当前位置: 首页>>代码示例>>C#>>正文


C# GraphicsLayer类代码示例

本文整理汇总了C#中GraphicsLayer的典型用法代码示例。如果您正苦于以下问题:C# GraphicsLayer类的具体用法?C# GraphicsLayer怎么用?C# GraphicsLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GraphicsLayer类属于命名空间,在下文中一共展示了GraphicsLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindAnAddress

 public FindAnAddress()
 {
     this.InitializeComponent();
     MyMap.InitialExtent = GeometryEngine.Project(new Envelope(-122.554, 37.615, -122.245, 37.884, SpatialReference.Wgs84),
         SpatialReference.WebMercator) as Envelope;
     _candidateGraphicsLayer = MyMap.Layers["CandidateGraphicsLayer"] as GraphicsLayer;
 }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:7,代码来源:FindAnAddress.xaml.cs

示例2: CalculateViewshed

 public CalculateViewshed()
 {
     InitializeComponent();
     InitializePMS().ContinueWith((_) => { }, TaskScheduler.FromCurrentSynchronizationContext());
     mapView1.Map.InitialExtent = new Envelope(-12004035.9462375, 4652780.19374956, -11735714.4261546, 4808810.41937776);
     inputLayer = mapView1.Map.Layers["InputLayer"] as GraphicsLayer;
 }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:7,代码来源:CalculateViewshed.xaml.cs

示例3: addInput

        void addInput(ESRI.ArcGIS.Client.Geometry.Geometry geometry)
        {
            GraphicsLayer layer = getLayer();

            #region Create layer if not already there and add to map
            if (layer == null)
            {
                InputLayerID = Guid.NewGuid().ToString("N");
                layer = new GraphicsLayer();
                if (config.Layer != null)
                {
                    layer.Renderer = config.Layer.Renderer;
                    Core.LayerExtensions.SetFields(layer, Core.LayerExtensions.GetFields(config.Layer));
                    Core.LayerExtensions.SetGeometryType(layer, Core.LayerExtensions.GetGeometryType(config.Layer));
                    Core.LayerExtensions.SetDisplayField(layer, Core.LayerExtensions.GetDisplayField(config.Layer));
                    Core.LayerExtensions.SetPopUpsOnClick(layer, Core.LayerExtensions.GetPopUpsOnClick(config.Layer));
                    LayerProperties.SetIsPopupEnabled(layer, LayerProperties.GetIsPopupEnabled(config.Layer));
                }
                layer.ID = InputLayerID;

                layer.SetValue(MapApplication.LayerNameProperty,
                    string.IsNullOrEmpty(config.LayerName) ? 
                        string.IsNullOrEmpty(config.Label) ? config.Name : config.Label
                        : config.LayerName);
                layer.Opacity = config.Opacity;
                Map.Layers.Add(layer);
            }
            #endregion

            #region Add geometry to layer
            Graphic g = new Graphic() { Geometry = geometry };
            layer.Graphics.Add(g);
            #endregion
        }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:34,代码来源:SketchLayerParameter.cs

