本文整理汇总了C#中IGeometryFactory.BuildGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometryFactory.BuildGeometry方法的具体用法?C# IGeometryFactory.BuildGeometry怎么用?C# IGeometryFactory.BuildGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGeometryFactory
的用法示例。
在下文中一共展示了IGeometryFactory.BuildGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Buffer
/// <summary>
///
/// </summary>
/// <param name="g"></param>
/// <param name="distance"></param>
/// <returns></returns>
public IGeometry Buffer(IGeometry g, double distance)
{
IPrecisionModel precisionModel = workingPrecisionModel;
if (precisionModel == null)
precisionModel = g.PrecisionModel;
// factory must be the same as the one used by the input
geomFact = g.Factory;
OffsetCurveBuilder curveBuilder = new OffsetCurveBuilder(precisionModel, quadrantSegments);
curveBuilder.EndCapStyle = endCapStyle;
OffsetCurveSetBuilder curveSetBuilder = new OffsetCurveSetBuilder(g, distance, curveBuilder);
IList bufferSegStrList = curveSetBuilder.GetCurves();
// short-circuit test
if (bufferSegStrList.Count <= 0)
{
IGeometry emptyGeom = geomFact.CreateGeometryCollection(new IGeometry[0]);
return emptyGeom;
}
ComputeNodedEdges(bufferSegStrList, precisionModel);
graph = new PlanarGraph(new OverlayNodeFactory());
graph.AddEdges(edgeList.Edges);
IList subgraphList = CreateSubgraphs(graph);
PolygonBuilder polyBuilder = new PolygonBuilder(geomFact);
BuildSubgraphs(subgraphList, polyBuilder);
IList resultPolyList = polyBuilder.Polygons;
IGeometry resultGeom = geomFact.BuildGeometry(resultPolyList);
return resultGeom;
}
示例2: Buffer
public IGeometry Buffer(IGeometry g, double distance)
{
IPrecisionModel precisionModel = _workingPrecisionModel;
if (precisionModel == null)
precisionModel = g.PrecisionModel;
// factory must be the same as the one used by the input
_geomFact = g.Factory;
OffsetCurveBuilder curveBuilder = new OffsetCurveBuilder(precisionModel, _bufParams);
OffsetCurveSetBuilder curveSetBuilder = new OffsetCurveSetBuilder(g, distance, curveBuilder);
var bufferSegStrList = curveSetBuilder.GetCurves();
// short-circuit test
if (bufferSegStrList.Count <= 0)
{
return CreateEmptyResultGeometry();
}
ComputeNodedEdges(bufferSegStrList, precisionModel);
_graph = new PlanarGraph(new OverlayNodeFactory());
_graph.AddEdges(_edgeList.Edges);
IEnumerable<BufferSubgraph> subgraphList = CreateSubgraphs(_graph);
PolygonBuilder polyBuilder = new PolygonBuilder(_geomFact);
BuildSubgraphs(subgraphList, polyBuilder);
var resultPolyList = polyBuilder.Polygons;
// just in case...
if (resultPolyList.Count <= 0)
{
return CreateEmptyResultGeometry();
}
IGeometry resultGeom = _geomFact.BuildGeometry(resultPolyList);
return resultGeom;
}
示例3: ToNodedLines
private IGeometry ToNodedLines(ICollection<ISegmentString> segStrings, IGeometryFactory geomFact)
{
var lines = new List<IGeometry>();
foreach (NodedSegmentString nss in segStrings)
{
// skip collapsed lines
if (nss.Count < 2)
continue;
//Coordinate[] pts = getCoords(nss);
var pts = nss.NodeList.GetSplitCoordinates();
lines.Add(geomFact.CreateLineString(pts));
}
return geomFact.BuildGeometry(lines);
}