fixed coordinate
This commit is contained in:
parent
4064189cd3
commit
05f6d5f5b8
|
@ -18,8 +18,6 @@ import com.google.gwt.core.client.EntryPoint;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
|
|
@ -15,6 +15,7 @@ import ol.MapOptions;
|
|||
import ol.OLFactory;
|
||||
import ol.View;
|
||||
import ol.ViewOptions;
|
||||
import ol.color.Color;
|
||||
import ol.control.Attribution;
|
||||
import ol.event.EventListener;
|
||||
import ol.geom.Point;
|
||||
|
@ -31,8 +32,12 @@ import ol.source.ImageWmsOptions;
|
|||
import ol.source.ImageWmsParams;
|
||||
import ol.source.Osm;
|
||||
import ol.source.XyzOptions;
|
||||
import ol.style.Fill;
|
||||
import ol.style.FillOptions;
|
||||
import ol.style.Icon;
|
||||
import ol.style.IconOptions;
|
||||
import ol.style.Stroke;
|
||||
import ol.style.StrokeOptions;
|
||||
import ol.style.Style;
|
||||
import ol.style.Text;
|
||||
import ol.style.TextOptions;
|
||||
|
@ -252,7 +257,19 @@ import ol.style.TextOptions;
|
|||
if(showCoordinateText) {
|
||||
TextOptions textOptions = new TextOptions();
|
||||
textOptions.setOffsetY(-25);
|
||||
textOptions.setText("Long: "+coordinate.getX() + ", Lat: "+coordinate.getY());
|
||||
// StrokeOptions strokeOptions = new StrokeOptions();
|
||||
// strokeOptions.setColor(new Color(0, 0, 255, 0.0));
|
||||
// strokeOptions.setWidth(4);
|
||||
// Stroke stroke = new Stroke(strokeOptions);
|
||||
// textOptions.setStroke(stroke);
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
|
||||
// textOptions.setFill(new Fill(fillOptions));
|
||||
|
||||
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326);
|
||||
textOptions.setText("Long: "+transfCoord.getX() + ", Lat: "+transfCoord.getY());
|
||||
|
||||
|
||||
Text text = new Text(textOptions);
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// Color color = new Color(217, 217, 223, 0.0);
|
||||
|
|
|
@ -46,4 +46,15 @@ public final class MapUtils {
|
|||
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
|
||||
return Projection.transform(centerCoordinate, source, target);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse coordinate.
|
||||
*
|
||||
* @param coord the coord
|
||||
* @return the coordinate
|
||||
*/
|
||||
public static Coordinate reverseCoordinate(Coordinate coord){
|
||||
return new Coordinate(coord.getY(), coord.getX());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
|
@ -256,7 +257,10 @@ public class ConcessioneView extends Composite {
|
|||
|
||||
private void addCentroidMap() {
|
||||
MapView mapView = new MapView();
|
||||
mapView.addMarker(new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat()), true);
|
||||
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
||||
Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
||||
mapView.addMarker(transfCoord, true);
|
||||
mapViewPanel.add(mapView);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue