OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
measure_tool.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_MEASURE_TOOL_HH
20 #define OST_GUI_MEASURE_TOOL_HH
21 
22 /*
23  Author: Tobias Schmidt
24  */
25 
26 #include <ost/gui/tools/tool.hh>
27 #include <ost/mol/atom_handle.hh>
28 #include <ost/gfx/color.hh>
29 
30 #include <QList>
31 #include <QWidget>
32 namespace ost { namespace gui {
33 
35 public:
36  typedef enum {
37  DIST, ANGL, DIHE
38  } Type;
39 
40  Measurement(mol::AtomHandleList ahl, gfx::Color col, Real line_width);
41 
42  Real GetMeasurement() const;
43  Type GetType() const;
44  String GetName() const;
45  mol::AtomHandleList GetAtoms() const;
46  gfx::Color GetColor() const;
47  void SetColor(gfx::Color c);
48  Real GetLineWidth() const;
49  void SetLineWidth(Real w);
50  bool IsValid() const;
51 
52 private:
54  Type type_;
55  String name_;
56  Real measurement_;
57  bool valid_;
58  gfx::Color col_;
59  Real line_width_;
60 };
61 
62 typedef std::vector<Measurement> MeasurementList;
63 
64 
66  Q_OBJECT
67 public:
68  MeasureTool();
69  virtual ~MeasureTool() {};
70 
71  int GetMeasureMode();
72  virtual void Click(const MouseEvent& event);
73  virtual bool CanOperateOn(gfx::NodePtrList nodes);
74  virtual QIcon GetIcon() const;
75 
76  gfx::Color GetColor() const;
77  Real GetLineWidth() const;
78 
79  void RenderGL();
80 
81 public slots:
82  void ClearMeasurements();
83 
84 private:
85  int num_clicks_;
86  int mode_;
87  mol::AtomHandleList sel_atoms_;
88  MeasurementList ml_;
89 };
90 
91 }}
92 
93 #endif
std::string String
Definition: base.hh:54
base class for tools
Definition: tool.hh:62
float Real
Definition: base.hh:44
std::vector< Measurement > MeasurementList
Definition: measure_tool.hh:62
#define DLLEXPORT_OST_GUI
std::vector< AtomHandle > AtomHandleList
std::vector< GfxNodeP > NodePtrList
Definition: gfx_node_fw.hh:34