use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class AddSpeciesInArea method loadAreaLayers.
public void loadAreaLayers() {
try {
List<MapLayer> layers = null;
Map m = args;
if (m != null) {
for (Object o : m.entrySet()) {
if (((Map.Entry) o).getKey() instanceof String && ((Map.Entry) o).getKey().equals(StringConstants.POLYGON_LAYERS)) {
layers = (List<MapLayer>) ((Map.Entry) o).getValue();
}
}
}
for (int i = 0; layers != null && i < layers.size(); i++) {
MapLayer lyr = layers.get(i);
Radio rAr = new Radio(lyr.getDisplayName());
rAr.setId(lyr.getDisplayName().replaceAll(" ", "") + i);
rAr.setValue(lyr.getName());
rAr.setParent(rgArea);
rgArea.insertBefore(rAr, rAreaCurrent);
}
if (!allSpecies) {
//set as default in the zul
rAreaSelected = rAreaWorld;
} else {
rAreaWorld.setVisible(false);
rAreaAustralia.setVisible(false);
for (int i = 0; i < rgArea.getItemCount(); i++) {
if (rgArea.getItemAtIndex(i).isVisible()) {
rAreaSelected = rgArea.getItemAtIndex(i);
rgArea.setSelectedItem(rAreaSelected);
Clients.evalJavaScript("jq('#" + rAreaSelected.getUuid() + "-real').attr('checked', true);");
break;
}
}
}
} catch (Exception e) {
LOGGER.error(StringConstants.UNABLE_TO_LOAD_ACTIVE_AREA_LAYERS, e);
}
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class ToolComposer method onCheck$rgSpeciesBk.
public void onCheck$rgSpeciesBk(Event event) {
if (rgSpeciesBk == null) {
return;
}
Radio selectedItem = rgSpeciesBk.getSelectedItem();
try {
if (selectedItem == null && event != null) {
selectedItem = (Radio) ((org.zkoss.zk.ui.event.ForwardEvent) event).getOrigin().getTarget();
}
} catch (Exception e) {
LOGGER.error(StringConstants.FAILED_TO_SET_RADIO, e);
}
try {
if (vboxImportSL != null && event != null && selectedItem != rSpeciesUploadLSID) {
vboxImportSL.setVisible(false);
}
if (event != null && vboxImportSLBk != null && selectedItem != rSpeciesUploadLSIDBk) {
vboxImportSLBk.setVisible(false);
}
if (selectedItem == rSpeciesSearchBk && divSpeciesSearchBk != null) {
divSpeciesSearchBk.setVisible(true);
vboxMultipleBk.setVisible(false);
if (event != null) {
toggles();
}
return;
}
if (divSpeciesSearchBk != null) {
divSpeciesSearchBk.setVisible(false);
}
if (selectedItem == rSpeciesUploadLSIDBk) {
btnOk.setDisabled(true);
vboxImportSLBk.setVisible(true);
vboxMultiple.setVisible(false);
} else if (selectedItem == rSpeciesUploadSpeciesBk) {
btnOk.setVisible(true);
}
if (rMultipleBk != null && rMultipleBk.isSelected()) {
vboxMultipleBk.setVisible(true);
} else {
vboxMultipleBk.setVisible(false);
}
if (event != null) {
toggles();
}
// set default geospatial kosher checkboxes unless a map layers has
// been chosen
MapLayer ml;
Query q;
if (rgSpeciesBk.getSelectedItem() != null && rgSpeciesBk.getSelectedItem().getValue() != null && (ml = getMapComposer().getMapLayer(rgSpeciesBk.getSelectedItem().getLabel())) != null && (q = ml.getSpeciesQuery()) != null && q instanceof BiocacheQuery) {
setGeospatialKosherCheckboxesBk(((BiocacheQuery) q).getGeospatialKosher());
} else {
setGeospatialKosherCheckboxesBk(defaultGeospatialKosher);
}
updateGeospatialKosherCheckboxesBk();
} catch (Exception e) {
LOGGER.error("error selecting background species radio", e);
}
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class RemoteMapImpl method createLocalLayer.
public MapLayer createLocalLayer(int type, String label) {
MapLayer layer = new MapLayer();
layer.setName(label);
layer.setLayer(label);
layer.setId(label);
layer.setEnvColour(StringConstants.RED);
int colour = Util.nextColour();
int r = (colour >> 16) & 0x000000ff;
int g = (colour >> 8) & 0x000000ff;
int b = (colour) & 0x000000ff;
layer.setBlueVal(b);
layer.setGreenVal(g);
layer.setRedVal(r);
layer.setType(type);
layer.setSubType(type);
return layer;
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class MapComposer method redrawLayersList.
public void redrawLayersList() {
int idx = activeLayersList.getSelectedIndex();
List<MapLayer> activeLayers = getPortalSession().getActiveLayers();
activeLayersList.setModel(new ListModelList(activeLayers, true));
activeLayersList.setSelectedIndex(idx);
if (layerLegendNameRefresh != null) {
try {
layerLegendNameRefresh.onEvent(new ForwardEvent("", this, null, llc2MapLayer.getDisplayName()));
} catch (Exception e) {
LOGGER.error("failed to refresh legend name with current map layer", e);
}
}
lblSelectedLayer.setValue(llc2MapLayer.getDisplayName());
adjustActiveLayersList();
}
use of au.org.emii.portal.menu.MapLayer in project spatial-portal by AtlasOfLivingAustralia.
the class MapComposer method updateLayerControls.
public void updateLayerControls() {
adjustActiveLayersList();
//remove any scatterplot legend
Component c = getFellowIfAny("scatterplotlayerlegend");
if (c != null) {
c.detach();
}
//remove children
for (int i = layerControls.getChildren().size() - 1; i >= 0; i--) {
layerControls.getChildren().get(i).detach();
}
MapLayer selectedLayer = this.getActiveLayersSelection(false);
if (selectedLayer == null) {
if (activeLayersList.getItemCount() > 0) {
activeLayersList.setSelectedIndex(0);
selectedLayer = (MapLayer) activeLayersList.getModel().getElementAt(0);
} else {
return;
}
}
lblSelectedLayer.setValue(selectedLayer.getDisplayName());
String page;
Window window;
if (selectedLayer.getType() == LayerUtilitiesImpl.SCATTERPLOT) {
page = "WEB-INF/zul/legend/LayerLegendScatterplot.zul";
} else if (selectedLayer.getType() == LayerUtilitiesImpl.MAP) {
page = "WEB-INF/zul/legend/MapOptions.zul";
} else {
Map params = new HashMap();
llc2MapLayer = selectedLayer;
params.put("map_layer", llc2MapLayer);
window = (Window) Executions.createComponents("WEB-INF/zul/legend/LayerLegendGeneral.zul", layerControls, params);
try {
window.doEmbedded();
} catch (Exception e) {
LOGGER.error("error setting up layer legend", e);
}
return;
}
window = (Window) Executions.createComponents(page, layerControls, null);
try {
if (window instanceof HasMapLayer) {
((HasMapLayer) window).setMapLayer(selectedLayer);
}
} catch (Exception e) {
LOGGER.error("failed to set map layer to window: " + (window != null ? window.getId() : "window is null"), e);
}
try {
window.doEmbedded();
} catch (Exception e) {
LOGGER.error("error setting layer legend", e);
}
}
Aggregations