58 #include "PropertyVisPlugin.hh"
60 #include "PropertyModelFactory.hh"
62 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
64 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
69 #define PROP_VIS "PropertyVisualization"
71 PropertyVisPlugin::PropertyVisPlugin() :
77 void PropertyVisPlugin::initializePlugin()
79 if ( OpenFlipper::Options::gui() ) {
85 tool_->meshNames->setModel(&objectListItemModel_);
87 emit addHiddenPickMode( PROP_VIS );
89 QIcon* toolIcon =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"PropertyVisIcon.png");
91 emit addToolbox( tr(
"Property Visualization") , tool_, toolIcon );
97 void PropertyVisPlugin::pluginsInitialized()
99 if ( OpenFlipper::Options::gui() ) {
102 connect(tool_->meshNames, SIGNAL( currentIndexChanged(
int) ),
this, SLOT( slotMeshChanged(
int) ) );
104 connect(tool_->visualizeButton, SIGNAL( clicked() ),
this, SLOT( slotVisualize() ) );
105 connect(tool_->clearButton, SIGNAL( clicked() ),
this, SLOT( slotAllCleared() ) );
107 connect(tool_->refresh_property_names_tb, SIGNAL( clicked() ),
this, SLOT( slotMeshChanged() ) );
109 connect(tool_->remove_property_tb, SIGNAL( clicked() ),
this, SLOT(
slotRemoveProperty() ) );
111 connect(tool_, SIGNAL( widgetShown() ),
this, SLOT( updateGUI() ) );
119 void PropertyVisPlugin::slotVisualizeProperty(
int _id,
const QString& _propname )
130 QModelIndexList list;
144 void PropertyVisPlugin::slotPickModeChanged(
const std::string& _mode)
146 if (propertyModel_ != 0)
147 propertyModel_->pickModeChanged(_mode);
152 void PropertyVisPlugin::slotAllCleared()
156 if (propertyModel_ != 0)
158 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
159 propertyModel_->clear(selectedIndices);
160 propertyModel_->objectUpdated();
167 void PropertyVisPlugin::objectDeleted(
int _id)
169 if( OpenFlipper::Options::gui() )
170 objectListItemModel_.removeObject(_id);
176 void PropertyVisPlugin::slotObjectUpdated(
int _identifier,
const UpdateType& _type )
178 if( OpenFlipper::Options::gui() )
180 if ( tool_->isVisible() )
193 void PropertyVisPlugin::updateGUI()
196 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
199 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
202 objectListItemModel_.refresh(datatype);
209 if (propertyModel_ != 0)
211 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
233 disconnect(propertyModel_, SIGNAL(log(QString)),
this, SLOT(
slotLog(QString)));
236 if (propertyModel_ != 0)
239 tool_->propertyName_lv->setModel(propertyModel_);
241 connect(tool_->propertyName_lv->selectionModel(),
242 SIGNAL( selectionChanged(
const QItemSelection &,
const QItemSelection &) ),
245 QWidget* widget = propertyModel_->
getWidget();
246 tool_->propertyWidgets->addWidget(widget);
250 connect(propertyModel_, SIGNAL(log(QString)),
this, SLOT(
slotLog(QString)));
254 tool_->propertyName_lv->setModel(0);
260 void PropertyVisPlugin::slotMeshChanged(
int )
262 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
268 void PropertyVisPlugin::slotVisualize()
273 if (propertyModel_ == 0)
return;
275 int selectedId = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
276 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
279 propertyModel_->visualize(selectedIndices);
301 void PropertyVisPlugin::slotMouseEvent( QMouseEvent* _event ) {
302 if (propertyModel_ != 0)
303 propertyModel_->mouseEvent(_event);
312 if (propertyModel_ != 0)
314 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
315 propertyModel_->duplicateProperty(selectedIndices);
318 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
341 if (propertyModel_ != 0)
343 QModelIndexList selectedIndices = tool_->propertyName_lv->selectionModel()->selectedIndexes();
344 propertyModel_->removeProperty(selectedIndices);
347 int id = tool_->meshNames->itemData( tool_->meshNames->currentIndex() ).toInt();
365 #if QT_VERSION < 0x050000
const QStringList ALL_OBJECTS
Iterable object range.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
void slotDuplicateProperty()
Duplicates the selected properties.
Logtype
Log types for Message Window.
void slotRemoveProperty()
Removes the selected properties.
void setNewPropertyModel(int id)
Exchanges the PropertyModel after the user selected a different object.
#define DATA_POLYHEDRAL_MESH
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
virtual QWidget * getWidget()=0
Returns 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.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
virtual void objectUpdated()=0
Revisualizes visualized properties.
void slotLog(Logtype _type, QString _message)
Receives log messages from PropertyModels and emits them.
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets=QWidgetList())=0
Visualizes the selected properties.
virtual void hideWidget()=0
Hides the widget.
#define DATA_HEXAHEDRAL_MESH
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
#define DATA_TRIANGLE_MESH
virtual void updateWidget(const QModelIndexList &selectedIndices)=0
Updates the widget.
void propertySelectionChanged()
Called when user selects a property.