jywarren / cartagen

Cartagen is a vector-based, client-side framework for rendering maps in native HTML 5. Maps are styled in GSS, a cascading stylesheet specification for geospatial information – a decision which leverages literacy in CSS to make map styling more accessible.
https://jywarren.github.io/cartagen/
MIT License
254 stars 27 forks source link

Looking for a cartagen theory-of-operation regarding Map, Glop, and Viewport #108

Open jmullaney2003 opened 4 years ago

jmullaney2003 commented 4 years ago

There is a gap between the wiki and the source code. The wiki contains some explanations about specific classes, and, of course, the source contains everything. I don't see the relationship between classes. I’m having trouble grasping a basic theory of operation.

Example: what is the difference (or relationship) between the Map, Glop, and Viewport? In particular, what is difference between Map.draw() and Glop.draw();

jywarren commented 4 years ago

Hi, so Glop is a set of convenience methods for (HTML) canvas operations, including a draw function, resizing, and some events stuff:

https://github.com/jywarren/cartagen/blob/master/src/glop/glop.js

Map has most of the map projection and lat/lon coord math utility functions.

https://github.com/jywarren/cartagen/blob/master/src/mapping/map.js

Viewport manages the rectangle that is being viewed through the browser window frame, and because Cartagen typically works in vector tiles, it also tracks the vector tiles which intersect with the browser viewport frame, so we can do efficient "culling" of data to render.

I hope this helps!