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


C# ESRI类代码示例

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


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

示例1: axSceneControl1_OnMouseDown

        private void axSceneControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ISceneControlEvents_OnMouseDownEvent e)
        {
            IPoint pPoint = null;
            object objOwner = null;
            object objObject = null;

            axSceneControl1.SceneGraph.Locate(axSceneControl1.SceneViewer, e.x, e.y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out objOwner, out objObject);

            ITextElement pTextElement = new TextElementClass();
            pTextElement.Text = "dddddd";

            IGraphicsContainer3D pGCon3D = axSceneControl1.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
            IElement  pElement = new MarkerElementClass();
            IMarkerElement pPointElement = pElement as MarkerElementClass;
            ILineElement pLineElement = pElement as ILineElement;
            ISimpleLineSymbol pLSymbol = new SimpleLineSymbolClass();
            ISimpleMarkerSymbol pMSym = new SimpleMarkerSymbolClass();
            IColor pFromColor = new RgbColorClass();
            IRgbColor pRgbColor = pFromColor as IRgbColor;
            pRgbColor.Red = 255;
            pRgbColor.Green = 0;
            pRgbColor.Blue = 0;
            pMSym.Size = 10;
            pMSym.Color = pFromColor;
            pMSym.Style = esriSimpleMarkerStyle.esriSMSDiamond;
            pPointElement.Symbol = pMSym;
            pLSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            pElement.Geometry = pPoint;

            pGCon3D.AddElement(pElement as IElement );
            axSceneControl1.Scene.SceneGraph.RefreshViewers();
            IDisplay3D pIDisplay3D = axSceneControl1.Scene.SceneGraph as IDisplay3D ;
            pIDisplay3D.FlashLocation(pPoint);
        }
开发者ID:chinasio,项目名称:Control,代码行数:34,代码来源:frm3DAnalyst.cs

示例2: MyMap_MouseClick

        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            _geometryService.CancelAsync();
            _queryTask.CancelAsync();

            Graphic clickGraphic = new Graphic();
            clickGraphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            clickGraphic.Geometry = e.MapPoint;
            // Input spatial reference for buffer operation defined by first feature of input geometry array
            clickGraphic.Geometry.SpatialReference = MyMap.SpatialReference;

            _pointAndBufferGraphicsLayer.ClearGraphics();
            _resultsGraphicsLayer.ClearGraphics();

            clickGraphic.SetZIndex(2);
            _pointAndBufferGraphicsLayer.Graphics.Add(clickGraphic);

            // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
            ESRI.ArcGIS.Client.Tasks.BufferParameters bufferParams = new ESRI.ArcGIS.Client.Tasks.BufferParameters()
            {
                BufferSpatialReference = new SpatialReference(4326),
                OutSpatialReference = MyMap.SpatialReference,
                Unit = LinearUnit.Meter,
            };
            bufferParams.Distances.Add(100);
            bufferParams.Features.Add(clickGraphic);

            _geometryService.BufferAsync(bufferParams);
        }
开发者ID:ahthakore,项目名称:arcgis-samples-silverlight,代码行数:29,代码来源:BufferQuery.xaml.cs

示例3: MyMap_MapGesture

        private void MyMap_MapGesture(object sender, ESRI.ArcGIS.Client.Map.MapGestureEventArgs e)
        {
            if (e.Gesture == GestureType.Tap)
            {
                FeatureLayer featureLayer = MyMap.Layers["MyFeatureLayer"] as FeatureLayer;
                IEnumerable<Graphic> selected = e.DirectlyOver(10,  new GraphicsLayer[] { featureLayer });
                foreach (Graphic g in selected)
                {
                    MyInfoWindow.Anchor = e.MapPoint;
                    MyInfoWindow.IsOpen = true;
                    //Since a ContentTemplate is defined (in XAML), Content will define the DataContext for the ContentTemplate
                    MyInfoWindow.Content = g;
                    return;
                }

                InfoWindow window = new InfoWindow()
                {
                    Anchor = e.MapPoint,
                    Padding = new Thickness(3),
                    Map = MyMap,
                    IsOpen = true,
                    Placement = InfoWindow.PlacementMode.Auto,
                    ContentTemplate = LayoutRoot.Resources["LocationInfoWindowTemplate"] as System.Windows.DataTemplate,
                    //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate
                    Content = new ESRI.ArcGIS.Client.Geometry.MapPoint(
                        double.Parse(e.MapPoint.X.ToString("0.000")),
                        double.Parse(e.MapPoint.Y.ToString("0.000")))
                };
                LayoutRoot.Children.Add(window);
            }
        }
