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 00077 00085 void RenderLine(QGLWidget* gla, Point3f AA, Point3f BB); 00086 00094 void Drag(QPoint cursor); 00095 00107 void Pin(QPoint cursor); 00108 00112 void Reset(); 00113 00119 bool IsReady(); 00120 00128 void GetPoints(Point3f &startpoint,Point3f &endpoint); 00129 00136 private: 00137 // types: 00138 typedef enum { RUBBER_BEGIN = 0, 00139 RUBBER_DRAGGING = 1, 00140 RUBBER_DRAGGED = 2, 00141 } RubberPhase; 00142 // data: 00143 RubberPhase currentphase; 00144 QPoint qt_cursor; 00145 Point3f start, end; 00146 bool have_to_pick; 00147 // QFont font; 00148 // functions: 00149 vcg::Point2f DevicePixelConvert(const Point3f); 00150 00151 }; 00152 00153 }//namespace 00154 00155 #endif /*RUBBERBAND_H*/