Commit 5ce4f05d authored by mat's avatar mat
Browse files

UPDATED Point pickink work for all component and not only for mesh.

Add comments for mesh models and selections after being whipped by Nico to do it.


git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1571 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 09bba2c5
......@@ -33,7 +33,8 @@ namespace camitk {
class MeshComponent;
/**
* Qt model for mesh data
* Qt model for mesh data.
* This class use the Qt model/view design
*/
class MeshDataModel : public QAbstractTableModel {
......@@ -41,21 +42,39 @@ class MeshDataModel : public QAbstractTableModel {
public :
/**
* @brief Constructor
*/
MeshDataModel ( MeshComponent* meshComp );
/**
* @brief Number of data arrays
*/
int rowCount ( const QModelIndex &parent = QModelIndex() ) const ;
/**
* @brief Number of data arrays columns
*/
int columnCount ( const QModelIndex &parent = QModelIndex() ) const;
/**
* @brief Model data
*/
QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const;
/**
* @brief Header data
*/
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
/**
* @brief Refresh the model
*/
void refresh();
private :
MeshComponent* meshComponent;
MeshComponent* meshComponent; /// The component where the data are stored
};
......
......@@ -35,6 +35,7 @@ class MeshComponent;
/**
* Qt model for mesh selection
* This class use the Qt model/view design.
*/
class MeshSelectionModel : public QAbstractTableModel {
......@@ -42,25 +43,49 @@ class MeshSelectionModel : public QAbstractTableModel {
public :
/**
* @brief Constructor
*/
MeshSelectionModel ( MeshComponent* const meshComp );
/**
* @brief Number of selection
*/
int rowCount ( const QModelIndex &parent = QModelIndex() ) const ;
/**
* @brief Number of selection columns
*/
int columnCount ( const QModelIndex &parent = QModelIndex() ) const;
/**
* @brief Model data
*/
QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const;
/**
* @brief Data header
*/
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
/**
* @brief Get the selection list
*/
QMap< QString, vtkSmartPointer<vtkSelectionNode> >& getSelectionList();
/**
* @brief Update the selection
*/
void updateSelection(const QString& name);
/**
* @brief Refresh the model
*/
void refresh();
private :
MeshComponent* meshComponent;
MeshComponent* meshComponent; /// The component where the selection are stored
QMap< int, QString > fieldName;
QMap< int, QString > contentName;
......
......@@ -1998,13 +1998,12 @@ void InteractiveViewer::picked() {
case POINT_PICKING: {
vtkSmartPointer<vtkPointPicker> pointPicker = vtkPointPicker::SafeDownCast ( picker );
MeshComponent* mesh = dynamic_cast<MeshComponent*> ( comp );
if ( pointPicker && mesh ) {
if ( pointPicker ) {
vtkIdType currentId = pointPicker->GetPointId();
if ( currentId != -1 ) {
vtkSmartPointer<vtkIdTypeArray> ids = vtkSmartPointer<vtkIdTypeArray>::New();
ids->InsertNextValue ( currentId );
// tell the component it has been picked
comp->pointPicked ( currentId, pickingEffectIsSelecting );
......@@ -2014,7 +2013,10 @@ void InteractiveViewer::picked() {
Application::showStatusBarMessage ( "Picked : " + comp->getName() + ", Point#" + QString::number ( currentId ) + ", position =(" + QString::number ( pickedPos[0] ) + "," + QString::number ( pickedPos[1] ) + "," + QString::number ( pickedPos[2] ) + ")" );
// pointPicked can have changed something
mesh->addToSelection ( "Selected Points", ids );
MeshComponent* mesh = dynamic_cast<MeshComponent*> ( comp );
if ( mesh ) {
mesh->addToSelection ( "Selected Points", ids );
}
refresh ( this );
emit selectionChanged();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment