Skip to content

faster rendering by looking at min and max scales before read#299

Merged
fgdrf merged 3 commits into
locationtech:masterfrom
sloob:faster_raster_rendering
Dec 20, 2018
Merged

faster rendering by looking at min and max scales before read#299
fgdrf merged 3 commits into
locationtech:masterfrom
sloob:faster_raster_rendering

Conversation

@sloob

@sloob sloob commented Sep 28, 2018

Copy link
Copy Markdown
Contributor

To increase the performance of the GridCoverageReaderRenderer, raster rendering will only be performed if the map's current scale is within the min / max scale of the layer.

Signed-off-by: sloob sebastian.loob@ibykus.de

Signed-off-by: sloob <sebastian.loob@ibykus.de>
@fgdrf fgdrf added this to the 2.1.0 milestone Sep 28, 2018
@fgdrf

fgdrf commented Sep 28, 2018

Copy link
Copy Markdown
Contributor

started ci-build : https://ci.eclipse.org/udig/job/uDig-PR/30/

// faster rendering if out of scale
GridCoverageRenderState state = getRenderState(getContext());
double scale = state.context.getViewportModel().getScaleDenominator();
if (scale < state.minScale || scale > state.maxScale)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, change looks good! Any chance to add a test case?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMH minScale / maxScale of state object might be null, if one or the other is not set.

Can you explaint how this change is related to line 232/ 227 where Rule of Style is compared to teh currentScale? I guess it is possible to define different rules for the same resource and one rule might fit where another doesn't.

So maybe it makes sense to move the style rule scale comparence before creating a coverage ..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minScale / maxScale should never be null. The GeoTools implementation of Rule initializes these double values with 0.0 and Double.PositiveInfinity (see https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/styling/RuleImpl.java).

The problem is, that the SLD do not have to include a RasterSymbolizer. If there is no RasterSymbolizer, a default Symbolizer is used (line 257) and the layer is rendered.
So using the GridCoverageRenderState with the feature type style seems to be the right way.

Signed-off-by: sloob <sebastian.loob@ibykus.de>
@fgdrf

fgdrf commented Oct 22, 2018

Copy link
Copy Markdown
Contributor

Started a CI-Build for this pull request again : https://ci.eclipse.org/udig/job/uDig-PR/32/

@fgdrf fgdrf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have unit tests! I'm wondering about different formatings of java class files - they looking different and formatter rules might not applied everywhere. I guess the comments are easy to address and I'd to merge it afterwards till the end of 2018 ;)

Comment thread plugins/pom.xml Outdated
<module>org.locationtech.udig.libs.tests</module>
<module>org.locationtech.udig.location.test</module>
<module>org.locationtech.udig.render.feature.basic.test</module>
<module>org.locationtech.udig.render.gridcoverage.basic.test</module>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like tabs are at the beginning of the lin rather that spaces, can we fix it?

paramMap.put("name", "BasicGridCoverage2DFormat"); //$NON-NLS-1$//$NON-NLS-2$
paramMap.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),new GridGeometry2D(new Rectangle(), new Rectangle()));

/* GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, mapDisplay.getWidth(), mapDisplay.getHeight());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the commented lines on intial commit? Are you kind to remove these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the bad code formatting. Hope everything is fine now :)

Signed-off-by: sloob <sebastian.loob@ibykus.de>
@fgdrf

fgdrf commented Dec 20, 2018

Copy link
Copy Markdown
Contributor

Looks good! Build-Job failure hasn't to do anything with your changes (https://ci.eclipse.org/udig/job/uDig-PR/38/)

Many thanks again for this improvement

@fgdrf fgdrf merged commit 5c9f993 into locationtech:master Dec 20, 2018
@sloob sloob deleted the faster_raster_rendering branch December 21, 2018 07:25
fgdrf pushed a commit to fgdrf/udig-platform that referenced this pull request Dec 23, 2019
…ontech#299)

* faster rendering by looking at min and max scales before read

Signed-off-by: sloob <sebastian.loob@ibykus.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants