-
Renderer: The central orchestrator. It will be responsible for managingLayerobjects and drawing them onto theGoogleMap.- Key methods:
addLayer(layer),removeLayer(layer),getLayers() - It will hold a reference to the
GoogleMapinstance.
- Key methods:
-
Layer: A container for a collection ofMapObjects. A layer represents a single, logical set of data, such as the contents of one KML file. -
MapObject: A common interface or base class for all renderable items. We'll have concrete implementations for each primitive type:MarkerObjectPolylineObjectPolygonObjectCircleObject- These will encapsulate the Google Maps SDK's objects and associated styling.
-
DataParser: An interface for parsing data files. We'll start with two implementations:KmlParserGeoJsonParser- The output of a parser will be a structured, in-memory representation of the data, specific to its format.
-
Mapper: A component that translates the format-specific object model from aDataParserinto aLayerof genericMapObjects that theRenderercan work with.KmlMapperGeoJsonMapper
- Instantiation: A developer creates an instance of the
Renderer, associating it with aGoogleMapobject. - Parsing: The developer provides a data source (e.g., an
InputStreamof a GeoJSON file) to the appropriateDataParser(e.g.,GeoJsonParser). The parser returns a structured representation of the GeoJSON data. - Mapping: The developer passes the parsed data object to the corresponding
Mapper(e.g.,GeoJsonMapper). The mapper converts the data into aLayerinstance, which contains a list ofMapObjects (likePolygonObject,MarkerObject, etc.). - Rendering: The developer adds the
Layerto theRendererusingrenderer.addLayer(layer). - Drawing: The
Rendereriterates through theMapObjects in theLayerand uses the Google Maps SDK to draw the corresponding shapes and markers on the map.