NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
backend_interface.h
Go to the documentation of this file.
1 
10 #include <base/inc/platform.h>
11 #include <base/inc/base_types.h>
13 #include <base/inc/sdk_ref_ptr.h>
19 
20 #ifndef SDK_VIS_BACKEND_INTERFACE_H_
21 #define SDK_VIS_BACKEND_INTERFACE_H_
22 #pragma once
23 
24 namespace sdk {
25 namespace vis {
26 namespace scene {
27 
28 FWD_DECL_INTERFACE(IBackendInitialParameters);
29 FWD_DECL_INTERFACE(IBackendFactory);
30 FWD_DECL_INTERFACE(IBackend);
31 FWD_DECL_INTERFACE(IBackendEvents);
32 FWD_DECL_INTERFACE(IGraphicContext);
33 FWD_DECL_INTERFACE(ILayerClipping);
34 FWD_DECL_INTERFACE(ITexture);
35 FWD_DECL_INTERFACE(ISpriteList);
36 
40 {
43 };
44 
48 {
51 
54 
57 
60 
63 
66 
69 
72 
74  kBackendProperty_EraseBackground,
75 };
76 
80 {
86 };
87 
90 static const float kOpaqueLayer_Opacity = -1.0;
91 
95 {
96 public:
97  // No own methods, only ISDKParameters methods
98 
99  SDK_IMPLEMENT_IID(IBackendInitialParameters)
100  SDK_END_INTERFACE(IBackendInitialParameters)
101 };
102 SDK_DECLARE_IID(IBackendInitialParameters)
103 
104 class IBackendFactory : public ISDKComponent
107 {
108 public:
110  virtual SDKResult SDK_CALLTYPE CreateBackend(
111  BackendType type, GraphicContextType gc_type,
112  const IBackendInitialParametersSP& backend_parameters,
113  const IGraphicContextInitialParametersSP& gc_parameters,
114  const IBackendEventsSP& events_handler, IBackendSP& backend) throw() = 0;
115 
118  virtual SDKResult SDK_CALLTYPE IsGraphicContextAvailable(GraphicContextType type) const throw() = 0;
119 
120  SDK_IMPLEMENT_IID(IBackendFactory)
121  SDK_END_INTERFACE(IBackendFactory)
122 };
123 SDK_DECLARE_IID(IBackendFactory)
124 
125 class IBackend : public ISDKProperties
129 {
130 public:
132  virtual BackendType SDK_CALLTYPE GetType() const throw() = 0;
133 
135  virtual GraphicContextType SDK_CALLTYPE GetGCType() const throw() = 0;
136 
138  virtual SDKResult SDK_CALLTYPE GetGraphicContext(
139  IGraphicContextSP& context) throw() = 0;
140 
142  virtual SDKResult SDK_CALLTYPE SetViewportParams(
143  const SDKMatrix4X4& scene_viewport_transform) throw() = 0;
144 
146  virtual SDKResult SDK_CALLTYPE StartDraw() throw() = 0;
147 
149  virtual SDKResult SDK_CALLTYPE DrawTexture(const ITextureSP& texture,
150  const SDKRectF2D& bounds, const SDKRectF2D& viewport,
151  const SDKMatrix4X4& transform, float opacity,
152  const ILayerClippingSP& clipping) throw() = 0;
153 
155  virtual SDKResult SDK_CALLTYPE DrawSprites(const ITextureSP& texture,
156  const SDKRectF2D& viewport, const SDKMatrix4X4* transforms, SDKUInt64 num,
157  const SDKMatrix4X4& transform, float opacity) throw() = 0;
158 
160  virtual SDKResult SDK_CALLTYPE FinishDraw() throw() = 0;
161 
164  virtual SDKResult SDK_CALLTYPE CopyBits(const SDKRect2D& rect_to_copy,
165  const TextureFormat& format, const SDKUInt32& stride_size,
166  const TextureStrideOrder& stride_order, const SDKUInt32& bits_size,
167  SDKUInt8* const bits) const throw() = 0;
168 
169  SDK_IMPLEMENT_IID(IBackend)
170  SDK_END_INTERFACE(IBackend)
171 };
172 SDK_DECLARE_IID(IBackend)
173 
177 {
178 };
179 
183 {
184 public:
186  virtual SDKResult SDK_CALLTYPE OnEvent(
187  const BackendEventID& id, const SDKAny* param) throw() = 0;
188 
189  SDK_IMPLEMENT_IID(IBackendEvents)
190  SDK_END_INTERFACE(IBackendEvents)
191 };
192 SDK_DECLARE_IID(IBackendEvents)
193 
194 } // namespace scene
195 } // namespace vis
196 } // namespace sdk
197 
198 #endif // SDK_VIS_BACKEND_INTERFACE_H_
sdk::vis::scene::IBackend::GetType
virtual BackendType SDK_CALLTYPE GetType() const =0
Returns backend type (Window/Texture)
base_types.h
SDK base types.
sdk::vis::scene::BackendPropertyIDs
BackendPropertyIDs
The backend property ids.
Definition: backend_interface.h:47
sdk::vis::scene::kBackendType_Texture
@ kBackendType_Texture
backend based on texture.
Definition: backend_interface.h:42
sdk::vis::scene::IBackendFactory::IsGraphicContextAvailable
virtual SDKResult SDK_CALLTYPE IsGraphicContextAvailable(GraphicContextType type) const =0
Checks, if backend, based on specified graphic context type can be created. Same as IGraphicContextFa...
geometry_base_types_helpers.h
Geometry types.
sdk::vis::scene::BackendType
BackendType
The backend type.
Definition: backend_interface.h:39
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::vis::scene::kBackendInitialParameter_TextureWidth
@ kBackendInitialParameter_TextureWidth
Target texture width.
Definition: backend_interface.h:84
properties_interface.h
Object generic properties interface.
sdk::vis::scene::IBackendFactory::CreateBackend
virtual SDKResult SDK_CALLTYPE CreateBackend(BackendType type, GraphicContextType gc_type, const IBackendInitialParametersSP &backend_parameters, const IGraphicContextInitialParametersSP &gc_parameters, const IBackendEventsSP &events_handler, IBackendSP &backend)=0
Creates backend according to a specified type.
sdk::vis::scene::IBackend::DrawTexture
virtual SDKResult SDK_CALLTYPE DrawTexture(const ITextureSP &texture, const SDKRectF2D &bounds, const SDKRectF2D &viewport, const SDKMatrix4X4 &transform, float opacity, const ILayerClippingSP &clipping)=0
Draws texture.
sdk::vis::scene::IBackend::FinishDraw
virtual SDKResult SDK_CALLTYPE FinishDraw()=0
Should be called after Draw* functions.
sdk::vis::scene::kBackendInitialParameter_TextureHeight
@ kBackendInitialParameter_TextureHeight
Target texture height.
Definition: backend_interface.h:85
sdk::vis::scene::kBackendProperty_Texture
@ kBackendProperty_Texture
Initiates backend resizing procedures (sometimes drawing stops working w/o it)
Definition: backend_interface.h:59
sdk::vis::scene::IBackend::CopyBits
virtual SDKResult SDK_CALLTYPE CopyBits(const SDKRect2D &rect_to_copy, const TextureFormat &format, const SDKUInt32 &stride_size, const TextureStrideOrder &stride_order, const SDKUInt32 &bits_size, SDKUInt8 *const bits) const =0
Shortcut for getting data from scene backend image. (Synchronized with Draw functions)
sdk::vis::scene::BackendEventID
BackendEventID
Generic backend event IDs.
Definition: backend_interface.h:176
parameters_interface.h
Provides access to members for managing a parameter set.
SDKRectF2D
2D Rectangle
Definition: geometry_base_types.h:1295
sdk::vis::scene::IBackend::GetGCType
virtual GraphicContextType SDK_CALLTYPE GetGCType() const =0
Returns graphic context type.
sdk::ISDKParameters
Provides access to members that manage parameters of an object.
Definition: parameters_interface.h:33
sdk::vis::scene::GraphicContextType
GraphicContextType
Possible types of graphics context, like context based on DirectX or OpenGL.
Definition: graphic_context_interface.h:49
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
matrix4x4.h
Matrix 4X4 implementation.
sdk::vis::scene::BackendInitialParametersID
BackendInitialParametersID
Initialization parameters for Window/Texture backends.
Definition: backend_interface.h:79
sdk::vis::scene::kOpaqueLayer_Opacity
static const float kOpaqueLayer_Opacity
Reserved opacity value for opaque layer.
Definition: backend_interface.h:90
sdk::ISDKProperties
Provides access to members that control the properties.
Definition: properties_interface.h:32
sdk::vis::scene::IBackend::DrawSprites
virtual SDKResult SDK_CALLTYPE DrawSprites(const ITextureSP &texture, const SDKRectF2D &viewport, const SDKMatrix4X4 *transforms, SDKUInt64 num, const SDKMatrix4X4 &transform, float opacity)=0
Draws sprites list.
sdk::vis::scene::kBackendProperty_ForceResize
@ kBackendProperty_ForceResize
Use texture antialiasing during combining several layers textures (kSDKAnyType_Bool)
Definition: backend_interface.h:62
sdk_component_interface.h
Common base SDK interfaces.
graphic_context_interface.h
Definition of graphic context interfaces.
platform.h
Describes the platform constants.
sdk::vis::scene::kBackendProperty_UseTextureAntialiasing
@ kBackendProperty_UseTextureAntialiasing
Use texture filtering during combining several layers textures (kSDKAnyType_Bool)
Definition: backend_interface.h:65
sdk::vis::scene::kBackendInitialParameter_DeviceDisplay
@ kBackendInitialParameter_DeviceDisplay
OS specific display.
Definition: backend_interface.h:82
sdk::vis::scene::kBackendProperty_UseTextureFiltering
@ kBackendProperty_UseTextureFiltering
Switch on debug logging (kSDKAnyType_Bool)
Definition: backend_interface.h:68
ISDKComponent
Base interface for all SDK interfaces.
Definition: sdk_component_interface.h:41
sdk::vis::scene::kBackendProperty_DebugLogging
@ kBackendProperty_DebugLogging
Erase backend background on start (kSDKAnyType_Bool)
Definition: backend_interface.h:71
sdk::vis::scene::kBackendInitialParameter_DeviceWnd
@ kBackendInitialParameter_DeviceWnd
OS specific window handle.
Definition: backend_interface.h:81
sdk::vis::scene::kBackendProperty_BackgroundColor
@ kBackendProperty_BackgroundColor
Background color (kSDKAnyType_Uint32 - ARGB)
Definition: backend_interface.h:50
sdk::vis::scene::IBackend::StartDraw
virtual SDKResult SDK_CALLTYPE StartDraw()=0
Should be called before Draw* functions.
sdk::vis::scene::IBackendEvents
Generic backend events.
Definition: backend_interface.h:182
sdk::vis::scene::kBackendProperty_Width
@ kBackendProperty_Width
Height of the backend space. (kSDKAnyType_Uint32)
Definition: backend_interface.h:53
sdk::vis::scene::kBackendInitialParameter_VisualInfo
@ kBackendInitialParameter_VisualInfo
OS specific visual info.
Definition: backend_interface.h:83
sdk::vis::scene::kBackendType_Window
@ kBackendType_Window
backend based on OS window.
Definition: backend_interface.h:41
sdk::vis::scene::kBackendProperty_Height
@ kBackendProperty_Height
Returns texture with drawing results (kSDKAnyType_SDKComponentPtr with ITexture)
Definition: backend_interface.h:56
sdk::vis::scene::IBackendFactory
Factory for all graphic context implementations.
Definition: backend_interface.h:106
sdk::vis::scene::IBackend::GetGraphicContext
virtual SDKResult SDK_CALLTYPE GetGraphicContext(IGraphicContextSP &context)=0
Returns associated graphic context (can absent)
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
sdk::vis::scene::IBackendInitialParameters
Initial settings to create an appropriate backend by factory.
Definition: backend_interface.h:94
sdk::vis::scene::IBackend::SetViewportParams
virtual SDKResult SDK_CALLTYPE SetViewportParams(const SDKMatrix4X4 &scene_viewport_transform)=0
Sets scene viewport parameters.