Exemple #1
0
        private void UpdateState(State state)
        {
            if (state.Equals(lastState))
            {
                return;
            }

            TracedScreenPoint[] path = GetUserRegion()
                                       .GetPath(CoordinateSystemUtilities.GetBounds(csi, state.center, state.size),
                                                state.center.zoom,
                                                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 <ClickableThing> list2 = new List <ClickableThing>();
            List <ClickableThing> list3 = new List <ClickableThing>();

            for (int j = 0; j < count; j++)
            {
                ClickableThing clickableThing = new 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 = ClickableThing.ClickedWhich.Vertex;
                clickableThing.pointIndex   = j;
                ClickableThing clickableThing2 = new 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 = ClickableThing.ClickedWhich.Segment;
                clickableThing2.pointIndex   = j;
            }

            list2.AddRange(list3);
            clickableThings = list2.ToArray();
            lastState       = new State(state);
        }
Exemple #2
0
 public MapRectangle GetBounds()
 {
     return(CoordinateSystemUtilities.GetBounds(this.baseLayer.GetDefaultCoordinateSystem(), this.center().llz, base.Size));
 }