Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
turingtestfail committed Feb 4, 2025
1 parent d13fd9b commit 846efa4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import org.geoserver.catalog.WMTSStoreInfo;
import org.geoserver.catalog.impl.LayerGroupStyle;
import org.geoserver.catalog.util.ReaderDimensionsAccessor;
import org.geoserver.config.GeoServer;
import org.geoserver.gwc.GWC;
import org.geoserver.gwc.layer.GeoServerTileLayer;
import org.geoserver.mapml.tcrs.Bounds;
Expand Down Expand Up @@ -130,7 +129,6 @@ public class MapMLDocumentBuilder {
private final WMS wms;
private static final String BBOX_PARAMS = "{xmin},{ymin},{xmax},{ymax}";
private static final String BBOX_PARAMS_YX = "{ymin},{xmin},{ymax},{xmax}";
private final GeoServer geoServer;

private final WMSMapContent mapContent;
private final HttpServletRequest request;
Expand Down Expand Up @@ -188,9 +186,8 @@ public class MapMLDocumentBuilder {
* @param wms WMS object
* @param request HttpServletRequest object
*/
public MapMLDocumentBuilder(WMSMapContent mapContent, WMS wms, GeoServer geoServer, HttpServletRequest request) {
public MapMLDocumentBuilder(WMSMapContent mapContent, WMS wms, HttpServletRequest request) {
this.wms = wms;
this.geoServer = geoServer;
this.request = request;
this.mapContent = mapContent;
GetMapRequest getMapRequest = mapContent.getRequest();
Expand Down Expand Up @@ -308,7 +305,7 @@ public Mapml getMapMLDocument() throws ServiceException {
* @throws ServiceException In the event of a service error.
*/
public void initialize() throws ServiceException {
isMultiExtent = Boolean.TRUE.equals((Boolean)
isMultiExtent = Boolean.TRUE.equals(
getMultiExtent(mapContent.getRequest()).orElse(MapMLConstants.MAPML_MULTILAYER_AS_MULTIEXTENT_DEFAULT));
if (isMultiExtent || layers.size() == 1) {
for (int i = 0; i < layers.size(); i++) {
Expand Down Expand Up @@ -622,6 +619,7 @@ private MapMLLayerMetadata layerToMapMLLayerMetadata(RawLayer layer, String styl
* @param getMapRequest GetMapRequest
* @return boolean true if layer should be represented as a feature
*/
@SuppressWarnings("unchecked")
private static boolean useFeatures(RawLayer layer, GetMapRequest getMapRequest) {
Optional useFeaturesOptional =
Optional.ofNullable(getMapRequest.getFormatOptions().get(MAPML_USE_FEATURES_REP));
Expand All @@ -636,6 +634,7 @@ private static boolean useFeatures(RawLayer layer, GetMapRequest getMapRequest)
* @param getMapRequest GetMapRequest
* @return boolean useTiles
*/
@SuppressWarnings("unchecked")
private static boolean useTiles(RawLayer layer, GetMapRequest getMapRequest) {
Optional useTilesOptional =
Optional.ofNullable(getMapRequest.getFormatOptions().get(MAPML_USE_TILES_REP));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.geoserver.config.GeoServer;
import org.geoserver.ows.Dispatcher;
import org.geoserver.ows.Request;
import org.geoserver.platform.ServiceException;
Expand All @@ -23,7 +22,6 @@
/** Handles a GetMap request that for a map in MapML HTML format. */
public class MapMLHTMLOutputFormat implements GetMapOutputFormat {
private WMS wms;
private GeoServer geoServer;
private final Set<String> OUTPUT_FORMATS =
Collections.unmodifiableSet(new HashSet<>(List.of(MapMLConstants.MAPML_HTML_MIME_TYPE)));
static final MapProducerCapabilities MAPML_CAPABILITIES = new MapProducerCapabilities(false, true, true);
Expand All @@ -33,17 +31,15 @@ public class MapMLHTMLOutputFormat implements GetMapOutputFormat {
*
* @param wms the WMS
*/
public MapMLHTMLOutputFormat(WMS wms, GeoServer geoServer) {
public MapMLHTMLOutputFormat(WMS wms) {
this.wms = wms;
this.geoServer = geoServer;
}

@Override
public WebMap produceMap(WMSMapContent mapContent) throws ServiceException, IOException {
Request request = Dispatcher.REQUEST.get();
HttpServletRequest httpServletRequest = request.getHttpRequest();
MapMLDocumentBuilder mapMLDocumentBuilder =
new MapMLDocumentBuilder(mapContent, wms, geoServer, httpServletRequest);
MapMLDocumentBuilder mapMLDocumentBuilder = new MapMLDocumentBuilder(mapContent, wms, httpServletRequest);
return new MapMLHTMLMap(mapContent, mapMLDocumentBuilder.getMapMLHTMLDocument());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public WebMap produceMap(WMSMapContent mapContent) throws ServiceException, IOEx
mapMLDocument = builder.getMapMLDocument();
} else {
MapMLDocumentBuilder mapMLDocumentBuilder =
new MapMLDocumentBuilder(mapContent, wms, geoServer, request.getHttpRequest());
new MapMLDocumentBuilder(mapContent, wms, request.getHttpRequest());
mapMLDocument = mapMLDocumentBuilder.getMapMLDocument();
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
</bean>
<bean id="mapMLHTMLProducer" class="org.geoserver.mapml.MapMLHTMLOutputFormat">
<constructor-arg index="0" ref="wms"/>
<constructor-arg index="1" ref="geoServer"/>
</bean>
<bean id="mapMLAdminPanel" class="org.geoserver.web.services.AdminPagePanelInfo">
<property name="id" value="mapMLAdminPanel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.geoserver.data.test.MockData;
import org.geoserver.web.GeoServerWicketTestSupport;
import org.geoserver.wfs.kvp.BBoxKvpParser;
import org.geoserver.wms.GetMapRequest;
import org.geotools.api.referencing.FactoryException;
Expand All @@ -20,7 +22,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

public class MapMLFormatLinkTest {
public class MapMLFormatLinkTest extends GeoServerWicketTestSupport {

@BeforeClass
public static void setup() {
Expand Down Expand Up @@ -57,6 +59,7 @@ public void testIncompatibleCode() throws Exception {
String epsgCode = "EPSG:32632";
Map<String, String> parameters = new HashMap<>();
parameters.put("srs", epsgCode);
parameters.put("layers", MockData.LINES.getLocalPart());
GetMapRequest request = new GetMapRequest();
CoordinateReferenceSystem crs = CRS.decode(epsgCode, true);
request.setCrs(crs);
Expand All @@ -78,6 +81,7 @@ private void transformLink(String epsgCode, String mapMLCode) throws FactoryExce
MapMLFormatLink link = new MapMLFormatLink();
Map<String, String> parameters = new HashMap<>();
parameters.put("srs", epsgCode);
parameters.put("layers", MockData.LINES.getLocalPart());
GetMapRequest request = new GetMapRequest();
request.setCrs(CRS.decode(epsgCode, true));
link.customizeRequest(request, parameters);
Expand Down

0 comments on commit 846efa4

Please sign in to comment.