use of org.openforis.idm.model.CoordinateAttribute in project collect by openforis.
the class CoordinateColumnProvider method extractValue.
@Override
protected String extractValue(Attribute<?, ?> attr, String fieldName) {
if (KML_FIELD_NAME.equals(fieldName)) {
if (attr.isEmpty()) {
return "";
} else {
CoordinateAttribute coordAttr = (CoordinateAttribute) attr;
String kml = String.format(kmlFormat, coordAttr.getXField().getValue(), coordAttr.getYField().getValue());
return kml;
}
} else {
return super.extractValue(attr, fieldName);
}
}
use of org.openforis.idm.model.CoordinateAttribute in project collect by openforis.
the class CoordinateAttributeMapper method setFields.
@Override
void setFields(Node<?> node, InsertSetStep<?> insert) {
CoordinateAttribute c = (CoordinateAttribute) node;
Coordinate value = c.getValue();
if (value != null) {
insert.set(DATA.NUMBER1, toNumeric(value.getX()));
insert.set(DATA.NUMBER2, toNumeric(value.getY()));
// insert.set(DATA.NUMBER3, toNumeric(value.getZ()));
insert.set(DATA.TEXT1, value.getSrsId());
}
}
use of org.openforis.idm.model.CoordinateAttribute in project collect by openforis.
the class DistanceCheckTest method testValidMaxDistance.
@Test
public void testValidMaxDistance() {
String coordStr = "SRID=EPSG:21035;POINT(805750 9333820)";
Coordinate coord = Coordinate.parseCoordinate(coordStr);
EntityBuilder.addValue(cluster, "id", new Code("001"));
CoordinateAttribute vehicleLocation = EntityBuilder.addValue(cluster, "vehicle_location", coord);
ValidationResults results = validate(vehicleLocation);
Assert.assertFalse(containsDistanceCheck(results.getErrors()));
}
use of org.openforis.idm.model.CoordinateAttribute in project collect by openforis.
the class GeoDataController method loadCoordinateValues.
@RequestMapping(value = "survey/{surveyId}/data/coordinatevalues.json", method = GET)
@ResponseBody
public List<CoordinateAttributePoint> loadCoordinateValues(@PathVariable int surveyId, @RequestParam int coordinateAttributeId, @RequestParam String srsId, @RequestParam int recordOffset, @RequestParam int maxNumberOfRecords) throws Exception {
final List<CoordinateAttributePoint> result = new ArrayList<CoordinateAttributePoint>();
CollectSurvey survey = surveyManager.loadSurvey(surveyId);
extractAllRecordCoordinates(survey, recordOffset, maxNumberOfRecords, coordinateAttributeId, srsId, new CoordinateProcessor() {
public void process(CollectRecord record, CoordinateAttribute coordAttr, Coordinate coordinate) {
CoordinateAttributePoint point = new CoordinateAttributePoint(coordAttr, coordinate);
result.add(point);
}
});
return result;
}
Aggregations