project method
Projects a geographic coordinate longitude, latitude to screen coordinates.
Implementation
@override
Point project(double longitude, double latitude) {
final lambda = toRadians(longitude - centerLon + _rotate0);
final phi = toRadians(latitude);
final cosLambda = math.cos(lambda);
final sinLambda = math.sin(lambda);
final cosPhi = math.cos(phi);
final sinPhi = math.sin(phi);
// Check if point is on visible hemisphere
final cosc = math.sin(toRadians(centerLat)) * sinPhi +
math.cos(toRadians(centerLat)) * cosPhi * cosLambda;
if (cosc < 0) {
// Point is on back of globe, return NaN
return const Point(double.nan, double.nan);
}
final x = cosPhi * sinLambda;
final y = math.cos(toRadians(centerLat)) * sinPhi -
math.sin(toRadians(centerLat)) * cosPhi * cosLambda;
return applyTransform(x, -y);
}