Removed old concessione. Added "Add layers to Map" facility

This commit is contained in:
Francesco Mangiacrapa 2022-11-09 11:42:44 +01:00
parent 62dc1bad6c
commit 8298b2f93e
16 changed files with 295 additions and 962 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -26,7 +27,8 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
@ -53,7 +55,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -80,7 +83,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -107,7 +111,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -134,7 +139,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -161,7 +167,11 @@
<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>
@ -188,7 +198,8 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -215,7 +226,8 @@
<property name="context-root" value="geoportal-data-viewer-app"/>
@ -242,7 +254,8 @@
</wb-module>

View File

@ -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.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
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.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
@ -125,7 +127,7 @@ public class GeoportalDataViewer implements EntryPoint {
private static List<BaseMapLayer> listBaseMapLayers = null;
private static ViewerStatus viewerStatus = new ViewerStatus();
private TimelineManagerStatus timelineMS = new TimelineManagerStatus(applicationBus);
private boolean initApplication;
@ -174,7 +176,7 @@ public class GeoportalDataViewer implements EntryPoint {
}
private void initApplication() {
initApplication = true;
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@ -236,9 +238,9 @@ public class GeoportalDataViewer implements EntryPoint {
paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null, true));
}
// TODO LOAD INITIAL LAYERS
mainPanel.openCollectionMenu();
GWT.log("DONE INIT LOAD");
}
@ -257,26 +259,6 @@ public class GeoportalDataViewer implements EntryPoint {
bindEvents();
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() {
@ -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() {
@Override
@ -396,12 +391,12 @@ public class GeoportalDataViewer implements EntryPoint {
mainPanel.showAsDetails(result, showDetailsEvent.getGeonaItemRef());
List<RelationshipDV> relationships = result.getTheProjectDV().getRelationships();
if (showDetailsEvent.isLoadTimelineRelationships()
&& relationships!= null && relationships.size() > 0) {
if (showDetailsEvent.isLoadTimelineRelationships() && relationships != null
&& relationships.size() > 0) {
GWT.log("LoadTimelineRelationships is true and the project has Relationships");
timelineMS.showTimelineProjectRelations(result.getTheProjectDV());
}
}
}
});
@ -422,11 +417,12 @@ public class GeoportalDataViewer implements EntryPoint {
attempt = 0;
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before calling the WFS
//forcing once at init time
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before
// calling the WFS
// forcing once at init time
initApplication = false;
final int MAX_RETRY = 15;
Timer timer = new com.google.gwt.user.client.Timer() {
@ -674,8 +670,6 @@ public class GeoportalDataViewer implements EntryPoint {
//
// }-*/;
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
if (projectID != null) {

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.DateTimeFormat;
/**
@ -28,7 +29,7 @@ public class GeoportalDataViewerConstants {
public static enum MapEventType {
MOUSE_CLICK, MAP_ZOOM_END, MOVE_END, ADDED_CENTROID_LAYER_TO_MAP
}
public static final String PROJECT_ID_KEY_FEATURE = "projectid";
/**
@ -69,7 +70,7 @@ public class GeoportalDataViewerConstants {
}
}
public enum RECORD_TYPE {
CONCESSIONE
}
@ -108,8 +109,7 @@ public class GeoportalDataViewerConstants {
public static native String toJsonObj(Object object)/*-{
return JSON.stringify(object);
}-*/;
/**
* Json to HTML.
*
@ -176,4 +176,8 @@ public class GeoportalDataViewerConstants {
}-*/;
public static native void clickElement(Element elem) /*-{
elem.click();
}-*/;
}

View File

@ -316,41 +316,9 @@ public class LayerManager {
// level
// is >
// QUERY_MIN_ZOOM_LEVEL
final String theProfileID = 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()
final String theProfileID = geoNaDataObject.getSourceLayerObject().getProfileID();
addLayerToMapForProject(theProfileID, theProductID, geoNaDataObject.getSourceLayerObject()
.getProjectDV());
}
}
});
}
} else {
// removing all WMS detail layers if the ZOOM level is <
@ -385,6 +353,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.
@ -468,7 +471,7 @@ public class LayerManager {
* @param projectID the project ID
* @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 boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
final String projectID, final ProjectDV projectDV) {

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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.ucd.UseCaseDescriptorDV;
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.events.ChangeMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
@ -101,16 +102,16 @@ public class GeonaDataViewMainPanel extends Composite {
@UiField
Button linkLayers;
@UiField
DropdownButton openCollectionDropDown;
@UiField
HTMLPanel openCollectionPanel;
@UiField
DropdownButton searchFacilityButton;
@UiField
NavList navListSearch;
@ -138,7 +139,6 @@ public class GeonaDataViewMainPanel extends Composite {
private HandlerManager applicationBus;
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
List<ItemFieldsResponse> itemFieldsReponse) {
initWidget(uiBinder.createAndBindUi(this));
@ -167,7 +167,7 @@ public class GeonaDataViewMainPanel extends Composite {
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setIcon(IconType.COMPASS);
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
@ -193,19 +193,19 @@ public class GeonaDataViewMainPanel extends Composite {
final UseCaseDescriptorDV ucd = ifResponse.getUseCaseDescriptorDV();
NavLink navLink = new NavLink(ifResponse.getUseCaseDescriptorDV().getName());
//navLink.setText(ucd.getName());
// navLink.setText(ucd.getName());
navLink.addClickHandler(new ClickHandler() {
private SearchFacilityUI currentSearchFacility;
@Override
public void onClick(ClickEvent event) {
if(this.currentSearchFacility!=null)
if (this.currentSearchFacility != null)
this.currentSearchFacility.resetCurrentSearch();
searchFacilityPanel.clear();
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, displayFields, sortByFields, searchByFields,
initialSortFilter);
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, displayFields,
sortByFields, searchByFields, initialSortFilter);
searchFacilityPanel.add(currentSearchFacility);
currentSearchFacility.setSearchButton(searchFacilityButton);
}
@ -477,56 +477,59 @@ public class GeonaDataViewMainPanel extends Composite {
*
* @param listBaseLayers the new base layers
*/
public void setAvailableCollections(Collection<GCubeCollection> collection) {
GWT.log("Init Available collections menu");
if(collection == null || collection.isEmpty())
if (collection == null || collection.isEmpty())
GWT.log("!!! No Available collections");
for(GCubeCollection coll : collection) {
GWT.log("Found available collection "+coll);
for (GCubeCollection coll : collection) {
GWT.log("Found available collection " + coll);
String label = coll.getUcd().getName();
String id=coll.getUcd().getId();
String id = coll.getUcd().getId();
CheckBox checkbox = new CheckBox(label);
checkbox.setId("gcubeCollectionSelector_"+id);
checkbox.setId("gcubeCollectionSelector_" + id);
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
GWT.log("Collection selector flag changed to value : "+event.toDebugString());
String collectionID = ((CheckBox)event.getSource()).getId().replace("gcubeCollectionSelector_", "");
GWT.log("Collection ID is : "+collectionID + ", event value: "+event.getValue());
if(event.getValue()) {
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
String collectionID = ((CheckBox) event.getSource()).getId().replace("gcubeCollectionSelector_",
"");
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
if (event.getValue()) {
// OPEN COLLECTION
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}else {
} else {
// CLOSE COLLECTION
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
}
}
});
openCollectionPanel.add(checkbox);
}
//Open the first collection as default
if(collection!=null && collection.size()>0) {
// Open the first collection as default
if (collection != null && collection.size() > 0) {
CheckBox checkbox = (CheckBox) openCollectionPanel.getWidget(0);
checkbox.setValue(true, true);
String collectionID = checkbox.getId().replace("gcubeCollectionSelector_", "");
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
public void openCollectionMenu() {
GWT.log("openCollectionMenu");
GeoportalDataViewerConstants.clickElement(openCollectionDropDown.getElement().getFirstChildElement());
}
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
if (listBaseLayers == null)

View File

@ -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.MAP_PROJECTION;
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.EVENT_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
@ -39,10 +40,24 @@ import com.google.gwt.user.client.ui.Widget;
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 {
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> {
}
@ -64,6 +79,9 @@ public class ProjectViewer extends Composite {
@UiField
Button relationshipsButton;
@UiField
Button addLayersToMap;
private ProjectView theProjectView;
private CustomFlexTable customTable = new CustomFlexTable();
@ -72,30 +90,29 @@ public class ProjectViewer extends Composite {
private String myLogin;
private boolean viewImageButtonVisible = true;
private boolean openImageButtonVisible = true;
private HandlerManager applicationBus;
/**
* Instantiates a new project viewer.
*/
private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this));
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,
ProjectView projectView) {
this(applicationBus, geoportalItemRefs, projectView, true, true);
}
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
final ProjectView projectView, boolean viewImageButtonVisible, boolean openImageButtonVisible) {
final ProjectView projectView) {
this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs;
this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible;
this.applicationBus = applicationBus;
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
@ -126,10 +143,10 @@ public class ProjectViewer extends Composite {
@Override
public void onClick(ClickEvent event) {
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView, false,
openImageButtonVisible);
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView);
cv.setExpandViewButtonVisible(false);
cv.setRelationshipsButtonVisible(false);
cv.setAddLayersToMapVisible(false);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
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>() {
@Override
@ -184,6 +213,9 @@ public class ProjectViewer extends Composite {
}
}
/**
* Adds the centroid map.
*/
private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
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() {
return theProjectView;
}
/**
* Sets the expand view button visible.
*
* @param bool the new expand view button visible
*/
protected void setExpandViewButtonVisible(boolean 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) {
relationshipsButton.setVisible(bool);
}

View File

@ -19,14 +19,20 @@
}
.the-title {
background-color: rgba(0,60,136,.7);
background-color: rgba(0, 60, 136, .7);
color: white;
padding: 10px 10px;
font-size: 14px;
}
.margin-bottom-10 {
.functionalities-style {
margin-bottom: 10px;
position: sticky;
top: 0;
background-color: white;
opacity: 0.9;
border-radius: 5px;
z-index: 2000;
}
.width-100 {
@ -40,11 +46,11 @@
<g:HTMLPanel ui:field="headerPanel"
addStyleNames="{style.the-title}"></g:HTMLPanel>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}">
<g:HorizontalPanel addStyleNames="{style.functionalities-style}">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
</g:HTMLPanel>

View File

@ -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);
// }
//
//}

View File

@ -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>

View File

@ -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);
// }
// }-*/;
}

View File

@ -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>

View File

@ -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>"));
}
}
}
}

View File

@ -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>

View File

@ -203,6 +203,10 @@ body {
left: 50px;
}
.inner-toolbar .btn-group {
margin-left: 0px !important;
}
.inner-toolbar .btn-link {
border: 1px solid #eee;
background-color: #fcfcfc;