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

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