@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { LOGGER.log(Level.FINE, "Computing bounds from native CRS"); ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); ReferencedEnvelope nativeBBox = cb.getBoundsFromCRS(resource); if (nativeBBox != null) { nativeBoundsPanel.setModelObject(nativeBBox); } target.add(nativeBoundsPanel); }
@Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); try { CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); if (crs == null) return; ReferencedEnvelope refEnv = new ReferencedEnvelope(CRS.getEnvelope(crs)); envelopePanel.setModelObject(refEnv); envelopePanel.modelChanged(); target.add(envelopePanel); } catch (Exception e) { throw new WicketRuntimeException(e); } }
@Override public void onSubmit(final AjaxRequestTarget target, Form form) { // perform manual processing otherwise the component contents won't be updated form.process(); ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); try { CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); ReferencedEnvelope bounds = cb.getNativeBounds(resource); resource.setNativeBoundingBox(bounds); nativeBBox.setModelObject(bounds); } catch(IOException e) { LOGGER.log(Level.SEVERE, "Error computing the native BBOX", e); error("Error computing the native BBOX:" + e.getMessage()); } target.addComponent(nativeBBox); }
@Override public void onSubmit(final AjaxRequestTarget target, Form form) { // perform manual processing otherwise the component contents won't be updated form.process(null); ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); try { CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); ReferencedEnvelope bounds = cb.getNativeBounds(resource); resource.setNativeBoundingBox(bounds); nativeBBox.setModelObject(bounds); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error computing the native BBOX", e); error("Error computing the native BBOX:" + e.getMessage()); } target.add(nativeBBox); }
@Override protected void onClick(AjaxRequestTarget target, Form form) { // perform manual processing of the required fields nativeBBox.processInput(); declaredCRS.processInput(); ReferencedEnvelope nativeBounds = (ReferencedEnvelope) nativeBBox.getModelObject(); try { // if the native bounds are not around compute them if(nativeBounds == null) { ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); nativeBounds = cb.getNativeBounds(resource); resource.setNativeBoundingBox(nativeBounds); nativeBBox.setModelObject(nativeBounds); target.addComponent(nativeBBox); } CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); latLonPanel.setModelObject(cb.getLatLonBounds(nativeBounds, declaredCRS.getCRS())); } catch(IOException e) { LOGGER.log(Level.SEVERE, "Error computing the geographic BBOX", e); error("Error computing the geographic bounds:" + e.getMessage()); } target.addComponent(latLonPanel); } };
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // perform manual processing of the required fields form.process(null); form.visitFormComponents(new FeedbackMessageCleaner<>(FeedbackMessage.UNDEFINED)); ReferencedEnvelope nativeBounds = (ReferencedEnvelope) nativeBBox.getModelObject(); try { // if the native bounds are not around compute them if (nativeBounds == null) { ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject(); CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); nativeBounds = cb.getNativeBounds(resource); resource.setNativeBoundingBox(nativeBounds); nativeBBox.setModelObject(nativeBounds); target.add(nativeBBox); } CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); latLonPanel.setModelObject( cb.getLatLonBounds(nativeBounds, declaredCRS.getCRS())); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error computing the geographic BBOX", e); error("Error computing the geographic bounds:" + e.getMessage()); } target.add(latLonPanel); }
envelopePanel.setModelObject( lg.getBounds() ); target.addComponent( envelopePanel );
@Override public void onClick(AjaxRequestTarget target, Form<?> form) { // build a layer group with the current contents of the group LayerGroupInfo lg = getCatalog().getFactory().createLayerGroup(); for (LayerGroupEntry entry : lgEntryPanel.getEntries()) { lg.getLayers().add(entry.getLayer()); lg.getStyles().add(entry.getStyle()); } try { // grab the eventually manually inserted CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); if (crs != null) { // ensure the bounds calculated in terms of the user specified // crs new CatalogBuilder(getCatalog()) .calculateLayerGroupBounds(lg, crs); } else { // calculate from scratch new CatalogBuilder(getCatalog()).calculateLayerGroupBounds(lg); } envelopePanel.setModelObject(lg.getBounds()); target.add(envelopePanel); } catch (Exception e) { throw new WicketRuntimeException(e); } } });
@Override protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) { super.onAfterSubmit(target, form); if (CollectionUtils.isEmpty(getSelectedLayers())) return; GeoServerApplication gsa = (GeoServerApplication) getApplication(); LayerGroupInfo lg = gsa.getCatalog().getFactory().createLayerGroup(); getSelectedLayers() .forEach( l -> { lg.getLayers().add(gsa.getCatalog().getLayerByName(l)); }); try { CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); // CRS.decode(envelopePanel.getCoordinateReferenceSystem()); if (crs != null) { new CatalogBuilder(gsa.getCatalog()) .calculateLayerGroupBounds(lg, crs); } else { // calculate from scratch new CatalogBuilder(gsa.getCatalog()).calculateLayerGroupBounds(lg); } ReferencedEnvelope renv = lg.getBounds(); envelopePanel.setModelObject(renv); } catch (Exception e) { throw new WicketRuntimeException(e); } target.add(mainDiv); }