Пример #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());
   }
 }
Пример #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;
   }
 }