コード例 #1
0
        public SpecialPointLayer GetLayer(double scale)
        {
            var images = _source.Get(scale);

            var locatables = new List <Locateable>();

            foreach (var imageGroup in images)
            {
                var locatable = new Locateable();

                locatable.AncherFunction = AncherFunctionHandlers.CenterCenter;

                locatable.X = imageGroup.Center.MercatorLocation.X;

                locatable.Y = imageGroup.Center.MercatorLocation.Y;

                //locatable.Element = new Common.View.MapMarkers.CountableImageMarker(imageSymbol, imageGroup.Frequency.ToString());

                locatable.Element = _viewMaker(imageGroup.Frequency.ToString());

                locatable.OnRequestHandleMouseDown += (sender, e) => { this.OnRequestMouseDownHandle.SafeInvoke(imageGroup); };

                locatables.Add(locatable);
            }

            return(new SpecialPointLayer(LayerName, locatables));
        }
コード例 #2
0
        private void Remove(Locateable mainLocateable)
        {
            if (_mainLocateables.Count <= 2)
            {
                return;
            }

            var index = _mainLocateables.IndexOf(mainLocateable);

            if (index > 0)
            {
                _controlLocateables.RemoveAt(2 * index - 1);

                _controlLayer.Items.RemoveAt(2 * index - 1);

                if (index == _mainLocateables.Count - 1)
                {
                    _controlLocateables.RemoveAt(2 * index - 2);

                    _controlLayer.Items.RemoveAt(2 * index - 2);
                }
                else
                {
                    _controlLocateables.RemoveAt(2 * index - 1);

                    _controlLayer.Items.RemoveAt(2 * index - 1);
                }
            }
            else
            {
                _controlLocateables.RemoveAt(0);

                _controlLocateables.RemoveAt(0);

                _controlLayer.Items.RemoveAt(0);

                _controlLayer.Items.RemoveAt(0);
            }

            _mainLocateables.Remove(mainLocateable);

            _mainLayer.Items.Remove(mainLocateable);

            mercatorPolyline.RemoveAt(index);

            Refresh();
        }
コード例 #3
0
        private void Add(Locateable mainLocateable)
        {
            var index = _mainLocateables.IndexOf(mainLocateable);

            if (index == 0)
            {
                return;
            }

            var point = new Ham.SpatialBase.Point((mainLocateable.X + _mainLocateables[index - 1].X) / 2.0, (mainLocateable.Y + _mainLocateables[index - 1].Y) / 2.0);

            var newMainLocateable = AsLocateable(point, Colors.Green);

            newMainLocateable.OnPositionChanged += mainLocateable_OnPositionChanged;

            newMainLocateable.Element.MouseRightButtonDown += (sender, e) =>
            {
                mainElement_MouseRightButtonDown(newMainLocateable, e);
            };

            var newControl1 = AsLocateable(point, Colors.Gray);

            newControl1.OnPositionChanged += controlLocateable_OnPositionChanged;

            var newControl2 = AsLocateable(point, Colors.Gray);

            newControl2.OnPositionChanged += controlLocateable_OnPositionChanged;

            _mainLocateables.Insert(index, newMainLocateable);

            mercatorPolyline.Insert(index, point);

            _controlLocateables.Insert(2 * index - 1, newControl2);

            _controlLocateables.Insert(2 * index - 1, newControl1);

            Refresh();
        }