public static void moveMapTo(OLmaps mp, ShapeValue value) { Coordinate p1 = null, p2 = null; ShapeValue env = new ShapeValue(value.getEnvelope()); try { env = env.transform(Geospace.get().getStraightGeoCRS()); } catch (ThinklabException e2) { throw new ThinklabRuntimeException(e2); } ReferencedEnvelope e = env.getEnvelope(); try { p1 = JTS.transform( new Coordinate(e.getMinX(), e.getMinY()), null, ARIESWebappPlugin.get().geoToGoogleTransform); p2 = JTS.transform( new Coordinate(e.getMaxX(), e.getMaxY()), null, ARIESWebappPlugin.get().geoToGoogleTransform); } catch (TransformException e1) { // shouldn't happen throw new ThinklabRuntimeException(e1); } mp.setBounds(p1.x, p1.y, p2.x, p2.y); }
public void moveMapTo(OLmaps mp, RasterGrid grid) { Coordinate p1 = null, p2 = null; try { p1 = JTS.transform( new Coordinate(grid.getLeft(), grid.getBottom()), null, ARIESWebappPlugin.get().geoToGoogleTransform); p2 = JTS.transform( new Coordinate(grid.getRight(), grid.getTop()), null, ARIESWebappPlugin.get().geoToGoogleTransform); } catch (TransformException e) { // shouldn't happen throw new ThinklabRuntimeException(e); } mp.setBounds(p1.x, p1.y, p2.x, p2.y); }