Skip to content

Commit

Permalink
moved multiextent to layergroup admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
turingtestfail committed Feb 11, 2025
1 parent b835f28 commit 371c7be
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public final class MapMLConstants {
/** MapML layer metadata use tiles */
public static final String MAPML_USE_TILES = "mapml.useTiles";

/** MapML layer metadata use multiextent */
public static final String MAPML_MULTIEXTENT = "mapml.multiextent";

/** MapML layer metadata remote client request */
public static final String MAPML_USE_REMOTE = "mapml.useRemote";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ <h3><wicket:message key="mapmlSectionHeading">MapML Settings</wicket:message></h
<li>
<fieldset>
<legend>
<span><wicket:message key="mapmlTileSection">Tile Config</wicket:message></span>
<span><wicket:message key="mapmlTileSection">Representation Config</wicket:message></span>
</legend>
<ul class="choiceList">
<li>
<input id="useTiles" wicket:id="useTiles" type="checkbox"></input>
<label for="useTiles"><wicket:message key="mapmlUseTiles">Use Tiles</wicket:message></label>
</li>
<li>
<input id="multiextent" wicket:id="multiextent" type="checkbox"></input>
<label for="multiextent"><wicket:message key="multiextent">Multi-Layer as Multi-Extent</wicket:message></label>
</li>
</ul>
</fieldset>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

package org.geoserver.mapml;

import static org.geoserver.mapml.MapMLConstants.MAPML_MULTIEXTENT;
import static org.geoserver.mapml.MapMLConstants.MAPML_USE_TILES;
import static org.geoserver.mapml.MapMLLayerConfigurationPanel.getAvailableMimeTypes;
import static org.geoserver.web.demo.MapMLFormatLink.FORMAT_OPTION_DEFAULT;

import java.util.logging.Logger;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -17,8 +19,10 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.geoserver.catalog.LayerGroupInfo;
import org.geoserver.web.GeoServerApplication;
import org.geoserver.web.publish.PublishedConfigurationPanel;
import org.geoserver.web.util.MapModel;
import org.geoserver.wms.WMSInfo;
import org.geotools.util.logging.Logging;

/**
Expand Down Expand Up @@ -54,7 +58,7 @@ public MapMLLayerGroupConfigurationPanel(final String panelId, final IModel<Laye
add(licenseLink);

// add the checkbox to select tiled or not
MapModel<Boolean> useTilesModel = new MapModel<>(new PropertyModel<>(model, METADATA), "mapml.useTiles");
MapModel<Boolean> useTilesModel = new MapModel<>(new PropertyModel<>(model, METADATA), MAPML_USE_TILES);
CheckBox useTiles = new CheckBox("useTiles", useTilesModel);
useTiles.add(new OnChangeAjaxBehavior() {
@Override
Expand All @@ -66,6 +70,25 @@ protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
});
add(useTiles);

// add the checkbox to select multiextent or not
MapModel<Boolean> multiextentModel = new MapModel<>(new PropertyModel<>(model, METADATA), MAPML_MULTIEXTENT);
// in previous versions, the multiextent option was stored in the WMSInfo
if (multiextentModel.getObject() == null) {
WMSInfo wmsInfo = GeoServerApplication.get().getGeoServer().getService(WMSInfo.class);
boolean multiExtent = Boolean.parseBoolean(
wmsInfo.getMetadata().get(MapMLConstants.MAPML_MULTILAYER_AS_MULTIEXTENT) != null
? wmsInfo.getMetadata()
.get(MapMLConstants.MAPML_MULTILAYER_AS_MULTIEXTENT)
.toString()
: FORMAT_OPTION_DEFAULT);
LayerGroupInfo layerGroupInfo = (LayerGroupInfo) model.getObject();
layerGroupInfo.getMetadata().put(MAPML_MULTIEXTENT, multiExtent);
GeoServerApplication.get().getGeoServer().getCatalog().save(layerGroupInfo);
multiextentModel.setObject(multiExtent);
}
CheckBox multiextent = new CheckBox("multiextent", multiextentModel);
add(multiextent);

MapModel<String> mimeModel = new MapModel<>(new PropertyModel<>(model, METADATA), MapMLConstants.MAPML_MIME);
boolean useTilesFromModel =
Boolean.TRUE.equals(model.getObject().getMetadata().get(MAPML_USE_TILES, Boolean.class));
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
import org.geoserver.mapml.MapMLConstants;
import org.geoserver.mapml.tcrs.TiledCRSConstants;
import org.geoserver.mapml.tcrs.TiledCRSParams;
import org.geoserver.web.GeoServerApplication;
import org.geoserver.wms.GetMapRequest;
import org.geoserver.wms.WMS;
import org.geoserver.wms.WMSInfo;
import org.geotools.api.referencing.FactoryException;
import org.geotools.api.referencing.operation.TransformException;
import org.geotools.geometry.jts.ReferencedEnvelope;
Expand All @@ -44,14 +42,6 @@ public ExternalLink getFormatLink(PreviewLayer layer) {

/** Customize the request to use the MapML format and a native MapML CRS if possible */
void customizeRequest(GetMapRequest request, Map<String, String> params) {
// Get the WMSInfo and check if the multiExtent and useFeatures options are set in the configuration
WMSInfo wmsInfo = GeoServerApplication.get().getGeoServer().getService(WMSInfo.class);
boolean multiExtent = Boolean.parseBoolean(
wmsInfo.getMetadata().get(MapMLConstants.MAPML_MULTILAYER_AS_MULTIEXTENT) != null
? wmsInfo.getMetadata()
.get(MapMLConstants.MAPML_MULTILAYER_AS_MULTIEXTENT)
.toString()
: FORMAT_OPTION_DEFAULT);
WMS wms = WMS.get();
PublishedInfo layerInfo;
MetadataMap metadata;
Expand All @@ -70,6 +60,10 @@ void customizeRequest(GetMapRequest request, Map<String, String> params) {
metadata.get(MapMLConstants.MAPML_USE_TILES) != null
? metadata.get(MapMLConstants.MAPML_USE_TILES).toString()
: FORMAT_OPTION_DEFAULT);
boolean multiExtent = Boolean.parseBoolean(
metadata.get(MapMLConstants.MAPML_MULTIEXTENT) != null
? metadata.get(MapMLConstants.MAPML_MULTIEXTENT).toString()
: FORMAT_OPTION_DEFAULT);
// set the format
params.put("format", MapMLConstants.MAPML_HTML_MIME_TYPE);
// set the format_options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ MapMLLayerGroupConfigurationPanel.mapmlSectionHeading=MapML Settings
MapMLLayerGroupConfigurationPanel.mapmlLicenseSection=License Info
MapMLLayerGroupConfigurationPanel.mapmlLicenseTitle=License Title
MapMLLayerGroupConfigurationPanel.mapmlLicenseLink=License Link
MapMLLayerGroupConfigurationPanel.mapmlTileSection=Tile Settings
MapMLLayerGroupConfigurationPanel.mapmlTileSection=Representation Settings
MapMLLayerGroupConfigurationPanel.mapmlVectorSection=Vector Settings
MapMLLayerGroupConfigurationPanel.mapmlUseFeatures=Use Features
MapMLLayerGroupConfigurationPanel.mapmlUseTiles=Use Tiles
MapMLLayerGroupConfigurationPanel.mapmlDefaultMimeSection=Default Mime Type Config
MapMLLayerGroupConfigurationPanel.mapmlDefaultMime=Default Mime Type
MapMLLayerGroupConfigurationPanel.multiextent=Represent multi-layer requests as multiple <map-extent> elements

MapMLTCRSPanel.title=Gridsets selection to TCRS
MapMLTCRSPanel.availableHeader=Available GridSets to be selected as MapML TCRSs
MapMLTCRSPanel.selectedHeader=Selected GridSets
MapMLTCRSSettingsPage.title=MapML TCRS Settings
MapMLTCRSSettingsPage.description=Administer Settings for MapML TCRS definitions

MapMLAdminPanel.title=MapML Settings
MapMLAdminPanel.mapml=MapML Settings
MapMLAdminPanel.multiextent=Represent multi-layer requests as multiple <map-extent> elements
6 changes: 0 additions & 6 deletions src/extension/mapml/src/main/resources/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@
<bean id="mapMLHTMLProducer" class="org.geoserver.mapml.MapMLHTMLOutputFormat">
<constructor-arg index="0" ref="wms"/>
</bean>
<bean id="mapMLAdminPanel" class="org.geoserver.web.services.AdminPagePanelInfo">
<property name="id" value="mapMLAdminPanel"/>
<property name="titleKey" value="mapml"/>
<property name="componentClass" value="org.geoserver.mapml.web.MapMLAdminPanel"/>
<property name="serviceClass" value="org.geoserver.wms.WMSInfo"/>
</bean>

<bean id="mapMLTCRSSettingsPage" class="org.geoserver.web.MenuPageInfo">
<property name="id" value="mapMLTCRSSettings"/>
Expand Down

This file was deleted.

0 comments on commit 371c7be

Please sign in to comment.