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


C# Rendering.GetStyle方法代码示例

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


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

示例1: RenderInternal

        private void RenderInternal(D2D1.Factory factory, D2D1.RenderTarget rt, Map map, 
            Envelope envelope, Rendering.Thematics.ITheme theme)
        {
            var ds = new FeatureDataSet();
            lock (_syncRoot)
            {
                DataSource.Open();
                DataSource.ExecuteIntersectionQuery(envelope, ds);
                DataSource.Close();
            }

            var scale = map.MapScale;
            var zoom = map.Zoom;

            foreach (FeatureDataTable features in ds.Tables)
            {
                // Transform geometries if necessary
                if (CoordinateTransformation != null)
                {
                    for (var i = 0; i < features.Count; i++)
                    {
                        features[i].Geometry = ToTarget(features[i].Geometry);
                    }
                }

                //Linestring outlines is drawn by drawing the layer once with a thicker line
                //before drawing the "inline" on top.
                if (Style.EnableOutline)
                {
                    for (int i = 0; i < features.Count; i++)
                    {
                        var feature = features[i];
                        var outlineStyle = theme.GetStyle(feature) as VectorStyle;
                        if (outlineStyle == null) continue;
                        if (!(outlineStyle.Enabled && outlineStyle.EnableOutline)) continue;

                        double compare = outlineStyle.VisibilityUnits == VisibilityUnits.ZoomLevel ? zoom : scale;

                        if (!(outlineStyle.MinVisible <= compare && compare <= outlineStyle.MaxVisible)) continue;

                        using (var sdxStyle = SharpDXVectorStyle.FromVectorStyle(rt, factory, outlineStyle))
                        {
                            if (sdxStyle != null)
                            {
                                //Draw background of all line-outlines first
                                if (feature.Geometry is ILineString)
                                {
                                    SharpDXVectorRenderer.DrawLineString(rt, factory, (ILineString)feature.Geometry,
                                        sdxStyle.Outline, sdxStyle.OutlineWidth, sdxStyle.OutlineStrokeStyle,
                                        map, sdxStyle.LineOffset);
                                }
                                else if (feature.Geometry is IMultiLineString)
                                {
                                    SharpDXVectorRenderer.DrawMultiLineString(rt, factory, (IMultiLineString)feature.Geometry,
                                        sdxStyle.Outline, sdxStyle.OutlineWidth, sdxStyle.OutlineStrokeStyle,
                                        map, sdxStyle.LineOffset);
                                }
                            }
                        }
                    }
                }


                var sdxVectorStyles = new Dictionary<VectorStyle, SharpDXVectorStyle>();
                for (var i = 0; i < features.Count; i++)
                {
                    var feature = features[i];
                    var style = theme.GetStyle(feature);
                    if (style == null) continue;
                    if (!style.Enabled) continue;

                    var compare = style.VisibilityUnits == VisibilityUnits.ZoomLevel ? zoom : scale;

                    if (!(style.MinVisible <= compare && compare <= style.MaxVisible)) continue;


                    IEnumerable<IStyle> stylesToRender = GetStylesToRender(style);

                    if (stylesToRender == null)
                        return;

                    foreach (var styleToRender in stylesToRender)
                    {
                        if (!styleToRender.Enabled) continue;
                        if (!(styleToRender is VectorStyle)) continue;
                        if (!(style.MinVisible <= compare && compare <= style.MaxVisible)) continue;

                        var vstyle = (VectorStyle) styleToRender;
                        SharpDXVectorStyle sdxStyle;
                        if (!sdxVectorStyles.TryGetValue(vstyle, out sdxStyle))
                        {
                            sdxStyle = SharpDXVectorStyle.FromVectorStyle(rt, factory, vstyle);
                            sdxVectorStyles.Add(vstyle, sdxStyle);
                        }

                        RenderGeometry(factory, rt, map, feature.Geometry, sdxStyle);
                    }
                }

                foreach (var value in sdxVectorStyles.Values)
//.........这里部分代码省略.........
开发者ID:lishxi,项目名称:_SharpMap,代码行数:101,代码来源:SharpDXVectorLayer.cs


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