PluginFunctions.hh

Go to the documentation of this file.
00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 7323 $                                                         *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2009-10-06 14:46:06 +0200 (Di, 06. Okt 2009) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 
00046 //=============================================================================
00047 //
00048 //  Standard Functions
00049 //
00050 //=============================================================================
00051 
00057 //
00058 #ifndef PLUGINFUNCTIONS_HH
00059 #define PLUGINFUNCTIONS_HH
00060 
00061 #include <QPair>
00062 
00063 #include <OpenFlipper/common/Types.hh>
00064 
00065 #include <ACG/Scenegraph/SceneGraph.hh>
00066 #include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh>
00067 
00068 //== FORWARDDECLARATIONS ======================================================
00069 class ViewObjectMarker;
00070 class QGLWidget;
00071 
00074 namespace PluginFunctions {
00075 
00076 //=======================================
00077 // Get Source/Target objects
00080 //=======================================
00081 
00087 DLLEXPORT
00088 bool getPickedObject(const unsigned int _node_idx , BaseObjectData*& _object);
00089 
00092 //=======================================
00093 // Get Objects by their identifier
00096 //=======================================
00097 
00103 DLLEXPORT
00104 bool getSourceIdentifiers( std::vector<int>& _identifiers  );
00105 
00111 DLLEXPORT
00112 bool getTargetIdentifiers( std::vector<int>& _identifiers  );
00113 
00119 DLLEXPORT
00120 bool getAllMeshes( std::vector<int>& _identifiers  );
00121 
00127 DLLEXPORT
00128 bool getAllObjectIdentifiers( std::vector<int>& _identifiers  );
00129 
00130 
00141 DLLEXPORT
00142 bool getObject(  const int _identifier , BaseObject*& _object );
00143 
00147 DLLEXPORT
00148 bool getObject(  const int _identifier , BaseObjectData*& _object );
00149 
00152 DLLEXPORT
00153 int getObjectId( const QString _name );
00154 
00160 DLLEXPORT
00161 bool objectExists(  const int _identifier );
00162 
00164 DLLEXPORT
00165 int objectCount();
00166 
00168 DLLEXPORT
00169 int targetCount();
00170 
00172 DLLEXPORT
00173 int sourceCount();
00174 
00176 DLLEXPORT
00177 int visibleCount();
00178 
00181 //=======================================
00182 // Get/set status of examiner
00185 //=======================================
00186 
00187 
00189 DLLEXPORT
00190 int viewers( );
00191 
00193 DLLEXPORT
00194 void setActiveExaminer( const unsigned int _id );
00195 
00197 DLLEXPORT
00198 unsigned int activeExaminer();
00199 
00201 DLLEXPORT
00202 QString getEncodedExaminerView();
00203 
00205 DLLEXPORT
00206 QString getEncodedExaminerView(int _viewerId);
00207 
00209 DLLEXPORT
00210 void setEncodedExaminerView( QString _view );
00211 
00213 DLLEXPORT
00214 void setEncodedExaminerView(int _viewerId , QString _view );
00215 
00219 DLLEXPORT
00220 void setSceneCenter(const ACG::Vec3d& _center, int _viewer );
00221 
00225 DLLEXPORT
00226 const ACG::Vec3d& sceneCenter( int _viewer );
00227 
00232 DLLEXPORT
00233 bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr );
00234 
00238 DLLEXPORT
00239 bool scenegraphPick( const unsigned int _examiner ,ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr );
00240 
00245 DLLEXPORT
00246 bool scenegraphRegionPick( ACG::SceneGraph::PickTarget                _pickTarget,
00247                            const QRegion&                             _region,
00248                            QList<QPair<unsigned int, unsigned int> >& _list);
00249 
00253 DLLEXPORT
00254 bool scenegraphRegionPick( const unsigned int                         _examiner,
00255                            ACG::SceneGraph::PickTarget                _pickTarget,
00256                            const QRegion&                             _region,
00257                            QList<QPair<unsigned int, unsigned int> >& _list);
00258 
00259 
00264 DLLEXPORT
00265 void traverse( ACG::SceneGraph::MouseEventAction  &_action );
00266 
00268 void traverse(  const unsigned int _examiner, ACG::SceneGraph::MouseEventAction  &_action );
00269 
00271 DLLEXPORT
00272 const std::string pickMode ();
00273 
00275 DLLEXPORT
00276 void pickMode ( std::string _mode);
00277 
00279 DLLEXPORT
00280 void getCurrentViewImage(QImage& _image);
00281 
00289 DLLEXPORT
00290 ACG::SceneGraph::BaseNode* getSceneGraphRootNode();
00291 
00297 DLLEXPORT
00298 ACG::SceneGraph::BaseNode* getRootNode();
00299 
00301 DLLEXPORT
00302 void addGlobalNode(ACG::SceneGraph::BaseNode* _node);
00303 
00312 DLLEXPORT
00313 void addObjectRenderingNode(ACG::SceneGraph::BaseNode* _node);
00314 
00316 DLLEXPORT
00317 void actionMode ( Viewer::ActionMode _mode);
00318 
00320 DLLEXPORT
00321 Viewer::ActionMode actionMode();
00322 
00324 DLLEXPORT
00325 void shareGLWidget (QGLWidget* _widget);
00326 
00328 DLLEXPORT
00329 QGLWidget* shareGLWidget ();
00330 
00335 DLLEXPORT
00336 void allowRotation(bool _mode);
00337 
00341 DLLEXPORT
00342 QPoint mapToGlobal( const QPoint _point );
00343 
00347 DLLEXPORT
00348 QPoint mapToLocal( const QPoint _point );
00349 
00354 DLLEXPORT
00355 void setViewObjectMarker (ViewObjectMarker *_marker);
00356 
00361 DLLEXPORT
00362 void setDefaultViewObjectMarker (ViewObjectMarker *_marker);
00363 
00365 DLLEXPORT
00366 ViewObjectMarker* defaultViewObjectMarker ();
00367 
00371 //=======================================
00372 // Iterators for object Access
00375 //=======================================
00376 
00377 typedef QStringList IteratorRestriction;
00378 
00379 const QStringList ALL_OBJECTS;
00380 const QStringList TARGET_OBJECTS ("target");
00381 const QStringList SOURCE_OBJECTS ("source");
00382 
00390 class DLLEXPORT ObjectIterator {
00391 
00392    public :
00393 
00395       typedef BaseObjectData  value_type;
00396 
00398       typedef BaseObjectData* value_handle;
00399 
00401       typedef value_type&     reference;
00402 
00404       typedef value_type*     pointer;
00405 
00413    ObjectIterator(IteratorRestriction _restriction = ALL_OBJECTS , DataType _dataType = DATA_ALL );
00414 
00416    ObjectIterator(BaseObjectData* pos, IteratorRestriction _restriction = ALL_OBJECTS , DataType _dataType = DATA_ALL );
00417 
00419    operator value_handle() { return pos_;  };
00420 
00422    bool operator==( const ObjectIterator& _rhs);
00423 
00425    bool operator!=( const ObjectIterator& _rhs);
00426 
00428    ObjectIterator& operator=( const ObjectIterator& _rhs);
00429 
00431    pointer operator->();
00432 
00434    ObjectIterator& operator++();
00435 
00437    ObjectIterator& operator--();
00438 
00440    BaseObjectData* operator*();
00441 
00443    BaseObjectData* index() { return pos_; };
00444 
00445    private :
00447       BaseObjectData* pos_;
00448 
00450       DataType dataType_;
00451 
00453       IteratorRestriction restriction_;
00454 
00458       inline void proceedToNextBaseObjectData(BaseObject*& _object);
00459 
00460 };
00461 
00469 class DLLEXPORT BaseObjectIterator {
00470 
00471    public :
00472 
00474       typedef BaseObject  value_type;
00475 
00477       typedef BaseObject* value_handle;
00478 
00480       typedef value_type&     reference;
00481 
00483       typedef value_type*     pointer;
00484 
00492    BaseObjectIterator(IteratorRestriction _restriction = ALL_OBJECTS , DataType _dataType = DATA_ALL );
00493 
00495    BaseObjectIterator(BaseObject* pos, IteratorRestriction _restriction = ALL_OBJECTS , DataType _dataType = DATA_ALL );
00496 
00498    operator value_handle() { return pos_;  };
00499 
00501    bool operator==( const BaseObjectIterator& _rhs);
00502 
00504    bool operator!=( const BaseObjectIterator& _rhs);
00505 
00507    BaseObjectIterator& operator=( const BaseObjectIterator& _rhs);
00508 
00510    pointer operator->();
00511 
00513    BaseObjectIterator& operator++();
00514 
00516    BaseObjectIterator& operator--();
00517 
00519    BaseObject* operator*();
00520 
00522    BaseObject* index() { return pos_; };
00523 
00524    private :
00526       BaseObject* pos_;
00527 
00529       DataType dataType_;
00530 
00532       IteratorRestriction restriction_;
00533 
00534 };
00535 
00536 // /// Return Iterator to Mesh End
00537 // MeshIterator meshes_end();
00538 
00540 DLLEXPORT
00541 ObjectIterator objectsEnd();
00542 
00544 DLLEXPORT
00545 BaseObjectIterator baseObjectsEnd();
00546 
00549 //=======================================
00550 // Dont Use functions below!!!
00553 //=======================================
00554 
00556 DLLEXPORT
00557 void setDataRoot( BaseObject* _root );
00558 
00561 //=======================================
00564 //=======================================
00565 
00571 DLLEXPORT
00572 BaseObjectData* baseObjectData( BaseObject* _object );
00573 
00582 DLLEXPORT
00583 int viewerId();
00584 
00586 DLLEXPORT
00587 BaseObject*& objectRoot();
00588 
00589 }
00590 
00591 #endif //PLUGINFUNCTIONS_HH

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .