mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 05:11:04 +00:00
started using CoordinateSystem to map from Position to LatLng
This commit is contained in:
1 parent
df81a3b83f
commit
aed5b1fe3c
22 files changed
+99
-154
No files matched your search
+1
-1
@@ -101,7 +101,7 @@ public class BoatOverlay extends CanvasOverlayV3 {
|
||||
lastScale = boatSizeScaleFactor;
|
||||
lastColor = color;
|
||||
}
|
||||
LatLng latLngPosition = LatLng.newInstance(boatFix.position.getLatDeg(), boatFix.position.getLngDeg());
|
||||
LatLng latLngPosition = coordinateSystem.toLatLng(boatFix.position);
|
||||
Point boatPositionInPx = mapProjection.fromLatLngToDivPixel(latLngPosition);
|
||||
setCanvasPosition(boatPositionInPx.getX() - getCanvas().getCoordinateSpaceWidth() / 2,
|
||||
boatPositionInPx.getY() - getCanvas().getCoordinateSpaceHeight() / 2);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class CompetitorInfoOverlay extends CanvasOverlayV3 {
|
||||
@Override
|
||||
protected void draw() {
|
||||
if (mapProjection != null && position != null) {
|
||||
LatLng latLngPosition = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng latLngPosition = coordinateSystem.toLatLng(position);
|
||||
Context2d ctx = getCanvas().getContext2d();
|
||||
CssColor grayTransparentColor = CssColor.make("rgba(255,255,255,0.75)");
|
||||
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.racemap;
|
||||
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
@@ -24,4 +25,6 @@ public interface CoordinateSystem {
|
||||
* @return a degree angle from the interval [0..360)
|
||||
*/
|
||||
double mapDegreeBearing(double trueBearingInDegrees);
|
||||
|
||||
LatLng toLatLng(Position position);
|
||||
}
|
||||
+3
-4
@@ -66,13 +66,12 @@ public class CourseMarkOverlay extends CanvasOverlayV3 {
|
||||
}
|
||||
double markSizeScaleFactor = markScaleAndSize.getA();
|
||||
getCanvas().setTitle(getTitle());
|
||||
LatLng latLngPosition = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
// calculate canvas size
|
||||
double canvasWidth = markScaleAndSize.getB().getWidth();
|
||||
double canvasHeight = markScaleAndSize.getB().getHeight();
|
||||
double buoyZoneRadiusInPixel = -1;
|
||||
if (showBuoyZone && mark.type == MarkType.BUOY) {
|
||||
buoyZoneRadiusInPixel = calculateRadiusOfBoundingBox(mapProjection, latLngPosition,
|
||||
buoyZoneRadiusInPixel = calculateRadiusOfBoundingBoxInPixels(mapProjection, position,
|
||||
buoyZoneRadiusInMeter);
|
||||
if (buoyZoneRadiusInPixel > MIN_BUOYZONE_RADIUS_IN_PX) {
|
||||
canvasWidth = (buoyZoneRadiusInPixel + 1) * 2;
|
||||
@@ -102,7 +101,7 @@ public class CourseMarkOverlay extends CanvasOverlayV3 {
|
||||
lastWidth = canvasWidth;
|
||||
lastHeight = canvasHeight;
|
||||
}
|
||||
Point buoyPositionInPx = mapProjection.fromLatLngToDivPixel(latLngPosition);
|
||||
Point buoyPositionInPx = mapProjection.fromLatLngToDivPixel(coordinateSystem.toLatLng(position));
|
||||
if (showBuoyZone && mark.type == MarkType.BUOY && buoyZoneRadiusInPixel > MIN_BUOYZONE_RADIUS_IN_PX) {
|
||||
setCanvasPosition(buoyPositionInPx.getX() - buoyZoneRadiusInPixel, buoyPositionInPx.getY() - buoyZoneRadiusInPixel);
|
||||
} else {
|
||||
@@ -131,7 +130,7 @@ public class CourseMarkOverlay extends CanvasOverlayV3 {
|
||||
double buoyScaleFactor = 2.0;
|
||||
|
||||
Size markSizeInPixel = calculateBoundingBox(mapProjection,
|
||||
LatLng.newInstance(markPosition.getLatDeg(), markPosition.getLngDeg()),
|
||||
coordinateSystem.toLatLng(markPosition),
|
||||
markVectorGraphics.getMarkWidthInMeters() * buoyScaleFactor, markVectorGraphics.getMarkHeightInMeters() * buoyScaleFactor);
|
||||
|
||||
double markHeightInPixel = markSizeInPixel.getHeight();
|
||||
|
||||
+9
-4
@@ -66,7 +66,10 @@ public class FixesAndTails {
|
||||
*/
|
||||
private final Map<CompetitorDTO, Integer> lastShownFix;
|
||||
|
||||
public FixesAndTails() {
|
||||
private final CoordinateSystem coordinateSystem;
|
||||
|
||||
public FixesAndTails(CoordinateSystem coordinateSystem) {
|
||||
this.coordinateSystem = coordinateSystem;
|
||||
fixes = new HashMap<CompetitorDTO, List<GPSFixDTO>>();
|
||||
tails = new HashMap<CompetitorDTO, Polyline>();
|
||||
firstShownFix = new HashMap<CompetitorDTO, Integer>();
|
||||
@@ -140,14 +143,16 @@ public class FixesAndTails {
|
||||
if (!fix.timepoint.before(to)) {
|
||||
indexOfLast = i-1;
|
||||
} else {
|
||||
LatLng point = null;
|
||||
final LatLng point;
|
||||
if (indexOfFirst == -1) {
|
||||
if (!fix.timepoint.before(from)) {
|
||||
indexOfFirst = i;
|
||||
point = LatLng.newInstance(fix.position.getLatDeg(), fix.position.getLngDeg());
|
||||
point = coordinateSystem.toLatLng(fix.position);
|
||||
} else {
|
||||
point = null;
|
||||
}
|
||||
} else {
|
||||
point = LatLng.newInstance(fix.position.getLatDeg(), fix.position.getLngDeg());
|
||||
point = coordinateSystem.toLatLng(fix.position);
|
||||
}
|
||||
if (point != null) {
|
||||
points.add(point);
|
||||
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.racemap;
|
||||
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
@@ -18,4 +19,9 @@ public class IdentityCoordinateSystem implements CoordinateSystem {
|
||||
public double mapDegreeBearing(double trueBearingInDegrees) {
|
||||
return trueBearingInDegrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLng toLatLng(Position position) {
|
||||
return LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -354,7 +354,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
this.timer = timer;
|
||||
timer.addTimeListener(this);
|
||||
raceMapImageManager = new RaceMapImageManager();
|
||||
fixesAndTails = new FixesAndTails();
|
||||
fixesAndTails = new FixesAndTails(coordinateSystem);
|
||||
markDTOs = new HashMap<String, MarkDTO>();
|
||||
courseSidelines = new HashMap<SidelineDTO, Polygon>();
|
||||
boatOverlays = new HashMap<CompetitorDTO, BoatOverlay>();
|
||||
@@ -1047,13 +1047,12 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
double lat1 = position.getLatitude() / 180. * Math.PI;
|
||||
double lon1 = position.getLongitude() / 180. * Math.PI;
|
||||
double bearingRad = bearingDeg / 180. * Math.PI;
|
||||
|
||||
double lat2 = Math.asin(Math.sin(lat1) * Math.cos(distianceRad) +
|
||||
Math.cos(lat1) * Math.sin(distianceRad) * Math.cos(bearingRad));
|
||||
double lon2 = lon1 + Math.atan2(Math.sin(bearingRad)*Math.sin(distianceRad)*Math.cos(lat1),
|
||||
Math.cos(distianceRad)-Math.sin(lat1)*Math.sin(lat2));
|
||||
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalize to -180..+180�
|
||||
|
||||
// position is already in LatLng space, so no mapping through coordinateSystem is required here
|
||||
return LatLng.newInstance(lat2 / Math.PI * 180., lon2 / Math.PI * 180.);
|
||||
}
|
||||
|
||||
@@ -1109,7 +1108,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
.getHullLengthInMeters() / 1000.; // one hull length
|
||||
// implement and use Position.translateRhumb()
|
||||
double bearingOfBoatInDeg = lastBoatFix.speedWithBearing.bearingInDegrees;
|
||||
LatLng boatPosition = LatLng.newInstance(lastBoatFix.position.getLatDeg(), lastBoatFix.position.getLngDeg());
|
||||
LatLng boatPosition = coordinateSystem.toLatLng(lastBoatFix.position);
|
||||
LatLng posAheadOfFirstBoat = calculatePositionAlongRhumbline(boatPosition, bearingOfBoatInDeg,
|
||||
distanceFromBoatPositionInKm);
|
||||
final WindDTO windFix = windDataForLegMiddle.windFixes.get(0);
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.racemap;
|
||||
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
@@ -54,4 +55,10 @@ public class RotateAndTranslateCoordinateSystem implements CoordinateSystem {
|
||||
public double mapDegreeBearing(double trueBearingInDegrees) {
|
||||
return (trueBearingInDegrees + rotationAngleInDegrees) % 360.;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLng toLatLng(Position position) {
|
||||
final Position mapped = map(position);
|
||||
return LatLng.newInstance(mapped.getLatDeg(), mapped.getLngDeg());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class SmallTransparentInfoOverlay extends CanvasOverlayV3 {
|
||||
@Override
|
||||
protected void draw() {
|
||||
if (mapProjection != null && position != null) {
|
||||
LatLng latLngPosition = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng latLngPosition = coordinateSystem.toLatLng(position);
|
||||
Context2d context2d = getCanvas().getContext2d();
|
||||
CssColor grayTransparentColor = CssColor.make("rgba(255,255,255,0.75)");
|
||||
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@ package com.sap.sailing.gwt.ui.client.shared.racemap;
|
||||
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.google.gwt.maps.client.base.Point;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
@@ -61,7 +60,7 @@ public class WindSensorOverlay extends CanvasOverlayV3 {
|
||||
if (position != null) {
|
||||
double rotationDegOfWindSymbol = windDTO.dampenedTrueWindBearingDeg;
|
||||
transformer.drawToCanvas(getCanvas(), rotationDegOfWindSymbol, 1.0);
|
||||
setLatLngPosition(LatLng.newInstance(windDTO.position.getLatDeg(), windDTO.position.getLngDeg()));
|
||||
setLatLngPosition(coordinateSystem.toLatLng(windDTO.position));
|
||||
Point sensorPositionInPx = mapProjection.fromLatLngToDivPixel(getLatLngPosition());
|
||||
setCanvasPosition(sensorPositionInPx.getX() - canvasWidth / 2, sensorPositionInPx.getY() - canvasHeight / 2);
|
||||
String title = stringMessages.wind() + " ("+ WindSourceTypeFormatter.format(windSource, stringMessages) + "): ";
|
||||
|
||||
+9
-17
@@ -364,33 +364,25 @@ public abstract class CanvasOverlayV3 {
|
||||
setProperty(canvas.getElement().getStyle(), "transform", "translateZ(0) rotate("+Math.round(rotationInDegrees)+"deg)");
|
||||
}
|
||||
|
||||
protected double calculateRadiusOfBoundingBox(MapCanvasProjection projection, LatLng centerPosition, double lengthInMeter) {
|
||||
Position centerPos = new DegreePosition(centerPosition.getLatitude(), centerPosition.getLongitude());
|
||||
Position translateRhumbX = centerPos.translateRhumb(new DegreeBearingImpl(90), new MeterDistance(lengthInMeter));
|
||||
Position translateRhumbY = centerPos.translateRhumb(new DegreeBearingImpl(0), new MeterDistance(lengthInMeter));
|
||||
|
||||
LatLng posWithDistanceX = LatLng.newInstance(translateRhumbX.getLatDeg(), translateRhumbX.getLngDeg());
|
||||
LatLng posWithDistanceY = LatLng.newInstance(translateRhumbY.getLatDeg(), translateRhumbY.getLngDeg());
|
||||
|
||||
Point pointCenter = projection.fromLatLngToDivPixel(centerPosition);
|
||||
protected double calculateRadiusOfBoundingBoxInPixels(MapCanvasProjection projection, Position centerPosition, double lengthInMeter) {
|
||||
Position translateRhumbX = centerPosition.translateRhumb(new DegreeBearingImpl(90), new MeterDistance(lengthInMeter));
|
||||
Position translateRhumbY = centerPosition.translateRhumb(new DegreeBearingImpl(0), new MeterDistance(lengthInMeter));
|
||||
LatLng posWithDistanceX = coordinateSystem.toLatLng(translateRhumbX);
|
||||
LatLng posWithDistanceY = coordinateSystem.toLatLng(translateRhumbY);
|
||||
Point pointCenter = projection.fromLatLngToDivPixel(coordinateSystem.toLatLng(centerPosition));
|
||||
Point pointX = projection.fromLatLngToDivPixel(posWithDistanceX);
|
||||
Point pointY = projection.fromLatLngToDivPixel(posWithDistanceY);
|
||||
|
||||
double diffX = Math.abs(pointX.getX() - pointCenter.getX());
|
||||
double diffY = Math.abs(pointY.getY() - pointCenter.getY());
|
||||
|
||||
return Math.min(diffX, diffY);
|
||||
}
|
||||
|
||||
protected double calculateDistanceAlongX(MapCanvasProjection projection, LatLng position, double distanceXInMeter) {
|
||||
Position pos = new DegreePosition(position.getLatitude(), position.getLongitude());
|
||||
|
||||
Position translateRhumbX = pos.translateRhumb(new DegreeBearingImpl(90), new MeterDistance(distanceXInMeter));
|
||||
LatLng posWithDistanceX = LatLng.newInstance(translateRhumbX.getLatDeg(), translateRhumbX.getLngDeg());
|
||||
|
||||
LatLng posWithDistanceX = coordinateSystem.toLatLng(translateRhumbX);
|
||||
Point point = projection.fromLatLngToDivPixel(position);
|
||||
Point pointX = projection.fromLatLngToDivPixel(posWithDistanceX);
|
||||
|
||||
return Math.abs(pointX.getX() - point.getX());
|
||||
}
|
||||
|
||||
@@ -399,8 +391,8 @@ public abstract class CanvasOverlayV3 {
|
||||
Position translateRhumbX = pos.translateRhumb(new DegreeBearingImpl(90), new MeterDistance(distanceXInMeter));
|
||||
Position translateRhumbY = pos.translateRhumb(new DegreeBearingImpl(0), new MeterDistance(distanceYInMeter));
|
||||
|
||||
LatLng posWithDistanceX = LatLng.newInstance(translateRhumbX.getLatDeg(), translateRhumbX.getLngDeg());
|
||||
LatLng posWithDistanceY = LatLng.newInstance(translateRhumbY.getLatDeg(), translateRhumbY.getLngDeg());
|
||||
LatLng posWithDistanceX = coordinateSystem.toLatLng(translateRhumbX);
|
||||
LatLng posWithDistanceY = coordinateSystem.toLatLng(translateRhumbY);
|
||||
|
||||
Point pointCenter = projection.fromLatLngToDivPixel(position);
|
||||
Point pointX = projection.fromLatLngToDivPixel(posWithDistanceX);
|
||||
|
||||
+2
-6
@@ -10,7 +10,6 @@ import com.google.gwt.canvas.dom.client.TextMetrics;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.i18n.client.TimeZone;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.google.gwt.maps.client.base.Point;
|
||||
import com.google.gwt.maps.client.controls.ControlPosition;
|
||||
import com.google.gwt.user.client.Window;
|
||||
@@ -155,8 +154,7 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
ctxt.setStrokeStyle(this.colors.getColor(colorIdx));
|
||||
ctxt.beginPath();
|
||||
for (SimulatorWindDTO point : points) {
|
||||
Point px = mapProjection.fromLatLngToContainerPixel(LatLng.newInstance(point.position.getLatDeg(),
|
||||
point.position.getLngDeg()));
|
||||
Point px = mapProjection.fromLatLngToContainerPixel(coordinateSystem.toLatLng(point.position));
|
||||
if (first) {
|
||||
ctxt.moveTo(px.getX(), px.getY());
|
||||
first = false;
|
||||
@@ -171,9 +169,7 @@ public class RaceSimulationOverlay extends FullCanvasOverlay {
|
||||
if ((point.timepoint - start.timepoint) % (timeStep) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Point px = mapProjection.fromLatLngToContainerPixel(LatLng.newInstance(point.position.getLatDeg(),
|
||||
point.position.getLngDeg()));
|
||||
Point px = mapProjection.fromLatLngToContainerPixel(coordinateSystem.toLatLng(point.position));
|
||||
ctxt.beginPath();
|
||||
ctxt.arc(px.getX(), px.getY(), 1.5, 0, 2 * Math.PI);
|
||||
ctxt.closePath();
|
||||
|
||||
+5
-25
@@ -196,23 +196,15 @@ public class PathCanvasOverlay extends WindFieldCanvasOverlay implements Named {
|
||||
}
|
||||
|
||||
private void drawLine(SimulatorWindDTO p1, SimulatorWindDTO p2) {
|
||||
|
||||
double weight = 3.0;
|
||||
|
||||
Position position = p1.position;
|
||||
|
||||
LatLng positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(p1.position);
|
||||
Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
double x1 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
double y1 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
position = p2.position;
|
||||
positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(p2.position);
|
||||
canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
double x2 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
double y2 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
// Context2d context2d = canvas.getContext2d();
|
||||
// context2d.setShadowBlur(weight);
|
||||
drawLine(x1, y1, x2, y2, weight, pathColor);
|
||||
@@ -221,17 +213,11 @@ public class PathCanvasOverlay extends WindFieldCanvasOverlay implements Named {
|
||||
}
|
||||
|
||||
private void drawPoint(SimulatorWindDTO p) {
|
||||
|
||||
double weight = 3.0;
|
||||
|
||||
Position position = p.position;
|
||||
|
||||
LatLng positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(p.position);
|
||||
Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
double x1 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
double y1 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
drawCircle(x1, y1, weight / 2., pathColor);
|
||||
}
|
||||
|
||||
@@ -244,20 +230,14 @@ public class PathCanvasOverlay extends WindFieldCanvasOverlay implements Named {
|
||||
if (p1 == null || p2 == null) {
|
||||
return true;
|
||||
}
|
||||
Position position = p1.position;
|
||||
|
||||
LatLng positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(p1.position);
|
||||
Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
double x1 = canvasPositionInPx.getX();
|
||||
double y1 = canvasPositionInPx.getY();
|
||||
|
||||
position = p2.position;
|
||||
positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(p2.position);
|
||||
canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
double x2 = canvasPositionInPx.getX();
|
||||
double y2 = canvasPositionInPx.getY();
|
||||
|
||||
double pxDistance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
||||
if (pxDistance >= MinimumPxDistanceBetweenArrows) {
|
||||
return true;
|
||||
|
||||
+5
-15
@@ -23,6 +23,7 @@ import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.RadianPosition;
|
||||
import com.sap.sailing.gwt.ui.client.SimulatorServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.CoordinateSystem;
|
||||
import com.sap.sailing.gwt.ui.shared.RequestTotalTimeDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ResponseTotalTimeDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SimulatorUISelectionDTO;
|
||||
@@ -80,32 +81,21 @@ public class PathPolyline {
|
||||
|
||||
public static PathPolyline createPathPolyline(List<SimulatorWindDTO> pathPoints, String color, int weight, double opacity, ErrorReporter errorReporter,
|
||||
SimulatorServiceAsync simulatorService,
|
||||
MapWidget map, SimulatorMap simulatorMap, SimulatorMainPanel simulatorMainPanel, SimulatorUISelectionDTO selection) {
|
||||
|
||||
MapWidget map, SimulatorMap simulatorMap, SimulatorMainPanel simulatorMainPanel, SimulatorUISelectionDTO selection, CoordinateSystem coordinateSystem) {
|
||||
List<LatLng> points = new ArrayList<LatLng>();
|
||||
|
||||
// int counter = 1;
|
||||
// int max = 5;
|
||||
for (SimulatorWindDTO pathPoint : pathPoints) {
|
||||
if (pathPoint.isTurn) {
|
||||
|
||||
// counter++;
|
||||
points.add(LatLng.newInstance(pathPoint.position.getLatDeg(), pathPoint.position.getLngDeg()));
|
||||
// if (counter > max) {
|
||||
// break;
|
||||
// }
|
||||
points.add(coordinateSystem.toLatLng(pathPoint.position));
|
||||
}
|
||||
}
|
||||
|
||||
return new PathPolyline(points.toArray(new LatLng[0]), color, weight, opacity, selection, errorReporter, pathPoints, simulatorService, map,
|
||||
simulatorMap, simulatorMainPanel);
|
||||
}
|
||||
|
||||
public static PathPolyline createPathPolyline(List<SimulatorWindDTO> pathPoints, ErrorReporter errorReporter, SimulatorServiceAsync simulatorService,
|
||||
MapWidget map, SimulatorMap simulatorMap, SimulatorMainPanel simulatorMainPanel, SimulatorUISelectionDTO selection) {
|
||||
|
||||
MapWidget map, SimulatorMap simulatorMap, SimulatorMainPanel simulatorMainPanel, SimulatorUISelectionDTO selection, CoordinateSystem coordinateSystem) {
|
||||
return createPathPolyline(pathPoints, DEFAULT_COLOR, DEFAULT_WEIGHT, DEFAULT_OPACITY, errorReporter, simulatorService, map, simulatorMap,
|
||||
simulatorMainPanel, selection);
|
||||
simulatorMainPanel, selection, coordinateSystem);
|
||||
}
|
||||
|
||||
private PathPolyline(LatLng[] points, String color, int weight, double opacity, SimulatorUISelectionDTO selection, ErrorReporter errorReporter,
|
||||
|
||||
+1
@@ -230,6 +230,7 @@ public class RaceCourseCanvasOverlay extends FullCanvasOverlay {
|
||||
private void center() {
|
||||
double cLat = (startPoint.getLatitude() + ((endPoint.getLatitude() - startPoint.getLatitude()) % 180.) / 2. + 90.) % 180. - 90.;
|
||||
double cLon = (startPoint.getLongitude() + ((endPoint.getLongitude() - startPoint.getLongitude()) % 360.) / 2. + 180.) % 360. - 180;
|
||||
// startPoint and endPoint are already in the map's coordinate space, so no further mapping through coordinateSystem is required here
|
||||
LatLng centerPoint = LatLng.newInstance(cLat, cLon);
|
||||
getMap().panTo(centerPoint);
|
||||
}
|
||||
|
||||
+3
-5
@@ -5,6 +5,7 @@ import com.google.gwt.canvas.dom.client.Context2d.TextAlign;
|
||||
import com.google.gwt.maps.client.MapWidget;
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.google.gwt.maps.client.base.Point;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.CoordinateSystem;
|
||||
import com.sap.sailing.gwt.ui.simulator.racemap.FullCanvasOverlay;
|
||||
import com.sap.sailing.simulator.util.SailingSimulatorConstants;
|
||||
@@ -25,7 +26,7 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
super(map, zIndex, coordinateSystem);
|
||||
|
||||
this.simulatorMap = simulatorMap;
|
||||
this.venue = VenueDescriptorFactory.createVenue(event);
|
||||
this.venue = VenueDescriptorFactory.createVenue(event, coordinateSystem);
|
||||
this.currentCourseArea = this.venue.getDefaultCourseArea();
|
||||
|
||||
}
|
||||
@@ -67,16 +68,13 @@ public class RegattaAreaCanvasOverlay extends FullCanvasOverlay {
|
||||
}
|
||||
|
||||
protected void drawRegattaAreas() {
|
||||
|
||||
LatLng cPos = LatLng.newInstance(54.4344, 10.19659167);
|
||||
LatLng cPos = coordinateSystem.toLatLng(new DegreePosition(54.4344, 10.19659167));
|
||||
Point centerPoint = mapProjection.fromLatLngToDivPixel(cPos);
|
||||
Point borderPoint = mapProjection.fromLatLngToDivPixel(this.getEdgePoint(cPos, 0.015));
|
||||
double pxStroke = Math.pow(2.0, (getMap().getZoom() - 10.0) / 2.0);
|
||||
|
||||
final Context2d context2d = canvas.getContext2d();
|
||||
context2d.setLineWidth(3);
|
||||
context2d.setStrokeStyle("Black");
|
||||
|
||||
for (CourseAreaDescriptor courseArea : venue.getCourseAreas()) {
|
||||
centerPoint = mapProjection.fromLatLngToDivPixel(courseArea.getCenterPos());
|
||||
borderPoint = mapProjection.fromLatLngToDivPixel(courseArea.getEdgePos());
|
||||
|
||||
+1
-8
@@ -572,13 +572,10 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
windNeedleCanvasOverlay.addToMap();
|
||||
}
|
||||
}
|
||||
|
||||
raceCourseCanvasOverlay = new RaceCourseCanvasOverlay(map, SimulatorMapOverlaysZIndexes.RACE_COURSE_ZINDEX, mode, coordinateSystem);
|
||||
|
||||
if (mode == SailingSimulatorConstants.ModeEvent) {
|
||||
regattaAreaCanvasOverlay.setRaceCourseCanvas(raceCourseCanvasOverlay);
|
||||
}
|
||||
|
||||
if (windParams.isShowArrows()) {
|
||||
windFieldCanvasOverlay = new WindFieldCanvasOverlay(map, SimulatorMapOverlaysZIndexes.WINDFIELD_ZINDEX, timer, windParams, coordinateSystem);
|
||||
}
|
||||
@@ -596,9 +593,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
}
|
||||
replayPathCanvasOverlays = new ArrayList<PathCanvasOverlay>();
|
||||
legendCanvasOverlay = new PathLegendCanvasOverlay(map, SimulatorMapOverlaysZIndexes.PATHLEGEND_ZINDEX, mode, coordinateSystem);
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
regattaAreaCanvasOverlay.onResize();
|
||||
@@ -621,9 +616,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
legendCanvasOverlay.onResize();
|
||||
timePanel.resetTimeSlider();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
overlaysInitialized = true;
|
||||
}
|
||||
|
||||
@@ -1034,7 +1027,7 @@ public class SimulatorMap extends AbsolutePanel implements RequiresDataInitializ
|
||||
SimulatorUISelectionDTO selection = new SimulatorUISelectionDTO(parent.getSelectedBoatClassIndex(), parent.getSelectedRaceIndex(),
|
||||
parent.getSelectedCompetitorIndex(), parent.getSelectedLegIndex());
|
||||
|
||||
return PathPolyline.createPathPolyline(pathDTO.getPoints(), errorReporter, simulatorService, map, this, parent, selection);
|
||||
return PathPolyline.createPathPolyline(pathDTO.getPoints(), errorReporter, simulatorService, map, this, parent, selection, coordinateSystem);
|
||||
}
|
||||
|
||||
public void addLegendOverlayForPathPolyline(long totalTimeMilliseconds) {
|
||||
|
||||
+28
-26
@@ -3,117 +3,119 @@ package com.sap.sailing.gwt.ui.simulator;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.maps.client.base.LatLng;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.CoordinateSystem;
|
||||
import com.sap.sailing.simulator.util.SailingSimulatorConstants;
|
||||
|
||||
public class VenueDescriptorFactory {
|
||||
public static VenueDescriptor createVenue(char event) {
|
||||
public static VenueDescriptor createVenue(char event, CoordinateSystem coordinateSystem) {
|
||||
VenueDescriptor result = null;
|
||||
switch (event) {
|
||||
case SailingSimulatorConstants.EventKielerWoche:
|
||||
result = createKielVenue();
|
||||
result = createKielVenue(coordinateSystem);
|
||||
break;
|
||||
case SailingSimulatorConstants.EventTravemuenderWoche:
|
||||
result = createTravemuendeVenue();
|
||||
result = createTravemuendeVenue(coordinateSystem);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static VenueDescriptor createKielVenue() {
|
||||
private static VenueDescriptor createKielVenue(CoordinateSystem coordinateSystem) {
|
||||
LatLng cPos;
|
||||
ArrayList<CourseAreaDescriptor> courseAreas = new ArrayList<CourseAreaDescriptor>();
|
||||
|
||||
VenueDescriptor venue = new VenueDescriptor("Kieler Bucht", courseAreas);
|
||||
// Middle of Echo and Klio
|
||||
venue.setCenterPos(LatLng.newInstance(54.477245795, 10.220622225));
|
||||
venue.setCenterPos(coordinateSystem.toLatLng(new DegreePosition(54.477245795, 10.220622225)));
|
||||
|
||||
// TV
|
||||
cPos = LatLng.newInstance(54.43450, 10.19559167);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.43450, 10.19559167));
|
||||
CourseAreaDescriptor defaultCourseArea = new CourseAreaDescriptor("TV", cPos, 0.5, "#EAB75A");
|
||||
courseAreas.add(defaultCourseArea);
|
||||
|
||||
// Golf
|
||||
cPos = LatLng.newInstance(54.41985556, 10.19454167);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.41985556, 10.19454167));
|
||||
courseAreas.add(new CourseAreaDescriptor("Golf", cPos, 0.35, "#F1F3EF", "silver"));
|
||||
|
||||
// Foxtrot
|
||||
cPos = LatLng.newInstance(54.445775, 10.29223889);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.445775, 10.29223889));
|
||||
courseAreas.add(new CourseAreaDescriptor("Foxtrot", cPos, 0.65, "#DA58A6"));
|
||||
|
||||
// India
|
||||
cPos = LatLng.newInstance(54.44803611, 10.20863611);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.44803611, 10.20863611));
|
||||
courseAreas.add(new CourseAreaDescriptor("India", cPos, 0.40, "#B7827B"));
|
||||
|
||||
// Juliett
|
||||
cPos = LatLng.newInstance(54.46183611, 10.2239);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.46183611, 10.2239));
|
||||
courseAreas.add(new CourseAreaDescriptor("Juliett", cPos, 0.55, "#979b9b"));
|
||||
|
||||
// Echo
|
||||
cPos = LatLng.newInstance(54.47640278, 10.20090556);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.47640278, 10.20090556));
|
||||
courseAreas.add(new CourseAreaDescriptor("Echo", cPos, 0.60, "#1CADD9"));
|
||||
|
||||
// Kilo
|
||||
cPos = LatLng.newInstance(54.47808889, 10.24033889);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.47808889, 10.24033889));
|
||||
courseAreas.add(new CourseAreaDescriptor("Kilo", cPos, 0.55, "#9FC269"));
|
||||
|
||||
// Charlie
|
||||
cPos = LatLng.newInstance(54.49327222, 10.17525833);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.49327222, 10.17525833));
|
||||
courseAreas.add(new CourseAreaDescriptor("Charlie", cPos, 0.70, "#2796f1"));
|
||||
|
||||
// Delta
|
||||
cPos = LatLng.newInstance(54.49706111, 10.21921944);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.49706111, 10.21921944));
|
||||
courseAreas.add(new CourseAreaDescriptor("Delta", cPos, 0.75, "#179E8B"));
|
||||
|
||||
// Bravo
|
||||
cPos = LatLng.newInstance(54.50911667, 10.13973333);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.50911667, 10.13973333));
|
||||
courseAreas.add(new CourseAreaDescriptor("Bravo", cPos, 0.80, "#d34547"));
|
||||
|
||||
// Alfa
|
||||
cPos = LatLng.newInstance(54.52905, 10.18515278);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.52905, 10.18515278));
|
||||
courseAreas.add(new CourseAreaDescriptor("Alfa", cPos, 1.00, "#d65c93"));
|
||||
|
||||
venue.setDefaultCourseArea(defaultCourseArea);
|
||||
return venue;
|
||||
}
|
||||
|
||||
private static VenueDescriptor createTravemuendeVenue() {
|
||||
private static VenueDescriptor createTravemuendeVenue(CoordinateSystem coordinateSystem) {
|
||||
LatLng cPos;
|
||||
ArrayList<CourseAreaDescriptor> courseAreas = new ArrayList<CourseAreaDescriptor>();
|
||||
|
||||
VenueDescriptor venue = new VenueDescriptor("Kieler Bucht", courseAreas);
|
||||
venue.setCenterPos(LatLng.newInstance(54.01583, 10.92583));
|
||||
venue.setCenterPos(coordinateSystem.toLatLng(new DegreePosition(54.01583, 10.92583)));
|
||||
|
||||
// Alfa
|
||||
cPos = LatLng.newInstance(54.015, 10.835);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.015, 10.835));
|
||||
CourseAreaDescriptor defaultCourseArea = new CourseAreaDescriptor("Alfa", cPos, 0.9, "#FF8030");
|
||||
courseAreas.add(defaultCourseArea);
|
||||
|
||||
// Bravo
|
||||
cPos = LatLng.newInstance(54.01666667, 11.01666667);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.01666667, 11.01666667));
|
||||
courseAreas.add(new CourseAreaDescriptor("Bravo", cPos, 0.75, "#179E8B"));
|
||||
|
||||
// Charlie
|
||||
cPos = LatLng.newInstance(54.0025, 10.98333333);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.0025, 10.98333333));
|
||||
courseAreas.add(new CourseAreaDescriptor("Charlie", cPos, 0.6, "#CE3032"));
|
||||
|
||||
// Delta
|
||||
cPos = LatLng.newInstance(54.02166667, 10.92083333);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.02166667, 10.92083333));
|
||||
courseAreas.add(new CourseAreaDescriptor("Delta", cPos, 0.75, "#B4287C"));
|
||||
|
||||
// Foxtrot
|
||||
cPos = LatLng.newInstance(54.00833333, 10.88333333);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.00833333, 10.88333333));
|
||||
courseAreas.add(new CourseAreaDescriptor("Foxtrot", cPos, 0.75, "#FFFFFF", "silver"));
|
||||
|
||||
// Golf
|
||||
cPos = LatLng.newInstance(53.98333333, 10.9);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(53.98333333, 10.9));
|
||||
courseAreas.add(new CourseAreaDescriptor("Golf", cPos, 0.50, "#1CADD9"));
|
||||
|
||||
// Hotel
|
||||
cPos = LatLng.newInstance(53.99, 10.95666667);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(53.99, 10.95666667));
|
||||
courseAreas.add(new CourseAreaDescriptor("Hotel", cPos, 0.50, "#FFFF30", "silver"));
|
||||
|
||||
// See
|
||||
cPos = LatLng.newInstance(54.04333333, 10.875);
|
||||
cPos = coordinateSystem.toLatLng(new DegreePosition(54.04333333, 10.875));
|
||||
courseAreas.add(new CourseAreaDescriptor("See", cPos, 1.25, "#818585"));
|
||||
|
||||
venue.setDefaultCourseArea(defaultCourseArea);
|
||||
|
||||
+4
-9
@@ -408,19 +408,14 @@ public class WindGridCanvasOverlay extends FullCanvasOverlay implements TimeList
|
||||
}
|
||||
|
||||
private void drawGridCell(final GridCell cell) {
|
||||
|
||||
LatLng positionLatLng = LatLng.newInstance(cell.bottomLeft.getLatDeg(), cell.bottomLeft.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(cell.bottomLeft);
|
||||
final Point blPoint = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
positionLatLng = LatLng.newInstance(cell.bottomRight.getLatDeg(), cell.bottomRight.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(cell.bottomRight);
|
||||
final Point brPoint = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
positionLatLng = LatLng.newInstance(cell.topLeft.getLatDeg(), cell.topLeft.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(cell.topLeft);
|
||||
final Point tlPoint = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
positionLatLng = LatLng.newInstance(cell.topRight.getLatDeg(), cell.topRight.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(cell.topRight);
|
||||
final Point trPoint = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
/*
|
||||
* Uncomment to see the center of the grid for debug drawCircle(blPoint.getX()-this.getWidgetPosLeft(),
|
||||
* blPoint.getY()-this.getWidgetPosTop(),2,"red"); drawCircle(brPoint.getX()-this.getWidgetPosLeft(),
|
||||
|
||||
+2
-6
@@ -201,18 +201,14 @@ public class WindLineCanvasOverlay extends FullCanvasOverlay implements TimeList
|
||||
|
||||
private void drawLine(final Position p1, final Position p2) {
|
||||
final double weight = 1.0;
|
||||
|
||||
LatLng positionLatLng = LatLng.newInstance(p1.getLatDeg(), p1.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(p1);
|
||||
Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
final double x1 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
final double y1 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
positionLatLng = LatLng.newInstance(p2.getLatDeg(), p2.getLngDeg());
|
||||
positionLatLng = coordinateSystem.toLatLng(p2);
|
||||
canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
final double x2 = canvasPositionInPx.getX() - this.getWidgetPosLeft();
|
||||
final double y2 = canvasPositionInPx.getY() - this.getWidgetPosTop();
|
||||
|
||||
drawLine(x1, y1, x2, y2, weight, lineColor);
|
||||
}
|
||||
|
||||
|
||||
+3
-19
@@ -145,8 +145,8 @@ public class WindLineGuidesCanvasOverlay extends FullCanvasOverlay implements Ti
|
||||
Iterator<SimulatorWindDTO> windDTOIter = windDTOList.iterator();
|
||||
final SimulatorWindDTO w0 = windDTOIter.next();
|
||||
final SimulatorWindDTO w1 = windDTOIter.next();
|
||||
final LatLng pg0 = LatLng.newInstance(w0.position.getLatDeg(), w0.position.getLngDeg());
|
||||
final LatLng pg1 = LatLng.newInstance(w1.position.getLatDeg(), w1.position.getLngDeg());
|
||||
final LatLng pg0 = coordinateSystem.toLatLng(w0.position);
|
||||
final LatLng pg1 = coordinateSystem.toLatLng(w1.position);
|
||||
final Point px0 = mapProjection.fromLatLngToDivPixel(pg0);
|
||||
final Point px1 = mapProjection.fromLatLngToDivPixel(pg1);
|
||||
final double dx = px0.getX()-px1.getX();
|
||||
@@ -174,42 +174,26 @@ public class WindLineGuidesCanvasOverlay extends FullCanvasOverlay implements Ti
|
||||
final String msg = "Wind @ P" + index + ": time : " + windDTO.timepoint + " speed: " + windDTO.trueWindSpeedInKnots + "knots "
|
||||
+ windDTO.trueWindBearingDeg;
|
||||
logger.fine(msg);
|
||||
|
||||
final Context2d context2d = canvas.getContext2d();
|
||||
context2d.setGlobalAlpha(0.2);
|
||||
|
||||
final Position position = windDTO.position;
|
||||
|
||||
final LatLng positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
final LatLng positionLatLng = coordinateSystem.toLatLng(position);
|
||||
final Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
|
||||
final double x = canvasPositionInPx.getX() - getWidgetPosLeft();
|
||||
final double y = canvasPositionInPx.getY() - getWidgetPosTop();
|
||||
|
||||
windFieldPoints.put(new ToolTip(x, y), windDTO);
|
||||
|
||||
final double dx = length * Math.sin(angle);
|
||||
final double dy = -length * Math.cos(angle);
|
||||
|
||||
final double x1 = x + dx / 2;
|
||||
final double y1 = y + dy / 2;
|
||||
|
||||
drawLine(x - dx / 2, y - dy / 2, x1, y1, weight, arrowColor);
|
||||
|
||||
final double theta = Math.atan2(-dy, dx);
|
||||
|
||||
final double hLength = Math.max(6.,6.+(10./(60.-10.))*Math.max(length-6.,0));
|
||||
logger.finer("headlength: "+hLength+", arrowlength: "+length);
|
||||
|
||||
if (drawHead) {
|
||||
drawHead(x1, y1, theta, hLength, weight);
|
||||
}
|
||||
//String text = "P" + index;// + NumberFormat.getFormat("0.00").format(windDTO.trueWindBearingDeg) + "�";
|
||||
//drawPointWithText(x, y, text);
|
||||
//drawPoint(x, y);
|
||||
|
||||
context2d.setGlobalAlpha(0.4);
|
||||
|
||||
}
|
||||
|
||||
protected void drawHead(final double x, final double y, final double theta, final double headLength, final double weight) {
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ public abstract class FullCanvasOverlay extends CanvasOverlayV3 implements Requi
|
||||
+ "knots " + windDTO.trueWindBearingDeg;
|
||||
logger.fine(msg);
|
||||
Position position = windDTO.position;
|
||||
LatLng positionLatLng = LatLng.newInstance(position.getLatDeg(), position.getLngDeg());
|
||||
LatLng positionLatLng = coordinateSystem.toLatLng(position);
|
||||
Point canvasPositionInPx = mapProjection.fromLatLngToDivPixel(positionLatLng);
|
||||
double x = canvasPositionInPx.getX() - getWidgetPosLeft();
|
||||
double y = canvasPositionInPx.getY() - getWidgetPosTop();
|
||||
|
||||
Reference in new issue
Block a user