vtkMap icon indicating copy to clipboard operation
vtkMap copied to clipboard

Bug fixes

Open embeddedmz opened this issue 6 years ago • 5 comments

I mainly fixed this issue https://github.com/OpenGeoscience/vtkMap/issues/114 and other problems related to vtkMapMarkerSet (IDs are not unique, DeleteMarker bugs/leaks, recompute clusters, etc...).

There's also an important fix I made in vtkFeatureLayer that allows VTK smart pointers to correctly free the instances of it (replaced the overriden Delete by Unregister as smart pointers don't use Delete to decrement the reference count).

The commits comments provides a more exhaustive description of changes.

Thanks.

embeddedmz avatar Aug 22 '19 17:08 embeddedmz

@embeddedmz Thank you for another major contribution. I will try to review in the next few days. Is there a simple test program that demonstrates the delete-marker problem?

johnkit avatar Aug 23 '19 14:08 johnkit

Hi @johnkit

You can simply take the weather station application, add this code in void qtWeatherStations::showStations() : // remove old markers for (const auto& id : StationMap) { if (!this->MapMarkers->DeleteMarker(id.first)) { std::cout << "Error: unable to delete marker " << id.first << std::endl; } } before this instruction (deletion of old stations marker is missing... by the way, this code is already available in the pull request commits) this->StationMap.clear();

Then, compile and launch the program, create some stations, (7) they will be displayed correctly, then create another number of stations (test with numbers != 7).

In short, the problem is that the IDs are not generated uniquely : if you have 3 markers (0, 1, 2) and then you decide to delete marker 1, the next marker you will create (the fourth one since the beginning) will have 2 as an ID, but 2 is already assigned (to the third created marker).

The variable used to assign IDs to added markers must not be decremented when we delete a marker. Moreover, using a map is better than using a vector to store marker nodes : when a marker is erased, that creates fragmentation in std::vector that needs to be handled and if it's handled, we can't access marker nodes with their IDs directly (that's why a map is more adequate).

embeddedmz avatar Aug 23 '19 14:08 embeddedmz

Recently, I noticed that vtkMap is unable to download map tiles from openstreetmap server. When I specified a user agent (e.g. vtkMap), I was again able to download the tiles.

I will add the commit in this pull request !

embeddedmz avatar Jan 06 '20 14:01 embeddedmz

Hi @johnkit I made a small change in core/CMakeLists.txt to fix libcurl include dir not being set for examples projects in Visual Studio 2019 (generated with the latest version of CMake). This pull request is getting bigger and bigger and the last commit is not even related to the others. I hope that you can find the time to merge the commits so I can create a new pull request. Thanks.

embeddedmz avatar Apr 10 '20 22:04 embeddedmz

@johnkit To remove the ugly discontinuities between tiles (or any image textured planes in VTK), multi sampling must be disabled AND vtkTexture's interpolation must not be activated. The map is now displayed correctly. I didn't find a way to keep MSAA and display tiles without tampering their borders.

embeddedmz avatar May 10 '20 20:05 embeddedmz