Closed Dazzid closed 6 years ago
Can you specify which Processing and Unfolding versions you are using?
Also, which renderer do you use? (the one specified in size()
)
Hey Till, It is Processing 3.3.6 with Unfolding 0.9.9. And P2D
If you want to get the screen positions for all locations of a line marker you need to access the actual locations, like so:
List<Marker> myMarkers = map.getMarkerManager(0).getMarkers();
for (int i = 0; i < myMarkers.size(); i++) {
SimpleLinesMarker myMarker = (SimpleLinesMarker) myMarkers.get(i);
for (int j = 0; j < myMarker.getLocations().size(); j++) {
println(map.getScreenPosition(myMarker.getLocation(j)));
}
}
The marker.getLocation() does return the centroid for all shape markers. This might be a bug for the SimpleLineMarker. Let me know if this centroid is what you are interested in.
(NB: In the above code snippet it is expected that all markers from the markerManager are SimpleLinesMarker. In an actual program you would need to cast more carefully.)
For getting the correct centroid, you can use this as a work-around:
Location centroid = GeoUtils.getEuclideanCentroid(lineMarker.getLocations());
ScreenPosition pos = map.getScreenPosition(centroid);
Now it make sense. Thanks!
Which was it you needed? Centroid? Or all locations?
Hi, I'm just trying to have the pixels coordinates of a path that was build by SimpleLinesMarker m = new SimpleLinesMarker(lineFeature.getLocations()). I'm using something like this:
But it is not the correct way to do so, it gives back far away pixel coordinates among many [0,0] return: [ 0.0, 0.0, 0.0 ] [ -8063.0, 195758.0, 0.0 ] [ 0.0, 0.0, 0.0 ] [ -10058.0, 247856.0, 0.0 ] [ 0.0, 0.0, 0.0 ] ...