Esempio n. 1
0
        public Mapper()
        {
            InitializeComponent();
            _map.IsLogoVisible         = false;
            this.scaleLine1.Visibility = System.Windows.Visibility.Visible;



            // extent (qq - think!)
            //var pt1 = MapUtil.ProjectPoint(new Point(0, -90));
            //var pt2 = MapUtil.ProjectPoint(new Point(360, 90));
            var pt1 = MapUtil.ProjectPoint(new Point(0, -40));
            var pt2 = MapUtil.ProjectPoint(new Point(360, 40));

            var extent = new ESRI.ArcGIS.Client.Geometry.Envelope(
                new ESRI.ArcGIS.Client.Geometry.MapPoint(pt1.X, pt1.Y),
                new ESRI.ArcGIS.Client.Geometry.MapPoint(pt2.X, pt2.Y));

            _map.Extent       = extent;
            _map.ZoomDuration = TimeSpan.Zero;//qqq

            _l1 = new ESRI.ArcGIS.Client.GraphicsLayer();
            this._map.Layers.Add(_l1);
            _l1.Initialize();//qq
            _l1.Visible = true;

            //this.legend1.LayerItems.Add(new ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel(_l1)); //qq

            this._map.Progress += new EventHandler <ESRI.ArcGIS.Client.ProgressEventArgs>(_map_Progress);

            //
            IsDirty = true;
        }
        void CitiesGraphicsLayerQueryTask_ExecuteCompleted(object sender, QueryEventArgs queryArgs)
        {
            if (queryArgs.FeatureSet == null)
            {
                return;
            }

            FeatureSet resultFeatureSet = queryArgs.FeatureSet;

            ESRI.ArcGIS.Client.GraphicsLayer graphicsLayer =
                MyMap.Layers["CitiesGraphicsLayer"] as ESRI.ArcGIS.Client.GraphicsLayer;

            if (resultFeatureSet != null && resultFeatureSet.Features.Count > 0)
            {
                foreach (ESRI.ArcGIS.Client.Graphic graphicFeature in resultFeatureSet.Features)
                {
                    graphicFeature.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                    graphicsLayer.Graphics.Add(graphicFeature);
                }
            }
        }