Пример #1
0
        internal ViewerControl.MouseAction ImminentAction(MouseEventArgs e)
        {
            if (this.clickableThings == null)
            {
                return(null);
            }
            int i = 0;

            while (i < this.clickableThings.GetLength(0))
            {
                UserRegionViewController.ClickableThing clickableThing = this.clickableThings[i];
                if (clickableThing.vertexLocation.originalIndex >= 0 && clickableThing.path.IsVisible(e.Location))
                {
                    if (clickableThing.clickedWhich == UserRegionViewController.ClickableThing.ClickedWhich.Segment)
                    {
                        return(new UserRegionViewController.SegmentMouseAction(this, clickableThing.vertexLocation.originalIndex, e.Location));
                    }
                    return(new UserRegionViewController.VertexMouseAction(this, clickableThing.vertexLocation.originalIndex));
                }
                else
                {
                    i++;
                }
            }
            return(null);
        }
Пример #2
0
        private void UpdateState(UserRegionViewController.State state)
        {
            if (state.Equals(this.lastState))
            {
                return;
            }
            TracedScreenPoint[]      path = this.GetUserRegion().GetPath(CoordinateSystemUtilities.GetBounds(this.csi, state.center, state.size), state.center.zoom, this.csi);
            List <TracedScreenPoint> list = new List <TracedScreenPoint>();
            int length = path.GetLength(0);

            for (int i = 0; i < length; i++)
            {
                D.Assert(path[i].originalIndex >= 0);
                int num = (i + length - 1) % length;
                if (!(path[num].pointf == path[i].pointf))
                {
                    list.Add(path[i]);
                }
            }
            list.ToArray();
            int count = list.Count;
            List <UserRegionViewController.ClickableThing> list2 = new List <UserRegionViewController.ClickableThing>();
            List <UserRegionViewController.ClickableThing> list3 = new List <UserRegionViewController.ClickableThing>();

            for (int j = 0; j < count; j++)
            {
                UserRegionViewController.ClickableThing clickableThing = new UserRegionViewController.ClickableThing();
                list2.Add(clickableThing);
                clickableThing.vertexLocation = list[j];
                clickableThing.path           = new GraphicsPath();
                clickableThing.path.AddEllipse(list[j].pointf.X - 4f, list[j].pointf.Y - 4f, 8f, 8f);
                clickableThing.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Vertex;
                clickableThing.pointIndex   = j;
                UserRegionViewController.ClickableThing clickableThing2 = new UserRegionViewController.ClickableThing();
                list3.Add(clickableThing2);
                clickableThing2.vertexLocation = list[j];
                clickableThing2.path           = new GraphicsPath();
                clickableThing2.path.AddLine(list[j].pointf, list[(j + 1) % count].pointf);
                clickableThing2.path.Widen(new Pen(Color.Black, 4f));
                clickableThing2.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Segment;
                clickableThing2.pointIndex   = j;
            }
            list2.AddRange(list3);
            this.clickableThings = list2.ToArray();
            this.lastState       = new UserRegionViewController.State(state);
        }
Пример #3
0
 internal void Paint(PaintSpecification e, LatLonZoom center, Size size)
 {
     if (this.GetUserRegion() == null)
     {
         return;
     }
     UserRegionViewController.State state;
     state.center = center;
     state.size   = size;
     state.valid  = true;
     this.UpdateState(state);
     UserRegionViewController.ClickableThing[] array = this.clickableThings;
     for (int i = 0; i < array.Length; i++)
     {
         UserRegionViewController.ClickableThing clickableThing = array[i];
         e.Graphics.FillPath(this.segmentFillBrush, clickableThing.path);
     }
 }
Пример #4
0
 private void UpdateState(UserRegionViewController.State state)
 {
     if (state.Equals(this.lastState))
     {
         return;
     }
     TracedScreenPoint[] path = this.GetUserRegion().GetPath(CoordinateSystemUtilities.GetBounds(this.csi, state.center, state.size), state.center.zoom, this.csi);
     List<TracedScreenPoint> list = new List<TracedScreenPoint>();
     int length = path.GetLength(0);
     for (int i = 0; i < length; i++)
     {
         D.Assert(path[i].originalIndex >= 0);
         int num = (i + length - 1) % length;
         if (!(path[num].pointf == path[i].pointf))
         {
             list.Add(path[i]);
         }
     }
     list.ToArray();
     int count = list.Count;
     List<UserRegionViewController.ClickableThing> list2 = new List<UserRegionViewController.ClickableThing>();
     List<UserRegionViewController.ClickableThing> list3 = new List<UserRegionViewController.ClickableThing>();
     for (int j = 0; j < count; j++)
     {
         UserRegionViewController.ClickableThing clickableThing = new UserRegionViewController.ClickableThing();
         list2.Add(clickableThing);
         clickableThing.vertexLocation = list[j];
         clickableThing.path = new GraphicsPath();
         clickableThing.path.AddEllipse(list[j].pointf.X - 4f, list[j].pointf.Y - 4f, 8f, 8f);
         clickableThing.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Vertex;
         clickableThing.pointIndex = j;
         UserRegionViewController.ClickableThing clickableThing2 = new UserRegionViewController.ClickableThing();
         list3.Add(clickableThing2);
         clickableThing2.vertexLocation = list[j];
         clickableThing2.path = new GraphicsPath();
         clickableThing2.path.AddLine(list[j].pointf, list[(j + 1) % count].pointf);
         clickableThing2.path.Widen(new Pen(Color.Black, 4f));
         clickableThing2.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Segment;
         clickableThing2.pointIndex = j;
     }
     list2.AddRange(list3);
     this.clickableThings = list2.ToArray();
     this.lastState = new UserRegionViewController.State(state);
 }