use of au.org.ala.legend.Facet in project spatial-portal by AtlasOfLivingAustralia.
the class LayerLegendScatterplotController method registerScatterPlotSelection.
private void registerScatterPlotSelection() {
try {
if (data.getLayer1() != null && data.getLayer1().length() > 0 && data.getLayer2() != null && data.getLayer2().length() > 0) {
Facet f = getFacetIn();
int count = 0;
if (f != null) {
Query q = data.getQuery().newFacet(f, false);
count = q.getOccurrenceCount();
}
updateCount(String.valueOf(count));
}
} catch (Exception e) {
LOGGER.error("error updating scatterplot selection", e);
clearSelection();
getMapComposer().applyChange(mapLayer);
}
}
use of au.org.ala.legend.Facet in project spatial-portal by AtlasOfLivingAustralia.
the class AddFacetController method onClick$btnOk.
public void onClick$btnOk(Event event) {
if (btnOk.isDisabled()) {
return;
}
try {
if (!hasCustomArea && (isAreaCustom() || isAreaHighlightCustom())) {
this.doOverlapped();
this.setTop("-9999px");
this.setLeft("-9999px");
Map<String, Object> winProps = new HashMap<String, Object>();
winProps.put(StringConstants.PARENT, this);
winProps.put(StringConstants.PARENTNAME, "Tool");
winProps.put(StringConstants.SELECTEDMETHOD, selectedMethod);
List<MapLayer> layers = getMapComposer().getPolygonLayers();
if (layers != null && !layers.isEmpty()) {
prevTopArea = layers.get(0);
} else {
prevTopArea = null;
}
Window window = (Window) Executions.createComponents("WEB-INF/zul/add/AddArea.zul", this, winProps);
window.setAttribute("winProps", winProps, true);
window.setParent(this);
window.doModal();
return;
}
Div currentDiv = (Div) getFellowIfAny(StringConstants.ATSTEP + currentStep);
Div nextDiv = (Div) getFellowIfAny(StringConstants.ATSTEP + (currentStep + 1));
if (!currentDiv.getZclass().contains(StringConstants.LAST)) {
currentDiv.setVisible(false);
nextDiv.setVisible(true);
Html previousStepCompletedImg = (Html) getFellowIfAny(StringConstants.IMG_COMPLETED_STEP + (currentStep));
previousStepCompletedImg.setVisible(true);
Label previousStepLabel = (Label) getFellowIfAny(StringConstants.LBLSTEP + (currentStep));
previousStepLabel.setStyle(StringConstants.FONT_WEIGHT_NORMAL);
Label currentStepLabel = (Label) getFellowIfAny(StringConstants.LBLSTEP + (currentStep + 1));
currentStepLabel.setStyle(StringConstants.FONT_WEIGHT_BOLD);
currentStep++;
updateWindowTitle();
fixFocus();
sa = getSelectedArea();
query = QueryUtil.queryFromSelectedArea(query, sa, false, getGeospatialKosher());
if (query != null) {
List<QueryField> fields = query.getFacetFieldList();
Collections.sort(fields, new QueryField.QueryFieldComparator());
String lastGroup = null;
for (QueryField field : fields) {
String newGroup = field.getGroup().getName();
if (!newGroup.equals(lastGroup)) {
Comboitem sep = new Comboitem(StringConstants.SEPERATOR);
sep.setLabel("---------------" + StringUtils.center(newGroup, 19) + "---------------");
sep.setParent(cbColour);
sep.setDisabled(true);
lastGroup = newGroup;
}
Comboitem ci = new Comboitem(field.getDisplayName());
ci.setValue(field.getName());
ci.setParent(cbColour);
}
}
btnBack.setDisabled(false);
btnOk.setDisabled(true);
} else {
if (selectedList.size() == 0) {
btnOk.setDisabled(true);
}
Facet f = Facet.parseFacet(getSelectionFacet());
Query querynew = query.newFacet(f, true);
if (querynew.getOccurrenceCount() <= 0) {
getMapComposer().showMessage(CommonData.lang(StringConstants.NO_OCCURRENCES_SELECTED));
} else {
getMapComposer().mapSpecies(querynew, StringConstants.MY_FACET, StringConstants.SPECIES, -1, LayerUtilitiesImpl.SPECIES, null, 0, MapComposer.DEFAULT_POINT_SIZE, MapComposer.DEFAULT_POINT_OPACITY, Util.nextColour(), false);
this.detach();
}
}
} catch (Exception ex) {
LOGGER.error("error adding facet", ex);
}
fixFocus();
}
use of au.org.ala.legend.Facet in project spatial-portal by AtlasOfLivingAustralia.
the class AddFacetController method onClick$dbutton.
public void onClick$dbutton(Event event) {
uncheckAll();
minValue = dmin.getValue();
maxValue = dmax.getValue();
//get count and display
Facet f = Facet.parseFacet(getSelectionFacet());
Query querynew = query.newFacet(f, true);
lblOccurrencesSelected.setValue(querynew.getOccurrenceCount() + " occurrences selected");
}
use of au.org.ala.legend.Facet in project spatial-portal by AtlasOfLivingAustralia.
the class AreaEnvironmentalEnvelope method getFacets.
List<Facet> getFacets() {
List<Facet> facets = new ArrayList<Facet>();
for (int i = 0; i < selectedLayers.size(); i++) {
SPLFilter splf = selectedSPLFilterLayers.get(selectedLayers.get(i).get(StringConstants.ID));
Facet f = new Facet(CommonData.getLayerFacetName(splf.getLayername()), splf.getMinimumValue(), splf.getMaximumValue(), true);
facets.add(f);
}
return facets;
}
use of au.org.ala.legend.Facet in project spatial-portal by AtlasOfLivingAustralia.
the class ClassificationLegend method updateD.
void updateD() {
if (!dmin.isDisabled()) {
double range = gMaxValue - gMinValue;
if (range > 0) {
dmin.setValue(minValue);
dmax.setValue(maxValue);
mapLayer.setHighlight(getSelectionFacet());
Facet f = Facet.parseFacet(getSelectionFacet());
int occurrencesCount = query.getOccurrenceCount();
if (f != null) {
occurrencesCount = query.newFacet(f, false).getOccurrenceCount();
}
String minText = minValue == (int) minValue ? String.valueOf((int) minValue) : String.format("%f", minValue);
String maxText = maxValue == (int) maxValue ? String.valueOf((int) maxValue) : String.format("%f", maxValue);
String unknownText = dunknown.isChecked() ? " +Unknown" : " ";
String selectedText;
if (occurrencesCount == query.getOccurrenceCount()) {
selectedText = String.format(" (all of %d records selected)", occurrencesCount);
} else {
selectedText = String.format(" (%d of %d records selected)", occurrencesCount, query.getOccurrenceCount());
}
createInGroup.setVisible(!disableselection && occurrencesCount != 0 && occurrencesCount != query.getOccurrenceCount());
if (createOutGroup != null)
createOutGroup.setVisible(!disableselection && occurrencesCount != 0 && occurrencesCount != query.getOccurrenceCount());
clearSelection.setVisible(!disableselection && occurrencesCount != 0 && occurrencesCount != query.getOccurrenceCount());
dlabel.setValue(minText + " to " + maxText + unknownText + selectedText);
getMapComposer().applyChange(mapLayer);
}
} else {
dlabel.setValue("list selection underway, range selection disabled");
}
}
Aggregations