だからここに私の解決策があります。2D 投影の「中心」は相対的であるべきだと判断しました。それは私たちの仕事に合っています。いくつかのコード サンプルを次に示します。
public final class GeometryUtil {
/**
https://www.cfa.harvard.edu/~dfabricant/huchra/ay145/constants.html
1 Earth Radius = 6.37814x108 cm = 6.37814x10^6 m (Equatorial)
*/
public static final double EARTH_RADIUS_IN_METERS = 6.37814e+6;
private GeometryUtil(){}
/**
* @param geoPoint is a point of some object you want to translate to Cartesian.
* @param geoPointRelative is a point of relative center.
* We suppose that this relative GeoPoint is a center for the first parameter.
* */
public static Coordinate toCoordinate(GeoPoint geoPoint, GeoPoint geoPointRelative){
return new Coordinate(toX(geoPoint, geoPointRelative.getLongitude()),
toY(geoPoint, geoPointRelative.getLatitude()));
}
public static double toX(GeoPoint geoPoint, double relativeLongitude){
return EARTH_RADIUS_IN_METERS *
cos(toRadians(geoPoint.getLatitude())) *
toRadians(geoPoint.getLongitude()- relativeLongitude);
}
public static double toY(GeoPoint geoPoint, double relativeLatitude){
return EARTH_RADIUS_IN_METERS * toRadians(geoPoint.getLatitude() - relativeLatitude);
}
}
以下は、Geometry フィギュアのビルダーです。
public final class GeometryBuilder {
private static final int DIAMETER_MULTIPLIER = 2;
private static final int TURN_LEFT = 90; //We should start to roll to the right from "North"/"Up"/12 o'clock
private GeometryBuilder(){}
public static Circle buildCirlce(GeoPoint centerOfCircle, GeoPoint relativeCenter, Distance radiusDistance){
GeometricShapeFactory geometricShapeFactory = new GeometricShapeFactory();
geometricShapeFactory.setCentre(GeometryUtil.toCoordinate(centerOfCircle, relativeCenter));
geometricShapeFactory.setSize(radiusDistance.getMeters() * DIAMETER_MULTIPLIER);
return new Circle(geometricShapeFactory.createEllipse());
}
public static Sector buildGSMCellSector(GSMCellLocation gsmCellLocation, GeoPoint relativeCenter){
GeometricShapeFactory geometricShapeFactory = new GeometricShapeFactory();
geometricShapeFactory.setCentre(GeometryUtil.toCoordinate(gsmCellLocation.getGeoPoint(), relativeCenter));
geometricShapeFactory.setSize(gsmCellLocation.getMidDist() * DIAMETER_MULTIPLIER);
return new Sector(geometricShapeFactory.createArcPolygon(-toRadians(gsmCellLocation.getEndAngle()- TURN_LEFT),
toRadians(gsmCellLocation.getAngleWidth())));
}
}
TURN_LEFT は特定のものであることに言及する必要があります。オブジェクトの角度は 12 時から始まります。ジオメトリ ライブラリは 3 時からカウントを開始します。そのため、3 時間 (90 度) 戻さなければなりません。
問題は解決された。また、LiteShape を使用して、いくつかの画像を PNG ファイルに描画しました。大丈夫です。