Exemplo n.º 1
0
 @Override
 public boolean contains(HorizontalPosition position) {
   if (position == null) return false;
   if (GISUtils.crsMatch(crs, position.getCoordinateReferenceSystem())) {
     return xAxis.contains(position.getX()) && yAxis.contains(position.getY());
   } else {
     HorizontalPosition transformedPos = GISUtils.transformPosition(position, crs);
     return xAxis.contains(transformedPos.getX()) && yAxis.contains(transformedPos.getY());
   }
 }
Exemplo n.º 2
0
 @Override
 public GridCoordinates2D findIndexOf(HorizontalPosition position) {
   int x;
   int y;
   if (GISUtils.crsMatch(position.getCoordinateReferenceSystem(), crs)) {
     x = xAxis.findIndexOf(position.getX());
     y = yAxis.findIndexOf(position.getY());
   } else {
     HorizontalPosition gridPos = GISUtils.transformPosition(position, crs);
     x = xAxis.findIndexOf(gridPos.getX());
     y = yAxis.findIndexOf(gridPos.getY());
   }
   if (x >= 0 && y >= 0) {
     return new GridCoordinates2D(x, y);
   } else {
     return null;
   }
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   AbstractHorizontalGrid other = (AbstractHorizontalGrid) obj;
   if (crs == null) {
     if (other.crs != null) return false;
   } else if (!GISUtils.crsMatch(crs, other.crs)) return false;
   return true;
 }
Exemplo n.º 4
0
 @Override
 public GeographicBoundingBox getGeographicBoundingBox() {
   return GISUtils.toGeographicBoundingBox(getBoundingBox());
 }