示例4: LineLength

        public LineLength()
        {
            InitializeComponent();

            mapView1.Map.InitialExtent = new Envelope(-13149423, 3997267, -12992880, 4062214, SpatialReferences.WebMercator);
            myGraphicsLayer = mapView1.Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:7,代码来源:LineLength.xaml.cs

示例5: GeodesicBuffer

        /// <summary>Construct Geodesic Buffer sample control</summary>
        public GeodesicBuffer()
        {
            InitializeComponent();

            _graphicsLayer = mapView.Map.Layers["GraphicsLayer"] as GraphicsLayer;
            var task = SetupSymbols();
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:8,代码来源:GeodesicBuffer.xaml.cs

示例6: MainPage

        public MainPage()
        {
            InitializeComponent();

            activateIdentify = true;

            MyDrawObject = new Draw(myMap)
            {
                FillSymbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.FillSymbol,
                DrawMode = DrawMode.Rectangle

            };

            MyDrawObject.DrawComplete += myDrawObject_DrawComplete;
            MyDrawObject.IsEnabled = false;
            _toolMode = "";
            _previousExtentImage = btnPrevExtent.Content as Image;
            _nextExtentImage = btnNextExtent.Content as Image;

            // Initializes the graphics layer
            graphicsLayer = myMap.Layers["myGraphicsLayer"] as GraphicsLayer;

            myMeasureObject = new Draw(myMap)
            {
                // Sets the initial drawing of the line and polygon
                FillSymbol = LayoutRoot.Resources["RedFillSymbol"] as ESRI.ArcGIS.Client.Symbols.FillSymbol,
                LineSymbol = LayoutRoot.Resources["RedLineSymbol"] as ESRI.ArcGIS.Client.Symbols.CartographicLineSymbol
            };

            // Runs the measure draw complete method
            myMeasureObject.DrawComplete += myMeasureObject_DrawComplete;
            // Disables the measure drawing once a graphic is drawn - in other words, I don't want to draw multiple graphics
            myMeasureObject.IsEnabled = false;
        }
开发者ID:csergent45,项目名称:Hybrid,代码行数:34,代码来源:MainPage.xaml.cs

示例7: Start

 public void Start()
 {
     if (explosionLayer != null) return;
     explosionLayer = new GraphicsLayer { ID = Id };
     explosionLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, explosionLayer);
 }
开发者ID:TNOCS,项目名称:csTouch,代码行数:7,代码来源:ExplosionModel.cs

示例8: BatchGeocoding

        public BatchGeocoding()
        {
            InitializeComponent();

            ESRI.ArcGIS.Client.Geometry.Envelope initialExtent =
                        new ESRI.ArcGIS.Client.Geometry.Envelope(
                    _mercator.FromGeographic(
                        new ESRI.ArcGIS.Client.Geometry.MapPoint(-117.387, 33.97)) as MapPoint,
                    _mercator.FromGeographic(
                        new ESRI.ArcGIS.Client.Geometry.MapPoint(-117.355, 33.988)) as MapPoint);

            initialExtent.SpatialReference = new SpatialReference(102100);

            MyMap.Extent = initialExtent;

            _locatorTask = new Locator("http://serverapps101.esri.com/arcgis/rest/services/USA_Geocode/GeocodeServer");
            _locatorTask.AddressesToLocationsCompleted += _locatorTask_AddressesToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            geocodedResults = MyMap.Layers["LocationGraphicsLayer"] as GraphicsLayer;

            //List of addresses to geocode
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "4409 Redwood Dr" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3758 Cedar St" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3486 Orange St" }, { "Zip", "92501" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "2999 4th St" }, { "Zip", "92507" } });
            batchaddresses.Add(new Dictionary<string, string> { { "Street", "3685 10th St" }, { "Zip", "92501" } });

            AddressListbox.ItemsSource = batchaddresses;
        }
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:30,代码来源:BatchGeocoding.xaml.cs

示例9: AddSampleGraphic

        private void AddSampleGraphic(GraphicsLayer gLyr)
        {
            SimpleMarkerSymbol sampleSymbol = new SimpleMarkerSymbol()
            {
                Color = new SolidColorBrush(Colors.Red),
                Size = 12,
                Style = SimpleMarkerSymbol.SimpleMarkerStyle.Circle
            };

            Graphic g = new Graphic()
            {
                Geometry = new MapPoint(-110, 35),
                Symbol = sampleSymbol
            };
            g.Attributes.Add("Attribute1", "Value1");
            g.Attributes.Add("Attribute2", "Value2");
            g.Attributes.Add("Attribute3", "Value3");
            g.Attributes.Add("Attribute4", "Value4");
            g.Attributes.Add("Attribute5", "Value5");
            g.Attributes.Add("Attribute6", "Value6");
            g.Attributes.Add("Attribute7", "Value7");
            g.Attributes.Add("Attribute8", "Value8");
            g.Attributes.Add("Attribute9", "Value9");
            g.Attributes.Add("Attribute10", "Value10");

            gLyr.Graphics.Add(g);
        }
开发者ID:yulifengwx,项目名称:arcgis-viewer-silverlight,代码行数:27,代码来源:SampleGraphicsLayerConverter.cs

示例10: drawBufferCircle

 public void drawBufferCircle(double radius, int pointCount, MapPoint currentPoint, GraphicsLayer gl)
 {
     MapPoint point = currentPoint;
     var pl = new ESRI.ArcGIS.Client.Geometry.Polyline();
     var polygon = new ESRI.ArcGIS.Client.Geometry.Polygon();
     var routePoint = new ESRI.ArcGIS.Client.Geometry.PointCollection();
     for (int i = 1; i <= pointCount; i++)
     {
         double x;
         double y;
         x = (point.X + radius * Math.Cos(2 * Math.PI / pointCount * i));
         y = (point.Y + radius * Math.Sin(2 * Math.PI / pointCount * i));
         routePoint.Add(new MapPoint(x, y));
     }
     routePoint.Add(routePoint[0]);
     polygon.Rings.Add(routePoint);
     GraphicsLayer mygraphicslayer = gl;
     mygraphicslayer.ClearGraphics();
     Graphic graphic = new Graphic()
     {
         Geometry = polygon,
         Symbol = LayoutRoot.Resources["DefaultBufferSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
     };
     mygraphicslayer.Graphics.Add(graphic);
 }
开发者ID:hzhiguang,项目名称:Wheels-SG,代码行数:25,代码来源:AppPage.xaml.cs

示例11: OnGraphicAddClicked

        private void OnGraphicAddClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                GraphicsLayer gLayer = map1.Layers["EventsGraphicsLayer"] as GraphicsLayer;
                if (gLayer != null)
                    map1.Layers.Remove(gLayer);

                GraphicsLayer graphicsLayer = new GraphicsLayer()
                {
                    ID = "SimpleGraphicsLayer"
                };

                graphicsLayer.Graphics.Add(new Graphic()
                {
                    Geometry = new MapPoint(-74.0064, 40.7142),
                    Symbol = new SimpleMarkerSymbol()
                    {
                        Style = SimpleMarkerStyle.Circle,
                        Color = Colors.Red,
                        Size = 8
                    }
                });
                map1.Layers.Add(graphicsLayer);
            }
            catch (Exception ex)
            {

                throw;
            }
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:31,代码来源:GraphicsLayerWindow.xaml.cs

