LoadTexture() public static méthode

public static LoadTexture ( Stream textureData ) : Mapsui.Rendering.OpenTK.TextureInfo
textureData System.IO.Stream
Résultat Mapsui.Rendering.OpenTK.TextureInfo
Exemple #1
0
        public static void Draw(IViewport viewport, IStyle style, IFeature feature, IDictionary <object, TextureInfo> TextureCache, long currentIteration)
        {
            try
            {
                var raster = (IRaster)feature.Geometry;

                TextureInfo textureInfo;

                if (!TextureCache.Keys.Contains(raster))
                {
                    textureInfo          = TextureHelper.LoadTexture(raster.Data);
                    TextureCache[raster] = textureInfo;
                }
                else
                {
                    textureInfo = TextureCache[raster];
                }

                textureInfo.IterationUsed = currentIteration;
                TextureCache[raster]      = textureInfo;
                var destination = WorldToScreen(viewport, feature.Geometry.GetBoundingBox());
                TextureHelper.RenderTexture(textureInfo.TextureId, ToVertexArray(RoundToPixel(destination)));
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        public static void Draw(LabelStyle style, string text, float x, float y)
        {
            var key = text + "_" + style.Font.FontFamily + "_" + style.Font.Size + "_" + (float)style.Font.Size + "_" + style.BackColor + "_" + style.ForeColor;

            if (!LabelBitmapCache.Keys.Contains(key))
            {
                var memoryStream = PlatformLabelBitmap.Create(style, text);
                LabelBitmapCache[key] = TextureHelper.LoadTexture(memoryStream);
            }
            var info = LabelBitmapCache[key];

            TextureHelper.RenderTexture(info, x, y, offsetX: (float)style.Offset.X, offsetY: (float)style.Offset.Y,
                                        horizontalAlignment: style.HorizontalAlignment, verticalAlignment: style.VerticalAlignment);
        }
Exemple #3
0
        private static void DrawPointWithSymbolStyle(SymbolStyle symbolStyle, Point destination, IDictionary <int, TextureInfo> bitmapCache)
        {
            TextureInfo textureInfo;

            if (!bitmapCache.Keys.Contains(symbolStyle.BitmapId))
            {
                textureInfo = TextureHelper.LoadTexture(BitmapRegistry.Instance.Get(symbolStyle.BitmapId));
                bitmapCache[symbolStyle.BitmapId] = textureInfo;
            }
            else
            {
                textureInfo = bitmapCache[symbolStyle.BitmapId];
            }

            TextureHelper.RenderTexture(textureInfo, (float)destination.X, (float)destination.Y,
                                        (float)symbolStyle.SymbolRotation,
                                        (float)symbolStyle.SymbolOffset.X, (float)symbolStyle.SymbolOffset.Y,
                                        opacity: (float)symbolStyle.Opacity, scale: (float)symbolStyle.SymbolScale);
        }