use of au.org.emii.portal.menu.SelectedArea in project spatial-portal by AtlasOfLivingAustralia.
the class AddFacetController method getSelectedArea.
public SelectedArea getSelectedArea() {
String area = rAreaSelected.getValue();
SelectedArea selectedarea = null;
try {
if (StringConstants.CURRENT.equals(area)) {
selectedarea = new SelectedArea(null, getMapComposer().getViewArea());
} else if (StringConstants.AUSTRALIA.equals(area)) {
selectedarea = new SelectedArea(null, CommonData.getSettings().getProperty(CommonData.AUSTRALIA_WKT));
} else if (StringConstants.WORLD.equals(area)) {
selectedarea = new SelectedArea(null, CommonData.WORLD_WKT);
} else {
List<MapLayer> layers = getMapComposer().getPolygonLayers();
for (MapLayer ml : layers) {
if (area.equals(ml.getName())) {
selectedarea = new SelectedArea(ml, null);
break;
}
}
//for 'all areas'
if (selectedarea == null) {
selectedarea = new SelectedArea(null, area);
}
}
} catch (Exception e) {
LOGGER.error("Unable to retrieve selected area", e);
}
return selectedarea;
}
use of au.org.emii.portal.menu.SelectedArea in project spatial-portal by AtlasOfLivingAustralia.
the class AddSpeciesInArea method onFinish.
public void onFinish() {
try {
SelectedArea sa = getSelectedArea();
boolean setupMetadata = true;
MapLayer ml = null;
Query q = QueryUtil.queryFromSelectedArea(query, sa, true, geospatialKosher);
if (byLsid) {
ml = getMapComposer().mapSpecies(q, name, s, featureCount, type, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), expertDistributions);
} else if (filter) {
ml = getMapComposer().mapSpecies(q, name, s, featureCount, type, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), expertDistributions);
} else if (filterGrid) {
ml = getMapComposer().mapSpecies(q, name, s, featureCount, type, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), expertDistributions);
} else if (rank != null && taxon != null && q != null) {
ml = getMapComposer().mapSpecies(q, taxon, rank, -1, LayerUtilitiesImpl.SPECIES, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), expertDistributions);
setupMetadata = false;
} else {
int resultsCountOccurrences = q.getOccurrenceCount();
//test limit
if (resultsCountOccurrences > 0 && resultsCountOccurrences <= Integer.parseInt(CommonData.getSettings().getProperty(StringConstants.MAX_RECORD_COUNT_MAP))) {
String activeAreaLayerName = getSelectedAreaDisplayName();
String layerName = CommonData.lang("occurrences_in_area_prefix") + " " + activeAreaLayerName;
if (multipleSpeciesUploadName != null) {
layerName = multipleSpeciesUploadName;
} else {
if (q instanceof BiocacheQuery) {
String lsids = ((BiocacheQuery) q).getLsids();
if (lsids != null && lsids.length() > 0 && lsids.split(",").length > 1) {
layerName = CommonData.lang("species_assemblage_layer_name");
}
}
}
ml = getMapComposer().mapSpecies(q, layerName, StringConstants.SPECIES, resultsCountOccurrences, LayerUtilitiesImpl.SPECIES, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), expertDistributions);
} else {
getMapComposer().showMessage(CommonData.lang("error_too_many_occurrences_for_mapping").replace("<counted_occurrences>", resultsCountOccurrences + "").replace("<max_occurrences>", CommonData.getSettings().getProperty(StringConstants.MAX_RECORD_COUNT_MAP)));
}
setupMetadata = false;
}
if (setupMetadata) {
ml.getMapLayerMetadata().setMoreInfo(metadata);
}
LOGGER.debug("metadata: " + metadata);
} catch (Exception e) {
LOGGER.error("error adding species in area to map", e);
}
}
use of au.org.emii.portal.menu.SelectedArea in project spatial-portal by AtlasOfLivingAustralia.
the class AreaReportController method onMapSpeciesKosher.
public void onMapSpeciesKosher(Event event) {
try {
SelectedArea sa;
if (!StringConstants.CURRENT_EXTENT.equalsIgnoreCase(areaName)) {
sa = selectedArea;
} else {
sa = new SelectedArea(null, getMapComposer().getViewArea());
}
Query baseQuery = null;
if (event != null && event.getData() != null) {
baseQuery = new BiocacheQuery(null, null, (String) event.getData(), null, false, null);
}
Query query = QueryUtil.queryFromSelectedArea(baseQuery, sa, true, new boolean[] { true, false, false });
query = query.newFacet(new Facet("occurrence_status_s", "absent", false), false);
String activeAreaLayerName = getMapComposer().getNextActiveAreaLayerName(areaDisplayName + " geospatial kosher");
getMapComposer().mapSpecies(query, activeAreaLayerName, StringConstants.SPECIES, -1, LayerUtilitiesImpl.SPECIES, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), false);
} catch (Exception e) {
LOGGER.error("error mapping kosher species in area", e);
}
}
use of au.org.emii.portal.menu.SelectedArea in project spatial-portal by AtlasOfLivingAustralia.
the class PhylogeneticDiversityListResults method populateList.
public void populateList() {
areaPds = new ArrayList<Map<String, String>>();
areaSpeciesMatches = new ArrayList<Map<String, JSONArray>>();
try {
for (int i = 0; i < selectedAreas.size(); i++) {
SelectedArea sa = selectedAreas.get(i);
evalArea(sa);
}
makeCSV();
fillPDTreeList();
} catch (Exception e) {
LOGGER.error("error reading Phylogenetic Diversity list data", e);
getMapComposer().showMessage("Unknown error.");
this.detach();
}
}
use of au.org.emii.portal.menu.SelectedArea in project spatial-portal by AtlasOfLivingAustralia.
the class AreaReportController method onMapSpecies.
public void onMapSpecies(Event event) {
try {
SelectedArea sa;
if (!StringConstants.CURRENT_EXTENT.equalsIgnoreCase(areaName)) {
sa = selectedArea;
} else {
sa = new SelectedArea(null, getMapComposer().getViewArea());
}
Query baseQuery = null;
if (event != null && event.getData() != null) {
baseQuery = new BiocacheQuery(null, null, (String) event.getData(), null, false, null);
}
Query query = QueryUtil.queryFromSelectedArea(baseQuery, sa, true, new boolean[] { true, true, false });
query = query.newFacet(new Facet("occurrence_status_s", "absent", false), false);
String activeAreaLayerName = getMapComposer().getNextActiveAreaLayerName(areaDisplayName);
getMapComposer().mapSpecies(query, activeAreaLayerName, StringConstants.SPECIES, -1, LayerUtilitiesImpl.SPECIES, null, -1, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), false);
} catch (Exception e) {
LOGGER.error("error mapping species in area", e);
}
}
Aggregations