+ switch ( aConstructorId ) {
+ case 0:
+ return !( myObjects.length() == 0 );
+ break;
+ case 1:
+ return !( myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() );
+ break;
+ case 2:
+ return !( myObjects.length() == 0 || myVector->_is_nil() );
+ break;
+ default:
+ return false;
+ }
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
+{
+ bool res = false;
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked();
+
+ GEOM::GEOM_Object_var anObj;
+
+ switch ( getConstructorId() ) {
+ case 0:
+ {
+ double dx = GroupPoints->SpinBox1->value();
+ double dy = GroupPoints->SpinBox2->value();
+ double dz = GroupPoints->SpinBox3->value();
+
+ if ( toCreateCopy ) {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ else {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ res = true;
+ break;
+ }
+ case 1:
+ {
+ if ( toCreateCopy ) {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ else {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ res = true;
+ break;
+ }
+ case 2:
+ {
+ if ( toCreateCopy ) {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ else {
+ for ( int i = 0; i < myObjects.length(); i++ ) {
+ anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector );
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+ }
+ }
+ res = true;
+ break;
+ }