本文整理汇总了Java中org.gavaghan.geodesy.GeodeticCalculator类的典型用法代码示例。如果您正苦于以下问题:Java GeodeticCalculator类的具体用法?Java GeodeticCalculator怎么用?Java GeodeticCalculator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeodeticCalculator类属于org.gavaghan.geodesy包,在下文中一共展示了GeodeticCalculator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTrackDistances
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
/**
* updates the distance information in the trackpoints of the track object.
*
* @param track
* Track object to update
* @throws java.lang.NullPointerException
* if track is empty
*/
public static void updateTrackDistances(Track track) {
Optional.ofNullable(Objects.requireNonNull(track).getTrackPoints()).ifPresent(trackPoints -> {
GeodeticCalculator geoCalc = new GeodeticCalculator();
Double distance = 0.0;
GlobalCoordinates lastCoordinate = null;
for (TrackPoint trackPoint : trackPoints) {
trackPoint.setDistance(distance);
GlobalCoordinates thisCoordinate =
new GlobalCoordinates(trackPoint.getLatitude(), trackPoint.getLongitude());
if (null != lastCoordinate) {
distance += geoCalc.calculateGeodeticCurve(Ellipsoid.WGS84, lastCoordinate, thisCoordinate)
.getEllipsoidalDistance();
}
lastCoordinate = thisCoordinate;
}
});
}
示例2: GeoEllipse
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoEllipse(GeoPoint pivot, double widthMeters, double heightMeters, double maxDistanceMeters,
double flatnessDistanceMeters, int limit) {
//super(maxDistanceMeters, flatnessDistanceMeters, limit);
//path = new Path2D.Double();
path = new GeneralPath();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
this.flatnessDistanceMeters = flatnessDistanceMeters;
this.limit = limit;
arcTo(pivot, widthMeters, heightMeters, 0, 180);
arcTo(pivot, widthMeters, heightMeters, 180, 0);
}
示例3: GeoBlock2
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoBlock2(GeoPoint p1, GeoPoint p2, double leftWidthMeters, double rightWidthMeters, double maxDistanceMeters,
double flatnessDistanceMeters, int limit) {
//super(maxDistanceMeters, flatnessDistanceMeters, limit);
path = new GeneralPath();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
//this.flatnessDistanceMeters = flatnessDistanceMeters;
//this.limit = limit;
GlobalCoordinates c1 = toGlobalCoord(p1);
GlobalCoordinates c2 = toGlobalCoord(p2);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, c1, c2);
double a1 = curve.getAzimuth();
double a2 = curve.getReverseAzimuth();
double leftRadius = leftWidthMeters;
double rightRadius = rightWidthMeters;
//diagnostic to prevent error in calculate global coords if points are identical
if(p1.x==p2.x && p1.y==p2.y)
return;
//end section
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, leftRadius);
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, leftRadius);
moveToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, leftRadius);
lineToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, rightRadius);
lineToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, rightRadius);
lineToLatLong(c.getLongitude(), c.getLatitude());
closePath();
}
示例4: GeoPath
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoPath(double maxDistanceMeters, double flatnessDistanceMeters, int limit) {
path = new GeneralPath();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
this.flatnessDistanceMeters = flatnessDistanceMeters;
this.limit = limit;
}
示例5: GeoBlock
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoBlock(GeoPoint p1, GeoPoint p2, double widthMeters, double maxDistanceMeters,
double flatnessDistanceMeters, int limit) {
//super(maxDistanceMeters, flatnessDistanceMeters, limit);
path = new GeneralPath();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
//this.flatnessDistanceMeters = flatnessDistanceMeters;
//this.limit = limit;
GlobalCoordinates c1 = toGlobalCoord(p1);
GlobalCoordinates c2 = toGlobalCoord(p2);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, c1, c2);
double a1 = curve.getAzimuth();
double a2 = curve.getReverseAzimuth();
double radius = widthMeters / 2;
//diagnostic to prevent error in calculate global coords if points are identical
if(p1.x==p2.x && p1.y==p2.y)
return;
//end section
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, radius);
moveToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, radius);
lineToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, radius);
lineToLatLong(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, radius);
lineToLatLong(c.getLongitude(), c.getLatitude());
closePath();
}
示例6: GeoArc
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoArc(GeoPoint pivot, double widthMeters, double heightMeters, double leftAzimuth, double rightAzimuth,
double maxDistanceMeters, double flatnessDistanceMeters, int limit) {
//super(maxDistanceMeters, flatnessDistanceMeters, limit);
path = new GeneralPath();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
this.flatnessDistanceMeters = flatnessDistanceMeters;
this.limit = limit;
moveTo(pivot);
arcTo(pivot, widthMeters, heightMeters, leftAzimuth, rightAzimuth);
closePath();
}
示例7: GeoPath
import org.gavaghan.geodesy.GeodeticCalculator; //导入依赖的package包/类
public GeoPath(double maxDistanceMeters, double flatnessDistanceMeters, int limit) {
path = new Path2D.Double();
toPoints = new ArrayList<GeoPoint>();
geoCalc = new GeodeticCalculator();
this.maxDistanceMeters = maxDistanceMeters;
this.flatnessDistanceMeters = flatnessDistanceMeters;
this.limit = limit;
}