Search in sources :

Example 6 with SpatialReferenceSystem

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;
}
Also used : SpatialReferenceSystem(org.openforis.idm.metamodel.SpatialReferenceSystem) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 7 with SpatialReferenceSystem

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;
}
Also used : SpatialReferenceSystem(org.openforis.idm.metamodel.SpatialReferenceSystem) ArrayList(java.util.ArrayList) GeoToolsCoordinateOperations(org.openforis.collect.geospatial.GeoToolsCoordinateOperations)

Example 8 with SpatialReferenceSystem

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;
    }
}
Also used : SpatialReferenceSystem(org.openforis.idm.metamodel.SpatialReferenceSystem) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 9 with SpatialReferenceSystem

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;
}
Also used : SpatialReferenceSystem(org.openforis.idm.metamodel.SpatialReferenceSystem) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Aggregations

SpatialReferenceSystem (org.openforis.idm.metamodel.SpatialReferenceSystem)9 CollectSurvey (org.openforis.collect.model.CollectSurvey)4 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)2 Coordinate (org.openforis.idm.model.Coordinate)2 ArrayList (java.util.ArrayList)1 GeoToolsCoordinateOperations (org.openforis.collect.geospatial.GeoToolsCoordinateOperations)1 NodeChangeSet (org.openforis.collect.model.NodeChangeSet)1 CoordinateOperationException (org.openforis.idm.geospatial.CoordinateOperationException)1 CoordinateAttributeDefinition (org.openforis.idm.metamodel.CoordinateAttributeDefinition)1 Survey (org.openforis.idm.metamodel.Survey)1 CoordinateAttribute (org.openforis.idm.model.CoordinateAttribute)1 FactoryException (org.opengis.referencing.FactoryException)1 CRSAuthorityFactory (org.opengis.referencing.crs.CRSAuthorityFactory)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1 TransformException (org.opengis.referencing.operation.TransformException)1 InternationalString (org.opengis.util.InternationalString)1