本文整理汇总了C#中IMultiLineString.GetGeometryN方法的典型用法代码示例。如果您正苦于以下问题:C# IMultiLineString.GetGeometryN方法的具体用法?C# IMultiLineString.GetGeometryN怎么用?C# IMultiLineString.GetGeometryN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMultiLineString
的用法示例。
在下文中一共展示了IMultiLineString.GetGeometryN方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
/// <summary>
///
/// </summary>
/// <param name="multiLineString"></param>
/// <param name="writer"></param>
public void Write(IMultiLineString multiLineString, BinaryWriter writer)
{
writer.Write((int) ShapeGeometryTypes.LineString);
// Write BoundingBox
WriteBoundingBox(multiLineString, writer);
// Write NumParts and NumPoints
writer.Write((int) multiLineString.NumGeometries);
writer.Write((int) multiLineString.NumPoints);
// Write IndexParts
int count = 0;
writer.Write((int) count);
// Write linestrings index
for (int i = 0; i < multiLineString.NumGeometries; i++)
{
// Write internal holes index
count += multiLineString.GetGeometryN(i).NumPoints;
if (count == multiLineString.NumPoints)
break;
writer.Write((int) count);
}
// Write Coordinates
for (int i = 0; i < multiLineString.NumPoints; i++)
Write(multiLineString.Coordinates[i], writer);
}
示例2: WriteMultiLineString
/// <summary>
/// Writes a multilinestring.
/// </summary>
/// <param name="mls">The multilinestring to be written.</param>
/// <param name="bWriter">Stream to write to.</param>
/// <param name="byteorder">Byte order</param>
private static void WriteMultiLineString(IMultiLineString mls, BinaryWriter bWriter, WkbByteOrder byteorder)
{
//Write the number of linestrings.
int num = mls.NumGeometries;
WriteUInt32((uint) num, bWriter, byteorder);
//Loop on the number of linestrings.
//NOTE: by contract, the first item returned
// from GetEnumerator (i.e. using foreach) is the IMultiLineString itself!
for (int i = 0; i < num; i++)
{
ILineString ls = (ILineString) mls.GetGeometryN(i);
//Write LineString Header
bWriter.Write((byte)byteorder);
WriteUInt32((uint)WKBGeometryType.wkbLineString, bWriter, byteorder);
//Write each linestring.
WriteLineString(ls, bWriter, byteorder);
}
}
示例3: TransformMultiLineString
/// <summary>
/// Transforms a <see cref="GeoAPI.Geometries.IMultiLineString"/>.
/// </summary>
/// <param name="lines">MultiLineString 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 MultiLineString</returns>
public static IMultiLineString TransformMultiLineString(IMultiLineString lines, ProjectionInfo from, ProjectionInfo to, IGeometryFactory toFactory)
{
var l = new ILineString[lines.Count];
for (var i = 0; i < lines.Count; i++)
l[i] = TransformLineString((ILineString)lines.GetGeometryN(i), from, to, toFactory);
return toFactory.CreateMultiLineString(l);
}
示例4: AppendMultiLineStringText
/// <summary>
/// Converts a <c>MultiLineString</c> to <MultiLineString Text
/// format, then appends it to the writer.
/// </summary>
/// <param name="multiLineString">The <c>MultiLineString</c> to process.</param>
/// <param name="level"></param>
/// <param name="indentFirst"></param>
/// <param name="writer">The output writer to append to.</param>
private void AppendMultiLineStringText(IMultiLineString multiLineString, int level, bool indentFirst, TextWriter writer)
{
if (multiLineString.IsEmpty)
writer.Write(" EMPTY");
else
{
int level2 = level;
bool doIndent = indentFirst;
writer.Write("(");
for (int i = 0; i < multiLineString.NumGeometries; i++)
{
if (i > 0)
{
writer.Write(",");
level2 = level + 1;
doIndent = true;
}
AppendLineStringText((ILineString) multiLineString.GetGeometryN(i), level2, doIndent, writer);
}
writer.Write(")");
}
}
示例5: ClipLineString
/// <summary>
/// Clips a <see cref="IMultiLineString"/> to the bounding box defined by <see cref="CohenSutherlandLineClipping(double,double,double,double)"/>.
/// </summary>
/// <param name="lineStrings">The multi-line string to clip</param>
/// <returns>A (possibly multi) line string</returns>
public IMultiLineString ClipLineString(IMultiLineString lineStrings)
{
var clippedLineStringList = new List<ILineString>();
for (var i = 0; i < lineStrings.NumGeometries; i++)
{
var s = (ILineString) lineStrings.GetGeometryN(i);
var clippedLineStrings = ClipLineString(s);
for (var j = 0; j < clippedLineStrings.NumGeometries; j++)
{
var clippedLineString = (ILineString)clippedLineStrings.GetGeometryN(j);
clippedLineStringList.Add(clippedLineString);
}
}
return lineStrings.Factory.CreateMultiLineString(clippedLineStringList.ToArray());
}
示例6: FromMultiLineString
private static DSMultiLineString FromMultiLineString(IMultiLineString geometry, DSGeometryFactory factory, bool setUserData)
{
var dsLineStrings = new DotSpatial.Topology.IBasicLineString[geometry.NumGeometries];
for (var i = 0; i < dsLineStrings.Length; i++)
dsLineStrings[i] = FromLineString((ILineString)geometry.GetGeometryN(i), factory, setUserData);
var result = factory.CreateMultiLineString(dsLineStrings);
if (setUserData)
result.UserData = geometry.UserData;
return result;
}
示例7: TransformMultiLineString
/// <summary>
///
/// </summary>
/// <param name="geom"></param>
/// <param name="parent"></param>
/// <returns></returns>
protected virtual IGeometry TransformMultiLineString(IMultiLineString geom, IGeometry parent)
{
ArrayList transGeomList = new ArrayList();
for (int i = 0; i < geom.NumGeometries; i++)
{
IGeometry transformGeom = TransformLineString((ILineString) geom.GetGeometryN(i), geom);
if (transformGeom == null) continue;
if (transformGeom.IsEmpty) continue;
transGeomList.Add(transformGeom);
}
return factory.BuildGeometry(transGeomList);
}
示例8: FromMultiLineString
private static GeoAPIMultiLineString FromMultiLineString(IMultiLineString geometry, GeoAPIGeometryFactory factory, bool copyUserData)
{
var dsLineStrings = new GeoAPILineString[geometry.NumGeometries];
for (var i = 0; i < dsLineStrings.Length; i++)
dsLineStrings[i] = FromLineString((ILineString)geometry.GetGeometryN(i), factory, copyUserData);
var result = factory.CreateMultiLineString(dsLineStrings);
if (copyUserData)
result.UserData = geometry.UserData;
return result;
}
示例9: ToShape
private GraphicsPath ToShape(IMultiLineString mls)
{
var path = new GraphicsPath();
for (var i = 0; i < mls.NumGeometries; i++)
{
path.AddPath(ToShape((ILineString)mls.GetGeometryN(i)), false);
}
return path;
}
示例10: ComputeBoundaryCoordinates
//private Map endpointMap;
private Coordinate[] ComputeBoundaryCoordinates(IMultiLineString mLine)
{
IList<Coordinate> bdyPts = new List<Coordinate>();
_endpointMap = new OrderedDictionary<Coordinate, Counter>();
for (int i = 0; i < mLine.NumGeometries; i++)
{
ILineString line = (ILineString)mLine.GetGeometryN(i);
if (line.NumPoints == 0)
continue;
AddEndpoint(line.GetCoordinateN(0));
AddEndpoint(line.GetCoordinateN(line.NumPoints - 1));
}
foreach (KeyValuePair<Coordinate, Counter> entry in _endpointMap)
{
Counter counter = entry.Value;
int valence = counter.Count;
if (_bnRule.IsInBoundary(valence))
{
bdyPts.Add(entry.Key);
}
}
return CoordinateArrays.ToCoordinateArray(bdyPts);
}
示例11: AppendMultiLineStringText
/// <summary>
/// Converts a MultiLineString to <MultiLineString Text>
/// format, then Appends it to the writer.
/// </summary>
/// <param name="multiLineString">The MultiLineString to process.</param>
/// <param name="writer">The output stream writer to Append to.</param>
private static void AppendMultiLineStringText(IMultiLineString multiLineString, StringWriter writer)
{
if (multiLineString == null || multiLineString.IsEmpty)
writer.Write("EMPTY");
else
{
writer.Write("(");
for (var i = 0; i < multiLineString.NumGeometries; i++)
{
if (i > 0)
writer.Write(", ");
AppendLineStringText((ILineString)multiLineString.GetGeometryN(i), writer);
}
writer.Write(")");
}
}
示例12: Write
/// <summary>
/// Writes <paramref name="multiLineString"/> to a stream using <paramref name="writer"/>
/// </summary>
/// <param name="multiLineString">The multi linestring to write</param>
/// <param name="writer">The writer to use</param>
public void Write(IMultiLineString multiLineString, BinaryWriter writer)
{
writer.Write((int) ShapeGeometryType.LineString);
// Write BoundingBox
WriteBoundingBox(multiLineString.EnvelopeInternal, writer);
// Write NumParts and NumPoints
writer.Write((int) multiLineString.NumGeometries);
writer.Write((int) multiLineString.NumPoints);
// Write IndexParts
int count = 0;
writer.Write((int) count);
var seq = multiLineString.Factory.CoordinateSequenceFactory.Create(multiLineString.NumPoints,
((ILineString) multiLineString[0]).CoordinateSequence.Ordinates);
// Write linestrings index
for (int i = 0; i < multiLineString.NumGeometries; i++)
{
// Write internal holes index
var ls = ((ILineString) multiLineString.GetGeometryN(i)).CoordinateSequence;
CoordinateSequences.Copy(ls, 0, seq, count, ls.Count);
count += ls.Count;
if (count == multiLineString.NumPoints)
break;
writer.Write((int) count);
}
// Write Coordinates
Write(multiLineString.Coordinates, writer);
}