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


C# SqlGeometry.STNumGeometries方法代码示例

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


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

示例1: SqlGeometryToGeometryMultiPoint

 private static IGeometry SqlGeometryToGeometryMultiPoint(SqlGeometry geometry, GeometryFactory factory)
 {
     IPoint[] points = new IPoint[geometry.STNumGeometries().Value];
     for (int i = 1; i <= points.Length; i++)
         points[i - 1] = SqlGeometryToGeometryPoint(geometry.STGeometryN(i), factory);
     return factory.CreateMultiPoint(points);
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:7,代码来源:ConvertToGeometry.cs

示例2: 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

示例3: SqlGeometryToGeometryGeometryCollection

        private static IGeometryCollection SqlGeometryToGeometryGeometryCollection(SqlGeometry geometry, GeometryFactory factory)
        {
            IGeometry[] geoms = new IGeometry[geometry.STNumGeometries().Value];
            for (int i = 1; i <= geoms.Length; i++)
                geoms[i - 1] = SqlGeometryToGeometry(geometry.STGeometryN(i), factory);

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

示例4: BuildMultipolygonSimplified

 /// <summary>
 /// Builds multipoligon by each polygon inside geometry collection
 /// </summary>
 public static void BuildMultipolygonSimplified(SqlGeometryBuilder builder, SqlGeometry shape,
                                               SqlDouble shortestDistance)
 {
     builder.BeginGeometry(OpenGisGeometryType.MultiPolygon);
     var polygonCount = shape.STNumGeometries();
     for (int i = 1; i <= polygonCount; i++)
     {
         BuildPolygonSimplified(builder, shape.STGeometryN(i), shortestDistance);
     }
     // End the geometry
     builder.EndGeometry();
 }
开发者ID:MoonDav,项目名称:TileRendering,代码行数:15,代码来源:ShortLineExcluding.cs

示例5: CorrigerUnionGeometry

		public static SqlGeometry CorrigerUnionGeometry(SqlGeometry geom, int srid)
		{
			SqlGeometry geomBase = SqlTypesExtensions.STGeomFromText("POINT EMPTY", srid);

			for (int i = 1; i <= geom.STNumGeometries(); i++)
			{
				SqlGeometry curGeom = geom.STGeometryN(i);
				if (curGeom.STDimension().Value == 2)
				{
					SqlGeometry outerRing = curGeom.STExteriorRing();

					List<SqlGeometry> holes = new List<SqlGeometry>();

					for (int hole = 1; hole <= curGeom.STNumInteriorRing(); hole++)
					{
						SqlGeometry holeGeom = SqlTypesExtensions.PolygonFromRings(curGeom.STInteriorRingN(hole), null); // trou converti en polygone
						double aire = holeGeom.GetAireEnMetres();
						if (aire > AIRE_MINI_SCORIES)
						{
							List<SqlGeometry> nativeHoles = SqlTypesExtensions.ExteriorRingsFromPolygon(holeGeom); // polygone corrigé reconverti en linestring
							holes.AddRange(nativeHoles);
						}
					}

					curGeom = SqlTypesExtensions.PolygonFromRings(outerRing, holes);
					geomBase = geomBase.STUnion(curGeom);
				}
			}

			return geomBase;
		}
开发者ID:xfischer,项目名称:SqlServerSpatial.Toolkit,代码行数:31,代码来源:SqlTypesExtensions.cs

示例6: SqlGeometryToSharpMapMultiPoint

 private static SMGeometry SqlGeometryToSharpMapMultiPoint(SqlGeometry geometry)
 {
     SMMultiPoint multiPoint = new SMMultiPoint();
     for (int i = 1; i <= geometry.STNumGeometries(); i++)
         multiPoint.Points.Add((SMPoint)SqlGeometryToSharpMapPoint(geometry.STGeometryN(i)));
     return multiPoint;
 }
开发者ID:Giszpenc,项目名称:ProjNet,代码行数:7,代码来源:SpatialDataFactoryNew.cs

示例7: SqlGeometryToSharpMapGeometryCollection

 private static SMGeometryCollection SqlGeometryToSharpMapGeometryCollection(SqlGeometry geometry)
 {
     SMGeometryCollection geometryCollection = new SMGeometryCollection();
     for (int i = 0; i < geometry.STNumGeometries(); i++)
         geometryCollection.Collection.Add(ToSharpMapGeometry(geometry.STGeometryN(i)));
     return geometryCollection;
 }
开发者ID:Giszpenc,项目名称:ProjNet,代码行数:7,代码来源:SpatialDataFactoryNew.cs

示例8: SqlGeometryToSharpMapMultiLineString

 private static SMMultiLineString SqlGeometryToSharpMapMultiLineString(SqlGeometry geometry, Factory factory)
 {
     var fact = factory ?? Services.CreateGeometryFactory((int)geometry.STSrid);
     var lineStrings = new SMLineString[(int)geometry.STNumGeometries()];
     for (var i = 1; i <= geometry.STNumGeometries(); i++)
         lineStrings[i-1] = (SMLineString)SqlGeometryToSharpMapLineString(geometry.STGeometryN(i), fact);
     return fact.CreateMultiLineString(lineStrings);
 }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:8,代码来源:SqlGeometryConverter.cs

示例9: MultiPolygonToMultiLineString

 private SqlGeometry MultiPolygonToMultiLineString(SqlGeometry multipoly)
 {
     SqlGeometry result;
     var geomBuilder = new SqlGeometryBuilder();
     geomBuilder.SetSrid((0));
     int geomnum = (int) multipoly.STNumGeometries();
     for (int g = 1; g <= geomnum; g++)
     {
         AddMultiLineStringFromPolygon(geomBuilder, multipoly.STGeometryN(g));
     }
     result = geomBuilder.ConstructedGeometry;
     if (result.STIsValid()) return result;
     else return result.MakeValid();
 }
开发者ID:MoonDav,项目名称:TileRendering,代码行数:14,代码来源:ShapeToTileRendering.cs

示例10: CreateMultiPolygonFromGeometryCollectionWithExcludingLineString

 private static SqlGeometry CreateMultiPolygonFromGeometryCollectionWithExcludingLineString( SqlGeometry geometry)
 {
     SqlGeometryBuilder builder = new SqlGeometryBuilder();
     builder.SetSrid(0);
     if (GetOpenGisGeometryType(geometry) != OpenGisGeometryType.GeometryCollection) return geometry;
     builder.BeginGeometry(OpenGisGeometryType.MultiPolygon);
     var polygonCount = geometry.STNumGeometries();
     for (int i = 1; i <= polygonCount; i++)
     {
         var shape = geometry.STGeometryN(i);
         if (GetOpenGisGeometryType(shape) == OpenGisGeometryType.Polygon)
         {
             RepeatPolygon(builder, shape);
         }
     }
     // End the geometry
     builder.EndGeometry();
     return builder.ConstructedGeometry;
 }
开发者ID:MoonDav,项目名称:TileRendering,代码行数:19,代码来源:ShortLineExcluding.cs

示例11: GetGeometryInfo

        /// <summary>
        ///     Преобразует в списки координат с инфрмацией о типе геометрии
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        private GeometryInstanceInfo GetGeometryInfo(SqlGeometry shape)
        {
            var result = new GeometryInstanceInfo();
            var type = (OpenGisGeometryType) Enum.Parse(typeof (OpenGisGeometryType), (string) shape.STGeometryType());
            result.ShapeType = type;
            //List<PointF> points = new List<PointF>();
            PointF[] points;
            List<GeometryPointSequence> pointSequenceList;
            var shapesPointsCollection = new List<List<GeometryPointSequence>>();
            switch (type)
            {
                case OpenGisGeometryType.Point:
                    points = new PointF[1];
                    SqlGeometry firstpoint = shape.STStartPoint();
                    points[0] = new PointF((float) firstpoint.STX, (float) firstpoint.STY);
                    pointSequenceList = new List<GeometryPointSequence>
                        {
                            new GeometryPointSequence {PointList = points, InnerRing = false}
                        };
                    shapesPointsCollection.Add(pointSequenceList);
                    break;

                case OpenGisGeometryType.LineString:
                    points = shape.ToPointsFArray();
                    pointSequenceList = new List<GeometryPointSequence> { new GeometryPointSequence { PointList = points, InnerRing = false } };

                    shapesPointsCollection.Add(pointSequenceList);
                    break;

                case OpenGisGeometryType.Polygon:
                    shapesPointsCollection = shape.ToGeometryPointsOfPolygon();
                    break;

                case OpenGisGeometryType.MultiPoint:
                case OpenGisGeometryType.MultiLineString:
                    shapesPointsCollection = shape.ToGeometryPointsOfMultiPointLineString();
                    break;

                case OpenGisGeometryType.MultiPolygon:
                    shapesPointsCollection = shape.ToGeometryPointsOfMultiPolygon();
                    break;

                case OpenGisGeometryType.GeometryCollection:
                    var geomNum = (int) shape.STNumGeometries();
                    var geometryList = new GeometryInstanceInfo[geomNum];
                    int i;
                    for ( i = 0; i < geomNum; i++)
                        geometryList[i] = GetGeometryInfo(shape.STGeometryN(i));
                    result.GeometryInstanceInfoCollection = geometryList;
                    break;
            }
            result.Points = shapesPointsCollection;
            return result;
        }
开发者ID:MoonDav,项目名称:TileRendering,代码行数:59,代码来源:GeometryParser.cs

示例12: Decode

        private Geometry Decode(SqlGeometry g)
        {
            PathGeometry result = new PathGeometry();

            switch (g.STGeometryType().Value.ToLower())
            {
                case "point":
                    PathFigure pointFig = new PathFigure();
                    pointFig.StartPoint = new Point(g.STX.Value - 2, g.STY.Value - 2);
                    LineSegment pointLs = new LineSegment(new Point(g.STX.Value + 2, g.STY.Value + 2), true);
                    pointFig.Segments.Add(pointLs);
                    result.Figures.Add(pointFig);

                    pointFig = new PathFigure();
                    pointFig.StartPoint = new Point(g.STX.Value - 2, g.STY.Value + 2);
                    pointLs = new LineSegment(new Point(g.STX.Value + 2, g.STY.Value - 2), true);
                    pointFig.Segments.Add(pointLs);
                    result.Figures.Add(pointFig);

                    return result;
                case "polygon":
                    string cmd = new string(g.STAsText().Value).Trim().Substring(8);
                    string[] polyArray = (cmd.Substring(1, cmd.Length - 2) + ", ").Split('(');

                    var polys = from s in polyArray
                                where s.Length > 0
                                select s.Trim().Substring(0, s.Length - 3);

                    PathFigure fig;
                    foreach (var item in polys)
                    {
                        fig = new PathFigure();
                        var polyPoints = from p in item.Split(',')
                                         select p.Trim().Replace(" ", ",");
                        fig.StartPoint = Point.Parse(polyPoints.ElementAt(0));
                        for (int i = 1; i < polyPoints.Count(); i++)
                        {
                            LineSegment ls = new LineSegment(Point.Parse(polyPoints.ElementAt(i)), true);
                            fig.Segments.Add(ls);
                        }

                        result.Figures.Add(fig);
                    }

                    return result;
                case "linestring":
                    PathFigure lsfig = new PathFigure();
                    lsfig.StartPoint = new Point(g.STPointN(1).STX.Value, g.STPointN(1).STY.Value);

                    for (int i = 1; i <= g.STNumPoints(); i++)
                    {
                        LineSegment ls = new LineSegment();
                        ls.Point = new Point(g.STPointN(i).STX.Value, g.STPointN(i).STY.Value);
                        lsfig.Segments.Add(ls);
                    }
                    result.Figures.Add(lsfig);

                    return result;
                case "multipoint":
                case "multilinestring":
                case "multipolygon":
                case "geometrycollection":
                    GeometryGroup mpG = new GeometryGroup();

                    for (int i = 1; i <= g.STNumGeometries().Value; i++)
                        mpG.Children.Add(Decode(g.STGeometryN(i)));

                    return mpG;
                default:
                    return Geometry.Empty;
            }
        }
开发者ID:rupeshkumar399,项目名称:seemapcell,代码行数:72,代码来源:GeometryInfo.cs

示例13: ReprojectMultiPolygon

 private void ReprojectMultiPolygon(SqlGeometry geometry, SqlGeometryBuilder bldr)
 {
     bldr.BeginGeometry(OpenGisGeometryType.MultiPolygon);
     for (int i = 1, c = geometry.STNumGeometries().Value; i <= c; i++)
         ReprojectPolygon(geometry.STGeometryN(i), bldr);
     bldr.EndGeometry();
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:7,代码来源:ReprojectSqlServer.cs

示例14: SqlGeometryToGeometryMultiPolygon

        private static IMultiPolygon SqlGeometryToGeometryMultiPolygon(SqlGeometry geometry, GeometryFactory factory)
        {
            IPolygon[] polygons = new IPolygon[geometry.STNumGeometries().Value];
            for (var i = 1; i <= polygons.Length; i++)
                polygons[i - 1] = SqlGeometryToGeometryPolygon(geometry.STGeometryN(i), factory);

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

示例15: DrawMultiLineString

        private void DrawMultiLineString(SqlGeometry stroke, Color strokecolor, int width)
        {

            using (Pen pen = new Pen(strokecolor, width))
            {
                int geomnum = (int) stroke.STNumGeometries();
                for (int i = 1; i <= geomnum; i++)
                {
                    _graphics.DrawLines(pen, stroke.STGeometryN(i).ToPointsArray());
                }
            }
        }
开发者ID:MoonDav,项目名称:TileRendering,代码行数:12,代码来源:ShapeToTileRendering.cs


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