From 83718eb295f9c194903b6e8a532ede0eedb95d93 Mon Sep 17 00:00:00 2001
From: Dimitar Misev <misev@rasdaman.com>
Date: Wed, 25 Apr 2018 20:22:10 +0200
Subject: [PATCH] ticket:1752 - WMS style fragments problem with subsetting
---
.../wms/handlers/service/WMSGetMapService.java | 29 ++++++++++++++--------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/applications/petascope/petascope_main/src/main/java/petascope/wms/handlers/service/WMSGetMapService.java b/applications/petascope/petascope_main/src/main/java/petascope/wms/handlers/service/WMSGetMapService.java
index fba7948..f2595d2 100644
a
|
b
|
public class WMSGetMapService {
|
250 | 250 | ParsedSubset<Long> gridDomainSubsetY = coordinateTranslationService.geoToGridForRegularAxis(geoDomainSubsetY, geoDomainMinY, |
251 | 251 | geoDomainMaxY, resolutionY, gridDomainMinY); |
252 | 252 | |
| 253 | // replace all occurrences of c0, c1, ... in coverageExpressions with |
| 254 | // c0[subset], c1[subset], ... |
| 255 | List<String> subsettedExpressions = new ArrayList<>(); |
| 256 | i = 0; |
| 257 | for (String coverageExpression : coverageExpressions) { |
| 258 | String aliasName = ALIAS_NAME + "" + i; |
| 259 | String subsettedAliasName = SUBSET_COVERAGE_EXPRESSION_TEMPLATE |
| 260 | .replace("$coverageExpression", aliasName) |
| 261 | .replace("$gridXMin", gridDomainSubsetX.getLowerLimit().toString()) |
| 262 | .replace("$gridYMin", gridDomainSubsetY.getLowerLimit().toString()) |
| 263 | .replace("$gridXMax", gridDomainSubsetX.getUpperLimit().toString()) |
| 264 | .replace("$gridYMax", gridDomainSubsetY.getUpperLimit().toString()); |
| 265 | subsettedExpressions.add(coverageExpression.replaceAll(aliasName, subsettedAliasName)); |
| 266 | i++; |
| 267 | } |
| 268 | |
253 | 269 | // Now create a final coverageExpression which combines all the translated coverageExpression for styles with the OVERLAY operator |
254 | | String combinedCoverageExpression = ListUtil.join(coverageExpressions, " OVERLAY "); |
255 | | // e.g: (c + 1)[0:20, 30:45] |
256 | | String subsetCoverageExpression = SUBSET_COVERAGE_EXPRESSION_TEMPLATE |
257 | | .replace("$coverageExpression", combinedCoverageExpression) |
258 | | .replace("$gridXMin", gridDomainSubsetX.getLowerLimit().toString()) |
259 | | .replace("$gridYMin", gridDomainSubsetY.getLowerLimit().toString()) |
260 | | .replace("$gridXMax", gridDomainSubsetX.getUpperLimit().toString()) |
261 | | .replace("$gridYMax", gridDomainSubsetY.getUpperLimit().toString()); |
262 | | |
263 | | String scaleCoverageExpression = "Scale( " + subsetCoverageExpression + ", [0:" + (this.width - 1) + ", 0:" + (this.height - 1) + "] )"; |
| 270 | String combinedCoverageExpression = ListUtil.join(subsettedExpressions, " OVERLAY "); |
| 271 | |
| 272 | String scaleCoverageExpression = "Scale( " + combinedCoverageExpression + ", [0:" + (this.width - 1) + ", 0:" + (this.height - 1) + "] )"; |
264 | 273 | // Final Rasql from all the styles, layers |
265 | 274 | if (!nativeCRS.equals(outputCRS)) { |
266 | 275 | // It needs to be projected when the requesting CRS is different from the geo-referenced XY axes |