本文整理汇总了C#中SqlGeometry.STNumInteriorRing方法的典型用法代码示例。如果您正苦于以下问题:C# SqlGeometry.STNumInteriorRing方法的具体用法?C# SqlGeometry.STNumInteriorRing怎么用?C# SqlGeometry.STNumInteriorRing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlGeometry
的用法示例。
在下文中一共展示了SqlGeometry.STNumInteriorRing方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlGeometryToSharpMapPolygon
private static SMGeometry SqlGeometryToSharpMapPolygon(SqlGeometry geometry)
{
//exterior ring
SMLinearRing exterior = new SMLinearRing(GetPoints(geometry.STExteriorRing()));
SMLinearRing[] interior = null;
if (geometry.STNumInteriorRing() > 0)
{
interior = new SMLinearRing[(int)geometry.STNumInteriorRing()];
for (int i = 1; i <= geometry.STNumInteriorRing(); i++)
interior[i - 1] = new SMLinearRing(GetPoints(geometry.STInteriorRingN(i)));
}
return new SMPolygon(exterior, interior);
}
示例2: SqlGeometryToSharpMapPolygon
private static SMGeometry SqlGeometryToSharpMapPolygon(SqlGeometry geometry, Factory factory)
{
var fact = factory ?? Services.CreateGeometryFactory((int)geometry.STSrid);
//exterior ring
var exterior = fact.CreateLinearRing(GetPoints(geometry.STExteriorRing()));
SMLinearRing[] interior = null;
if (geometry.STNumInteriorRing()>0)
{
interior = new SMLinearRing[(int)geometry.STNumInteriorRing()];
for (var i = 1; i <= geometry.STNumInteriorRing(); i++)
interior[i - 1] = fact.CreateLinearRing(GetPoints(geometry.STInteriorRingN(i)));
}
return Services.CreateGeometryFactory((int)geometry.STSrid).CreatePolygon(exterior, interior);
}
示例3: GetPolygonPointSequence
static List<GeometryPointSequence> GetPolygonPointSequence(SqlGeometry geom)
{
List<GeometryPointSequence> pointsList = new List<GeometryPointSequence>();
int numInteriorRing = (int)geom.STNumInteriorRing();
GeometryPointSequence points = new GeometryPointSequence();
points.PointList = geom.STExteriorRing().ToPointsFArray();
points.InnerRing = false;
pointsList.Add(points);
if (numInteriorRing > 1)
for (int i = 1; i <= numInteriorRing; i++)
{
points.PointList = geom.STInteriorRingN(i).ToPointsFArray();
points.InnerRing = true;
pointsList.Add(points);
}
return pointsList;
}
示例4: SqlGeometryToGeometryPolygon
private static IPolygon SqlGeometryToGeometryPolygon(SqlGeometry geometry, GeometryFactory factory)
{
ILinearRing exterior = factory.CreateLinearRing(GetPoints(geometry.STExteriorRing()));
ILinearRing[] interior = null;
if (geometry.STNumInteriorRing() > 0)
{
interior = new ILinearRing[geometry.STNumInteriorRing().Value];
for (int i = 1; i <= interior.Length; i++)
interior[i - 1] = factory.CreateLinearRing(GetPoints(geometry.STInteriorRingN(i)));
}
return factory.CreatePolygon(exterior, interior);
}
示例5: AddMultiLineStringFromPolygon
private void AddMultiLineStringFromPolygon(SqlGeometryBuilder geomBuilder, SqlGeometry poly)
{
int intnum = (int) poly.STNumInteriorRing();
var exteriorRing = poly.STExteriorRing();
if (intnum > 0) geomBuilder.BeginGeometry(OpenGisGeometryType.MultiLineString);
geomBuilder.BeginGeometry(OpenGisGeometryType.LineString);
var startpoint = exteriorRing.STStartPoint();
geomBuilder.BeginFigure((double) startpoint.STX, (double) startpoint.STY);
for (int i = 2; i <= exteriorRing.STNumPoints(); i++)
geomBuilder.AddLine((double) exteriorRing.STPointN(i).STX, (double) exteriorRing.STPointN(i).STY);
geomBuilder.EndFigure();
geomBuilder.EndGeometry();
if (intnum > 0)
{
SqlGeometry intRing;
SqlGeometry point;
for (int i = 1; i <= intnum; i++)
{
intRing = poly.STInteriorRingN(i);
geomBuilder.BeginGeometry(OpenGisGeometryType.LineString);
startpoint = intRing.STStartPoint();
geomBuilder.BeginFigure((double) startpoint.STX, (double) startpoint.STY);
for (int p = 2; p <= intRing.STNumPoints(); p++)
{
point = intRing.STPointN(p);
geomBuilder.AddLine((double) point.STX, (double) point.STY);
}
geomBuilder.EndFigure();
geomBuilder.EndGeometry();
}
geomBuilder.EndFigure();
geomBuilder.EndGeometry();
}
}
示例6: PolygonToMultiLineString
/// <summary>
/// Формирует контур полигона с внутренними кольцами
/// </summary>
/// <param name="poly">Полигон для извлечения контура</param>
/// <returns>Возвращает MULTILINESTRING или LINESTRING при отсутствии внутренних колец</returns>
private SqlGeometry PolygonToMultiLineString(SqlGeometry poly)
{
SqlGeometry result;
int intnum = (int) poly.STNumInteriorRing();
var exteriorRing = poly.STExteriorRing();
var geomBuilder = new SqlGeometryBuilder();
geomBuilder.SetSrid((0));
AddMultiLineStringFromPolygon(geomBuilder, poly);
result = geomBuilder.ConstructedGeometry;
if (result.STIsValid()) return result;
else return result.MakeValid();
}
示例7: RepeatPolygon
private static void RepeatPolygon(SqlGeometryBuilder builder, SqlGeometry shape)
{
try
{
builder.BeginGeometry(OpenGisGeometryType.Polygon);
var internalRingsNum = (int)shape.STNumInteriorRing();
var exteriorRing = shape.STExteriorRing();
// Proceed shortening external ring
AddRingByBuilder(builder, exteriorRing);
// Proceed interior rings
if (internalRingsNum > 0)
for (int i = 1; i <= internalRingsNum; i++)
{
AddRingByBuilder(builder, shape.STInteriorRingN(i));
}
builder.EndGeometry();
}
catch (Exception ex)
{
throw new Exception(string.Format(" RepeatPolygon: {0}", ex.Message));
}
}
示例8: ReprojectPolygon
private void ReprojectPolygon(SqlGeometry geometry, SqlGeometryBuilder bldr)
{
bldr.BeginGeometry(OpenGisGeometryType.Polygon);
ReprojectFigure(geometry.STExteriorRing(), bldr);
if (geometry.STNumInteriorRing() > 0)
{
for (int i = 1, c = geometry.STNumInteriorRing().Value; i <= c; i++)
ReprojectFigure(geometry.STInteriorRingN(i), bldr);
}
bldr.EndGeometry();
}