OpendTect  6.6
pickset.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: May 2001 / Mar 2016
9  Contents: PickSet base classes
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "picklocation.h"
16 #include "enums.h"
17 #include "namedobj.h"
18 #include "trckey.h"
19 #include "sets.h"
20 #include "draw.h"
21 #include "tableascio.h"
22 template <class T> class ODPolygon;
23 
24 class TrcKeyZSampling;
25 class uiComboBox;
26 
27 
28 namespace Pick
29 {
30 
34 {
35 public:
36  typedef idx_type LocID;
37 
38  Set(const char* nm=0);
39  Set(const Set&);
40  ~Set();
41 
42  Set& operator =(const Set&);
43 
44  struct Disp
45  {
46  Disp()
47  : color_(Color::NoColor())
48  , fillcolor_(Color::NoColor())
49  , pixsize_(3)
50  , markertype_(3) // Sphere
51  , dofill_(false)
52  , connect_(None)
53  {}
54  enum Connection { None, Open, Close };
56  Color color_;
58  int pixsize_;
60  bool dofill_;
63  };
64 
67  bool is2D() const;
71 
72  bool isPolygon() const;
73  void getPolygon(ODPolygon<double>&,int idx=0) const;
75  void getLocations(ObjectSet<const Location>&,int idx=0)const;
76  float getXYArea(int idx=0) const;
78  LocID find(const TrcKey&) const;
79  LocID nearestLocation(const Coord&) const;
80  LocID nearestLocation(const Coord3&,bool ignorez=false) const;
82 
83  static const char* sKeyMarkerType() { return "Marker Type"; }
84  static const char* sKeyFillColor() { return "Surface Color"; }
85  static const char* sKeyFill() { return "Fill"; }
86  static const char* sKeyConnect() { return "Connect"; }
87 
88  void fillPar(IOPar&) const;
89  bool usePar(const IOPar&);
90  void fillDisplayPars(IOPar&) const;
91  bool useDisplayPars(const IOPar&);
92  bool writeDisplayPars() const;
93 
98  const Pick::Location&);
99 
101  const TypeSet<int>& indexes);
103  const TypeSet<int>& indexes);
104 
106  const Location& get(LocID) const;
107 
108  void setReadOnly( bool yn ) { readonly_ = yn; }
109  bool isReadOnly() const { return readonly_; }
110 
111  void addStartIdx(int locidx);
112  void setStartIdx(int setidx,int locidx);
113  int nrSets() const { return startidxs_.size(); }
114  void getStartStopIdx(int setidx,int& start,int&stop) const;
115  const TypeSet<int>& startIndexs() const { return startidxs_; }
116 
118  static const char* sKeyThresholdSize()
119  { return "PointSet Size Threshold";}
120  static const char* sKeyUseThreshold()
121  { return "Use PointSet Size Threshold";}
122  static int getSizeThreshold();
123 
124 private:
125 
126  enum EventType { Insert, PolygonClose, Remove, Move };
129  const TypeSet<Pick::Location>&);
130 
132  bool readonly_;
133 
134 };
137 /*
138 mExpClass(General) List : public ObjectSet<Location>
139 {
140 public:
141  typedef idx_type LocID;
142 
143  List() {}
144  List( const Pick::Set& ps ) { addAll( ps ); }
145 
146  List& add(const Pick::Location&,bool mkcopy=false);
147  inline void addAll( const Pick::Set& ps )
148  { const_cast<Pick::Set&>(ps).getLocations(*this); }
149 
150  inline bool is2D() const;
151  inline Pos::SurvID getSurvID() const;
152  LocID find(const TrcKey&) const;
153  LocID nearestLocation(const Coord&) const;
154  LocID nearestLocation(const Coord3&,bool ignorez=false) const;
155 
156  Location& get(LocID);
157  const Location& get(LocID) const;
158 
159 };*/
160 
161 
162 template <class PicksType>
163 inline bool is2D( const PicksType& picks )
164 {
165  return TrcKey::is2D( picks.getSurvID() );
166 }
167 
168 template <class PicksType>
169 inline bool getSurvID( const PicksType& picks )
170 {
171  return picks.isEmpty() ? false : picks.get(0).trcKey().survID();
172 }
173 /*
174 inline bool Pick::List::is2D() const { return Pick::is2D( *this ); }
175 inline Pos::SurvID Pick::List::getSurvID() const
176 { return Pick::getSurvID( *this ); }
177 */
178 
179 } // namespace Pick
180 
181 
183 {
184 public:
186  : Table::AscIO(fd) {}
187 
188  static Table::FormatDesc* getDesc(bool iszreq);
189  static void updateDesc(Table::FormatDesc&,bool iszreq);
190  static void createDescBody(Table::FormatDesc*,bool iszreq);
191 
192  bool isXY() const;
193  bool get(od_istream&,Pick::Set&,bool iszreq,
194  float zval) const;
195 };
196 
197 
198 /* This include will go away after 6.0 */
199 #include "picksetmgr.h"
200 
201 
Pick::Set::usePar
bool usePar(const IOPar &)
Pick::Set::find
LocID find(const TrcKey &) const
Pick::Set::sKeyMarkerType
static const char * sKeyMarkerType()
Definition: pickset.h:83
Coord3
A cartesian coordinate in 3D space.
Definition: coord.h:72
OD::LineStyle
Definition: draw.h:118
ODPolygon
(Closed) sequence of connected 2-D coordinates.
Definition: polygon.h:27
Pick::Set::nrSets
int nrSets() const
Definition: pickset.h:113
Pick::Set::disp_
Disp disp_
Definition: pickset.h:65
picksetmgr.h
Pick::Set
Set of picks with something in common.
Definition: pickset.h:34
Pick::Set::getLocations
void getLocations(ObjectSet< Location > &, int idx=0)
NamedCallBacker
CallBacker object with a name. Use if you want your object to be able to send and receive CallBack's,...
Definition: namedobj.h:72
Pick::Set::nearestLocation
LocID nearestLocation(const Coord3 &, bool ignorez=false) const
Pick::Set::Disp::Connection
Connection
Definition: pickset.h:54
Pick::Set::is2D
bool is2D() const
default is 3D
tableascio.h
ObjectSet
Set of pointers to objects.
Definition: commontypes.h:31
Pick::Set::Disp::dofill_
bool dofill_
Fill?
Definition: pickset.h:60
Pick::Set::Set
Set(const Set &)
PickSetAscIO::createDescBody
static void createDescBody(Table::FormatDesc *, bool iszreq)
uiComboBox
Combo box.
Definition: uicombobox.h:32
trckey.h
Pick::Set::Disp::connect_
Connection connect_
connect picks in set order
Definition: pickset.h:62
Pick
Definition: picklocation.h:21
Pick::Set::Disp::Open
@ Open
Definition: pickset.h:54
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Pick::Set::readonly_
bool readonly_
Definition: pickset.h:132
od_istream
OD class for stream read common access to the std::cin.
Definition: od_istream.h:24
namedobj.h
Pos::SurvID
Index_Type SurvID
Definition: commontypes.h:84
Pick::Set::startidxs_
TypeSet< int > startidxs_
Definition: pickset.h:131
PickSetAscIO::getDesc
static Table::FormatDesc * getDesc(bool iszreq)
Pick::Set::writeDisplayPars
bool writeDisplayPars() const
Table
Definition: geom2dascio.h:20
Pick::Set::Disp::markertype_
int markertype_
MarkerStyle3D.
Definition: pickset.h:59
Pick::Set::sKeyFillColor
static const char * sKeyFillColor()
Definition: pickset.h:84
PickSetAscIO::updateDesc
static void updateDesc(Table::FormatDesc &, bool iszreq)
Pick::Set::sKeyFill
static const char * sKeyFill()
Definition: pickset.h:85
TrcKeyZSampling
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
TrcKey::is2D
bool is2D() const
Definition: trckey.h:43
Pick::Set::~Set
~Set()
Pick::Set::fillPar
void fillPar(IOPar &) const
Pick::getSurvID
bool getSurvID(const PicksType &picks)
Definition: pickset.h:169
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
Pick::Set::bulkRemoveWithUndo
void bulkRemoveWithUndo(const TypeSet< Pick::Location > &, const TypeSet< int > &indexes)
Pick::Set::fillDisplayPars
void fillDisplayPars(IOPar &) const
Pick::Set::getLocations
void getLocations(ObjectSet< const Location > &, int idx=0) const
Pick::Set::addUndoEvent
void addUndoEvent(EventType, LocID, const Pick::Location &)
Pick::Set::moveWithUndo
void moveWithUndo(LocID, const Pick::Location &, const Pick::Location &)
PickSetAscIO::isXY
bool isXY() const
Pick::Set::pars_
IOPar & pars_
Definition: pickset.h:66
Pick::Set::LocID
idx_type LocID
Definition: pickset.h:36
Pick::Set::getBoundingBox
void getBoundingBox(TrcKeyZSampling &) const
Pick::Set::isSizeLargerThanThreshold
bool isSizeLargerThanThreshold() const
Pick::Set::EventType
EventType
Definition: pickset.h:126
Pick::Set::get
Location & get(LocID)
PickSetAscIO
Definition: pickset.h:183
Pick::Set::Set
Set(const char *nm=0)
Pick::Set::sKeyConnect
static const char * sKeyConnect()
Definition: pickset.h:86
Pick::Set::useDisplayPars
bool useDisplayPars(const IOPar &)
Pick::Location
Pick location in space,.
Definition: picklocation.h:46
Pick::Set::getSurvID
Pos::SurvID getSurvID() const
pre-6.0.1 sets will return the survID of first loc
Pick::Set::getStartStopIdx
void getStartStopIdx(int setidx, int &start, int &stop) const
Pick::Set::isPolygon
bool isPolygon() const
draw.h
Pick::Set::addBulkUndoEvent
void addBulkUndoEvent(EventType, const TypeSet< int > &, const TypeSet< Pick::Location > &)
Pick::Set::getXYArea
float getXYArea(int idx=0) const
Only for closed polygons. Returns in m^2.
Pick::Set::get
const Location & get(LocID) const
Pick::Set::getSizeThreshold
static int getSizeThreshold()
TrcKey
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
Network::None
@ None
Definition: networkcommon.h:33
PickSetAscIO::PickSetAscIO
PickSetAscIO(const Table::FormatDesc &fd)
Definition: pickset.h:185
Pick::Set::removeSingleWithUndo
void removeSingleWithUndo(LocID)
Pick::Set::Remove
@ Remove
Definition: pickset.h:126
Pick::Set::Disp::fillcolor_
Color fillcolor_
surface color
Definition: pickset.h:57
Pick::Set::Disp::pixsize_
int pixsize_
size in pixels
Definition: pickset.h:58
Pick::Set::bulkAppendWithUndo
void bulkAppendWithUndo(const TypeSet< Pick::Location > &, const TypeSet< int > &indexes)
Pick::Set::setStartIdx
void setStartIdx(int setidx, int locidx)
enums.h
PickSetAscIO::get
bool get(od_istream &, Pick::Set &, bool iszreq, float zval) const
Pick::Set::appendWithUndo
void appendWithUndo(const Pick::Location &)
Pick::is2D
bool is2D(const PicksType &picks)
ObjectSet of Pick::Location's. Does not manage.
Definition: pickset.h:163
Pick::Set::Disp
Definition: pickset.h:45
Pick::Set::nearestLocation
LocID nearestLocation(const Coord &) const
Table::FormatDesc
description of input our output data content
Definition: tabledef.h:220
picklocation.h
Pick::Set::sKeyThresholdSize
static const char * sKeyThresholdSize()
Definition: pickset.h:118
Pick::Set::Disp::mDeclareEnumUtils
mDeclareEnumUtils(Connection) Color color_
marker color
sets.h
Pick::Set::getPolygon
void getPolygon(ODPolygon< double > &, int idx=0) const
Pick::Set::Disp::linestyle_
OD::LineStyle linestyle_
line type
Definition: pickset.h:61
Pick::Set::isReadOnly
bool isReadOnly() const
Definition: pickset.h:109
Color
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer,...
Definition: color.h:26
Pick::Set::startIndexs
const TypeSet< int > & startIndexs() const
Definition: pickset.h:115
Pick::Set::addStartIdx
void addStartIdx(int locidx)
TypeSet< Location >::idx_type
OD::ValVec< Location, int >::idx_type idx_type
Definition: typeset.h:185
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
Table::AscIO
Ascii I/O using Format Description.
Definition: tableascio.h:42
Pick::Set::insertWithUndo
void insertWithUndo(LocID, const Pick::Location &)
Pick::Set::Disp::Disp
Disp()
Definition: pickset.h:46
Pick::Set::setReadOnly
void setReadOnly(bool yn)
Definition: pickset.h:108
TypeSet< Location >
Pick::Set::sKeyUseThreshold
static const char * sKeyUseThreshold()
Definition: pickset.h:120

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