Exemplo n.º 1
0
        public MapRenderer()
        {
            StyleRenderers[typeof(RasterStyle)]  = new RasterStyleRenderer();
            StyleRenderers[typeof(VectorStyle)]  = new VectorStyleRenderer();
            StyleRenderers[typeof(LabelStyle)]   = new LabelStyleRenderer();
            StyleRenderers[typeof(SymbolStyle)]  = new SymbolStyleRenderer();
            StyleRenderers[typeof(CalloutStyle)] = new CalloutStyleRenderer();

            WidgetRenders[typeof(Hyperlink)]       = new HyperlinkWidgetRenderer();
            WidgetRenders[typeof(ScaleBarWidget)]  = new ScaleBarWidgetRenderer();
            WidgetRenders[typeof(ZoomInOutWidget)] = new ZoomInOutWidgetRenderer();
            WidgetRenders[typeof(ButtonWidget)]    = new ButtonWidgetRenderer();
        }
Exemplo n.º 2
0
        public static void Draw(SKCanvas canvas, IReadOnlyViewport viewport, IStyle style, IFeature feature,
                                IGeometry geometry, SymbolCache symbolCache, float opacity)
        {
            var point       = geometry as Point;
            var destination = viewport.WorldToScreen(point);

            if (style is CalloutStyle calloutStyle)
            {
                CalloutStyleRenderer.Draw(canvas, viewport, symbolCache, opacity, destination, calloutStyle);
            }
            else if (style is LabelStyle labelStyle)
            {
                LabelRenderer.Draw(canvas, labelStyle, feature, destination, opacity);
            }
            else if (style is SymbolStyle symbolStyle)
            {
                if (symbolStyle.BitmapId >= 0)
                {
                    // todo: Remove this call. ImageStyle should be used instead of SymbolStyle with BitmapId
                    ImageStyleRenderer.Draw(canvas, symbolStyle, destination, symbolCache, opacity, viewport.Rotation);
                }
                else
                {
                    SymbolStyleRenderer.Draw(canvas, symbolStyle, destination, opacity, symbolStyle.SymbolType, viewport.Rotation);
                }
            }
            else if (style is ImageStyle imageStyle)
            {
                ImageStyleRenderer.Draw(canvas, imageStyle, destination, symbolCache, opacity, viewport.Rotation);
            }
            else if (style is VectorStyle vectorStyle)
            {
                // Use the SymbolStyleRenderer and specify Ellipse
                SymbolStyleRenderer.Draw(canvas, vectorStyle, destination, opacity, SymbolType.Ellipse);
            }
            else
            {
                throw new Exception($"Style of type '{style.GetType()}' is not supported for points");
            }
        }