NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
gl2d_text_interface.h
Go to the documentation of this file.
1 #ifndef SDK_GL2D_TEXT_INTERFACE_H_
11 #define SDK_GL2D_TEXT_INTERFACE_H_
12 #pragma once
13 
14 #include <base/inc/platform.h>
15 #include <base/inc/base_types.h>
16 #include <base/inc/sdk_component_base.h>
18 #include <visualizationlayer/inc/vis_const.h>
19 
20 #include "gl2d_texture_interface.h"
21 #include "gl2d_font_interface.h"
22 
23 SDK_GL2D_BEGIN_NAMESPACE
24 
27 
31 {
35 
39 };
40 
44 {
45  // Simple text
46  // Horizontal one line text only without word-wrapping, etc
47  // Arabian language definitely not implemented
48  kGL2DTextType_Simple = 0,
49 
50  // Bordered text
51  // Same as Simple, i.e. horizontal one line text only without word-wrapping, etc
52  // but in addition text will be bordered
53  // (with same text but with increased stroke size and using different color)
54  // Arabian language definitely not implemented
55  kGL2DTextType_Bordered = 1,
56 };
57 
61 {
62  // Unknown pivot point type
63  kGL2DTextPivotPoint_Unknown = 0,
64 
65  // Text top -----------------> 3------------------4------------------5
66  // | XXXXXXX XXXXX X X XXXXXXX X |
67  // | X X X X X XX |
68  // | X X XX X X X |
69  // 2 X XXXX 10 X X 6
70  // | X X X X X X |
71  // Text center line ---------> 1 X XXXXX X X X XXX |
72  // | |
73  // Text bottom --------------> 9------------------8------------------7
74  // ^ ^
75  // | |
76  // | |
77  // | |
78  // Text left border Text right border
79  //
80 
81  // Pivot point at text left border by Ox, at center line by Oy
82  // (See 1)
83  kGL2DTextPivotPoint_Default = 1,
84 
85  // Pivot point at text left border by Ox, at the middle of height by Oy
86  // (See 2)
87  kGL2DTextPivotPoint_MidLeft = 2,
88 
89  // Pivot point at text left border by Ox, at text top by Oy
90  // (See 3)
91  kGL2DTextPivotPoint_TopLeft = 3,
92 
93  // Pivot point at the middle of text by width for Ox, at text top by Oy
94  // (See 4)
95  kGL2DTextPivotPoint_MidTop = 4,
96 
97  // Pivot point at text right border by Ox, at text top by Oy
98  // (See 5)
99  kGL2DTextPivotPoint_TopRight = 5,
100 
101  // Pivot point at text right border by Ox, at the middle of height by Oy
102  // (See 6)
103  kGL2DTextPivotPoint_MidRight = 6,
104 
105  // Pivot point at text right border by Ox, at text bottom by Oy
106  // (See 7)
107  kGL2DTextPivotPoint_BottomRight = 7,
108 
109  // Pivot point at the middle of text by width for Ox, at text bottom by Oy
110  // (See 8)
111  kGL2DTextPivotPoint_MidBottom = 8,
112 
113  // Pivot point at text left border by Ox, at text bottom by Oy
114  // (See 9)
115  kGL2DTextPivotPoint_BottomLeft = 9,
116 
117  // Pivot point at text center
118  // (See 10)
119  kGL2DTextPivotPoint_Center = 10,
120 };
121 
125 {
126  // Left to right reading direction
127  kGL2DTextReadingDirection_LeftToRight = 0,
128  kGL2DReadDir_LTR = kGL2DTextReadingDirection_LeftToRight,
129 
130  // Right to left reading direction
131  kGL2DTextReadingDirection_RightToLeft = 1,
132  kGL2DReadDir_RTL = kGL2DTextReadingDirection_RightToLeft,
133 };
134 
137 class IGL2DText : public ISDKProperties
138 {
139 public:
141  virtual void SDK_CALLTYPE Dump() const throw() = 0;
142 
144  virtual IGL2DCanvasSP SDK_CALLTYPE GetParent() const throw() = 0;
145 
147  virtual GL2DTextType SDK_CALLTYPE GetType() const throw() = 0;
150  virtual SDKUInt32 SDK_CALLTYPE GetVertexCount() const throw() = 0;
152  virtual SDKUInt32 SDK_CALLTYPE GetTextPositionsCount() const throw() = 0;
154  virtual SDKUInt32 SDK_CALLTYPE GetMemSize() const throw() = 0;
155 
157  virtual IGL2DFontSP SDK_CALLTYPE GetFont() const throw() = 0;
159  inline GL2DFontID SDK_CALLTYPE GetFontID() const
160  {
161  const IGL2DFontSP font = GetFont();
162  return font ? font->GetID() : kGL2DUnknownFontID;
163  }
164 
166  virtual SDKResult SDK_CALLTYPE GetTextString(
167  SDKString& text_string) const throw() = 0;
169  virtual float SDK_CALLTYPE GetFontSize() const throw() = 0;
171  virtual GL2DTextReadingDirection SDK_CALLTYPE GetReadingDirection() const throw() = 0;
173  virtual GL2DTextPivotPoint SDK_CALLTYPE GetPivotPoint() const throw() = 0;
175  virtual SDKPointF2D SDK_CALLTYPE GetPivotPointOffset() const throw() = 0;
177  virtual float SDK_CALLTYPE GetBorderWidth() const throw() = 0;
178 
180  virtual IGL2DTextureSP SDK_CALLTYPE GetTexture() const throw() = 0;
181 
184  virtual SDKUInt32 SDK_CALLTYPE GetTextCenterLine() const throw() = 0;
186  virtual SDKSize SDK_CALLTYPE GetTextSize() const throw() = 0;
187 
191  virtual SDKResult SDK_CALLTYPE Clone(const float* const vertex_data,
192  const SDKUInt32& vertex_data_size, IGL2DTextSP& cloned_text) const throw() = 0;
193 
194  SDK_IMPLEMENT_IID(IGL2DText)
195  SDK_END_INTERFACE(IGL2DText)
196 };
197 SDK_DECLARE_IID(IGL2DText)
198 
199 SDK_GL2D_END_NAMESPACE
200 
201 #endif // SDK_GL2D_TEXT_INTERFACE_H_
IGL2DText::GetFont
virtual IGL2DFontSP SDK_CALLTYPE GetFont() const =0
Returns appropriate Font object.
IGL2DText::GetTextString
virtual SDKResult SDK_CALLTYPE GetTextString(SDKString &text_string) const =0
Returns text string.
base_types.h
SDK base types.
kGL2DTextPropertyID_BorderWidth
@ kGL2DTextPropertyID_BorderWidth
Definition: gl2d_text_interface.h:34
gl2d_font_interface.h
Provides with information about single registered font from GL2D fonts storage.
GL2DTextPropertyIDs
GL2DTextPropertyIDs
Generic GL2D Text properties.
Definition: gl2d_text_interface.h:30
IGL2DText::GetMemSize
virtual SDKUInt32 SDK_CALLTYPE GetMemSize() const =0
Returns text memory size.
IGL2DText::Clone
virtual SDKResult SDK_CALLTYPE Clone(const float *const vertex_data, const SDKUInt32 &vertex_data_size, IGL2DTextSP &cloned_text) const =0
Clones given text with new text position(s) vertex_data - Set of X/Y coordinate pairs to describe tex...
IGL2DText::GetTextSize
virtual SDKSize SDK_CALLTYPE GetTextSize() const =0
Returns text (texture) size.
properties_interface.h
Object generic properties interface.
IGL2DText::Dump
virtual void SDK_CALLTYPE Dump() const =0
Dumps given object.
IGL2DText::GetType
virtual GL2DTextType SDK_CALLTYPE GetType() const =0
Returns text type.
GL2DTextPivotPoint
GL2DTextPivotPoint
GL2D Text type.
Definition: gl2d_text_interface.h:60
IGL2DText::GetPivotPointOffset
virtual SDKPointF2D SDK_CALLTYPE GetPivotPointOffset() const =0
Returns pivot point offset.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
IGL2DText::GetTexture
virtual IGL2DTextureSP SDK_CALLTYPE GetTexture() const =0
Returns text texture (only for textured texts)
IGL2DText::GetReadingDirection
virtual GL2DTextReadingDirection SDK_CALLTYPE GetReadingDirection() const =0
Returns reading direction.
SDKPointF2D
Single 2D point.
Definition: geometry_base_types.h:33
IGL2DText
GL2D Text object.
Definition: gl2d_text_interface.h:137
GL2DTextType
GL2DTextType
GL2D Text type.
Definition: gl2d_text_interface.h:43
platform.h
Describes the platform constants.
IGL2DText::GetPivotPoint
virtual GL2DTextPivotPoint SDK_CALLTYPE GetPivotPoint() const =0
Returns pivot point type.
GL2DFontID
SDKUInt32 GL2DFontID
Font ID.
Definition: gl2d_font_interface.h:29
IGL2DText::GetVertexCount
virtual SDKUInt32 SDK_CALLTYPE GetVertexCount() const =0
Returns number of vertexes in text (4 vertexes per one text quad)
GL2DTextReadingDirection
GL2DTextReadingDirection
GL2D Text reading direction.
Definition: gl2d_text_interface.h:124
IGL2DCanvas
GL2D Canvas to use to drawing NOTE! Create/Draw functionality was moved to appropriate GL2D Canvas Fu...
Definition: gl2d_canvas_interface.h:435
IGL2DText::GetParent
virtual IGL2DCanvasSP SDK_CALLTYPE GetParent() const =0
Returns parent canvas object.
IGL2DText::GetFontID
GL2DFontID SDK_CALLTYPE GetFontID() const
Returns appropriate Font ID.
Definition: gl2d_text_interface.h:159
IGL2DText::GetTextPositionsCount
virtual SDKUInt32 SDK_CALLTYPE GetTextPositionsCount() const =0
Returns number of text positions.
IGL2DText::GetTextCenterLine
virtual SDKUInt32 SDK_CALLTYPE GetTextCenterLine() const =0
Returns text center line position in texture (starting from 0 - bottom of texture)
kGL2DTextPropertyID_BorderTextTexture
@ kGL2DTextPropertyID_BorderTextTexture
Definition: gl2d_text_interface.h:38
IGL2DText::GetFontSize
virtual float SDK_CALLTYPE GetFontSize() const =0
Returns font size.
IGL2DText::GetBorderWidth
virtual float SDK_CALLTYPE GetBorderWidth() const =0
Returns text border width (bordered texts only)
kGL2DUnknownFontID
static const GL2DFontID kGL2DUnknownFontID
Unknown Font ID.
Definition: gl2d_font_interface.h:33
gl2d_texture_interface.h
GL2D Texture object.
SDKSize
SizeUI.
Definition: geometry_base_types.h:1235
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.