OpendTect-6_4  6.4
draw.h
Go to the documentation of this file.
1 #ifndef draw_h
2 #define draw_h
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H. Bril
8  Date: 26/07/2000
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "enums.h"
16 #include "color.h"
17 #include "geometry.h"
18 #include "uistring.h"
19 
20 
22 {
23 public:
24 
25  enum Pos { Start, Stop, Center };
26  enum HPos { Left, Right, HCenter };
28  enum VPos { Top, Bottom, VCenter };
29  mDeclareEnumUtils(VPos)
30 
31  Alignment( HPos h=Left, VPos v=Top );
32  Alignment( Pos h, Pos v );
33 
34  HPos hPos() const { return hor_; }
35  VPos vPos() const { return ver_; }
36  Pos pos(bool hor) const;
37 
38  void set( HPos h, VPos v ) { hor_ = h; ver_ = v; }
39  void set( HPos h ) { hor_ = h; }
40  void set( VPos v ) { ver_ = v; }
41  void set(Pos h,Pos v);
42 
43  int uiValue() const;
44  void setUiValue(int);
45 
46  static HPos opposite( HPos p );
47  static VPos opposite( VPos p );
48 
49 protected:
50 
52  VPos ver_;
53 };
54 
55 
56 #define mAlignment(h,v) Alignment(Alignment::h,Alignment::v)
57 #define mDeclAlignment(nm,h,v) Alignment nm( Alignment::h, Alignment::v )
58 
59 
61 {
62 public:
63 
64  enum Type { None, Square, Circle, Cross, Plus, Target,
65  HLine, VLine, Plane, Triangle, Arrow };
67 
68  MarkerStyle2D( Type tp=Square, int sz=1,
69  Color col=Color::Black(),
70  float rot=0);
71 
72  bool operator==(const MarkerStyle2D& a) const;
73  const MarkerStyle2D& operator=(const MarkerStyle2D& a);
74 
75  Type type_;
76  int size_;
77  Color color_;
78  float rotation_; //clockwise rotion angle in degrees.
79 
80  bool isVisible() const;
81 
82  void toString(BufferString&) const;
83  void fromString(const char*);
84 
85 };
86 
87 
89 {
90 public:
91 
92  enum Type { None=-1,
93  Cube=0, Cone, Cylinder, Sphere, Arrow, Cross,
94  Point, Plane };
96 
97  MarkerStyle3D( Type tp=Cube, int sz=3,
98  Color col=Color::White() );
99 
100  Type type_;
101  int size_;
102  Color color_;
103 
104  bool isVisible() const;
105 
106  void toString(BufferString&) const;
107  void fromString(const char*);
108 
109  bool operator==(const MarkerStyle3D& b) const;
110  bool operator!=(const MarkerStyle3D& b) const;
111  static MarkerStyle2D::Type getMS2DType(MarkerStyle3D::Type);
112 };
113 
114 
115 namespace OD
116 {
117 
119 {
120 public:
121 
122  enum Type { None, Solid, Dash, Dot, DashDot, DashDotDot };
123  // This enum should not be changed: it is cast
124  // directly to a UI enum.
125  mDeclareEnumUtils(Type)
126 
127  LineStyle(Type t=Solid,int w=1,Color c=Color::Black());
128 
129  bool operator ==( const LineStyle& ls ) const;
130  bool operator !=( const LineStyle& ls ) const;
131 
132  Type type_;
133  int width_;
134  Color color_;
135 
136  bool isVisible() const;
137 
138  void toString(BufferString&) const;
139  void fromString(const char*);
140 
141 };
142 
143 } // namespace OD
144 
145 
147 {
148 public:
149 
150  FillPattern( int typ=0, int opt=0 )
151  : type_(typ), opt_(opt) {}
152 
153  static void getTypeNames(BufferStringSet&);
154  static void getOptNames(int,BufferStringSet&);
155 
156  int type_;
157  int opt_;
158 
159  void setNoFill() { type_ = opt_ = 0; }
160  void setFullFill() { type_ = 1; opt_ = 0; }
161  void setMediumDotted() { type_ = 1; opt_ = 4; }
162 
163 };
164 
165 
166 
168 {
169 public:
170  enum Type { Line, Triangle, Square, Cross };
171  enum HandedNess { TwoHanded, LeftHanded, RightHanded };
172 
173  ArrowHeadStyle( int sz=1, Type t=Line, HandedNess h=TwoHanded );
174 
175  void setBoldNess(int b);
176 
177  int sz_;
178  Type type_;
180 
181 };
182 
183 
185 {
186 public:
187 
188  enum Type { HeadOnly, TwoSided, TailOnly, HeadNorTail };
189 
190  ArrowStyle( int boldness=1, Type t=HeadOnly );
191  void setBoldNess( int b );
192 
193  bool hasHead() const;
194  bool hasTail() const;
195 
196  Type type_;
200 
201 };
202 
203 
205 {
206 public:
207 
208  enum LineType { Normal=0, Bold=1, HighLighted=2 };
209 
211  : pos_(mUdf(float))
212  , txt_(uiString::emptyString())
213  , linetype_(Normal) {}
214 
215  float pos_;
218 
219  PlotAnnotation& operator=( const PlotAnnotation& from )
220  {
221  pos_ = from.pos_;
222  linetype_ = from.linetype_;
223  txt_ = from.txt_;
224  return *this;
225  }
226 
227  bool operator==( const PlotAnnotation& from ) const
228  {
229  return pos_ == from.pos_
230  && linetype_ == from.linetype_;
231  }
232 
233  bool isNormal() const
234  { return linetype_ == Normal; }
235 
236 };
237 
238 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Definition: draw.h:171
Definition: draw.h:146
PlotAnnotation()
Definition: draw.h:210
Type type_
Definition: draw.h:196
Definition: draw.h:21
Definition: draw.h:65
Definition: draw.h:26
void setMediumDotted()
Definition: draw.h:161
OD::LineStyle linestyle_
contains the color
Definition: draw.h:197
Definition: draw.h:60
Definition: draw.h:118
Definition: vishorizonsectiondef.h:31
Definition: uistring.h:89
LineType
Definition: draw.h:208
PlotAnnotation & operator=(const PlotAnnotation &from)
Definition: draw.h:219
Set of BufferString objects.
Definition: bufstringset.h:28
VPos vPos() const
Definition: draw.h:35
FixedString Target()
Definition: keystrs.h:130
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
FixedString None()
Definition: keystrs.h:90
bool operator==(const PlotAnnotation &from) const
Definition: draw.h:227
float pos_
Definition: draw.h:215
Definition: draw.h:94
FixedString Cube()
Definition: keystrs.h:51
Definition: draw.h:25
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
void setFullFill()
Definition: draw.h:160
HPos
Definition: draw.h:26
Position.
Definition: commontypes.h:42
ArrowHeadStyle headstyle_
Definition: draw.h:198
LineType linetype_
Definition: draw.h:217
Definition: draw.h:88
Type
Definition: draw.h:92
FillPattern(int typ=0, int opt=0)
Definition: draw.h:150
Definition: draw.h:204
mDeclareEnumUtils(HPos) enum VPos
Definition: draw.h:27
bool isNormal() const
Definition: draw.h:233
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Pos pos(RowID) const
void setNoFill()
Definition: draw.h:159
Type
Definition: draw.h:64
Definition: draw.h:184
ArrowHeadStyle tailstyle_
Definition: draw.h:199
OpendTect.
Definition: commontypes.h:29
uiString txt_
Definition: draw.h:216
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
Type type_
Definition: draw.h:178
int sz_
Definition: draw.h:177
HandedNess
Definition: draw.h:171
HPos hor_
Definition: draw.h:51
#define mClass(module)
Definition: commondefs.h:164
VPos ver_
Definition: draw.h:52
Definition: draw.h:93
int type_
Definition: draw.h:156
Export_Basic const char * toString(ViewStyle)
int opt_
Definition: draw.h:157
HandedNess handedness_
Definition: draw.h:179
Definition: draw.h:167
Definition: vishorizonsectiondef.h:31

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019