52 #include "PluginFunctionsCore.hh" 54 #include <ACG/Scenegraph/SeparatorNode.hh> 55 #include <ACG/Scenegraph/MaterialNode.hh> 69 static std::vector< glViewer* > examiner_widgets_;
75 static std::vector< Viewer::ViewerProperties* > viewerProperties_;
81 static unsigned int activeExaminer_ = 0;
83 static bool internalLightHandling_ =
true;
122 static OFGLWidget* shareGLWidget_ = 0;
126 static int viewerId_ = 0;
129 static int objectCounter_ = 0;
132 static int targetCounter_ = 0;
135 static std::map<int, BaseObject*> objectMap_;
145 return examiner_widgets_.size();
149 internalLightHandling_ =
false;
153 return internalLightHandling_;
161 static QVector<QPair<QString, QString>> pluginCommandLineOptions_;
168 PluginFunctions::examiner_widgets_ = _viewerWidgets;
169 PluginFunctions::examiner_widget_ = examiner_widgets_[0];
172 QTime time = QTime::currentTime();
173 qsrand( time.hour() * 10 + time.minute() * 100 + time.second() * 1000 + time.msec() * 10000 );
178 PluginFunctions::viewerProperties_ = _viewerProperties;
182 activeExaminer_ = _id;
186 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
187 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
191 return( examiner_widgets_[_viewerId] );
195 return activeExaminer_;
207 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
208 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
213 examiner_widgets_[_viewerId]->encodeView ( view );
224 if ( _viewerId < 0 || _viewerId >= (
int)examiner_widgets_.size() ) {
225 std::cerr <<
"Requested unknown viewer with id : " << _viewerId << std::endl;
229 examiner_widgets_[_viewerId]->decodeView ( _view );
237 PluginFunctions::dataSeparatorNode_ = _dataSeparatorNode;
240 if ( PluginFunctions::dataSeparatorNode_->nChildren() != 1 ){
241 std::cerr <<
"Only one child allowed for dataSeparatorNode on initialization!" << std::endl;
242 std::cerr <<
"The Core has initialized the scenegraph in a strange way!" << std::endl;
252 PluginFunctions::sceneGraphRootNode_ = _root_node;
256 PluginFunctions::sceneGraphRootNodeGlobal_ = _root_node;
261 if ( o_it->picked( _node_idx ) ) {
271 _identifiers.clear();
274 if ( o_it->source() )
275 _identifiers.push_back ( o_it->id() );
277 return ( ! _identifiers.empty() );
281 _identifiers.clear();
284 if ( o_it->target() )
285 _identifiers.push_back ( o_it->id() );
287 return ( !_identifiers.empty() );
296 if ( _identifier == -1 )
303 std::map<int, BaseObject*>::iterator it;
304 it = objectMap_.find(_identifier);
306 _object = (it != objectMap_.end() ? it->second : 0);
308 return ( _object != 0 );
313 if ( _identifier == -1 )
319 std::map<int, BaseObject*>::iterator it;
320 it = objectMap_.find(_identifier);
322 BaseObject*
object = (it != objectMap_.end() ? it->second : 0);
325 return ( _object != 0 );
329 if(_name.isEmpty())
return -1;
332 return object ?
object->
id() : -1;
340 if ( _identifier == -1 )
344 return (
object != 0 );
351 _identifiers.clear();
356 _identifiers.push_back( o_it->id() );
359 return (!_identifiers.empty());
364 _identifiers.clear();
369 _identifiers.push_back( o_it->id() );
372 return ( !_identifiers.empty() );
376 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
382 if ( (_viewer != ACTIVE_VIEWER ) && ( ( _viewer < 0 ) || _viewer >= (
int)examiner_widgets_.size()) ){
383 std::cerr <<
"Unable to set fixed view. Wrong viewer id (" << _viewer <<
")" << std::endl;
417 if ( _viewer == ACTIVE_VIEWER )
424 return examiner_widgets_[activeExaminer_]->glMapToGlobal(_point);
428 return examiner_widgets_[activeExaminer_]->glMapFromGlobal(_point);
433 if ( _viewer == ACTIVE_VIEWER )
435 else if ( _viewer == ALL_VIEWERS )
436 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
438 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
441 std::cerr <<
"Requested illegal viewer for setting DrawMode!!" << std::endl;
451 if ( _viewer == ACTIVE_VIEWER ) {
453 }
else if ( _viewer == ALL_VIEWERS )
454 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
455 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
458 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
467 viewingRay(_x,_y,_outOrigin,_outDirection,activeExaminer_);
480 return examiner_widgets_[activeExaminer_]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
486 if ( _examiner >= examiner_widgets_.size() ) {
487 std::cerr <<
"Wrong examiner id" << std::endl;
490 return examiner_widgets_[_examiner]->pick( _pickTarget,_mousePos,_nodeIdx,_targetIdx,_hitPointPtr );
497 const QPoint & _mousePos,
505 bool ok =
scenegraphPick(_examiner,_pickTarget,_mousePos, nodeIdx,_targetIdx,_hitPointPtr);
510 if ( _refine && (_hitPointPtr != 0) ) {
513 double x = _mousePos.x();
514 double y = examiner_widget_->
glHeight() - _mousePos.y();
521 *_hitPointPtr = _object->
refinePick(_pickTarget,*_hitPointPtr, mousePoint3d , direction , _targetIdx );
532 const QPoint & _mousePos,
538 return scenegraphPick(activeExaminer_,_pickTarget,_mousePos, _object,_targetIdx,_refine,_hitPointPtr );
546 const QRegion& _region,
547 QList<QPair<size_t, size_t> >& _list,
548 QVector<float>* _depths,
549 QVector<ACG::Vec3d>* _points)
551 return examiner_widgets_[activeExaminer_]->pick_region( _pickTarget, _region, _list, _depths, _points);
556 const QRegion& _region,
557 QList<QPair<size_t, size_t> >& _list,
558 QVector<float>* _depths,
559 QVector<ACG::Vec3d>* _points)
561 if ( _examiner >= examiner_widgets_.size() ) {
562 std::cerr <<
"Wrong examiner id" << std::endl;
565 return examiner_widgets_[_examiner]->pick_region( _pickTarget, _region, _list, _depths, _points);
597 shareGLWidget_ = _widget;
602 return shareGLWidget_;
610 if ( _id >= (
int)viewerProperties_.size() ) {
611 std::cerr <<
" Error, requested properties for non-existing Viewer!" << std::endl;
612 return dummyProperties;
616 _id = activeExaminer_;
618 return ( *viewerProperties_[_id] );
623 if ( _viewer == ACTIVE_VIEWER ) {
624 examiner_widgets_[activeExaminer_]->perspectiveProjection();
625 }
else if ( _viewer == ALL_VIEWERS )
626 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
628 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
631 std::cerr <<
"Requested illegal viewer for perspectiveProjection()!!" << std::endl;
635 if ( _viewer == ACTIVE_VIEWER ) {
636 examiner_widgets_[activeExaminer_]->orthographicProjection();
637 }
else if ( _viewer == ALL_VIEWERS )
638 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
640 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
643 std::cerr <<
"Requested illegal viewer for orthographicProjection()!!" << std::endl;
649 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
650 examiner_widgets_[i]->
setFOVY(_fovy);
654 if ( _viewer == ACTIVE_VIEWER ) {
655 examiner_widgets_[activeExaminer_]->allowRotation(_mode);
656 }
else if ( _viewer == ALL_VIEWERS )
657 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
659 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
662 std::cerr <<
"Requested illegal viewer for allowRotation!!" << std::endl;
666 if ( _viewer == ACTIVE_VIEWER )
674 if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
678 std::cerr <<
"Requested illegal viewer for isRotationAllowed!!" << std::endl;
688 if ( _viewer == ACTIVE_VIEWER ) {
689 examiner_widgets_[activeExaminer_]->viewingDirection(_dir,_up);
690 }
else if ( _viewer == ALL_VIEWERS )
691 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
693 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
696 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
701 if ( _viewer == ACTIVE_VIEWER ) {
702 examiner_widgets_[activeExaminer_]->lookAt(_eye,_center, _up);
703 }
else if ( _viewer == ALL_VIEWERS )
704 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
705 examiner_widgets_[i]->
lookAt(_eye,_center, _up);
706 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
707 examiner_widgets_[_viewer]->
lookAt(_eye,_center, _up);
709 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
713 if ( _viewer == ACTIVE_VIEWER ) {
714 return examiner_widgets_[activeExaminer_]->trackBallCenter();
715 }
else if ( _viewer == ALL_VIEWERS )
716 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
718 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
721 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
723 return examiner_widgets_[activeExaminer_]->trackBallCenter();
727 if ( _viewer == ACTIVE_VIEWER ) {
728 examiner_widgets_[activeExaminer_]->setTrackBallCenter( _center );
729 }
else if ( _viewer == ALL_VIEWERS )
730 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
732 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
735 std::cerr <<
"Requested illegal viewer for setTrackBallCenter!!" << std::endl;
739 if ( _viewer == ACTIVE_VIEWER ) {
740 examiner_widgets_[activeExaminer_]->setScenePos( _center, _radius );
741 }
else if ( _viewer == ALL_VIEWERS )
742 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
743 examiner_widgets_[i]->
setScenePos( _center, _radius );
744 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
745 examiner_widgets_[_viewer]->
setScenePos( _center, _radius );
747 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
751 if ( _viewer == ACTIVE_VIEWER ) {
752 examiner_widgets_[activeExaminer_]->setScenePos( _center, examiner_widgets_[activeExaminer_]->scene_radius() );
753 }
else if ( _viewer == ALL_VIEWERS )
754 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
755 examiner_widgets_[i]->
setScenePos( _center, examiner_widgets_[i]->scene_radius() );
756 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
757 examiner_widgets_[_viewer]->
setScenePos( _center, examiner_widgets_[_viewer]->scene_radius() );
759 std::cerr <<
"Requested illegal viewer for setScenePos!!" << std::endl;
764 if (_viewer == ACTIVE_VIEWER) {
765 examiner_widgets_[activeExaminer_]->setSceneCenter(_center);
766 }
else if (_viewer == ALL_VIEWERS) {
768 for (uint i = 0; i < examiner_widgets_.size(); ++i) {
769 examiner_widgets_[i]->setSceneCenter(_center);
771 }
else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size()) {
772 examiner_widgets_[_viewer]->setSceneCenter(_center);
774 std::cerr <<
"Requested illegal viewer for setSceneCenter!!" << std::endl;
780 if (_viewer == ACTIVE_VIEWER) {
781 return examiner_widgets_[activeExaminer_]->scene_center();
782 }
else if (_viewer == ALL_VIEWERS)
783 std::cerr <<
"Please select viewer to get sceneCenter!" << std::endl;
784 else if ((_viewer >= 0) && _viewer < (
int) examiner_widgets_.size())
785 return examiner_widgets_[_viewer]->scene_center();
787 std::cerr <<
"Requested illegal viewer for sceneCenter!!" << std::endl;
789 return examiner_widgets_[activeExaminer_]->scene_center();
793 return examiner_widgets_[activeExaminer_]->scene_radius();
797 if ( _viewer == ACTIVE_VIEWER ) {
798 return examiner_widgets_[activeExaminer_]->scene_radius();
799 }
else if ( _viewer == ALL_VIEWERS )
800 std::cerr <<
"Illegal request for scene radius. Please select one viewer!" << std::endl;
801 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
802 return examiner_widgets_[_viewer]->scene_radius();
804 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
810 if ( _viewer == ACTIVE_VIEWER ) {
811 examiner_widgets_[activeExaminer_]->setSceneRadius(_radius);
812 }
else if ( _viewer == ALL_VIEWERS )
813 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
815 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
818 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
822 if ( _viewer == ACTIVE_VIEWER ) {
823 examiner_widgets_[activeExaminer_]->translate(_vector);
824 }
else if ( _viewer == ALL_VIEWERS )
825 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
826 examiner_widgets_[i]->
translate(_vector);
827 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
828 examiner_widgets_[_viewer]->
translate(_vector);
830 std::cerr <<
"Requested illegal viewer for translate!!" << std::endl;
838 if ( _viewer == ACTIVE_VIEWER ) {
839 examiner_widgets_[activeExaminer_]->rotate(_axis,_angle,_center);
840 }
else if ( _viewer == ALL_VIEWERS )
841 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
842 examiner_widgets_[i]->
rotate(_axis,_angle,_center);
843 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
844 examiner_widgets_[_viewer]->
rotate(_axis,_angle,_center);
846 std::cerr <<
"Requested illegal viewer for rotate!!" << std::endl;
850 if ( _viewer == ACTIVE_VIEWER ) {
851 examiner_widgets_[activeExaminer_]->home();
852 }
else if ( _viewer == ALL_VIEWERS )
853 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
854 examiner_widgets_[i]->home();
855 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
856 examiner_widgets_[_viewer]->home();
858 std::cerr <<
"Requested illegal viewer for viewHome!!" << std::endl;
862 if ( _viewer == ACTIVE_VIEWER ) {
863 examiner_widgets_[activeExaminer_]->viewAll();
864 }
else if ( _viewer == ALL_VIEWERS )
865 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
866 examiner_widgets_[i]->
viewAll();
867 else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
868 examiner_widgets_[_viewer]->
viewAll();
870 std::cerr <<
"Requested illegal viewer for viewAll!!" << std::endl;
874 if ( _viewer == ACTIVE_VIEWER ) {
876 }
else if ( _viewer == ALL_VIEWERS )
877 std::cerr <<
"Please select viewer to get viewing direction!" << std::endl;
878 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
881 std::cerr <<
"Requested illegal viewer for viewingDirection!!" << std::endl;
888 if ( _viewer == ACTIVE_VIEWER) {
889 return (examiner_widgets_[activeExaminer_]->projectionMode() == 0);
890 }
else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() ){
891 return ( examiner_widgets_[_viewer]->projectionMode() == 0);
893 std::cerr <<
"Requested illegal viewer for isProjectionOrthographic!!" << std::endl;
899 if ( _viewer == ACTIVE_VIEWER ) {
901 }
else if ( _viewer == ALL_VIEWERS )
902 std::cerr <<
"Please select viewer to get eyePos!" << std::endl;
903 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
906 std::cerr <<
"Requested illegal viewer for eyePos!!" << std::endl;
912 if ( _viewer == ACTIVE_VIEWER ) {
914 }
else if ( _viewer == ALL_VIEWERS )
915 std::cerr <<
"Please select viewer to get up vector!" << std::endl;
916 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
919 std::cerr <<
"Requested illegal viewer for up vector!!" << std::endl;
928 if ( _viewer == ACTIVE_VIEWER ) {
930 }
else if ( _viewer == ALL_VIEWERS )
931 std::cerr <<
"Please select viewer to get fovy!" << std::endl;
932 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
935 std::cerr <<
"Requested illegal viewer for fovy!!" << std::endl;
942 for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
948 defaultMarker_ = _marker;
953 return defaultMarker_;
958 return PluginFunctions::sceneGraphRootNode_;
962 return PluginFunctions::dataRootNode_;
966 if (PluginFunctions::sceneGraphRootNode_){
980 if (PluginFunctions::sceneGraphRootNode_)
981 _node->
set_parent( PluginFunctions::sceneGraphRootNodeGlobal_ );
986 if (PluginFunctions::sceneGraphRootNode_){
1001 return(objectCounter_);
1007 return ( targetCounter_ );
1028 if ( o_it->visible() )
1048 _objects.push_back( *o_it );
1056 examiner_widgets_[activeExaminer_]->flyTo(_position,_center,_time);
1064 ACG::Vec3d e = eye + t * (_move_back ? -0.5f : 0.5f);
1065 examiner_widgets_[activeExaminer_]->flyTo(e, _center, _time);
1070 void viewerSnapshot(
int _viewer, QImage& _image,
int _width,
int _height,
bool _alpha,
1071 bool _hideCoordsys,
int _samples) {
1073 if ( _viewer == ACTIVE_VIEWER ) {
1074 examiner_widgets_[activeExaminer_]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1075 }
else if ( _viewer == ALL_VIEWERS )
1076 std::cerr <<
"Please select viewer to get snapshot!" << std::endl;
1077 else if ( ( _viewer >= 0 ) && _viewer < (
int)examiner_widgets_.size() )
1078 examiner_widgets_[_viewer]->snapshot(_image, _width, _height, _alpha, _hideCoordsys, _samples);
1080 std::cerr <<
"Requested illegal viewer for snapshot!!" << std::endl;
1100 return (objectRoot_);
1111 if ( objectCounter_ < 0 )
1112 std::cerr <<
"Deleted more objects than created!!!" << std::endl;
1123 if ( targetCounter_ < 0 )
1124 std::cerr <<
"target object counter underflow!!!" << std::endl;
1133 std::map<int, BaseObject*>::iterator it;
1134 it = objectMap_.find(_objectId);
1136 if(it != objectMap_.end())
return;
1139 objectMap_.insert(std::pair<int, BaseObject*>(_objectId, _object));
1148 std::map<int, BaseObject*>::iterator it;
1149 it = objectMap_.find(_objectId);
1152 if(it != objectMap_.end()) objectMap_.erase(it);
1159 if ( sceneGraphGenerators_.contains( _generator->
handles() ) )
1163 sceneGraphGenerators_[_generator->
handles() ] = _generator;
1167 QMap< std::string ,ACG::QtWidgets::SceneGraphWidgetGenerator* > getSceneGraphGeneratorList(){
1172 QWidget * parent,
const QString & caption,
1173 const QString & defaultDir,
const QString & filter,
1174 QString * selectedFilter, QFileDialog::Options options) {
1177 const QString result = QFileDialog::getOpenFileName(parent, caption, dir,
1178 filter, selectedFilter, options);
1179 if (result.length())
1185 QWidget * parent,
const QString & caption,
1186 const QString & defaultDir,
const QString & filter,
1187 QString * selectedFilter, QFileDialog::Options options,
1188 const QString & defaultSuffix) {
1200 QFileDialog dialog(parent, caption, dir, filter);
1201 dialog.setOptions(options);
1202 dialog.setAcceptMode(QFileDialog::AcceptSave);
1203 if (selectedFilter && !selectedFilter->isEmpty())
1204 dialog.selectNameFilter(*selectedFilter);
1205 dialog.setDefaultSuffix(defaultSuffix);
1206 if (dialog.exec() == QDialog::Accepted) {
1208 *selectedFilter = dialog.selectedNameFilter();
1209 QString result = dialog.selectedFiles().value(0);
1220 if (visibleOnly && !o_it->visible())
continue;
1222 result.append(o_it->getAllCommentsFlat());
1228 if (!ACG::SceneGraph::Material::support_json_serialization())
1229 return QStringList();
1234 if (visibleOnly && !o_it->visible())
continue;
1236 QString materialStr(QObject::tr(
"<not available>"));
1237 if (!o_it->materialNode())
1238 materialStr = QObject::tr(
"<not available: materialNode == null>");
1240 materialStr = o_it->materialNode()->material().serializeToJson();
1242 if (!result.empty())
1243 result.last().append(QString::fromUtf8(
","));
1244 result.append(QString::fromUtf8(
"\"%1\": %2").arg(o_it->name()).arg(materialStr));
1249 void invalidatePickCaches() {
1250 for(
size_t i = 0; i < examiner_widgets_.size(); ++i) {
1251 examiner_widgets_[i]->invalidatePickCache();
1265 return pluginCommandLineOptions_;
1268 void setPluginCommandLineOptions(
const QVector<QPair<QString, QString> > &_pluginCommandLineOptions)
1270 pluginCommandLineOptions_ = _pluginCommandLineOptions;
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
void allowRotation(bool _mode, int _viewer)
void addGlobalNode(ACG::SceneGraph::BaseNode *_node)
Add a global node.
void addSceneGraphGenerator(ACG::QtWidgets::SceneGraphWidgetGenerator *_generator)
Add a scenegraph generator ( the handled type will be extracted from the generator) ...
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
void shareGLWidget(OFGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
int getObjectId(const QString &_name)
int sourceCount()
Get the number of source objects.
bool getAllObjectIdentifiers(std::vector< int > &_identifiers)
Get identifiers of all objects.
QStringList collectObjectComments(bool visibleOnly, bool targetedOnly)
QMap< std::string,ACG::QtWidgets::SceneGraphWidgetGenerator *> sceneGraphGenerators_
Map of scenegraph widget generators.
const QStringList SOURCE_OBJECTS("source")
Iterable object range.
void addObjectToMap(int _objectId, BaseObject *_object)
Add object to internal object map.
QStringList collectObjectMaterials(bool visibleOnly, bool targetedOnly)
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
bool getTargetIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a target object.
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
void setViewers(std::vector< glViewer * > _viewerWidgets)
Set the internal Viewer pointer ( DO NOT USE!! )
bool objectExists(const int _identifier)
Check if an object with this identifier exists.
void setViewerProperties(std::vector< Viewer::ViewerProperties * > _viewerProperties)
Set the internal viewerProperties pointer ( DO NOT USE!! )
void setSceneGraphRootNodeGlobal(SeparatorNode *_root_node)
void setDataSeparatorNodes(SeparatorNode *_dataSeparatorNode)
Set the internal data root node pointers ( DO NOT USE!! )
void viewHome(int _viewer)
Go to home position.
virtual std::string handles()
return the type this generator handles
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
void removeObjectFromMap(int _objectId)
Remove object from internal object map.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
QStringList IteratorRestriction
Iterable object range.
bool rotationLocked()
Pointer to the glState of the Viewer.
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
void set_parent(BaseNode *_parent)
Set the parent of this node.
void setSceneGraphRootNode(SeparatorNode *_root_node)
QPoint mapToGlobal(const QPoint _point)
Map coordinates of GL Widget to global coordinates.
int viewers()
Get the number of viewers.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
const QStringList ALL_OBJECTS
Iterable object range.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
int viewerId()
Return unique viewer id.
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
bool getSourceIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a source object.
void addObjectRenderingNode(ACG::SceneGraph::BaseNode *_node)
Add scenegraph node modifing object rendering.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
ActionMode
Enum listing action modes of the viewers.
void getCurrentViewImage(QImage &_image)
Returns a QImage of the current View.
Vec3d up() const
get up-vector w.r.t. camera coordinates
void setFOVY(double _fovy)
Set field of view angle.
ACG::Vec3d upVector(int _viewer)
Get the current up vector.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
int currentViewingDirection()
Pointer to the glState of the Viewer.
BaseObject *& objectRoot()
Get the root of the object structure.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void setDefaultViewObjectMarker(ViewObjectMarker *_marker)
void increaseTargetCount()
Decrease the number of current Object.
ACG::Vec4f backgroundColor()
Get current background color.
void disableExaminerLightHandling()
Disable the core light handling.
Range adapter for ObjectIterator.
unsigned int glHeight() const
get height of QGLWidget
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
void increaseObjectCount()
Decrease the number of current Object.
void setEncodedExaminerView(QString _view)
Set the encoded view for the active examiner.
double fovy() const
get field of view in y direction
bool scenegraphRegionPick(ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< size_t, size_t > > &_list, QVector< float > *_depths, QVector< ACG::Vec3d > *_points)
void setMainGLContext()
Set current GL Context to main context.
ObjectReferenceRange objectReferences(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
BaseObjectData * baseObjectData(BaseObject *_object)
Cast an BaseObject to a BaseObjectData if possible.
QString getEncodedExaminerView()
Get the encoded view for the active examiner.
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
void viewing_ray(int _x, int _y, Vec3d &_origin, Vec3d &_direction) const
Vec3d viewing_direction() const
get viewing ray
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
Vec3d eye() const
get eye point
void addGlobalStatusNode(ACG::SceneGraph::BaseNode *_node)
Adds a global status node.
void setSceneCenter(const ACG::Vec3d &_center, int _viewer)
bool getAllMeshes(std::vector< int > &_identifiers)
Get identifiers of all meshes.
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.
ChildIter childrenBegin()
Returns: begin-iterator of children.
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
void viewAll(int _viewer)
View the whole scene.
Viewer::ActionMode actionMode()
get the action mode
int visibleCount()
Get the number of visible objects.
BaseNode * parent()
Get the nodes parent node.
PickTarget
What target to use for picking.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void decreaseObjectCount()
Increase the number of current Object.
virtual void makeCurrent()
Makes this widget the current widget for OpenGL operations.
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
void setDataRoot(BaseObject *_root)
void traverse(BaseNode *_node, Action &_action)
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
void decreaseTargetCount()
Increase the number of current Object.
void setViewObjectMarker(ViewObjectMarker *_marker)
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
QString getOpenFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
ACG::GLState & glState()
Get the glState of the Viewer.
glViewer * viewer(int _viewerId)
Get a Viewer.
void rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
QPoint mapToLocal(const QPoint _point)
Map global coordinates to GL Widget local coordinates.
Viewer::ActionMode actionMode()
Get the current Action mode.
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
int objectCount()
Get the number of available objects.
Range adapter for ObjectIterator.
double sceneRadius()
Returns the current scene radius from the active examiner widget.
virtual void snapshot(int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int samples=1)
void get_all_objects(std::vector< BaseObjectData *> &_objects)
const QVector< QPair< QString, QString > > & pluginCommandLineOptions()
Get command line plugin settings as key-value pairs.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
int targetCount()
Get the number of target objects.
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
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.
QString getSaveFileName(const QString &configProperty, QWidget *parent, const QString &caption, const QString &defaultDir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QString &defaultSuffix)
void set_parent(BaseNode *_parent)
Set the parent of this node.
void traverse(ACG::SceneGraph::MouseEventAction &_action)
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
bool examinerLightHandling()
returns if internal light handling is active.
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
const std::string pickMode()
Get the current Picking mode.
std::string pickMode()
get active pick mode
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.