当前位置: 首页>>代码示例>>C#>>正文


C# IStyle类代码示例

本文整理汇总了C#中IStyle的典型用法代码示例。如果您正苦于以下问题:C# IStyle类的具体用法?C# IStyle怎么用?C# IStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IStyle类属于命名空间,在下文中一共展示了IStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderGeometry

        public void RenderGeometry(MultiPolygon multiPolygon, IStyle style, IFeature feature, IViewport viewport)
        {
            if (_bgWorker == null)
                _bgWorker = new BackgroundWorker();
            /*
            while (_bgWorker.IsBusy) {
                Thread.Sleep (00001);
            }
            */
            _bgWorker.RunWorkerCompleted += (sender, e) =>
                {
                    var layer = e.Result as CALayer;

                    if (layer != null)
                    {
                        var styleKey = style.GetHashCode().ToString();
                        feature[styleKey] = layer;
                    }
                };

            _bgWorker.DoWork += delegate(object sender, DoWorkEventArgs e)
                {
                    var layer = RenderImage(multiPolygon, style, viewport);
                    e.Result = layer;
                };

            _bgWorker.RunWorkerAsync();
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:28,代码来源:ContextRenderer.cs

示例2: AreStylesEqual

 public static bool AreStylesEqual(IStyle lhs, IStyle rhs)
 {
     Assert.AreEqual(lhs.MinVisible, rhs.MinVisible, "MinVisible differs");
     Assert.AreEqual(lhs.MaxVisible, rhs.MaxVisible, "MaxVisible differs");
     Assert.AreEqual(lhs.Enabled, rhs.Enabled, "Enabled differs");
     return true;
 }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:7,代码来源:StylesTest.cs

示例3: GetGeneralProperties

 private static void GetGeneralProperties(ICssStyleDeclaration csd, IStyle style)
 {
     if (csd.GetPropertyValue("zoom-min-visible") != string.Empty)
         style.MinVisible = double.Parse(csd.GetPropertyValue("zoom-min-visible"));
     if (csd.GetPropertyValue("zoom-max-visible") != string.Empty)
         style.MaxVisible = double.Parse(csd.GetPropertyValue("zoom-max-visible"));
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:StyleTypeConverter.cs

示例4: Draw

        public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IFeature feature,
            IDictionary<object, SKBitmapInfo> skBitmapCache, long currentIteration)
        {
            try
            {
                var raster = (IRaster)feature.Geometry;

                SKBitmapInfo textureInfo;

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

                textureInfo.IterationUsed = currentIteration;
                skBitmapCache[raster] = textureInfo;
                var destination = WorldToScreen(viewport, feature.Geometry.GetBoundingBox());
                BitmapHelper.RenderRaster(canvas, textureInfo.Bitmap, RoundToPixel(destination).ToSkia());
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex.Message, ex);
            }
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:29,代码来源:RasterRenderer.cs

示例5: Draw

        // todo:
        // try to remove the feature argument. LabelStyle should already contain the feature specific text
        // The visible feature iterator should create this LabelStyle
        public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IFeature feature, 
            IGeometry geometry, IDictionary<int, SKBitmapInfo> symbolBitmapCache)
        {
            var point = geometry as Point;
            var destination = viewport.WorldToScreen(point);

            if (style is LabelStyle)              // case 1) LabelStyle
            {
                LabelRenderer.Draw(canvas, (LabelStyle) style, feature, (float) destination.X, (float) destination.Y);
            }
            else if (style is SymbolStyle)
            {
                var symbolStyle = (SymbolStyle)style;

                if ( symbolStyle.BitmapId >= 0)   // case 2) Bitmap Style
                {
                    DrawPointWithBitmapStyle(canvas, symbolStyle, destination, symbolBitmapCache);
                }
                else                              // case 3) SymbolStyle without bitmap
                {
                    DrawPointWithSymbolStyle(canvas, symbolStyle, destination, symbolStyle.SymbolType);
                }
            }
            else if (style is VectorStyle)        // case 4) VectorStyle
            {
                DrawPointWithVectorStyle(canvas, (VectorStyle) style, destination);
            }
            else
            {
                throw new Exception($"Style of type '{style.GetType()}' is not supported for points");
            }
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:35,代码来源:PointRenderer.cs

示例6: Render

        public static void Render(Graphics graphics, IGeometry feature, IStyle style, IViewport viewport)
        {
            var stream = ((IRaster)feature).Data;
            stream.Position = 0;
            var bitmap = new Bitmap(stream);

            Geometries.Point min = viewport.WorldToScreen(new Geometries.Point(feature.GetBoundingBox().MinX, feature.GetBoundingBox().MinY));
            Geometries.Point max = viewport.WorldToScreen(new Geometries.Point(feature.GetBoundingBox().MaxX, feature.GetBoundingBox().MaxY));

            Rectangle destination = RoundToPixel(new RectangleF((float)min.X, (float)max.Y, (float)(max.X - min.X), (float)(min.Y - max.Y)));
            graphics.DrawImage(bitmap,
                destination,
                0, 0, bitmap.Width, bitmap.Height,
                GraphicsUnit.Pixel,
                new ImageAttributes());

            if (DeveloperTools.DeveloperMode)
            {
                var font = new System.Drawing.Font("Arial", 12);
                var message = (GC.GetTotalMemory(true) / 1000).ToString(CultureInfo.InvariantCulture) + " KB";
                graphics.DrawString(message, font, new SolidBrush(Color.Black), 10f, 10f);
            }

            bitmap.Dispose();
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:25,代码来源:RasterRenderer.cs

示例7: RenderPoint

        public static UIElement RenderPoint(Point point, IStyle style, IViewport viewport)
        {
            UIElement symbol;
            var matrix = XamlMedia.Matrix.Identity;

            if (style is SymbolStyle)
            {
                var symbolStyle = style as SymbolStyle;

                if (symbolStyle.Symbol == null || symbolStyle.Symbol.Data == null)
                    symbol = CreateSymbolFromVectorStyle(symbolStyle, symbolStyle.Opacity, symbolStyle.SymbolType);
                else
                    symbol = CreateSymbolFromBitmap(symbolStyle.Symbol.Data, symbolStyle.Opacity);
                matrix = CreatePointSymbolMatrix(viewport.Resolution, symbolStyle);
            }
            else
            {
                symbol = CreateSymbolFromVectorStyle((style as VectorStyle) ?? new VectorStyle());
                MatrixHelper.ScaleAt(ref matrix, viewport.Resolution, viewport.Resolution);
            }

            MatrixHelper.Append(ref matrix, CreateTransformMatrix(point, viewport));

            symbol.RenderTransform = new XamlMedia.MatrixTransform { Matrix = matrix };

            symbol.IsHitTestVisible = false;

            return symbol;
        }
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:29,代码来源:GeometryRenderer.cs

示例8: RenderPoint

        public static XamlShapes.Shape RenderPoint(Point point, IStyle style, IViewport viewport)
        {
            XamlShapes.Shape symbol;
            var matrix = XamlMedia.Matrix.Identity;

            if (style is SymbolStyle)
            {
                var symbolStyle = style as SymbolStyle;

                if (symbolStyle.BitmapId < 0)
                    symbol = CreateSymbolFromVectorStyle(symbolStyle, symbolStyle.Opacity, symbolStyle.SymbolType, symbolStyle.Width, symbolStyle.Height);
                else
                    symbol = CreateSymbolFromBitmap(BitmapRegistry.Instance.Get(symbolStyle.BitmapId), symbolStyle.Opacity);
                matrix = CreatePointSymbolMatrix(viewport.Resolution, symbolStyle);
            }
            else
            {
                symbol = CreateSymbolFromVectorStyle((style as VectorStyle) ?? new VectorStyle());
                MatrixHelper.ScaleAt(ref matrix, viewport.Resolution, viewport.Resolution);
            }

            MatrixHelper.Append(ref matrix, CreateTransformMatrix(point, viewport));

            symbol.RenderTransform = new XamlMedia.MatrixTransform { Matrix = matrix };
            symbol.IsHitTestVisible = false;

            return symbol;
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:28,代码来源:GeometryRenderer.cs

示例9: Load

 public void Load(IStyle[] styles)
 {
     this._attributeValue = null;
     this._dirty = false;
     string attribute = styles[0].GetAttribute(this._omName);
     if (attribute != null)
     {
         attribute = attribute.Trim();
         for (int i = 1; i < styles.Length; i++)
         {
             string str2 = styles[i].GetAttribute(this._omName);
             if (str2 == null)
             {
                 str2 = null;
                 break;
             }
             str2 = str2.Trim();
             if ((this._caseSignificant && !attribute.Equals(str2)) || (string.Compare(attribute, str2, true, CultureInfo.InvariantCulture) != 0))
             {
                 attribute = null;
                 break;
             }
         }
         if (attribute != null)
         {
             this._attributeValue = this._caseSignificant ? attribute : attribute.ToLower(CultureInfo.InvariantCulture);
         }
     }
 }
开发者ID:ikvm,项目名称:webmatrix,代码行数:29,代码来源:CssAttribute.cs

示例10: GradientThemeBase

 /// <summary>
 /// Creates an instance of this class
 /// </summary>
 /// <param name="minValue">The minimum value</param>
 /// <param name="maxValue">The maximum value</param>
 /// <param name="minStyle">The <see cref="IStyle">style</see> to apply for values equal to <paramref name="minValue"/></param>
 /// <param name="maxStyle">The <see cref="IStyle">style</see> to apply for values equal to <paramref name="maxValue"/></param>
 protected GradientThemeBase(double minValue, double maxValue, IStyle minStyle, IStyle maxStyle)
 {
     _min = minValue;
     _max = maxValue;
     _maxStyle = maxStyle;
     _minStyle = minStyle;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:GradientTheme.cs

示例11: Draw

        public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IGeometry geometry)
        {
            var polygon = (Polygon)geometry;

            float lineWidth = 1;
            var lineColor = Color.Black; // default
            var fillColor = Color.Gray; // default

            var vectorStyle = style as VectorStyle;

            if (vectorStyle != null)
            {
                lineWidth = (float) vectorStyle.Outline.Width;
                lineColor = vectorStyle.Outline.Color;
                fillColor = vectorStyle.Fill?.Color;
            }

            using (var path = ToSkia(viewport, polygon))
            {
                using (var paint = new SKPaint())
                {
                    paint.IsAntialias = true;
                    paint.StrokeWidth = lineWidth;

                    paint.Style = SKPaintStyle.Fill;
                    paint.Color = fillColor.ToSkia();
                    canvas.DrawPath(path, paint);
                    paint.Style = SKPaintStyle.Stroke;
                    paint.Color = lineColor.ToSkia();
                    canvas.DrawPath(path, paint);
                }
            }
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:33,代码来源:PolygonRenderer.cs

示例12: Draw

        public static void Draw(Canvas canvas, IViewport viewport, IStyle style, IFeature feature)
        {
            try
            {
                if (!feature.RenderedGeometry.ContainsKey(style)) feature.RenderedGeometry[style] = ToAndroidBitmap(feature.Geometry);
                var bitmap = (AndroidGraphics.Bitmap)feature.RenderedGeometry[style];
                
                var dest = WorldToScreen(viewport, feature.Geometry.GetBoundingBox());
                dest = new BoundingBox(
                    dest.MinX,
                    dest.MinY,
                    dest.MaxX,
                    dest.MaxY);

                var destination = RoundToPixel(dest);
                using (var paint = new Paint())
                {
                    canvas.DrawBitmap(bitmap, new Rect(0, 0, bitmap.Width, bitmap.Height), destination, paint);
                }

                DrawOutline(canvas, style, destination);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }

        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:28,代码来源:RasterRenderer.cs

示例13: PaintValue

 public void PaintValue(Graphics graphic, Rectangle renderRect, Rectangle clipRect, IStyle style, object value)
 {
     brush.Color = ValidateValue(value);
     clipRect.Height--;
     graphic.FillRectangle(brush, clipRect);
     graphic.DrawRectangle(Pens.Black, clipRect);
 }
开发者ID:NtreevSoft,项目名称:GridControl,代码行数:7,代码来源:ColumnUserModal.cs

示例14: Draw

        public static void Draw(IViewport viewport, IStyle style, IFeature feature)
        {
            var lineString = ((LineString)feature.Geometry).Vertices;

            float lineWidth = 1;
            var lineColor = Color.White;

            var vectorStyle = style as VectorStyle;

            if (vectorStyle != null)
            {
                lineWidth = (float)vectorStyle.Line.Width;
                lineColor = vectorStyle.Line.Color;
            }

            float[] points = ToOpenTK(lineString);
            WorldToScreen(viewport, points);

            GL.LineWidth(lineWidth);
            GL.Color4((byte)lineColor.R, (byte)lineColor.G, (byte)lineColor.B, (byte)lineColor.A);
            GL.EnableClientState(All.VertexArray);
            GL.VertexPointer(2, All.Float, 0, points);
            GL.DrawArrays(All.Lines, 0, points.Length / 2);
            GL.DisableClientState(All.VertexArray);
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:25,代码来源:LineStringRenderer.cs

示例15: CreateLineStringLayer

 public static ILayer CreateLineStringLayer(IStyle style = null)
 {
     return new MemoryLayer
     {
         DataSource = new MemoryProvider(
             new[] { new LineString(new[]
                 {
                     new Point(0, 0), 
                     new Point(10000, 10000),
                     new Point(10000, 0),
                     new Point(0, 10000),
                     new Point(100000, 100000),
                     new Point(100000, 0),
                     new Point(0, 100000),
                     new Point(1000000, 1000000),
                     new Point(1000000, 0),
                     new Point(0, 1000000),
                     new Point(10000000, 10000000),
                     new Point(10000000, 0),
                     new Point(0, 10000000)
                 }
             )}
         ),
         Name = "LineStringLayer",
         Style = style
     };
 }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:27,代码来源:LineStringSample.cs


注:本文中的IStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。