Example #1
0
 public void Start()
 {
     if (ZonesLayer != null) return;
     ZonesLayer = new GraphicsLayer { ID = Id };
     ZonesLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, ZonesLayer);
 }
Example #2
0
 public void Start()
 {
     if (explosionLayer != null) return;
     explosionLayer = new GraphicsLayer { ID = Id };
     explosionLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, explosionLayer);
 }
Example #3
0
 public void Start()
 {
     if (circleLayer != null) return;
     circleLayer = new GraphicsLayer { ID = Id, IsHitTestVisible = false };
     circleLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, circleLayer);
 }
Example #4
0
 /// <summary>
 /// Started only once in a service
 /// </summary>
 public void Start()
 {
     if (QueryLayer != null) return;
     QueryLayer = new GraphicsLayer { ID = Id };
     QueryLayer.Initialize();
     var dsBaseLayer = (dsBaseLayer)Layer;
     if (dsBaseLayer != null) dsBaseLayer.ChildLayers.Insert(0, QueryLayer);
 }
Example #5
0
        }         // public string getAGSMapServiceUrl()

        /// <summary>
        /// Create and add to map a simple graphics layer, or return existed GL
        /// </summary>
        /// <returns>redline layer</returns>
        public static GraphicsLayer makeRLLayer(Map map, string layerID, string layerName)
        {
            if (map != null)
            {
                var graphicsLayer = map.Layers[layerID] as GraphicsLayer;
                if (graphicsLayer != null)
                {
                    string.Format("VLayer.makeRLLayer, layer already exists, id '{0}'", layerID).clog();
                    return(graphicsLayer);
                }
            }

            string.Format("VLayer.makeRLLayer, create new GraphicsLayer, id '{0}'", layerID).clog();
            // don't react on hover
            var symbPMS = new PictureMarkerSymbol()
            {
                Height  = 28,
                Width   = 28,
                OffsetX = 14,
                OffsetY = 28,
                Source  = new System.Windows.Media.Imaging.BitmapImage(
                    new Uri("/Images/MarkerSymbols/Basic/RedTag.png", UriKind.RelativeOrAbsolute))
            };
            // react on hover
            var symbIFS = new ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol()
            {
                Source = "/Images/MarkerSymbols/Basic/RedTag.png",
                //OffsetX = 14, OffsetY = 28,
                Size    = 28,
                OriginX = 0.5, OriginY = 1
            };

            var gl = new GraphicsLayer()
            {
                ID       = layerID,
                Renderer = new SimpleRenderer()
                {
                    Symbol = symbIFS                     // new SimpleMarkerSymbol()
                },
                RendererTakesPrecedence = false
            };

            //ESRI.ArcGIS.Client.Extensibility.LayerProperties.SetIsPopupEnabled(gl, false);

            // Set layer name in Map Contents
            //gl.SetValue(MapApplication.LayerNameProperty, lyrName);
            //* Remove the line that says "wmsLayer.SetValue(MapApplication.LayerNameProperty, layerName);" and replace it with "MapApplication.SetLayerName(wmsLayer, layerName);"
            //* http://forums.arcgis.com/threads/51206-Adding-WMS-Service?p=178500&viewfull=1#post178500
            //MapApplication.SetLayerName(gl, lyrName);

            if (map != null)
            {
                gl.Initialize();
                map.Layers.Add(gl);
                MapApplication.SetLayerName(gl, layerName);
            }
            return(gl);
        } // public static GraphicsLayer makeRLLayer(Map map, string layerID, string layerName)
Example #6
0
 public void Start()
 {
     if (GridLayer != null) return;
     GridLayer = new GraphicsLayer { ID = Id, Opacity = 0.3 };
     GridLayer.MapTip = CreateMapTip();
     GridLayer.MaximumResolution = 12;
     GridLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, GridLayer);
 }
Example #7
0
 public void Start()
 {
     if (tracksLayer != null) return;
     tracksLayer                 = new GraphicsLayer {
         ID                      = Id,
         RenderingMode           = GraphicsLayerRenderingMode.Static,
         RendererTakesPrecedence = false
     };
     tracksLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, tracksLayer);
 }
