58 #include "PropertyVisPlugin.hh"
60 #include "PropertyModelFactory.hh"
62 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
65 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
68 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
74 #define PROP_VIS "PropertyVisualization"
76 PropertyVisPlugin::PropertyVisPlugin() :
82 void PropertyVisPlugin::initializePlugin()
84 if ( OpenFlipper::Options::gui() ) {
90 tool_->meshNames->setModel(&objectListItemModel_);
92 emit addHiddenPickMode( PROP_VIS );
94 QIcon* toolIcon =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"PropertyVisIcon.png");
96 emit addToolbox( tr(
"Property Visualization") , tool_, toolIcon );
102 void PropertyVisPlugin::pluginsInitialized()
104 if ( OpenFlipper::Options::gui() ) {
107 connect(tool_->meshNames, SIGNAL( currentIndexChanged(
int) ),
this, SLOT( slotMeshChanged(
int) ) );
109 connect(tool_->visualizeButton, SIGNAL( clicked() ),
this, SLOT( slotVisualize() ) );
110 connect(tool_->clearButton, SIGNAL( clicked() ),
this, SLOT( slotAllCleared() ) );
112 connect(tool_->refresh_property_names_tb, SIGNAL( clicked() ),
this, SLOT( slotMeshChanged() ) );
114 connect(tool_->remove_property_tb, SIGNAL( clicked() ),
this, SLOT(
slotRemoveProperty() ) );
116 connect(tool_, SIGNAL( widgetShown() ),
this, SLOT( updateGUI() ) );
124 void PropertyVisPlugin::slotVisualizeProperty(
int _id,
const QString& _propname )
135 QModelIndexList list;
149 void PropertyVisPlugin::slotPickModeChanged(
const std::string& _mode)
151 if (propertyModel_ != 0)
152 propertyModel_->pickModeChanged(_mode);
157 void PropertyVisPlugin::slotAllCleared()
161 if (propertyModel_ != 0)
163 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
164 propertyModel_->clear(selectedIndices);
165 propertyModel_->objectUpdated();
172 void PropertyVisPlugin::objectDeleted(
int _id)
174 if( OpenFlipper::Options::gui() )
175 objectListItemModel_.removeObject(_id);
181 void PropertyVisPlugin::slotObjectUpdated(
int _identifier,
const UpdateType& _type )
183 if( OpenFlipper::Options::gui() )
185 if ( tool_->isVisible() )
198 void PropertyVisPlugin::updateGUI()
201 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
204 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
207 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
208 datatype |=
DataType(DATA_TETRAHEDRAL_MESH);
210 objectListItemModel_.refresh(datatype);
217 if (propertyModel_ != 0)
219 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
241 disconnect(propertyModel_, SIGNAL(log(QString)),
this, SLOT(
slotLog(QString)));
244 if (propertyModel_ != 0)
247 tool_->propertyName_lv->setModel(propertyModel_);
249 connect(tool_->propertyName_lv->selectionModel(),
250 SIGNAL( selectionChanged(
const QItemSelection &,
const QItemSelection &) ),
253 QWidget* widget = propertyModel_->
getWidget();
254 tool_->propertyWidgets->addWidget(widget);
258 connect(propertyModel_, SIGNAL(log(QString)),
this, SLOT(
slotLog(QString)));
262 tool_->propertyName_lv->setModel(0);
268 void PropertyVisPlugin::slotMeshChanged(
int )
270 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
276 void PropertyVisPlugin::slotVisualize()
281 if (propertyModel_ == 0)
return;
283 int selectedId = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
284 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
287 propertyModel_->visualize(selectedIndices);
309 void PropertyVisPlugin::slotMouseEvent( QMouseEvent* _event ) {
310 if (propertyModel_ != 0)
311 propertyModel_->mouseEvent(_event);
320 if (propertyModel_ != 0)
322 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
323 propertyModel_->duplicateProperty(selectedIndices);
326 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
349 if (propertyModel_ != 0)
351 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
352 propertyModel_->removeProperty(selectedIndices);
355 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
373 #if QT_VERSION < 0x050000
void slotRemoveProperty()
Removes the selected properties.
void propertySelectionChanged()
Called when user selects a property.
#define DATA_POLYHEDRAL_MESH
virtual void objectUpdated()=0
Revisualizes visualized properties.
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets=QWidgetList())=0
Visualizes the selected properties.
void slotLog(Logtype _type, QString _message)
Receives log messages from PropertyModels and emits them.
void slotDuplicateProperty()
Duplicates the selected properties.
virtual void updateWidget(const QModelIndexList &selectedIndices)=0
Updates the widget.
QModelIndex indexFromPlainPropName(const QString &propName) const
Returns the index of the property with the given name.
virtual void gatherProperties()=0
Searches for properties and creates PropertyVisualizers.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
#define DATA_TRIANGLE_MESH
Logtype
Log types for Message Window.
virtual void hideWidget()=0
Hides the widget.
void setNewPropertyModel(int id)
Exchanges the PropertyModel after the user selected a different object.
const QStringList ALL_OBJECTS
Iterable object range.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
#define DATA_HEXAHEDRAL_MESH
virtual QWidget * getWidget()=0
Returns the widget.