1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : StdMeshersGUI_CartesianParamCreator.cxx
23 // Author : Open CASCADE S.A.S.
26 #include "StdMeshersGUI_CartesianParamCreator.h"
29 #include "SMESHGUI_Utils.h"
30 #include "SMESHGUI_VTKUtils.h"
31 #include "SMESHGUI_HypothesesUtils.h"
32 #include "SMESHGUI_SpinBox.h"
33 #include "SMESHGUI_MeshEditPreview.h"
36 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
38 // SALOME GUI includes
39 #include <LightApp_SelectionMgr.h>
40 #include <QtxComboBox.h>
41 #include <SALOME_InteractiveObject.hxx>
42 #include <SALOME_ListIO.hxx>
43 #include <SALOME_ListIteratorOfListIO.hxx>
44 #include <SUIT_ResourceMgr.h>
45 #include <SalomeApp_IntSpinBox.h>
46 #include <SalomeApp_Tools.h>
50 #include <BRepBndLib.hxx>
51 #include <Bnd_Box.hxx>
52 #include <TopoDS_Iterator.hxx>
53 #include <TopoDS_Shape.hxx>
57 #include <QAbstractItemModel>
58 #include <QApplication>
59 #include <QButtonGroup>
61 #include <QGridLayout>
63 #include <QHBoxLayout>
66 #include <QListWidget>
67 #include <QModelIndex>
68 #include <QPushButton>
69 #include <QRadioButton>
71 #include <QStyleOptionViewItem>
73 #include <QTreeWidget>
74 #include <QTreeWidgetItem>
75 #include <QVBoxLayout>
80 namespace StdMeshersGUI
82 enum { COORD_BUT = 0, SPACING_BUT };
84 //================================================================================
86 * \brief get spacing definition from a tree item
88 //================================================================================
90 void getFromItem(QTreeWidgetItem * item, double& t0, double& t1, QString& fun )
94 t0 = item->text( 0 ).split(' ')[0].toDouble();
95 t1 = item->data( 0, Qt::UserRole ).toDouble();
96 fun = item->text( 1 );
100 //================================================================================
102 * \brief set spacing definition to a tree item
104 //================================================================================
106 QTreeWidgetItem* setToItem(double t0, double t1, const QString& fun, QTreeWidgetItem * item)
108 if ( !item ) item = new QTreeWidgetItem;
109 item->setText( 0, QString( "%1 - %2" ).arg( t0 ).arg( t1 ));
110 item->setData( 0, Qt::UserRole, t1 );
111 item->setText( 1, fun );
112 item->setFlags( item->flags() | Qt::ItemIsEditable );
116 //================================================================================
118 * \brief Retrieves coordinate value from a list item
120 //================================================================================
122 double coordFromItem( QListWidgetItem * item )
124 return item ? item->data( Qt::UserRole ).toDouble() : 0;
127 //================================================================================
129 * \brief Sets coordinate value to a list item
131 //================================================================================
133 QListWidgetItem* coordToItem( double coord, QListWidgetItem * item )
135 if ( !item ) item = new QListWidgetItem;
136 item->setText( QString::number( coord ));
137 item->setData( Qt::UserRole, coord );
138 item->setFlags( item->flags() | Qt::ItemIsEditable );
142 //================================================================================
145 * \param theParent - Parent widget for this tab
147 * Makes tab's look and feel
149 //================================================================================
151 GridAxisTab::GridAxisTab( QWidget* theParent,const int axisIndex ):
152 QFrame( theParent ), myAxisIndex( axisIndex )
154 // 1) Grid definition mode
155 myModeGroup = new QButtonGroup( this );
156 QGroupBox* modeBox = new QGroupBox( tr( "GRID_DEF_MODE" ), this );
157 QHBoxLayout* modeLay = new QHBoxLayout( modeBox );
158 modeLay->setMargin( MARGIN );
159 modeLay->setSpacing( SPACING );
161 QRadioButton* coordModeBtn = new QRadioButton( tr( "SMESH_COORDINATES" ), modeBox );
162 QRadioButton* spacModeBtn = new QRadioButton( tr( "SPACING" ), modeBox );
164 modeLay->addWidget( coordModeBtn );
165 modeLay->addWidget( spacModeBtn );
166 myModeGroup->addButton( coordModeBtn, COORD_BUT );
167 myModeGroup->addButton( spacModeBtn, SPACING_BUT );
170 myInsertBtn = new QPushButton( tr("INSERT"), this);
171 myDeleteBtn = new QPushButton( tr("SMESH_BUT_DELETE"), this);
173 myStepLabel = new QLabel( tr("COORD_STEP"));
174 myStepSpin = new SMESHGUI_SpinBox( this );
175 myStepSpin->setAcceptNames( false ); // No Notebook variables allowed
176 myStepSpin->RangeStepAndValidator();
177 myStepSpin->SetStep( 1. );
178 myStepSpin->SetValue( myStep = 1. );
180 // 3) Coodrinates/Spacing group
181 QFrame* csFrame = new QFrame( this );
182 QVBoxLayout* scLay = new QVBoxLayout( csFrame );
183 scLay->setMargin( 0 );
184 scLay->setSpacing( SPACING );
187 mySpacingTreeWdg = new QTreeWidget( csFrame );
188 mySpacingTreeWdg->setColumnCount(2);
189 mySpacingTreeWdg->setHeaderLabels( QStringList() << tr( "SMESH_RANGE" ) << QString( "f(t)" ));
190 mySpacingTreeWdg->setColumnWidth( 1, 40 );
191 mySpacingTreeWdg->setColumnWidth( 2, 30 );
192 mySpacingTreeWdg->setItemDelegate( new LineDelegate( mySpacingTreeWdg ));
193 scLay->addWidget( mySpacingTreeWdg );
196 myCoordList = new QListWidget( csFrame );
197 myCoordList->setItemDelegate( new LineDelegate( myCoordList ));
198 scLay->addWidget( myCoordList );
202 QGridLayout* axisTabLayout = new QGridLayout( this );
203 axisTabLayout->setMargin( MARGIN );
204 axisTabLayout->setSpacing( SPACING );
206 axisTabLayout->addWidget( modeBox , 0, 0, 1, 3 );
207 axisTabLayout->addWidget( myInsertBtn , 1, 0, 1, 2 );
208 axisTabLayout->addWidget( myDeleteBtn , 2, 0, 1, 2 );
209 axisTabLayout->addWidget( myStepLabel, 3, 0 );
210 axisTabLayout->addWidget( myStepSpin , 3, 1 );
211 axisTabLayout->addWidget( csFrame , 1, 2, 4, 1 );
213 axisTabLayout->setRowStretch( 4, 1 );
216 connect( myInsertBtn, SIGNAL( clicked() ), SLOT( onInsert() ));
217 connect( myDeleteBtn, SIGNAL( clicked() ), SLOT( onDelete() ));
218 connect( myModeGroup, SIGNAL( buttonClicked ( int )), SLOT( onMode(int)));
219 connect( myModeGroup, SIGNAL( buttonClicked ( int )), SIGNAL( gridModeChanged(int)));
220 connect( mySpacingTreeWdg, SIGNAL( itemSelectionChanged()), SLOT( updateButtons() ));
221 connect( myCoordList, SIGNAL( itemSelectionChanged()), SLOT( updateButtons() ));
222 connect( myStepSpin, SIGNAL( valueChanged(double)), SLOT( onStepChange() ));
225 //================================================================================
227 * \brief SLOT onInsert
229 //================================================================================
231 void GridAxisTab::onInsert()
233 if ( isGridBySpacing() )
235 QTreeWidgetItem * item = mySpacingTreeWdg->currentItem();
236 if ( !item ) item = mySpacingTreeWdg->topLevelItem( 0 );
237 int i = mySpacingTreeWdg->indexOfTopLevelItem( item );
239 double t0, t1; QString fun;
240 getFromItem( item, t0, t1, fun );
241 double t = 0.5 * ( t0 + t1 );
242 setToItem( t0, t, fun, item );
244 item = setToItem( t, t1, fun );
245 if ( i == mySpacingTreeWdg->topLevelItemCount()-1 )
246 mySpacingTreeWdg->addTopLevelItem( item );
248 mySpacingTreeWdg->insertTopLevelItem( i+1, item );
249 mySpacingTreeWdg->setCurrentItem( item );
253 if ( myCoordList->count() == 0 )
255 myCoordList->addItem( coordToItem( 0 ));
259 double coord = coordFromItem( myCoordList->currentItem() ) + myStep;
260 int i = myCoordList->currentRow();
261 while ( i > 0 && coordFromItem( myCoordList->item( i-1 )) > coord )
263 while ( i < myCoordList->count() && coordFromItem( myCoordList->item( i )) < coord )
265 const double tol = 1e-6;
267 ( i < myCoordList->count() && coordFromItem( myCoordList->item( i )) - coord < tol ) ||
268 ( i > 0 && coord - coordFromItem( myCoordList->item( i-1 )) < tol );
270 myCoordList->insertItem( i, coordToItem( coord ));
271 else if ( myStep < 0 )
273 myCoordList->setCurrentRow( i );
279 //================================================================================
281 * \brief SLOT onDelete
283 //================================================================================
285 void GridAxisTab::onDelete()
287 if ( isGridBySpacing() )
289 QList<QTreeWidgetItem *> selItems = mySpacingTreeWdg->selectedItems();
290 QTreeWidgetItem * item;
291 foreach ( item, selItems )
293 int i = mySpacingTreeWdg->indexOfTopLevelItem( item );
294 if ( i == 0 ) continue;
295 QTreeWidgetItem* prevItem = mySpacingTreeWdg->topLevelItem( i-1 );
297 double t0, t1, t2; QString fun;
298 getFromItem( item, t1, t2, fun );
299 getFromItem( prevItem, t0, t1, fun );
302 setToItem( t0, t2, fun, prevItem );
307 if ( myCoordList->count() > 2 )
308 if ( QListWidgetItem * item = myCoordList->currentItem() )
314 //================================================================================
318 //================================================================================
320 void GridAxisTab::onMode(int isSpacing)
322 mySpacingTreeWdg->setShown( isSpacing );
323 myCoordList->setShown( !isSpacing );
324 myStepSpin->setShown( !isSpacing );
325 myStepLabel->setShown( !isSpacing );
328 if ( mySpacingTreeWdg->topLevelItemCount() == 0 )
330 QString spacing( "1" );
331 if ( myCoordList->count() > 1 )
333 double c1 = coordFromItem( myCoordList->item( 1 ));
334 double c0 = coordFromItem( myCoordList->item( 0 ));
335 spacing = QString::number( c1 - c0 );
337 mySpacingTreeWdg->addTopLevelItem( setToItem( 0., 1., spacing ) );
339 //myCoordList->clear();
343 //mySpacingTreeWdg->clear();
344 if ( myCoordList->count() == 0 )
345 myCoordList->addItem( coordToItem( 0 ));
350 //================================================================================
352 * \brief SLOT onStepChange
354 //================================================================================
356 void GridAxisTab::onStepChange()
358 if ( fabs( myStepSpin->GetValue() ) < 1e-100 )
360 double delta = myStepSpin->singleStep() * ( myStep > myStepSpin->GetValue() ? -1 : +1 );
361 myStepSpin->SetValue( myStepSpin->GetValue() + delta );
363 myStep = myStepSpin->GetValue();
366 //================================================================================
368 * \brief Enables/disables buttons
370 //================================================================================
372 void GridAxisTab::updateButtons()
374 bool insertEnable = false, deleteEnable = false;
375 if ( isGridBySpacing() )
378 const int nbSelected = mySpacingTreeWdg->selectedItems().count();
379 if ( nbSelected > 0 )
381 // we delete a current range by uniting it with the previous
382 int i = mySpacingTreeWdg->indexOfTopLevelItem( mySpacingTreeWdg->currentItem() );
383 deleteEnable = ( i > 0 );
388 const int nbSelected = myCoordList->selectedItems().count();
389 insertEnable = ( nbSelected || myCoordList->count() < 2 );
390 deleteEnable = ( nbSelected && myCoordList->count() > 2 );
392 myInsertBtn->setEnabled( insertEnable );
393 myDeleteBtn->setEnabled( deleteEnable );
396 //================================================================================
398 * \brief Inserts coordinates into myCoordList
400 //================================================================================
402 void GridAxisTab::setCoordinates( SMESH::double_array_var coords )
404 myCoordList->clear();
405 for ( size_t i = 0; i < coords->length(); ++i )
406 myCoordList->addItem( coordToItem( coords[i] ));
408 myModeGroup->button( COORD_BUT )->setChecked( true );
412 //================================================================================
414 * \brief Sets spacing got from hypothesis
416 //================================================================================
418 void GridAxisTab::setSpacing( SMESH::string_array_var funs, SMESH::double_array_var points )
420 mySpacingTreeWdg->clear();
421 if ( funs->length() == points->length() - 1 )
423 for ( size_t i = 1; i < points->length(); ++i )
424 mySpacingTreeWdg->addTopLevelItem
425 ( setToItem( points[i-1], points[i], (const char*) funs[i-1] ));
427 myModeGroup->button( SPACING_BUT )->setChecked( true );
428 onMode( SPACING_BUT );
431 //================================================================================
433 * \brief Checks grid definintion mode
435 //================================================================================
437 bool GridAxisTab::isGridBySpacing() const
439 return ( myModeGroup->checkedId() == SPACING_BUT );
442 //================================================================================
444 * \brief Returns coordinates to set to a hypothesis
446 //================================================================================
448 SMESH::double_array* GridAxisTab::getCoordinates()
450 SMESH::double_array_var coords = new SMESH::double_array;
451 coords->length( myCoordList->count() );
452 for ( size_t i = 0; i < coords->length(); ++i )
453 coords[i] = coordFromItem( myCoordList->item( i ) );
455 return coords._retn();
458 //================================================================================
460 * \brief Returms spacing to set to a hypothesis
462 //================================================================================
464 void GridAxisTab::getSpacing(SMESH::string_array_out funs,
465 SMESH::double_array_out points) const
467 funs = new SMESH::string_array();
468 points = new SMESH::double_array();
469 funs->length( mySpacingTreeWdg->topLevelItemCount() );
470 points->length( mySpacingTreeWdg->topLevelItemCount() + 1 );
471 double t0, t1; QString fun;
472 for ( size_t i = 0; i < funs->length(); ++i )
474 QTreeWidgetItem* item = mySpacingTreeWdg->topLevelItem( i );
475 getFromItem( item, t0, t1, fun );
477 funs[i] = fun.toLatin1().constData();
479 points[ points->length()-1 ] = 1.0;
483 //================================================================================
485 * \brief Verifies parameters
487 //================================================================================
489 bool GridAxisTab::checkParams(QString& msg, SMESH::SMESH_Hypothesis_var& hyp) const
491 if ( isGridBySpacing() )
493 if ( mySpacingTreeWdg->topLevelItemCount() == 0 )
494 return false; // how could it be?
495 StdMeshers::StdMeshers_CartesianParameters3D_var h =
496 StdMeshers::StdMeshers_CartesianParameters3D::_narrow( hyp );
497 SMESH::string_array_var funs;
498 SMESH::double_array_var points;
499 getSpacing( funs.out(), points.out() );
501 const char* axisName[3] = { "X", "Y", "Z" };
502 SMESH::double_array_var coords =
503 h->ComputeCoordinates(0.,1., funs, points, axisName[ myAxisIndex ]);
505 catch ( const SALOME::SALOME_Exception& ex ) {
506 msg = (const char*) ex.details.text;
512 return myCoordList->count() > 1;
517 //================================================================================
519 * \brief LineDelegate constructor
521 //================================================================================
523 LineDelegate::LineDelegate( QWidget* parent ):
524 QItemDelegate( parent ),
525 mySpacingTreeWdg( qobject_cast<QTreeWidget*>( parent )),
526 myCoordList( qobject_cast<QListWidget*>( parent ))
530 //================================================================================
532 * \brief Creates an editor depending on a current item
534 //================================================================================
536 QWidget* LineDelegate::createEditor( QWidget* parent,
537 const QStyleOptionViewItem& opt,
538 const QModelIndex& index) const
541 if ( mySpacingTreeWdg )
543 if ( index.column() == 0 &&
544 index.row() != mySpacingTreeWdg->topLevelItemCount()-1 )
546 SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent );
547 sb->setAcceptNames( false ); // No Notebook variables allowed
548 sb->setFrame( false );
551 if ( index.column() == 1 ) {
552 w = new QLineEdit( parent );
557 SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent );
558 sb->setAcceptNames( false ); // No Notebook variables allowed
559 sb->setFrame( false );
560 const double tol = 1e-5;
561 double from = index.row() ? coordFromItem( myCoordList->item( index.row()-1 ))+tol : -1e+6;
562 double to = index.row() == myCoordList->count()-1 ? 1e+6 : coordFromItem( myCoordList->item( index.row()+1 ))-tol;
563 sb->RangeStepAndValidator( from, to, 0.01 );
569 //================================================================================
571 * \brief Limit value range in the spin of a neighbor range
573 //================================================================================
575 void LineDelegate::setEditorData ( QWidget * editor, const QModelIndex & index ) const
577 if ( mySpacingTreeWdg && index.column() == 0 )
579 double t0, t1, t2=1.0; QString fun;
580 QTreeWidgetItem* item = mySpacingTreeWdg->topLevelItem( index.row() );
581 getFromItem( item, t0, t1, fun );
582 if ( index.row() != mySpacingTreeWdg->topLevelItemCount()-1 )
584 item = mySpacingTreeWdg->topLevelItem( index.row()+1 );
585 getFromItem( item, t1, t2, fun );
587 const double tol = 1e-3;
588 SMESHGUI_SpinBox* sb = qobject_cast<SMESHGUI_SpinBox*>( editor );
589 sb->RangeStepAndValidator( t0 + tol, t2 - tol, 0.01 );
594 QItemDelegate::setEditorData( editor, index );
598 //================================================================================
602 //================================================================================
604 void LineDelegate::setModelData( QWidget* editor,
605 QAbstractItemModel* model,
606 const QModelIndex& index ) const
608 if ( mySpacingTreeWdg )
610 if ( index.column() == 0 )
612 if ( index.row() != mySpacingTreeWdg->topLevelItemCount()-1 )
614 SMESHGUI_SpinBox* sb = qobject_cast<SMESHGUI_SpinBox*>( editor );
615 double t0, t1, t = sb->GetValue(); QString fun;
617 QTreeWidgetItem* item = mySpacingTreeWdg->topLevelItem( index.row() );
618 getFromItem( item, t0, t1, fun );
619 setToItem( t0, t, fun, item );
621 item = mySpacingTreeWdg->topLevelItem( index.row() + 1 );
622 getFromItem( item, t0, t1, fun );
623 setToItem( t, t1, fun, item );
626 else if ( !qobject_cast<QLineEdit*>(editor)->text().trimmed().isEmpty() )
628 QItemDelegate::setModelData( editor, model, index );
633 SMESHGUI_SpinBox* sb = qobject_cast<SMESHGUI_SpinBox*>( editor );
634 coordToItem( sb->GetValue(), myCoordList->item( index.row() ));
638 } // namespace StdMeshersGUI
642 const double theAngTol = M_PI / 180.;
644 //================================================================================
646 * \brief Set variables to groups of spin boxes
648 //================================================================================
650 void setText( const QString& vars, SMESHGUI_SpinBox** spins )
652 QStringList varList = vars.split( ':' );
653 for ( int i = 0; i < 3 && i < varList.count(); ++i )
654 if ( !varList[i].isEmpty() )
655 spins[i]->setText( varList[i] );
658 //================================================================================
660 * \brief Computes more 2 axes by one
661 * \param [in] iOk - index of a given axis
662 * \param [in,out] dirs - directions of 3 axes
664 //================================================================================
666 void get3Dirs( int iOk, gp_XYZ dirs[3] )
668 dirs[ ( iOk+1 ) % 3 ] = dirs[ iOk ];
670 if ( Abs( dirs[ iOk ].Y() ) < 1e-100 &&
671 Abs( dirs[ iOk ].Z() ) < 1e-100 )
673 dirs[ ( iOk+1 ) % 3 ].SetY( dirs[ iOk ].Y() + 1. );
675 dirs[ ( iOk+1 ) % 3 ].SetX( dirs[ iOk ].X() + 1. );
677 dirs[( iOk+2 ) % 3] = dirs[ iOk ] ^ dirs[ ( iOk+1 ) % 3 ];
678 dirs[( iOk+1 ) % 3] = dirs[ ( iOk+2 ) % 3 ] ^ dirs[ iOk ];
682 //================================================================================
684 * \brief StdMeshersGUI_CartesianParamCreator constructor
686 //================================================================================
688 StdMeshersGUI_CartesianParamCreator::StdMeshersGUI_CartesianParamCreator(const QString& aHypType)
689 : StdMeshersGUI_StdHypothesisCreator( aHypType ),
696 myAxesPreview = new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() ));
697 myAxesPreview->SetArrowShapeAndNb( /*nbArrows=*/3,
703 myDirTic[0] = myDirTic[1] = myDirTic[2] = 0;
706 //================================================================================
708 * \brief StdMeshersGUI_CartesianParamCreator destructor
710 //================================================================================
712 StdMeshersGUI_CartesianParamCreator::~StdMeshersGUI_CartesianParamCreator()
714 if ( myAxisTabs[0] ) delete myAxisTabs[0];
715 if ( myAxisTabs[1] ) delete myAxisTabs[1];
716 if ( myAxisTabs[2] ) delete myAxisTabs[2];
721 delete myAxesPreview;
724 //================================================================================
726 * \brief Validate parameters
728 //================================================================================
730 bool StdMeshersGUI_CartesianParamCreator::checkParams( QString& msg ) const
732 if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
735 if ( myName && myName->text().trimmed().isEmpty() )
737 msg = tr("SMESH_WRN_EMPTY_NAME");
740 if ( ! myThreshold->isValid( msg, true ))
743 SMESH::SMESH_Hypothesis_var hyp = hypothesis();
744 if ( !myAxisTabs[0]->checkParams( msg, hyp )) return false;
745 if ( !myAxisTabs[1]->checkParams( msg, hyp )) return false;
746 if ( !myAxisTabs[2]->checkParams( msg, hyp )) return false;
748 StdMeshersGUI_CartesianParamCreator* me = (StdMeshersGUI_CartesianParamCreator*) this;
749 if ( !me->updateAxesPreview() )
751 msg = tr("INVALID_AXES_DIR");
758 //================================================================================
760 * \brief Create widgets
762 //================================================================================
764 QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame()
766 QFrame* fr = new QFrame();
767 //fr->setMinimumWidth(460);
769 QVBoxLayout* lay = new QVBoxLayout( fr );
771 lay->setSpacing( SPACING );
773 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
774 lay->addWidget( GroupC1 );
776 StdMeshers::StdMeshers_NumberOfSegments_var h =
777 StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );
779 QGridLayout* argGroupLayout = new QGridLayout( GroupC1 );
780 argGroupLayout->setSpacing( SPACING );
781 argGroupLayout->setMargin( MARGIN );
782 argGroupLayout->setColumnStretch( 0, 0 );
783 argGroupLayout->setColumnStretch( 1, 1 );
790 myName = new QLineEdit( GroupC1 );
791 argGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
792 argGroupLayout->addWidget( myName, row, 1 );
797 argGroupLayout->addWidget( new QLabel( tr( "THRESHOLD" ), GroupC1 ), row, 0 );
798 myThreshold = new SMESHGUI_SpinBox( GroupC1 );
799 myThreshold->setAcceptNames( false ); // No Notebook variables allowed
800 myThreshold->RangeStepAndValidator( 1.00001, 1e+10, 1., "length_precision" );
801 argGroupLayout->addWidget( myThreshold, row, 1 );
804 // 2) "Implement edges"
805 myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 );
806 argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 );
809 // 3) Grid definition
810 QTabWidget* tabWdg = new QTabWidget( fr );
811 myAxisTabs[ 0 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 0 );
812 myAxisTabs[ 1 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 1 );
813 myAxisTabs[ 2 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 2 );
814 tabWdg->addTab( myAxisTabs[ 0 ], tr( "AXIS_X" ) );
815 tabWdg->addTab( myAxisTabs[ 1 ], tr( "AXIS_Y" ) );
816 tabWdg->addTab( myAxisTabs[ 2 ], tr( "AXIS_Z" ) );
817 argGroupLayout->addWidget( tabWdg, row, 0, 1, 2 );
820 QPixmap aPix = SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"));
823 myFixedPointGrp = new QGroupBox( tr("FIXED_POINT"), fr );
824 myFixedPointGrp->setCheckable( true );
825 //QPushButton* pointBtn = new QPushButton( QIcon(aPix), "", myFixedPointGrp );
826 QLabel* pXLbl = new QLabel( tr("SMESH_X"), myFixedPointGrp );
827 QLabel* pYLbl = new QLabel( tr("SMESH_Y"), myFixedPointGrp );
828 QLabel* pZLbl = new QLabel( tr("SMESH_Z"), myFixedPointGrp );
829 for ( int i = 0; i < 3; ++i )
831 myPointSpin[i] = new SMESHGUI_SpinBox( myFixedPointGrp );
832 myPointSpin[i]->RangeStepAndValidator( -1e20, 1e20, 10 );
833 myPointSpin[i]->SetValue( 0. );
835 QHBoxLayout* aFixedPointLay = new QHBoxLayout( myFixedPointGrp );
836 aFixedPointLay->addWidget( pXLbl, 0, Qt::AlignRight );
837 aFixedPointLay->addWidget( myPointSpin[0], 1 );
838 aFixedPointLay->addWidget( pYLbl, 0, Qt::AlignRight );
839 aFixedPointLay->addWidget( myPointSpin[1], 1 );
840 aFixedPointLay->addWidget( pZLbl, 0, Qt::AlignRight );
841 aFixedPointLay->addWidget( myPointSpin[2], 1 );
842 argGroupLayout->addWidget( myFixedPointGrp, row, 0, 1, 2 );
846 QGroupBox* axesDirGrp = new QGroupBox( tr("AXES_DIRECTION"), fr );
847 QGridLayout* axisDirLay = new QGridLayout( axesDirGrp );
848 axisDirLay->setSpacing( SPACING );
849 axisDirLay->setMargin( MARGIN );
850 axisDirLay->setColumnStretch( 0, 2 );
852 myOrthogonalChk = new QCheckBox( tr("ORTHOGONAL_AXES"), axesDirGrp );
853 axisDirLay->addWidget( myOrthogonalChk, 0, 0, 1, 7 );
856 axisLbl[0] = new QLabel( tr( "AXIS_X"), axesDirGrp );
857 axisLbl[1] = new QLabel( tr( "AXIS_Y"), axesDirGrp );
858 axisLbl[2] = new QLabel( tr( "AXIS_Z"), axesDirGrp );
860 myAxisBtnGrp = new QButtonGroup( axesDirGrp );
861 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
862 for ( int i = 0; i < 3; ++i )
864 QPushButton* axisBtn = new QPushButton( QIcon(aPix), "", axesDirGrp );
865 axisBtn->setCheckable( true );
866 myAxisBtnGrp->addButton( axisBtn, i );
867 myXDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
868 myYDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
869 myZDirSpin[i] = new SMESHGUI_SpinBox( axesDirGrp );
870 myXDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
871 myYDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
872 myZDirSpin[i]->RangeStepAndValidator( -1, 1, 0.1, "len_tol_precision" );
873 dLbl[0] = new QLabel( tr("SMESH_DX"), axesDirGrp );
874 dLbl[1] = new QLabel( tr("SMESH_DY"), axesDirGrp );
875 dLbl[2] = new QLabel( tr("SMESH_DZ"), axesDirGrp );
876 axisDirLay->addWidget( axisLbl[i], i+1, 0 );
877 axisDirLay->addWidget( axisBtn, i+1, 1 );
878 axisDirLay->addWidget( dLbl[0], i+1, 2 );
879 axisDirLay->addWidget( dLbl[1], i+1, 4 );
880 axisDirLay->addWidget( dLbl[2], i+1, 6 );
881 axisDirLay->addWidget( myXDirSpin[i], 1, 3+i*2 );
882 axisDirLay->addWidget( myYDirSpin[i], 2, 3+i*2 );
883 axisDirLay->addWidget( myZDirSpin[i], 3, 3+i*2 );
885 axisDirLay->setColumnStretch( 3, 10 );
886 axisDirLay->setColumnStretch( 5, 10 );
887 axisDirLay->setColumnStretch( 7, 10 );
890 QPushButton* optimBtn = new QPushButton( tr("OPTIMAL_AXES"), axesDirGrp );
891 QPushButton* resetBtn = new QPushButton( tr("RESET_AXES"), axesDirGrp );
892 axisDirLay->addWidget( optimBtn, 4, 0, 1, 4 );
893 axisDirLay->addWidget( resetBtn, 4, 4, 1, 4 );
895 argGroupLayout->addWidget( axesDirGrp, row, 0, 1, 2 );
900 LightApp_SelectionMgr* selMgr = SMESH::GetSelectionMgr( SMESHGUI::GetSMESHGUI() );
902 connect( selMgr, SIGNAL( currentSelectionChanged()), SLOT( onSelectionChange()));
903 connect( myOrthogonalChk, SIGNAL( toggled(bool)), SLOT( onOrthogonalAxes(bool)));
904 connect( optimBtn, SIGNAL( clicked(bool)), SLOT( onOptimalAxes(bool)));
905 connect( resetBtn, SIGNAL( clicked(bool)), SLOT( onResetAxes(bool)));
906 for ( int i = 0; i < 3; ++i )
908 connect( myXDirSpin[i], SIGNAL(valueChanged (const QString&)),
909 this, SLOT (onAxisDirChange(const QString&)) );
910 connect( myYDirSpin[i], SIGNAL(valueChanged (const QString&)),
911 this, SLOT (onAxisDirChange(const QString&)) );
912 connect( myZDirSpin[i], SIGNAL(valueChanged (const QString&)),
913 this, SLOT (onAxisDirChange(const QString&)) );
914 connect( myAxisTabs[i], SIGNAL(gridModeChanged(int)),
915 this, SLOT (onGridModeChanged(int)));
919 myAxesLen = 120; // default trihedron size is 100
920 myOrigin[0] = myOrigin[1] = myOrigin[2] = 0.;
922 QString shapeEntry = getMainShapeEntry();
923 if ( !shapeEntry.isEmpty() )
926 Handle(SALOME_InteractiveObject) io =
927 new SALOME_InteractiveObject( shapeEntry.toStdString().c_str(), "GEOM" );
928 GEOM::GEOM_Object_var geomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( io );
929 if ( GEOMBase::GetShape( geomObj, shape ) && !shape.IsNull())
932 BRepBndLib::Add( shape, box );
936 box.Get( myOrigin[0], myOrigin[1], myOrigin[2], max[0], max[1], max[2] );
937 gp_Pnt o( myOrigin[0], myOrigin[1], myOrigin[2] );
938 gp_Pnt x( max[0], max[1], max[2] );
939 myAxesLen = o.Distance( x );
942 while ( step > myAxesLen / 5 )
944 myPointSpin[0]->SetStep( step );
945 myPointSpin[1]->SetStep( step );
946 myPointSpin[2]->SetStep( step );
950 myAxisBtnGrp->button(0)->setEnabled( !shape.IsNull() );
951 myAxisBtnGrp->button(1)->setEnabled( !shape.IsNull() );
952 myAxisBtnGrp->button(2)->setEnabled( !shape.IsNull() );
953 optimBtn->setEnabled( !shape.IsNull() );
960 //================================================================================
962 * \brief Tranfer parameters from hypothesis to widgets
964 //================================================================================
966 void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
968 StdMeshers::StdMeshers_CartesianParameters3D_var h =
969 StdMeshers::StdMeshers_CartesianParameters3D::_narrow( initParamsHypothesis() );
972 myName->setText( hypName() );
974 QString varName = getVariableName( "SetSizeThreshold" );
975 if ( varName.isEmpty() )
976 myThreshold->setValue( h->GetSizeThreshold() );
978 myThreshold->setText( varName );
980 myAddEdges->setChecked( h->GetToAddEdges() );
983 for ( int ax = 0; ax < 3; ++ax )
985 if ( h->IsGridBySpacing( ax ))
987 SMESH::string_array_var funs;
988 SMESH::double_array_var intPoints;
989 h->GetGridSpacing( funs.out(), intPoints.out(), ax );
990 myAxisTabs[ax]->setSpacing( funs, intPoints );
994 SMESH::double_array_var coords = h->GetGrid( ax );
995 myAxisTabs[ax]->setCoordinates( coords );
1000 SMESH::PointStruct fp;
1001 StdMeshersGUI_CartesianParamCreator* me = (StdMeshersGUI_CartesianParamCreator*) this;
1002 if ( h->GetFixedPoint( fp ))
1004 me->myPointSpin[0]->SetValue( fp.x );
1005 me->myPointSpin[1]->SetValue( fp.y );
1006 me->myPointSpin[2]->SetValue( fp.z );
1007 setText( getVariableName("GetFixedPoint"), &me->myPointSpin[0] );
1008 myFixedPointGrp->setChecked( true );
1012 myFixedPointGrp->setChecked( false );
1016 SMESHGUI_SpinBox** spins[3] = { &me->myXDirSpin[0], &me->myYDirSpin[0], &me->myZDirSpin[0] };
1017 SMESH::DirStruct axisDir[3];
1018 h->GetAxesDirs( axisDir[0],
1021 QString vars = getVariableName("GetAxesDirs");
1022 for ( int i = 0; i < 3; ++i )
1024 spins[i][0]->SetValue( axisDir[i].PS.x );
1025 spins[i][1]->SetValue( axisDir[i].PS.y );
1026 spins[i][2]->SetValue( axisDir[i].PS.z );
1027 setText( vars, spins[i] );
1029 // cut off 3 used vars
1030 if ( !vars.isEmpty() )
1033 for ( int j = 0; j < 3; ++j )
1034 if (( ind = vars.indexOf(':', ind+1 )) < 0 )
1039 vars.remove( 0, ind+1 );
1044 dlg()->setMinimumSize( dlg()->minimumSizeHint().width(),
1045 dlg()->minimumSizeHint().height() );
1048 //================================================================================
1050 * \brief Tranfer parameters from widgets to hypothesis
1052 //================================================================================
1054 QString StdMeshersGUI_CartesianParamCreator::storeParams() const
1056 StdMeshers::StdMeshers_CartesianParameters3D_var h =
1057 StdMeshers::StdMeshers_CartesianParameters3D::_narrow( hypothesis() );
1062 SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().constData() );
1065 h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" );
1066 h->SetSizeThreshold( myThreshold->text().toDouble() );
1067 h->SetToAddEdges( myAddEdges->isChecked() );
1070 for ( int ax = 0; ax < 3; ++ax )
1072 if ( myAxisTabs[ax]->isGridBySpacing())
1074 SMESH::double_array_var intPoints;
1075 SMESH::string_array_var funs;
1076 myAxisTabs[ax]->getSpacing( funs.out(), intPoints.out() );
1077 h->SetGridSpacing( funs, intPoints, ax );
1081 SMESH::double_array_var coords = myAxisTabs[ax]->getCoordinates();
1082 h->SetGrid( coords, ax );
1088 params << myPointSpin[0]->text();
1089 params << myPointSpin[1]->text();
1090 params << myPointSpin[2]->text();
1091 h->SetVarParameter( params.join(":").toLatin1().constData(), "SetFixedPoint" );
1094 SMESH::PointStruct ps;
1095 ps.x = myPointSpin[0]->GetValue();
1096 ps.y = myPointSpin[1]->GetValue();
1097 ps.z = myPointSpin[2]->GetValue();
1098 h->SetFixedPoint( ps, !myFixedPointGrp->isEnabled() || !myFixedPointGrp->isChecked() );
1101 SMESHGUI_SpinBox* const * spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1102 for ( int ax = 0; ax < 3; ++ax )
1104 params << spins[ax][0]->text();
1105 params << spins[ax][1]->text();
1106 params << spins[ax][2]->text();
1108 h->SetVarParameter( params.join(":").toLatin1().constData(), "SetAxesDirs" );
1110 SMESH::DirStruct axDir[3];
1111 for ( int ax = 0; ax < 3; ++ax )
1113 axDir[ax].PS.x = spins[ax][0]->GetValue();
1114 axDir[ax].PS.y = spins[ax][1]->GetValue();
1115 axDir[ax].PS.z = spins[ax][2]->GetValue();
1117 h->SetAxesDirs( axDir[0], axDir[1], axDir[2] );
1120 catch(const SALOME::SALOME_Exception& ex)
1122 SalomeApp_Tools::QtCatchCorbaException(ex);
1127 //================================================================================
1129 * \brief Returns a name of help page
1131 //================================================================================
1133 QString StdMeshersGUI_CartesianParamCreator::helpPage() const
1135 return "cartesian_algo_page.html#cartesian_hyp_anchor";
1138 //================================================================================
1140 * \brief Show axes if they are OK
1142 //================================================================================
1144 bool StdMeshersGUI_CartesianParamCreator::updateAxesPreview()
1148 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1149 for ( int i = 0; i < 3 && isOk; ++i )
1151 gp_XYZ dir( spins[i][0]->GetValue(),
1152 spins[i][1]->GetValue(),
1153 spins[i][2]->GetValue());
1154 if (( isOk = ( dir.Modulus() > 1e-100 )))
1155 axes[i].SetDirection( gp_Dir( dir ));
1157 axes[i].SetLocation ( gp_Pnt( myOrigin[0],
1161 gp_Vec norm01 = axes[0].Direction().XYZ() ^ axes[1].Direction().XYZ();
1162 gp_Vec norm12 = axes[1].Direction().XYZ() ^ axes[2].Direction().XYZ();
1164 isOk = ( !axes[0].Direction().IsParallel( axes[1].Direction(), theAngTol ) &&
1165 !axes[1].Direction().IsParallel( axes[2].Direction(), theAngTol ) &&
1166 !axes[2].Direction().IsParallel( axes[0].Direction(), theAngTol ) &&
1167 !norm01.IsParallel( norm12, theAngTol ) );
1169 myAxesPreview->SetArrows( axes, myAxesLen );
1171 myAxesPreview->SetVisibility( isOk );
1176 //================================================================================
1178 * \brief Makes axes orthogonal if necessary
1180 //================================================================================
1182 void StdMeshersGUI_CartesianParamCreator::onOrthogonalAxes(bool isOrtho)
1186 updateAxesPreview();
1190 std::multimap< int, int > ageOfAxis;
1192 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1194 for ( int iAx = 0; iAx < 3; ++iAx )
1196 dirs[iAx].SetCoord( spins[iAx][0]->GetValue(),
1197 spins[iAx][1]->GetValue(),
1198 spins[iAx][2]->GetValue());
1199 if (( isOk = ( dirs[iAx].Modulus() > 1e-100 )))
1200 ageOfAxis.insert( std::make_pair( myDirTic[iAx], iAx ));
1202 ageOfAxis.insert( std::make_pair( -1, iAx ));
1209 dirs[0].SetCoord( 1, 0, 0 );
1210 dirs[1].SetCoord( 0, 1, 0 );
1211 dirs[2].SetCoord( 0, 0, 1 );
1216 int iOk = ageOfAxis.rbegin()->second;
1217 get3Dirs( iOk, dirs );
1221 std::multimap< int, int >::reverse_iterator ag2ax = ageOfAxis.rbegin();
1222 int iOk1 = ag2ax->second;
1223 int iOk2 = (++ag2ax)->second;
1224 int iKo = (++ag2ax)->second;
1225 if ( gp_Vec( dirs[ iOk1 ]).IsParallel( gp_Vec( dirs[ iOk2 ]), theAngTol ))
1226 std::swap( iOk2, iKo );
1227 if ( gp_Vec( dirs[ iOk1 ]).IsParallel( gp_Vec( dirs[ iOk2 ]), theAngTol ))
1229 get3Dirs( iOk1, dirs );
1233 dirs[ iKo ] = dirs[ iOk1 ] ^ dirs[ iOk2 ];
1234 dirs[ iOk2 ] = dirs[ iKo ] ^ dirs[ iOk1 ];
1235 if ( ( iOk1+1 ) % 3 != iOk2 )
1236 dirs[ iKo ].Reverse();
1240 for ( int iAx = 0; iAx < 3; ++iAx )
1242 double size = dirs[iAx].Modulus();
1243 if ( size > 1e-100 )
1245 for (int i = 0; i < 3; ++i )
1247 bool isBlocked = spins[iAx][i]->blockSignals( true );
1248 spins[iAx][i]->SetValue( dirs[iAx].Coord( i+1 ));
1249 spins[iAx][i]->blockSignals( isBlocked );
1253 updateAxesPreview();
1256 //================================================================================
1258 * \brief Increment myDirTic and update the preview of axes
1260 //================================================================================
1262 void StdMeshersGUI_CartesianParamCreator::onAxisDirChange(const QString&)
1264 QObject* changedSpin = sender();
1265 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1266 for ( int iAx = 0; iAx < 3; ++iAx )
1267 if ( spins[iAx][0] == changedSpin ||
1268 spins[iAx][1] == changedSpin ||
1269 spins[iAx][2] == changedSpin )
1271 myDirTic[ iAx ] = 1 + Max( Max( myDirTic[0], myDirTic[1] ), myDirTic[2] );
1275 onOrthogonalAxes( myOrthogonalChk->isChecked() );
1278 //================================================================================
1280 * \brief Sets axis direction by a selected EDGE
1282 //================================================================================
1284 void StdMeshersGUI_CartesianParamCreator::onSelectionChange()
1286 int iAxis = myAxisBtnGrp->checkedId();
1290 SALOME_ListIO aList;
1291 SMESHGUI::GetSMESHGUI()->selectionMgr()->selectedObjects(aList);
1293 TopoDS_Shape edge, shape;
1294 for( SALOME_ListIteratorOfListIO anIt( aList ); anIt.More(); anIt.Next() )
1296 GEOM::GEOM_Object_var go = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIt.Value() );
1297 if ( GEOMBase::GetShape( go, shape ) && shape.ShapeType() == TopAbs_EDGE )
1299 if ( !edge.IsNull() )
1300 return; // several EDGEs selected
1304 if ( edge.IsNull() )
1308 TopoDS_Iterator vIt( edge );
1309 for ( ; vIt.More() && vv[1].IsNull(); vIt.Next() )
1310 vv[ !vv[0].IsNull() ] = vIt.Value();
1313 if ( !GEOMBase::VertexToPoint( vv[0], pp[0] ) ||
1314 !GEOMBase::VertexToPoint( vv[1], pp[1] ))
1317 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1319 gp_Vec newDir( pp[0], pp[1] );
1320 gp_Vec curDir( spins[iAxis][0]->GetValue(),
1321 spins[iAxis][1]->GetValue(),
1322 spins[iAxis][2]->GetValue());
1323 if ( newDir * curDir < 0 )
1326 double size = newDir.Magnitude();
1327 if ( size < 1e-100 )
1331 for (int i = 0; i < 3; ++i )
1333 bool isBlocked = spins[iAxis][i]->blockSignals( true );
1334 spins[iAxis][i]->SetValue( newDir.Coord( i+1 ));
1335 spins[iAxis][i]->blockSignals( isBlocked );
1337 myDirTic[ iAxis ] = 1 + Max( Max( myDirTic[0], myDirTic[1] ), myDirTic[2] );
1339 onOrthogonalAxes( myOrthogonalChk->isChecked() );
1342 //================================================================================
1344 * \brief Sets axes at which number of hexahedra is maximal
1346 //================================================================================
1348 void StdMeshersGUI_CartesianParamCreator::onOptimalAxes(bool)
1350 StdMeshers::StdMeshers_CartesianParameters3D_var h =
1351 StdMeshers::StdMeshers_CartesianParameters3D::_narrow( hypothesis() );
1355 QString shapeEntry = getMainShapeEntry();
1356 if ( shapeEntry.isEmpty() )
1359 Handle(SALOME_InteractiveObject) io =
1360 new SALOME_InteractiveObject( shapeEntry.toStdString().c_str(), "GEOM" );
1361 GEOM::GEOM_Object_var geomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( io );
1362 if ( geomObj->_is_nil() )
1365 SMESH::DirStruct axDirs[3];
1366 h->ComputeOptimalAxesDirs( geomObj,
1367 myOrthogonalChk->isChecked(),
1372 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1373 for ( int iAx = 0; iAx < 3; ++iAx )
1375 double coords[3] = { axDirs[iAx].PS.x, axDirs[iAx].PS.y, axDirs[iAx].PS.z };
1376 for (int i = 0; i < 3; ++i )
1378 bool isBlocked = spins[iAx][i]->blockSignals( true );
1379 spins[iAx][i]->SetValue( coords[ i ]);
1380 spins[iAx][i]->blockSignals( isBlocked );
1383 updateAxesPreview();
1386 //================================================================================
1388 * \brief Sets axes || to the axes of global CS
1390 //================================================================================
1392 void StdMeshersGUI_CartesianParamCreator::onResetAxes(bool)
1394 SMESHGUI_SpinBox** spins[3] = { &myXDirSpin[0], &myYDirSpin[0], &myZDirSpin[0] };
1395 for ( int iAx = 0; iAx < 3; ++iAx )
1397 for (int i = 0; i < 3; ++i )
1399 bool isBlocked = spins[iAx][i]->blockSignals( true );
1400 spins[iAx][i]->SetValue( iAx == i ? 1. : 0. );
1401 spins[iAx][i]->blockSignals( isBlocked );
1405 updateAxesPreview();
1408 //================================================================================
1410 * \brief SLOT called when the grid definintion mode changes
1412 //================================================================================
1414 void StdMeshersGUI_CartesianParamCreator::onGridModeChanged(int)
1416 bool haveSpacing = ( myAxisTabs[0]->isGridBySpacing() ||
1417 myAxisTabs[1]->isGridBySpacing() ||
1418 myAxisTabs[2]->isGridBySpacing() );
1420 myFixedPointGrp->setEnabled( haveSpacing );