NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
scene_initialization_helpers.h
Go to the documentation of this file.
1 
11 #ifndef SDK_VIS_SCENE_INITIALIZATION_HELPERS_H_
12 #define SDK_VIS_SCENE_INITIALIZATION_HELPERS_H_
13 #pragma once
14 
15 #include <map>
16 #include <base/inc/platform.h>
17 #include <base/inc/sdk_results.h>
18 #include <base/inc/sdk_ref_ptr.h>
22 #include "../graphic_context_interface.h"
23 #include "../backend_interface.h"
24 
25 #if defined(SDK_OS_WIN)
26 // Windows/DirectX specific types
27 # include <Windows.h>
28 # if defined(SDK_GRAPHICS_USE_DIRECTX_10_1)
29 # include <d3d10_1.h>
30 # undef ERROR
31 # endif
32 #elif defined(SDK_OS_LINUX)
33 // No additional includes required for Linux
34 #elif defined(SDK_OS_ANDROID)
35 // No additional includes required for Android
36 #else
37 // TODO:
38 Other OS specific includes
39 #endif // SDK_OS_WIN
40 
41 namespace sdk {
42 namespace vis {
43 namespace scene {
44 
49 {
50 public:
53  virtual SDKResult SDK_CALLTYPE GetParameter(SDKParameterID parameter_id, SDKAny& value) const throw();
54  virtual SDKResult SDK_CALLTYPE SetParameter(SDKParameterID parameter_id, const SDKAny& value) throw()
55  { return kSDKResult_NotImplemented; } // Initial value can't be changed
56  virtual SDKResult SDK_CALLTYPE Clone(ISDKParametersSP& clone) const throw()
57  { return kSDKResult_NotImplemented; }
58 
60  virtual SDKAtomicRefCount SDK_CALLTYPE AddRef() const throw();
61  virtual SDKAtomicRefCount SDK_CALLTYPE Release() const throw();
62  virtual SDKResult SDK_CALLTYPE GetInterface(
63  const InterfaceId& id, void** obj_ptr) throw();
65 
68  sdk::vis::scene::IGraphicContextInitialParametersSP& init_params) throw();
72  const sdk::gfx::OSWindow& window, // Should be non-null
73  sdk::vis::scene::IGraphicContextInitialParametersSP& init_params) throw();
74 
76 #if defined(SDK_OS_WIN) && defined(SDK_GRAPHICS_USE_DIRECTX_10_1)
77  // \brief DO NOT RELEASE the ID3D10Device1 instance, due of initial settings
78  // component does not holds a strong reference to it
79  static SDKResult CreateGraphicContextInitialParametersForDirectX10Type(
80  ID3D10Device1* d3d10_device, // Can be NULL to create internal DirectX context
81  sdk::vis::scene::IGraphicContextInitialParametersSP& init_params) throw();
82 #endif // SDK_OS_WIN && SDK_GRAPHICS_USE_DIRECTX_10_1
83 
86  const sdk::gfx::OpenGLGraphicsDeviceContext& device_context,
87  sdk::vis::scene::IGraphicContextInitialParametersSP& init_params) throw();
88 
91  sdk::vis::scene::IGraphicContextInitialParametersSP& init_params) throw();
92 
94 protected:
99 
101  virtual SDKResult SetParameterImpl(const SDKParameterID& id, const SDKAny& value) throw();
102 
103 private:
106  void operator=(const GraphicContextInitParametersHelper&);
107 
108 protected:
109  // Number of references
110  mutable SDKAtomicRefCount m_ref;
111 
112  // Parameters storage
113  typedef std::map<SDKParameterID, SDKAnyHandler> ParametersMap;
114  ParametersMap m_parameters;
116 #if defined(SDK_OS_WIN)
117  // Windows specific Window/DC handles for Window based context
118  HWND m_hwnd;
119  HDC m_hdc;
120 #endif // SDK_OS_WIN
121 };
122 
127 {
128 public:
131  virtual SDKResult SDK_CALLTYPE GetParameter(SDKParameterID parameter_id, SDKAny& value) const throw();
132  virtual SDKResult SDK_CALLTYPE SetParameter(SDKParameterID parameter_id, const SDKAny& value) throw()
133  { return kSDKResult_NotImplemented; } // Initial value can't be changed
134  virtual SDKResult SDK_CALLTYPE Clone(ISDKParametersSP& clone) const throw()
135  { return kSDKResult_NotImplemented; }
136 
138  virtual SDKAtomicRefCount SDK_CALLTYPE AddRef() const throw();
139  virtual SDKAtomicRefCount SDK_CALLTYPE Release() const throw();
140  virtual SDKResult SDK_CALLTYPE GetInterface(const InterfaceId& id,
141  void** obj_ptr) throw();
143 
146  const sdk::gfx::OSWindow& window,
147  sdk::vis::scene::IBackendInitialParametersSP& init_params) throw();
148 
151  const SDKSize& texture_size,
152  sdk::vis::scene::IBackendInitialParametersSP& init_params) throw();
153 
155 protected:
159  virtual ~BackendInitParametersHelper();
160 
162  virtual SDKResult SetParameterImpl(const SDKParameterID& id, const SDKAny& value) throw();
163 
164 private:
167  void operator=(const BackendInitParametersHelper&);
168 
169 protected:
170  // Number of references
171  mutable SDKAtomicRefCount m_ref;
172 
173  // Parameters storage
174  typedef std::map<SDKParameterID, SDKAnyHandler> ParametersMap;
175  ParametersMap m_parameters;
177 };
178 
179 } // namespace scene
180 } // namespace vis
181 } // namespace sdk
182 
183 #endif // SDK_VIS_SCENE_INITIALIZATION_HELPERS_H_
sdk::vis::scene::BackendInitParametersHelper::CreateBackendInitialParametersForTextureType
static SDKResult CreateBackendInitialParametersForTextureType(const SDKSize &texture_size, sdk::vis::scene::IBackendInitialParametersSP &init_params)
Creates backend initial parameters for kBackendType_Texture type.
sdk_results.h
A list of SDK error/return results.
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::ISDKParameters::GetParameter
virtual SDKResult SDK_CALLTYPE GetParameter(SDKParameterID id, SDKAny &value) const =0
Returns the value of the specified parameter.
InterfaceId
Uuid InterfaceId
Definition of interface UUID.
Definition: sdk_uuid.h:45
sdk::vis::scene::GraphicContextInitParametersHelper
Helper class, which allows to create an implementation of IGraphicContextInitialParameters,...
Definition: scene_initialization_helpers.h:48
sdk::vis::scene::GraphicContextInitParametersHelper::CreateGraphicContextInitialParametersForOpenGLType
static SDKResult CreateGraphicContextInitialParametersForOpenGLType(const sdk::gfx::OpenGLGraphicsDeviceContext &device_context, sdk::vis::scene::IGraphicContextInitialParametersSP &init_params)
Creates graphics context initial parameters for kGraphicContextType_DirectX10 type.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::ISDKParameters::SetParameter
virtual SDKResult SDK_CALLTYPE SetParameter(SDKParameterID id, const SDKAny &value)=0
Sets the value of the specified parameter.
sdk_component_interface.h
Common base SDK interfaces.
sdk::vis::scene::BackendInitParametersHelper
Helper class, which allows to create an implementation of IBackendInitialParameters,...
Definition: scene_initialization_helpers.h:126
sdk::vis::scene::IGraphicContextInitialParameters
Initial settings to create an appropriate graphics context by factory. No own methods,...
Definition: graphic_context_interface.h:106
sdk::vis::scene::GraphicContextInitParametersHelper::CreateGraphicContextInitialParametersForAutoType
static SDKResult CreateGraphicContextInitialParametersForAutoType(sdk::vis::scene::IGraphicContextInitialParametersSP &init_params)
Creates graphics context initial parameters for kGraphicContextType_Auto type.
platform.h
Describes the platform constants.
sdk::vis::scene::BackendInitParametersHelper::CreateBackendInitialParametersForWindowType
static SDKResult CreateBackendInitialParametersForWindowType(const sdk::gfx::OSWindow &window, sdk::vis::scene::IBackendInitialParametersSP &init_params)
Creates backend initial parameters for kBackendType_Window type.
os_specific_types.h
Set of structures, which is specific for each of OS, like OpenGL context parameters for Linux or Dire...
kSDKResult_NotImplemented
static const SDKResult kSDKResult_NotImplemented
Not implemented.
Definition: sdk_results.h:70
sdk::vis::scene::GraphicContextInitParametersHelper::CreateGraphicContextInitialParametersForSoftwareType
static SDKResult CreateGraphicContextInitialParametersForSoftwareType(sdk::vis::scene::IGraphicContextInitialParametersSP &init_params)
Creates graphics context for kGraphicContextType_Software type.
SDKSize
SizeUI.
Definition: geometry_base_types.h:1235
sdk::vis::scene::IBackendInitialParameters
Initial settings to create an appropriate backend by factory.
Definition: backend_interface.h:94
sdk_any_handler.h
Wrappers for work with SDKAny instance.