Public Function ConvertListAhead(ByVal sourceList As GeoCalcNET.CoordPointCollection, ByVal targetList As GeoCalcNET.CoordPointCollection) As Integer
public System.Int32 ConvertListAhead(GeoCalcNET.CoordPointCollection sourceList, GeoCalcNET.CoordPointCollection targetList)
The ConvertListAhead method takes two CoordPointCollection arguments, the first of which is the list of CoordPoints to be converted, and the second of which is the list that will store the CoordPoints that result from the conversion. The method will take the CoordPoints in the first CoordPointCollection, which must each have a type that matches the SourceCoordSys, convert them to the corresponding CoordPoints in the TargetCoordSys, and store the results in the second CoordPointCollection. If any of the CoordPoints has a type that does not match the type of its respective CoordSys, a GeoCalcException will be thrown. The method returns an Integer value indicating the number of points that were successfully converted.
Private Sub GeoCalcNET_CoordTransform_ConvertListAhead(ByVal ct As GeoCalcNET.CoordTransform)
Dim sourceCPC As New GeoCalcNET.CoordPointCollection
sourceCPC.PointStyle = ct.SourceCoordSys.PointStyle.Clone()
Dim pt1 As GeoCalcNET.CoordPoint = ct.SourceCoordSys.PointStyle.Clone()
pt1.SetInUnits(12.3, 45)
sourceCPC.AddPoint(pt1)
Dim pt2 As GeoCalcNET.CoordPoint = ct.SourceCoordSys.PointStyle.Clone()
pt2.SetInUnits(-1.67, 44)
sourceCPC.AddPoint(pt2)
Dim targetCPC As New GeoCalcNET.CoordPointCollection
targetCPC.PointStyle = ct.TargetCoordSys.PointStyle.Clone()
Dim numConverted As Integer = ct.ConvertListAhead(sourceCPC, targetCPC)
MessageBox.Show("converted " + numConverted.ToString() + " of " + sourceCPC.Count.ToString())
End Sub
private void GeoCalcNET_CoordTransform_ConvertListAhead(GeoCalcNET.CoordTransform ct)
{
GeoCalcNET.CoordPoint sourcePt = (GeoCalcNET.CoordPoint)ct.SourceCoordSys.PointStyle.Clone();
GeoCalcNET.CoordPointCollection sourceCPC = new GeoCalcNET.CoordPointCollection();
sourceCPC.PointStyle = sourcePt;
sourcePt.SetInUnits(34, 45);
sourceCPC.AddPoint(sourcePt);
GeoCalcNET.CoordPoint targetPt = (GeoCalcNET.CoordPoint)ct.TargetCoordSys.PointStyle.Clone();
GeoCalcNET.CoordPointCollection targetCPC = new GeoCalcNET.CoordPointCollection();
targetCPC.PointStyle = targetPt;
int numConverted = ct.ConvertListAhead(sourceCPC, targetCPC);
MessageBox.Show("converted " + numConverted.ToString() + " of " + sourceCPC.Count.ToString());
}