开发者ID:jorik041,项目名称:arcgis-samples-winphone,代码行数:31,代码来源:InfoWindowSimple.xaml.cs

示例4: MyMap_MouseClick

        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            FeatureLayer featureLayer = MyMap.Layers["MyFeatureLayer"] as FeatureLayer;
            System.Windows.Point screenPnt = MyMap.MapToScreen(e.MapPoint);

            // Account for difference between Map and application origin
            GeneralTransform generalTransform = MyMap.TransformToVisual(Application.Current.RootVisual);
            System.Windows.Point transformScreenPnt = generalTransform.Transform(screenPnt);

            IEnumerable<Graphic> selected =
                featureLayer.FindGraphicsInHostCoordinates(transformScreenPnt);

            foreach (Graphic g in selected)
            {

                MyInfoWindow.Anchor = e.MapPoint;
                MyInfoWindow.IsOpen = true;
                //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate
                MyInfoWindow.Content = g.Attributes;
                return;
            }

            InfoWindow window = new InfoWindow()
            {
                Anchor = e.MapPoint,
                Map = MyMap,
                IsOpen = true,
                Placement=InfoWindow.PlacementMode.Auto,
                ContentTemplate = LayoutRoot.Resources["LocationInfoWindowTemplate"] as System.Windows.DataTemplate,
                //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate
                Content = e.MapPoint
            };
            LayoutRoot.Children.Add(window);
        }
开发者ID:konglingjie,项目名称:arcgis-samples-silverlight,代码行数:34,代码来源:InfoWindowSimple.xaml.cs

示例5: Initialize

        public override void Initialize(ESRI.ArcLogistics.App.Pages.Page page)
        {
            label1.Content = "Data unavailable.";
            try
            {
                string URLString = @"http://www.weather.gov/xml/current_obs/KRAL.xml";
                XmlTextReader reader = new XmlTextReader(URLString);

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "temperature_string")
                    {
                        if (reader.Read())
                            label1.Content = "Riverside, CA: " + reader.Value;

                        reader.Close();
                        break;
                    }
                }
            }

            finally
            {

            }
        }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:26,代码来源:MyCustomWidge.xaml.cs

示例6: GraphicsLayer_MouseLeftButtonDown

 private void GraphicsLayer_MouseLeftButtonDown(object sender, ESRI.ArcGIS.Client.GraphicMouseButtonEventArgs e)
 {
     if (e.Graphic.Selected)
         e.Graphic.UnSelect();
     else
         e.Graphic.Select();
 }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:7,代码来源:CustomSymbols.xaml.cs

示例7: MyMap_MouseClick

        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            CsvLayer csvLayer = MyMap.Layers["MyCSVLayer"] as CsvLayer;
            System.Windows.Point screenPnt = MyMap.MapToScreen(e.MapPoint);

            // Account for difference between Map and application origin
            GeneralTransform generalTransform = MyMap.TransformToVisual(null);
            System.Windows.Point transformScreenPnt = generalTransform.Transform(screenPnt);

            int tolerance = 20;
            Rect screenRect = new Rect(new Point(transformScreenPnt.X - tolerance / 2, transformScreenPnt.Y - tolerance / 2),
                new Point(transformScreenPnt.X + tolerance / 2, transformScreenPnt.Y + tolerance / 2));
            IEnumerable<Graphic> selected =
                csvLayer.FindGraphicsInHostCoordinates(screenRect);

            foreach (Graphic g in selected)
            {

                MyInfoWindow.Anchor = e.MapPoint;
                MyInfoWindow.IsOpen = true;
                //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate
                MyInfoWindow.Content = g.Attributes;
                return;
            }
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:25,代码来源:CSVLayer.xaml.cs

