Ejemplo n.º 1
0
  /**
   * Conversion de Jts Polygon en Kml Polygon
   *
   * @param polygon
   * @return
   */
  private de.micromata.opengis.kml.v_2_2_0.Polygon getAsKmlPolygon(Polygon polygon) {

    de.micromata.opengis.kml.v_2_2_0.Polygon kmlPolygon =
        new de.micromata.opengis.kml.v_2_2_0.Polygon();

    // Ring exterieur
    LineString jtsExteriorRing = polygon.getExteriorRing();
    kmlPolygon
        .createAndSetOuterBoundaryIs()
        .setLinearRing(getAsKmlRing(jtsExteriorRing.getCoordinates()));

    // Rings interieurs
    for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
      kmlPolygon
          .createAndAddInnerBoundaryIs()
          .setLinearRing(getAsKmlRing(polygon.getInteriorRingN(i).getCoordinates()));
    }

    return kmlPolygon;
  }
Ejemplo n.º 2
0
 @Override
 public Polygon clone() {
   Polygon copy;
   copy = ((Polygon) super.clone());
   copy.outerBoundaryIs =
       ((outerBoundaryIs == null) ? null : ((Boundary) outerBoundaryIs.clone()));
   copy.innerBoundaryIs = new ArrayList<Boundary>((getInnerBoundaryIs().size()));
   for (Boundary iter : innerBoundaryIs) {
     copy.innerBoundaryIs.add(iter.clone());
   }
   copy.polygonSimpleExtension = new ArrayList<Object>((getPolygonSimpleExtension().size()));
   for (Object iter : polygonSimpleExtension) {
     copy.polygonSimpleExtension.add(iter);
   }
   copy.polygonObjectExtension =
       new ArrayList<AbstractObject>((getPolygonObjectExtension().size()));
   for (AbstractObject iter : polygonObjectExtension) {
     copy.polygonObjectExtension.add(iter.clone());
   }
   return copy;
 }