Пример #1
0
        internal async Task AddGraphicToMap(Geometry geom, CIMColor color, ProGraphicAttributes p = null, bool IsTempGraphic = false, double size = 1.0)
        {
            if (geom == null || MapView.Active == null)
            {
                return;
            }

            CIMSymbolReference symbol = null;

            if (geom.GeometryType == GeometryType.Point)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.Instance.ConstructPointSymbol(color, size, SimpleMarkerStyle.Circle);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polyline)
            {
                await QueuedTask.Run(() =>
                {
                    var s  = SymbolFactory.Instance.ConstructLineSymbol(color, size);
                    symbol = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }
            else if (geom.GeometryType == GeometryType.Polygon)
            {
                await QueuedTask.Run(() =>
                {
                    var outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 1.0, SimpleLineStyle.Solid);
                    var s       = SymbolFactory.Instance.ConstructPolygonSymbol(color, SimpleFillStyle.Null, outline);
                    symbol      = new CIMSymbolReference()
                    {
                        Symbol = s
                    };
                });
            }

            await QueuedTask.Run(() =>
            {
                var disposable = MapView.Active.AddOverlay(geom, symbol);
                overlayObjects.Add(disposable);

                var gt = GetGraphicType();

                GraphicsList.Add(new Graphic(gt, disposable, geom, this, p, IsTempGraphic));

                RaisePropertyChanged(() => HasMapGraphics);
            });
        }
Пример #2
0
 public Graphic(GraphicTypes _graphicType, IDisposable _disposable, Geometry _geometry, ProTabBaseViewModel _viewModel, ProGraphicAttributes _p, bool _isTemp = false)
 {
     GraphicType = _graphicType;
     //UniqueId = _uniqueid;
     Disposable = _disposable;
     Geometry   = _geometry;
     IsTemp     = _isTemp;
     ViewModel  = _viewModel;
     p          = _p;
 }
Пример #3
0
 internal async void AddGraphicToMap(Geometry geom, ProGraphicAttributes p = null, bool IsTempGraphic = false, double size = 1.0)
 {
     // default color Red
     await AddGraphicToMap(geom, ColorFactory.Instance.RedRGB, p, IsTempGraphic, size);
 }