Search in sources :

Example 1 with NewLocation

use of org.activityinfo.geoadmin.model.NewLocation in project activityinfo by bedatadriven.

the class LocationImportWindow method doImport.

private void doImport() {
    int nameIndex = importForm.getNameAttributeIndex();
    List<NewLocation> newLocations = Lists.newArrayList();
    for (LocationFeature location : locations) {
        Point point = location.getPoint();
        NewLocation newLocation = new NewLocation();
        newLocation.setName(truncate(location.getFeature().getAttributeStringValue(nameIndex)));
        newLocation.setLongitude(point.getX());
        newLocation.setLatitude(point.getY());
        for (AdminEntity entity : location.getEntities().values()) {
            newLocation.getAdminEntityIds().add(entity.getId());
        }
        newLocations.add(newLocation);
    }
    client.postNewLocations(locationTypeId, newLocations);
    setVisible(false);
}
Also used : AdminEntity(org.activityinfo.geoadmin.model.AdminEntity) NewLocation(org.activityinfo.geoadmin.model.NewLocation) Point(com.vividsolutions.jts.geom.Point) Point(com.vividsolutions.jts.geom.Point)

Aggregations

Point (com.vividsolutions.jts.geom.Point)1 AdminEntity (org.activityinfo.geoadmin.model.AdminEntity)1 NewLocation (org.activityinfo.geoadmin.model.NewLocation)1