Перемещение и resizing картинок на карте

ArcGIS 8.x,9.x,10.x (Arcview, ArcEditor, Arcinfo).
Ответить
Tereha
Завсегдатай
Сообщения: 423
Зарегистрирован: 15 май 2010, 06:13
Репутация: 7

Перемещение и resizing картинок на карте

Сообщение Tereha »

Нужно реализовать возможность нанесения на карту рисунка (для схем) с возможностью его перетаскивания и изменения размеров и с прозрачным фоном.
Идеальным было бы решение с IElement, но он, как я понял не содержит функционала , обеспечивающего прозрачность фона.
Прозрачность может обеспечить marker symbol, но возможно ли реализовать такое же простое его перемещение и изменение размеров как у Element?
Или все-таки проще самому реализовать это через Graphics?
Any ideas or reference!
Tereha
Завсегдатай
Сообщения: 423
Зарегистрирован: 15 май 2010, 06:13
Репутация: 7

Re: Перемещение и resizing картинок на карте

Сообщение Tereha »

Решил проблему следующим образом:

Код: Выделить всё

        ///<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);            
        }
Ответить

Вернуться в «ArcGIS»

Кто сейчас на конференции

Сейчас этот форум просматривают: Ahrefs [Bot] и 4 гостя