00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_GUI_MEASURE_TOOL_HH 00020 #define OST_GUI_MEASURE_TOOL_HH 00021 00022 /* 00023 Author: Tobias Schmidt 00024 */ 00025 #include <QList> 00026 00027 #include <ost/gui/tools/tool.hh> 00028 #include <ost/mol/atom_handle.hh> 00029 #include <ost/gfx/color.hh> 00030 00031 namespace ost { namespace gui { 00032 00033 class DLLEXPORT_OST_GUI Measurement { 00034 public: 00035 typedef enum { 00036 DIST, ANGL, DIHE 00037 } Type; 00038 00039 Measurement(mol::AtomHandleList ahl, gfx::Color col, Real line_width); 00040 00041 Real GetMeasurement() const; 00042 Type GetType() const; 00043 String GetName() const; 00044 mol::AtomHandleList GetAtoms() const; 00045 gfx::Color GetColor() const; 00046 void SetColor(gfx::Color c); 00047 Real GetLineWidth() const; 00048 void SetLineWidth(Real w); 00049 bool IsValid() const; 00050 00051 private: 00052 mol::AtomHandleList ahl_; 00053 Type type_; 00054 String name_; 00055 Real measurement_; 00056 bool valid_; 00057 gfx::Color col_; 00058 Real line_width_; 00059 }; 00060 00061 typedef std::vector<Measurement> MeasurementList; 00062 00063 00064 class DLLEXPORT_OST_GUI MeasureTool : public Tool { 00065 public: 00066 MeasureTool(); 00067 00068 int GetMeasureMode(); 00069 virtual void Click(const MouseEvent& event); 00070 virtual bool CanOperateOn(gfx::NodePtrList nodes); 00071 virtual QIcon GetIcon() const; 00072 00073 gfx::Color GetColor() const; 00074 Real GetLineWidth() const; 00075 00076 void RenderGL(); 00077 00078 private: 00079 int num_clicks_; 00080 int mode_; 00081 mol::AtomHandleList sel_atoms_; 00082 MeasurementList ml_; 00083 }; 00084 00085 }} 00086 00087 #endif
1.5.8