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


C# ILineString类代码示例

本文整理汇总了C#中ILineString的典型用法代码示例。如果您正苦于以下问题:C# ILineString类的具体用法?C# ILineString怎么用?C# ILineString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Intersects

 public bool Intersects(Coordinate pt, ILineString ring)
 {
     var seq = ring.CoordinateSequence;
     var seqProj = Project(seq, _facingPlane);
     Coordinate ptProj = Project(pt, _facingPlane);
     return Location.Exterior != RayCrossingCounter.LocatePointInRing(ptProj, seqProj);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:7,代码来源:PlanarPolygon3D.cs

示例2: TransformToImageI

        public static Point[] TransformToImageI(ILineString line, Map map, bool simplifyGeometry, ref int pointCount)
        {
            var length = line.Coordinates.Length;
            var points = new Point[length];

            points[0] = WorldtoMap(line.Coordinates[0], map);
            Point pt = points[0];
            Point pt2 = pt;
            pointCount = 1;
            int i = 1;
            for (; i < length - 1; i++)
            {
                pt = WorldtoMap(line.Coordinates[i], map);

                if (!simplifyGeometry || Math.Abs(pt2.X - pt.X) > 0 || Math.Abs(pt2.Y - pt.Y) > 0)
                {
                    points[pointCount] = pt;
                    pointCount++;

                    pt2 = pt;
                }
            }

            if (length > 1)
                points[pointCount++] = WorldtoMap(line.Coordinates[i], map);

            return points;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:Transform.cs

示例3: BuildGrid

        private IGeometry BuildGrid()
        {
            var lines = new ILineString[_numLines * 2];
            int index = 0;

            for (int i = 0; i < _numLines; i++)
            {
                Coordinate p0 = new Coordinate(GetRandOrdinate(), 0);
                Coordinate p1 = new Coordinate(GetRandOrdinate(), GridWidth);
                ILineString line = _geomFactory.CreateLineString(new [] { p0, p1 });
                lines[index++] = line;
            }

            for (int i = 0; i < _numLines; i++)
            {
                Coordinate p0 = new Coordinate(0, GetRandOrdinate());
                Coordinate p1 = new Coordinate(GridWidth, GetRandOrdinate());
                ILineString line = _geomFactory.CreateLineString(new [] { p0, p1 });
                lines[index++] = line;
            }

            IMultiLineString ml = _geomFactory.CreateMultiLineString(lines);
            _grid = ml.Buffer(_lineWidth);
            var wktWriter = new WKTWriter(2) {Formatted = true, MaxCoordinatesPerLine = 6};
            if (Verbose)
                Console.WriteLine(wktWriter.Write(_grid));
            return _grid;

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

示例4: Buffer

 /// <summary>
 /// </summary>
 /// <param name="line">the line to buffer</param>
 /// <param name="startWidth">the buffer width at the start of the line</param>
 /// <param name="endWidth">the buffer width at the end of the line</param>
 /// <returns>The variable-width buffer polygon</returns>
 public static IGeometry Buffer(ILineString line, double startWidth,
     double endWidth)
 {
     var width = Interpolate(line, startWidth, endWidth);
     var vb = new VariableWidthBuffer(line, width);
     return vb.GetResult();
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:VariableWidthBuffer.cs

示例5: SqlGeometryToGeometryMultiLineString

        private static IMultiLineString SqlGeometryToGeometryMultiLineString(SqlGeometry geometry, GeometryFactory factory)
        {
            ILineString[] lineStrings = new ILineString[geometry.STNumGeometries().Value];
            for (int i = 1; i <= lineStrings.Length; i++)
                lineStrings[i - 1] = SqlGeometryToGeometryLineString(geometry.STGeometryN(i), factory);

            return factory.CreateMultiLineString(lineStrings);
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:8,代码来源:ConvertToGeometry.cs

示例6: LineStringSelfIntersectionsOp

        /// <summary>
        /// 
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
		public static IGeometry LineStringSelfIntersectionsOp(ILineString line)
		{
			IGeometry lineEndPts = GetEndPoints(line);
            IGeometry nodedLine = line.Union(lineEndPts);
			IGeometry nodedEndPts = GetEndPoints(nodedLine);
            IGeometry selfIntersections = nodedEndPts.Difference(lineEndPts);
			return selfIntersections;
		}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:13,代码来源:LineStringSelfIntersections.cs

示例7: GeometryToSqlGeometry

        private static void GeometryToSqlGeometry(ILineString geom, SqlGeometryBuilder bldr)
        {
            bldr.BeginGeometry(OpenGisGeometryType.LineString);

            AddFigure(geom, bldr);

            bldr.EndGeometry();
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:8,代码来源:ConvertToSqlGeometry.cs

示例8: DrawLineString

		/// <summary>
		/// Renders a LineString to the map.
		/// </summary>
		/// <param name="g">Graphics reference</param>
		/// <param name="line">LineString to render</param>
		/// <param name="pen">Pen style used for rendering</param>
		/// <param name="map">Map reference</param>
		public static void DrawLineString(System.Drawing.Graphics g, ILineString line, System.Drawing.Pen pen, SharpMap.Map map)
		{
			if (line.Coordinates.Length > 1)
			{
				System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
				gp.AddLines(Transform.TransformToImage(line, map));
				g.DrawPath(pen, gp);
			}
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:16,代码来源:VectorRenderer.cs

示例9: AddFigure

        private static void AddFigure(ILineString line, SqlGeometryBuilder bldr)
        {
            IList<Coordinate> coords = line.Coordinates;

            bldr.BeginFigure(coords[0].X, coords[0].Y);
            for (int i = 0; i < coords.Count; i++)
                bldr.AddLine(coords[i].X, coords[i].Y);
            bldr.EndFigure();
        }
开发者ID:interworks,项目名称:FastShapefile,代码行数:9,代码来源:ConvertToSqlGeometry.cs

示例10: Add

 private void Add(ILineString lineString)
 {
     ICoordinateSequence seq = lineString.CoordinateSequence;
     for (int i = 1; i < seq.Count; i++)
     {
         Coordinate prev = seq.GetCoordinate(i - 1);
         Coordinate curr = seq.GetCoordinate(i);
         graph.AddEdge(prev, curr);
     }
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:10,代码来源:EdgeGraphBuilder.cs

示例11: UpdateGridValues

 /// <summary>
 /// Fills gridvalues function with profiledata based on profileline over the grid
 /// </summary>
 /// <param name="function"></param>
 /// <param name="grid"></param>
 /// <param name="polyline"></param>
 public static void UpdateGridValues(Function function, IRegularGridCoverage grid, ILineString polyline)
 {
     function.Clear();
     double offset = 0;
     double step = polyline.Length / 100;
     foreach (ICoordinate coordinate in GetGridProfileCoordinates(polyline, step))
     {
         function[offset] = grid.Evaluate(coordinate);
         offset += step;
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:RegularGridCoverageHelper.cs

示例12: WriteGeom

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

            writer.WritePropertyName("arcs");
            writer.WriteStartArray();
            writer.WriteValue(0);
            writer.WriteEndArray();
            return new[] { ls.Coordinates };
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:11,代码来源:TopoFeatureConverter.cs

示例13: angleBisectors

 public static IGeometry angleBisectors(IGeometry g)
 {
     var pts = trianglePts(g);
     var cc = Triangle.InCentre(pts[0], pts[1], pts[2]);
     var geomFact = FunctionsUtil.getFactoryOrDefault(g);
     var line = new ILineString[3];
     line[0] = geomFact.CreateLineString(new Coordinate[] { pts[0], cc });
     line[1] = geomFact.CreateLineString(new Coordinate[] { pts[1], cc });
     line[2] = geomFact.CreateLineString(new Coordinate[] { pts[2], cc });
     return geomFact.CreateMultiLineString(line);
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:11,代码来源:TestCaseGeometryFunctions.cs

示例14: GetGridProfileCoordinates

 /// <summary>
 /// return the coordinates along the gridProfile at stepSize intervals.
 /// </summary>
 /// <param name="gridProfile"></param>
 /// <param name="stepSize"></param>
 /// <returns></returns>
 public static IEnumerable<ICoordinate> GetGridProfileCoordinates(ILineString gridProfile, double stepSize)
 {
     var lengthIndexedLine = new LengthIndexedLine(gridProfile);
     if (0 == stepSize)
         throw new ArgumentException("Stepsize too small", "stepSize");
     int count = (int)((gridProfile.Length / stepSize) + 1);
     for (int i=0; i<count; i++)
     {
         yield return (ICoordinate)lengthIndexedLine.ExtractPoint(i * stepSize).Clone();
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:RegularGridCoverageHelper.cs

示例15: ComputeDistance

 public static void ComputeDistance(ILineString line, Coordinate pt, PointPairDistance ptDist)
 {
     var coords = line.Coordinates;
     var tempSegment = new LineSegment();
     for (var i = 0; i < coords.Length - 1; i++)
     {
         tempSegment.SetCoordinates(coords[i], coords[i + 1]);
         // this is somewhat inefficient - could do better
         var closestPt = tempSegment.ClosestPoint(pt);
         ptDist.SetMinimum(closestPt, pt);
     }
 }
开发者ID:leoliusg,项目名称:NetTopologySuite,代码行数:12,代码来源:DistanceToPoint.cs


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