示例12: DriveTimes

        public DriveTimes()
        {
            InitializeComponent();

            graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            bufferSymbols = new List<FillSymbol>(
                    new FillSymbol[] { LayoutRoot.Resources["FillSymbol1"] as FillSymbol,
                        LayoutRoot.Resources["FillSymbol2"] as FillSymbol,
                        LayoutRoot.Resources["FillSymbol3"] as FillSymbol });

            _geoprocessorTask = new Geoprocessor("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/GPServer/Generate%20Service%20Areas");
            _geoprocessorTask.JobCompleted += GeoprocessorTask_JobCompleted;
            _geoprocessorTask.StatusUpdated += GeoprocessorTask_StatusUpdated;
            _geoprocessorTask.GetResultDataCompleted += GeoprocessorTask_GetResultDataCompleted;
            _geoprocessorTask.Failed += GeoprocessorTask_Failed;

            MyDrawObject = new Draw(MyMap)
            {
                IsEnabled = true,
                DrawMode = DrawMode.Point
            };

            MyDrawObject.DrawComplete += MyDrawObject_DrawComplete;
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:25,代码来源:DriveTimes.xaml.cs

示例13: MainViewModel

            /// <summary>
            /// Initializes a new instance of the MainViewModel class.
            /// </summary>
            public MainViewModel()
            {
                if (IsInDesignMode)
                {
                    // Code runs in Blend --> create design time data.
                }
                else
                {
                    // Code runs "for real"
                    ConfigService config = new ConfigService();
                    this.myModel = config.LoadJSON();
                    this.SearchRelayCommand = new RelayCommand<string>(Search);

                    Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) =>
                    {
                        this.mapView = mapView;
                        this.mapView.MaxScale = 500;

                        ArcGISLocalTiledLayer localTiledLayer = new ArcGISLocalTiledLayer(this.TilePackage);
                        localTiledLayer.ID = "SF Basemap";
                        localTiledLayer.InitializeAsync();

                        this.mapView.Map.Layers.Add(localTiledLayer);

                        this.CreateLocalServiceAndDynamicLayer();
                        this.CreateFeatureLayers();

                        this.graphicsLayer = new Esri.ArcGISRuntime.Layers.GraphicsLayer();
                        this.graphicsLayer.ID = "Results";
                        this.graphicsLayer.InitializeAsync();
                        this.mapView.Map.Layers.Add(this.graphicsLayer);
                    });
                }
            }
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:37,代码来源:MainViewModel.cs

示例14: Start

 public void Start()
 {
     if (ZonesLayer != null) return;
     ZonesLayer = new GraphicsLayer { ID = Id };
     ZonesLayer.Initialize();
     ((dsBaseLayer)Layer).ChildLayers.Insert(0, ZonesLayer);
 }
开发者ID:TNOCS,项目名称:csTouch,代码行数:7,代码来源:ZoneModel.cs

示例15: SmoothGraphicAnimation

		/// <summary>
		/// Initializes a new instance of the <see cref="SmoothGraphicAnimation"/> class.
		/// </summary>
		public SmoothGraphicAnimation()
		{
			InitializeComponent();

			_userInteractionLayer = new GraphicsLayer()
			{
				Renderer = new SimpleRenderer()
				{
					Symbol = new SimpleMarkerSymbol() { Color = Colors.Green, Size = 15, Style = SimpleMarkerStyle.Circle }
				}
			};

			_animatingLayer = new GraphicsLayer()
			{
				Renderer = new SimpleRenderer()
				{
					Symbol = new SimpleMarkerSymbol() { Color = Colors.Red, Size = 15, Style = SimpleMarkerStyle.Circle }
				}
			};

            MyMapView.Map.Layers.Add(_userInteractionLayer);
            MyMapView.Map.Layers.Add(_animatingLayer);

            MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
        }
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:28,代码来源:SmoothGraphicAnimation.xaml.cs


注:本文中的GraphicsLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。