1 #pragma once
2 
3 #ifndef TREGIONPROP_H
4 #define TREGIONPROP_H
5 
6 #include "tgeometry.h"
7 #include "tregionoutline.h"
8 #include "tsimplecolorstyles.h"
9 
10 #undef DVAPI
11 #undef DVVAR
12 
13 #ifdef TVRENDER_EXPORTS
14 #define DVAPI DV_EXPORT_API
15 #define DVVAR DV_EXPORT_VAR
16 #else
17 #define DVAPI DV_IMPORT_API
18 #define DVVAR DV_IMPORT_VAR
19 #endif
20 
21 //============================================================================//
22 
23 // forward declarations
24 
25 class TColorStyle;
26 class TRegion;
27 class TVectorRenderData;
28 class TInputStreamInterface;
29 class TOutputStreamInterface;
30 
31 template <class T>
32 class TRasterPT;
33 class TPixelRGBM32;
34 
35 typedef TPixelRGBM32 TPixel32;
36 typedef TRasterPT<TPixel32> TRaster32P;
37 
38 //============================================================================//
39 //                                TRegionProp //
40 //============================================================================//
41 
42 class TRegionProp {
43   const TRegion *const m_region;
44 
45 protected:
46   bool m_regionChanged;
47   int m_styleVersionNumber;
48 
49 public:
50   TRegionProp(const TRegion *region);
51 
~TRegionProp()52   virtual ~TRegionProp() {}
53 
54   //! Note: update internal data if isRegionChanged()
55   virtual void draw(const TVectorRenderData &rd) = 0;
56 
getRegion()57   const TRegion *getRegion() const { return m_region; }
58 
59   virtual const TColorStyle *getColorStyle() const = 0;
60 
notifyRegionChange()61   virtual void notifyRegionChange() { m_regionChanged = true; }
62 
63   virtual TRegionProp *clone(const TRegion *region) const = 0;
64 
65 private:
66   // not implemented
67   TRegionProp(const TRegionProp &);
68   TRegionProp &operator=(const TRegionProp &);
69 };
70 
71 //-------------------------------------------------------------------
72 
73 class OutlineRegionProp final : public TRegionProp {
74   double m_pixelSize;
75   TOutlineStyleP m_colorStyle;
76 
77   TRegionOutline m_outline;
78 
79   //-------------------------------------------------------------------
80 
81   void computeRegionOutline();
82 
83 public:
84   OutlineRegionProp(const TRegion *region, const TOutlineStyleP regionStyle);
85 
86   void draw(const TVectorRenderData &rd) override;
87 
88   const TColorStyle *getColorStyle() const override;
89 
90   TRegionProp *clone(const TRegion *region) const override;
91 };
92 
93 #endif
94