fixed css. managing popup info separately
This commit is contained in:
parent
0e082c0c37
commit
2af0252338
|
@ -107,11 +107,11 @@ public class LayerManager {
|
||||||
GWT.log("(" + selectDataInfo.getX1() + "," + selectDataInfo.getY1() + ")(" + selectDataInfo.getX2()
|
GWT.log("(" + selectDataInfo.getX1() + "," + selectDataInfo.getY1() + ")(" + selectDataInfo.getX2()
|
||||||
+ "," + selectDataInfo.getY2() + ")");
|
+ "," + selectDataInfo.getY2() + ")");
|
||||||
|
|
||||||
for (LayerObject layerObj : layerObjects.values()) {
|
// for (LayerObject layerObj : layerObjects.values()) {
|
||||||
// TODO
|
// // TODO
|
||||||
isLayerVisible(layerObj.getLayerItem());
|
// isLayerVisible(layerObj.getLayerItem());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
BoundsMap mapBBOX = new BoundsMap();
|
BoundsMap mapBBOX = new BoundsMap();
|
||||||
// THIS IS SHOULD BE CORRET, THE BOUND AND CRS ARE READ FROM MAP
|
// THIS IS SHOULD BE CORRET, THE BOUND AND CRS ARE READ FROM MAP
|
||||||
|
@ -227,6 +227,8 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("the product id is: " + theProductId);
|
GWT.log("the product id is: " + theProductId);
|
||||||
|
//Displaying popup info for centroid layer
|
||||||
|
showPopupInfoForCentroidLayer(geoNaDataObject, feature, queryEvent.getOnFailureCenterTo());
|
||||||
|
|
||||||
// retrieving and showing WMS layers of a concessione if the ZOOM level is >
|
// retrieving and showing WMS layers of a concessione if the ZOOM level is >
|
||||||
// QUERY_MIN_ZOOM_LEVEL
|
// QUERY_MIN_ZOOM_LEVEL
|
||||||
|
@ -260,195 +262,185 @@ public class LayerManager {
|
||||||
olMap.removeAllDetailLayers();
|
olMap.removeAllDetailLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(queryEvent.getSourceMapEventType() != null && queryEvent.getSourceMapEventType().equals(MapEventType.MAP_ZOOM_END)) {
|
|
||||||
// GWT.log("EVENT IS "+MapEventType.MAP_ZOOM_END +" retuning");
|
// Showing properties belonging to concessioni centroid layer
|
||||||
// return;
|
// Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
//
|
||||||
|
// String nome = "";
|
||||||
|
// String descrizione = "";
|
||||||
|
// String date = "";
|
||||||
|
//
|
||||||
|
// for (String key : entries.keySet()) {
|
||||||
|
// String theValue = entries.get(key).get(0);
|
||||||
|
// if (key.equalsIgnoreCase("nome")) {
|
||||||
|
// nome = theValue != null ? theValue : "";
|
||||||
|
// } else if (key.equalsIgnoreCase("descrizione")) {
|
||||||
|
// descrizione = theValue != null ? theValue : "";
|
||||||
|
// } else if (key.equalsIgnoreCase("date_scavo")) {
|
||||||
|
// date = theValue != null ? theValue : "";
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Showing properties belonging to concessioni centroid layer
|
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
|
||||||
|
|
||||||
String nome = "";
|
|
||||||
String descrizione = "";
|
|
||||||
String date = "";
|
|
||||||
|
|
||||||
for (String key : entries.keySet()) {
|
|
||||||
String theValue = entries.get(key).get(0);
|
|
||||||
if (key.equalsIgnoreCase("nome")) {
|
|
||||||
nome = theValue != null ? theValue : "";
|
|
||||||
} else if (key.equalsIgnoreCase("descrizione")) {
|
|
||||||
descrizione = theValue != null ? theValue : "";
|
|
||||||
} else if (key.equalsIgnoreCase("date_scavo")) {
|
|
||||||
date = theValue != null ? theValue : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GeoportalDataViewerConstants.print("0: "+nome);
|
// GeoportalDataViewerConstants.print("0: "+nome);
|
||||||
flex.setHTML(0, 0, new HTML(nome).toString());
|
// flex.setHTML(0, 0, new HTML(nome).toString());
|
||||||
try {
|
// try {
|
||||||
descrizione = StringUtil.ellipsize(descrizione, 100);
|
// descrizione = StringUtil.ellipsize(descrizione, 100);
|
||||||
GWT.log("reduced: " + descrizione);
|
// GWT.log("reduced: " + descrizione);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
GWT.log("error: " + e.getMessage());
|
// GWT.log("error: " + e.getMessage());
|
||||||
}
|
// }
|
||||||
// GeoportalDataViewerConstants.print("1: "+descrizione);
|
// // GeoportalDataViewerConstants.print("1: "+descrizione);
|
||||||
flex.setText(1, 0, descrizione);
|
// flex.setText(1, 0, descrizione);
|
||||||
// GeoportalDataViewerConstants.print("2: "+date);
|
// // GeoportalDataViewerConstants.print("2: "+date);
|
||||||
date = StringUtil.formatDate(date);
|
// date = StringUtil.formatDate(date);
|
||||||
flex.setHTML(2, 0, new HTML("<code>" + date + "</code>").toString());
|
// flex.setHTML(2, 0, new HTML("<code>" + date + "</code>").toString());
|
||||||
|
|
||||||
if (geoNaDataObject.getMapImages() != null) {
|
// if (geoNaDataObject.getMapImages() != null) {
|
||||||
for (String key : geoNaDataObject.getMapImages().keySet()) {
|
// for (String key : geoNaDataObject.getMapImages().keySet()) {
|
||||||
List<UploadedImageDV> listUI = geoNaDataObject.getMapImages()
|
// List<UploadedImageDV> listUI = geoNaDataObject.getMapImages()
|
||||||
.get(key);
|
// .get(key);
|
||||||
GWT.log("Adding images: " + listUI);
|
// GWT.log("Adding images: " + listUI);
|
||||||
if (listUI != null && listUI.size() > 0) {
|
// if (listUI != null && listUI.size() > 0) {
|
||||||
UploadedImageDV img = listUI.get(0);
|
// UploadedImageDV img = listUI.get(0);
|
||||||
if (img.getListWsContent() != null) {
|
// if (img.getListWsContent() != null) {
|
||||||
WorkspaceContentDV wsContent = img.getListWsContent()
|
// WorkspaceContentDV wsContent = img.getListWsContent()
|
||||||
.get(img.getListWsContent().size() - 1);
|
// .get(img.getListWsContent().size() - 1);
|
||||||
String theImgHTML = "<img src=\"" + wsContent.getLink()
|
// String theImgHTML = "<img src=\"" + wsContent.getLink()
|
||||||
+ "\"></img>";
|
// + "\"></img>";
|
||||||
GWT.log("theImgHTML: " + theImgHTML);
|
// GWT.log("theImgHTML: " + theImgHTML);
|
||||||
// GeoportalDataViewerConstants.print("The row are:
|
// // GeoportalDataViewerConstants.print("The row are:
|
||||||
// "+flex.getRowCount());
|
// // "+flex.getRowCount());
|
||||||
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
// flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
featureFound = true;
|
// featureFound = true;
|
||||||
// break; //Only the first one
|
// break; //Only the first one
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feature == null)
|
// if (feature == null)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
|
// GWT.log("The selected Feature is: " + feature);
|
||||||
|
// // GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
|
||||||
|
// FeatureRow theFeature = feature;
|
||||||
|
// Button button = null;
|
||||||
|
// if (!featureFound) {
|
||||||
|
// flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||||
|
// } else {
|
||||||
|
// button = new Button("Open Details");
|
||||||
|
// button.getElement().setId("open-details");
|
||||||
|
// button.setType(ButtonType.LINK);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// VerticalPanel vpPanel = new VerticalPanel();
|
||||||
|
// vpPanel.add(flex);
|
||||||
|
|
||||||
GWT.log("The selected Feature is: " + feature);
|
// if (button != null) {
|
||||||
// GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
|
// vpPanel.add(button);
|
||||||
FeatureRow theFeature = feature;
|
// button.setType(ButtonType.LINK);
|
||||||
Button button = null;
|
// button.addClickHandler(new ClickHandler() {
|
||||||
if (!featureFound) {
|
//
|
||||||
flex.setHTML(0, 0, new HTML("No data available").toString());
|
// @Override
|
||||||
} else {
|
// public void onClick(ClickEvent event) {
|
||||||
button = new Button("Open Details");
|
// ShowDetailsEvent toEvent = parseGeonaReferences(
|
||||||
button.getElement().setId("open-details");
|
// geoNaDataObject.getSourceLayerObject().getItemType(),
|
||||||
button.setType(ButtonType.LINK);
|
// theFeature);
|
||||||
}
|
// applicationBus.fireEvent(toEvent);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
VerticalPanel vpPanel = new VerticalPanel();
|
// Coordinate centerTo = null;
|
||||||
vpPanel.add(flex);
|
// GWT.log("geometry is: " + feature.getGeometry());
|
||||||
|
// if (feature.getGeometry() != null) {
|
||||||
if (button != null) {
|
// GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
|
||||||
vpPanel.add(button);
|
//
|
||||||
button.setType(ButtonType.LINK);
|
// Geometry geom = new GeoJson()
|
||||||
button.addClickHandler(new ClickHandler() {
|
// .readGeometry(feature.getGeometry().getToJSONObject(), null);
|
||||||
|
//
|
||||||
@Override
|
// // POINT
|
||||||
public void onClick(ClickEvent event) {
|
// if (geom.getType().equalsIgnoreCase("Point")) {
|
||||||
ShowDetailsEvent toEvent = parseGeonaReferences(
|
// GWT.log("geometry: is a point");
|
||||||
geoNaDataObject.getSourceLayerObject().getItemType(),
|
// String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
|
||||||
theFeature);
|
// JSONArray centerJSON = (JSONArray) JSONParser
|
||||||
applicationBus.fireEvent(toEvent);
|
// .parseStrict(coordinateJSON);
|
||||||
|
//// Coordinate center = OLFactory.createCoordinate(
|
||||||
}
|
//// new Double(centerJSON.get(0).toString()),
|
||||||
});
|
//// new Double(centerJSON.get(1).toString()));
|
||||||
}
|
//
|
||||||
|
// Coordinate center = new Coordinate(
|
||||||
Coordinate centerTo = null;
|
|
||||||
GWT.log("geometry is: " + feature.getGeometry());
|
|
||||||
if (feature.getGeometry() != null) {
|
|
||||||
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
|
|
||||||
|
|
||||||
Geometry geom = new GeoJson()
|
|
||||||
.readGeometry(feature.getGeometry().getToJSONObject(), null);
|
|
||||||
|
|
||||||
//POINT
|
|
||||||
if (geom.getType().equalsIgnoreCase("Point")) {
|
|
||||||
GWT.log("geometry: is a point");
|
|
||||||
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
|
|
||||||
JSONArray centerJSON = (JSONArray) JSONParser
|
|
||||||
.parseStrict(coordinateJSON);
|
|
||||||
// Coordinate center = OLFactory.createCoordinate(
|
|
||||||
// new Double(centerJSON.get(0).toString()),
|
// new Double(centerJSON.get(0).toString()),
|
||||||
// new Double(centerJSON.get(1).toString()));
|
// new Double(centerJSON.get(1).toString()));
|
||||||
|
//
|
||||||
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
|
// if (feature.getCrsName() != null && feature.getCrsName()
|
||||||
new Double(centerJSON.get(1).toString()));
|
// .endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||||
|
//
|
||||||
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
// center = MapUtils.transformCoordiante(center,
|
||||||
|
// MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
center = MapUtils.transformCoordiante(center,
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
MAP_PROJECTION.EPSG_4326.getName(),
|
// }
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
// centerTo = center;
|
||||||
}
|
// } else {
|
||||||
centerTo = center;
|
//
|
||||||
} else {
|
// Extent geomExtent = geom.getExtent();
|
||||||
|
//
|
||||||
Extent geomExtent = geom.getExtent();
|
// Coordinate lower = OLFactory.createCoordinate(
|
||||||
|
// geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
|
||||||
Coordinate lower = OLFactory.createCoordinate(
|
// Coordinate upper = OLFactory.createCoordinate(
|
||||||
geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
|
// geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
|
||||||
Coordinate upper = OLFactory.createCoordinate(
|
// Coordinate lowerCoord = lower;
|
||||||
geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
|
// Coordinate upperCoord = upper;
|
||||||
Coordinate lowerCoord = lower;
|
// if (feature.getCrsName() != null && feature.getCrsName()
|
||||||
Coordinate upperCoord = upper;
|
// .endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||||
if (feature.getCrsName() != null && feature.getCrsName()
|
//
|
||||||
.endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
// lowerCoord = MapUtils.transformCoordiante(lower,
|
||||||
|
// MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
lowerCoord = MapUtils.transformCoordiante(lower,
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
MAP_PROJECTION.EPSG_4326.getName(),
|
// upperCoord = MapUtils.transformCoordiante(upper,
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
// MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
upperCoord = MapUtils.transformCoordiante(upper,
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
MAP_PROJECTION.EPSG_4326.getName(),
|
// }
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
//
|
||||||
}
|
// ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(),
|
||||||
|
// lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
|
||||||
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(),
|
//
|
||||||
lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
|
// centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
|
||||||
|
//
|
||||||
centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
|
|
||||||
|
|
||||||
}
|
|
||||||
GWT.log("center is: "+centerTo);
|
|
||||||
// PointsPath path = feature.getGeometry().getPath();
|
|
||||||
// GWT.log("Points Path: " + path);
|
|
||||||
// if (path != null && path.getCoordinates() != null
|
|
||||||
// && path.getCoordinates().length > 0) {
|
|
||||||
// org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.Coordinate center = path
|
|
||||||
// .getCoordinates()[0];
|
|
||||||
// centerTo = new Coordinate(center.getX(), center.getY());
|
|
||||||
// }
|
// }
|
||||||
}
|
// GWT.log("center is: " + centerTo);
|
||||||
|
// }
|
||||||
|
|
||||||
// fallback
|
// // fallback
|
||||||
if (centerTo == null)
|
// if (centerTo == null)
|
||||||
centerTo = queryEvent.getOnFailureCenterTo();
|
// centerTo = queryEvent.getOnFailureCenterTo();
|
||||||
|
//
|
||||||
olMap.showPopup(vpPanel.toString(), centerTo);
|
// olMap.showPopup(vpPanel.toString(), centerTo);
|
||||||
|
//
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void execute() {
|
// public void execute() {
|
||||||
Element buttonElement = DOM.getElementById("open-details");
|
// Element buttonElement = DOM.getElementById("open-details");
|
||||||
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
// Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||||
Event.setEventListener(buttonElement, new EventListener() {
|
// Event.setEventListener(buttonElement, new EventListener() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onBrowserEvent(Event event) {
|
// public void onBrowserEvent(Event event) {
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
// if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
ShowDetailsEvent toEvent = parseGeonaReferences(
|
// ShowDetailsEvent toEvent = parseGeonaReferences(
|
||||||
geoNaDataObject.getSourceLayerObject()
|
// geoNaDataObject.getSourceLayerObject()
|
||||||
.getItemType(),
|
// .getItemType(),
|
||||||
theFeature);
|
// theFeature);
|
||||||
applicationBus.fireEvent(toEvent);
|
// applicationBus.fireEvent(toEvent);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -663,6 +655,179 @@ public class LayerManager {
|
||||||
return layerItem;
|
return layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show popup info for centroid layer.
|
||||||
|
*
|
||||||
|
* @param geoNaDataObject the geo na data object
|
||||||
|
* @param feature the feature
|
||||||
|
* @param onFailureCenterTo the on failure center to
|
||||||
|
*/
|
||||||
|
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
||||||
|
Coordinate onFailureCenterTo) {
|
||||||
|
|
||||||
|
FlexTable flex = new FlexTable();
|
||||||
|
flex.setCellPadding(1);
|
||||||
|
flex.setCellSpacing(1);
|
||||||
|
flex.getElement().addClassName("popup-table");
|
||||||
|
VerticalPanel vpPanel = new VerticalPanel();
|
||||||
|
vpPanel.add(flex);
|
||||||
|
|
||||||
|
if (feature == null) {
|
||||||
|
olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||||
|
flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Showing properties belonging to concessioni centroid layer
|
||||||
|
Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
|
||||||
|
String nome = "";
|
||||||
|
String descrizione = "";
|
||||||
|
String date = "";
|
||||||
|
|
||||||
|
for (String key : entries.keySet()) {
|
||||||
|
String theValue = entries.get(key).get(0);
|
||||||
|
if (key.equalsIgnoreCase("nome")) {
|
||||||
|
nome = theValue != null ? theValue : "";
|
||||||
|
} else if (key.equalsIgnoreCase("descrizione")) {
|
||||||
|
descrizione = theValue != null ? theValue : "";
|
||||||
|
} else if (key.equalsIgnoreCase("date_scavo")) {
|
||||||
|
date = theValue != null ? theValue : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GeoportalDataViewerConstants.print("0: "+nome);
|
||||||
|
flex.setHTML(0, 0, new HTML(nome).toString());
|
||||||
|
try {
|
||||||
|
descrizione = StringUtil.ellipsize(descrizione, 100);
|
||||||
|
GWT.log("reduced: " + descrizione);
|
||||||
|
} catch (Exception e) {
|
||||||
|
GWT.log("error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
// GeoportalDataViewerConstants.print("1: "+descrizione);
|
||||||
|
flex.setText(1, 0, descrizione);
|
||||||
|
// GeoportalDataViewerConstants.print("2: "+date);
|
||||||
|
date = StringUtil.formatDate(date);
|
||||||
|
flex.setHTML(2, 0, new HTML("<code>" + date + "</code>").toString());
|
||||||
|
|
||||||
|
if (geoNaDataObject.getMapImages() != null) {
|
||||||
|
for (String key : geoNaDataObject.getMapImages().keySet()) {
|
||||||
|
List<UploadedImageDV> listUI = geoNaDataObject.getMapImages().get(key);
|
||||||
|
GWT.log("Adding images: " + listUI);
|
||||||
|
if (listUI != null && listUI.size() > 0) {
|
||||||
|
UploadedImageDV img = listUI.get(0);
|
||||||
|
if (img.getListWsContent() != null) {
|
||||||
|
WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size() - 1);
|
||||||
|
String theImgHTML = "<img src=\"" + wsContent.getLink() + "\"></img>";
|
||||||
|
GWT.log("theImgHTML: " + theImgHTML);
|
||||||
|
// GeoportalDataViewerConstants.print("The row are:
|
||||||
|
// "+flex.getRowCount());
|
||||||
|
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log("The selected Feature is: " + feature);
|
||||||
|
// GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
|
||||||
|
FeatureRow theFeature = feature;
|
||||||
|
Button button = new Button("Open Details");
|
||||||
|
button.getElement().setId("open-details");
|
||||||
|
button.setType(ButtonType.LINK);
|
||||||
|
|
||||||
|
if (button != null) {
|
||||||
|
vpPanel.add(button);
|
||||||
|
button.setType(ButtonType.LINK);
|
||||||
|
button.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
ShowDetailsEvent toEvent = parseGeonaReferences(
|
||||||
|
geoNaDataObject.getSourceLayerObject().getItemType(), theFeature);
|
||||||
|
applicationBus.fireEvent(toEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinate centerTo = null;
|
||||||
|
GWT.log("geometry is: " + feature.getGeometry());
|
||||||
|
if (feature.getGeometry() != null) {
|
||||||
|
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
|
||||||
|
|
||||||
|
Geometry geom = new GeoJson().readGeometry(feature.getGeometry().getToJSONObject(), null);
|
||||||
|
|
||||||
|
// POINT
|
||||||
|
if (geom.getType().equalsIgnoreCase("Point")) {
|
||||||
|
GWT.log("geometry: is a point");
|
||||||
|
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
|
||||||
|
JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON);
|
||||||
|
// Coordinate center = OLFactory.createCoordinate(
|
||||||
|
// new Double(centerJSON.get(0).toString()),
|
||||||
|
// new Double(centerJSON.get(1).toString()));
|
||||||
|
|
||||||
|
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
|
||||||
|
new Double(centerJSON.get(1).toString()));
|
||||||
|
|
||||||
|
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||||
|
|
||||||
|
center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
}
|
||||||
|
centerTo = center;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Extent geomExtent = geom.getExtent();
|
||||||
|
|
||||||
|
Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
|
||||||
|
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
|
||||||
|
Coordinate lowerCoord = lower;
|
||||||
|
Coordinate upperCoord = upper;
|
||||||
|
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||||
|
|
||||||
|
lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
|
||||||
|
upperCoord.getY());
|
||||||
|
|
||||||
|
centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
|
||||||
|
|
||||||
|
}
|
||||||
|
GWT.log("center is: " + centerTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fallback
|
||||||
|
if (centerTo == null)
|
||||||
|
centerTo = onFailureCenterTo;
|
||||||
|
|
||||||
|
olMap.showPopup(vpPanel.toString(), centerTo);
|
||||||
|
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Element buttonElement = DOM.getElementById("open-details");
|
||||||
|
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||||
|
Event.setEventListener(buttonElement, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Event event) {
|
||||||
|
if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
|
ShowDetailsEvent toEvent = parseGeonaReferences(
|
||||||
|
geoNaDataObject.getSourceLayerObject().getItemType(), theFeature);
|
||||||
|
applicationBus.fireEvent(toEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is layer visible.
|
* Checks if is layer visible.
|
||||||
*
|
*
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
Location earthLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.EARTH);
|
Location earthLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.WORLD);
|
||||||
applicationBus.fireEvent(new MapExtentToEvent(earthLocation));
|
applicationBus.fireEvent(new MapExtentToEvent(earthLocation));
|
||||||
map.setCenter(earthLocation.getCoordinate(MAP_PROJECTION.EPSG_3857));
|
map.setCenter(earthLocation.getCoordinate(MAP_PROJECTION.EPSG_3857));
|
||||||
map.setZoom(earthLocation.getZoomLevel());
|
map.setZoom(earthLocation.getZoomLevel());
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class ExtentMapUtil {
|
||||||
* Sep 1, 2021
|
* Sep 1, 2021
|
||||||
*/
|
*/
|
||||||
public static enum PLACE {
|
public static enum PLACE {
|
||||||
ITALY, EARTH
|
ITALY, WORLD
|
||||||
}
|
}
|
||||||
|
|
||||||
final static Map<PLACE, Location> mapExtent = new HashMap<PLACE, Location>();
|
final static Map<PLACE, Location> mapExtent = new HashMap<PLACE, Location>();
|
||||||
|
@ -39,13 +39,13 @@ public class ExtentMapUtil {
|
||||||
GeoportalDataViewerConstants.ITALY_CENTER_LAT, MAP_PROJECTION.EPSG_4326,
|
GeoportalDataViewerConstants.ITALY_CENTER_LAT, MAP_PROJECTION.EPSG_4326,
|
||||||
GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON);
|
GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON);
|
||||||
|
|
||||||
// EPSG_4326 EARTH LOCATION
|
// EPSG_4326 WORLD LOCATION
|
||||||
Location earth = new Location(PLACE.EARTH.name(), 0,
|
Location earth = new Location(PLACE.WORLD.name(), 0,
|
||||||
0, MAP_PROJECTION.EPSG_4326,
|
0, MAP_PROJECTION.EPSG_4326,
|
||||||
2);
|
2);
|
||||||
|
|
||||||
mapExtent.put(PLACE.ITALY, ita);
|
mapExtent.put(PLACE.ITALY, ita);
|
||||||
mapExtent.put(PLACE.EARTH, earth);
|
mapExtent.put(PLACE.WORLD, earth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LayerConcessioneView extends Composite {
|
||||||
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
|
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
|
||||||
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
|
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
|
||||||
Style exportStyle = exportMapButton.getElement().getStyle();
|
Style exportStyle = exportMapButton.getElement().getStyle();
|
||||||
exportStyle.setWidth(100, Unit.PCT);
|
//exportStyle.setWidth(100, Unit.PCT);
|
||||||
exportStyle.setMarginLeft(70, Unit.PCT);
|
exportStyle.setMarginLeft(70, Unit.PCT);
|
||||||
|
|
||||||
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
|
Loading…
Reference in New Issue