Example #8
0
        public override void Initialize()
        {
            if (LayerFile == null || !File.Exists(LayerFile)) return;
            var fileInfo = new FileInfo(LayerFile);
            if (fileInfo.Directory != null) ID = fileInfo.Directory.Name;

            Graphics = new GraphicsLayer();
            ChildLayers.Add(Graphics);
            Graphics.Initialize();

            ID = "Presenter Layer";
            base.Initialize();
            SpatialReference = new SpatialReference(4326);
            ChildLayers.Insert(0, el);
            UpdateLayer();
        }
Example #9
0
 public ucBagGeoCodingTool()
 {
     InitializeComponent();
     Loaded += UcPlacemarkLoaded;
     var layer = AppState.ViewDef.MapToolsLayer;
     var l = layer.ChildLayers.FirstOrDefault(k => k.ID == "BagGeo") as GraphicsLayer;
     if (l != null)
     {
         gLayer = l;
     }
     else
     {
         gLayer = new GraphicsLayer { ID = "BagGeo" };
         layer.ChildLayers.Add(gLayer);
         gLayer.Initialize();
     }
 }
Example #10
0
 public ucGeoCodingTool()
 {
     InitializeComponent();
     Loaded += UcPlacemarkLoaded;
     _layer = AppState.ViewDef.MapToolsLayer;
     Layer l = _layer.ChildLayers.FirstOrDefault(k => k.ID == "Geo");
     if (l != null && l is GraphicsLayer)
     {
         gLayer = (GraphicsLayer)l;
     }
     else
     {
         gLayer = new GraphicsLayer { ID = "Geo" };
         _layer.ChildLayers.Add(gLayer);
         gLayer.Initialize();
     }
 }
Example #11
0
        }         // private GraphicsLayer getRLLayer()

        /// <summary>
        /// Add RL layer to map or return already existing layer
        /// </summary>
        /// <param name="rl"></param>
        /// <returns></returns>
        private GraphicsLayer addRLL2Map(GraphicsLayer gl)
        {
            log(string.Format("VRedlineImpl.addRLL2Map, initialize and add to map RL layer"));
            var el = MapApplication.Current.Map.Layers[gl.ID] as GraphicsLayer;

            if (el != null)
            {
                log(string.Format("VRedlineImpl.addRLL2Map, layer already exist"));
                return(el);
            }

            //var lyr = MapApplication.Current.SelectedLayer;

            gl.MouseLeftButtonDown -= gl_MouseLeftButtonDown;
            gl.MouseLeftButtonDown += gl_MouseLeftButtonDown;
            gl.Initialize();
            MapApplication.Current.Map.Layers.Add(gl);
            MapApplication.SetLayerName(gl, layerName);

            //MapApplication.Current.SelectedLayer = lyr;
            //ESRI.ArcGIS.Client.Extensibility.LayerProperties.SetIsPopupEnabled(gl, false);
            return(gl);
        }         // private GraphicsLayer addRLL2Map(GraphicsLayer rl)
Example #12
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            Start = new csPoint() { Mp = start };
            Finish = new csPoint() { Mp = finish };
            MLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();

            LineSymbol ls = new LineSymbol() { Color = Brushes.Black, Width = 4 };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            _start.Geometry = start;
            _start.Attributes["position"] = start;

            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["measure"] = this;
            _start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["measure"] = this;
            _finish.Attributes["state"] = "finish";
            MLayer.Graphics.Add(_finish);

            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

        }
