OpendTect-6_4  6.4
pickset.h
Go to the documentation of this file.
1 #ifndef pickset_h
2 #define pickset_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: May 2001 / Mar 2016
10  Contents: PickSet base classes
11  RCS: $Id$
12 ________________________________________________________________________
13 
14 -*/
15 
16 #include "picklocation.h"
17 #include "enums.h"
18 #include "namedobj.h"
19 #include "trckey.h"
20 #include "sets.h"
21 #include "draw.h"
22 #include "tableascio.h"
23 template <class T> class ODPolygon;
24 
25 
26 namespace Pick
27 {
28 
31 mExpClass(General) Set : public NamedObject, public TypeSet<Location>
32 {
33 public:
34  Set(const char* nm=0);
35  Set(const Set&);
36  ~Set();
37 
38  Set& operator =(const Set&);
39 
40  struct Disp
41  {
42  Disp()
43  : color_(Color::NoColor())
44  , markertype_(3) // Sphere
45  , connect_(None)
46  , pixsize_(3) {}
47  enum Connection { None, Open, Close };
50  int pixsize_;
53  };
54 
57  bool is2D() const;
59  Pos::SurvID getSurvID() const;
61 
62  bool isPolygon() const;
63  void getPolygon(ODPolygon<double>&,int idx=0) const;
64  void getLocations(ObjectSet<Location>&,int idx=0);
65  void getLocations(ObjectSet<const Location>&,int idx=0)const;
66  float getXYArea(int idx=0) const;
68  size_type find(const TrcKey&) const;
69  size_type nearestLocation(const Coord&) const;
70  size_type nearestLocation(const Coord3&,bool ignorez=false) const;
71 
72  static const char* sKeyMarkerType() { return "Marker Type"; }
73  void fillPar(IOPar&) const;
74  bool usePar(const IOPar&);
75  void fillDisplayPars(IOPar&) const;
76  bool useDisplayPars(const IOPar&);
77  bool writeDisplayPars() const;
78 
79  void removeSingleWithUndo(size_type idx);
80  void insertWithUndo(size_type,const Pick::Location&);
81  void appendWithUndo(const Pick::Location&);
82  void moveWithUndo(size_type,const Pick::Location&,
83  const Pick::Location&);
84 
85  inline Location& get( size_type idx ) { return (*this)[idx]; }
86  inline const Location& get( size_type idx ) const { return (*this)[idx]; }
87 
88  void setReadOnly( bool yn ) { readonly_ = yn; }
89  bool isReadOnly() const { return readonly_; }
90 
91  // The following stuff with indexes is a kludge that will be replaced
92  // by the Group Label in 7.X
93  void addStartIdx(int locidx);
94  void setStartIdx(int setidx,int locidx);
95  int nrSets() const { return startidxs_.size(); }
96  void getStartStopIdx(int setidx,int& start,int&stop) const;
97  const TypeSet<int>& startIndexs() const { return startidxs_; }
98 
99  bool isSizeLargerThanThreshold() const;
100  static const char* sKeyThresholdSize()
101  { return "PointSet Size Threshold";}
102  static const char* sKeyUseThreshold()
103  { return "Use PointSet Size Threshold";}
104  static int getSizeThreshold();
105 
106 private:
107 
108  enum EventType { Insert, PolygonClose, Remove, Move };
109  void addUndoEvent(EventType,size_type,const Pick::Location&);
110 
112  bool readonly_;
113 
114 };
115 
118 mExpClass(General) List : public ObjectSet<Location>
119 {
120 public:
121 
122  List() {}
123  List( const Pick::Set& ps ) { addAll( ps ); }
124 
125  List& add(const Pick::Location&,bool mkcopy=false);
126  inline void addAll( const Pick::Set& ps )
127  { const_cast<Pick::Set&>(ps).getLocations(*this); }
128 
129  inline bool is2D() const;
130  inline Pos::SurvID getSurvID() const;
131  size_type find(const TrcKey&) const;
132  size_type nearestLocation(const Coord&) const;
133  size_type nearestLocation(const Coord3&,bool ignorez=false) const;
134 
135  inline Location& get( size_type idx ) { return *(*this)[idx];}
136  inline const Location& get( size_type idx ) const { return *(*this)[idx];}
137 
138 };
139 
140 
141 template <class PicksType>
142 inline bool is2D( const PicksType& picks )
143 {
144  return TrcKey::is2D( picks.getSurvID() );
145 }
146 
147 template <class PicksType>
148 inline bool getSurvID( const PicksType& picks )
149 {
150  return picks.isEmpty() ? false : picks.get(0).trcKey().survID();
151 }
152 
153 inline bool Pick::List::is2D() const { return Pick::is2D( *this ); }
155 { return Pick::getSurvID( *this ); }
156 
157 
158 } // namespace Pick
159 
160 
161 mExpClass(General) PickSetAscIO : public Table::AscIO
162 {
163 public:
165  : Table::AscIO(fd) {}
166 
167  static Table::FormatDesc* getDesc(bool iszreq);
168  static void updateDesc(Table::FormatDesc&,bool iszreq);
169  static void createDescBody(Table::FormatDesc*,bool iszreq);
170 
171  bool isXY() const;
172  bool get(od_istream&,Pick::Set&,bool iszreq,
173  float zval) const;
174 };
175 
176 
177 /* This include will go away after 6.0 */
178 #include "picksetmgr.h"
179 
180 
181 #endif
#define mExpClass(module)
Definition: commondefs.h:160
static const char * sKeyUseThreshold()
Definition: pickset.h:102
static const char * sKeyMarkerType()
Definition: pickset.h:72
int pixsize_
size in pixels
Definition: pickset.h:50
bool isReadOnly() const
Definition: pickset.h:89
Pick location in space,.
Definition: picklocation.h:46
Definition: pickset.h:47
bool readonly_
Definition: pickset.h:112
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
Connection connect_
connect picks in set order
Definition: pickset.h:52
(Closed) sequence of connected 2-D coordinates.
Definition: polygon.h:27
PickSetAscIO(const Table::FormatDesc &fd)
Definition: pickset.h:164
Disp disp_
Definition: pickset.h:55
int size_type
Definition: objectset.h:39
description of input our output data content
Definition: tabledef.h:220
List()
Definition: pickset.h:122
A cartesian coordinate in 2D space.
Definition: coord.h:25
ObjectSet of Pick::Location&#39;s. Does not manage.
Definition: pickset.h:118
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
FixedString None()
Definition: keystrs.h:90
OD class for stream read.
Definition: od_istream.h:24
Definition: pickset.h:40
void addAll(const Pick::Set &ps)
Definition: pickset.h:126
Set of picks with something in common.
Definition: pickset.h:31
Definition: pickset.h:161
TypeSet< int > startidxs_
Definition: pickset.h:111
List(const Pick::Set &ps)
Definition: pickset.h:123
Pos::SurvID getSurvID() const
Definition: pickset.h:154
int size_type
Definition: typeset.h:30
Set of (small) copyable elements.
Definition: commontypes.h:30
IOPar & pars_
Definition: pickset.h:56
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Definition: geom2dascio.h:21
Index_Type SurvID
Definition: commontypes.h:49
int markertype_
MarkerStyle3D.
Definition: pickset.h:51
Color color_
color
Definition: pickset.h:49
EventType
Definition: pickset.h:108
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
bool is2D() const
Definition: pickset.h:153
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
Connection
Definition: pickset.h:47
A cartesian coordinate in 3D space.
Definition: coord.h:72
bool getSurvID(const PicksType &picks)
Definition: pickset.h:148
Disp()
Definition: pickset.h:42
Object with a name.
Definition: namedobj.h:35
bool is2D(const PicksType &picks)
Definition: pickset.h:142
Definition: picklocation.h:21
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
bool is2D() const
Definition: trckey.h:44
void setReadOnly(bool yn)
Definition: pickset.h:88
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
static const char * sKeyThresholdSize()
Definition: pickset.h:100
const TypeSet< int > & startIndexs() const
Definition: pickset.h:97
int nrSets() const
Definition: pickset.h:95
Definition: pickset.h:108

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