boku-ilen / geodot-plugin

Godot plugin for loading geospatial data
GNU General Public License v3.0
109 stars 19 forks source link

Reformat API with encapsulated GeoDataset and GeoLayer objects #27

Closed kb173 closed 4 years ago

kb173 commented 4 years ago

Instead of long function calls with paths and layer names, we'd like to switch to a more object-oriented solution: Getting a GeoDataset object from Geodot, which offers functions to get its GeoLayers (e.g. all as an Array or individual ones by name). All functionality like getting points near a position, or getting all features, will then be in this GeoLayer class. We may have to strictly differentiate between raster layers and vector layers since those offer very different functionality (-> GeoRasterLayer and GeoVectorLayer).

This has several advantages: Errors are easier to convey precisely (with is_valid() checks in each object), function calls are less convoluted, and the user has a much finer control of caching since it is in their control when a GeoDataset or GeoLayer object is deleted.

This will, of course, break compatibility with previous versions.

kb173 commented 4 years ago

In preparation for this restructure, some classes were reworked a bit in https://github.com/boku-ilen/geodot-plugin/commit/1db101ec56e5452b52f9a6a30c990682d169477a to remove duplicate functionality and make all the files a bit clearer and easier to look through.

kb173 commented 4 years ago

Done and tested! The only thing left to implement has been noted in https://github.com/boku-ilen/geodot-plugin/issues/29.