ACF $AcfVersion:0$
TObject2dCompWrap.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
8#include <i2d/IObject2d.h>
10
11namespace i2d
12{
13
14
19template <class BaseObject2d>
20class TObject2dCompWrap: public icomp::CComponentBase, public BaseObject2d
21{
22public:
24 typedef BaseObject2d BaseClass2;
25
26 I_BEGIN_COMPONENT(TObject2dCompWrap);
27 I_REGISTER_INTERFACE(IObject2d);
28 I_REGISTER_INTERFACE(iser::ISerializable);
29 I_REGISTER_INTERFACE(istd::IChangeable);
30 I_ASSIGN(m_calibrationCompPtr, "Calibration", "Calibration associated with this 2d object", false, "Calibration");
31 I_ASSIGN(m_defaultObjectProviderCompPtr, "DefaultObject2dProvider", "Default object prototype provider", false, "DefaultObject2dProvider");
32 I_END_COMPONENT;
33
34protected:
35 // reimplemented (icomp::CComponentBase)
36 virtual void OnComponentCreated() override;
37
38protected:
39 I_REF(i2d::ICalibration2d, m_calibrationCompPtr);
40 I_REF(i2d::IObject2dProvider, m_defaultObjectProviderCompPtr);
41};
42
43
44// protected methods
45
46// reimplemented (icomp::CComponentBase)
47
48template <class BaseObject2d>
50{
51 BaseClass::OnComponentCreated();
52
53 BaseClass2::SetCalibration(m_calibrationCompPtr.GetPtr(), false);
54
55 if (m_defaultObjectProviderCompPtr.IsValid()){
56 const i2d::IObject2d* defaultGeomPtr = m_defaultObjectProviderCompPtr->GetObject2d();
57 if (defaultGeomPtr != nullptr){
58 BaseClass2::CopyFrom(*defaultGeomPtr);
59 }
60
61 const i2d::ICalibration2d* calibrationPtr = BaseClass2::GetCalibration();
62
63 if (calibrationPtr != NULL){
64 BaseClass2::InvTransform(*calibrationPtr);
65 BaseClass2::SetCalibration(calibrationPtr);
66 }
67 }
68}
69
70
71} // namespace i2d
72
73
74
75
Interface for 2D calibration and coordinate transformation with unit information.
Common interface for describing the 2D-objects.
Definition IObject2d.h:26
Common interface for a provider, which delivers a 2D-object.
Base class for all components implementing 2D objects.
virtual void OnComponentCreated() override
icomp::CComponentBase BaseClass
Base class for component implementation.
Common class for all classes which objects can be archived or restored from archive.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
#define NULL
Definition istd.h:74
Contains the 2D objects.
Definition CAffine2d.h:11