OpendTect  6.6
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  RCS: $Id$
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "generalmod.h"
14 #include "enums.h"
15 #include "color.h"
16 #include "geometry.h"
17 #include "uistring.h"
18 
19 
21 {
22 public:
23 
24  enum Pos { Start, Stop, Center };
25  enum HPos { Left, Right, HCenter };
27  enum VPos { Top, Bottom, VCenter };
29 
30  Alignment( HPos h=Left, VPos v=Top );
31  Alignment( Pos h, Pos v );
32 
33  HPos hPos() const { return hor_; }
34  VPos vPos() const { return ver_; }
35  Pos pos(bool hor) const;
36 
37  void set( HPos h, VPos v ) { hor_ = h; ver_ = v; }
38  void set( HPos h ) { hor_ = h; }
39  void set( VPos v ) { ver_ = v; }
40  void set(Pos h,Pos v);
41 
42  int uiValue() const;
43  void setUiValue(int);
44 
45  static HPos opposite( HPos p );
46  static VPos opposite( VPos p );
47 
48 protected:
49 
51  VPos ver_;
52 };
53 
54 
55 #define mAlignment(h,v) Alignment(Alignment::h,Alignment::v)
56 #define mDeclAlignment(nm,h,v) Alignment nm( Alignment::h, Alignment::v )
57 
58 
60 {
61 public:
62 
63  enum Type { None, Square, Circle, Cross, Plus, Target,
64  HLine, VLine, Plane, Triangle, Arrow };
66 
67  MarkerStyle2D( Type tp=Square, int sz=1,
68  Color col=Color::Black(),
69  float rot=0);
70 
71  bool operator==(const MarkerStyle2D& a) const;
72  const MarkerStyle2D& operator=(const MarkerStyle2D& a);
73 
74  Type type_;
75  int size_;
76  Color color_;
77  float rotation_; //clockwise rotion angle in degrees.
78 
79  bool isVisible() const;
80 
81  void toString(BufferString&) const;
82  void fromString(const char*);
83 
84 };
85 
86 
88 {
89 public:
90 
91  enum Type { None=-1,
92  Cube=0, Cone, Cylinder, Sphere, Arrow, Cross,
93  Point, Plane };
95 
96  MarkerStyle3D( Type tp=Cube, int sz=3,
97  Color col=Color::White() );
98 
99  Type type_;
100  int size_;
101  Color color_;
102 
103  bool isVisible() const;
104 
105  void toString(BufferString&) const;
106  void fromString(const char*);
107 
108  bool operator==(const MarkerStyle3D& b) const;
109  bool operator!=(const MarkerStyle3D& b) const;
110  static MarkerStyle2D::Type getMS2DType(MarkerStyle3D::Type);
111 };
112 
113 
114 namespace OD
115 {
116 
118 {
119 public:
120 
121  enum Type { None, Solid, Dash, Dot, DashDot, DashDotDot };
122  // This enum should not be changed: it is cast
123  // directly to a UI enum.
125 
126  LineStyle(Type t=Solid,int w=1,Color c=Color::Black());
127 
128  bool operator ==( const LineStyle& ls ) const;
129  bool operator !=( const LineStyle& ls ) const;
130 
131  Type type_;
132  int width_;
133  Color color_;
134 
135  bool isVisible() const;
136 
137  void toString(BufferString&) const;
138  void fromString(const char*);
139 
140 };
141 
142 } // namespace OD
143 
144 
146 {
147 public:
148 
149  FillPattern( int typ=0, int opt=0 )
150  : type_(typ), opt_(opt) {}
151 
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:
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 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 
ArrowStyle::hasTail
bool hasTail() const
OD::LineStyle
Definition: draw.h:118
FillPattern::getTypeNames
static void getTypeNames(BufferStringSet &)
FillPattern::type_
int type_
Definition: draw.h:155
PlotAnnotation::LineType
LineType
Definition: draw.h:207
OD::LineStyle::mDeclareEnumUtils
mDeclareEnumUtils(Type) LineStyle(Type t
ArrowHeadStyle::TwoHanded
@ TwoHanded
Definition: draw.h:170
OD::Bottom
@ Bottom
Definition: oduicommon.h:65
MarkerStyle3D::Sphere
@ Sphere
Definition: draw.h:92
uistring.h
ArrowStyle::tailstyle_
ArrowHeadStyle tailstyle_
Definition: draw.h:198
geometry.h
Pos
Position.
Definition: commontypes.h:78
MarkerStyle3D
Definition: draw.h:88
ArrowHeadStyle::handedness_
HandedNess handedness_
Definition: draw.h:178
PlotAnnotation
Definition: draw.h:204
ArrowStyle::type_
Type type_
Definition: draw.h:195
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
MarkerStyle2D::Type
Type
Definition: draw.h:63
Alignment::mDeclareEnumUtils
mDeclareEnumUtils(HPos) enum VPos
Definition: draw.h:26
OD
OpendTect.
Definition: commontypes.h:28
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
ODGMT::Circle
@ Circle
Definition: gmtdef.h:20
OD::Top
@ Top
Definition: oduicommon.h:62
ODGMT::Square
@ Square
Definition: gmtdef.h:20
PlotAnnotation::operator=
PlotAnnotation & operator=(const PlotAnnotation &from)
Definition: draw.h:218
FillPattern::setMediumDotted
void setMediumDotted()
Definition: draw.h:160
Alignment::hor_
HPos hor_
Definition: draw.h:50
OD::LineStyle::Type
Type
Definition: draw.h:121
Alignment::mDeclareEnumUtils
mDeclareEnumUtils(VPos) Alignment(HPos h
FillPattern::getOptNames
static void getOptNames(int, BufferStringSet &)
Alignment::ver_
VPos ver_
Definition: draw.h:51
Alignment::HPos
HPos
Definition: draw.h:25
ArrowHeadStyle
Definition: draw.h:167
ArrowStyle::Type
Type
Definition: draw.h:187
Alignment::uiValue
int uiValue() const
FillPattern::setFullFill
void setFullFill()
Definition: draw.h:159
Alignment::opposite
static VPos opposite(VPos p)
mClass
#define mClass(module)
Definition: commondefs.h:181
ArrowStyle::linestyle_
OD::LineStyle linestyle_
contains the color
Definition: draw.h:196
ArrowStyle
Definition: draw.h:184
PlotAnnotation::linetype_
LineType linetype_
Definition: draw.h:216
Alignment::Right
@ Right
Definition: draw.h:25
Alignment::set
void set(HPos h)
Definition: draw.h:38
PlotAnnotation::pos_
float pos_
Definition: draw.h:214
FillPattern
Definition: draw.h:146
Alignment::pos
Pos pos(bool hor) const
ArrowHeadStyle::sz_
int sz_
Definition: draw.h:176
Triangle
@ Triangle
Definition: vishorizonsectiondef.h:30
ArrowHeadStyle::HandedNess
HandedNess
Definition: draw.h:170
MarkerStyle2D
Definition: draw.h:60
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
Network::None
@ None
Definition: networkcommon.h:33
ArrowStyle::ArrowStyle
ArrowStyle(int boldness=1, Type t=HeadOnly)
ArrowHeadStyle::ArrowHeadStyle
ArrowHeadStyle(int sz=1, Type t=Line, HandedNess h=TwoHanded)
Alignment::setUiValue
void setUiValue(int)
FillPattern::FillPattern
FillPattern(int typ=0, int opt=0)
Definition: draw.h:149
Alignment::set
void set(Pos h, Pos v)
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
ArrowStyle::headstyle_
ArrowHeadStyle headstyle_
Definition: draw.h:197
ArrowStyle::setBoldNess
void setBoldNess(int b)
MarkerStyle3D::Type
Type
Definition: draw.h:91
PlotAnnotation::PlotAnnotation
PlotAnnotation()
Definition: draw.h:209
enums.h
Alignment::vPos
VPos vPos() const
Definition: draw.h:34
Alignment::opposite
static HPos opposite(HPos p)
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
ODGMT::Cross
@ Cross
Definition: gmtdef.h:20
color.h
sKey::Cube
FixedString Cube()
Definition: keystrs.h:51
PlotAnnotation::isNormal
bool isNormal() const
Definition: draw.h:232
sKey::Target
FixedString Target()
Definition: keystrs.h:158
MarkerStyle2D::VLine
@ VLine
Definition: draw.h:64
Alignment::set
void set(HPos h, VPos v)
Definition: draw.h:37
FillPattern::setNoFill
void setNoFill()
Definition: draw.h:158
ArrowHeadStyle::type_
Type type_
Definition: draw.h:177
MarkerStyle3D::mDeclareEnumUtils
mDeclareEnumUtils(Type) MarkerStyle3D(Type tp
Alignment::set
void set(VPos v)
Definition: draw.h:39
ArrowHeadStyle::setBoldNess
void setBoldNess(int b)
FillPattern::opt_
int opt_
Definition: draw.h:156
Alignment::Stop
@ Stop
Definition: draw.h:24
PlotAnnotation::operator==
bool operator==(const PlotAnnotation &from) const
Definition: draw.h:226
Color
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer,...
Definition: color.h:26
Line
@ Line
Definition: vishorizonsectiondef.h:30
Alignment
Definition: draw.h:21
toString
BufferString toString(const BufferStringSet &bss)
Definition: bufstringset.h:156
OD::Left
@ Left
Definition: oduicommon.h:63
MarkerStyle2D::mDeclareEnumUtils
mDeclareEnumUtils(Type) MarkerStyle2D(Type tp
ArrowHeadStyle::Type
Type
Definition: draw.h:169
PlotAnnotation::txt_
uiString txt_
Definition: draw.h:215
ArrowStyle::hasHead
bool hasHead() const
MarkerStyle3D::Point
@ Point
Definition: draw.h:93

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