Removed old concessione. Added "Add layers to Map" facility
This commit is contained in:
parent
62dc1bad6c
commit
8298b2f93e
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,6 +103,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,6 +131,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,6 +159,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,6 +167,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,6 +218,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,6 +246,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,6 +273,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.Relationsh
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
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.AddLayerToMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEventHandler;
|
||||||
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.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
|
@ -237,7 +239,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null, true));
|
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO LOAD INITIAL LAYERS
|
mainPanel.openCollectionMenu();
|
||||||
|
|
||||||
GWT.log("DONE INIT LOAD");
|
GWT.log("DONE INIT LOAD");
|
||||||
|
|
||||||
|
@ -257,26 +259,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
|
|
||||||
// new Timer() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// GWT.log("Instancing timeline");
|
|
||||||
// ProjectDV project = new ProjectDV();
|
|
||||||
// project.setId("fake");
|
|
||||||
// project.setProfileID("fake");
|
|
||||||
// applicationBus.fireEvent(new TimelineProjectRelationsEvent(project, EVENT_TYPE.SHOW));
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }.schedule(1000);
|
|
||||||
|
|
||||||
// Modal modal = new Modal(true, true);
|
|
||||||
// modal.setWidth(400);
|
|
||||||
//
|
|
||||||
// modal.add(timeline);
|
|
||||||
// modal.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ViewerStatus getStatus() {
|
public static ViewerStatus getStatus() {
|
||||||
|
@ -363,6 +345,19 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(AddLayerToMapEvent.TYPE, new AddLayerToMapEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddingLayerForProject(AddLayerToMapEvent addLayerToMapEvent) {
|
||||||
|
|
||||||
|
if (addLayerToMapEvent.getTheProjectDV() != null) {
|
||||||
|
layerManager.addLayerToMapForProject(addLayerToMapEvent.getTheProjectDV().getProfileID(),
|
||||||
|
addLayerToMapEvent.getTheProjectDV().getId(), addLayerToMapEvent.getTheProjectDV());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -397,8 +392,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
List<RelationshipDV> relationships = result.getTheProjectDV().getRelationships();
|
List<RelationshipDV> relationships = result.getTheProjectDV().getRelationships();
|
||||||
|
|
||||||
if (showDetailsEvent.isLoadTimelineRelationships()
|
if (showDetailsEvent.isLoadTimelineRelationships() && relationships != null
|
||||||
&& relationships!= null && relationships.size() > 0) {
|
&& relationships.size() > 0) {
|
||||||
GWT.log("LoadTimelineRelationships is true and the project has Relationships");
|
GWT.log("LoadTimelineRelationships is true and the project has Relationships");
|
||||||
timelineMS.showTimelineProjectRelations(result.getTheProjectDV());
|
timelineMS.showTimelineProjectRelations(result.getTheProjectDV());
|
||||||
}
|
}
|
||||||
|
@ -422,9 +417,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
attempt = 0;
|
attempt = 0;
|
||||||
|
|
||||||
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before calling the WFS
|
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before
|
||||||
|
// calling the WFS
|
||||||
|
|
||||||
//forcing once at init time
|
// forcing once at init time
|
||||||
initApplication = false;
|
initApplication = false;
|
||||||
|
|
||||||
final int MAX_RETRY = 15;
|
final int MAX_RETRY = 15;
|
||||||
|
@ -674,8 +670,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
//
|
//
|
||||||
// }-*/;
|
// }-*/;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||||
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||||
if (projectID != null) {
|
if (projectID != null) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
|
||||||
|
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +110,6 @@ public class GeoportalDataViewerConstants {
|
||||||
return JSON.stringify(object);
|
return JSON.stringify(object);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Json to HTML.
|
* Json to HTML.
|
||||||
*
|
*
|
||||||
|
@ -176,4 +176,8 @@ public class GeoportalDataViewerConstants {
|
||||||
|
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
public static native void clickElement(Element elem) /*-{
|
||||||
|
elem.click();
|
||||||
|
}-*/;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,42 +316,10 @@ public class LayerManager {
|
||||||
// level
|
// level
|
||||||
// is >
|
// is >
|
||||||
// QUERY_MIN_ZOOM_LEVEL
|
// QUERY_MIN_ZOOM_LEVEL
|
||||||
|
final String theProfileID = geoNaDataObject.getSourceLayerObject().getProfileID();
|
||||||
final String theProfileID = geoNaDataObject.getSourceLayerObject()
|
addLayerToMapForProject(theProfileID, theProductID, geoNaDataObject.getSourceLayerObject()
|
||||||
.getProfileID();
|
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
|
||||||
theProfileID, theProductID,
|
|
||||||
new AsyncCallback<List<GCubeSDIViewerLayerDV>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(
|
|
||||||
List<GCubeSDIViewerLayerDV> result) {
|
|
||||||
|
|
||||||
for (GCubeSDIViewerLayerDV layer : result) {
|
|
||||||
GWT.log("Adding layer: "
|
|
||||||
+ layer.getLayerName());
|
|
||||||
addLayer(LayerObjectType.PROJECT_LAYER,
|
|
||||||
layer.getLayerName(),
|
|
||||||
layer.getLayerName(),
|
|
||||||
layer.getWMSLink(), false, false, null,
|
|
||||||
true,
|
|
||||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
|
||||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
|
||||||
theProfileID, theProductID,
|
|
||||||
geoNaDataObject.getSourceLayerObject()
|
|
||||||
.getProjectDV());
|
.getProjectDV());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// removing all WMS detail layers if the ZOOM level is <
|
// removing all WMS detail layers if the ZOOM level is <
|
||||||
// QUERY_MIN_ZOOM_LEVEL
|
// QUERY_MIN_ZOOM_LEVEL
|
||||||
|
@ -386,6 +354,41 @@ public class LayerManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addLayerToMapForProject(String theProfileID, String theProductID, ProjectDV theProjectDV) {
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||||
|
theProfileID, theProductID,
|
||||||
|
new AsyncCallback<List<GCubeSDIViewerLayerDV>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(
|
||||||
|
List<GCubeSDIViewerLayerDV> result) {
|
||||||
|
|
||||||
|
for (GCubeSDIViewerLayerDV layer : result) {
|
||||||
|
GWT.log("Adding layer: "
|
||||||
|
+ layer.getLayerName());
|
||||||
|
addLayer(LayerObjectType.PROJECT_LAYER,
|
||||||
|
layer.getLayerName(),
|
||||||
|
layer.getLayerName(),
|
||||||
|
layer.getWMSLink(), false, false, null,
|
||||||
|
true,
|
||||||
|
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||||
|
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||||
|
theProfileID, theProductID,
|
||||||
|
theProjectDV);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the all detail layers.
|
* Removes the all detail layers.
|
||||||
*/
|
*/
|
||||||
|
@ -468,7 +471,7 @@ public class LayerManager {
|
||||||
* @param projectID the project ID
|
* @param projectID the project ID
|
||||||
* @param projectDV the project DV
|
* @param projectDV the project DV
|
||||||
*/
|
*/
|
||||||
public void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
||||||
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
||||||
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
|
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
|
||||||
final String projectID, final ProjectDV projectDV) {
|
final String projectID, final ProjectDV projectDV) {
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AddedLayerToMapEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 18, 2020
|
||||||
|
*/
|
||||||
|
public class AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
|
||||||
|
public static Type<AddLayerToMapEventHandler> TYPE = new Type<AddLayerToMapEventHandler>();
|
||||||
|
private ProjectDV theProjectDV;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new adds the layer to map event.
|
||||||
|
*
|
||||||
|
* @param theProjectDV the the project DV
|
||||||
|
*/
|
||||||
|
public AddLayerToMapEvent(ProjectDV theProjectDV) {
|
||||||
|
this.theProjectDV = theProjectDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<AddLayerToMapEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(AddLayerToMapEventHandler handler) {
|
||||||
|
handler.onAddingLayerForProject(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectDV getTheProjectDV() {
|
||||||
|
return theProjectDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface AddLayerToMapEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 9, 2022
|
||||||
|
*/
|
||||||
|
public interface AddLayerToMapEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On adding layer for project.
|
||||||
|
*
|
||||||
|
* @param addLayerToMapEvent the add layer to map event
|
||||||
|
*/
|
||||||
|
void onAddingLayerForProject(AddLayerToMapEvent addLayerToMapEvent);
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
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.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
|
@ -138,7 +139,6 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
|
||||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
|
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
|
||||||
List<ItemFieldsResponse> itemFieldsReponse) {
|
List<ItemFieldsResponse> itemFieldsReponse) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
@ -193,19 +193,19 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
final UseCaseDescriptorDV ucd = ifResponse.getUseCaseDescriptorDV();
|
final UseCaseDescriptorDV ucd = ifResponse.getUseCaseDescriptorDV();
|
||||||
NavLink navLink = new NavLink(ifResponse.getUseCaseDescriptorDV().getName());
|
NavLink navLink = new NavLink(ifResponse.getUseCaseDescriptorDV().getName());
|
||||||
//navLink.setText(ucd.getName());
|
// navLink.setText(ucd.getName());
|
||||||
navLink.addClickHandler(new ClickHandler() {
|
navLink.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
private SearchFacilityUI currentSearchFacility;
|
private SearchFacilityUI currentSearchFacility;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
if(this.currentSearchFacility!=null)
|
if (this.currentSearchFacility != null)
|
||||||
this.currentSearchFacility.resetCurrentSearch();
|
this.currentSearchFacility.resetCurrentSearch();
|
||||||
|
|
||||||
searchFacilityPanel.clear();
|
searchFacilityPanel.clear();
|
||||||
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, displayFields, sortByFields, searchByFields,
|
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, displayFields,
|
||||||
initialSortFilter);
|
sortByFields, searchByFields, initialSortFilter);
|
||||||
searchFacilityPanel.add(currentSearchFacility);
|
searchFacilityPanel.add(currentSearchFacility);
|
||||||
currentSearchFacility.setSearchButton(searchFacilityButton);
|
currentSearchFacility.setSearchButton(searchFacilityButton);
|
||||||
}
|
}
|
||||||
|
@ -480,31 +480,31 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
public void setAvailableCollections(Collection<GCubeCollection> collection) {
|
public void setAvailableCollections(Collection<GCubeCollection> collection) {
|
||||||
GWT.log("Init Available collections menu");
|
GWT.log("Init Available collections menu");
|
||||||
if(collection == null || collection.isEmpty())
|
if (collection == null || collection.isEmpty())
|
||||||
GWT.log("!!! No Available collections");
|
GWT.log("!!! No Available collections");
|
||||||
|
|
||||||
|
for (GCubeCollection coll : collection) {
|
||||||
for(GCubeCollection coll : collection) {
|
GWT.log("Found available collection " + coll);
|
||||||
GWT.log("Found available collection "+coll);
|
|
||||||
String label = coll.getUcd().getName();
|
String label = coll.getUcd().getName();
|
||||||
String id=coll.getUcd().getId();
|
String id = coll.getUcd().getId();
|
||||||
|
|
||||||
CheckBox checkbox = new CheckBox(label);
|
CheckBox checkbox = new CheckBox(label);
|
||||||
checkbox.setId("gcubeCollectionSelector_"+id);
|
checkbox.setId("gcubeCollectionSelector_" + id);
|
||||||
|
|
||||||
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
GWT.log("Collection selector flag changed to value : "+event.toDebugString());
|
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
|
||||||
|
|
||||||
String collectionID = ((CheckBox)event.getSource()).getId().replace("gcubeCollectionSelector_", "");
|
String collectionID = ((CheckBox) event.getSource()).getId().replace("gcubeCollectionSelector_",
|
||||||
|
"");
|
||||||
|
|
||||||
GWT.log("Collection ID is : "+collectionID + ", event value: "+event.getValue());
|
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
|
||||||
if(event.getValue()) {
|
if (event.getValue()) {
|
||||||
// OPEN COLLECTION
|
// OPEN COLLECTION
|
||||||
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||||
}else {
|
} else {
|
||||||
// CLOSE COLLECTION
|
// CLOSE COLLECTION
|
||||||
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||||
}
|
}
|
||||||
|
@ -514,18 +514,21 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
openCollectionPanel.add(checkbox);
|
openCollectionPanel.add(checkbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Open the first collection as default
|
// Open the first collection as default
|
||||||
if(collection!=null && collection.size()>0) {
|
if (collection != null && collection.size() > 0) {
|
||||||
CheckBox checkbox = (CheckBox) openCollectionPanel.getWidget(0);
|
CheckBox checkbox = (CheckBox) openCollectionPanel.getWidget(0);
|
||||||
checkbox.setValue(true, true);
|
checkbox.setValue(true, true);
|
||||||
String collectionID = checkbox.getId().replace("gcubeCollectionSelector_", "");
|
String collectionID = checkbox.getId().replace("gcubeCollectionSelector_", "");
|
||||||
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openCollectionMenu() {
|
||||||
|
|
||||||
|
GWT.log("openCollectionMenu");
|
||||||
|
GeoportalDataViewerConstants.clickElement(openCollectionDropDown.getElement().getFirstChildElement());
|
||||||
|
}
|
||||||
|
|
||||||
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
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.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.events.AddLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
@ -39,10 +40,24 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ProjectViewer.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 9, 2022
|
||||||
|
*/
|
||||||
public class ProjectViewer extends Composite {
|
public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
|
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface ProjectViewerUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 9, 2022
|
||||||
|
*/
|
||||||
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
|
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +79,9 @@ public class ProjectViewer extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Button relationshipsButton;
|
Button relationshipsButton;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button addLayersToMap;
|
||||||
|
|
||||||
private ProjectView theProjectView;
|
private ProjectView theProjectView;
|
||||||
|
|
||||||
private CustomFlexTable customTable = new CustomFlexTable();
|
private CustomFlexTable customTable = new CustomFlexTable();
|
||||||
|
@ -72,30 +90,29 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
private String myLogin;
|
private String myLogin;
|
||||||
|
|
||||||
private boolean viewImageButtonVisible = true;
|
|
||||||
|
|
||||||
private boolean openImageButtonVisible = true;
|
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new project viewer.
|
||||||
|
*/
|
||||||
private ProjectViewer() {
|
private ProjectViewer() {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
pageViewDetails.getElement().setId("page-view-details");
|
pageViewDetails.getElement().setId("page-view-details");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new project viewer.
|
||||||
|
*
|
||||||
|
* @param applicationBus the application bus
|
||||||
|
* @param geoportalItemRefs the geoportal item refs
|
||||||
|
* @param projectView the project view
|
||||||
|
*/
|
||||||
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
|
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
|
||||||
ProjectView projectView) {
|
final ProjectView projectView) {
|
||||||
this(applicationBus, geoportalItemRefs, projectView, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
|
|
||||||
final ProjectView projectView, boolean viewImageButtonVisible, boolean openImageButtonVisible) {
|
|
||||||
this();
|
this();
|
||||||
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
||||||
this.theProjectView = projectView;
|
this.theProjectView = projectView;
|
||||||
this.geoportalItemReferences = geoportalItemRefs;
|
this.geoportalItemReferences = geoportalItemRefs;
|
||||||
this.viewImageButtonVisible = viewImageButtonVisible;
|
|
||||||
this.openImageButtonVisible = openImageButtonVisible;
|
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
|
|
||||||
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
||||||
|
@ -126,10 +143,10 @@ public class ProjectViewer extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView, false,
|
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView);
|
||||||
openImageButtonVisible);
|
|
||||||
cv.setExpandViewButtonVisible(false);
|
cv.setExpandViewButtonVisible(false);
|
||||||
cv.setRelationshipsButtonVisible(false);
|
cv.setRelationshipsButtonVisible(false);
|
||||||
|
cv.setAddLayersToMapVisible(false);
|
||||||
int width = Window.getClientWidth() * 75 / 100;
|
int width = Window.getClientWidth() * 75 / 100;
|
||||||
int height = Window.getClientHeight() * 70 / 100;
|
int height = Window.getClientHeight() * 70 / 100;
|
||||||
ModalWindow mw = new ModalWindow(theTitle, width, height);
|
ModalWindow mw = new ModalWindow(theTitle, width, height);
|
||||||
|
@ -162,6 +179,18 @@ public class ProjectViewer extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addLayersToMap.setType(ButtonType.LINK);
|
||||||
|
addLayersToMap.setIcon(IconType.MAP_MARKER);
|
||||||
|
addLayersToMap.setTitle("Add the layer/s of the Project to principal Map");
|
||||||
|
|
||||||
|
addLayersToMap.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,6 +213,9 @@ public class ProjectViewer extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the centroid map.
|
||||||
|
*/
|
||||||
private void addCentroidMap() {
|
private void addCentroidMap() {
|
||||||
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
|
@ -210,14 +242,38 @@ public class ProjectViewer extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the project view.
|
||||||
|
*
|
||||||
|
* @return the project view
|
||||||
|
*/
|
||||||
public ProjectView getProjectView() {
|
public ProjectView getProjectView() {
|
||||||
return theProjectView;
|
return theProjectView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the expand view button visible.
|
||||||
|
*
|
||||||
|
* @param bool the new expand view button visible
|
||||||
|
*/
|
||||||
protected void setExpandViewButtonVisible(boolean bool) {
|
protected void setExpandViewButtonVisible(boolean bool) {
|
||||||
expandButton.setVisible(bool);
|
expandButton.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the adds the layers to map visible.
|
||||||
|
*
|
||||||
|
* @param bool the new adds the layers to map visible
|
||||||
|
*/
|
||||||
|
protected void setAddLayersToMapVisible(boolean bool) {
|
||||||
|
addLayersToMap.setVisible(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the relationships button visible.
|
||||||
|
*
|
||||||
|
* @param bool the new relationships button visible
|
||||||
|
*/
|
||||||
protected void setRelationshipsButtonVisible(boolean bool) {
|
protected void setRelationshipsButtonVisible(boolean bool) {
|
||||||
relationshipsButton.setVisible(bool);
|
relationshipsButton.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.the-title {
|
.the-title {
|
||||||
background-color: rgba(0,60,136,.7);
|
background-color: rgba(0, 60, 136, .7);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.margin-bottom-10 {
|
.functionalities-style {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background-color: white;
|
||||||
|
opacity: 0.9;
|
||||||
|
border-radius: 5px;
|
||||||
|
z-index: 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.width-100 {
|
.width-100 {
|
||||||
|
@ -40,11 +46,11 @@
|
||||||
<g:HTMLPanel ui:field="headerPanel"
|
<g:HTMLPanel ui:field="headerPanel"
|
||||||
addStyleNames="{style.the-title}"></g:HTMLPanel>
|
addStyleNames="{style.the-title}"></g:HTMLPanel>
|
||||||
<g:HTMLPanel ui:field="pageViewDetails">
|
<g:HTMLPanel ui:field="pageViewDetails">
|
||||||
<g:HorizontalPanel
|
<g:HorizontalPanel addStyleNames="{style.functionalities-style}">
|
||||||
addStyleNames="{style.margin-bottom-10}">
|
|
||||||
<b:Button ui:field="shareButton">Share</b:Button>
|
<b:Button ui:field="shareButton">Share</b:Button>
|
||||||
<b:Button ui:field="expandButton">Expand</b:Button>
|
<b:Button ui:field="expandButton">Expand</b:Button>
|
||||||
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
|
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
|
||||||
|
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
|
||||||
</g:HorizontalPanel>
|
</g:HorizontalPanel>
|
||||||
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
|
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -1,333 +0,0 @@
|
||||||
//package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
|
||||||
//
|
|
||||||
//import java.util.ArrayList;
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
|
||||||
//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.MAP_PROJECTION;
|
|
||||||
//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.ModalWindow;
|
|
||||||
//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.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.util.CustomFlexTable;
|
|
||||||
//
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Button;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.PageHeader;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Paragraph;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Thumbnails;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
||||||
//import com.google.gwt.core.client.GWT;
|
|
||||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
//import com.google.gwt.uibinder.client.UiBinder;
|
|
||||||
//import com.google.gwt.uibinder.client.UiField;
|
|
||||||
//import com.google.gwt.user.client.Window;
|
|
||||||
//import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
//import com.google.gwt.user.client.ui.Composite;
|
|
||||||
//import com.google.gwt.user.client.ui.HTMLPanel;
|
|
||||||
//import com.google.gwt.user.client.ui.Widget;
|
|
||||||
//
|
|
||||||
//import ol.Coordinate;
|
|
||||||
//
|
|
||||||
//public class ConcessioneView extends Composite {
|
|
||||||
//
|
|
||||||
// private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
|
||||||
//
|
|
||||||
// interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// PageHeader titolo;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// Paragraph introduzione;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel concessioniPanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel relazioneScavoPanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel imagesPanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel pageViewDetails;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel mapViewPanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel posizionamentoAreaIndaginePanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel piantaFineScavoPanel;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// Button shareButton;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// Button expandButton;
|
|
||||||
//
|
|
||||||
// private ConcessioneDV concessioneDV;
|
|
||||||
//
|
|
||||||
// private Thumbnails thumbNails = new Thumbnails();
|
|
||||||
//
|
|
||||||
// private CustomFlexTable customTable = new CustomFlexTable();
|
|
||||||
//
|
|
||||||
// private GeoportalItemReferences geonaItemRef;
|
|
||||||
//
|
|
||||||
// private String myLogin;
|
|
||||||
//
|
|
||||||
// private boolean viewImageButtonVisible = true;
|
|
||||||
//
|
|
||||||
// private boolean openImageButtonVisible = true;
|
|
||||||
//
|
|
||||||
// private ConcessioneView() {
|
|
||||||
// initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
// pageViewDetails.getElement().setId("page-view-details");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ConcessioneView(GeoportalItemReferences item, ConcessioneDV concDV) {
|
|
||||||
// this(item, concDV, true, true);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ConcessioneView(GeoportalItemReferences item, ConcessioneDV concDV, boolean viewImageButtonVisible,
|
|
||||||
// boolean openImageButtonVisible) {
|
|
||||||
// this();
|
|
||||||
// GWT.log("Rendering " + concDV.getNome());
|
|
||||||
// this.concessioneDV = concDV;
|
|
||||||
// this.geonaItemRef = item;
|
|
||||||
// this.viewImageButtonVisible = viewImageButtonVisible;
|
|
||||||
// this.openImageButtonVisible = openImageButtonVisible;
|
|
||||||
//
|
|
||||||
// titolo.setText(concessioneDV.getNome());
|
|
||||||
// introduzione.setText(concessioneDV.getIntroduzione());
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getDataInizioProgetto() != null) {
|
|
||||||
// customTable.addNextKeyValue("Data Inizio Progetto",
|
|
||||||
// GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getDataFineProgetto() != null) {
|
|
||||||
// customTable.addNextKeyValue("Data Fine Progetto",
|
|
||||||
// GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getParoleChiaveLibere() != null) {
|
|
||||||
// customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getParoleChiaveICCD() != null) {
|
|
||||||
// customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getAuthors() != null) {
|
|
||||||
// customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getContributore() != null) {
|
|
||||||
// customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getEditore() != null) {
|
|
||||||
// customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getResponsabile() != null) {
|
|
||||||
// customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getRisorseCorrelate() != null) {
|
|
||||||
// customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getTitolari() != null) {
|
|
||||||
// customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getSoggetto() != null) {
|
|
||||||
// customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getEditore() != null) {
|
|
||||||
// customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getFontiFinanziamento() != null) {
|
|
||||||
// customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getLicenzaID() != null) {
|
|
||||||
// customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getTitolariLicenza() != null) {
|
|
||||||
// customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (concessioneDV.getTitolariCopyright() != null) {
|
|
||||||
// customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),
|
|
||||||
// GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// shareButton.setType(ButtonType.LINK);
|
|
||||||
// shareButton.setIcon(IconType.SHARE);
|
|
||||||
// shareButton.setTitle("Get a link to share with...");
|
|
||||||
//
|
|
||||||
// shareButton.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// expandButton.setType(ButtonType.LINK);
|
|
||||||
// expandButton.setIcon(IconType.EXPAND);
|
|
||||||
// expandButton.setTitle("Show this view in new Window");
|
|
||||||
//
|
|
||||||
// expandButton.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
//
|
|
||||||
// ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible);
|
|
||||||
// cv.setExpandViewButtonVisible(false);
|
|
||||||
// int width = Window.getClientWidth() * 75 / 100;
|
|
||||||
// int height = Window.getClientHeight() * 70 / 100;
|
|
||||||
// ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
|
|
||||||
// mw.add(cv);
|
|
||||||
// mw.setCaller(ConcessioneView.this);
|
|
||||||
// // mw.setWidth(900);
|
|
||||||
// mw.show();
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// concessioniPanel.add(customTable);
|
|
||||||
//
|
|
||||||
// GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(String result) {
|
|
||||||
// myLogin = result;
|
|
||||||
// addCentroidMap();
|
|
||||||
// addRelazioneDiScavo();
|
|
||||||
// addPosizionamentoAreaIndagine();
|
|
||||||
// addPiantaFineScavo();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// addUploadedImages();
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void addPosizionamentoAreaIndagine() {
|
|
||||||
//
|
|
||||||
// LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
|
|
||||||
// if (layer == null)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// posizionamentoAreaIndaginePanel.setVisible(true);
|
|
||||||
// posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void addPiantaFineScavo() {
|
|
||||||
//
|
|
||||||
// List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
|
|
||||||
//
|
|
||||||
// if (listLayersDV == null)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// for (LayerConcessioneDV layerDV : listLayersDV) {
|
|
||||||
// piantaFineScavoPanel.setVisible(true);
|
|
||||||
// piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void addRelazioneDiScavo() {
|
|
||||||
//
|
|
||||||
// AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo();
|
|
||||||
// RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
|
|
||||||
// if (abstractRS == null && relazioneScavo==null)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// relazioneScavoPanel.setVisible(true);
|
|
||||||
// relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void addCentroidMap() {
|
|
||||||
// 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");
|
|
||||||
//
|
|
||||||
// if (concessioneDV != null && concessioneDV.getCentroidLat() != null
|
|
||||||
// && concessioneDV.getCentroidLong() != null) {
|
|
||||||
// Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
|
||||||
// Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
|
|
||||||
// MAP_PROJECTION.EPSG_3857.getName());
|
|
||||||
// // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
|
||||||
// boolean authenticatedUser = myLogin != null ? true : false;
|
|
||||||
// mapView.addMarker(transfCoord, authenticatedUser);
|
|
||||||
// mapViewPanel.add(mapView);
|
|
||||||
// } else if (concessioneDV != null) {
|
|
||||||
// GeoportalDataViewerConstants
|
|
||||||
// .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
|
|
||||||
// + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void addUploadedImages() {
|
|
||||||
// GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative());
|
|
||||||
// List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
|
||||||
// if (immagini != null && immagini.size() > 0) {
|
|
||||||
// imagesPanel.setVisible(true);
|
|
||||||
//
|
|
||||||
// List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>();
|
|
||||||
// for (UploadedImageDV uploadedImageDV : immagini) {
|
|
||||||
// immaginiToShow.add(uploadedImageDV);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (immaginiToShow.size() > 0) {
|
|
||||||
// ImagesGallery gallery = new ImagesGallery(immaginiToShow);
|
|
||||||
// imagesPanel.add(gallery.getGalleryPanel());
|
|
||||||
// gallery.fillGallery();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ConcessioneDV getConcessioneDV() {
|
|
||||||
// return concessioneDV;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// protected void setExpandViewButtonVisible(boolean bool) {
|
|
||||||
// expandButton.setVisible(bool);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -1,68 +0,0 @@
|
||||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
|
||||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
|
||||||
|
|
||||||
<ui:style>
|
|
||||||
.margin-left-10 {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.font-size-h1-22 h1 {
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-to-right {
|
|
||||||
right: 20px;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.the-title h1 {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.margin-bottom-10 {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.width-100 {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</ui:style>
|
|
||||||
<g:HTMLPanel ui:field="pageViewDetails">
|
|
||||||
<!-- <g:HTMLPanel ui:field="sharePanel" -->
|
|
||||||
<!-- addStyleNames="{style.align-to-right}"> -->
|
|
||||||
<!-- </g:HTMLPanel> -->
|
|
||||||
<b:PageHeader ui:field="titolo"
|
|
||||||
addStyleNames="{style.the-title}"></b:PageHeader>
|
|
||||||
<g:HorizontalPanel
|
|
||||||
addStyleNames="{style.margin-bottom-10}">
|
|
||||||
<b:Button ui:field="shareButton">Share</b:Button>
|
|
||||||
<b:Button ui:field="expandButton">Expand</b:Button>
|
|
||||||
</g:HorizontalPanel>
|
|
||||||
<b:Paragraph ui:field="introduzione"></b:Paragraph>
|
|
||||||
<g:VerticalPanel addStyleNames="{style.width-100}">
|
|
||||||
<g:HTMLPanel ui:field="mapViewPanel">
|
|
||||||
</g:HTMLPanel>
|
|
||||||
<g:HTMLPanel ui:field="concessioniPanel">
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</g:VerticalPanel>
|
|
||||||
<g:HTMLPanel ui:field="relazioneScavoPanel"
|
|
||||||
addStyleNames="{style.margin-left-10}" visible="false">
|
|
||||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Relazione di Scavo</b:PageHeader>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
<g:HTMLPanel ui:field="imagesPanel"
|
|
||||||
addStyleNames="{style.margin-left-10}" visible="false">
|
|
||||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Immagini Rappresentative</b:PageHeader>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
<g:HTMLPanel ui:field="posizionamentoAreaIndaginePanel"
|
|
||||||
addStyleNames="{style.margin-left-10}" visible="false">
|
|
||||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Posizionamento Area di
|
|
||||||
Indagine</b:PageHeader>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
<g:HTMLPanel ui:field="piantaFineScavoPanel"
|
|
||||||
addStyleNames="{style.margin-left-10}" visible="false">
|
|
||||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Pianta Fine Scavo</b:PageHeader>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</ui:UiBinder>
|
|
|
@ -1,265 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
|
||||||
|
|
||||||
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.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.util.CustomFlexTable;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.dom.client.Style;
|
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
|
||||||
|
|
||||||
import ol.Coordinate;
|
|
||||||
|
|
||||||
public class LayerConcessioneView extends Composite {
|
|
||||||
|
|
||||||
private static LayerConcessioneUiBinder uiBinder = GWT.create(LayerConcessioneUiBinder.class);
|
|
||||||
|
|
||||||
interface LayerConcessioneUiBinder extends UiBinder<Widget, LayerConcessioneView> {
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
HTMLPanel layerConcessionePanel;
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
HTMLPanel mapViewPanel;
|
|
||||||
|
|
||||||
private CustomFlexTable customTable = new CustomFlexTable();
|
|
||||||
|
|
||||||
private static enum IMAGE_EXPORT_AS {
|
|
||||||
PNG, JPEG
|
|
||||||
};
|
|
||||||
|
|
||||||
int downloadAttempt = 0;
|
|
||||||
|
|
||||||
public LayerConcessioneView(LayerConcessioneDV layerDV) {
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
GWT.log("Showing: " + layerDV);
|
|
||||||
|
|
||||||
GWT.log("WMS LINK: " + layerDV.getWmsLink());
|
|
||||||
if (layerDV.getLayerName() != null && layerDV.getWmsLink() != null) {
|
|
||||||
|
|
||||||
DropdownButton exportMapButton = new DropdownButton("Export Map as...");
|
|
||||||
exportMapButton.setType(ButtonType.LINK);
|
|
||||||
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
|
|
||||||
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
|
|
||||||
Style exportStyle = exportMapButton.getElement().getStyle();
|
|
||||||
//exportStyle.setWidth(100, Unit.PCT);
|
|
||||||
exportStyle.setMarginLeft(70, Unit.PCT);
|
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
mapViewPanel.add(mapView);
|
|
||||||
mapViewPanel.add(exportMapButton);
|
|
||||||
String mapServerHost = layerDV.getWmsLink().contains("?")
|
|
||||||
? layerDV.getWmsLink().substring(0, layerDV.getWmsLink().indexOf("?"))
|
|
||||||
: layerDV.getWmsLink();
|
|
||||||
|
|
||||||
mapView.addWMSLayer(mapServerHost, layerDV.getLayerName(), layerDV.getBbox());
|
|
||||||
|
|
||||||
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
|
|
||||||
|
|
||||||
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
|
|
||||||
NavLink navLink = new NavLink(exportType.name());
|
|
||||||
String exportExt = exportType.name().toLowerCase();
|
|
||||||
String filename = layerDV.getLayerName() + "." + exportExt;
|
|
||||||
String mimeType = "image/" + exportExt;
|
|
||||||
final HTML htmlLink = new HTML("<a id=\"" + htmlLinkId + "\" download=\"" + filename + "\"></a>");
|
|
||||||
navLink.getElement().appendChild(htmlLink.getElement());
|
|
||||||
navLink.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
|
|
||||||
// DOWNLOAD only the layer by Geoserver
|
|
||||||
/*
|
|
||||||
* Map<String, String> mapLayerURLs =
|
|
||||||
* mapView.getLightOLSM().getLayerURLsProperty(); Collection<String> layerURLs =
|
|
||||||
* mapLayerURLs.values(); ArrayList<String> layers = new
|
|
||||||
* ArrayList<String>(layerURLs); exportPDF(layers.get(0)); String layerURL =
|
|
||||||
* mapLayerURLs.get(layerDV.getLayerName()); GWT.log("layerDV name is: " +
|
|
||||||
* layerDV.getLayerName()); if (layerURL != null) Window.open(layerURL,
|
|
||||||
* "_blank", null);
|
|
||||||
*/
|
|
||||||
|
|
||||||
downloadAttempt++;
|
|
||||||
|
|
||||||
if (downloadAttempt > 3) {
|
|
||||||
Window.alert("LOOP");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DOWNLOAD the OSM + layer by canvas
|
|
||||||
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId,
|
|
||||||
filename, mimeType);
|
|
||||||
// mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exportMapButton.add(navLink);
|
|
||||||
|
|
||||||
}
|
|
||||||
//mapViewPanel.add(exportMapButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection());
|
|
||||||
customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita());
|
|
||||||
customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati());
|
|
||||||
customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione());
|
|
||||||
customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
layerConcessionePanel.add(customTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static native void exportPDF(String layerURL) /*-{
|
|
||||||
var image = new Image(layerURL);
|
|
||||||
|
|
||||||
var doc = new $wnd.jspdf.jsPDF();
|
|
||||||
doc.addImage(layerURL, 'PNG', 0, 0, image.width, image.height);
|
|
||||||
doc.save("map.pdf")
|
|
||||||
}-*/;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints the.
|
|
||||||
*
|
|
||||||
* @param msg the msg
|
|
||||||
*/
|
|
||||||
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
|
|
||||||
String mimeType)/*-{
|
|
||||||
console.log("map: " + map);
|
|
||||||
|
|
||||||
map.once('rendercomplete', function() {
|
|
||||||
var mapCanvas = $doc.createElement('canvas');
|
|
||||||
var size = map.getSize();
|
|
||||||
mapCanvas.width = size[0];
|
|
||||||
mapCanvas.height = size[1];
|
|
||||||
var mapContext = mapCanvas.getContext('2d');
|
|
||||||
var mapContainer = $doc.querySelector('#' + mapPanelId);
|
|
||||||
//console.log("mapContainer:" +JSON.stringify(mapContainer, null, 4));
|
|
||||||
Array.prototype.forEach.call(mapContainer
|
|
||||||
.querySelectorAll('.ol-layer canvas'), function(canvas) {
|
|
||||||
if (canvas.width > 0) {
|
|
||||||
var opacity = canvas.parentNode.style.opacity;
|
|
||||||
mapContext.globalAlpha = opacity === '' ? 1
|
|
||||||
: Number(opacity);
|
|
||||||
var transform = canvas.style.transform;
|
|
||||||
// Get the transform parameters from the style's transform matrix
|
|
||||||
var matrix = transform.match(/^matrix\(([^\(]*)\)$/)[1]
|
|
||||||
.split(',').map(Number);
|
|
||||||
// Apply the transform to the export map context
|
|
||||||
CanvasRenderingContext2D.prototype.setTransform.apply(
|
|
||||||
mapContext, matrix);
|
|
||||||
mapContext.drawImage(canvas, 0, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (navigator.msSaveBlob) {
|
|
||||||
// link download attribute does not work on MS browsers
|
|
||||||
navigator.msSaveBlob(mapCanvas.msToBlob(), filename);
|
|
||||||
} else {
|
|
||||||
var link = $doc.getElementById(linkId);
|
|
||||||
link.href = mapCanvas.toDataURL(mimeType);
|
|
||||||
link.click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
map.renderSync();
|
|
||||||
}-*/;
|
|
||||||
|
|
||||||
// public static native void mapExport(ol.Map map, String mapPanelId)/*-{
|
|
||||||
// try {
|
|
||||||
// var dims = {
|
|
||||||
// a0 : [ 1189, 841 ],
|
|
||||||
// a1 : [ 841, 594 ],
|
|
||||||
// a2 : [ 594, 420 ],
|
|
||||||
// a3 : [ 420, 297 ],
|
|
||||||
// a4 : [ 297, 210 ],
|
|
||||||
// a5 : [ 210, 148 ],
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// var resolutions = {
|
|
||||||
// 72 : 72,
|
|
||||||
// 150 : 150,
|
|
||||||
// 300 : 300,
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// //var format = document.getElementById('format').value;
|
|
||||||
// var format = 'a4';
|
|
||||||
// //var resolution = document.getElementById('resolution').value;
|
|
||||||
// var resolution = resolutions[150];
|
|
||||||
// var dim = dims[format];
|
|
||||||
// var width = Math.round((dim[0] * resolution) / 25.4);
|
|
||||||
// var height = Math.round((dim[1] * resolution) / 25.4);
|
|
||||||
// var size = map.getSize();
|
|
||||||
// var viewResolution = map.getView().getResolution();
|
|
||||||
//
|
|
||||||
// map.once('rendercomplete', function() {
|
|
||||||
// var mapCanvas = $doc.createElement('canvas');
|
|
||||||
// mapCanvas.width = width;
|
|
||||||
// mapCanvas.height = height;
|
|
||||||
// var mapContext = mapCanvas.getContext('2d');
|
|
||||||
// var selectId = "#" + mapPanelId;
|
|
||||||
// console.log('selectId: ' + selectId);
|
|
||||||
// var container = $doc.querySelector(selectId);
|
|
||||||
// console.log('container: ' + container);
|
|
||||||
// Array.prototype.forEach.call(container
|
|
||||||
// .querySelectorAll('.ol-layer canvas'),
|
|
||||||
// function(canvas) {
|
|
||||||
// canvas.crossOrigin = "anonymous"; // This enables CORS
|
|
||||||
// if (canvas.width > 0) {
|
|
||||||
// var opacity = canvas.parentNode.style.opacity;
|
|
||||||
// mapContext.globalAlpha = opacity === '' ? 1
|
|
||||||
// : Number(opacity);
|
|
||||||
// var transform = canvas.style.transform;
|
|
||||||
// // Get the transform parameters from the style's transform matrix
|
|
||||||
// var matrix = transform
|
|
||||||
// .match(/^matrix\(([^\(]*)\)$/)[1]
|
|
||||||
// .split(',').map(Number);
|
|
||||||
// // Apply the transform to the export map context
|
|
||||||
// CanvasRenderingContext2D.prototype.setTransform
|
|
||||||
// .apply(mapContext, matrix);
|
|
||||||
// mapContext.drawImage(canvas, 0, 0);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// //window.open(mapCanvas.toDataURL(), '_blank');
|
|
||||||
//
|
|
||||||
// var pdf = new $wnd.jspdf.jsPDF('landscape', undefined, format);
|
|
||||||
// pdf.addImage(mapCanvas.toDataURL('image/jpeg'), 'JPEG', 0, 0,
|
|
||||||
// dim[0], dim[1]);
|
|
||||||
// pdf.save('map.pdf');
|
|
||||||
// // Reset original map size
|
|
||||||
// map.setSize(size);
|
|
||||||
// map.getView().setResolution(viewResolution);
|
|
||||||
// exportButton.disabled = false;
|
|
||||||
// document.body.style.cursor = 'auto';
|
|
||||||
// });
|
|
||||||
// //map.renderSync();
|
|
||||||
// // Set print size
|
|
||||||
// var printSize = [width, height];
|
|
||||||
// map.setSize(printSize);
|
|
||||||
// var scaling = Math.min(width / size[0], height / size[1]);
|
|
||||||
// map.getView().setResolution(viewResolution / scaling);
|
|
||||||
// } catch (error) {
|
|
||||||
// window.alert(error);
|
|
||||||
// }
|
|
||||||
// }-*/;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
|
||||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
|
||||||
|
|
||||||
<ui:style>
|
|
||||||
.important {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
</ui:style>
|
|
||||||
<g:HTMLPanel addStyleNames="style-layer">
|
|
||||||
<g:VerticalPanel>
|
|
||||||
<g:HTMLPanel ui:field="mapViewPanel"></g:HTMLPanel>
|
|
||||||
<g:HTMLPanel ui:field="layerConcessionePanel"></g:HTMLPanel>
|
|
||||||
</g:VerticalPanel>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</ui:UiBinder>
|
|
|
@ -1,119 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
|
||||||
|
|
||||||
public class RelazioneScavoView extends Composite {
|
|
||||||
|
|
||||||
private static final String SHOW_ITALIAN_DESCR = "Italian description";
|
|
||||||
|
|
||||||
private static final String SHOW_ENGLISH_DESCR = "English description";
|
|
||||||
|
|
||||||
private static RelazioneScavoViewUiBinder uiBinder = GWT.create(RelazioneScavoViewUiBinder.class);
|
|
||||||
|
|
||||||
interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> {
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
HTMLPanel relazioneScavoPanel;
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
Paragraph abstractParagraphIta;
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
Paragraph abstractParagraphEng;
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
Button linkAbstractLanguage;
|
|
||||||
|
|
||||||
private CustomFlexTable customTable = new CustomFlexTable();
|
|
||||||
|
|
||||||
public RelazioneScavoView(AbstractRelazioneScavoDV abstractRelazioneDV, RelazioneScavoDV relazioneScavoDV) {
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
GWT.log("Showing abstract: "+abstractRelazioneDV);
|
|
||||||
GWT.log("Showing relazioneScavoDV: "+relazioneScavoDV);
|
|
||||||
|
|
||||||
if (abstractRelazioneDV != null) {
|
|
||||||
relazioneScavoPanel.setVisible(true);
|
|
||||||
if (abstractRelazioneDV.getAbstractSectionIta() != null) {
|
|
||||||
abstractParagraphIta.setText(abstractRelazioneDV.getAbstractSectionIta());
|
|
||||||
if (abstractRelazioneDV.getAbstractSectionEng() != null) {
|
|
||||||
linkAbstractLanguage.setVisible(true);
|
|
||||||
abstractParagraphEng.setText(abstractRelazioneDV.getAbstractSectionEng());
|
|
||||||
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showLinkToDownloadWsContent("Abstract Relazione", abstractRelazioneDV.getListWsContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
linkAbstractLanguage.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
GWT.log("Clicked");
|
|
||||||
if (abstractParagraphIta.isVisible()) {
|
|
||||||
linkAbstractLanguage.setText(SHOW_ITALIAN_DESCR);
|
|
||||||
abstractParagraphIta.setVisible(false);
|
|
||||||
abstractParagraphEng.setVisible(true);
|
|
||||||
} else {
|
|
||||||
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
|
|
||||||
abstractParagraphIta.setVisible(true);
|
|
||||||
abstractParagraphEng.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (relazioneScavoDV != null) {
|
|
||||||
relazioneScavoPanel.setVisible(true);
|
|
||||||
// customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
|
|
||||||
// customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
|
|
||||||
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(),
|
|
||||||
GeoportalDataViewerConstants.NEW_LINE_BR);
|
|
||||||
|
|
||||||
showLinkToDownloadWsContent("Relazione", relazioneScavoDV.getListWsContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
relazioneScavoPanel.add(customTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showLinkToDownloadWsContent(String title, List<WorkspaceContentDV> listContent) {
|
|
||||||
if (listContent != null) {
|
|
||||||
int i = 0;
|
|
||||||
String fieldLabel = title;
|
|
||||||
for (WorkspaceContentDV workspaceContentDV : listContent) {
|
|
||||||
|
|
||||||
if (i > 0) {
|
|
||||||
fieldLabel = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
String downloadLabel = "download";
|
|
||||||
if(workspaceContentDV.getName()!=null) {
|
|
||||||
downloadLabel = workspaceContentDV.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
customTable.addNextKeyWidget(fieldLabel, new HTML(
|
|
||||||
"<a href=\"" + workspaceContentDV.getLink() + "\">" + downloadLabel + "</a>"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
|
||||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
|
||||||
|
|
||||||
<ui:style>
|
|
||||||
.description>p {
|
|
||||||
font-size: 20px;
|
|
||||||
padding: 10px;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
</ui:style>
|
|
||||||
<g:HTMLPanel ui:field="relazioneScavoPanel"
|
|
||||||
addStyleNames="{style.description}">
|
|
||||||
<b:Button ui:field="linkAbstractLanguage" visible="false"
|
|
||||||
type="LINK"></b:Button>
|
|
||||||
<b:Paragraph ui:field="abstractParagraphIta"></b:Paragraph>
|
|
||||||
<b:Paragraph ui:field="abstractParagraphEng"
|
|
||||||
visible="false"></b:Paragraph>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</ui:UiBinder>
|
|
|
@ -203,6 +203,10 @@ body {
|
||||||
left: 50px;
|
left: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inner-toolbar .btn-group {
|
||||||
|
margin-left: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.inner-toolbar .btn-link {
|
.inner-toolbar .btn-link {
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
background-color: #fcfcfc;
|
background-color: #fcfcfc;
|
||||||
|
|
Loading…
Reference in New Issue