use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayersZoomExtentEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
// get reference to the label/image the user clicked on
Component target = event.getTarget();
Listitem listItem = (Listitem) target.getParent().getParent();
MapLayer activeLayer = listItem.getValue();
if (activeLayer != null) {
mapComposer.zoomToExtent(activeLayer);
}
} else {
LOGGER.debug("MapController reports unsafe to perform action");
}
}
use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class PointComparison method onMapClick.
public void onMapClick(Event event) {
String pointGeom = (String) event.getData();
try {
if (pointGeom.contains(StringConstants.NAN_NAN)) {
} else {
points.get(currentPoint)[0] = pointGeom.replace("POINT(", "").split(" ")[0];
points.get(currentPoint)[1] = pointGeom.split(" ")[1].replace(")", "");
lbPoints.setModel(new SimpleListModel<Object>(points));
//get the current MapComposer instance
MapComposer mc = getMapComposer();
//add feature to the map as a new layer
layerName = mc.getNextAreaLayerName("Point");
MapLayer mapLayer = mc.addWKTLayer(pointGeom, layerName, "Point");
mapLayer.getMapLayerMetadata().setMoreInfo(LayersUtil.getMetadataForWKT(CommonData.lang(StringConstants.METADATA_USER_BOUNDING_BOX), pointGeom));
layers.set(currentPoint, mapLayer);
disableEdit();
}
} catch (Exception e) {
LOGGER.error("Error adding user point", e);
}
}
use of au.org.emii.portal.composer.MapComposer 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.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class AddAreaController method onClick$btnOk.
public void onClick$btnOk(Event event) {
if (btnOk.isDisabled()) {
return;
}
String windowName = "";
MapComposer mc = getMapComposer();
String script = "";
boolean overlapped = true;
if (cbAreaSelection.getSelectedItem() == ciBoundingBox) {
windowName = "WEB-INF/zul/add/area/AreaBoundingBox.zul";
script = mc.getOpenLayersJavascript().addBoxDrawingTool();
} else if (cbAreaSelection.getSelectedItem() == ciPolygon) {
windowName = "WEB-INF/zul/add/area/AreaPolygon.zul";
script = mc.getOpenLayersJavascript().addPolygonDrawingTool();
} else if (cbAreaSelection.getSelectedItem() == ciPointAndRadius) {
windowName = "WEB-INF/zul/add/area/AreaPointAndRadius.zul";
script = mc.getOpenLayersJavascript().addRadiusDrawingTool();
} else if (cbAreaSelection.getSelectedItem() == ciRegionSelection) {
overlapped = false;
windowName = "WEB-INF/zul/add/area/AreaRegionSelection.zul";
} else if (cbAreaSelection.getSelectedItem() == ciAddressRadiusSelection) {
overlapped = false;
windowName = "WEB-INF/zul/add/area/AreaAddressRadiusSelection.zul";
} else if (cbAreaSelection.getSelectedItem() == ciRadiusManualSelection) {
overlapped = false;
windowName = "WEB-INF/zul/add/area/AreaRadiusManualSelection.zul";
} else if (cbAreaSelection.getSelectedItem() == ciUploadShapefile) {
windowName = "WEB-INF/zul/add/area/AreaUploadShapefile.zul";
overlapped = false;
} else if (cbAreaSelection.getSelectedItem() == ciUploadKML) {
windowName = "WEB-INF/zul/add/area/AreaUploadKML.zul";
overlapped = false;
} else if (cbAreaSelection.getSelectedItem() == ciMapPolygon) {
List<MapLayer> layers = getMapComposer().getContextualLayers();
boolean visibleLayers = false;
for (MapLayer ml : layers) {
if (ml.isDisplayed()) {
visibleLayers = true;
break;
}
}
if (!visibleLayers) {
//present layer selection window
windowName = "WEB-INF/zul/layer/ContextualLayerSelection.zul";
overlapped = false;
} else {
windowName = "WEB-INF/zul/add/area/AreaMapPolygon.zul";
script = mc.getOpenLayersJavascript().addFeatureSelectionTool();
}
} else if (cbAreaSelection.getSelectedItem() == ciEnvironmentalEnvelope) {
windowName = "WEB-INF/zul/add/area/AreaEnvironmentalEnvelope.zul";
} else if (cbAreaSelection.getSelectedItem() == ciBoxAustralia) {
String wkt = CommonData.getSettings().getProperty(CommonData.AUSTRALIA_WKT);
String layerName = mc.getNextAreaLayerName(CommonData.lang(StringConstants.AUSTRALIA_BOUNDING_BOX));
MapLayer mapLayer = mc.addWKTLayer(wkt, layerName, layerName);
mapLayer.getMapLayerMetadata().setMoreInfo(LayersUtil.getMetadata(CommonData.lang(StringConstants.AUSTRALIA_BOUNDING_BOX) + " " + wkt));
remoteLogger.logMapArea(layerName, "Area - BoxAustralia", wkt);
} else if (cbAreaSelection.getSelectedItem() == ciBoxWorld) {
String wkt = CommonData.WORLD_WKT;
String layerName = mc.getNextAreaLayerName(CommonData.lang(StringConstants.WORLD_BOUNDING_BOX));
MapLayer mapLayer = mc.addWKTLayer(wkt, layerName, layerName);
mapLayer.getMapLayerMetadata().setMoreInfo(LayersUtil.getMetadata(CommonData.lang(StringConstants.WORLD_BOUNDING_BOX) + " " + wkt));
remoteLogger.logMapArea(layerName, "Area - BoxWorld", wkt);
} else if (cbAreaSelection.getSelectedItem() == ciBoxCurrentView) {
String wkt = mc.getMapComposer().getViewArea();
String layerName = mc.getNextAreaLayerName(CommonData.lang(StringConstants.CURRENT_VIEW_AREA));
MapLayer mapLayer = mc.addWKTLayer(wkt, layerName, layerName);
mapLayer.getMapLayerMetadata().setMoreInfo(LayersUtil.getMetadata(CommonData.lang(StringConstants.CURRENT_VIEW_AREA) + " " + wkt));
remoteLogger.logMapArea(layerName, "Area - BoxCurrentView", wkt);
} else if (cbAreaSelection.getSelectedItem() == ciWKT) {
windowName = "WEB-INF/zul/add/area/AreaWKT.zul";
} else if (cbAreaSelection.getSelectedItem() == ciMergeAreas) {
windowName = "WEB-INF/zul/add/area/AreaMerge.zul";
overlapped = false;
}
if (!windowName.isEmpty()) {
mc.getOpenLayersJavascript().execute(mc.getOpenLayersJavascript().getIFrameReferences() + script);
Window window = (Window) Executions.createComponents(windowName, this.getParent(), args);
try {
if (overlapped) {
window.doOverlapped();
} else {
window.setParent(this.getParent());
window.doModal();
}
} catch (Exception e) {
LOGGER.error("error opening window: " + windowName, e);
}
} else if (StringConstants.ADDTOOLWINDOW.equals(getParent().getId())) {
ToolComposer analysisParent = (ToolComposer) this.getParent();
analysisParent.resetWindow(getMapComposer().getNextAreaLayerName(StringConstants.MY_AREA));
} else if (StringConstants.ADDFACETWINDOW.equals(getParent().getId())) {
AddFacetController analysisParent = (AddFacetController) this.getParent();
analysisParent.resetWindow(getMapComposer().getNextAreaLayerName(StringConstants.MY_AREA));
}
if (cbAreaSelection.getSelectedItem() != null) {
mc.setAttribute(StringConstants.ADDAREAWINDOW, cbAreaSelection.getSelectedItem().getId());
}
this.detach();
}
use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class AreaBoundingBox method onClick$btnClear.
public void onClick$btnClear(Event event) {
MapComposer mc = getMapComposer();
if (layerName != null && mc.getMapLayer(layerName) != null) {
mc.removeLayer(layerName);
}
String script = mc.getOpenLayersJavascript().addBoxDrawingTool();
mc.getOpenLayersJavascript().execute(mc.getOpenLayersJavascript().getIFrameReferences() + script);
displayGeom.setValue("");
btnNext.setDisabled(true);
btnClear.setDisabled(true);
}
Aggregations