00001 /* 00002 * QCameraKeyPathEditorImpl.h 00003 * $Id: 00004 * 00005 * Copyright (C) 2001 Alexander Buck, Markus Janich 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 // Description : Class QCameraKeyPathEditorImpl 00024 // Purpose : Provides a tool to handle camerapaths 00025 // 00026 00027 #ifndef QCAMERAKEYPATHEDITORIMPL_H 00028 #define QCAMERAKEYPATHEDITORIMPL_H 00029 00030 00031 // Qt 00033 #include <qstring.h> 00034 #include <qmenubar.h> 00035 #include <qvalidator.h> 00036 #include <qgl.h> 00037 #include <qdom.h> 00038 00039 // QGLViewer 00041 #include "CCamera.h" 00042 #include "CP3D.h" 00043 #include "CV3D.h" 00044 #include "QGLViewer.h" 00045 #include "QCameraDrag.h" 00046 #include "QSceneTreeNode.h" 00047 00048 00049 // Own 00051 #include "CList.h" 00052 #include "CCameraKeyPathAttributes.h" 00053 #include "QCameraKeyPathEditor.h" 00054 #include "CCameraKeyPathPoint.h" 00055 #include "QMyListBox.h" 00056 #include "QCameraKeyPathDrag.h" 00057 #include "QCameraKeyPathDropSite.h" 00058 #include "QIconOptions.h" 00059 00060 // Forwar declarations 00062 class QVBoxLayout; 00063 class QHBoxLayout; 00064 class QGridLayout; 00065 class QComboBox; 00066 class QLabel; 00067 class QLineEdit; 00068 class QPushButton; 00069 class QSlider; 00070 class QCheckBox; 00071 00077 class QCameraKeyPathEditorImpl : public QCameraKeyPathEditor, public QSceneTreeDrawable 00078 { 00079 Q_OBJECT 00080 00081 public: 00082 00084 // CONSTRUCTORS // 00086 00088 QCameraKeyPathEditorImpl( QGLViewer *viewer, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 00089 00090 00092 ~QCameraKeyPathEditorImpl(); 00093 00095 // PUBLIC METHODS // 00097 00099 void updateBoundingBox(); 00100 00102 virtual void draw(); 00103 00104 00105 signals: 00107 // SIGNALS // 00109 00111 void sigRedrawGL(); 00112 00114 void sigCameraKeyPath(const CList<CCameraKeyPathPoint> &); 00115 00116 public slots: 00118 // PUBLIC SLOTS // 00120 00125 void sltSetCameraPath(const CList<CCameraKeyPathPoint> &); 00126 00127 00128 private slots: 00130 // PRIVATE SLOTS // 00132 00134 void sltDeleteCamera(); 00135 00137 void sltReplaceCamera(); 00138 00140 void sltSetIconSize(double); 00141 00143 void sltSetFrustumSize(double); 00144 00146 void sltShowOptions(); 00147 00149 void sltSaveInXML(); 00150 00152 void sltSetSaveName(const QString &); 00153 00155 void sltLoadFile(); 00156 00158 void sltChangeCamValue(); 00159 00161 void sltAddNewCamera(); 00162 00164 void sltCheckValues(); 00165 00167 void sltUpdateHighlights(int); 00168 00170 void sltClearHighlights(int nIndex); 00171 00173 void sltUpdateTool(int nIndex); 00174 00176 void sltAttachCamera(); 00177 00179 void sltAbout(); 00180 00182 void sltMoveUp(); 00183 00185 void sltMoveDown(); 00186 00188 void sltUpdateName(int); 00189 00192 void sltOk() { 00193 sltApply(); 00194 hide(); 00195 }; 00196 00199 void sltApply() { 00200 emit(sigCameraKeyPath(*m_pCameraKeyPath)); 00201 }; 00202 00203 protected: 00205 // PROTECTED METHODS // 00207 00209 void dragEnterEvent(QDragEnterEvent*); 00210 00212 void dragLeaveEvent(QDragLeaveEvent*); 00213 00215 void dropEvent(QDropEvent*); 00216 00217 private: 00218 00220 // PRIVATE METHODS // 00222 00224 bool eventFilter(QObject *o, QEvent *e); 00225 00229 void setCamera(const CCamera &); 00230 00232 void saveInList(QString qname); 00233 00235 void writeAttributes(CCameraKeyPathAttributes); 00236 00240 void setSlider(int); 00241 00243 void writeCameraText(CCamera *); 00244 00246 void formatCamBox(); 00247 00249 CP3D getCurrentEyePos(); 00250 00252 CP3D getCurrentRefPoint(); 00253 00255 CV3D getCurrentViewUp(); 00256 00258 int getCurrentFovy(); 00259 00261 int getCurrentFrames(); 00262 00264 float getCurrentTension(); 00265 00267 float getCurrentContinuity(); 00268 00270 float getCurrentBias(); 00271 00273 void setMenuBar(QLayout *); 00274 00276 void makeArrowDispList(); 00277 00279 void makePathDispList(); 00280 00282 void showError(QString qError); 00283 00285 CList<CCameraKeyPathPoint>* getCamerapathPtr() 00286 { 00287 return m_pCameraKeyPath; 00288 } 00289 00291 void updateHighlights(); 00292 00294 void redraw(); 00295 00296 00298 // PRIVATE MEMBERS // 00300 00302 QMenuBar *m_pqMenuBar; 00303 00305 QGLViewer *m_pMyViewer; 00306 00308 CCameraKeyPathPoint m_camPoint; 00309 00311 CCameraKeyPathAttributes m_attributes; 00312 00314 CCamera m_myCamera; 00315 00317 CCamera m_detachCamera; 00318 00320 CList<CCameraKeyPathPoint> *m_pCameraKeyPath; 00321 00323 CList<bool> m_highlightedCams; 00324 00326 int m_nSliderIndex; 00327 00329 float m_rfIconSize; 00330 00332 float m_rfFrustumSize; 00333 00335 QDoubleValidator *m_pDValEye; 00336 00338 QDoubleValidator *m_pDValRef; 00339 00341 QDoubleValidator *m_pDValUp; 00342 00344 QDoubleValidator *m_pDValVAngle; 00345 00347 QDoubleValidator *m_pDValIcon; 00348 00350 QDoubleValidator *m_pDValFrustum; 00351 00353 QIntValidator *m_pIValFrame; 00354 00356 QDoubleValidator *m_pDValTension; 00357 00359 QDoubleValidator *m_pDValCon; 00360 00362 QDoubleValidator *m_pDValBias; 00363 00365 GLuint m_glPathDispList; 00366 00368 GLuint m_glArrowDispList; 00369 00371 QString m_qSaveName; 00372 00374 bool m_fClearSelectedCams; 00375 00377 bool m_fAttachCamera; 00378 00380 bool m_fCorrectValues; 00381 00383 bool m_fClearSelection; 00384 00386 bool m_fDeleteWithSelection; 00387 00389 QIconOptions *m_pqOptions; 00390 }; 00391 00392 #endif // QCAMERAKEYPATHEDITORIMPL_H