use of au.org.ala.spatial.composer.progress.ProgressController in project spatial-portal by AtlasOfLivingAustralia.
the class SitesBySpeciesComposer method openProgressBar.
void openProgressBar() {
ProgressController window = (ProgressController) Executions.createComponents("WEB-INF/zul/progress/AnalysisProgress.zul", getMapComposer(), null);
window.setParentWindow(this);
window.start(pid, "Points to Grid");
try {
window.setParent(getMapComposer());
window.doModal();
} catch (Exception e) {
LOGGER.error("error opening AnalysisProgress.zul for points to grid: " + pid, e);
}
}
use of au.org.ala.spatial.composer.progress.ProgressController in project spatial-portal by AtlasOfLivingAustralia.
the class MaxentComposer method openProgressBar.
void openProgressBar() {
ProgressController window = (ProgressController) Executions.createComponents("WEB-INF/zul/progress/AnalysisProgress.zul", getMapComposer(), null);
window.setParentWindow(this);
window.start(pid, StringConstants.PREDICTION, isBackgroundProcess);
try {
window.setParent(getMapComposer());
window.doModal();
} catch (Exception e) {
LOGGER.error("error opening AnaysisProgress.zul for Prediction", e);
}
}
use of au.org.ala.spatial.composer.progress.ProgressController in project spatial-portal by AtlasOfLivingAustralia.
the class ALOCComposer method runclassification.
public boolean runclassification() {
try {
layerLabel = tToolName.getValue();
String sbenvsel = getSelectedLayersWithDisplayNames();
if (sbenvsel.split(":").length > 50) {
getMapComposer().showMessage(sbenvsel.split(":").length + " layers selected. Please select fewer than 50 environmental layers in step 1.");
return false;
}
if (groupCount.getValue() <= 1 || groupCount.getValue() > 200) {
getMapComposer().showMessage("Please enter the number of groups to generate (2 to 200) in step 2.");
return false;
}
SelectedArea sa = getSelectedArea();
//estimate analysis size in bytes
double[][] bbox = null;
//NQ: 20131219 Added extra check because BB is not supplied in all situations with the metadata (ie WKT has been drawn etc) http://code.google.com/p/ala/issues/detail?id=475
if (sa.getMapLayer() != null && sa.getMapLayer().getMapLayerMetadata().getBbox() != null) {
List<Double> bb = sa.getMapLayer().getMapLayerMetadata().getBbox();
bbox = new double[][] { { bb.get(0), bb.get(1) }, { bb.get(2), bb.get(3) } };
} else {
List<Double> bb = Util.getBoundingBox(sa.getWkt());
bbox = new double[][] { { bb.get(0), bb.get(1) }, { bb.get(2), bb.get(3) } };
}
if (bbox == null) {
bbox = new double[][] { { -180, -90 }, { 180, 90 } };
}
long cellsInBBox = (long) ((bbox[1][0] - bbox[0][0]) / 0.01 * (bbox[1][1] - bbox[0][1]) / 0.01);
long size = (groupCount.getValue() + sbenvsel.split(":").length + 2) * cellsInBBox * 4;
LOGGER.debug("ALOC estimate size in MB, cells=" + cellsInBBox + ", bbox=" + bbox[0][0] + "," + bbox[0][1] + "," + bbox[1][0] + "," + bbox[1][1] + ", groups=" + groupCount.getValue() + ", layers=" + sbenvsel.split(":").length + ", size=" + size / 1024 / 1024 + ", max size=" + CommonData.getSettings().getProperty("aloc_size_limit_in_mb"));
if (size / 1024 / 1024 > Integer.parseInt(CommonData.getSettings().getProperty("aloc_size_limit_in_mb"))) {
getMapComposer().showMessage("Analysis is too large. Reduce the number of groups, number of layers or area.", this);
return false;
}
HttpClient client = new HttpClient();
PostMethod get = new PostMethod((CommonData.getSatServer() + "/ws/aloc?") + "gc=" + URLEncoder.encode(String.valueOf(groupCount.getValue()), StringConstants.UTF_8) + "&envlist=" + URLEncoder.encode(sbenvsel, StringConstants.UTF_8));
String area;
if (sa.getMapLayer() != null && sa.getMapLayer().getEnvelope() != null) {
area = StringConstants.ENVELOPE + "(" + sa.getMapLayer().getEnvelope() + ")";
} else {
area = sa.getWkt();
}
get.addParameter(StringConstants.AREA, area);
get.addRequestHeader(StringConstants.ACCEPT, StringConstants.TEXT_PLAIN);
client.executeMethod(get);
String slist = get.getResponseBodyAsString();
generationCount++;
pid = slist;
legendPath = "/WEB-INF/zul/legend/LayerLegendClassification.zul?pid=" + pid + "&layer=" + URLEncoder.encode(layerLabel, StringConstants.UTF_8);
try {
remoteLogger.logMapAnalysis(tToolName.getValue(), "Tool - Classification", area, "", sbenvsel, pid, "gc: " + groupCount.getValue(), StringConstants.STARTED);
} catch (Exception e) {
LOGGER.error("error with remote logger", e);
}
ProgressController window = (ProgressController) Executions.createComponents("WEB-INF/zul/progress/AnalysisProgress.zul", getMapComposer(), null);
window.setParentWindow(this);
window.start(pid, StringConstants.CLASSIFICATION);
window.setParent(getMapComposer());
window.doModal();
this.setVisible(false);
return true;
} catch (Exception ex) {
LOGGER.error("error opening AnalysisProgress.zul for classification: " + pid, ex);
getMapComposer().showMessage("Unknown error.", this);
}
return false;
}
use of au.org.ala.spatial.composer.progress.ProgressController in project spatial-portal by AtlasOfLivingAustralia.
the class ImportAnalysisController method openProgressBarSxS.
void openProgressBarSxS() {
ProgressController window = (ProgressController) Executions.createComponents("WEB-INF/zul/progress/AnalysisProgress.zul", getMapComposer(), null);
window.setParentWindow(this);
window.start(pid, "Points to Grid");
try {
window.setParent(getMapComposer());
window.doModal();
} catch (Exception e) {
LOGGER.error("error opening sites by species progress bar pid=" + pid, e);
}
}
use of au.org.ala.spatial.composer.progress.ProgressController in project spatial-portal by AtlasOfLivingAustralia.
the class ImportAnalysisController method openProgressBarMaxent.
void openProgressBarMaxent() {
ProgressController window = (ProgressController) Executions.createComponents("WEB-INF/zul/progress/AnalysisProgress.zul", getMapComposer(), null);
window.setParentWindow(this);
window.start(pid, StringConstants.PREDICTION);
try {
window.setParent(getMapComposer());
window.doModal();
} catch (Exception e) {
LOGGER.error("error opening prediction progress bar pid=" + pid, e);
}
}
Aggregations