• Add Graphic to Map Snippet


    Draw a specified graphic on the map using the supplied colors.

    ///<summary>Draw a specified graphic on the map using the supplied colors.</summary>
    ///      
    ///<param name="map">An IMap interface.</param>
    ///<param name="geometry">An IGeometry interface. It can be of the geometry type: esriGeometryPoint, esriGeometryPolyline, or esriGeometryPolygon.</param>
    ///<param name="rgbColor">An IRgbColor interface. The color to draw the geometry.</param>
    ///<param name="outlineRgbColor">An IRgbColor interface. For those geometry's with an outline it will be this color.</param>
    ///      
    ///<remarks>Calling this function will not automatically make the graphics appear in the map area. Refresh the map area after after calling this function with Methods like IActiveView.Refresh or IActiveView.PartialRefresh.</remarks>
    public void AddGraphicToMap(ESRI.ArcGIS.Carto.IMap map, ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor rgbColor, ESRI.ArcGIS.Display.IRgbColor outlineRgbColor)
    {
      ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)map; // Explicit Cast
      ESRI.ArcGIS.Carto.IElement element = null;
      if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
      {
        // Marker symbols
        ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
        simpleMarkerSymbol.Color = rgbColor;
        simpleMarkerSymbol.Outline = true;
        simpleMarkerSymbol.OutlineColor = outlineRgbColor;
        simpleMarkerSymbol.Size = 15;
        simpleMarkerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
    
        ESRI.ArcGIS.Carto.IMarkerElement markerElement = new ESRI.ArcGIS.Carto.MarkerElementClass();
        markerElement.Symbol = simpleMarkerSymbol;
        element = (ESRI.ArcGIS.Carto.IElement)markerElement; // Explicit Cast
      }
      else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
      {
        //  Line elements
        ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
        simpleLineSymbol.Color = rgbColor;
        simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid;
        simpleLineSymbol.Width = 5;
    
        ESRI.ArcGIS.Carto.ILineElement lineElement = new ESRI.ArcGIS.Carto.LineElementClass();
        lineElement.Symbol = simpleLineSymbol;
        element = (ESRI.ArcGIS.Carto.IElement)lineElement; // Explicit Cast
      }
      else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon)
      {
        // Polygon elements
        ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
        simpleFillSymbol.Color = rgbColor;
        simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal;
        ESRI.ArcGIS.Carto.IFillShapeElement fillShapeElement = new ESRI.ArcGIS.Carto.PolygonElementClass();
        fillShapeElement.Symbol = simpleFillSymbol;
        element = (ESRI.ArcGIS.Carto.IElement)fillShapeElement; // Explicit Cast
      }
      if (!(element == null))
      {
        element.Geometry = geometry;
        graphicsContainer.AddElement(element, 0);
      }
    }
    本博客有部分内容来自网络,如有问题请联系:hebeilijianghua@qq.com,并注明来自博客园。
  • 相关阅读:
    RESTful架构的设计误区
    CRUD的http请求方式
    RESTful API的安全性
    REST风格的原则
    REST架构风格理解
    ansible上手之认识Playbook
    ansible模块之file
    ansible模块之yum,yum_repository
    ansible模块之copy
    Pygame
  • 原文地址:https://www.cnblogs.com/leebokeyuan/p/5594048.html
Copyright © 2020-2023  润新知