geoportal-data-viewer-app/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ViewerStatus.java

66 lines
2.0 KiB
Java

package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
public class ViewerStatus {
private GNADataViewerConfigProfile geonaDataViewerProfile;
private ViewerConfiguration config;
// ucid -> index layer
private Map<String,List<LayerObject>> openedIndexes;
// ucid -> projectId -> layers
private Map<String,Map<String,List<LayerObject>>> openedProjects;
public GNADataViewerConfigProfile getGeonaDataViewerProfile() {
return geonaDataViewerProfile;
}
public void setGeonaDataViewerProfile(GNADataViewerConfigProfile geonaDataViewerProfile) {
this.geonaDataViewerProfile = geonaDataViewerProfile;
}
public ViewerConfiguration getConfig() {
return config;
}
public void setConfig(ViewerConfiguration config) {
this.config = config;
}
public Map<String, List<LayerObject>> getOpenedIndexes() {
return openedIndexes;
}
public Map<String, Map<String,List<LayerObject>>> getOpenedProjects() {
return openedProjects;
}
public void addOpenedIndex(String ucid, LayerObject indexId) {
if(openedIndexes==null) openedIndexes=new HashMap<String, List<LayerObject>>();
if(!openedIndexes.containsKey(ucid)) openedIndexes.put(ucid, new ArrayList<LayerObject>());
openedIndexes.get(ucid).add(indexId);
}
public void addOpenedProjectLayer(String ucid, String projectId, LayerObject projectLayer) {
if(openedProjects==null) openedProjects=new HashMap<String, Map<String,List<LayerObject>>>();
if(!openedProjects.containsKey(ucid)) openedProjects.put(ucid, new HashMap<String, List<LayerObject>>());
Map<String,List<LayerObject>> map=openedProjects.get(ucid);
if(!map.containsKey(projectId)) map.put(ucid, new ArrayList<LayerObject>());
map.get(projectId).add(projectLayer);
}
}