+void VisuGUI_CutPlanesPane::DrawTable()
+{
+ if (myCutPlanes == NULL) return;
+ if (!hasInit) return;
+
+ int aNbRows = myPosTable->numRows();
+ int aNbPlanes = getNbPlanes();
+
+ myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+ myCutPlanes->SetNbPlanes(aNbPlanes);
+ myCutPlanes->SetDisplacement(myPosSpn->value());
+ if (aNbRows>0)
+ for (int i = 0; i < aNbRows; ++i) {
+ QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+ if (aItem == 0) break;
+ if (!aItem->isChecked())
+ myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
+ }
+
+ if (aNbPlanes > aNbRows)
+ myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+ else if (aNbPlanes < aNbRows)
+ myPosTable->setNumRows(aNbPlanes);
+
+ int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+ for (int i = 0; i<aMin; i++) {
+ myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
+ }
+
+ QHeader *vh = myPosTable->verticalHeader();
+ QString str("Plane# %1");
+ for (int i=aMin; i<aNbPlanes; i++) {
+ VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
+ QTableItem::OnTyping,
+ QString::number(myCutPlanes->GetPlanePosition(i)));
+ aEditItem->setReplaceable(false);
+ aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
+ myPosTable->setItem(i, 0, aEditItem);
+
+ QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+ aCheck->setChecked(myCutPlanes->IsDefault(i));
+ aCheck->setReplaceable(false);
+ myPosTable->setItem(i, 1, aCheck);
+
+ vh->setLabel( i, str.arg(i+1) );
+ }
+
+ // Update preview
+ if (myPreviewCheck->isChecked()) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+}
+
+void VisuGUI_CutPlanesPane::setDefault (int all)
+{
+ myPosTable->setCurrentCell(-1, 1);
+ myPosTable->clearSelection();
+ if (all == 0) return;
+ if (all == 1)
+ for (int i = 0; i < getNbPlanes(); ++i)
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
+
+ for (int i = 0; i < getNbPlanes(); ++i) {
+ if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+ myCutPlanes->SetDefault(i);
+ myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+ myPosTable->item( i, 0 )->setEnabled(false);
+ } else
+ myPosTable->item( i, 0 )->setEnabled(true);
+ }
+}
+
+void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
+{
+ if (theCol == 0) {
+ QString aTxt = myPosTable->text(theRow, 0);
+ bool isChanged = !aTxt.isEmpty();
+ ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+ if (myPreviewCheck->isChecked()) {
+ //Update Preview
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+ } else {
+ bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+ if (isDefault) {
+ myCutPlanes->SetDefault(theRow);
+ myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
+
+ if (myPreviewCheck->isChecked()) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ //Update Preview
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+ }
+ myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+ }
+}
+
+void VisuGUI_CutPlanesPane::deletePlanes()
+{
+ if (myPreviewActor == 0) return;
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+ vf->RemoveActor(myPreviewActor);
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+}
+
+void VisuGUI_CutPlanesPane::onRotation (double theValue)