///<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(double x, double y) { ESRI.ArcGIS.Display.IRgbColor rgbColorCls = new ESRI.ArcGIS.Display.RgbColorClass(); rgbColorCls.Red = 255; rgbColorCls.Green = 255; rgbColorCls.Blue = 255; ESRI.ArcGIS.Geometry.Point p = new ESRI.ArcGIS.Geometry.Point(); p.X = x; p.Y = y; ESRI.ArcGIS.Geometry.IGeometry geometry = (IGeometry)p; ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)axMapControl1.Map; // Explicit Cast ESRI.ArcGIS.Carto.IElement element = null; IPictureMarkerSymbol MarkerSymbol = new ESRI.ArcGIS.Display.PictureMarkerSymbol(); MarkerSymbol.Size = 50; MarkerSymbol.BitmapTransparencyColor = rgbColorCls; MarkerSymbol.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureBitmap, @D:\__VS\�?конки\Новая папка\�?она пожа�?а с�?ема.bmp); ESRI.ArcGIS.Carto.IMarkerElement markerElement = new ESRI.ArcGIS.Carto.MarkerElementClass(); markerElement.Symbol = MarkerSymbol; element = (ESRI.ArcGIS.Carto.IElement)markerElement; // Explicit Cast element.Geometry = geometry; graphicsContainer.AddElement(element, 0); IActiveView activeView = axMapControl1.Map as IActiveView; activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, MarkerSymbol, null); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.