示例8: LocatorTask_AddressToLocationsCompleted

        private void LocatorTask_AddressToLocationsCompleted(object sender, ESRI.ArcGIS.Client.Tasks.AddressToLocationsEventArgs args)
        {
            List<AddressCandidate> returnedCandidates = args.Results;

            AddressBorder.Visibility = System.Windows.Visibility.Collapsed;

            if (returnedCandidates.Count > 0)
            {
                AddressCandidate candidate = returnedCandidates[0];

                Graphic graphic = new Graphic()
                {
                    Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as Symbol,
                    Geometry = candidate.Location
                };

                graphic.Attributes.Add("Address", candidate.Address);

                graphicsLayer.Graphics.Add(graphic);

                ResultsTextBlock.Visibility = System.Windows.Visibility.Visible;
                ResultsTextBlock.Text = candidate.Address;

                double displaySize = MyMap.MinimumResolution * 30;
                ESRI.ArcGIS.Client.Geometry.Envelope displayExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(
                    candidate.Location.X - (displaySize / 2),
                    candidate.Location.Y - (displaySize / 2),
                    candidate.Location.X + (displaySize / 2),
                    candidate.Location.Y + (displaySize / 2));
                MyMap.ZoomTo(displayExtent);
            }
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:32,代码来源:AddressToLocation.xaml.cs

示例9: Legend_Refreshed

 private void Legend_Refreshed(object sender, ESRI.ArcGIS.Client.Toolkit.Legend.RefreshedEventArgs e)
 {
     if (e.LayerItem.LayerItems != null)
         foreach (LayerItemViewModel layerItemVM in e.LayerItem.LayerItems)
             if (layerItemVM.IsExpanded)
                 layerItemVM.IsExpanded = false;
 }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:7,代码来源:GroupLayers.xaml.cs

示例10: 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

示例11: MyDrawObject_DrawComplete

        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            MyDrawObject.IsEnabled = false;

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

            Graphic graphic = new Graphic()
            {
                Symbol = LayoutRoot.Resources["StartMarkerSymbol"] as Symbol,
                Geometry = e.Geometry as MapPoint
            };
            graphicsLayer.Graphics.Add(graphic);

            Geoprocessor geoprocessorTask = new Geoprocessor("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
                "Specialty/ESRI_Currents_World/GPServer/MessageInABottle");
            geoprocessorTask.ExecuteCompleted += GeoprocessorTask_ExecuteCompleted;
            geoprocessorTask.Failed += GeoprocessorTask_Failed;

            List<GPParameter> parameters = new List<GPParameter>();
            parameters.Add(new GPFeatureRecordSetLayer("Input_Point", e.Geometry as MapPoint));
            parameters.Add(new GPDouble("Days", Convert.ToDouble(DaysTextBox.Text)));

            geoprocessorTask.ExecuteAsync(parameters);
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:25,代码来源:MessageInABottle.xaml.cs

示例12: SaveMapDocument

 //保存地图文档
 public static void SaveMapDocument(ESRI.ArcGIS.Controls.AxMapControl axMapControl)
 {
     if (axMapControl == null)
     {
         return;
     }
     string m_mapDocumentName = axMapControl.DocumentFilename;
     if (axMapControl.CheckMxFile(m_mapDocumentName))
     {
         //新建地图文档接口
         IMapDocument mapDoc = new MapDocumentClass();
         mapDoc.Open(m_mapDocumentName, string.Empty);
         //确定文档非只读文件
         if (mapDoc.get_IsReadOnly(m_mapDocumentName))
         {
             MessageBox.Show("Map document is read only!");
             mapDoc.Close();
             return;
         }
         //用当前地图替换文档内容
         mapDoc.ReplaceContents((IMxdContents)axMapControl.Map);
         //保存文档
         mapDoc.Save(mapDoc.UsesRelativePaths, false);
         //关闭文档
         mapDoc.Close();
     }
 }
开发者ID:Kingvey,项目名称:ConstructionLandEvaluationSystem,代码行数:28,代码来源:MapDocumentOperation.cs

示例13: getTransformedValue

        public override object getTransformedValue(ESRI.ArcGIS.DataSourcesRaster.IPixelBlock3 bigArr, int startClm, int startRw, int nBand)
        {
            //Console.WriteLine("Start CR = " + startClm.ToString()+":"+ startRw.ToString());
            float s = 0;
            float s2 = 0;
            foreach (int[] xy in offsetLst)
            {
                int bWc = xy[0] + startClm;
                int bRc = xy[1] + startRw;

                object vlObj = bigArr.GetVal(nBand, bWc, bRc);

                if (vlObj == null)
                {
                    continue;
                }
                else
                {
                    float vl = (float)vlObj;
                    s += vl;
                    s2 += vl * vl;
                }
            }
            return (s2 - ((s * s) / offsetLst.Count)) / offsetLst.Count;
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:25,代码来源:focalSampleHelperVariance.cs

示例14: OnMouseDown

        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            if (arg.Button != System.Windows.Forms.MouseButtons.Left)
                return;
            try
            {
                //Get the active view from the ArcMap static class.
                IActiveView activeView = ArcMap.Document.FocusMap as IActiveView;

                var point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y) as IPoint;

                // always use WGS84
                var sr = GetSR();

                if (sr != null)
                {
                    point.Project(sr);
                }

                var doc = AddIn.FromID<ArcMapAddinCoordinateTool.DockableWindowCoordinateTool.AddinImpl>(ThisAddIn.IDs.DockableWindowCoordinateTool);

                if (doc != null)
                {
                    doc.SetInput(point.X, point.Y);
                }
            }
            catch { }
        }
