Ejemplo n.º 1
0
  @Override
  public Polygon createDomainObject(PolygonDTO polygonDTO) throws AssemblyException {

    Polygon polygon = new Polygon();

    Collection<List<List<Double>>> coordinates = new ArrayList<List<List<Double>>>();

    Collection<LineStringDTO> collectionLineString = polygonDTO.getCollectionLineStringDTO();

    for (LineStringDTO lineStringDTO : collectionLineString) {
      LineString lineString = lineStringAssembler.createDomainObject(lineStringDTO);
      List<List<Double>> coordinatesLineString = lineString.getCoordinates();
      coordinates.add(coordinatesLineString);
    }

    polygon.setCoordinates(coordinates);

    return polygon;
  }
Ejemplo n.º 2
0
  @Override
  public PolygonDTO createDataTransferObject(Polygon polygon) throws AssemblyException {

    PolygonDTO polygonDTO = new PolygonDTO();
    List<LineStringDTO> collectionLineStringDTO = new ArrayList<LineStringDTO>();

    Collection<List<List<Double>>> collectionCoordinates = polygon.getCoordinates();

    for (List<List<Double>> coordinates : collectionCoordinates) {
      LineString lineString = new LineString();
      lineString.setCoordinates(coordinates);
      LineStringDTO lineStringDTO = lineStringAssembler.createDataTransferObject(lineString);
      collectionLineStringDTO.add(lineStringDTO);
    }

    polygonDTO.setCollectionLineStringDTO(collectionLineStringDTO);

    return polygonDTO;
  }