use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class GDMComposer method loadMap.
public void loadMap(Event event) {
String[] envlist = getSelectedLayersWithDisplayNames().split(":");
for (String env2 : envlist) {
String env = env2.split("\\|")[0];
String displayName = env2.split("\\|")[1];
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:gdm_" + env + "Tran_" + pid + "&styles=alastyles&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:gdm_" + env + "Tran_" + pid + "&STYLE=alastyles";
LOGGER.debug(legendurl);
String layername = "Tranformed " + displayName;
getMapComposer().addWMSLayer(pid + "_" + env, layername, mapurl, (float) 0.5, null, legendurl, LayerUtilitiesImpl.GDM, null, null);
MapLayer ml = getMapComposer().getMapLayer(pid + "_" + env);
ml.setPid(pid + "_" + env);
String infoUrl = CommonData.getSatServer() + "/output/gdm/" + pid + "/gdm.html";
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setMoreInfo(infoUrl + "\nGDM Output\npid:" + pid);
md.setId(Long.valueOf(pid));
}
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class MaxentComposer method loadMap.
public void loadMap(Event event) {
String mapurl = CommonData.getGeoServer() + "/wms?service=WMS&version=1.1.0&request=GetMap&layers=ALA:species_" + pid + "&styles=alastyles&FORMAT=image%2Fpng";
String legendurl = CommonData.getGeoServer() + "/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=10&HEIGHT=1" + "&LAYER=ALA:species_" + pid + "&STYLE=alastyles";
LOGGER.debug(legendurl);
//get job inputs
String layername = tToolName.getValue();
getMapComposer().addWMSLayer("species_" + pid, layername, mapurl, (float) 0.5, null, legendurl, LayerUtilitiesImpl.MAXENT, null, null);
MapLayer ml = getMapComposer().getMapLayer("species_" + pid);
ml.setPid(pid);
String infoUrl = CommonData.getSatServer() + "/output/maxent/" + pid + "/species.html";
MapLayerMetadata md = ml.getMapLayerMetadata();
md.setMoreInfo(infoUrl + "\nMaxent Output\npid:" + pid);
md.setId(Long.valueOf(pid));
try {
// set off the download as well
String fileUrl = CommonData.getSatServer() + "/ws/download/" + pid;
Filedownload.save(new URL(fileUrl).openStream(), "application/zip", tToolName.getValue().replaceAll(" ", "_") + ".zip");
} catch (Exception e) {
LOGGER.error("Error generating download for prediction model:", e);
}
this.detach();
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class LayerLegendGeneralComposer method afterCompose.
@Override
public void afterCompose() {
super.afterCompose();
MapLayer llc2MapLayer = null;
Map m = Executions.getCurrent().getArg();
if (m != null) {
for (Object o : m.entrySet()) {
if (((Map.Entry) o).getKey() instanceof String && "map_layer".equals(((Map.Entry) o).getKey())) {
llc2MapLayer = (MapLayer) ((Map.Entry) o).getValue();
}
}
}
cbColour.setSelectedIndex(0);
getMapComposer().setFacetsOpenListener(new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
cbColour.open();
}
});
getMapComposer().setLayerLegendNameRefresh(new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
txtLayerName.setValue((String) event.getData());
}
});
init(llc2MapLayer, llc2MapLayer.getSpeciesQuery(), llc2MapLayer.getRedVal(), llc2MapLayer.getGreenVal(), llc2MapLayer.getBlueVal(), llc2MapLayer.getSizeVal(), (int) (llc2MapLayer.getOpacity() * 100), llc2MapLayer.getColourMode(), (StringConstants.GRID.equals(llc2MapLayer.getColourMode())) ? 0 : ((llc2MapLayer.isClustered()) ? 1 : 2), llc2MapLayer.getSizeUncertain());
getFellow("btnSearch").addEventListener(StringConstants.ONCLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
List<String[]> legendLinesFiltered = new ArrayList<String[]>();
String txt = ((Textbox) getFellow("txtSearch")).getValue().toLowerCase();
if (txt.length() > 0) {
Integer groupCount = mapLayer.getClassificationGroupCount();
JSONArray groupObjects = mapLayer.getClassificationObjects();
List<JSONObject> model = new ArrayList<JSONObject>();
for (int i = 0; i < groupCount; i++) {
if (((JSONObject) groupObjects.get(i)).get("name").toString().toLowerCase().contains(txt)) {
model.add((JSONObject) groupObjects.get(i));
}
}
lbClassificationGroup.setModel(new SimpleListModel(model));
lbClassificationGroup.setActivePage(0);
((Button) getFellow("btnClear")).setDisabled(false);
}
}
});
getFellow("btnClear").addEventListener(StringConstants.ONCLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
((Textbox) getFellow("txtSearch")).setValue("");
((Button) getFellow("btnClear")).setDisabled(true);
Integer groupCount = mapLayer.getClassificationGroupCount();
JSONArray groupObjects = mapLayer.getClassificationObjects();
List<JSONObject> model = new ArrayList<JSONObject>();
for (int i = 0; i < groupCount; i++) {
model.add((JSONObject) groupObjects.get(i));
}
lbClassificationGroup.setModel(new SimpleListModel(model));
lbClassificationGroup.setActivePage(0);
}
});
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class LayerLegendGeneralComposer method onClick$btnApply.
public void onClick$btnApply(Event event) {
MapComposer mc = getMapComposer();
MapLayer ml = mapLayer;
//layer on map settings
if (getRed() != ml.getRedVal() || getGreen() != ml.getGreenVal() || getBlue() != ml.getBlueVal() || getSize() != ml.getSizeVal() || getOpacity() != (int) (ml.getOpacity() * 100) || (ml.getColourMode() != null && !ml.getColourMode().equals(getColourMode())) || (ml.isClustered() && getPointType() != 1) || ml.getSizeUncertain() != getUncertainty() || !ml.getDisplayName().equals(getDisplayName())) {
//layer in menu settings
if (!ml.getDisplayName().equals(getDisplayName())) {
ml.setDisplayName(getDisplayName());
//selection label
mc.setLabelSelectedLayer(getDisplayName());
mc.redrawLayersList();
}
ml.setRedVal(getRed());
ml.setGreenVal(getGreen());
ml.setBlueVal(getBlue());
ml.setSizeVal(getSize());
ml.setOpacity(getOpacity() / 100.0f);
ml.setColourMode(getColourMode());
ml.setClustered(getPointType() == 0);
ml.setSizeUncertain(getUncertainty());
mc.applyChange(ml);
}
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class MapComposer method getMapLayerWMS.
public Object getMapLayerWMS(String wmsurl) {
// check if layer already present
List udl = getPortalSession().getActiveLayers();
Iterator iudl = udl.iterator();
while (iudl.hasNext()) {
MapLayer ml = (MapLayer) iudl.next();
if (ml.getUri() != null && ml.getUri().equals(wmsurl)) {
return ml;
}
}
return null;
}
Aggregations