Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed ability to automatically apply a style to the raster from a S… #134

Closed
wants to merge 2 commits into from

Conversation

ma15569
Copy link
Member

@ma15569 ma15569 commented Aug 19, 2024

This part of code allows to read and apply a style to a RasterImageLayer. The style must be stored as SLD file, with the same name of the raster layer. This ability is limited to single banded layers (DEM/DTM) as currently OpenJUMP can read/write symbologies only for these types of file

…LD file

This part of code allows to read and apply a style to a RasterImageLayer. The style must be stored as SLD file, with the same name of the raster layer. This ability is limited to single banded layers (DEM/DTM) as   currently OpenJUMP can read/write symbologies only for these types of file
@edeso
Copy link
Member

edeso commented Aug 19, 2024

@ma15569 saw you added and delteted this several times. you know you can keep a PR and only push changes the branch t points to right? you can even force push if you need to.

// The style must be stored as SLD file with the same name of the layer.
if (rLayer.getNumBands() == 1) {// Currently OpenJUMP can read/write symbology only for
// monoband raster files
String sldS = new File(imageFileName).getAbsolutePath().replace("tif", "sld");
Copy link
Member

Choose a reason for hiding this comment

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

that's not safe! e.g.

tif-Example.tif -> sld-Example.sld
Tif-Example.TIF -> Tif-Example.TIF

use our UriUtil instead

String sldFileName = org.openjump.util.UriUtilremoveExtension(path) + ".sld";

@ma15569 ma15569 marked this pull request as draft August 19, 2024 16:28
@edeso
Copy link
Member

edeso commented Aug 19, 2024

looking better. only issue left. the complete change ist tab indented (again). but the source file you want to patch uses spaces only.

in Eclipse

Window>Preferences>General>Editors>Text Editors
"Displayed tab width" -> 2
enable checkbox "Insert spaces for tabs"
enable checkbox "Show whitespace characters"

Window>Preferences>Java>Code Style>Formatter
click edit
Indention
>Tab Policy -> Spaces only
>Indention Size -> 2
change Profile name on top to e.g. "Eclipse [built-in] + 2spaces"
[OK]
[Apply and Close]

now select your changed lines 219-236, Source>Format

commit, push ;)

@ma15569 ma15569 marked this pull request as ready for review August 20, 2024 07:23
@ma15569 ma15569 marked this pull request as draft August 20, 2024 07:47
@ma15569 ma15569 marked this pull request as ready for review August 20, 2024 07:48
@ma15569 ma15569 marked this pull request as draft August 20, 2024 07:48
@ma15569 ma15569 closed this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants