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


C# IGeometry.Apply方法代码示例

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


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

示例1: ExtractLinework

 ///<summary>
 /// Extracts linework for polygonal components.
 ///</summary>
 ///<param name="g">The geometry from which to extract</param>
 ///<returns>A lineal geometry containing the extracted linework</returns>
 private static IMultiLineString ExtractLinework(IGeometry g)
 {
     PolygonalLineworkExtracter extracter = new PolygonalLineworkExtracter();
     g.Apply(extracter);
     List<ILineString> linework = extracter.Linework;
     return g.Factory.CreateMultiLineString(linework.ToArray());
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:12,代码来源:FuzzyPointLocator.cs

示例2: Add

 /// <summary>
 /// Adds a <see cref="IGeometry"/> to be dissolved. 
 /// Any number of geometries may be adde by calling this method multiple times.
 /// Any type of Geometry may be added.  The constituent linework will be
 /// extracted to be dissolved.
 /// </summary>
 /// <param name="geometry">geometry to be line-merged</param>
 public void Add(IGeometry geometry)
 {
     geometry.Apply(new GeometryComponentFilter(c =>
     {
         if (c is ILineString)
             Add(c as ILineString);
     }));
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:15,代码来源:LineDissolver.cs

示例3: GetLines

 /// <summary>
 /// Extracts the linear components from a single <see cref="IGeometry"/>
 /// and adds them to the provided <see cref="ICollection{ILineString}"/>.
 /// </summary>
 /// <param name="geom">The geometry from which to extract linear components</param>
 /// <param name="lines">The Collection to add the extracted linear components to</param>
 /// <returns>The Collection of linear components (LineStrings or LinearRings)</returns>
 public static ICollection<IGeometry> GetLines(IGeometry geom, ICollection<IGeometry> lines)
 {
     if (geom is ILineString)
     {
         lines.Add(geom);
     }
     else
     {
         geom.Apply(new LinearComponentExtracter(lines));
     }
     return lines;
 }
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:19,代码来源:LinearComponentExtracter.cs

示例4: RemoveCommonBits

 /// <summary>
 /// Removes the common coordinate bits from a Geometry.
 /// The coordinates of the Geometry are changed.
 /// </summary>
 /// <param name="geom">The Geometry from which to remove the common coordinate bits.</param>
 /// <returns>The shifted Geometry.</returns>
 public IGeometry RemoveCommonBits(IGeometry geom)
 {
     if (commonCoord.X == 0.0 && commonCoord.Y == 0.0)
         return geom;
     ICoordinate invCoord = new Coordinate(commonCoord);
     invCoord.X = -invCoord.X;
     invCoord.Y = -invCoord.Y;
     Translater trans = new Translater(invCoord);            
     geom.Apply(trans);
     geom.GeometryChanged();
     return geom;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:18,代码来源:CommonBitsRemover.cs

示例5: GetLines

 ///<summary>
 /// Extracts the <see cref="ILineString"/> elements from a single <see cref="IGeometry"/> 
 /// and adds them to the<see cref="List{ILineString}"/>.
 ///</summary>
 /// <param name="geom">The geometry from which to extract</param>
 /// <param name="lines">The list to add the extracted elements to</param>
 /// <returns>The <paramref name="lines"/> list argument</returns>
 public static ICollection<IGeometry> GetLines(IGeometry geom, ICollection<IGeometry> lines)
 {
     if (geom is ILineString)
     {
         lines.Add(geom);
     }
     else if (geom is IGeometryCollection)
     {
         geom.Apply(new LineStringExtracter(lines));
     }
     // skip non-LineString elemental geometries
     return lines;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:20,代码来源:LineStringExtracter.cs

示例6: GetPolygons

        /// <summary>
        /// Extracts the <see cref="IPolygon"/> elements from a single <see cref="IGeometry"/> and adds them to the provided <see cref="IList{IPolygon}"/>.
        /// </summary>
        /// <param name="geom">The geometry from which to extract</param>
        /// <param name="list">The list to add the extracted elements to</param>
        /// <returns></returns>
        public static IList<IGeometry> GetPolygons(IGeometry geom, IList<IGeometry> list)
        {
            if (geom is IPolygon)
            {
                list.Add(geom);
            }
            else if (geom is IGeometryCollection)
            {
                geom.Apply(new PolygonExtracter(list));
            }
            // skip non-Polygonal elemental geometries

            return list;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:20,代码来源:PolygonExtracter.cs

示例7: ComputeFacetSequences

        /// <summary>
        /// Creates facet sequences from a given geometry
        /// </summary>
        /// <param name="g">The geometry</param>
        /// <returns>A list of <see cref="FacetSequence"/>s</returns>
        private static List<FacetSequence> ComputeFacetSequences(IGeometry g)
        {
            var sections = new List<FacetSequence>();

            g.Apply(new GeometryComponentFilter(
                        delegate(IGeometry geom)
                            {
                                ICoordinateSequence seq;
                                if (geom is ILineString)
                                {
                                    seq = ((ILineString) geom).CoordinateSequence;
                                    AddFacetSequences(seq, sections);
                                }
                                else if (geom is IPoint)
                                {
                                    seq = ((IPoint) geom).CoordinateSequence;
                                    AddFacetSequences(seq, sections);
                                }
                            }));
            return sections;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:26,代码来源:FacetSequenceTreeBuilder.cs

示例8: GetPolygonHoles

 public static IGeometry GetPolygonHoles(IGeometry geom)
 {
     IList<IGeometry> holePolys = new List<IGeometry>();
     geom.Apply(new InternalGeometryFilterImpl(holePolys));
     return geom.Factory.BuildGeometry(holePolys);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:6,代码来源:GeometryFunctions.cs

示例9: ComputeOrientedDistance

        private void ComputeOrientedDistance(IGeometry discreteGeom, IGeometry geom, PointPairDistance ptDist)
        {
            var distFilter = new MaxPointDistanceFilter(geom);
            discreteGeom.Apply(distFilter);
            ptDist.SetMaximum(distFilter.MaxPointDistance);

            if (_densifyFrac > 0)
            {
                var fracFilter = new MaxDensifiedByFractionDistanceFilter(geom, _densifyFrac);
                discreteGeom.Apply(fracFilter);
                ptDist.SetMaximum(fracFilter.MaxPointDistance);

            }
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:14,代码来源:DiscreteHausdorffDistance.cs

示例10: UnwrapDateline

        /**
         * If <code>geom</code> spans the dateline, then this modifies it to be a
         * valid JTS geometry that extends to the right of the standard -180 to +180
         * width such that some points are greater than +180 but some remain less.
         * Takes care to invoke {@link com.vividsolutions.jts.geom.Geometry#geometryChanged()}
         * if needed.
         *
         * @return The number of times the geometry spans the dateline.  >= 0
         */
        private static int UnwrapDateline(IGeometry geom)
        {
            if (geom.EnvelopeInternal.Width < 180)
                return 0;//can't possibly cross the dateline
            int[] result = { 0 };//an array so that an inner class can modify it.
            geom.Apply(new S4nGeometryFilter(result));

            int crossings = result[0];
            return crossings;
        }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:19,代码来源:NtsGeometry.cs

示例11: Add

 /// <summary>
 /// Adds a Geometry to be processed. May be called multiple times.
 /// Any dimension of Geometry may be added; the constituent linework will be
 /// extracted.
 /// </summary>
 /// <param name="geometry"></param>
 public void Add(IGeometry geometry)
 {
     geometry.Apply(new AnonymousGeometryComponentFilterImpl(this));
 }
开发者ID:izambakci,项目名称:tf-net,代码行数:10,代码来源:LineMerger.cs

示例12: SetZ

 private static void SetZ(IGeometry g)
 {
     g.Apply(new AverageZFilter());
 }
开发者ID:APLANA-Alexey-Stolyarov,项目名称:NetTopologySuite,代码行数:4,代码来源:WKBTest.cs

示例13: GetLines

 /// <summary>
 /// Extracts the linear components from a single point.
 /// If more than one point is to be processed, it is more
 /// efficient to create a single <c>LineExtracterFilter</c> instance
 /// and pass it to multiple geometries.
 /// </summary>
 /// <param name="geom">The point from which to extract linear components.</param>
 /// <returns>The list of linear components.</returns>
 public static IList GetLines(IGeometry geom)
 {
     IList lines = new ArrayList();
     geom.Apply(new LinearComponentExtracter(lines));
     return lines;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:14,代码来源:LinearComponentExtracter.cs

示例14: ComputeMaxVertexDistance

 private void ComputeMaxVertexDistance(IGeometry curve)
 {
     MaxPointDistanceFilter distFilter = new MaxPointDistanceFilter(_inputGeom);
     curve.Apply(distFilter);
     _maxPtDist.SetMaximum(distFilter.MaxPointDistance);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:6,代码来源:BufferCurveMaximumDistanceFinder.cs

示例15: ExtractTaggedSegmentStrings

        static IList<ISegmentString> ExtractTaggedSegmentStrings(IGeometry geom, IPrecisionModel pm)
        {
            var segStrings = new List<ISegmentString>();
            var filter = new GeometryComponentFilter(
                delegate (IGeometry fgeom)
                {
                    // Extract linework for lineal components only
                    if (!(fgeom is ILineString)) return;
                    // skip empty lines
                    if (geom.NumPoints <= 0) return;
                    var roundPts = Round(((ILineString)geom).CoordinateSequence, pm);
                    segStrings.Add(new NodedSegmentString(roundPts, geom));
                });

            geom.Apply(filter);
            return segStrings;
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:17,代码来源:GeometrySnapRounder.cs


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