63 #include <../ObjectTypes/TriangleMesh/TriangleMesh.hh> 64 #include <../ObjectTypes/PolyMesh/PolyMesh.hh> 66 #include "PluginFunctionsCore.hh" 80 static std::vector< glViewer* > examiner_widgets_;
86 static std::vector< Viewer::ViewerProperties* > viewerProperties_;
92 static unsigned int activeExaminer_ = 0;
94 static bool internalLightHandling_ =
true;
133 static QGLWidget* shareGLWidget_ = 0;
137 static int viewerId_ = 0;
140 static int objectCounter_ = 0;
143 static int targetCounter_ = 0;
146 static std::map<int, BaseObject*> objectMap_;
156 return examiner_widgets_.size();
160 internalLightHandling_ =
false;
164 return internalLightHandling_;
172 PluginFunctions::examiner_widgets_ = _viewerWidgets;
173 PluginFunctions::examiner_widget_ = examiner_widgets_[0];
176 QTime time = QTime::currentTime();
177 qsrand( time.hour() * 10 + time.minute() * 100 + time.second() * 1000 + time.msec() * 10000 );
182 PluginFunctions::viewerProperties_ = _viewerProperties;
186 activeExaminer_ = _id;
190 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
191 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
195 return( examiner_widgets_[_viewerId] );
199 return activeExaminer_;
211 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
212 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
217 examiner_widgets_[_viewerId]->encodeView ( view );
228 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
229 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
233 examiner_widgets_[_viewerId]->decodeView ( _view );
241 PluginFunctions::dataSeparatorNode_ = _dataSeparatorNode;
244 if ( PluginFunctions::dataSeparatorNode_->nChildren() != 1 ){
245 std::cerr <<
"Only one child allowed for dataSeparatorNode on initialization!" << std::endl;
246 std::cerr <<
"The Core has initialized the scenegraph in a strange way!" << std::endl;
256 PluginFunctions::sceneGraphRootNode_ = _root_node;
260 PluginFunctions::sceneGraphRootNodeGlobal_ = _root_node;
265 if ( o_it->picked( _node_idx ) ) {
275 _identifiers.clear();
278 if ( o_it->source() )
279 _identifiers.push_back ( o_it->id() );
281 return ( ! _identifiers.empty() );
285 _identifiers.clear();
288 if ( o_it->target() )
289 _identifiers.push_back ( o_it->id() );
291 return ( !_identifiers.empty() );
300 if ( _identifier == -1 )
307 std::map<int, BaseObject*>::iterator it;
308 it = objectMap_.find(_identifier);
310 _object = (it != objectMap_.end() ? it->second : 0);
312 return ( _object != 0 );
317 if ( _identifier == -1 )
323 std::map<int, BaseObject*>::iterator it;
324 it = objectMap_.find(_identifier);
326 BaseObject*
object = (it != objectMap_.end() ? it->second : 0);
329 return ( _object != 0 );
333 if(_name.isEmpty())
return -1;
336 return object ?
object->
id() : -1;
344 if ( _identifier == -1 )
348 return (
object != 0 );
355 _identifiers.clear();
360 _identifiers.push_back( o_it->id() );
363 return (!_identifiers.empty());
368 _identifiers.clear();
373 _identifiers.push_back( o_it->id() );
376 return ( !_identifiers.empty() );
380 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
386 if ( (_viewer != ACTIVE_VIEWER ) && ( ( _viewer < 0 ) || _viewer >= (
int)examiner_widgets_.size()) ){
387 std::cerr <<
"Unable to set fixed view. Wrong viewer id (" << _viewer <<
")" << std::endl;
421 if ( _viewer == ACTIVE_VIEWER )
428 return examiner_widgets_[activeExaminer_]->glMapToGlobal(_point);
432 return examiner_widgets_[activeExaminer_]->glMapFromGlobal(_point);
437 if ( _viewer == ACTIVE_VIEWER )
439 else if ( _viewer == ALL_VIEWERS )
440 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
442 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
445 std::cerr <<
"Requested illegal viewer for setting DrawMode!!" << std::endl;
455 if ( _viewer == ACTIVE_VIEWER ) {
457 }
else if ( _viewer == ALL_VIEWERS )
458 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
459 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
462 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
471 viewingRay(_x,_y,_outOrigin,_outDirection,activeExaminer_);
484 return examiner_widgets_[activeExaminer_]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
490 if ( _examiner >= examiner_widgets_.size() ) {
491 std::cerr <<
"Wrong examiner id" << std::endl;
494 return examiner_widgets_[_examiner]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
501 const QPoint & _mousePos,
503 unsigned int & _targetIdx,
507 unsigned int nodeIdx = 0;
509 bool ok =
scenegraphPick(_examiner,_pickTarget,_mousePos,nodeIdx,_targetIdx,_hitPointPtr);
514 if ( _refine && (_hitPointPtr != 0) ) {
517 double x = _mousePos.x();
518 double y = examiner_widget_->
glHeight() - _mousePos.y();
525 *_hitPointPtr = _object->
refinePick(_pickTarget,*_hitPointPtr, mousePoint3d , direction , _targetIdx );
536 const QPoint & _mousePos,
538 unsigned int & _targetIdx,
542 return scenegraphPick(activeExaminer_,_pickTarget,_mousePos, _object,_targetIdx,_refine,_hitPointPtr );
550 const QRegion& _region,
551 QList<QPair<unsigned int, unsigned int> >& _list,
552 QVector<float>* _depths,
553 QVector<ACG::Vec3d>* _points)
555 return examiner_widgets_[activeExaminer_]->pick_region( _pickTarget, _region, _list, _depths, _points);
560 const QRegion& _region,
561 QList<QPair<unsigned int, unsigned int> >& _list,
562 QVector<float>* _depths,
563 QVector<ACG::Vec3d>* _points)
565 if ( _examiner >= examiner_widgets_.size() ) {
566 std::cerr <<
"Wrong examiner id" << std::endl;
569 return examiner_widgets_[_examiner]->pick_region( _pickTarget, _region, _list, _depths, _points);
601 shareGLWidget_ = _widget;
606 return shareGLWidget_;
614 if ( _id >= (
int)viewerProperties_.size() ) {
615 std::cerr <<
" Error, requested properties for non-existing Viewer!" << std::endl;
616 return dummyProperties;
620 _id = activeExaminer_;
622 return ( *viewerProperties_[_id] );
627 if ( _viewer == ACTIVE_VIEWER ) {
628 examiner_widgets_[activeExaminer_]->perspectiveProjection();
629 }
else if ( _viewer == ALL_VIEWERS )
630 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
632 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
635 std::cerr <<
"Requested illegal viewer for perspectiveProjection()!!" << std::endl;
639 if ( _viewer == ACTIVE_VIEWER ) {
640 examiner_widgets_[activeExaminer_]->orthographicProjection();
641 }
else if ( _viewer == ALL_VIEWERS )
642 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
644 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
647 std::cerr <<
"Requested illegal viewer for orthographicProjection()!!" << std::endl;
653 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
654 examiner_widgets_[i]->
setFOVY(_fovy);
658 if ( _viewer == ACTIVE_VIEWER ) {
659 examiner_widgets_[activeExaminer_]->allowRotation(_mode);
660 }
else if ( _viewer == ALL_VIEWERS )
661 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
663 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
666 std::cerr <<
"Requested illegal viewer for allowRotation!!" << std::endl;
670 if ( _viewer == ACTIVE_VIEWER )
678 if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
682 std::cerr <<
"Requested illegal viewer for isRotationAllowed!!" << std::endl;
692 if ( _viewer == ACTIVE_VIEWER ) {
693 examiner_widgets_[activeExaminer_]->viewingDirection(_dir,_up);
694 }
else if ( _viewer == ALL_VIEWERS )
695 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
697 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
700 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
705 if ( _viewer == ACTIVE_VIEWER ) {
706 examiner_widgets_[activeExaminer_]->lookAt(_eye,_center, _up);
707 }
else if ( _viewer == ALL_VIEWERS )
708 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
709 examiner_widgets_[i]->
lookAt(_eye,_center, _up);
710 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
711 examiner_widgets_[_viewer]->
lookAt(_eye,_center, _up);
713 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
717 if ( _viewer == ACTIVE_VIEWER ) {
718 return examiner_widgets_[activeExaminer_]->trackBallCenter();
719 }
else if ( _viewer == ALL_VIEWERS )
720 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
722 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
725 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
727 return examiner_widgets_[activeExaminer_]->trackBallCenter();
731 if ( _viewer == ACTIVE_VIEWER ) {
732 examiner_widgets_[activeExaminer_]->setTrackBallCenter( _center );
733 }
else if ( _viewer == ALL_VIEWERS )
734 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
736 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
739 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
743 if ( _viewer == ACTIVE_VIEWER ) {
744 examiner_widgets_[activeExaminer_]->setScenePos( _center, _radius );
745 }
else if ( _viewer == ALL_VIEWERS )
746 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
747 examiner_widgets_[i]->
setScenePos( _center, _radius );
748 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
749 examiner_widgets_[_viewer]->
setScenePos( _center, _radius );
751 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
755 if ( _viewer == ACTIVE_VIEWER ) {
756 examiner_widgets_[activeExaminer_]->setScenePos( _center, examiner_widgets_[activeExaminer_]->scene_radius() );
757 }
else if ( _viewer == ALL_VIEWERS )
758 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
759 examiner_widgets_[i]->
setScenePos( _center, examiner_widgets_[i]->scene_radius() );
760 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
761 examiner_widgets_[_viewer]->
setScenePos( _center, examiner_widgets_[_viewer]->scene_radius() );
763 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
768 if (_viewer == ACTIVE_VIEWER) {
769 examiner_widgets_[activeExaminer_]->setSceneCenter(_center);
770 }
else if (_viewer == ALL_VIEWERS) {
772 for (uint i = 0; i < examiner_widgets_.size(); ++i) {
773 examiner_widgets_[i]->setSceneCenter(_center);
775 }
else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size()) {
776 examiner_widgets_[_viewer]->setSceneCenter(_center);
778 std::cerr <<
"Requested illegal viewer for setSceneCenter!!" << std::endl;
784 if (_viewer == ACTIVE_VIEWER) {
785 return examiner_widgets_[activeExaminer_]->scene_center();
786 }
else if (_viewer == ALL_VIEWERS)
787 std::cerr <<
"Please select viewer to get sceneCenter!" << std::endl;
788 else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size())
789 return examiner_widgets_[_viewer]->scene_center();
791 std::cerr <<
"Requested illegal viewer for sceneCenter!!" << std::endl;
793 return examiner_widgets_[activeExaminer_]->scene_center();
797 return examiner_widgets_[activeExaminer_]->scene_radius();
801 if ( _viewer == ACTIVE_VIEWER ) {
802 return examiner_widgets_[activeExaminer_]->scene_radius();
803 }
else if ( _viewer == ALL_VIEWERS )
804 std::cerr <<
"Illegal request for scene radius. Please select one viewer!" << std::endl;
805 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
806 return examiner_widgets_[_viewer]->scene_radius();
808 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
814 if ( _viewer == ACTIVE_VIEWER ) {
815 examiner_widgets_[activeExaminer_]->setSceneRadius(_radius);
816 }
else if ( _viewer == ALL_VIEWERS )
817 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
819 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
822 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
826 if ( _viewer == ACTIVE_VIEWER ) {
827 examiner_widgets_[activeExaminer_]->translate(_vector);
828 }
else if ( _viewer == ALL_VIEWERS )
829 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
830 examiner_widgets_[i]->
translate(_vector);
831 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
832 examiner_widgets_[_viewer]->
translate(_vector);
834 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
842 if ( _viewer == ACTIVE_VIEWER ) {
843 examiner_widgets_[activeExaminer_]->rotate(_axis,_angle,_center);
844 }
else if ( _viewer == ALL_VIEWERS )
845 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
846 examiner_widgets_[i]->
rotate(_axis,_angle,_center);
847 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
848 examiner_widgets_[_viewer]->
rotate(_axis,_angle,_center);
850 std::cerr <<
"Requested illegal viewer for rotate!!" << std::endl;
854 if ( _viewer == ACTIVE_VIEWER ) {
855 examiner_widgets_[activeExaminer_]->home();
856 }
else if ( _viewer == ALL_VIEWERS )
857 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
858 examiner_widgets_[i]->home();
859 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
860 examiner_widgets_[_viewer]->home();
862 std::cerr <<
"Requested illegal viewer for viewHome!!" << std::endl;
866 if ( _viewer == ACTIVE_VIEWER ) {
867 examiner_widgets_[activeExaminer_]->viewAll();
868 }
else if ( _viewer == ALL_VIEWERS )
869 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
870 examiner_widgets_[i]->
viewAll();
871 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
872 examiner_widgets_[_viewer]->
viewAll();
874 std::cerr <<
"Requested illegal viewer for viewAll!!" << std::endl;
878 if ( _viewer == ACTIVE_VIEWER ) {
880 }
else if ( _viewer == ALL_VIEWERS )
881 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
882 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
885 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
892 if ( _viewer == ACTIVE_VIEWER) {
893 return (examiner_widgets_[activeExaminer_]->projectionMode() == 0);
894 }
else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() ){
895 return ( examiner_widgets_[_viewer]->projectionMode() == 0);
897 std::cerr <<
"Requested illegal viewer for isProjectionOrthographic!!" << std::endl;
903 if ( _viewer == ACTIVE_VIEWER ) {
905 }
else if ( _viewer == ALL_VIEWERS )
906 std::cerr <<
"Please select viewer to get eyePos!" << std::endl;
907 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
910 std::cerr <<
"Requested illegal viewer for eyePos!!" << std::endl;
916 if ( _viewer == ACTIVE_VIEWER ) {
918 }
else if ( _viewer == ALL_VIEWERS )
919 std::cerr <<
"Please select viewer to get up vector!" << std::endl;
920 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
923 std::cerr <<
"Requested illegal viewer for up vector!!" << std::endl;
932 if ( _viewer == ACTIVE_VIEWER ) {
934 }
else if ( _viewer == ALL_VIEWERS )
935 std::cerr <<
"Please select viewer to get fovy!" << std::endl;
936 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
939 std::cerr <<
"Requested illegal viewer for fovy!!" << std::endl;
946 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
952 defaultMarker_ = _marker;
957 return defaultMarker_;
962 return PluginFunctions::sceneGraphRootNode_;
966 return PluginFunctions::dataRootNode_;
970 if (PluginFunctions::sceneGraphRootNode_){
984 if (PluginFunctions::sceneGraphRootNode_)
985 _node->
set_parent( PluginFunctions::sceneGraphRootNodeGlobal_ );
990 if (PluginFunctions::sceneGraphRootNode_){
1005 return(objectCounter_);
1011 return ( targetCounter_ );
1032 if ( o_it->visible() )
1052 _objects.push_back( *o_it );
1060 examiner_widgets_[activeExaminer_]->flyTo(_position,_center,_time);
1068 ACG::Vec3d e = eye + t * (_move_back ? -0.5f : 0.5f);
1069 examiner_widgets_[activeExaminer_]->flyTo(e, _center, _time);
1074 void viewerSnapshot(
int _viewer, QImage& _image,
int _width,
int _height,
bool _alpha,
1075 bool _hideCoordsys,
int _samples) {
1077 if ( _viewer == ACTIVE_VIEWER ) {
1078 examiner_widgets_[activeExaminer_]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1079 }
else if ( _viewer == ALL_VIEWERS )
1080 std::cerr <<
"Please select viewer to get snapshot!" << std::endl;
1081 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
1082 examiner_widgets_[_viewer]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1084 std::cerr <<
"Requested illegal viewer for snapshot!!" << std::endl;
1104 return (objectRoot_);
1115 if ( objectCounter_ < 0 )
1116 std::cerr <<
"Deleted more objects than created!!!" << std::endl;
1127 if ( targetCounter_ < 0 )
1128 std::cerr <<
"target object counter underflow!!!" << std::endl;
1137 std::map<int, BaseObject*>::iterator it;
1138 it = objectMap_.find(_objectId);
1140 if(it != objectMap_.end())
return;
1143 objectMap_.insert(std::pair<int, BaseObject*>(_objectId, _object));
1152 std::map<int, BaseObject*>::iterator it;
1153 it = objectMap_.find(_objectId);
1156 if(it != objectMap_.end()) objectMap_.erase(it);
1163 if ( sceneGraphGenerators_.contains( _generator->
handles() ) )
1167 sceneGraphGenerators_[_generator->
handles() ] = _generator;
1176 QWidget * parent,
const QString & caption,
1177 const QString & defaultDir,
const QString & filter,
1178 QString * selectedFilter, QFileDialog::Options options) {
1181 const QString result = QFileDialog::getOpenFileName(parent, caption, dir,
1182 filter, selectedFilter, options);
1183 if (result.length())
1189 QWidget * parent,
const QString & caption,
1190 const QString & defaultDir,
const QString & filter,
1191 QString * selectedFilter, QFileDialog::Options options,
1192 const QString & defaultSuffix) {
1204 QFileDialog dialog(parent, caption, dir, filter);
1205 dialog.setOptions(options);
1206 dialog.setAcceptMode(QFileDialog::AcceptSave);
1207 if (selectedFilter && !selectedFilter->isEmpty())
1208 dialog.selectNameFilter(*selectedFilter);
1209 dialog.setDefaultSuffix(defaultSuffix);
1210 if (dialog.exec() == QDialog::Accepted) {
1212 *selectedFilter = dialog.selectedNameFilter();
1213 QString result = dialog.selectedFiles().value(0);
1224 if (visibleOnly && !o_it->visible())
continue;
1226 result.append(o_it->getAllCommentsFlat());
1232 if (!ACG::SceneGraph::Material::support_json_serialization())
1233 return QStringList();
1238 if (visibleOnly && !o_it->visible())
continue;
1240 QString materialStr(QObject::tr(
"<not available>"));
1241 if (!o_it->materialNode())
1242 materialStr = QObject::tr(
"<not available: materialNode == null>");
1244 materialStr = o_it->materialNode()->material().serializeToJson();
1246 if (!result.empty())
1247 result.last().append(QString::fromUtf8(
","));
1248 result.append(QString::fromUtf8(
"\"%1\": %2").arg(o_it->name()).arg(materialStr));
1253 void invalidatePickCaches() {
1254 for(
size_t i = 0; i < examiner_widgets_.size(); ++i) {
1255 examiner_widgets_[i]->invalidatePickCache();
void traverse(ACG::SceneGraph::MouseEventAction &_action)
BaseObject *& objectRoot()
Get the root of the object structure.
void setMainGLContext()
Set current GL Context to main context.
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
void setViewerProperties(std::vector< Viewer::ViewerProperties * > _viewerProperties)
Set the internal viewerProperties pointer ( DO NOT USE!! )
void viewingRay(int _x, int _y, ACG::Vec3d &_outOrigin, ACG::Vec3d &_outDirection)
Retrieve a viewing ray from the active examiner that can be used for raycasting.
QPoint mapToLocal(const QPoint _point)
Map global coordinates to GL Widget local coordinates.
Vec3d eye() const
get eye point
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
QStringList IteratorRestriction
Iterable object range.
ACG::Vec3d upVector(int _viewer)
Get the current up vector.
bool getSourceIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a source object.
void setSceneCenter(const ACG::Vec3d &_center, int _viewer)
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
ACG::GLState & glState()
Get the glState of the Viewer.
void viewHome(int _viewer)
Go to home position.
void addObjectToMap(int _objectId, BaseObject *_object)
Add object to internal object map.
QPoint mapToGlobal(const QPoint _point)
Map coordinates of GL Widget to global coordinates.
bool getAllMeshes(std::vector< int > &_identifiers)
Get identifiers of all meshes.
void setEncodedExaminerView(QString _view)
Set the encoded view for the active examiner.
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
void decreaseTargetCount()
Increase the number of current Object.
int viewerId()
Return unique viewer id.
bool getObject(int _identifier, BSplineCurveObject *&_object)
void viewing_ray(int _x, int _y, Vec3d &_origin, Vec3d &_direction) const
const QStringList SOURCE_OBJECTS("source")
Iterable object range.
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
BaseObjectData * baseObjectData(BaseObject *_object)
Cast an BaseObject to a BaseObjectData if possible.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
Range adapter for ObjectIterator.
int viewers()
Get the number of viewers.
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
void increaseTargetCount()
Decrease the number of current Object.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
int getObjectId(const QString &_name)
double sceneRadius()
Returns the current scene radius from the active examiner widget.
void get_all_objects(std::vector< BaseObjectData * > &_objects)
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
Viewer::ActionMode actionMode()
get the action mode
void shareGLWidget(QGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
const QStringList ALL_OBJECTS
Iterable object range.
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
bool rotationLocked()
Pointer to the glState of the Viewer.
void setFOVY(double _fovy)
Set field of view angle.
QString getOpenFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
void set_parent(BaseNode *_parent)
Set the parent of this node.
void viewAll(int _viewer)
View the whole scene.
PickTarget
What target to use for picking.
Vec3d up() const
get up-vector w.r.t. camera coordinates
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > sceneGraphGenerators_
Map of scenegraph widget generators.
bool objectExists(const int _identifier)
Check if an object with this identifier exists.
const std::string pickMode()
Get the current Picking mode.
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
glViewer * viewer(int _viewerId)
Get a Viewer.
int sourceCount()
Get the number of source objects.
void removeObjectFromMap(int _objectId)
Remove object from internal object map.
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
QString getSaveFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QString &defaultSuffix)
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
unsigned int glHeight() const
get height of QGLWidget
int objectCount()
Get the number of available objects.
void increaseObjectCount()
Decrease the number of current Object.
void set_parent(BaseNode *_parent)
Set the parent of this node.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
Range adapter for ObjectIterator.
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void setViewObjectMarker(ViewObjectMarker *_marker)
bool examinerLightHandling()
returns if internal light handling is active.
ChildIter childrenBegin()
Returns: begin-iterator of children.
virtual void makeCurrent()
Makes this widget the current widget for OpenGL operations.
void rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
void traverse(BaseNode *_node, Action &_action)
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
std::string pickMode()
get active pick mode
QString getEncodedExaminerView()
Get the encoded view for the active examiner.
Viewer::ActionMode actionMode()
Get the current Action mode.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
void setSceneGraphRootNodeGlobal(SeparatorNode *_root_node)
void setDefaultViewObjectMarker(ViewObjectMarker *_marker)
ActionMode
Enum listing action modes of the viewers.
ObjectReferenceRange objectReferences(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
int targetCount()
Get the number of target objects.
virtual ACG::Vec3d refinePick(ACG::SceneGraph::PickTarget _pickTarget, const ACG::Vec3d _hitPoint, const ACG::Vec3d _start, const ACG::Vec3d _dir, const unsigned int _targetIdx)
Refine picking.
bool getAllObjectIdentifiers(std::vector< int > &_identifiers)
Get identifiers of all objects.
void decreaseObjectCount()
Increase the number of current Object.
virtual std::string handles()
return the type this generator handles
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
void setDataRoot(BaseObject *_root)
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
void addGlobalStatusNode(ACG::SceneGraph::BaseNode *_node)
Adds a global status node.
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
bool scenegraphRegionPick(ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< unsigned int, unsigned int > > &_list, QVector< float > *_depths, QVector< ACG::Vec3d > *_points)
double fovy() const
get field of view in y direction
void allowRotation(bool _mode, int _viewer)
void addGlobalNode(ACG::SceneGraph::BaseNode *_node)
Add a global node.
void setDataSeparatorNodes(SeparatorNode *_dataSeparatorNode)
Set the internal data root node pointers ( DO NOT USE!! )
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator * > getSceneGraphGeneratorList()
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
void disableExaminerLightHandling()
Disable the core light handling.
int currentViewingDirection()
Pointer to the glState of the Viewer.
void addObjectRenderingNode(ACG::SceneGraph::BaseNode *_node)
Add scenegraph node modifing object rendering.
BaseNode * parent()
Get the nodes parent node.
QStringList collectObjectComments(bool visibleOnly, bool targetedOnly)
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
int visibleCount()
Get the number of visible objects.
QStringList collectObjectMaterials(bool visibleOnly, bool targetedOnly)
ACG::Vec4f backgroundColor()
Get current background color.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void getCurrentViewImage(QImage &_image)
Returns a QImage of the current View.
void setSceneGraphRootNode(SeparatorNode *_root_node)
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
void addSceneGraphGenerator(ACG::QtWidgets::SceneGraphWidgetGenerator *_generator)
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
virtual void snapshot(int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int samples=1)
bool getTargetIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a target object.
Vec3d viewing_direction() const
get viewing ray