Provides access to a set of generic methods that can be used in all languages supported.
Description
You can use the IGeometryBridge methods with any supported development languages: Java, C#, VB.Net, VB 6.0, C++, etc. The methods on the regular interfaces (IGeometryCollection, ISegmentCollection, IPointCollection, etc) are using C style arrays, which are not supported by some languages. The IGeometryBridge interface solves that problem allowing you to pass safe arrays instead.
Members
Name | Description | |
---|---|---|
AddGeometries | Adds references to the specified geometries. | |
AddPoints | Adds copies of the input points as vertices to this Path, Ring, Polyline, or Polygon; or references to the input points to this Multipoint, Triangles, TriangleFan, or TriangleStrip. | |
AddSegments | Adds references to segments. | |
AddWKSPoints | Adds vertices to this Path, Ring, Polyline, or Polygon, or adds new points to this Multipoint, Triangles, TriangleFan, or TriangleStrip. | |
AddWKSPointZs | Adds vertices/points to this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch. | |
ConstructBuffers | Constructs a set of buffers at various distances. More efficient than calling Buffer repeatedly on the same geometry. | |
Densify | Densify segment into the specified number of smaller segments. | |
GetPoints | Populates an array with references to points in the Multipoint. The QueryPoints method on IPointCollection makes copies of the points. | |
InsertGeometries | Inserts at the specified index references to some number of geometries in the input array. | |
InsertPoints | Inserts copies of the input points as vertices into a Path, Ring, Polyline, or Polygon; or references to the input points into a Multipoint, Triangles, TriangleFan, or TriangleStrip. | |
InsertSegments | Inserts references to the input segments. | |
InsertWKSPoints | Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch. | |
InsertWKSPointZs | Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch. | |
QueryBeginningRings | Populates an array with references to all beginning rings of the specified types. | |
QueryFollowingRings | Populates an array with references to following rings that are in the ring group that starts with the specified beginning ring. | |
QueryGeometries | Populates the array with references to a sub-sequence of geometries. | |
QueryPoints | Copies some points to an existing array of points. | |
QuerySegments | Returns references to some of the input segments. | |
QueryWKSPoints | Copies vertices'/points' coordinates to the array of point structures. | |
QueryWKSPointZs | Copies vertices/points coordinates to the array of point structures. | |
ReplacePoints | Replaces vertices/points within a PointCollection. | |
ReplaceSegments | Removes and inserts from segments. | |
SetGeometries | Replaces all geometries in the collection with the specified number of references to those in the input array. | |
SetPoints | Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with references to the input points. | |
SetSegments | Replaces all segments with references to the input segments. | |
SetWKSPoints | Replaces all vertices of this Path, Ring, Polyline, or Polygon with new ones, or replaces all points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with new ones. | |
SetWKSPointZs | Replaces all vertices/points of this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch with new ones. | |
SplitAtDistances | Introduces new vertices into this polyline at specified distances from the beginning of the polyline. | |
SplitDivideLength | Divide segment into smaller segments of the specified length. |
IGeometryBridge2.AddWKSPoints Method
Adds vertices to this Path, Ring, Polyline, or Polygon, or adds new points to this Multipoint, Triangles, TriangleFan, or TriangleStrip.
Public Sub AddWKSPoints ( _
ByVal pPointCollection As IPointCollection4, _
ByRef pointStructures As WKSPoint[] _
)
public void AddWKSPoints (
IPointCollection4 pPointCollection,
ref WKSPoint[] pointStructures
);
public void AddWKSPoints()
{
int length = 10;
WKSPoint[] pointArray = new WKSPoint[length];
for (int i = 0; i < length; i++)
{
pointArray[i] = new WKSPoint();
pointArray[i].X = i * 10;
pointArray[i].Y = i * 10;
}
IPointCollection4 pointCollection = new MultipointClass();
//adds WKSpointZs to pointCollection
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddWKSPoints(pointCollection, ref pointArray);
System.Windows.Forms.MessageBox.Show(pointCollection.PointCount + " Points added");
}
IGeometryBridge2.InsertWKSPoints Method
Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch.
Public Sub InsertWKSPoints ( _
ByVal pPointCollection As IPointCollection4, _
ByVal Index As Integer, _
ByRef pointStructures As WKSPoint[] _
)
public void InsertWKSPoints (
IPointCollection4 pPointCollection,
int Index,
ref WKSPoint[] pointStructures
);
public void InsertWKSPoints()
{
int length = 10;
WKSPoint[] pointArray = new WKSPoint[length];
for (int i = 0; i < length; i++)
{
pointArray[i] = new WKSPoint();
pointArray[i].X = i * 10;
pointArray[i].Y = i * 10;
}
IPointCollection4 pointCollection = new MultipointClass();
//add points to pointCollection
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddWKSPoints(pointCollection, ref pointArray);
//insert points
int secondArrayLength = 5;
WKSPoint[] secondPointArray = new WKSPoint[secondArrayLength];
for (int i = 0; i < secondArrayLength; i++)
{
secondPointArray[i] = new WKSPoint();
secondPointArray[i].X = i * 33;
secondPointArray[i].Y = i * 33;
}
int index = 1;
geometryBridge.InsertWKSPoints(pointCollection, index, ref secondPointArray);
}
IGeometryBridge2.QueryWKSPoints Method
Copies vertices'/points' coordinates to the array of point structures.
Public Sub QueryWKSPoints ( _
ByVal pPointCollection As IPointCollection4, _
ByVal Index As Integer, _
ByRef pointStructures As WKSPoint[] _
)
public void QueryWKSPoints (
IPointCollection4 pPointCollection,
int Index,
ref WKSPoint[] pointStructures
);
public void QueryWKSPoints()
{
int length = 10;
WKSPoint[] pointArray = new WKSPoint[length];
for (int i = 0; i < length; i++)
{
pointArray[i] = new WKSPoint();
pointArray[i].X = i * 10;
pointArray[i].Y = i * 10;
}
IPointCollection4 pointCollection = new MultipointClass();
//adds WKSpointZs to pointCollection I
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddWKSPoints(pointCollection, ref pointArray);
//prepare output
int index = 5;
WKSPoint[] outPutPointArray = new WKSPoint[pointCollection.PointCount - index];
for (int i = 0; i < outPutPointArray.Length; i++)
{
outPutPointArray[i] = new WKSPoint();
}
//query
geometryBridge.QueryWKSPoints(pointCollection, index, ref outPutPointArray);
String report = "";
for (int i = 0; i < outPutPointArray.Length; i++)
{
WKSPoint currentPoint = outPutPointArray[i];
report = report + "index = " + (i + index) + " ,X = " + currentPoint.X + " ,Y = " + currentPoint.Y + "\n";
}
System.Windows.Forms.MessageBox.Show(report);
}
IGeometryBridge2.SetWKSPoints Method
Replaces all vertices of this Path, Ring, Polyline, or Polygon with new ones, or replaces all points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with new ones.
Public Sub SetWKSPoints ( _
ByVal pPointCollection As IPointCollection4, _
ByRef pointStructures As WKSPoint[] _
)
public void SetWKSPoints (
IPointCollection4 pPointCollection,
ref WKSPoint[] pointStructures
);
public void SetWKSPoints()
{
int length = 10;
WKSPoint[] pointArray = new WKSPoint[length];
for (int i = 0; i < length; i++)
{
pointArray[i] = new WKSPoint();
pointArray[i].X = i * 10;
pointArray[i].Y = i * 10;
}
IPointCollection4 pointCollection = new MultipointClass();
//add points to pointCollection
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddWKSPoints(pointCollection, ref pointArray);
//set points - overrides all existing points
int secondArrayLength = 5;
WKSPoint[] secondPointArray = new WKSPoint[secondArrayLength];
for (int i = 0; i < secondArrayLength; i++)
{
secondPointArray[i] = new WKSPoint();
secondPointArray[i].X = i * 33;
secondPointArray[i].Y = i * 33;
}
geometryBridge.SetWKSPoints(pointCollection, ref secondPointArray);
}
IGeometryBridge2.SplitAtDistances Method
Introduces new vertices into this polyline at specified distances from the beginning of the polyline.
Public Function SplitAtDistances ( _
ByVal polyCurve As IPolycurve2, _
ByRef distances As Double[]&, _
ByVal asRatios As Boolean, _
ByVal createParts As Boolean _
) As IEnumSplitPoint
public IEnumSplitPoint SplitAtDistances (
IPolycurve2 polyCurve,
ref Double[]& distances,
ref bool asRatios,
ref bool createParts
);
public void SplitAtDistances()
{
//Construct Polycurve
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(100, 0);
IPolycurve2 polyCurve = new PolylineClass();
polyCurve.FromPoint = fromPoint;
polyCurve.ToPoint = toPoint;
//split in 10 parts using absolute length, therefore asRatio = false
bool asRatio = false;
double[] distances = new double[10];
for (int i = 0; i < 10; i++)
{
distances[i] = (polyCurve.Length / 100) * (i + 1) * 10;
}
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
IEnumSplitPoint splitPoints = geometryBridge.SplitAtDistances(polyCurve, ref distances, asRatio, true);
//print splitPoints
splitPoints.Reset();
IPoint currentPoint;
int partIndex;
int vertexIndex;
splitPoints.Next(out currentPoint, out partIndex, out vertexIndex);
while (currentPoint != null)
{
System.Windows.Forms.MessageBox.Show("X = " + currentPoint.X + " ,Y = " + currentPoint.Y);
splitPoints.Next(out currentPoint, out partIndex, out vertexIndex);
}
}
IGeometryBridge2.SplitDivideLength Method
Divide segment into smaller segments of the specified length.
Public Sub SplitDivideLength ( _
ByVal pSegment As ISegment, _
ByVal Offset As Double, _
ByVal Length As Double, _
ByVal asRatio As Boolean, _
ByRef numSplitSegments As Integer, _
ByRef splitSegments As ISegment[] _
)
public void SplitDivideLength (
ISegment pSegment,
double Offset,
double Length,
bool asRatio,
ref int numSplitSegments,
ref ISegment[] splitSegments
);
public void SplitDivideLength()
{
//Construct Polycurve
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(100, 0);
ILine line = new LineClass();
line.FromPoint = fromPoint;
line.ToPoint = toPoint;
/* offset: start, 0 -> we start from the beginning
* length: the desired output length for all segments execpt the last one
* asRatio: ratio
*/
double offset = 0;
double length = 10;
bool asRatio = false;
int numberOfSplittedSegments;
//NOTE that our array is of length 2 but we will get 10 Segments.
//This means that only the first 2 Segements are copied to the array.
//Nevertheless numberOfSplittedSegments will be = 10
ISegment[] splittedSegments = new ISegment[2];
for (int i = 0; i < 2; i++)
{
splittedSegments[i] = new PolylineClass() as ISegment;
}
ISegment segment = line as ISegment;
IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass();
geometryBridge.SplitDivideLength(segment, offset, length, asRatio, out numberOfSplittedSegments, ref splittedSegments);
//print segments length
for (int i = 0; i < splittedSegments.Length; i++)
{
System.Windows.Forms.MessageBox.Show(splittedSegments[i].Length.ToString());
}
}
Inherited Interfaces
Interfaces | Description |
---|---|
IGeometryBridge | Provides access to a set of generic methods that can be used in all languages supported. |
Classes that implement IGeometryBridge2
Classes | Description |
---|---|
GeometryEnvironment | Provides a way of creating geometries from different inputs and setting/getting global variables for controlling behavior of geometry methods. |