Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::Screen Class Reference

Screen object. More...

Inheritance diagram for gem::Screen:
Collaboration diagram for gem::Screen:

Public Member Functions

ERenderRule setRenderingRule (ERenderRule rule) noexcept
 Change the screen rendering rule, see TRenderRule.
ERenderRule getRenderingRule () const noexcept
 Get the current rendering rule.
Screenresize (const Size &size) noexcept
 Resize the screen to the given size in pixels.
ScreenhandleTouchEvent (ETouchEvent ev, LargeInteger touchId, const Xy &pt) noexcept
 Handle a screen touch event with the given id, see TTouchEvent for types.
ScreenscrollEvent (int delta, const Xy &pt) noexcept
 Handle a scroll event from a pointing device.
Rect getViewport () const noexcept
 Get screen viewport in pixels.
Screenrender () noexcept
 Render the screen by subsequently render all contained views.
void needsRender () noexcept
 Mark screen with pending render request.
template<typename T>
StrongPointer< CanvashitTest (const XyType< T > &pt) const noexcept
 Get the view under the given coordinates.
ScreenresetContext (bool contextLost=false) noexcept
 Reset screen context.
OpenGLContext getOpenGLContext () const noexcept
 Get OpenGL context.
void iterateCanvases (std::function< bool(StrongPointer< Canvas >)> collector) const noexcept
 Iterate all screen canvases.
void iterateViews (std::function< bool(StrongPointer< MapView >)> collector) const noexcept
 Iterate all screen views.
void iterateViews (std::function< bool(StrongPointer< MapView >, StrongPointer< MapViewV2 >)> collector) const noexcept
 Iterate all screen views * views v2.

Static Public Member Functions

static StrongPointer< Screenproduce (OpenGLContext context, ERenderRule renderRule=RR_OnDemand) noexcept
 Create a Screen object using an OpenGL context and an optional render rule.

Detailed Description

Screen object.

It supports rendering in an OpenGL context. It is possible to use the rendering in two ways:

  • Render on demand. The UI requests the screen to be rendered in the attached context.
  • Render automatically. For example when the map is scrolled or rotated the map is rendered automatically in the attached context and the UI is notified when finished. MapView objects require a Screen in order to be created. After creation a MapView will hold a strong pointer to its Screen.

Implements share-read / write Api object over IScreen.

Member Function Documentation

◆ getOpenGLContext()

OpenGLContext gem::Screen::getOpenGLContext ( ) const
inlinenoexcept

Get OpenGL context.

Returns
The OpenGL context

◆ getRenderingRule()

ERenderRule gem::Screen::getRenderingRule ( ) const
inlinenoexcept

Get the current rendering rule.

Returns
The current rendering rule

◆ getViewport()

Rect gem::Screen::getViewport ( ) const
inlinenoexcept

Get screen viewport in pixels.

origin is always 0, 0

Returns
The screen viewport

◆ handleTouchEvent()

Screen & gem::Screen::handleTouchEvent ( ETouchEvent ev,
LargeInteger touchId,
const Xy & pt )
inlinenoexcept

Handle a screen touch event with the given id, see TTouchEvent for types.

Parameters
[in]evThe touch event type
[in]touchIdThe touch id
[in]ptThe touch point
Returns
The screen object

◆ hitTest()

template<typename T>
StrongPointer< Canvas > gem::Screen::hitTest ( const XyType< T > & pt) const
inlinenoexcept

Get the view under the given coordinates.

With int type: coordinates are screen.

With float type: coordinates are screen fraction ( 0 - 1.f )

Parameters
[in]ptThe coordinates
Returns
The view under the given coordinates

◆ iterateCanvases()

void gem::Screen::iterateCanvases ( std::function< bool(StrongPointer< Canvas >)> collector) const
noexcept

Iterate all screen canvases.

collector must return true if the iteration should continue, false if it must stop

Parameters
[in]collectorThe collector function

◆ iterateViews() [1/2]

void gem::Screen::iterateViews ( std::function< bool(StrongPointer< MapView >)> collector) const
inlinenoexcept

Iterate all screen views.

collector must return true if the iteration should continue, false if it must stop

Parameters
[in]collectorThe collector function

◆ iterateViews() [2/2]

void gem::Screen::iterateViews ( std::function< bool(StrongPointer< MapView >, StrongPointer< MapViewV2 >)> collector) const
noexcept

Iterate all screen views * views v2.

collector must return true if the iteration should continue, false if it must stop

Parameters
[in]collectorThe collector function

◆ produce()

StrongPointer< Screen > gem::Screen::produce ( OpenGLContext context,
ERenderRule renderRule = RR_OnDemand )
inlinestaticnoexcept

Create a Screen object using an OpenGL context and an optional render rule.

Parameters
[in]contextThe OpenGL context
[in]renderRuleThe rendering rule
Returns
The Screen object

◆ render()

Screen & gem::Screen::render ( )
inlinenoexcept

Render the screen by subsequently render all contained views.

TRenderRule must be ERR_OnDemand

Returns
The screen object

◆ resetContext()

Screen & gem::Screen::resetContext ( bool contextLost = false)
inlinenoexcept

Reset screen context.

Notifies screen that the attached OpenGLContext has changed. This will trigger updates in the SDK textures, font etc.

Parameters
[in]contextLostIf true, the context was lost and the screen should reset all its resources
Returns
The screen object

◆ resize()

Screen & gem::Screen::resize ( const Size & size)
inlinenoexcept

Resize the screen to the given size in pixels.

Parameters
[in]sizeThe new size
Returns
The screen object

◆ scrollEvent()

Screen & gem::Screen::scrollEvent ( int delta,
const Xy & pt )
inlinenoexcept

Handle a scroll event from a pointing device.

Parameters
[in]deltaThe scroll delta
[in]ptThe scroll point
Returns
The screen object

◆ setRenderingRule()

ERenderRule gem::Screen::setRenderingRule ( ERenderRule rule)
inlinenoexcept

Change the screen rendering rule, see TRenderRule.

Default value if RR_OnDemand

Returns
The previous rendering rule
Parameters
[in]ruleThe new rendering rule