00001 /**************************************************************************** 00002 * MeshLab o o * 00003 * A versatile mesh processing toolbox o o * 00004 * _ O _ * 00005 * Copyright(C) 2008 \/)\/ * 00006 * Visual Computing Lab /\/| * 00007 * ISTI - Italian National Research Council | * 00008 * \ * 00009 * All rights reserved. * 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * This program is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 00020 * for more details. * 00021 * * 00022 ****************************************************************************/ 00023 /**************************************************************************** 00024 History 00025 $Log: not supported by cvs2svn $ 00026 Revision 1.1 2008/02/16 12:00:34 benedetti 00027 first version, adapted from meshlab's editmeasure plugin 00028 00029 00030 ****************************************************************************/ 00031 #ifndef RUBBERBAND_H 00032 #define RUBBERBAND_H 00033 00034 #include <vcg/space/color4.h> 00035 #include <QGLWidget> 00036 00037 namespace vcg { 00038 00044 class Rubberband 00045 { 00046 public: 00047 //data: 00048 00050 Color4b color; 00051 00052 // functions: 00053 00059 Rubberband(Color4b); 00060 00066 virtual ~Rubberband() {} 00067 00075 void Render(QGLWidget* glw); 00076 00084 void Drag(QPoint cursor); 00085 00097 void Pin(QPoint cursor); 00098 00102 void Reset(); 00103 00109 bool IsReady(); 00110 00118 void GetPoints(Point3f &startpoint,Point3f &endpoint); 00119 00126 void RenderLabel(QString text,QGLWidget* glw); 00127 00128 private: 00129 // types: 00130 typedef enum { RUBBER_BEGIN = 0, 00131 RUBBER_DRAGGING = 1, 00132 RUBBER_DRAGGED = 2, 00133 } RubberPhase; 00134 // data: 00135 RubberPhase currentphase; 00136 QPoint qt_cursor; 00137 Point3f start, end; 00138 bool have_to_pick; 00139 QFont font; 00140 // functions: 00141 Point3f PixelConvert(const Point3f); 00142 00143 }; 00144 00145 }//namespace 00146 00147 #endif /*RUBBERBAND_H*/