@Override public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) { if (googleMap != null) { String sourceCrs = map.getMapModel().getCrs(); if (isGoogleProjection(sourceCrs)) { int zoomLevel = calcZoomLevel(map.getMapModel().getMapView().getCurrentScale()); Coordinate latLon = convertToLatLon(bounds.getCenterPoint()); fitGoogleMapBounds(googleMap, latLon, zoomLevel); } else { // transform on server TransformGeometryRequest request = new TransformGeometryRequest(); request.setBounds( new org.geomajas.geometry.Bbox( bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight())); request.setSourceCrs(map.getMapModel().getCrs()); request.setTargetCrs(EPSG_3857); GwtCommand command = new GwtCommand(TransformGeometryRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance() .execute( command, new AbstractCommandCallback<TransformGeometryResponse>() { public void execute(TransformGeometryResponse response) { Bbox google = new Bbox(response.getBounds()); int zoomLevel = calcZoomLevelFromBounds(google); fitGoogleMapBounds( googleMap, convertToLatLon(google.getCenterPoint()), zoomLevel); } }); } } }
private void calculate(final GeometryArrayFunction callback) { geometry.setPrecision(-1); splitLine.setPrecision(-1); GeometrySplitRequest request = new GeometrySplitRequest(geometry, splitLine); GwtCommand command = new GwtCommand(GeometrySplitRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance() .execute( command, new AbstractCommandCallback<GeometrySplitResponse>() { public void execute(GeometrySplitResponse response) { callback.execute( response .getGeometries() .toArray(new Geometry[response.getGeometries().size()])); } }); }