- DirectPosition targetPosition;
- if (!featureStoreCrs.getIdentifiers().contains(nodeCrs.getName())) {
- MathTransform transform;
- try {
- transform = CRS.findMathTransform(nodeCrs, featureStoreCrs);
- targetPosition = transform.transform(nodePosition, null);
- } catch (Exception e) {
- throw new ArgeoException("Cannot transform from " + nodeCrs
- + " to " + featureStoreCrs, e);
- }
+ // FIXME: there is certainly a more standard way to reproject
+ if (!targetCrs.getIdentifiers().contains(crs.getName())) {
+ throw new ArgeoException("Reprojection not yet supported");
+ // MathTransform transform;
+ // try {
+ // transform = CRS.findMathTransform(nodeCrs, featureStoreCrs);
+ // if (geometry instanceof Point) {
+ // Point point = (Point) geometry;
+ // DirectPosition2D pos = new DirectPosition2D(nodeCrs,
+ // point.getX(), point.getY());
+ // DirectPosition targetPos = transform.transform(pos, null);
+ // return geometryFactory.createPoint(new Coordinate(targetPos
+ // .getCoordinate()[0], targetPos.getCoordinate()[1]));
+ // } else if (geometry instanceof Polygon) {
+ // Polygon polygon = (Polygon) geometry;
+ // List<Coordinate> coordinates = new ArrayList<Coordinate>();
+ // for (Coordinate coo : polygon.getExteriorRing()) {
+ // DirectPosition pos = new DirectPosition2D(nodeCrs,
+ // coo.x, coo.y);
+ // DirectPosition targetPos = transform.transform(pos,
+ // null);
+ // // coordinates.add(o)
+ // }
+ // LinearRing ring = geometryFactory
+ // .createLinearRing(coordinates
+ // .toArray(new Coordinate[coordinates.size()]));
+ // return geometryFactory.createPolygon(ring, null);
+ // }
+ // } catch (Exception e) {
+ // throw new ArgeoException("Cannot transform from " + nodeCrs
+ // + " to " + featureStoreCrs, e);
+ // }