use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class GeoFunctions method latLong.
protected static Coordinate latLong(ExpressionContext expressionContext, Coordinate coordinate) {
if (coordinate == null || !coordinate.isComplete()) {
return null;
}
Survey survey = getSurvey(expressionContext);
CoordinateOperations coordinateOperations = survey.getContext().getCoordinateOperations();
if (coordinateOperations == null) {
return null;
} else {
return coordinateOperations.convertToWgs84(coordinate);
}
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class IDMFunctions method samplingPointCoordinateLookup.
private static Coordinate samplingPointCoordinateLookup(ExpressionContext context, String... keys) {
if (validateSamplingPointKeys(keys)) {
LookupProvider lookupProvider = getLookupProvider(context);
Survey survey = getSurvey(context);
Coordinate coordinate = lookupProvider.lookupSamplingPointCoordinate(survey, keys);
return coordinate;
} else {
return null;
}
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class IDMFunctions method lookup.
private static Object lookup(ExpressionContext context, String name, String attribute, String... keys) {
LookupProvider lookupProvider = getLookupProvider(context);
Survey survey = getSurvey(context);
Object result = lookupProvider.lookup(survey, name, attribute, (Object[]) keys);
if (result == null) {
return null;
} else if (LOCATION_ATTRIBUTE.equalsIgnoreCase(attribute)) {
// convert to Coordinate
Coordinate coordinate = Coordinate.parseCoordinate(result.toString());
return coordinate;
} else {
return result;
}
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class UIOptionsBinderTest method createTestSurvey.
private Survey createTestSurvey() {
Survey survey = context.createSurvey();
survey.setName("test");
survey.setUri("http://www.openforis.org/test");
survey.addLanguage("en");
return survey;
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class AbstractTest method createTestSurvey.
protected static Survey createTestSurvey() throws IdmlParseException {
InputStream is = AbstractTest.class.getClassLoader().getResourceAsStream("test.idm.xml");
SurveyContext surveyContext = new TestSurveyContext();
SurveyIdmlBinder parser = new SurveyIdmlBinder(surveyContext);
Survey survey = parser.unmarshal(is);
return survey;
}
Aggregations