MapGuide API Reference
|
virtual double MgCoordinateSystemMeasure::GetDistance | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) | [pure virtual] |
Computes the distance between two coordinates.
virtual double GetDistance(double x1, double y1, double x2, double y2); |
virtual double GetDistance(double x1, double y1, double x2, double y2); |
virtual double GetDistance(double x1, double y1, double x2, double y2); |
x1 | (double) The x value in coordinate system units of the first coordinate. |
y1 | (double) The y value in coordinate system units of the first coordinate. |
x2 | (double) The x value in coordinate system units of the second coordinate. |
y2 | (double) The y value in coordinate system units of the second coordinate. |
$distance = $coordSysMeasure->Getdistance(-74.806394, 40.714169, -71.061342, 42.355892);
using OSGeo.MapGuide; private MgCoordinateSystemMeasure geogCSMeasure; private double geogCSX = -160.101421317; private double geogCSY = 22.0234263273; private double geogCSX1 = -159.721535121256; private double geogCSY1 = 24.0028259520524; private double geogCSDistance = 2.0; private double distance; private double tolerance = 0.001; private Boolean isEquivalent; distance = geogCSMeasure.GetDistance(geogCSX, geogCSY, geogCSX1, geogCSY1); // distance has the value of geogCSDistance isEquivalent = Math.Abs(distance - geogCSDistance) < tolerance;
MgCoordinateSystemMeasureFailedException |