OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
RadialGradientPainter2D.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Color.h"
10#include "OTCore/Point2D.h"
12#include "OTGui/GuiTypes.h"
15
16#define OT_FactoryKey_RadialGradientPainter2D "OT_P2DRGrad"
17
18namespace ot {
19
22 public:
25
29 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
30
34 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
35
37 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_RadialGradientPainter2D); };
38
39 virtual std::string generateQss(void) const override;
40
41 virtual bool isEqualTo(const Painter2D* _other) const override;
42
44 void setCenterPoint(const ot::Point2DD& _center) { m_center = _center; };
45 const ot::Point2DD& getCenterPoint(void) const { return m_center; }
46
47 void setCenterRadius(double _r) { m_centerRadius = _r; };
48 double getCenterRadius(void) const { return m_centerRadius; };
49
51 void setFocalPoint(const ot::Point2DD& _focal);
52 const ot::Point2DD& getFocalPoint(void) const { return m_focal; };
53
56 void setFocalRadius(double _r) { m_focalRadius = _r; };
57 double getFocalRadius(void) const { return m_focalRadius; };
58
59 bool isFocalPointSet(void) const { return m_focalSet; };
60
61 private:
62 ot::Point2DD m_center;
63 double m_centerRadius;
64 ot::Point2DD m_focal;
65 double m_focalRadius;
66 bool m_focalSet;
67 };
68
69}
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
#define OT_FactoryKey_RadialGradientPainter2D
Definition RadialGradientPainter2D.h:16
Definition GradientPainter2D.h:16
Definition Painter2D.h:17
2D Point with double values
Definition Point2D.h:144
Definition RadialGradientPainter2D.h:20
void setCenterPoint(const ot::Point2DD &_center)
Set the center point for the gradient.
Definition RadialGradientPainter2D.h:44
bool isFocalPointSet(void) const
Definition RadialGradientPainter2D.h:59
virtual std::string getFactoryKey(void) const override
Returns the key that is used to create an instance of this class in the simple factory.
Definition RadialGradientPainter2D.h:37
void setCenterRadius(double _r)
Definition RadialGradientPainter2D.h:47
const ot::Point2DD & getFocalPoint(void) const
Definition RadialGradientPainter2D.h:52
void setFocalRadius(double _r)
Set the focal radius Note that the focal point needs to be set.
Definition RadialGradientPainter2D.h:56
double getCenterRadius(void) const
Definition RadialGradientPainter2D.h:48
const ot::Point2DD & getCenterPoint(void) const
Definition RadialGradientPainter2D.h:45
double getFocalRadius(void) const
Definition RadialGradientPainter2D.h:57
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30