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


C# MapArgs.PixelToProj方法代码示例

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


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

示例1: BuildPaths

        private void BuildPaths(MapArgs e, IEnumerable<int> indices, out List<GraphicsPath> paths)
        {
            DateTime startTime = DateTime.Now;

            paths = new List<GraphicsPath>();
            Rectangle clipRect = ComputeClippingRectangle(e);
            Extent drawExtents = e.PixelToProj(clipRect);
            SoutherlandHodgman shClip = new SoutherlandHodgman(clipRect);

            List<GraphicsPath> graphPaths = new List<GraphicsPath>();
            Dictionary<FastDrawnState, GraphicsPath> borders = new Dictionary<FastDrawnState, GraphicsPath>();
            for (int selectState = 0; selectState < 2; selectState++)
            {
                foreach (IPolygonCategory category in Symbology.Categories)
                {
                    FastDrawnState state = new FastDrawnState(selectState == 1, category);

                    GraphicsPath border = new GraphicsPath();
                    borders.Add(state, border);
                    graphPaths.Add(border);
                }
            }

            paths.AddRange(graphPaths);

            List<ShapeRange> shapes = DataSet.ShapeIndices;
            double[] vertices = DataSet.Vertex;

            if (ProgressReportingEnabled)
            {
                ProgressMeter = new ProgressMeter(ProgressHandler, "Building Paths", indices.Count());
            }

            if (!DrawnStatesNeeded)
            {
                FastDrawnState state = new FastDrawnState(false, Symbology.Categories[0]);

                foreach (int shp in indices)
                {
                    if (ProgressReportingEnabled) ProgressMeter.Next();
                    ShapeRange shape = shapes[shp];
                    if (!shape.Extent.Intersects(e.GeographicExtents)) return;
                    if (shp >= shapes.Count) return;
                    if (!borders.ContainsKey(state)) return;

                    BuildPolygon(vertices, shapes[shp], borders[state], e, drawExtents.Contains(shape.Extent) ? null : shClip);
                }
            }
            else
            {
                FastDrawnState[] states = DrawnStates;
                foreach (GraphicsPath borderPath in borders.Values)
                {
                    if (borderPath != null)
                    {
                        borderPath.FillMode = FillMode.Winding;
                    }
                }

                foreach (int shp in indices)
                {
                    if (ProgressReportingEnabled) ProgressMeter.Next();
                    if (shp >= shapes.Count) return;
                    if (shp >= states.Length)
                    {
                        AssignFastDrawnStates();
                        states = DrawnStates;
                    }
                    if (states[shp].Visible == false) continue;
                    ShapeRange shape = shapes[shp];
                    if (!shape.Extent.Intersects(e.GeographicExtents)) return;
                    if (drawExtents.Contains(shape.Extent))
                    {
                        FastDrawnState state = states[shp];
                        if (!borders.ContainsKey(state)) return;
                        BuildPolygon(vertices, shapes[shp], borders[state], e, null);
                    }
                    else
                    {
                        FastDrawnState state = states[shp];
                        if (!borders.ContainsKey(state)) return;
                        BuildPolygon(vertices, shapes[shp], borders[state], e, shClip);
                    }
                }
            }
            if (ProgressReportingEnabled) ProgressMeter.Reset();

            TimeSpan interval = DateTime.Now - startTime;
            totalTime += interval.TotalMilliseconds;

            //Console.WriteLine("Total milliseconds: " + totalTime.ToString());
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:92,代码来源:MapPolygonLayer.cs

示例2: BuildPaths

        private void BuildPaths(MapArgs e, IEnumerable<IFeature> features, out List<GraphicsPath> borderPaths)
        {
            borderPaths = new List<GraphicsPath>();
            Rectangle clipRect = ComputeClippingRectangle(e);
            Extent drawExtents = e.PixelToProj(clipRect);
            SoutherlandHodgman shClip = new SoutherlandHodgman(clipRect);

            for (int selectState = 0; selectState < 2; selectState++)
            {
                foreach (IPolygonCategory category in Symbology.Categories)
                {
                    // Determine the subset of the specified features that are visible and match the category
                    IPolygonCategory polygonCategory = category;
                    int i = selectState;
                    Func<IDrawnState, bool> isMember = state =>
                                                       state.SchemeCategory == polygonCategory &&
                                                       state.IsVisible &&
                                                       state.IsSelected == (i == 1);

                    var drawnFeatures = from feature in features
                                        where isMember(DrawingFilter[feature])
                                        select feature;

                    GraphicsPath borderPath = new GraphicsPath();
                    foreach (IFeature f in drawnFeatures)
                    {
                        BuildPolygon(DataSet.Vertex, f.ShapeIndex, borderPath, e,
                                     drawExtents.Contains(f.Envelope) ? null : shClip);
                    }
                    borderPaths.Add(borderPath);
                }
            }
        }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:33,代码来源:MapPolygonLayer.cs

示例3: BuildPaths

        private void BuildPaths(MapArgs e, IEnumerable<int> indices, out List<GraphicsPath> paths)
        {
            paths = new List<GraphicsPath>();
            var clipRect = ComputeClippingRectangle(e);
            var drawExtents = e.PixelToProj(clipRect);
            var shClip = new SoutherlandHodgman(clipRect);

            var graphPaths = new List<GraphicsPath>();
            var borders = new Dictionary<FastDrawnState, GraphicsPath>();
            for (var selectState = 0; selectState < 2; selectState++)
            {
                foreach (var category in Symbology.Categories)
                {
                    var state = new FastDrawnState(selectState == 1, category);
                    var border = new GraphicsPath {FillMode = FillMode.Winding};
                    borders.Add(state, border);
                    graphPaths.Add(border);
                }
            }

            paths.AddRange(graphPaths);

            var states = DrawnStates;
            foreach (var shp in indices)
            {
                var state = states[shp];
                if (!state.Visible) continue;
                if (!borders.ContainsKey(state)) continue;

                var shape = DataSet.GetShape(shp, false);
                if (!shape.Range.Extent.Intersects(e.GeographicExtents)) continue;

                BuildPolygon(shape.Range, borders[state], e,
                    drawExtents.Contains(shape.Range.Extent) ? null : shClip);
            }
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:36,代码来源:MapPolygonLayer.cs


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