Exemplo n.º 1
0
        public async Task <bool> Redraw(MapView mapView, IPointSymbology symbology, CancellationToken ctsToken)
        {
            if (_elements.Count <= 0)
            {
                return(false);
            }

            await QueuedTask.Run(() =>
            {
                InitSymbology(symbology);
                var spatialRef = SpatialReferences.WGS84; // TODO: this should be coming from response
                foreach (var element in _elements)
                {
                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    element.PointOverlay.Dispose();
                    element.TextOverlay.Dispose();
                    var addItems         = AddOverlay(mapView, element.Location, element.Value, spatialRef);
                    element.PointOverlay = addItems.Item1;
                    element.TextOverlay  = addItems.Item2;
                    element.Hitbox       = addItems.Item3;
                }
            });

            return(true);
        }
Exemplo n.º 2
0
 public bool Equals(IPointSymbology other)
 {
     return(Color == other.Color &&
            Shape == other.Shape &&
            Size == other.Size &&
            Opacity == other.Opacity);
 }
        public async Task <bool> Redraw(MapView mapView, IPointSymbology symbology, CancellationToken ctsToken)
        {
            if (_elements.Count <= 0)
            {
                return(false);
            }

            await QueuedTask.Run(() =>
            {
                InitSymbology(symbology);
                var spatialRef = SpatialReferences.WGS84; // TODO: this should be coming from response
                foreach (var element in _elements)
                {
                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    element.Overlay.Dispose();
                    element.Overlay = mapView.AddOverlay(element.Location, _symbolRef);
                    element.Hitbox  = CreateHitBox(mapView, element.Location, symbology.Size / 2, spatialRef);
                }
            });

            return(true);
        }
        private void InitSymbology(IPointSymbology symbology)
        {
            var pointColor  = ColorFactory.Instance.CreateRGBColor(symbology.Color.R, symbology.Color.G, symbology.Color.B, symbology.Opacity);
            var pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(pointColor, symbology.Size, symbology.Shape);

            (((pointSymbol.SymbolLayers[0] as CIMVectorMarker).MarkerGraphics[0].Symbol as CIMPolygonSymbol).SymbolLayers[0] as CIMSolidStroke).Width = 0;
            _symbolRef = pointSymbol.MakeSymbolReference();
        }
Exemplo n.º 5
0
        private void InitSymbology(IPointSymbology symbology)
        {
            _pointSize = symbology.Size;

            var pointColor = ColorFactory.Instance.CreateRGBColor(symbology.Color.R, symbology.Color.G, symbology.Color.B, symbology.Opacity);

            _pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(pointColor, symbology.Size, symbology.Shape);
            (((_pointSymbol.SymbolLayers[0] as CIMVectorMarker).MarkerGraphics[0].Symbol as CIMPolygonSymbol).SymbolLayers[0] as CIMSolidStroke).Width = 0;

            var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, symbology.Size * 1.5, "Arial", "Bold");

            textSymbol.HorizontalAlignment = HorizontalAlignment.Center;
            textSymbol.VerticalAlignment   = VerticalAlignment.Center;
            _textSymbolRef = textSymbol.MakeSymbolReference();
        }
Exemplo n.º 6
0
        public async Task <bool> ApplyResults(MapView mapView, SearchResults results, IPointSymbology symbology, CancellationToken ctsToken)
        {
            Clear();

            if (ctsToken.IsCancellationRequested)
            {
                return(false);
            }

            await QueuedTask.Run(() =>
            {
                InitSymbology(symbology);
                var spatialRef = SpatialReferences.WGS84; // TODO: this should be coming from response
                foreach (var pointCluster in results.GetValuePointClusters(ValueName))
                {
                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    var location = MapPointBuilder.CreateMapPoint(pointCluster.Longitude, pointCluster.Latitude, spatialRef);
                    var addItems = AddOverlay(mapView, location, pointCluster, spatialRef);
                    _elements.Add(new Element()
                    {
                        Location = location, Value = pointCluster, PointOverlay = addItems.Item1, TextOverlay = addItems.Item2, Hitbox = addItems.Item3
                    });
                }
            });

            return(_elements.Count > 0);
        }
        public async Task <bool> ApplyResults(MapView mapView, SearchResults results, IPointSymbology symbology, CancellationToken ctsToken)
        {
            Clear();

            if (ctsToken.IsCancellationRequested)
            {
                return(false);
            }

            await QueuedTask.Run(() =>
            {
                InitSymbology(symbology);
                var spatialRef = SpatialReferences.WGS84; // TODO: this should be coming from response
                foreach (var point in results.GetValuePoints(ValueName))
                {
                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    var location = MapPointBuilder.CreateMapPoint(point.Longitude, point.Latitude, spatialRef);
                    var overlay  = mapView.AddOverlay(location, _symbolRef);
                    _elements.Add(new Element()
                    {
                        Value = point, Location = location, Overlay = overlay, Hitbox = CreateHitBox(mapView, location, symbology.Size / 2, spatialRef)
                    });
                }
            });

            return(_elements.Count > 0);
        }