envelopePanel = new EnvelopePanel("bounds", envelopeModel); envelopePanel.setRequired(true); envelopePanel.setCRSFieldVisible(true); envelopePanel.setCrsRequired(true); envelopePanel.setOutputMarkupId(true); innerConstraintsDiv.add(envelopePanel);
@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); } }
public EnvelopePanel(String id, IModel model) { super(id, model); initComponents(); }
@Override protected void onClick(AjaxRequestTarget target, Form<?> form) { LOGGER.log(Level.FINE, "Computing bounds for LG based off CRS"); LayerGroupInfo lg = getPublishedInfo(); CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); new CatalogBuilder(getCatalog()) .calculateLayerGroupBoundsFromCRS(lg, crs); envelopePanel.modelChanged(); target.add(envelopePanel); } });
envelope = new EnvelopePanel("envelope", new PropertyModel(getCoverage, "bounds")); envelope.setCRSFieldVisible(true); envelope.setCrsRequired(true); details.add(envelope);
final EnvelopePanel nativeBBox = new EnvelopePanel("nativeBoundingBox", nativeBBoxModel); nativeBBox.setOutputMarkupId(true); refForm.add(nativeBBox); refForm.add(computeNativeBoundsLink(refForm, nativeBBox)); final EnvelopePanel latLonPanel = new EnvelopePanel("latLonBoundingBox", new PropertyModel( model, "latLonBoundingBox")); latLonPanel.setOutputMarkupId(true); latLonPanel.setRequired(true); refForm.add(latLonPanel); refForm.add(computeLatLonBoundsLink(refForm, nativeBBox, latLonPanel));
CoordinateReferenceSystem crs = envelopePanel.getCoordinateReferenceSystem(); envelopePanel.setModelObject( lg.getBounds() ); target.addComponent( envelopePanel );
@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); } };
void initComponents() { updateFields(); add(minXLabel = new Label("minXL", new ResourceModel("minX"))); add(minYLabel = new Label("minYL", new ResourceModel("minY"))); add(minZLabel = new Label("minZL", new ResourceModel("minZ"))); add(maxXLabel = new Label("maxXL", new ResourceModel("maxX"))); add(maxYLabel = new Label("maxYL", new ResourceModel("maxY"))); add(maxZLabel = new Label("maxZL", new ResourceModel("maxZ"))); add(minXInput = new DecimalTextField("minX", new PropertyModel<Double>(this, "minX"))); add(minYInput = new DecimalTextField("minY", new PropertyModel<Double>(this, "minY"))); add(minZInput = new DecimalTextField("minZ", new PropertyModel<Double>(this, "minZ"))); add(maxXInput = new DecimalTextField("maxX", new PropertyModel<Double>(this, "maxX"))); add(maxYInput = new DecimalTextField("maxY", new PropertyModel<Double>(this, "maxY"))); add(maxZInput = new DecimalTextField("maxZ", new PropertyModel<Double>(this, "maxZ"))); minZInput.setVisible(is3D()); minZLabel.setVisible(is3D()); maxZInput.setVisible(is3D()); maxZLabel.setVisible(is3D()); crsContainer = new WebMarkupContainer("crsContainer"); crsContainer.setVisible(false); crsPanel = new CRSPanel("crs", new PropertyModel<CoordinateReferenceSystem>(this, "crs")); crsContainer.add(crsPanel); add(crsContainer); }
@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); }
@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); }
void initComponents() { updateFields(); add(minXLabel = new Label("minXL", new ResourceModel("minX"))); add(minYLabel = new Label("minYL", new ResourceModel("minY"))); add(maxXLabel = new Label("maxXL", new ResourceModel("maxX"))); add(maxYLabel = new Label("maxYL", new ResourceModel("maxY"))); add( minXInput = new DecimalTextField( "minX", new PropertyModel(this, "minX")) ); add( minYInput = new DecimalTextField( "minY", new PropertyModel(this, "minY")) ); add( maxXInput = new DecimalTextField( "maxX", new PropertyModel(this, "maxX") )); add( maxYInput = new DecimalTextField( "maxY", new PropertyModel(this, "maxY")) ); crsContainer = new WebMarkupContainer("crsContainer"); crsContainer.setVisible(false); crsPanel = new CRSPanel("crs", new PropertyModel(this, "crs")); crsContainer.add(crsPanel); add(crsContainer); }
private void updateFields() { ReferencedEnvelope e = (ReferencedEnvelope) getModelObject(); if (e != null) { this.minX = e.getMinX(); this.minY = e.getMinY(); this.maxX = e.getMaxX(); this.maxY = e.getMaxY(); this.crs = e.getCoordinateReferenceSystem(); if (is3D()) { if (e instanceof ReferencedEnvelope3D) { this.minZ = ((ReferencedEnvelope3D) e).getMinZ(); this.maxZ = ((ReferencedEnvelope3D) e).getMaxZ(); } else { this.minZ = Double.NaN; this.maxZ = Double.NaN; } } else { this.minZ = Double.NaN; this.maxZ = Double.NaN; } } }
private void updateFields() { ReferencedEnvelope e = (ReferencedEnvelope) getModelObject(); if(e != null) { this.minX = e.getMinX(); this.minY = e.getMinY(); this.maxX = e.getMaxX(); this.maxY = e.getMaxY(); this.crs = e.getCoordinateReferenceSystem(); } }
envelope = new EnvelopePanel("envelope", new PropertyModel(getCoverage, "bounds")); envelope.setCRSFieldVisible(true); envelope.setCrsRequired(true); details.add(envelope);
final EnvelopePanel nativeBBox = new EnvelopePanel("nativeBoundingBox", nativeBBoxModel); nativeBBox.setOutputMarkupId(true); refForm.add(nativeBBox); refForm.add(computeNativeBoundsLink(refForm, nativeBBox)); new EnvelopePanel( "latLonBoundingBox", new PropertyModel<ReferencedEnvelope>(model, "latLonBoundingBox")); latLonPanel.setOutputMarkupId(true); latLonPanel.setRequired(true); refForm.add(latLonPanel); refForm.add(computeLatLonBoundsLink(refForm, nativeBBox, latLonPanel));
@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 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); }
form.add(envelopePanel = new EnvelopePanel( "bounds" )/*.setReadOnly(true)*/); envelopePanel.setRequired(true); envelopePanel.setCRSFieldVisible(true); envelopePanel.setOutputMarkupId( true );
@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); }