+ public AltosPointDouble screen(double lat, double lon) {
+ return screen(point(lat, lon));
+ }
+
+ /* Return first longitude value which ends up on-screen */
+ public double first_lon(double lon) {
+ /* Find a longitude left of the screen */
+ for (;;) {
+ double x = lon * scale_x - offset_x;
+ if (x < 0)
+ break;
+ lon -= 360.0;
+ }
+ /* Find the first longitude on the screen */
+ for (;;) {
+ double x = lon * scale_x - offset_x;
+ if (x >= 0)
+ break;
+ lon += 360.0;
+ }
+ return lon;
+ }
+
+ /* Return last longitude value which ends up on-screen */
+ public double last_lon(double lon) {
+ lon = first_lon(lon);
+
+ for(;;) {
+ double next_lon = lon + 360.0;
+ double next_x = next_lon * scale_x - offset_x;
+ if (next_x >= width)
+ break;
+ lon = next_lon;
+ }
+ return lon;
+ }
+