The Maps Renderer
It uses the Render Engine to render the data.
The Maps Renderer is initialized with a map handle of the DriveWorks Maps module and initializes a render buffer using the Render Engine. That render buffer gets filled with lines for all lane dividers in the map. Additionally, a buffer gets allocated for additional renderings during runtime. The user has to specify the maximum number of lines that will be needed during one of the render calls that render additional data (all render calls other than dwMapsRenderer_renderMap()). Also, it can be chosen whether the line directions of the map should be visible, so that it can be seen where lines start and end. When setting showMapLineDirections
to true, the lines will be shaded (darker to brighter) to show the line directions.
The Maps Renderer uses the Render Engine. It renders any lines with the current setting of the Render Engine. That means, it renders into the active tile, using its projection and modelView matrix and with line width settings. Color handling is different depending on the render call. There are helper functions to set up the projection and modelView matrices for the Maps Renderer.
The Maps Renderer provides the following render functions:
Renders all map lane dividers.
Render the lines of a lane plan from the DriveWorks Lane Planner module.
Render a list of polylines of WGS84 points.
Render an oriented box, defined by a WGS84 point, a bearing (clockwise angle to north) in radian, length and width in meters, optionally with a center cross and/or an arrow towards the bearing direction.
Render an axis-aligned square box defined by a WGS84 point and a size in meters, optionally with a center cross.
There are helper functions to set up projection and modelview matrices.
Set the projection matrix in the renderEngine tile such that the active tile height covers a given distance of map data in meters.
Set the modelView matrix in the renderEngine tile such that the given WGS84 coordinate is in the tile center.
Move the modelView matrix by a given delta in meters. This assumes the current modelView matrix is already set up for top-down orthographic view.
Set up the modelView matrix such that the camera is at a given WGS84 point, looking towards another WGS84 point.
There are helper functions to check whether a screen pixel is within a box that is defined by WGS84 coordinates:
There are helper functions to transform between different coordinates.
Returns the internally used render coordinate of a WGS84 point. This can be used to externally render lines into the same coordinate system.
Returns the WGS84 coordinate for a point given in the internal render coordinate system.
Returns the WGS84 coordinate that corresponds to a screen pixel. This can be used to localize mouse clicks on the screen, for example.
Returns the WGS84 coordinate that corresponds to a Normalized Display Coordinate system, with (0,0) in the center of the screen, going from (-1,-1) to (1,1). This can be helpful when selecting a point at a given position on the screen, e.g. screen center.
For more information see Map Access Sample .