Ejemplo n.º 1
0
 public WGS84BoundingBoxType(final GeographicBoundingBox inputGeoBox) {
   super(
       null,
       inputGeoBox.getWestBoundLongitude(),
       inputGeoBox.getSouthBoundLatitude(),
       inputGeoBox.getEastBoundLongitude(),
       inputGeoBox.getNorthBoundLatitude());
 }
  private Geometry getGeographicBoundingBox(CoordinateReferenceSystem crs) {
    GeographicBoundingBox envelope = CRS.getGeographicBoundingBox(crs);
    if (envelope == null) {
      return null;
    }

    final double westBoundLongitude = envelope.getWestBoundLongitude();
    final double eastBoundLongitude = envelope.getEastBoundLongitude();
    final double southBoundLatitude = envelope.getSouthBoundLatitude();
    final double northBoundLatitude = envelope.getNorthBoundLatitude();

    final int numSteps = 80;
    Geometry geogBoundingGeom;

    if (westBoundLongitude < eastBoundLongitude) {
      geogBoundingGeom =
          createBoundingPolygon(
              westBoundLongitude,
              eastBoundLongitude,
              southBoundLatitude,
              northBoundLatitude,
              numSteps);
    } else {
      // the geographic bounds cross the day line (lon -180/180), trick it into two adjacent
      // polygons
      Polygon eastPolygon =
          createBoundingPolygon(
              -180, eastBoundLongitude, southBoundLatitude, northBoundLatitude, numSteps);

      Polygon westPolygon =
          createBoundingPolygon(
              westBoundLongitude, 180, southBoundLatitude, northBoundLatitude, numSteps);

      geogBoundingGeom = gf.createMultiPolygon(new Polygon[] {eastPolygon, westPolygon});
    }
    return geogBoundingGeom;
  }
Ejemplo n.º 3
0
 /** Build a new bounding box. */
 public EXGeographicBoundingBox(final GeographicBoundingBox geoBox) {
   this.westBoundLongitude = geoBox.getWestBoundLongitude();
   this.southBoundLatitude = geoBox.getSouthBoundLatitude();
   this.eastBoundLongitude = geoBox.getEastBoundLongitude();
   this.northBoundLatitude = geoBox.getNorthBoundLatitude();
 }