Example #13
0
        public void Add()
        {            
            GroupLayer gl = AppState.ViewDef.FindOrCreateGroupLayer(@"Wikipedia");

            GraphicsLayer lWiki = new GraphicsLayer() {ID = "Wiki Search: " + Keyword};
            gl.ChildLayers.Add(lWiki);
            lWiki.Initialize();
            WebClient wc = new WebClient();
            wc.DownloadStringCompleted += (e, s) =>
                                              {
                                                  if (s.Error == null)
                                                  {
                                                      Results.Clear();
                                                      XDocument xdoc = XDocument.Parse(s.Result);
                                                      foreach (var a in xdoc.Root.Elements("entry"))
                                                      {
                                                          WikiSearchResult wsr = new WikiSearchResult()
                                                                                     {
                                                                                         Title =
                                                                                             a.Element("title").Value,
                                                                                         Summary =
                                                                                             a.Element("summary").Value,
                                                                                         WikiUrl =
                                                                                             a.Element("wikipediaUrl").
                                                                                             Value,
                                                                                         ImageUrl =
                                                                                             a.Element("thumbnailImg").
                                                                                             Value
                                                                                     };
                                                          double lat = Convert.ToDouble(a.Element("lat").Value,
                                                                                        CultureInfo.InvariantCulture);
                                                          double lon = Convert.ToDouble(a.Element("lng").Value,
                                                                                        CultureInfo.InvariantCulture);

                                                          wsr.Position =
                                                              (MapPoint) _wm.FromGeographic(new MapPoint(lon, lat));

                                                          Results.Add(wsr);
                                                          if (wsr.ImageUrl!="")
                                                          {
                                                              Graphic g = new Graphic();
                                                              
                                                              g.Symbol = new PictureMarkerSymbol()
                                                                             {
                                                                                 Source =
                                                                                     new BitmapImage(
                                                                                     new Uri(wsr.ImageUrl)),
                                                                                 Width = 30,
                                                                                 OffsetX = 15,
                                                                                 OffsetY = 15
                                                                             };
                                                              g.Geometry = wsr.Position;
                                                              lWiki.Graphics.Add(g);
                                                          }
                                                      }
                                                  }
                                              };
            wc.DownloadStringAsync(new Uri(@"http://api.geonames.org/wikipediaSearch?q=" + Keyword + @"&maxRows=100&username=damylen"));

        }
Example #14
0
        public override void Start()
        {
            base.Start();

            var baseLayer = ((dsBaseLayer)Model.Layer);
            if (OperatingMode == FieldOfViewOperatingMode.Image)
            {
                if (ImageLayer != null) return;
                var displayName = Model.Id + " FoV img";
                ImageLayer = baseLayer.ChildLayers.OfType<ElementLayer>().FirstOrDefault(c => string.Equals(c.DisplayName, displayName, StringComparison.InvariantCultureIgnoreCase));
                if (ImageLayer == null)
                {
                    ImageLayer = new ElementLayer { ID = displayName, DisplayName = displayName };
                    ImageLayer.Initialize();
                    baseLayer.ChildLayers.Insert(0, ImageLayer);
                    AppState.ViewDef.UpdateLayers();
                }
            }
            else
            {
                if (GraphicsLayer != null) return;
                var displayName = Model.Id + " FoV";
                GraphicsLayer = baseLayer.ChildLayers.OfType<GraphicsLayer>().FirstOrDefault(c => string.Equals(c.DisplayName, displayName, StringComparison.InvariantCultureIgnoreCase));
                if (GraphicsLayer == null)
                {
                    GraphicsLayer = new GraphicsLayer { ID = displayName, DisplayName = displayName };
                    GraphicsLayer.Initialize();
                    baseLayer.ChildLayers.Insert(0, GraphicsLayer);
                    AppState.ViewDef.UpdateLayers();
                }
            }

            color = Model.Model.GetColor("Color", Colors.Blue);
            strokeWidth = Model.Model.GetInt("StrokeWidth", 2);
            precision = Model.Model.GetInt("Precision", 2);

            ManagePoiVisibility();
            //this.operatingMode = FieldOfViewOperatingMode.Polygon;

            switch (OperatingMode)
            {
                case FieldOfViewOperatingMode.Polygon:
                    if (GraphicsLayer == null) return;
                    remoteClient.ComputeFieldOfViewAsVectorCompleted += ClientOnComputeFieldOfViewAsVectorCompleted;
                    localClient.ComputeFieldOfViewAsVectorCompleted += ClientOnComputeFieldOfViewAsVectorCompleted;
                    break;
                default:
                    if (ImageLayer == null) return;
                    remoteClient.ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewAsImageCompleted;
                    localClient.ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewAsImageCompleted;

                    image = new Image
                    {
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        VerticalAlignment = VerticalAlignment.Stretch,
                        Stretch = Stretch.Fill,
                        StretchDirection = StretchDirection.Both
                    };

                    ElementLayer.SetEnvelope(image, AppStateSettings.Instance.ViewDef.MapControl.Extent);
                    ImageLayer.Children.Add(image);
                    break;
            }

            var posChanged = Observable.FromEventPattern<PositionEventArgs>(ev => Poi.PositionChanged += ev, ev => Poi.PositionChanged -= ev);
            posChanged.Throttle(TimeSpan.FromMilliseconds(150)).Subscribe(k => Calculate());

            var labelChanged = Observable.FromEventPattern<LabelChangedEventArgs>(ev => Poi.LabelChanged += ev, ev => Poi.LabelChanged -= ev);
            labelChanged.Throttle(TimeSpan.FromMilliseconds(150)).Subscribe(k => Calculate());
            Calculate();
        }
Example #15
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            startPoint = new csPoint
            {
                Mp = start
            };
            finishPoint = new csPoint
            {
                Mp = finish
            };
            MLayer = new GraphicsLayer
            {
                ID = Guid.NewGuid().ToString()
            };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();

            var ls = new LineSymbol
            {
                Color = Brushes.Black,
                Width = 4
            };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            _start.Geometry = start;
            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["position"] = start;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["measure"] = this;
            _start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["measure"] = this;
            _finish.Attributes["state"] = "finish";
            _finish.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_finish);

            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

            if (AppState.Imb != null && AppState.Imb.Imb != null)
            {
                _3d = AppState.Imb.Imb.Publish(AppState.Imb.Imb.ClientHandle + ".3d");
                //AppState.Imb.Imb.Publish(_channel);
            }

            _updateTimer.Interval = 50;
            _updateTimer.Elapsed += UpdateTimerElapsed;
            _updateTimer.Start();
        }
Example #16
0
        }         // public void userGiveCSVLayerParams(string url, string lyrname, string proxy)

        /// <summary>
        /// Call from form, add to map graphicslayer from json
        /// </summary>
        /// <param name="url"></param>
        /// <param name="lyrname"></param>
        /// <param name="proxy"></param>
        public void userGiveJSONLayerParams(string url, string lyrname, string proxy)
        {
            log(string.Format("userGiveJSONLayerParams, name '{2}', url '{0}', proxy '{1}'", url, proxy, lyrname));
            MapApplication.Current.HideWindow(jsonParamsForm);

            var requrl = string.IsNullOrEmpty(proxy) ? url : string.Format("{0}?{1}", proxy, url);

            // get json text
            WebClient wc  = new WebClient();
            Uri       uri = new Uri(requrl, UriKind.RelativeOrAbsolute);

            wc.OpenReadCompleted += (sender, args) => {
                if (args.Error != null)
                {
                    log(String.Format("userGiveJSONLayerParams wc_OpenReadCompleted, error in reading answer, msg [{0}], trace [{1}]",
                                      args.Error.Message, args.Error.StackTrace));
                }
                else
                {
                    try {
                        StreamReader reader = new StreamReader(args.Result);
                        string       text   = reader.ReadToEnd();
                        log(string.Format("userGiveJSONLayerParams wc_OpenReadCompleted, resp '{0}'", text));

                        // got layer content, make layer
                        var featureSet    = FeatureSet.FromJson(text);
                        var graphicsLayer = new GraphicsLayer()
                        {
                            Graphics = new GraphicCollection(featureSet)
                        };
                        // set layer params
                        graphicsLayer.Opacity      = 1;
                        graphicsLayer.ID           = VExtClass.computeSHA1Hash(string.Format("{0}", text));
                        graphicsLayer.Initialized += (osender, eargs) => {
                            log(string.Format("userGiveJSONLayerParams.Initialized, {0}-{1}", lyrname, graphicsLayer.ID));
                        };

                        // projection
                        var MyMap    = MapApplication.Current.Map;
                        var mercator = new ESRI.ArcGIS.Client.Projection.WebMercator();
                        if (!featureSet.SpatialReference.Equals(MyMap.SpatialReference))
                        {
                            if (MyMap.SpatialReference.Equals(new SpatialReference(102100)) &&
                                featureSet.SpatialReference.Equals(new SpatialReference(4326)))
                            {
                                foreach (Graphic g in graphicsLayer.Graphics)
                                {
                                    g.Geometry = mercator.FromGeographic(g.Geometry);
                                }
                            }

                            else if (MyMap.SpatialReference.Equals(new SpatialReference(4326)) &&
                                     featureSet.SpatialReference.Equals(new SpatialReference(102100)))
                            {
                                foreach (Graphic g in graphicsLayer.Graphics)
                                {
                                    g.Geometry = mercator.ToGeographic(g.Geometry);
                                }
                            }

                            else
                            {
                                var geometryService = new GeometryService(
                                    "http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

                                geometryService.ProjectCompleted += (s, a) => {
                                    for (int i = 0; i < a.Results.Count; i++)
                                    {
                                        graphicsLayer.Graphics[i].Geometry = a.Results[i].Geometry;
                                    }
                                };

                                geometryService.Failed += (s, a) => {
                                    MessageBox.Show("Ошибка проецирования: " + a.Error.Message);
                                };

                                geometryService.ProjectAsync(graphicsLayer.Graphics, MyMap.SpatialReference);
                            }
                        }                         // if map.SR != featureset.SR

                        // add layer to map
                        graphicsLayer.Initialize();
                        MapApplication.SetLayerName(graphicsLayer, lyrname);
                        ESRI.ArcGIS.Client.Extensibility.LayerProperties.SetIsVisibleInMapContents(graphicsLayer, true);
                        MapApplication.Current.Map.Layers.Add(graphicsLayer);
                    }                     // got json text
                    catch (Exception ex) {
                        log(String.Format("userGiveJSONLayerParams wc_OpenReadCompleted, make layer failed {0}, {1}", ex.Message, ex.StackTrace));
                    }
                }
            };             // wc.OpenReadCompleted
            wc.OpenReadAsync(uri);

            log(string.Format("userGiveJSONLayerParams, done for name '{2}', url '{0}', proxy '{1}'", url, proxy, lyrname));
        }         // public void userGiveJSONLayerParams(string url, string lyrname, string proxy)
Example #17
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            remoteClient.ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewCompleted;
            localClient .ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewCompleted;

            StartPoint = new csPoint
            {
                Mp = start
            };
            FinishPoint = new csPoint
            {
                Mp = finish
            };
            MLayer = new GraphicsLayer
            {
                ID = Guid.NewGuid().ToString()
            };

            ImageLayer = new ElementLayer();
            Image = new System.Windows.Controls.Image
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch,
                Stretch = Stretch.Fill,
                StretchDirection = StretchDirection.Both
            };
            ElementLayer.SetEnvelope(Image, AppState.ViewDef.MapControl.Extent);
            ImageLayer.Children.Add(Image);

            Start = new Graphic();
            Finish = new Graphic();
            Line = new Graphic();

            var ls = new LineSymbol
            {
                Color = Brushes.Black,
                Width = 4
            };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            Start.Geometry = start;
            Start.Symbol = rd["Start"] as Symbol;
            Start.Attributes["position"] = start;
            Start.Attributes["finish"] = Finish;
            Start.Attributes["start"] = Start;
            Start.Attributes["line"] = Line;
            Start.Attributes["state"] = "start";
            Start.Attributes["measure"] = this;
            Start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(Start);

            Finish.Geometry = finish;
            Finish.Attributes["position"] = finish;
            Finish.Symbol = rd["Finish"] as Symbol;
            Finish.Attributes["finish"] = Finish;
            Finish.Attributes["start"] = Start;
            Finish.Attributes["line"] = Line;
            Finish.Attributes["measure"] = this;
            Finish.Attributes["state"] = "finish";
            Finish.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(Finish);
            Layer.ChildLayers.Add(ImageLayer);
            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

            if (AppState.Imb != null && AppState.Imb.Imb != null)
            {
                _3D = AppState.Imb.Imb.Publish(AppState.Imb.Imb.ClientHandle + ".3d");
                //AppState.Imb.Imb.Publish(_channel);
            }

            updateTimer.Interval = 50;
            updateTimer.Elapsed += UpdateTimerElapsed;
            updateTimer.Start();
        }
