Exemple #1
0
        /// <summary>
        /// Update the mouse manager.
        /// </summary>
        public override void Update(bool isActive)
        {
            //clear out the taps & touches
            Clicks.Clear();
            Highlights.Clear();
            Drags.Clear();
            Drops.Clear();
            Flicks.Clear();
            Pinches.Clear();

            if (null != Pinch)
            {
                //reset the pinch delta
                Pinch.Delta = 0f;
            }

            if (isActive)
            {
                TouchCollection = TouchPanel.GetState();

                //get the new taps & touches
                GetGestures();
                GetTouches();
            }

            //Add the pinch event if there is an ongoing gesture
            if (null != Pinch)
            {
                Pinches.Add(new PinchEventArgs(Pinch.Delta));
            }
        }
        //private readonly Action _graphicObjectSelected;
        //private readonly Action _verticleSelected;
        //private readonly Func<int, bool> _lineSelected;
        //private readonly Action _nullSelected;
        //private readonly Action _circleSelected;


        private void DrawCircle()
        {
            var circle = new Circle(Clicks.Last(), Radius, Drawing, GuidMapLogic, Width);

            GraphicObjects.Add(circle.Guid, circle);
            circle.DrawItself();
            circle.DrawOnGuidMap();
            //GuidMapLogic.SetOnMap(circle);
            Clicks.Clear();
        }
        public void SetAction(FormAction action)
        {
            if (_formAction == FormAction.SelectLine && action != FormAction.SelectLine)
            {
                Redraw();
            }

            if (NewObjectsActions.Contains(action))
            {
                SelectedObject = null;
                //_clicksOther.Clear();
            }

            _formAction = action;
            if (action == FormAction.StartDrawPolygon)
            {
                _buttonControl.StartDrawingPoligon();
                Clicks.Clear();
            }
            if (action == FormAction.StopDrawPolygon)
            {
                StopDrawPolygon();
            }
            else if (action == FormAction.ClearBitmap)
            {
                ClearMap();
            }
            else if (action == FormAction.DeleteObject)
            {
                DeleteObject();
            }
            else if (action == FormAction.DrawCircleOptimized)
            {
                _buttonControl.CircleSelected(Radius);
            }
            else if (action == FormAction.AddVerticle)
            {
                AddVerticle();
            }
            else if (action == FormAction.SetHorizontal)
            {
                SetHorizontal();
            }
            else if (action == FormAction.SetVertical)
            {
                SetVertical();
            }
            else if (action == FormAction.SetConcrentic)
            {
                Clicks.Clear();
                ConnectedCircles.Clear();
            }
            //else if(action == FormAction.RedrawBitmap)
            //    Redraw();
        }
 private void DrawLine()
 {
     if (Clicks.Count == 2)
     {
         var line = new Line(Clicks[0], Clicks[1], Width, Drawing, GuidMapLogic);
         line.DrawItself();
         GraphicObjects.Add(line.Guid, line);
         GraphicObjects.Add(line.StartVerticle.Guid, line.StartVerticle);
         GraphicObjects.Add(line.EndVerticle.Guid, line.EndVerticle);
         line.DrawOnGuidMap();
         Clicks.Clear();
     }
 }
Exemple #5
0
        /// <summary>
        /// Update the mouse manager.
        /// </summary>
        public override void Update(bool isActive)
        {
            //clear out the taps & touches
            Clicks.Clear();
            Highlights.Clear();
            Drags.Clear();
            Drops.Clear();
            Flicks.Clear();
            Pinches.Clear();
            Holds.Clear();

            if (null != Pinch)
            {
                //reset the pinch delta
                Pinch.Delta = 0f;
            }

            if (isActive && IsEnabled)
            {
                TouchCollection = TouchPanel.GetState();

                //get the new taps & touches
                GetGestures();
                GetTouches();
            }

            //Add the pinch event if there is an ongoing gesture
            if (null != Pinch)
            {
                if (Pinch.Finished)
                {
                    Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta)
                    {
                        Release = true
                    });
                    Pinch = null;
                }
                else
                {
                    Pinches.Add(new PinchEventArgs(Pinch.First, Pinch.Second, Pinch.Delta));
                }
            }
        }
        private void StopDrawPolygon()
        {
            if (Clicks.Count > 2)
            {
                var line = new Line(Clicks.Last(), Clicks.First(), Width, Drawing, GuidMapLogic, CurrentPolygon);
                CurrentPolygon.AddLastLine(line);
                line.DrawItself();

                CurrentPolygon
                .Lines.ForEach(poligonLine => GraphicObjects.Add(poligonLine.Guid, poligonLine));

                CurrentPolygon
                .Verticies.ForEach(poligonVerticle => GraphicObjects.Add(poligonVerticle.Guid, poligonVerticle));

                CurrentPolygon.DrawOnGuidMap();
                //GuidMapLogic.SetOnMap(CurrentPolygon);
            }
            _buttonControl.StopDrawingPoligon();
            Clicks.Clear();
        }
 private void CreatePoint()
 {
     Drawing.SetPixel(Clicks.Last(), Width);
     Clicks.Clear();
 }