added MAP_PROJECTION object
This commit is contained in:
parent
b2e6830bbe
commit
b337955f71
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
|
@ -335,7 +336,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
Double y = concessioneDV.getCentroidLat();
|
Double y = concessioneDV.getCentroidLat();
|
||||||
GWT.log("X: "+x +", Y:"+y);
|
GWT.log("X: "+x +", Y:"+y);
|
||||||
if(x!=null && y!=null) {
|
if(x!=null && y!=null) {
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
|
||||||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord,false);
|
GeoQuery select = olMapMng.toDataPointQuery(transfCoord,false);
|
||||||
GWT.log("GeoQuery: "+select);
|
GWT.log("GeoQuery: "+select);
|
||||||
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||||
|
|
|
@ -10,15 +10,15 @@ import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 24, 2020
|
* Nov 24, 2020
|
||||||
*/
|
*/
|
||||||
public class GeoportalDataViewerConstants {
|
public class GeoportalDataViewerConstants {
|
||||||
|
|
||||||
public static final String EPSG_4326 = "EPSG:4326";
|
// public static final String EPSG_4326 = "EPSG:4326";
|
||||||
public static final String EPSG_3857 = "EPSG:3857";
|
// public static final String EPSG_3857 = "EPSG:3857";
|
||||||
|
|
||||||
public static final String MAP_DIV = "map";
|
public static final String MAP_DIV = "map";
|
||||||
|
|
||||||
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
||||||
public static final String GET_GEONA_ITEM_TYPE = "git";
|
public static final String GET_GEONA_ITEM_TYPE = "git";
|
||||||
public static final String GET_GEONA_ITEM_ID = "gid";
|
public static final String GET_GEONA_ITEM_ID = "gid";
|
||||||
|
@ -27,32 +27,51 @@ public class GeoportalDataViewerConstants {
|
||||||
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
|
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
|
||||||
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
||||||
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
||||||
|
|
||||||
public static enum MapEventType {INIT, MAP_ZOOM_END, MOVE_END, ADDED_LAYER_TO_MAP}
|
public static enum MapEventType {
|
||||||
|
INIT, MAP_ZOOM_END, MOVE_END, ADDED_LAYER_TO_MAP
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum LayerType.
|
* The Enum LayerType.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 24, 2020
|
* Nov 24, 2020
|
||||||
*/
|
*/
|
||||||
public enum LayerType {RASTER_BASELAYER, FEATURE_TYPE};
|
public enum LayerType {
|
||||||
|
RASTER_BASELAYER, FEATURE_TYPE
|
||||||
public static final int MAX_WFS_FEATURES = 3; // zero for no limit
|
};
|
||||||
|
|
||||||
public static final String NEW_LINE_BR = "<br/>";
|
|
||||||
|
|
||||||
public static final double ITALY_CENTER_LONG = 12.45;
|
|
||||||
|
|
||||||
public static final double ITALY_CENTER_LAT = 42.98;
|
|
||||||
|
|
||||||
public static final int LIGHT_MAP_ITALY_FIT_ZOOM_ON = 5;
|
|
||||||
|
|
||||||
public static final int MAP_ITALY_FIT_ZOOM_ON = 6;
|
|
||||||
|
|
||||||
public static DateTimeFormat DT_FORMAT = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
public static DateTimeFormat DT_FORMAT = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
||||||
|
|
||||||
|
public static final int MAX_WFS_FEATURES = 3; // zero for no limit
|
||||||
|
|
||||||
|
public static final String NEW_LINE_BR = "<br/>";
|
||||||
|
|
||||||
|
public static enum MAP_PROJECTION {
|
||||||
|
|
||||||
|
EPSG_4326("EPSG:4326"), EPSG_3857("EPSG:3857");
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
|
MAP_PROJECTION(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final double ITALY_CENTER_LONG = 12.45;
|
||||||
|
|
||||||
|
public static final double ITALY_CENTER_LAT = 42.98;
|
||||||
|
|
||||||
|
public static final int LIGHT_MAP_ITALY_FIT_ZOOM_ON = 5;
|
||||||
|
|
||||||
|
public static final int MAP_ITALY_FIT_ZOOM_ON = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the.
|
* Prints the.
|
||||||
|
@ -60,8 +79,7 @@ public class GeoportalDataViewerConstants {
|
||||||
* @param msg the msg
|
* @param msg the msg
|
||||||
*/
|
*/
|
||||||
public static native void printJs(String msg)/*-{
|
public static native void printJs(String msg)/*-{
|
||||||
console.log("js console: "+msg);
|
console.log("js console: " + msg);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceCo
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
|
@ -123,8 +123,8 @@ public class LayerManager {
|
||||||
double minX = queryEvent.getGeoQuery().getX1();
|
double minX = queryEvent.getGeoQuery().getX1();
|
||||||
double minY = queryEvent.getGeoQuery().getY1();
|
double minY = queryEvent.getGeoQuery().getY1();
|
||||||
Coordinate centerCoordinate = new Coordinate(minX, minY);
|
Coordinate centerCoordinate = new Coordinate(minX, minY);
|
||||||
centerCoordinate = olMap.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_3857,
|
centerCoordinate = olMap.transform(centerCoordinate, MAP_PROJECTION.EPSG_3857.getName(),
|
||||||
GeoportalDataViewerConstants.EPSG_4326);
|
MAP_PROJECTION.EPSG_4326.getName());
|
||||||
mapBBOX.setLowerLeftX(centerCoordinate.getX());
|
mapBBOX.setLowerLeftX(centerCoordinate.getX());
|
||||||
mapBBOX.setLowerLeftY(centerCoordinate.getY());
|
mapBBOX.setLowerLeftY(centerCoordinate.getY());
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ public class LayerManager {
|
||||||
double maxX = queryEvent.getGeoQuery().getX2();
|
double maxX = queryEvent.getGeoQuery().getX2();
|
||||||
double maxY = queryEvent.getGeoQuery().getY2();
|
double maxY = queryEvent.getGeoQuery().getY2();
|
||||||
centerCoordinate = new Coordinate(maxX, maxY);
|
centerCoordinate = new Coordinate(maxX, maxY);
|
||||||
centerCoordinate = olMap.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_3857,
|
centerCoordinate = olMap.transform(centerCoordinate, MAP_PROJECTION.EPSG_3857.getName(),
|
||||||
GeoportalDataViewerConstants.EPSG_4326);
|
MAP_PROJECTION.EPSG_4326.getName());
|
||||||
mapBBOX.setUpperRightX(centerCoordinate.getX());
|
mapBBOX.setUpperRightX(centerCoordinate.getX());
|
||||||
mapBBOX.setUpperRightY(centerCoordinate.getY());
|
mapBBOX.setUpperRightY(centerCoordinate.getY());
|
||||||
|
|
||||||
mapBBOX.setCrs(GeoportalDataViewerConstants.EPSG_4326);
|
mapBBOX.setCrs(MAP_PROJECTION.EPSG_4326.getName());
|
||||||
|
|
||||||
GWT.log("Bounds is: " + mapBBOX);
|
GWT.log("Bounds is: " + mapBBOX);
|
||||||
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
||||||
|
@ -254,10 +254,10 @@ public class LayerManager {
|
||||||
olMap.removeAllDetailLayers();
|
olMap.removeAllDetailLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(queryEvent.getSourceMapEventType() != null && queryEvent.getSourceMapEventType().equals(MapEventType.MAP_ZOOM_END)) {
|
// if(queryEvent.getSourceMapEventType() != null && queryEvent.getSourceMapEventType().equals(MapEventType.MAP_ZOOM_END)) {
|
||||||
GWT.log("EVENT IS "+MapEventType.MAP_ZOOM_END +" retuning");
|
// GWT.log("EVENT IS "+MapEventType.MAP_ZOOM_END +" retuning");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//Showing properties belonging to concessioni centroid layer
|
//Showing properties belonging to concessioni centroid layer
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
@ -412,6 +412,7 @@ public class LayerManager {
|
||||||
@Override
|
@Override
|
||||||
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
|
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
|
||||||
GWT.log("Fired into layerManagerBus " + zoomOutEvent);
|
GWT.log("Fired into layerManagerBus " + zoomOutEvent);
|
||||||
|
olMap.removeAllDetailLayers();
|
||||||
applicationBus.fireEvent(zoomOutEvent);
|
applicationBus.fireEvent(zoomOutEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
|
||||||
|
@ -15,7 +19,6 @@ import com.google.gwt.event.shared.HandlerManager;
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.MapBrowserEvent;
|
import ol.MapBrowserEvent;
|
||||||
import ol.MapEvent;
|
import ol.MapEvent;
|
||||||
import ol.OLFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class OLMapManager.
|
* The Class OLMapManager.
|
||||||
|
@ -121,13 +124,17 @@ public class OLMapManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
// EPSG_4326_TO_ITALY
|
// EPSG_4326_TO_ITALY
|
||||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG,
|
// Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG,
|
||||||
GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
// GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate,
|
// Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate,
|
||||||
GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
// MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
// olMap.setCenter(transformedCenterCoordinate);
|
||||||
|
// olMap.setZoom(GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON);
|
||||||
|
|
||||||
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
olMap.setCenter(transformedCenterCoordinate);
|
olMap.setCenter(transformedCenterCoordinate);
|
||||||
olMap.setZoom(GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON);
|
olMap.setZoom(italyLocation.getZoomLevel());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class MapExtentToEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Sep 1, 2021
|
||||||
|
*/
|
||||||
|
public class MapExtentToEvent extends GwtEvent<MapExtentToEventHandler> {
|
||||||
|
public static Type<MapExtentToEventHandler> TYPE = new Type<MapExtentToEventHandler>();
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new map extent to event.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
*/
|
||||||
|
public MapExtentToEvent(Location location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<MapExtentToEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(MapExtentToEventHandler handler) {
|
||||||
|
handler.onExtentEvent(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface MapExtentToEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Sep 1, 2021
|
||||||
|
*/
|
||||||
|
public interface MapExtentToEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On extent event.
|
||||||
|
*
|
||||||
|
* @param mapExtentToEvent the map extent to event
|
||||||
|
*/
|
||||||
|
void onExtentEvent(MapExtentToEvent mapExtentToEvent);
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
@ -39,34 +39,33 @@ import ol.style.Style;
|
||||||
import ol.style.Text;
|
import ol.style.Text;
|
||||||
import ol.style.TextOptions;
|
import ol.style.TextOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LightOpenLayerOSM.
|
* The Class LightOpenLayerOSM.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 11, 2020
|
* Nov 11, 2020
|
||||||
*/
|
*/
|
||||||
public class LightOpenLayerOSM {
|
public class LightOpenLayerOSM {
|
||||||
|
|
||||||
/** The map. */
|
/** The map. */
|
||||||
private Map map;
|
private Map map;
|
||||||
|
|
||||||
/** The view. */
|
/** The view. */
|
||||||
private View view;
|
private View view;
|
||||||
|
|
||||||
/** The view options. */
|
/** The view options. */
|
||||||
private ViewOptions viewOptions = OLFactory.createOptions();
|
private ViewOptions viewOptions = OLFactory.createOptions();
|
||||||
|
|
||||||
/** The projection options. */
|
/** The projection options. */
|
||||||
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
||||||
|
|
||||||
private boolean isQueryPointActive;
|
private boolean isQueryPointActive;
|
||||||
|
|
||||||
private ol.layer.Vector geometryLayer;
|
private ol.layer.Vector geometryLayer;
|
||||||
|
|
||||||
private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
|
private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new light open layer OSM.
|
* Instantiates a new light open layer OSM.
|
||||||
*
|
*
|
||||||
|
@ -74,123 +73,122 @@ import ol.style.TextOptions;
|
||||||
*/
|
*/
|
||||||
public LightOpenLayerOSM(String divTargetId) {
|
public LightOpenLayerOSM(String divTargetId) {
|
||||||
|
|
||||||
// create a OSM-layer
|
// create a OSM-layer
|
||||||
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
||||||
|
|
||||||
Osm osmSource = new Osm(osmSourceOptions);
|
Osm osmSource = new Osm(osmSourceOptions);
|
||||||
LayerOptions osmLayerOptions = OLFactory.createOptions();
|
LayerOptions osmLayerOptions = OLFactory.createOptions();
|
||||||
osmLayerOptions.setSource(osmSource);
|
osmLayerOptions.setSource(osmSource);
|
||||||
|
|
||||||
Tile osmLayer = new Tile(osmLayerOptions);
|
Tile osmLayer = new Tile(osmLayerOptions);
|
||||||
// create a projection
|
// create a projection
|
||||||
projectionOptions.setCode(GeoportalDataViewerConstants.EPSG_3857);
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
||||||
projectionOptions.setUnits("m");
|
projectionOptions.setUnits("m");
|
||||||
|
|
||||||
Projection projection = new Projection(projectionOptions);
|
Projection projection = new Projection(projectionOptions);
|
||||||
viewOptions.setProjection(projection);
|
viewOptions.setProjection(projection);
|
||||||
viewOptions.setMaxZoom(20);
|
viewOptions.setMaxZoom(20);
|
||||||
|
|
||||||
// create a view
|
// create a view
|
||||||
view = new View(viewOptions);
|
view = new View(viewOptions);
|
||||||
|
|
||||||
// create the map
|
|
||||||
MapOptions mapOptions = OLFactory.createOptions();
|
|
||||||
mapOptions.setTarget(divTargetId);
|
|
||||||
mapOptions.setView(view);
|
|
||||||
|
|
||||||
map = new Map(mapOptions);
|
// create the map
|
||||||
|
MapOptions mapOptions = OLFactory.createOptions();
|
||||||
|
mapOptions.setTarget(divTargetId);
|
||||||
|
mapOptions.setView(view);
|
||||||
|
|
||||||
map.addLayer(osmLayer);
|
map = new Map(mapOptions);
|
||||||
//map.addLayer(tileDebugLayer);
|
|
||||||
|
map.addLayer(osmLayer);
|
||||||
|
// map.addLayer(tileDebugLayer);
|
||||||
|
|
||||||
|
Attribution attribution = new Attribution();
|
||||||
|
attribution.setCollapsed(true);
|
||||||
|
|
||||||
|
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
||||||
|
|
||||||
Attribution attribution = new Attribution();
|
|
||||||
attribution.setCollapsed(true);
|
|
||||||
|
|
||||||
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(MapBrowserEvent event) {
|
public void onEvent(MapBrowserEvent event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
Coordinate coordinate = event.getCoordinate();
|
Coordinate coordinate = event.getCoordinate();
|
||||||
if(isQueryPointActive) {
|
if (isQueryPointActive) {
|
||||||
|
|
||||||
double lon = coordinate.getX();
|
double lon = coordinate.getX();
|
||||||
double lat = coordinate.getY();
|
double lat = coordinate.getY();
|
||||||
|
|
||||||
int w = (int) map.getSize().getWidth();
|
int w = (int) map.getSize().getWidth();
|
||||||
int h = (int) map.getSize().getHeight();
|
int h = (int) map.getSize().getHeight();
|
||||||
// handler.clickOnMap(x, y, w, h);
|
// handler.clickOnMap(x, y, w, h);
|
||||||
|
|
||||||
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
|
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
|
||||||
// where 10px is the pixel diameter dimension of the clicked point
|
// where 10px is the pixel diameter dimension of the clicked point
|
||||||
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
|
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
|
||||||
double geoWidth = (bboxWidth / w) * (20 / 2);
|
double geoWidth = (bboxWidth / w) * (20 / 2);
|
||||||
double x1 = Math.min(lon+geoWidth, lon-geoWidth);
|
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
|
||||||
double x2 = Math.max(lon+geoWidth, lon-geoWidth);
|
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
|
||||||
double y1 = Math.min(lat+geoWidth, lat-geoWidth);
|
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
|
||||||
double y2 = Math.max(lat+geoWidth, lat-geoWidth);
|
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
|
||||||
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
|
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
|
||||||
|
|
||||||
// Point pt = new Point(coordinate);
|
// Point pt = new Point(coordinate);
|
||||||
// ol.Extent extent = pt.getExtent();
|
// ol.Extent extent = pt.getExtent();
|
||||||
// //new ClickDataInfo(x1, y1, x2, y2)
|
// //new ClickDataInfo(x1, y1, x2, y2)
|
||||||
// SelectDataInfo selectDataInfo
|
// SelectDataInfo selectDataInfo
|
||||||
//selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
|
// selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
|
||||||
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
|
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addControl(attribution);
|
map.addControl(attribution);
|
||||||
|
|
||||||
|
// add some interactions
|
||||||
|
map.addInteraction(new KeyboardPan());
|
||||||
|
map.addInteraction(new KeyboardZoom());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// add some interactions
|
|
||||||
map.addInteraction(new KeyboardPan());
|
|
||||||
map.addInteraction(new KeyboardZoom());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the center.
|
* Sets the center.
|
||||||
*
|
*
|
||||||
* @param centerCoordinate the new center
|
* @param centerCoordinate the new center
|
||||||
*/
|
*/
|
||||||
public void setCenter(Coordinate centerCoordinate) {
|
public void setCenter(Coordinate centerCoordinate) {
|
||||||
view.setCenter(centerCoordinate);
|
view.setCenter(centerCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the center.
|
* Sets the center.
|
||||||
*
|
*
|
||||||
* @param zoom the new zoom
|
* @param zoom the new zoom
|
||||||
*/
|
*/
|
||||||
public void setZoom(int zoom) {
|
public void setZoom(int zoom) {
|
||||||
view.setZoom(zoom);
|
view.setZoom(zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the WMS layer.
|
* Adds the WMS layer.
|
||||||
*
|
*
|
||||||
* @param mapServerHost the map server host
|
* @param mapServerHost the map server host
|
||||||
* @param layerName the layer name
|
* @param layerName the layer name
|
||||||
* @param bbox
|
* @param bbox
|
||||||
* @return the image
|
* @return the image
|
||||||
*/
|
*/
|
||||||
public Image addWMSLayer(String mapServerHost, String layerName, BoundsMap bbox) {
|
public Image addWMSLayer(String mapServerHost, String layerName, BoundsMap bbox) {
|
||||||
GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName);
|
GWT.log("Adding wmsLayer with mapServerHost: " + mapServerHost + ", layerName: " + layerName);
|
||||||
|
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerName);
|
imageWMSParams.setLayers(layerName);
|
||||||
//imageWMSParams.setSize(new Size(400,400));
|
// imageWMSParams.setSize(new Size(400,400));
|
||||||
//imageWMSParams.setVersion("1.1.0");
|
// imageWMSParams.setVersion("1.1.0");
|
||||||
// if(bbox!=null)
|
// if(bbox!=null)
|
||||||
// imageWMSParams.set("BBOX", bbox.getLowerLeftX()+","+bbox.getLowerLeftY()+","+bbox.getUpperRightX()+","+bbox.getUpperRightY());
|
// imageWMSParams.set("BBOX", bbox.getLowerLeftX()+","+bbox.getLowerLeftY()+","+bbox.getUpperRightX()+","+bbox.getUpperRightY());
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(mapServerHost);
|
imageWMSOptions.setUrl(mapServerHost);
|
||||||
imageWMSOptions.setParams(imageWMSParams);
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
//imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
|
||||||
|
@ -198,50 +196,48 @@ import ol.style.TextOptions;
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
||||||
//visibleLayerItems
|
// visibleLayerItems
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
|
|
||||||
return wmsLayer;
|
return wmsLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the first layer.
|
* Gets the first layer.
|
||||||
*
|
*
|
||||||
* @return the first layer
|
* @return the first layer
|
||||||
*/
|
*/
|
||||||
public Image getFirstLayer() {
|
public Image getFirstLayer() {
|
||||||
if(map.getLayers()!=null) {
|
if (map.getLayers() != null) {
|
||||||
return (Image) map.getLayers().getArray()[0];
|
return (Image) map.getLayers().getArray()[0];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the point.
|
* Adds the point.
|
||||||
*
|
*
|
||||||
* @param coordinate the coordinate
|
* @param coordinate the coordinate
|
||||||
* @param showCoordinateText the show coordinate text
|
* @param showCoordinateText the show coordinate text
|
||||||
* @param asMarker the as marker
|
* @param asMarker the as marker
|
||||||
*/
|
*/
|
||||||
public void addPoint(Coordinate coordinate, boolean showCoordinateText, boolean asMarker) {
|
public void addPoint(Coordinate coordinate, boolean showCoordinateText, boolean asMarker) {
|
||||||
|
|
||||||
if(geometryLayer!=null) {
|
if (geometryLayer != null) {
|
||||||
map.removeLayer(geometryLayer);
|
map.removeLayer(geometryLayer);
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
Style style = new Style();
|
Style style = new Style();
|
||||||
|
|
||||||
if(asMarker) {
|
if (asMarker) {
|
||||||
IconOptions iconOptions = new IconOptions();
|
IconOptions iconOptions = new IconOptions();
|
||||||
iconOptions.setSrc(markerURL);
|
iconOptions.setSrc(markerURL);
|
||||||
Icon icon = new Icon(iconOptions);
|
Icon icon = new Icon(iconOptions);
|
||||||
style.setImage(icon);
|
style.setImage(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(showCoordinateText) {
|
if (showCoordinateText) {
|
||||||
TextOptions textOptions = new TextOptions();
|
TextOptions textOptions = new TextOptions();
|
||||||
textOptions.setOffsetY(-25);
|
textOptions.setOffsetY(-25);
|
||||||
// StrokeOptions strokeOptions = new StrokeOptions();
|
// StrokeOptions strokeOptions = new StrokeOptions();
|
||||||
|
@ -253,10 +249,11 @@ import ol.style.TextOptions;
|
||||||
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
|
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
|
||||||
// textOptions.setFill(new Fill(fillOptions));
|
// textOptions.setFill(new Fill(fillOptions));
|
||||||
|
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326);
|
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, MAP_PROJECTION.EPSG_3857.getName(),
|
||||||
//DecimalFormat df = new DecimalFormat("#.####");
|
MAP_PROJECTION.EPSG_4326.getName());
|
||||||
|
// DecimalFormat df = new DecimalFormat("#.####");
|
||||||
NumberFormat fmt = NumberFormat.getFormat("#.####");
|
NumberFormat fmt = NumberFormat.getFormat("#.####");
|
||||||
textOptions.setText("Long: "+fmt.format(transfCoord.getX()) + ", Lat: "+fmt.format(transfCoord.getY()));
|
textOptions.setText("Long: " + fmt.format(transfCoord.getX()) + ", Lat: " + fmt.format(transfCoord.getY()));
|
||||||
|
|
||||||
Text text = new Text(textOptions);
|
Text text = new Text(textOptions);
|
||||||
// FillOptions fillOptions = new FillOptions();
|
// FillOptions fillOptions = new FillOptions();
|
||||||
|
@ -266,7 +263,6 @@ import ol.style.TextOptions;
|
||||||
// style.setFill(fill);
|
// style.setFill(fill);
|
||||||
style.setText(text);
|
style.setText(text);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Point thePoint = new Point(coordinate);
|
Point thePoint = new Point(coordinate);
|
||||||
Feature vf = new Feature(thePoint);
|
Feature vf = new Feature(thePoint);
|
||||||
|
@ -278,7 +274,7 @@ import ol.style.TextOptions;
|
||||||
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
||||||
map.addLayer(geometryLayer);
|
map.addLayer(geometryLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the map.
|
* Gets the map.
|
||||||
*
|
*
|
||||||
|
@ -297,7 +293,6 @@ import ol.style.TextOptions;
|
||||||
return map.getView().getProjection().getCode();
|
return map.getView().getProjection().getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current zoom level.
|
* Gets the current zoom level.
|
||||||
*
|
*
|
||||||
|
@ -306,9 +301,7 @@ import ol.style.TextOptions;
|
||||||
public double getCurrentZoomLevel() {
|
public double getCurrentZoomLevel() {
|
||||||
return map.getView().getZoom();
|
return map.getView().getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the bbox.
|
* Gets the bbox.
|
||||||
*
|
*
|
||||||
|
@ -317,7 +310,7 @@ import ol.style.TextOptions;
|
||||||
public ol.Extent getBBOX() {
|
public ol.Extent getBBOX() {
|
||||||
return getExtent();
|
return getExtent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the extent.
|
* Gets the extent.
|
||||||
*
|
*
|
||||||
|
@ -326,6 +319,5 @@ import ol.style.TextOptions;
|
||||||
public ol.Extent getExtent() {
|
public ol.Extent getExtent() {
|
||||||
return this.map.getView().calculateExtent(map.getSize());
|
return this.map.getView().calculateExtent(map.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import ol.source.Osm;
|
||||||
import ol.source.Vector;
|
import ol.source.Vector;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
|
||||||
/**
|
/**
|
||||||
* The Class OpenLayerOSM.
|
* The Class OpenLayerOSM.
|
||||||
*
|
*
|
||||||
|
@ -147,7 +147,7 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
Tile osmLayer = new Tile(osmLayerOptions);
|
Tile osmLayer = new Tile(osmLayerOptions);
|
||||||
// create a projection
|
// create a projection
|
||||||
projectionOptions.setCode(GeoportalDataViewerConstants.EPSG_3857);
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
||||||
projectionOptions.setUnits("m");
|
projectionOptions.setUnits("m");
|
||||||
|
|
||||||
Projection projection = new Projection(projectionOptions);
|
Projection projection = new Projection(projectionOptions);
|
||||||
|
@ -392,6 +392,8 @@ public abstract class OpenLayerOSM {
|
||||||
if (wmsDetailsLayerMap == null)
|
if (wmsDetailsLayerMap == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
||||||
|
|
||||||
for (String key : wmsDetailsLayerMap.keySet()) {
|
for (String key : wmsDetailsLayerMap.keySet()) {
|
||||||
Image layer = wmsDetailsLayerMap.get(key);
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
map.removeLayer(layer);
|
map.removeLayer(layer);
|
||||||
|
|
|
@ -16,4 +16,7 @@ public interface Images extends ClientBundle {
|
||||||
|
|
||||||
@Source("icon_share.png")
|
@Source("icon_share.png")
|
||||||
ImageResource shareIcon();
|
ImageResource shareIcon();
|
||||||
|
|
||||||
|
@Source("italy.png")
|
||||||
|
ImageResource italyIcon();
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -3,7 +3,9 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
|
@ -23,7 +25,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 19, 2020
|
* Nov 19, 2020
|
||||||
*/
|
*/
|
||||||
public class GeonaDataViewMainPanel extends Composite {
|
public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
|
@ -34,14 +36,14 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 19, 2020
|
* Nov 19, 2020
|
||||||
*/
|
*/
|
||||||
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
|
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel mainContainerPanel;
|
HTMLPanel mainContainerPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel mainToolBar;
|
HTMLPanel mainToolBar;
|
||||||
|
|
||||||
|
@ -50,37 +52,39 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
NavLink dataBoxSelection;
|
NavLink dataBoxSelection;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button removeQuery;
|
Button removeQuery;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DetailsPanel detailsPanel;
|
DetailsPanel detailsPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button extentToItaly;
|
||||||
|
|
||||||
private MapPanel mapPanel;
|
private MapPanel mapPanel;
|
||||||
|
|
||||||
private OpenLayerOSM map;
|
private OpenLayerOSM map;
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona data view main panel.
|
* Instantiates a new geona data view main panel.
|
||||||
*
|
*
|
||||||
* @param applicationBus the application bus
|
* @param applicationBus the application bus
|
||||||
* @param mapHeight the map height
|
* @param mapHeight the map height
|
||||||
*/
|
*/
|
||||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
|
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
mapPanel = new MapPanel(mapHeight+"px");
|
mapPanel = new MapPanel(mapHeight + "px");
|
||||||
detailsPanel.setHeight(mapHeight+"px");
|
detailsPanel.setHeight(mapHeight + "px");
|
||||||
detailsPanel.setApplicationBus(applicationBus);
|
detailsPanel.setApplicationBus(applicationBus);
|
||||||
mainContainerPanel.add(mapPanel);
|
mainContainerPanel.add(mapPanel);
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
||||||
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
||||||
|
|
||||||
removeQuery.setIcon(IconType.REMOVE);
|
removeQuery.setIcon(IconType.REMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,9 +147,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
removeQuery.setVisible(true);
|
removeQuery.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
removeQuery.addClickHandler(new ClickHandler() {
|
removeQuery.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
map.removeQueryInteractions();
|
map.removeQueryInteractions();
|
||||||
|
@ -153,27 +157,36 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
extentToItaly.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
applicationBus.fireEvent(new MapExtentToEvent(ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.ITALY)));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show as details.
|
* Show as details.
|
||||||
*
|
*
|
||||||
* @param concessioneDV the concessione DV
|
* @param concessioneDV the concessione DV
|
||||||
* @param geonaItemRef the geona item ref
|
* @param geonaItemRef the geona item ref
|
||||||
*/
|
*/
|
||||||
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
||||||
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide panel details.
|
* Hide panel details.
|
||||||
*/
|
*/
|
||||||
public void hidePanelDetails() {
|
public void hidePanelDetails() {
|
||||||
detailsPanel.hidePanelDetails();
|
detailsPanel.hidePanelDetails();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the displyed record.
|
* Gets the displyed record.
|
||||||
*
|
*
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
.margin-right-10 {
|
.margin-right-10 {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-weight-bold {
|
.font-weight-bold {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +20,17 @@
|
||||||
<g:HTMLPanel ui:field="panelMI"
|
<g:HTMLPanel ui:field="panelMI"
|
||||||
addStyleNames="info-interaction">
|
addStyleNames="info-interaction">
|
||||||
<g:Label>Map Interactions</g:Label>
|
<g:Label>Map Interactions</g:Label>
|
||||||
<b:Paragraph><b:Icon type="CHECK_EMPTY"/> Use <code>Shift+Drag</code> to draw an extent for zoom in the Map</b:Paragraph>
|
<b:Paragraph>
|
||||||
<b:Paragraph><b:Icon type="HAND_UP"/> Click on the Points shown on the Map to view their features</b:Paragraph>
|
<b:Icon type="CHECK_EMPTY" />
|
||||||
</g:HTMLPanel>
|
Use
|
||||||
|
<code>Shift+Drag</code>
|
||||||
|
to draw an extent for zoom in the Map
|
||||||
|
</b:Paragraph>
|
||||||
|
<b:Paragraph>
|
||||||
|
<b:Icon type="HAND_UP" />
|
||||||
|
Click on the Points shown on the Map to view their features
|
||||||
|
</b:Paragraph>
|
||||||
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" text="Query"
|
<b:DropdownButton type="LINK" text="Query"
|
||||||
visible="false">
|
visible="false">
|
||||||
|
@ -33,6 +42,8 @@
|
||||||
Selection</b:NavLink>
|
Selection</b:NavLink>
|
||||||
<!-- </b:ButtonGroup> -->
|
<!-- </b:ButtonGroup> -->
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
<b:Button type="LINK" ui:field="extentToItaly"
|
||||||
|
text="Extent"></b:Button>
|
||||||
<b:Button type="LINK" ui:field="removeQuery"
|
<b:Button type="LINK" ui:field="removeQuery"
|
||||||
text="Remove Query" visible="false"></b:Button>
|
text="Remove Query" visible="false"></b:Button>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
|
||||||
|
import ol.Coordinate;
|
||||||
|
import ol.OLFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ExtentMapUtil.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Sep 1, 2021
|
||||||
|
*/
|
||||||
|
public class ExtentMapUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum PLACE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Sep 1, 2021
|
||||||
|
*/
|
||||||
|
public static enum PLACE {
|
||||||
|
ITALY
|
||||||
|
}
|
||||||
|
|
||||||
|
final static Map<PLACE, Location> mapExtent = new HashMap<PLACE, Location>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
// EPSG_4326 ITALY LOCATION
|
||||||
|
Location location = new Location(PLACE.ITALY.name(), GeoportalDataViewerConstants.ITALY_CENTER_LONG,
|
||||||
|
GeoportalDataViewerConstants.ITALY_CENTER_LAT, MAP_PROJECTION.EPSG_4326,
|
||||||
|
GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON);
|
||||||
|
|
||||||
|
mapExtent.put(PLACE.ITALY, location);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Location getLocation(PLACE place) {
|
||||||
|
return mapExtent.get(place);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class Location.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Sep 1, 2021
|
||||||
|
*/
|
||||||
|
public static class Location {
|
||||||
|
public String name;
|
||||||
|
public double coordinateX;
|
||||||
|
public double coordinateY;
|
||||||
|
public MAP_PROJECTION projection;
|
||||||
|
public int zoomLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new location.
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @param coordinateX the coordinate X
|
||||||
|
* @param coordinateY the coordinate Y
|
||||||
|
* @param projection the projection
|
||||||
|
* @param zoomLevel the zoom level
|
||||||
|
*/
|
||||||
|
public Location(String name, double coordinateX, double coordinateY, MAP_PROJECTION projection, int zoomLevel) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.coordinateX = coordinateX;
|
||||||
|
this.coordinateY = coordinateY;
|
||||||
|
this.projection = projection;
|
||||||
|
this.zoomLevel = zoomLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the coordinate X.
|
||||||
|
*
|
||||||
|
* @return the coordinate X
|
||||||
|
*/
|
||||||
|
public double getCoordinateX() {
|
||||||
|
return coordinateX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the coordinate Y.
|
||||||
|
*
|
||||||
|
* @return the coordinate Y
|
||||||
|
*/
|
||||||
|
public double getCoordinateY() {
|
||||||
|
return coordinateY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the projection.
|
||||||
|
*
|
||||||
|
* @return the projection
|
||||||
|
*/
|
||||||
|
public MAP_PROJECTION getProjection() {
|
||||||
|
return projection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the zoom level.
|
||||||
|
*
|
||||||
|
* @return the zoom level
|
||||||
|
*/
|
||||||
|
public int getZoomLevel() {
|
||||||
|
return zoomLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the coordinate.
|
||||||
|
*
|
||||||
|
* @param targetProjection the target projection
|
||||||
|
* @return the coordinate
|
||||||
|
*/
|
||||||
|
public Coordinate getCoordinate(MAP_PROJECTION targetProjection) {
|
||||||
|
|
||||||
|
Coordinate coordinate = OLFactory.createCoordinate(coordinateX, coordinateY);
|
||||||
|
if (projection.equals(targetProjection)) {
|
||||||
|
return coordinate;
|
||||||
|
} else {
|
||||||
|
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(coordinate, projection.getName(),
|
||||||
|
targetProjection.getName());
|
||||||
|
return transformedCenterCoordinate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Location [name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", coordinateX=");
|
||||||
|
builder.append(coordinateX);
|
||||||
|
builder.append(", coordinateY=");
|
||||||
|
builder.append(coordinateY);
|
||||||
|
builder.append(", projection=");
|
||||||
|
builder.append(projection);
|
||||||
|
builder.append(", zoomLevel=");
|
||||||
|
builder.append(zoomLevel);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,9 +2,12 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerOSM;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
@ -67,12 +70,18 @@ import ol.OLFactory;
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
olsm = new LightOpenLayerOSM(theMapId);
|
olsm = new LightOpenLayerOSM(theMapId);
|
||||||
//EPSG_4326_TO_ITALY
|
|
||||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
//EPSG_3857 LOCATION TO ITALY
|
||||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
olsm.setCenter(transformedCenterCoordinate);
|
olsm.setCenter(transformedCenterCoordinate);
|
||||||
olsm.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
|
olsm.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
|
||||||
|
|
||||||
|
// Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||||
|
// Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||||
|
// olsm.setCenter(transformedCenterCoordinate);
|
||||||
|
// olsm.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
|
||||||
|
|
||||||
//setMapSize();
|
//setMapSize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,14 +145,13 @@ import ol.OLFactory;
|
||||||
|
|
||||||
if (bbox != null) {
|
if (bbox != null) {
|
||||||
|
|
||||||
|
|
||||||
Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY());
|
Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY());
|
||||||
Coordinate lowerCoord = MapUtils.transformCoordiante(lower, GeoportalDataViewerConstants.EPSG_4326,
|
Coordinate lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
GeoportalDataViewerConstants.EPSG_3857);
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
Coordinate upper = OLFactory.createCoordinate(bbox.getUpperRightX(), bbox.getUpperRightY());
|
Coordinate upper = OLFactory.createCoordinate(bbox.getUpperRightX(), bbox.getUpperRightY());
|
||||||
Coordinate upperCoord = MapUtils.transformCoordiante(upper, GeoportalDataViewerConstants.EPSG_4326,
|
Coordinate upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
GeoportalDataViewerConstants.EPSG_3857);
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
|
ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
|
||||||
theBBOX = new BoundsMap(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY(), null);
|
theBBOX = new BoundsMap(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY(), null);
|
||||||
|
|
|
@ -9,11 +9,15 @@ import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelaz
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||||
|
|
||||||
|
@ -35,7 +39,6 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.OLFactory;
|
|
||||||
|
|
||||||
public class ConcessioneView extends Composite {
|
public class ConcessioneView extends Composite {
|
||||||
|
|
||||||
|
@ -300,13 +303,15 @@ public class ConcessioneView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCentroidMap() {
|
private void addCentroidMap() {
|
||||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
// Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
// Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||||
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
||||||
|
|
||||||
if(concessioneDV!=null && concessioneDV.getCentroidLat()!=null && concessioneDV.getCentroidLong()!=null) {
|
if(concessioneDV!=null && concessioneDV.getCentroidLat()!=null && concessioneDV.getCentroidLong()!=null) {
|
||||||
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
|
||||||
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
||||||
boolean authenticatedUser = myLogin!=null?true:false;
|
boolean authenticatedUser = myLogin!=null?true:false;
|
||||||
mapView.addMarker(transfCoord, authenticatedUser);
|
mapView.addMarker(transfCoord, authenticatedUser);
|
||||||
|
|
|
@ -2,7 +2,10 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessio
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||||
|
|
||||||
|
@ -14,7 +17,6 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.OLFactory;
|
|
||||||
|
|
||||||
public class LayerConcessioneView extends Composite {
|
public class LayerConcessioneView extends Composite {
|
||||||
|
|
||||||
|
@ -44,8 +46,12 @@ public class LayerConcessioneView extends Composite {
|
||||||
|
|
||||||
GWT.log("WMS LINK: "+layerDV.getWmsLink());
|
GWT.log("WMS LINK: "+layerDV.getWmsLink());
|
||||||
if(layerDV.getLayerName()!=null && layerDV.getWmsLink()!=null) {
|
if(layerDV.getLayerName()!=null && layerDV.getWmsLink()!=null) {
|
||||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
|
||||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
|
||||||
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
|
// Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||||
|
// Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
|
||||||
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
||||||
|
|
||||||
mapViewPanel.add(mapView);
|
mapViewPanel.add(mapView);
|
||||||
|
|
Loading…
Reference in New Issue