Example #18
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            Start = new EffectsPoint() { Mp = start };
            Finish = new EffectsPoint() { Mp = finish };
            MLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            ContoursLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();
            BaseEffectsModelShapes = new GraphicCollection();
            EffectsModelShapes = new GraphicCollection();

            
            
//            var testJson = new FileInfo(@"Plugins\USDomainPlugin\Effects\Data\testshape.json");
//            JObject geoJson = null;
//            using (var reader = testJson.OpenText())
//            {
//                var strJson = reader.ReadToEnd();
//                geoJson = JObject.Parse(strJson);
//                reader.Close();
//            }
//            var strWkt = @"POLYGON ((281.4968022018320000 0,281.3579005227060000 8.8420282352252900,280.9413325645150000 17.6753304560934000,280.2475094295410000 26.4911892597699000,279.2771158374510000 35.2809044579670000,278.0311094495650000 44.0358016629793000,276.5107199237550000 52.7472408482570000,274.7174477009240000 61.4066248750691000,272.6530625242520000 70.0054079768411000,270.3196016926710000 78.5351041927953000,267.7193680503000000 86.9872957425693000,264.8549277138150000 95.3536413335488000,261.7291075400000000 103.6258843927170000,258.3449923359800000 111.7958612148940000,254.7059218148940000 119.8555090193290000,250.8154872999950000 127.7968739066940000,246.6775281804520000 135.6121187086160000,242.2961281223330000 143.2935307220230000,237.6756110385240000 150.8335293206440000,232.8205368215440000 158.2246734361790000,227.7356968434850000 165.4596689017280000,222.4261092275060000 172.5313756502600000,216.8970138955490000 179.4328147609900000,211.1538673971700000 186.1571753467370000,205.2023375245860000 192.6978212754450000,199.0482977192440000 199.0482977192440000,192.6978212754450000 205.2023375245860000,186.1571753467370000 211.1538673971700000,179.4328147609900000 216.8970138955490000,172.5313756502600000 222.4261092275060000,165.4596689017280000 227.7356968434850000,158.2246734361790000 232.8205368215440000,150.8335293206440000 237.6756110385240000,143.2935307220230000 242.2961281223330000,135.6121187086160000 246.6775281804520000,127.7968739066940000 250.8154872999950000,119.8555090193290000 254.7059218148940000,111.7958612148940000 258.3449923359800000,103.6258843927170000 261.7291075400000000,95.3536413335487000 264.8549277138150000,86.9872957425692000 267.7193680503000000,78.5351041927953000 270.3196016926710000,70.0054079768411000 272.6530625242520000,61.4066248750690000 274.7174477009240000,52.7472408482570000 276.5107199237550000,44.0358016629793000 278.0311094495650000,35.2809044579670000 279.2771158374510000,26.4911892597699000 280.2475094295410000,17.6753304560934000 280.9413325645150000,8.8420282352253100 281.3579005227060000,0.0000000000000172 281.4968022018320000,-8.8420282352252800 281.3579005227060000,-17.6753304560934000 280.9413325645150000,-26.4911892597699000 280.2475094295410000,-35.2809044579670000 279.2771158374510000,-44.0358016629793000 278.0311094495650000,-52.7472408482571000 276.5107199237550000,-61.4066248750690000 274.7174477009240000,-70.0054079768410000 272.6530625242520000,-78.5351041927953000 270.3196016926710000,-86.9872957425692000 267.7193680503000000,-95.3536413335488000 264.8549277138150000,-103.6258843927170000 261.7291075400000000,-111.7958612148940000 258.3449923359800000,-119.8555090193300000 254.7059218148940000,-127.7968739066940000 250.8154872999950000,-135.6121187086170000 246.6775281804520000,-143.2935307220230000 242.2961281223330000,-150.8335293206440000 237.6756110385240000,-158.2246734361790000 232.8205368215440000,-165.4596689017280000 227.7356968434850000,-172.5313756502600000 222.4261092275060000,-179.4328147609900000 216.8970138955490000,-186.1571753467370000 211.1538673971700000,-192.6978212754450000 205.2023375245860000,-199.0482977192440000 199.0482977192440000,-205.2023375245860000 192.6978212754450000,-211.1538673971700000 186.1571753467370000,-216.8970138955490000 179.4328147609900000,-222.4261092275060000 172.5313756502600000,-227.7356968434850000 165.4596689017280000,-232.8205368215440000 158.2246734361790000,-237.6756110385240000 150.8335293206440000,-242.2961281223330000 143.2935307220230000,-246.6775281804520000 135.6121187086160000,-250.8154872999950000 127.7968739066940000,-254.7059218148940000 119.8555090193290000,-258.3449923359800000 111.7958612148940000,-261.7291075400000000 103.6258843927170000,-264.8549277138150000 95.3536413335488000,-267.7193680503000000 86.9872957425693000,-270.3196016926710000 78.5351041927953000,-272.6530625242520000 70.0054079768411000,-274.7174477009240000 61.4066248750690000,-276.5107199237550000 52.7472408482571000,-278.0311094495650000 44.0358016629793000,-279.2771158374510000 35.2809044579671000,-280.2475094295410000 26.4911892597699000,-280.9413325645150000 17.6753304560935000,-281.3579005227060000 8.8420282352252700,-281.4968022018320000 0.0000000000000345,-281.3579005227060000 -8.8420282352253200,-280.9413325645150000 -17.6753304560934000,-280.2475094295410000 -26.4911892597699000,-279.2771158374510000 -35.2809044579670000,-278.0311094495650000 -44.0358016629794000,-276.5107199237550000 -52.7472408482570000,-274.7174477009240000 -61.4066248750692000,-272.6530625242520000 -70.0054079768412000,-270.3196016926710000 -78.5351041927953000,-267.7193680503000000 -86.9872957425693000,-264.8549277138150000 -95.3536413335488000,-261.7291075400000000 -103.6258843927170000,-258.3449923359800000 -111.7958612148940000,-254.7059218148940000 -119.8555090193290000,-250.8154872999950000 -127.7968739066940000,-246.6775281804520000 -135.6121187086160000,-242.2961281223330000 -143.2935307220230000,-237.6756110385240000 -150.8335293206440000,-232.8205368215440000 -158.2246734361790000,-227.7356968434850000 -165.4596689017280000,-222.4261092275060000 -172.5313756502600000,-216.8970138955490000 -179.4328147609900000,-211.1538673971700000 -186.1571753467370000,-205.2023375245860000 -192.6978212754450000,-199.0482977192440000 -199.0482977192440000,-192.6978212754450000 -205.2023375245860000,-186.1571753467370000 -211.1538673971700000,-179.4328147609900000 -216.8970138955490000,-172.5313756502600000 -222.4261092275060000,-165.4596689017280000 -227.7356968434850000,-158.2246734361790000 -232.8205368215440000,-150.8335293206440000 -237.6756110385240000,-143.2935307220230000 -242.2961281223330000,-135.6121187086160000 -246.6775281804520000,-127.7968739066940000 -250.8154872999950000,-119.8555090193290000 -254.7059218148940000,-111.7958612148940000 -258.3449923359800000,-103.6258843927170000 -261.7291075400000000,-95.3536413335488000 -264.8549277138150000,-86.9872957425693000 -267.7193680503000000,-78.5351041927954000 -270.3196016926710000,-70.0054079768412000 -272.6530625242520000,-61.4066248750690000 -274.7174477009240000,-52.7472408482570000 -276.5107199237550000,-44.0358016629793000 -278.0311094495650000,-35.2809044579671000 -279.2771158374510000,-26.4911892597698000 -280.2475094295410000,-17.6753304560934000 -280.9413325645150000,-8.8420282352252900 -281.3579005227060000,-0.0000000000000517 -281.4968022018320000,8.8420282352251800 -281.3579005227060000,17.6753304560935000 -280.9413325645150000,26.4911892597699000 -280.2475094295410000,35.2809044579670000 -279.2771158374510000,44.0358016629792000 -278.0311094495650000,52.7472408482572000 -276.5107199237550000,61.4066248750692000 -274.7174477009240000,70.0054079768411000 -272.6530625242520000,78.5351041927953000 -270.3196016926710000,86.9872957425694000 -267.7193680503000000,95.3536413335489000 -264.8549277138150000,103.6258843927170000 -261.7291075400000000,111.7958612148940000 -258.3449923359800000,119.8555090193290000 -254.7059218148940000,127.7968739066940000 -250.8154872999950000,135.6121187086160000 -246.6775281804520000,143.2935307220230000 -242.2961281223330000,150.8335293206440000 -237.6756110385240000,158.2246734361790000 -232.8205368215440000,165.4596689017280000 -227.7356968434850000,172.5313756502600000 -222.4261092275060000,179.4328147609900000 -216.8970138955490000,186.1571753467370000 -211.1538673971700000,192.6978212754450000 -205.2023375245860000,199.0482977192440000 -199.0482977192440000,205.2023375245860000 -192.6978212754450000,211.1538673971700000 -186.1571753467370000,216.8970138955490000 -179.4328147609900000,222.4261092275060000 -172.5313756502600000,227.7356968434850000 -165.4596689017280000,232.8205368215440000 -158.2246734361790000,237.6756110385240000 -150.8335293206440000,242.2961281223330000 -143.2935307220230000,246.6775281804520000 -135.6121187086160000,250.8154872999950000 -127.7968739066940000,254.7059218148940000 -119.8555090193290000,258.3449923359800000 -111.7958612148940000,261.7291075400000000 -103.6258843927170000,264.8549277138150000 -95.3536413335488000,267.7193680503000000 -86.9872957425693000,270.3196016926710000 -78.5351041927954000,272.6530625242520000 -70.0054079768413000,274.7174477009240000 -61.4066248750690000,276.5107199237550000 -52.7472408482570000,278.0311094495650000 -44.0358016629794000,279.2771158374510000 -35.2809044579671000,280.2475094295410000 -26.4911892597698000,280.9413325645150000 -17.6753304560934000,281.3579005227060000 -8.8420282352253000,281.4968022018320000 -0.0000000000000689))";

//            BaseEffectsModelShapes.AddRange(geoJson.ToGraphic(new SpatialReference(28992)));
//            BaseEffectsModelShapes.AddRange(strWkt.ToGraphic(new SpatialReference(28992)));
//            BaseEffectsModelShapes.ForEach(shape =>
//            {
//                var clone = new Graphic();
//                clone.Geometry = ((Polygon) shape.Geometry).Clone();
//                clone.Symbol = new SimpleFillSymbol
//                {
//                    BorderBrush = new SolidColorBrush(Colors.Black),
//                    BorderThickness = 4,
//                    Fill = new SolidColorBrush(Colors.Red) { Opacity = 0.8f }
//                };
//                clone.Attributes.Add("base", shape);
//                EffectsModelShapes.Add(clone);
//            });
//            ContoursLayer.Graphics.AddRange(EffectsModelShapes);
//            ContoursLayer.Graphics.AddRange(BaseEffectsModelShapes);
            Layer.ChildLayers.Add(ContoursLayer);
            Layer.ChildLayers.Add(MLayer);

            LineSymbol ls = new LineSymbol() { Color = Brushes.Black, Width = 4 };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);
            _start.Geometry = start;
            _start.Attributes["position"] = start;

            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["direction"] = this;
            _start.Attributes["menuenabled"] = true;

            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["direction"] = this;
            _finish.Attributes["state"] = "finish";
            MLayer.Graphics.Add(_finish);


            MLayer.Initialize();

            _start.SetZIndex(10);
            _finish.SetZIndex(10);
            Line.SetZIndex(10);

            SettingsViewModel = new EffectsModelSettingsViewModel();
            SettingsViewModel.PropertyChanged += SettingsViewModelOnPropertyChanged;
            SettingsViewModel.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

        }