use of org.openforis.idm.metamodel.SpatialReferenceSystem in project collect by openforis.
the class SpatialReferenceSystemsVM method getItemsInternal.
@Override
public List<SpatialReferenceSystem> getItemsInternal() {
CollectSurvey survey = getSurvey();
List<SpatialReferenceSystem> spatialReferenceSystems = survey.getSpatialReferenceSystems();
return spatialReferenceSystems;
}
use of org.openforis.idm.metamodel.SpatialReferenceSystem in project collect by openforis.
the class SpatialReferenceSystemsVM method getAvailablePredefinedSRSs.
public List<String> getAvailablePredefinedSRSs() {
List<SpatialReferenceSystem> currentSRSs = survey.getSpatialReferenceSystems();
List<String> insertedSRSCodes = new ArrayList<String>();
for (SpatialReferenceSystem srs : currentSRSs) {
insertedSRSCodes.add(srs.getId());
}
GeoToolsCoordinateOperations coordinateOperations = (GeoToolsCoordinateOperations) survey.getContext().getCoordinateOperations();
Set<String> availableSRSs = coordinateOperations.getAvailableSRSs();
List<String> result = new ArrayList<String>(availableSRSs);
result.removeAll(insertedSRSCodes);
Collections.sort(result);
return result;
}
use of org.openforis.idm.metamodel.SpatialReferenceSystem in project collect by openforis.
the class SRSFormValidator method validateIdUniqueness.
protected boolean validateIdUniqueness(ValidationContext ctx) {
SurveyObjectBaseVM<SpatialReferenceSystem> viewModel = getVM(ctx);
SpatialReferenceSystem editedItem = viewModel.getEditedItem();
CollectSurvey survey = viewModel.getSurvey();
String id = (String) getValue(ctx, ID_FIELD);
SpatialReferenceSystem existingItem = survey.getSpatialReferenceSystem(id);
if (existingItem != null && !existingItem.equals(editedItem)) {
String message = Labels.getLabel(ITEM_ID_ALREADY_DEFINED_MESSAGE_KEY);
addInvalidMessage(ctx, ID_FIELD, message);
return false;
} else {
return true;
}
}
use of org.openforis.idm.metamodel.SpatialReferenceSystem in project collect by openforis.
the class SRSFormValidator method getSurvey.
private CollectSurvey getSurvey(ValidationContext ctx) {
SurveyObjectBaseVM<SpatialReferenceSystem> viewModel = getVM(ctx);
CollectSurvey survey = viewModel.getSurvey();
return survey;
}
Aggregations