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


C# IPolygon.GetInteriorRingN方法代码示例

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


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

示例1: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="polygon"></param>
        /// <param name="writer"></param>
        public void Write(IPolygon polygon, BinaryWriter writer)
        {
            writer.Write((int) ShapeGeometryTypes.Polygon);

            // Write BoundingBox            
            WriteBoundingBox(polygon, writer);

            // Write NumParts and NumPoints            
            writer.Write((int) (polygon.NumInteriorRings + 1));
            writer.Write((int)  polygon.NumPoints);

            // Write IndexParts
            int count = 0;
            writer.Write((int) count);
            if (polygon.NumInteriorRings != 0)
            {
                // Write external shell index
                count += polygon.ExteriorRing.NumPoints;
                writer.Write((int) count);
                for (int i = 1; i < polygon.NumInteriorRings; i++)
                {
                    // Write internal holes index
                    count += polygon.GetInteriorRingN(i - 1).NumPoints;
                    writer.Write((int) count);
                }
            }

            // Write Coordinates
            for (int i = 0; i < polygon.NumPoints; i++)
                Write(polygon.Coordinates[i], writer);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:36,代码来源:ShapeWriter.cs

示例2: ComputeDistance

 public static void ComputeDistance(IPolygon poly, Coordinate pt, PointPairDistance ptDist)
 {
     ComputeDistance(poly.ExteriorRing, pt, ptDist);
     for (var i = 0; i < poly.NumInteriorRings; i++)
     {
         ComputeDistance(poly.GetInteriorRingN(i), pt, ptDist);
     }
 }
开发者ID:leoliusg,项目名称:NetTopologySuite,代码行数:8,代码来源:DistanceToPoint.cs

示例3: HasRepeatedPoint

 /// <summary>
 /// 
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 private bool HasRepeatedPoint(IPolygon p)
 {
     if (HasRepeatedPoint(p.ExteriorRing.Coordinates))
         return true;
     for (int i = 0; i < p.NumInteriorRings; i++)
         if (HasRepeatedPoint(p.GetInteriorRingN(i).Coordinates)) 
             return true;            
     return false;
 }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:14,代码来源:RepeatedPointTester.cs

示例4: ContainsPointInPolygon

 public static Boolean ContainsPointInPolygon(Coordinate p, IPolygon poly)
 {
     if (poly.IsEmpty) return false;
     ILinearRing shell = (ILinearRing)poly.ExteriorRing;
     if (!IsPointInRing(p, shell)) return false;
     // now test if the point lies in or on the holes
     for (int i = 0; i < poly.NumInteriorRings; i++)
     {
         ILinearRing hole = (ILinearRing)poly.GetInteriorRingN(i);
         if (IsPointInRing(p, hole)) return false;
     }
     return true;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:SimplePointInAreaLocator.cs

示例5: DrawPolygon

        public static void DrawPolygon(D2D1.RenderTarget renderTarget, D2D1.Factory factory, IPolygon pol, D2D1.Brush brush, D2D1.Brush pen, float penWidth, D2D1.StrokeStyle penStrokeStyle, bool clip, Map map)
        {
            if (pol.ExteriorRing == null)
                return;

            Vector2[] points;
            var startPoint = TransformToImage(pol.ExteriorRing, map, out points);
            if (points.Length > 1)
            {
                using (var geom = new D2D1.PathGeometry(factory))
                {
                    using (var gs = geom.Open())
                    {
                        gs.SetFillMode(D2D1.FillMode.Alternate);

                        gs.BeginFigure(startPoint, D2D1.FigureBegin.Filled);
                        gs.AddLines(points);
                        gs.EndFigure(D2D1.FigureEnd.Closed);

                        for (var i = 0; i < pol.NumInteriorRings; i++)
                        {
                            startPoint = TransformToImage(pol.GetInteriorRingN(i), map, out points);
                            if (points.Length > 1)
                            {
                                gs.BeginFigure(startPoint, D2D1.FigureBegin.Filled);
                                gs.AddLines(points);
                                gs.EndFigure(D2D1.FigureEnd.Closed);
                            }
                        }

                        gs.Close();
                    }

                    if (brush != null)
                        renderTarget.FillGeometry(geom, brush);
                    if (pen != null)
                        renderTarget.DrawGeometry(geom, pen, penWidth, penStrokeStyle);
                }
            }
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:40,代码来源:SharpDXVectorRenderer.cs

示例6: ToShape

        private GraphicsPath ToShape(IPolygon p)
        {
            var poly = new PolygonGraphicsPath();

            Append(poly, p.ExteriorRing.Coordinates);
            for (int j = 0; j < p.NumInteriorRings; j++)
            {
                Append(poly, p.GetInteriorRingN(j).Coordinates);
            }

            return poly.Path;
        }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:12,代码来源:GraphicsPathWriter.cs

示例7: Write

        /// <summary>
        /// Writes <paramref name="polygon"/> to a stream using <paramref name="writer"/>
        /// </summary>
        /// <param name="polygon">The polygon to write</param>
        /// <param name="writer">The writer to use</param>
        public void Write(IPolygon polygon, BinaryWriter writer)
        {
            writer.Write((int) ShapeGeometryType.Polygon);

            // Write BoundingBox            
            WriteBoundingBox(polygon.EnvelopeInternal, writer);

            // Write NumParts and NumPoints            
            writer.Write((int) (polygon.NumInteriorRings + 1));
            writer.Write((int)  polygon.NumPoints);

            // Write IndexParts
            int count = 0;
            writer.Write((int) count);
            var seq = polygon.Factory.CoordinateSequenceFactory.Create(polygon.NumPoints,
                                                                       polygon.ExteriorRing.CoordinateSequence.Ordinates);
            
            // Gather coordinate information
            var ring = polygon.ExteriorRing.CoordinateSequence;
            CoordinateSequences.Copy(ring, 0, seq, count, ring.Count);

            // If we have interior rings write the index parts and gather coordinate information
            if (polygon.NumInteriorRings > 0)
            {
                // Write exterior shell index
                count += ring.Count;
                writer.Write((int) count);

                // Gather coordinates and write interior shell index
                for (int i = 0; i < polygon.NumInteriorRings; i++)
                {
                    // Write internal holes index
                    ring = polygon.GetInteriorRingN(i).CoordinateSequence;
                    CoordinateSequences.Copy(ring, 0, seq, count, ring.Count);
                    if (i < polygon.NumInteriorRings - 1)
                    {
                        count += ring.Count;
                        writer.Write((int) count);
                    }
                }
            }

            // Write Coordinates
            WriteCoordinates(seq, writer, Ordinates.XY);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:50,代码来源:ShapeWriter.cs

示例8: TransformPolygon

        /// <summary>
        /// Transforms a <see cref="GeoAPI.Geometries.IPolygon"/>.
        /// </summary>
        /// <param name="p">Polygon to transform</param>
        /// <param name="from">Source Projection</param>
        /// <param name="to">Target Projection</param>
        /// <param name="toFactory">The factory to create geometries for <paramref name="to"/></param>
        /// <returns>Transformed Polygon</returns>
        public static IPolygon TransformPolygon(IPolygon p, ProjectionInfo from, ProjectionInfo to, IGeometryFactory toFactory)
        {
            var shell = toFactory.CreateLinearRing(TransformSequence(p.Shell.CoordinateSequence, from, to, toFactory.CoordinateSequenceFactory));
            var holes = new ILinearRing[p.NumInteriorRings];
            for (var i = 0; i < p.NumInteriorRings; i++)
                holes[i] = toFactory.CreateLinearRing(TransformSequence(p.GetInteriorRingN(i).CoordinateSequence, from, to, toFactory.CoordinateSequenceFactory));

            return toFactory.CreatePolygon(shell, holes);
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:17,代码来源:GeometryTransformDotSpatial.cs

示例9: WritePolygon

        private void WritePolygon(IPolygon p, int level,
            StringBuilder sb)
        {
            StartLine(GeometryTag("Polygon") + "\n", level, sb);
            WriteModifiers(level, sb);

            StartLine("  <outerBoundaryIs>\n", level, sb);
            WriteLinearRing((ILinearRing)p.ExteriorRing, level + 1, sb, false);
            StartLine("  </outerBoundaryIs>\n", level, sb);

            for (int t = 0; t < p.NumInteriorRings; t++)
            {
                StartLine("  <innerBoundaryIs>\n", level, sb);
                WriteLinearRing((ILinearRing)p.GetInteriorRingN(t), level + 1, sb, false);
                StartLine("  </innerBoundaryIs>\n", level, sb);
            }

            StartLine("</Polygon>\n", level, sb);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:19,代码来源:KMLWriter.cs

示例10: ContainsPointInPolygon

 /// <summary>
 /// 
 /// </summary>
 /// <param name="p"></param>
 /// <param name="poly"></param>
 /// <returns></returns>
 public static bool ContainsPointInPolygon(Coordinate p, IPolygon poly)
 {
     if(poly.IsEmpty) 
         return false;
     LinearRing shell = (LinearRing)poly.Shell;
     if (!CGAlgorithms.IsPointInRing(p, shell.Coordinates)) 
         return false;
     // now test if the point lies in or on the holes
     for(int i = 0; i < poly.NumHoles; i++)
     {
         LinearRing hole = (LinearRing)poly.GetInteriorRingN(i);
         if(CGAlgorithms.IsPointInRing(p, hole.Coordinates)) 
             return false;
     }
     return true;
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:22,代码来源:SimplePointInAreaLocator.cs

示例11: WriteGeom

        private Coordinate[][] WriteGeom(JsonWriter writer, IPolygon poly)
        {
            if (poly == null)
                throw new ArgumentNullException("poly");

            int numHoles = poly.NumInteriorRings;
            Coordinate[][] arr = new Coordinate[numHoles + 1][];
            writer.WritePropertyName("arcs");
            writer.WriteStartArray();
            writer.WriteStartArray();
            // shell            
            writer.WriteValue(0);
            arr[0] = poly.Shell.Coordinates;
            // holes
            for (int i = 0; i < numHoles; i++)
            {
                writer.WriteValue(i + 1);
                arr[i + 1] = poly.GetInteriorRingN(i).Coordinates;
            }
            writer.WriteEndArray();
            writer.WriteEndArray();
            return arr;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:23,代码来源:TopoFeatureConverter.cs

示例12: ComputeMinDistancePolygonRings

 /// <summary>Compute distance between a polygon and the rings of another.</summary>
 private void ComputeMinDistancePolygonRings(PlanarPolygon3D poly, IPolygon ringPoly,
     bool flip)
 {
     // compute shell ring
     ComputeMinDistancePolygonLine(poly, ringPoly.ExteriorRing, flip);
     if (_isDone) return;
     // compute hole rings
     int nHole = ringPoly.NumInteriorRings;
     for (int i = 0; i < nHole; i++)
     {
         ComputeMinDistancePolygonLine(poly, ringPoly.GetInteriorRingN(i), flip);
         if (_isDone) return;
     }
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:15,代码来源:Distance3DOp.cs

示例13: TransformPolygon

        /// <summary>
        /// 
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        protected virtual IGeometry TransformPolygon(IPolygon geom, IGeometry parent) 
        {
            bool isAllValidLinearRings = true;
            IGeometry shell = TransformLinearRing(geom.Shell);

            if (shell == null || ! (shell is LinearRing) || shell.IsEmpty)
                isAllValidLinearRings = false;

            ArrayList holes = new ArrayList();
            for (int i = 0; i < geom.NumHoles; i++) 
            {
                IGeometry hole = TransformLinearRing((ILinearRing) geom.GetInteriorRingN(i));
                if (hole == null || hole.IsEmpty) continue;            
                if (!(hole is LinearRing))
                    isAllValidLinearRings = false;
                holes.Add(hole);
            }

            if (isAllValidLinearRings)
                return _factory.CreatePolygon((ILinearRing)   shell, 
                                             (ILinearRing[]) holes.ToArray(typeof(ILinearRing)));
            ArrayList components = new ArrayList();
            if (shell != null) 
                components.Add(shell);                
            foreach (object hole in holes)
                components.Add(hole);
            return _factory.BuildGeometry(components);
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:34,代码来源:GeometryTransformer.cs

示例14: WritePolygon

        private static void WritePolygon(IPolygon geometry, PostGis2GeometryHeader pgh, BinaryWriter writer)
        {
            writer.Write((uint)PostGis2GeometryType.Polygon);
            if (geometry.IsEmpty)
            {
                writer.Write(0);
                return;
            }

            var numRings = 1 + geometry.NumInteriorRings;
            
            //shell
            writer.Write(numRings);
            writer.Write(geometry.Shell.NumPoints);

            //holes
            for (var i = 0; i < geometry.NumInteriorRings; i++ )
                writer.Write(geometry.GetInteriorRingN(i).NumPoints);
            
            //pad
            if (numRings % 2 != 0)
                writer.Write(0);

            WriteSequence(geometry.Shell.CoordinateSequence, pgh, writer, geometry.Shell.NumPoints);
            for (var i = 0; i < geometry.NumInteriorRings; i++ )
            {
                var sequence = geometry.GetInteriorRingN(i).CoordinateSequence;
                WriteSequence(sequence, pgh, writer, sequence.Count);
            }
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:30,代码来源:PostGis2Writer.cs

示例15: WritePolygon

 private static void WritePolygon(IPolygon geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumInteriorRings + 1);
     WriteLineString(geom.Shell, writeCoordinates, gaiaExport, bw);
     for (var i = 0; i < geom.NumInteriorRings; i++)
         WriteLineString(geom.GetInteriorRingN(i), writeCoordinates, gaiaExport, bw);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:GaiaGeoWriter.cs


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