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

Renders basic geometric shapes onto a Canvas. More...

Inheritance diagram for gem::BasicShapeDrawer:
Collaboration diagram for gem::BasicShapeDrawer:

Classes

struct  __allow_private_constructor

Public Member Functions

void renderShapes (XyF translationFactor=XyF(0.0f, 0.0f), XyF scaleFactor=XyF(1.0f, 1.0f))
 Renders the shapes.
unsigned int createTexture (const void *pImage, unsigned int width, unsigned int height, EColorFormat format)
 Creates a texture.
unsigned int createTexture (const String &fileName, EImageFileFormat fileFormat, EColorFormat format)
 Creates a texture by file name.
void deleteTexture (unsigned int textureId)
 Deletes a texture.
void drawCircle (const XyF &center, float radius, unsigned int color, bool bFilled=false)
 Draws a circle.
void drawLine (const XyF &start, const XyF &end, unsigned int color=0, float thickness=1.f)
 Draws a line.
void drawTexturedRectangle (unsigned int nTextureId, const XyF &topLeft, const XyF &botRight, unsigned int color=0, bool bFilled=false, float thickness=1.f)
 Draws a textured rectangle.
void drawRectangle (const XyF &topLeft, const XyF &botRight, unsigned int color=0, bool bFilled=false, float thickness=1.f)
 Draws a rectangle.
void drawRoundedRectangle (const XyF &topLeft, const XyF &botRight, unsigned int color=0, bool bFilled=false, float thickness=1.f)
 Draws a rounded rectangle.
void drawText (const String &text, XyF position, TextState style)
 Draws text with style.
int getTextWidth (const String &text, TextState style)
 Gets the text width.
int getTextAscent (TextState style)
 Gets the text ascent.
int getTextDescent (TextState style)
 Gets the text descent.

Static Public Member Functions

static StrongPointer< BasicShapeDrawerproduce (StrongPointer< Canvas > canvas)
 Creates a BasicShapeDrawer object.

Protected Types

using Base = ApiObject<IBasicShapesRenderer, false>
 The base class.

Detailed Description

Renders basic geometric shapes onto a Canvas.

Provides utilities to draw lines, circles, and polygons for overlays, debugging, or visualization.Shapes are rendered into a Canvas and displayed within a MapView.

Member Function Documentation

◆ createTexture() [1/2]

unsigned int gem::BasicShapeDrawer::createTexture ( const String & fileName,
EImageFileFormat fileFormat,
EColorFormat format )
inline

Creates a texture by file name.

Parameters
fileNameThe file name
fileFormatThe file format
formatThe color format
Returns
The texture ID

◆ createTexture() [2/2]

unsigned int gem::BasicShapeDrawer::createTexture ( const void * pImage,
unsigned int width,
unsigned int height,
EColorFormat format )
inline

Creates a texture.

Parameters
pImageThe image
widthThe width
heightThe height
formatThe color format
Returns
The texture ID

◆ deleteTexture()

void gem::BasicShapeDrawer::deleteTexture ( unsigned int textureId)
inline

Deletes a texture.

Parameters
textureIdThe texture ID

◆ drawCircle()

void gem::BasicShapeDrawer::drawCircle ( const XyF & center,
float radius,
unsigned int color,
bool bFilled = false )
inline

Draws a circle.

Parameters
centerThe center
radiusThe radius
colorThe color
bFilledThe flag indicating whether the circle is filled

◆ drawLine()

void gem::BasicShapeDrawer::drawLine ( const XyF & start,
const XyF & end,
unsigned int color = 0,
float thickness = 1.f )
inline

Draws a line.

Parameters
startThe start
endThe end
colorThe color
thicknessThe thickness of the line

◆ drawRectangle()

void gem::BasicShapeDrawer::drawRectangle ( const XyF & topLeft,
const XyF & botRight,
unsigned int color = 0,
bool bFilled = false,
float thickness = 1.f )
inline

Draws a rectangle.

Parameters
topLeftThe top-left
botRightThe bottom-right
colorThe color
bFilledThe flag indicating whether the rectangle is filled
thicknessThe thickness of the rectangle

◆ drawRoundedRectangle()

void gem::BasicShapeDrawer::drawRoundedRectangle ( const XyF & topLeft,
const XyF & botRight,
unsigned int color = 0,
bool bFilled = false,
float thickness = 1.f )
inline

Draws a rounded rectangle.

Parameters
topLeftThe top-left
botRightThe bottom-right
colorThe color
bFilledThe flag indicating whether the rectangle is filled
thicknessThe thickness of the rectangle

◆ drawText()

void gem::BasicShapeDrawer::drawText ( const String & text,
XyF position,
TextState style )
inline

Draws text with style.

Parameters
textThe text
positionThe position
styleThe text style

◆ drawTexturedRectangle()

void gem::BasicShapeDrawer::drawTexturedRectangle ( unsigned int nTextureId,
const XyF & topLeft,
const XyF & botRight,
unsigned int color = 0,
bool bFilled = false,
float thickness = 1.f )
inline

Draws a textured rectangle.

Parameters
nTextureIdThe texture ID
topLeftThe top-left
botRightThe bottom-right
colorThe color
bFilledThe flag indicating whether the rectangle is filled
thicknessThe thickness of the rectangle

◆ getTextAscent()

int gem::BasicShapeDrawer::getTextAscent ( TextState style)
inline

Gets the text ascent.

Parameters
styleThe text style
Returns
The text ascent

◆ getTextDescent()

int gem::BasicShapeDrawer::getTextDescent ( TextState style)
inline

Gets the text descent.

Parameters
styleThe text style
Returns
The text descent

◆ getTextWidth()

int gem::BasicShapeDrawer::getTextWidth ( const String & text,
TextState style )
inline

Gets the text width.

Parameters
textThe text
styleThe text style
Returns
The text width

◆ produce()

StrongPointer< BasicShapeDrawer > gem::BasicShapeDrawer::produce ( StrongPointer< Canvas > canvas)
inlinestatic

Creates a BasicShapeDrawer object.

Parameters
canvasThe canvas
Returns
The BasicShapeDrawer object

◆ renderShapes()

void gem::BasicShapeDrawer::renderShapes ( XyF translationFactor = XyF( 0.0f, 0.0f ),
XyF scaleFactor = XyF( 1.0f, 1.0f ) )
inline

Renders the shapes.

Parameters
translationFactorThe translation factor
scaleFactorThe scale factor