本文整理汇总了C#中PolylineClass.ConstructUnion方法的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass.ConstructUnion方法的具体用法?C# PolylineClass.ConstructUnion怎么用?C# PolylineClass.ConstructUnion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolylineClass
的用法示例。
在下文中一共展示了PolylineClass.ConstructUnion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_GraphicShape
private static IGeometry get_GraphicShape(IEnumElement theElements, int a_Dimensionality, bool multipart, ref IElementCollection elemCollection)
{
IGeometry theReturn = null;
IGeometryCollection theGeomColl = null;
object missing = Type.Missing;
try
{
elemCollection.Clear();
if (theElements != null)
{
theElements.Reset();
IElement theElement = theElements.Next();
while (theElement != null)
{
if (theGeomColl == null)
theGeomColl = new GeometryBagClass();
IGeometry theShape = null;
if (theElement is IGroupElement)
{
theShape = get_GraphicShape(((IGroupElement)theElement).Elements, a_Dimensionality, multipart,ref elemCollection);
}
else if (theElement is ICircleElement
|| theElement is IPolygonElement
|| theElement is IRectangleElement
|| theElement is IEllipseElement
|| theElement is ILineElement
|| theElement is IMarkerElement)
theShape = theElement.Geometry;
if (theShape != null)
theGeomColl.AddGeometry(theShape, ref missing, ref missing);
elemCollection.Add(theElement,-1);
theElement = theElements.Next();
}
}
if (theGeomColl != null && theGeomColl.GeometryCount > 0)
{
ITopologicalOperator theTopoOp = null;
switch (a_Dimensionality)
{
case 0:
if (multipart)
{
theTopoOp = new MultipointClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
}
else
theTopoOp = theGeomColl.get_Geometry(0) as ITopologicalOperator;
break;
case 1:
theTopoOp = new PolylineClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
break;
case 2:
theTopoOp = new PolygonClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
break;
}
theReturn = theTopoOp as IGeometry;
}
}
catch(Exception ex)
{
util.Logger.Write(" Descrip : Finding elements with a specific dimensionality. " +
"\n Message : " + ex.Message +
"\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);
}
return theReturn;
}
示例2: get_GraphicShape
public static IGeometry get_GraphicShape(IEnumElement theElements, int a_Dimensionality, bool multipart)
{
IGeometry theReturn = null;
IGeometryCollection theGeomColl = null;
object missing = Type.Missing;
if (theElements != null)
{
theElements.Reset();
IElement theElement = theElements.Next();
while (theElement != null)
{
if (theGeomColl == null)
theGeomColl = new GeometryBagClass();
IGeometry theShape = null;
if (theElement is IGroupElement)
{
theShape = get_GraphicShape(((IGroupElement)theElement).Elements, a_Dimensionality, multipart);
}
else if (theElement is ICircleElement
|| theElement is IPolygonElement
|| theElement is IRectangleElement
|| theElement is IEllipseElement
|| theElement is ILineElement
|| theElement is IMarkerElement)
theShape = theElement.Geometry;
if (theShape != null)
theGeomColl.AddGeometry(theShape, ref missing, ref missing);
theElement = theElements.Next();
}
}
if (theGeomColl != null && theGeomColl.GeometryCount > 0)
{
ITopologicalOperator theTopoOp = null;
switch (a_Dimensionality)
{
case 0:
if (multipart)
{
theTopoOp = new MultipointClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
}
else
theTopoOp = theGeomColl.get_Geometry(0) as ITopologicalOperator;
break;
case 1:
theTopoOp = new PolylineClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
break;
case 2:
theTopoOp = new PolygonClass();
theTopoOp.ConstructUnion((IEnumGeometry)theGeomColl);
break;
}
theReturn = theTopoOp as IGeometry;
}
return theReturn;
}
示例3: btnOK_Click
//.........这里部分代码省略.........
IFeature trailFromPrevSection = trailFC.GetFeature(Convert.ToInt32(oid));
if (waypointOID == "")
{
geomCol.AddGeometry(trailFromPrevSection.ShapeCopy);
}
else
{
IFeature startKMPost = waypointFC.GetFeature(startKmOID);
IPoint startKMPoint = startKMPost.ShapeCopy as IPoint;
IPoint endPointOnFirstLine = waypointFC.GetFeature(Convert.ToInt32(waypointOID)).ShapeCopy as IPoint;
ICurve curve = trailFromPrevSection.ShapeCopy as ICurve;
bool brs = true; double dfc = 0; double dacToKMPoint = -1; double dacToWayPointOnPath = -1;
IPoint outStartPoint = new PointClass();
curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, startKMPoint, false, outStartPoint, ref dacToKMPoint, ref dfc, ref brs);
curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, endPointOnFirstLine, false, outStartPoint, ref dacToWayPointOnPath, ref dfc, ref brs);
ICurve outCurve = new PolylineClass();
double fromDistance = dacToKMPoint;
double toDistance = dacToWayPointOnPath;
if (dacToWayPointOnPath < dacToKMPoint)
{
fromDistance = dacToWayPointOnPath;
toDistance = dacToKMPoint;
}
curve.GetSubcurve(fromDistance, toDistance, false, out outCurve);
geomCol.AddGeometry(outCurve);
}
}
}
//Total segments is the number of segments in the section, but does NOT include all the segments that might be used to build the km post.
double averageCosineValue = 1.0 / (totalCosValues / totalSegments);
ITopologicalOperator unionedPolyline = new PolylineClass();
unionedPolyline.ConstructUnion(geomCol as IEnumGeometry);
IPolyline fullTrail = unionedPolyline as IPolyline;
IPoint fromPoint2 = fullTrail.FromPoint;
IPoint toPoint2 = fullTrail.ToPoint;
List<IPoint> endPoints = new List<IPoint>() { fromPoint2, toPoint2 };
foreach (IPoint pnt in endPoints)
{
ISpatialFilter spatFilter = new SpatialFilterClass();
spatFilter.Geometry = pnt;
spatFilter.GeometryField = "SHAPE";
spatFilter.WhereClause = "OBJECTID = " + startKmOID;
spatFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
feCur = waypointFC.Search(spatFilter, false);
IFeature wayPointFe = feCur.NextFeature();
if (wayPointFe != null)
{
if (wayPointFe.OID != startKmOID)
{
//The from point of the unioned polyline doesn't match, so we have to reverse direction.
fullTrail.ReverseOrientation();
}
int splitIndex = 1;
int kmAlongTrail = startKmPost;
while (true)
{
double splitDistance = splitIndex * 1000 * averageCosineValue;
if (splitDistance > fullTrail.Length)
{
break;
}
IPoint outPoint = new PointClass();
fullTrail.QueryPoint(esriSegmentExtension.esriNoExtension, splitDistance, false, outPoint);