Example #1
0
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            if (arg.Button == MouseButtons.Left)
            {
                GeographicCoordinates geographicCoordinates = new GeographicCoordinates(ArcGlobe.Globe, arg.X, arg.Y);

                SpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceFactory((int)GeographicCoordinateSystem);

                PointGeometry pointGeometry = new PointGeometry(geographicCoordinates.Longitude, geographicCoordinates.Latitude, geographicCoordinates.AltitudeInKilometers, spatialReferenceFactory.SpatialReference);

                if (_polygonGeometry == null)
                {
                    _polygonGeometry = new PolygonGeometry(spatialReferenceFactory.SpatialReference);
                }

                _polygonGeometry.AddPoint(pointGeometry.Geometry as IPoint);

                TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe);

                if (!tableOfContents.LayerExists(GraphicsLayerName))
                {
                    tableOfContents.ConstructLayer(GraphicsLayerName);
                }

                Layer layer = new Layer(tableOfContents[GraphicsLayerName]);

                if (_polygonGeometry.PointCount == 1)
                {
                    PointElement pointElement = new PointElement(pointGeometry.Geometry, PointElementSize, PointElementStyle);

                    layer.AddElement(pointElement.Element, pointElement.ElementProperties);
                }
                else
                {
                    layer.RemoveElement(layer.ElementCount - 1);

                    PolylineGeometry polylineGeometry = new PolylineGeometry(_polygonGeometry.Geometry);

                    PolylineElement polylineElement = new PolylineElement(polylineGeometry.Geometry, PolylineElementWidth, PolylineElementStyle);

                    layer.AddElement(polylineElement.Element, polylineElement.ElementProperties);
                }

                ArcGlobe.Globe.GlobeDisplay.RefreshViewers();
            }
        }
        protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            if (arg.Button == MouseButtons.Left)
            {
                GeographicCoordinates geographicCoordinates = new GeographicCoordinates(ArcGlobe.Globe, arg.X, arg.Y);

                SpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceFactory((int)GeographicCoordinateSystem);

                PointGeometry pointGeometry = new PointGeometry(geographicCoordinates.Longitude, geographicCoordinates.Latitude, geographicCoordinates.AltitudeInKilometers, spatialReferenceFactory.SpatialReference);

                if (_polygonGeometry == null)
                {
                    _polygonGeometry = new PolygonGeometry(spatialReferenceFactory.SpatialReference);
                }

                _polygonGeometry.AddPoint(pointGeometry.Geometry as IPoint);

                TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe);

                if (!tableOfContents.LayerExists(GraphicsLayerName))
                {
                    tableOfContents.ConstructLayer(GraphicsLayerName);
                }

                Layer layer = new Layer(tableOfContents[GraphicsLayerName]);

                if (_polygonGeometry.PointCount == 1)
                {
                    PointElement pointElement = new PointElement(pointGeometry.Geometry, PointElementSize, PointElementStyle);

                    layer.AddElement(pointElement.Element, pointElement.ElementProperties);
                }
                else
                {
                    layer.RemoveElement(layer.ElementCount - 1);

                    PolylineGeometry polylineGeometry = new PolylineGeometry(_polygonGeometry.Geometry);

                    PolylineElement polylineElement = new PolylineElement(polylineGeometry.Geometry, PolylineElementWidth, PolylineElementStyle);

                    layer.AddElement(polylineElement.Element, polylineElement.ElementProperties);
                }

                ArcGlobe.Globe.GlobeDisplay.RefreshViewers();
            }
        }
Example #3
0
        protected override void OnDoubleClick()
        {
            if (_polygonGeometry.PointCount > 2)
            {
                TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe);

                if (tableOfContents.LayerExists("Globe Graphics"))
                {
                    Layer layer = new Layer(tableOfContents["Globe Graphics"]);

                    layer.RemoveElement(layer.ElementCount - 1);

                    _polygonGeometry.Close();

                    PolygonElement polygonElement = new PolygonElement(_polygonGeometry.Geometry, esriSimpleFillStyle.esriSFSSolid);

                    layer.AddElement(polygonElement.Element, polygonElement.ElementProperties);

                    _polygonGeometry = null;

                    ArcGlobe.Globe.GlobeDisplay.RefreshViewers();
                }
            }
        }
        protected override void OnDoubleClick()
        {
            if (_polygonGeometry.PointCount > 2)
            {
                TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe);

                if (tableOfContents.LayerExists("Globe Graphics"))
                {
                    Layer layer = new Layer(tableOfContents["Globe Graphics"]);

                    layer.RemoveElement(layer.ElementCount - 1);

                    _polygonGeometry.Close();

                    PolygonElement polygonElement = new PolygonElement(_polygonGeometry.Geometry, esriSimpleFillStyle.esriSFSSolid);

                    layer.AddElement(polygonElement.Element, polygonElement.ElementProperties);

                    _polygonGeometry = null;

                    ArcGlobe.Globe.GlobeDisplay.RefreshViewers();
                }
            }
        }