开发者ID:chinasio,项目名称:coordinate-tool-addin-dotnet,代码行数:28,代码来源:CoordinateToolButton.cs

示例15: CacheSnapObjects

        private void CacheSnapObjects(ESRI.ArcGIS.Client.Geometry.Geometry geometryObject, double snapDistance)
        {
            // For the given geometry (line or circle), find all the features that fall within the snapDistance.
              // First we need to issue a buffer in this method. GeometryService_LineBufferCompleted will
              // do the feature query.

              _snapObjects.Clear();
              GeometryService geometryServiceScaleRotate = new GeometryService(_xmlConfiguation.GeometryServerUrl);
              if (geometryServiceScaleRotate == null)
            return;

              geometryServiceScaleRotate.BufferCompleted += GeometryService_LineBufferCompleted;
              geometryServiceScaleRotate.Failed += GeometryService_Failed;
              geometryServiceScaleRotate.CancelAsync();

              Graphic clickGraphic = new Graphic();
              clickGraphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
              clickGraphic.Geometry = geometryObject;

              // Input spatial reference for buffer operation defined by first feature of input geometry array
              clickGraphic.Geometry.SpatialReference = ParcelMap.SpatialReference;

              // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
              ESRI.ArcGIS.Client.Tasks.BufferParameters bufferParams = new ESRI.ArcGIS.Client.Tasks.BufferParameters()
              {
            BufferSpatialReference = ParcelMap.SpatialReference,
            OutSpatialReference = ParcelMap.SpatialReference,
              };
              bufferParams.Distances.Add(snapDistance);
              bufferParams.Features.Add(clickGraphic);

              System.Diagnostics.Debug.WriteLine("Async: Buffering potential candidates for snapping.");
              geometryServiceScaleRotate.BufferAsync(bufferParams, snapDistance);
        }
开发者ID:Esri,项目名称:deed-drafter,代码行数:34,代码来源:ParcelTools.cs


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