Skip to content

Fix issue causing always full layer export of abstract geometry types#258

Merged
fgdrf merged 1 commit into
locationtech:masterfrom
nprigour:AbstractGeometryExport_with_selection_fix
Mar 23, 2018
Merged

Fix issue causing always full layer export of abstract geometry types#258
fgdrf merged 1 commit into
locationtech:masterfrom
nprigour:AbstractGeometryExport_with_selection_fix

Conversation

@nprigour

Copy link
Copy Markdown
Contributor

In org.locationtech.udig.catalog.ui.export.CatalogExportWizard when the type of layer is of the abstract type Geometry a selection during the action of a feature export (right click on a layer and selection of Export->Other->Layer To Shapefile) is ignored causing all layers features to be exported.

Signed-off-by: Nikolaos Pringouris nprigour@gmail.com

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
@fgdrf

fgdrf commented Mar 23, 2018

Copy link
Copy Markdown
Contributor

Is it about exporting only selected features and selection is ignored? Or do you mean the selection within the layers view is ignored and all layers are listed in export dialog? Can you provide a dataset with abstract Geometry type to reproduce the issue. That would help to understand the problem

Many Thanks

@nprigour

Copy link
Copy Markdown
Contributor Author

Hi @fgdrf
Is it not obvious from reviewing code that the problem is that selection filter (set in data.getQuery()) is actually ignored resulting always to a full layer export?

In line 173 FeatureCollection is created using the following fragment of code
SimpleFeatureCollection fc = fs.getFeatures(data.getQuery());

Then in line 212,213 a new collection is created ignoring the previous one (why?)
SimpleFeatureCollection featureCollection = fs.getFeatures();
FeatureIterator<SimpleFeature> featureIterator = featureCollection.features();

this causes all layer features to be always exported agnostic of whether a selection query exists or not for the given layer. This applies to any geometry type polygon, point, line etc.

@fgdrf

fgdrf commented Mar 23, 2018

Copy link
Copy Markdown
Contributor

Absolutely! I could reproduce the bug and test if your fix works for abstract and non abstract geometries. I'm wondering why it's broken for Geometry while it works for e.g. (Multi)Polygons ..

@fgdrf

fgdrf commented Mar 23, 2018

Copy link
Copy Markdown
Contributor

Great! Works as expected and both, Abstract and Non-Abstract geometries selected features are exported only while unselected are not exported.

@fgdrf fgdrf added the bug label Mar 23, 2018
@fgdrf fgdrf added this to the uDig-2.0.0 milestone Mar 23, 2018
@fgdrf fgdrf merged commit 2f05a08 into locationtech:master Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants