本文整理汇总了Java中org.gavaghan.geodesy.GlobalCoordinates类的典型用法代码示例。如果您正苦于以下问题:Java GlobalCoordinates类的具体用法?Java GlobalCoordinates怎么用?Java GlobalCoordinates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlobalCoordinates类属于org.gavaghan.geodesy包,在下文中一共展示了GlobalCoordinates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTrackDistances
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的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: GeoBlock2
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public GeoBlock2(GeoPoint p1, GeoPoint p2, double leftWidthMeters, double rightWidthMeters, double maxDistanceMeters,
double flatnessDistanceMeters, int limit) {
super(maxDistanceMeters, flatnessDistanceMeters, 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;
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, leftRadius);
moveTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, leftRadius);
lineTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, rightRadius);
lineTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, rightRadius);
lineTo(c.getLongitude(), c.getLatitude());
closePath();
}
示例3: GeoBlock
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public GeoBlock(GeoPoint p1, GeoPoint p2, double widthMeters, double maxDistanceMeters,
double flatnessDistanceMeters, int limit) {
super(maxDistanceMeters, flatnessDistanceMeters, 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;
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 - 90, radius);
moveTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 + 90, radius);
lineTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c2, a2 - 90, radius);
lineTo(c.getLongitude(), c.getLatitude());
c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, c1, a1 + 90, radius);
lineTo(c.getLongitude(), c.getLatitude());
closePath();
}
示例4: distance3D
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public double distance3D(WayPoint other) {
double d = geoCalc.calculateGeodeticCurve(reference,
new GlobalCoordinates(getLat(), this.getLon()),
new GlobalCoordinates(other.getLat(), other.getLon())
).getEllipsoidalDistance();
if (!Double.isNaN(getEle()) && !Double.isNaN(other.getEle())) {
double h = (getEle() - other.getEle());
return Math.sqrt(d * d + h * h);
} else return d;
}
示例5: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
//Path2D newPath = new Path2D.Double();
GeneralPath newPath = new GeneralPath();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
toPoints.add(point);
}
示例6: GeoBlock2
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的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();
}
示例7: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
GeneralPath newPath = new GeneralPath();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
toPoints.add(point);
simplify();
}
示例8: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
GeneralPath newPath = new GeneralPath();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
toPoints.add(point);
}
示例9: GeoBlock
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的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();
}
示例10: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
GeneralPath newPath = new GeneralPath();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
//path.lineTo(point.x, point.y);
toPoints.add(point);
simplify();
}
示例11: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
GeneralPath newPath = new GeneralPath();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
toPoints.add(point);
}
示例12: lineTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public void lineTo(GeoPoint point) {
Path2D newPath = new Path2D.Double();
// Move to the initial point
GeoPoint lastPoint = new GeoPoint();
if (toPoints.size() > 0) {
lastPoint = toPoints.get(toPoints.size() - 1);
newPath.moveTo(lastPoint.x, lastPoint.y);
}
// Calculate the curve to the new point
GlobalCoordinates start = toGlobalCoord(lastPoint);
GlobalCoordinates end = toGlobalCoord(point);
GeodeticCurve curve = geoCalc.calculateGeodeticCurve(REFERENCE_ELLIPSOID, start, end);
// Generate points along the curve, adding them to the new path
double distance = maxDistanceMeters;
while (distance < curve.getEllipsoidalDistance()) {
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, start, curve
.getAzimuth(), distance);
newPath.lineTo(c.getLongitude(), c.getLatitude());
distance += maxDistanceMeters;
}
newPath.lineTo(point.x, point.y);
// Append the new path to the existing path
path.append(newPath, true);
toPoints.add(point);
}
示例13: distance
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public double distance(WayPoint other) {
return geoCalc.calculateGeodeticCurve(reference,
new GlobalCoordinates(getLat(), this.getLon()),
new GlobalCoordinates(other.getLat(), other.getLon())
).getEllipsoidalDistance();
}
示例14: arcTo
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
public final void arcTo(GeoPoint pivot, double widthMeters, double heightMeters, double leftAzimuthDegrees,
double rightAzimuthDegrees) {
//Path2D newPath = new Path2D.Double();
GeneralPath newPath = new GeneralPath();
Arc2D arc;
if (leftAzimuthDegrees > rightAzimuthDegrees) {
arc = new Arc2D(-widthMeters / 2, -heightMeters / 2, widthMeters, heightMeters,
leftAzimuthDegrees - 90, Math.abs((360 - leftAzimuthDegrees) + rightAzimuthDegrees), Arc2D.OPEN);
} else {
arc = new Arc2D(-widthMeters / 2, -heightMeters / 2, widthMeters, heightMeters,
leftAzimuthDegrees - 90, Math.abs(leftAzimuthDegrees - rightAzimuthDegrees), Arc2D.OPEN);
}
GeoPoint point = null;
if (pivot != null) {
FlatteningPathIterator it = new FlatteningPathIterator(arc.getPathIterator(null), flatnessDistanceMeters, limit);
while (!it.isDone()) {
// Add a point to the list for each segment flattened from the curve
double[] strokePoints = new double[6];
int type = it.currentSegment(strokePoints);
double x = strokePoints[0];
double y = strokePoints[1];
double azimuth = Angle.toDegrees(Math.atan2(x, y));
GlobalCoordinates coord = new GlobalCoordinates(pivot.getLatitude(), pivot.getLongitude());
GlobalCoordinates c = geoCalc.calculateEndingGlobalCoordinates(REFERENCE_ELLIPSOID, coord, azimuth,
//new Point2D().distance(x, y));
Point2D.distance(0, 0, x, y));
switch (type) {
case PathIterator.SEG_MOVETO:
newPath.moveTo(c.getLongitude(), c.getLatitude());
GeoPoint startPoint = new GeoPoint(c.getLongitude(), c.getLatitude());
if (toPoints.size() > 0 && !startPoint.equals(toPoints.get(toPoints.size() - 1))) {
lineTo(startPoint);
}
break;
case PathIterator.SEG_LINETO:
newPath.lineTo(c.getLongitude(), c.getLatitude());
point = new GeoPoint(c.getLongitude(), c.getLatitude());
break;
}
it.next();
}
}
path.append(newPath, true);
toPoints.add(point);
}
示例15: toGlobalCoord
import org.gavaghan.geodesy.GlobalCoordinates; //导入依赖的package包/类
protected GlobalCoordinates toGlobalCoord(GeoPoint point) {
return new GlobalCoordinates(point.getLatitude(), point.getLongitude());
}