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


C# IStyle.GetHashCode方法代码示例

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


在下文中一共展示了IStyle.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CreateFromSharpmapStyle

        public static Func<ExportContext, SharpKml.Dom.Style> CreateFromSharpmapStyle(IStyle sharpmapStyle)
        {
            if (sharpmapStyle == null)
                throw new ArgumentNullException("sharpmapStyle");

            var vectorStyle = sharpmapStyle as VectorStyle;
            if (vectorStyle == null) return null;

            SharpKml.Dom.Style style = null;

            var install = new Action<ExportContext>(context =>
            {
                style = new SharpKml.Dom.Style
                {
                    Id = sharpmapStyle.GetHashCode().ToString(CultureInfo.InvariantCulture)
                };

                if (vectorStyle.Line != null)
                {
                    var lineStyle = new LineStyle();
                    style.Line = lineStyle;

                    var color = vectorStyle.Line.Color;
                    lineStyle.Color = new Color32(color.A, color.B, color.G, color.R);
                    lineStyle.ColorMode = ColorMode.Normal;
                    lineStyle.Width = vectorStyle.Line.Width;
                }

                var solidColor = ConvertToColor32(vectorStyle.Fill);
                if (solidColor != null)
                {
                    var polygonStyle = new PolygonStyle();
                    style.Polygon = polygonStyle;

                    polygonStyle.Fill = true;
                    polygonStyle.Color = solidColor;
                }

                if (vectorStyle.Symbol == null)
                {
                    if (vectorStyle.PointSize > 0)
                    {
                        var iconStyle = new IconStyle();

                        var pointColor = vectorStyle.PointColor != null
                            ? ConvertToColor32(vectorStyle.PointColor) ?? new Color32(255, 0, 0, 0)
                            : new Color32(255, 0, 0, 0);

                        iconStyle.Color = pointColor;
                        iconStyle.ColorMode = ColorMode.Normal;
                        iconStyle.Icon = new IconStyle.IconLink(Pushpins.ShadedDot);
                        iconStyle.Scale = vectorStyle.PointSize / 6;

                        style.Icon = iconStyle;
                    }
                }
                else
                {
                    var additionalFile = SaveImagetoDisk(vectorStyle.Symbol);
                    Debug.Assert(additionalFile != null, "additionalFile != null");

                    context.AdditionalFiles.Add(additionalFile);

                    var iconStyle = new IconStyle
                    {
                        Icon = new IconStyle.IconLink(new Uri(context.IsKmz ? Path.GetFileName(additionalFile) : additionalFile, UriKind.Relative)),
                        Scale = vectorStyle.SymbolScale
                    };

                    style.Icon = iconStyle;
                }
            });

            EventHandler endedHandler = delegate { style = null; };

            return context =>
            {
                if (style == null && sharpmapStyle.Enabled)
                {
                    install(context);

                    context.Exporter.Ended -= endedHandler;
                    context.Exporter.Ended += endedHandler;
                }

                return style;
            };
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:88,代码来源:KmlFileFeaturesExporter.cs


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