Search in sources :

Example 1 with StringWrapper

use of eu.europa.ec.fisheries.uvms.commons.geometry.model.StringWrapper in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripIdWithGeometryMapper method getGeometryMultiPointForAllFishingActivities.

private String getGeometryMultiPointForAllFishingActivities(List<FishingActivityEntity> fishingActivities) {
    if (CollectionUtils.isEmpty(fishingActivities) || fishingActivities.get(0) == null) {
        return null;
    }
    String GeometryWkt = null;
    List<Geometry> activityGeomList = new ArrayList<>();
    for (FishingActivityEntity fishingActivityEntity : fishingActivities) {
        if (fishingActivityEntity.getGeom() != null) {
            activityGeomList.add(fishingActivityEntity.getGeom());
        }
    }
    if (CollectionUtils.isNotEmpty(activityGeomList)) {
        Geometry geometry = GeometryUtils.createMultipoint(activityGeomList);
        StringWrapper stringWrapper = GeometryMapper.INSTANCE.geometryToWkt(geometry);
        if (stringWrapper != null) {
            return stringWrapper.getValue();
        }
    }
    return GeometryWkt;
}
Also used : FishingTripIdWithGeometry(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry) Geometry(com.vividsolutions.jts.geom.Geometry) StringWrapper(eu.europa.ec.fisheries.uvms.commons.geometry.model.StringWrapper) ArrayList(java.util.ArrayList) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Aggregations

Geometry (com.vividsolutions.jts.geom.Geometry)1 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingTripIdWithGeometry (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripIdWithGeometry)1 StringWrapper (eu.europa.ec.fisheries.uvms.commons.geometry.model.StringWrapper)1 ArrayList (java.util.ArrayList)1