Esri / esri-leaflet

A lightweight set of tools for working with ArcGIS services in Leaflet. :rocket:
https://developers.arcgis.com/esri-leaflet/
Apache License 2.0
1.61k stars 799 forks source link

Refactor FeatureLayer #213

Closed patrickarlt closed 10 years ago

patrickarlt commented 10 years ago

Its becoming really clear to me that the current way FeatureLayer works is going to be unacceptably complicated very soon. There are a lot of features left to implement including...

The main issue is there a lot of mixins that get included inside a larger class like L.GeoJSON which makes stuff get fairly complicated quickly. I want this to be more Leaflety and use inheritance.

Will keep this updated with what I find.

patrickarlt commented 10 years ago

Feature Manager

FeatureManager will extend or encapsulate L.Grid and manage the loading and filtering. Subclasses are responsible for implimenting method for adding. Subclasses can

Internally this class will listen for tileload events and request more features from the Feature Layer process them and pass them off to the addFeatures method. When visible features change from the result of changing time ranges or where clauses FeatureManager will pass features that need to be hidden to the hideFeatures method. Also passes the new list of visible features to the overrideFeatures method for layers where clearing and redrawing is more efficent.

Options
Methods

FeatureLayer

FeatureLayer will extend FeatureManager and impliment its own client side index based on RBush to manage drawing features on the client side which will hide features on the tileunload event from FeatureManager

Methods

ClusteredFeatureLayer

Wrapper around Leaflet.markercluster that clusters point features on the fly.

Methods

HeatMapFeatureLayer

Wrapper around Leaflet.heat that generates on the fly heatmaps from feautres. This is a non-interactive layer so pointer-events should be set to none.

Methods

Challenges

The biggest challenge right now is how to handle when time ranges and where clauses change and filtering the data down dynamically and making transitions smooth.

Next would be to figure out how to propagate events from things encapsulated classes like Leaflet.markercluster up to the main class.

Ill be able to do more work on this post Dev Summit.

patrickarlt commented 10 years ago

Done in beta 5.