OpenStructure
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-2020 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 
41 
43  Type GetType() const;
44  String GetName() const;
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:
69  virtual ~MeasureTool() {};
70 
72  virtual void Click(const MouseEvent& event);
73  virtual bool CanOperateOn(gfx::NodePtrList nodes);
74  virtual QIcon GetIcon() const;
75 
77  Real GetLineWidth() const;
78 
79  void RenderGL();
80 
81 public slots:
83 
84 private:
85  int num_clicks_;
86  int mode_;
87  mol::AtomHandleList sel_atoms_;
88  MeasurementList ml_;
89 };
90 
91 }}
92 
93 #endif
gfx::Color GetColor() const
virtual bool CanOperateOn(gfx::NodePtrList nodes)
whether the tool is capable of manipulating the given node
virtual void Click(const MouseEvent &event)
left mouse click
Real GetLineWidth() const
virtual QIcon GetIcon() const
Measurement(mol::AtomHandleList ahl, gfx::Color col, Real line_width)
Real GetMeasurement() const
String GetName() const
void SetLineWidth(Real w)
gfx::Color GetColor() const
Type GetType() const
void SetColor(gfx::Color c)
mol::AtomHandleList GetAtoms() const
bool IsValid() const
Real GetLineWidth() const
base class for tools
Definition: tool.hh:62
#define DLLEXPORT_OST_GUI
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
std::vector< GfxNodeP > NodePtrList
Definition: gfx_node_fw.hh:34
std::vector< Measurement > MeasurementList
Definition: measure_tool.hh:62
std::vector< AtomHandle > AtomHandleList
Definition: base.dox:1