Salome HOME
Update translations
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_MarkerDlg.cxx
index cf986c23a72e46e4162527cbd4932d83f925bd20..bf70a697f3156da53065a1bb5207544f1e748dda 100644 (file)
@@ -1,30 +1,31 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 // File   : GEOMToolsGUI_MarkerDlg.cxx
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
+
 #include "GEOMToolsGUI_MarkerDlg.h"
 
 #include <GeometryGUI.h>
 #include <GEOM_Displayer.h>
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <QtxComboBox.h>
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
@@ -160,7 +161,7 @@ GEOMToolsGUI_MarkerDlg::GEOMToolsGUI_MarkerDlg( QWidget* parent )
 
 GEOMToolsGUI_MarkerDlg::~GEOMToolsGUI_MarkerDlg()
 {
-  myOperation->Destroy();
+  myOperation->UnRegister();
 }
 
 void GEOMToolsGUI_MarkerDlg::setStandardMarker( GEOM::marker_type type, GEOM::marker_size size )
@@ -212,33 +213,33 @@ void GEOMToolsGUI_MarkerDlg::accept()
     if (window && window->getViewManager()) {
       int mgrId = window->getViewManager()->getGlobalId();
       if ( selMgr ) {
-       SALOME_ListIO selected;
-       selMgr->selectedObjects( selected );
-       if ( !selected.IsEmpty() ) {
-         _PTR(Study) study = getStudy()->studyDS();
-         for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) {
-           _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
-           GEOM::GEOM_Object_var anObject =
-             GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
-           if ( !anObject->_is_nil() ) {
-             if ( myWGStack->currentIndex() == 0 ) {
-               anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
-               QString aMarker = "%1%2%3";
-               aMarker = aMarker.arg(getMarkerType());
-               aMarker = aMarker.arg(DIGIT_SEPARATOR);
-               aMarker = aMarker.arg(getStandardMarkerScale());
-               getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, aMarker);
-             }
-             else if ( getCustomMarkerID() > 0 ) {
-               anObject->SetMarkerTexture( getCustomMarkerID() );
-               getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, QString::number(getCustomMarkerID()));
-             }
-           }
-         }
-         GEOM_Displayer displayer( getStudy() );
-         displayer.Redisplay( selected, true );
-         selMgr->setSelectedObjects( selected );
-       }
+        SALOME_ListIO selected;
+        selMgr->selectedObjects( selected );
+        if ( !selected.IsEmpty() ) {
+          _PTR(Study) study = getStudy()->studyDS();
+          for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) {
+            _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
+            GEOM::GEOM_Object_var anObject =
+              GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
+            if ( !anObject->_is_nil() ) {
+              if ( myWGStack->currentIndex() == 0 ) {
+                anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
+                QString aMarker = "%1%2%3";
+                aMarker = aMarker.arg(getMarkerType());
+                aMarker = aMarker.arg(DIGIT_SEPARATOR);
+                aMarker = aMarker.arg(getStandardMarkerScale());
+                getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, aMarker);
+              }
+              else if ( getCustomMarkerID() > 0 ) {
+                anObject->SetMarkerTexture( getCustomMarkerID() );
+                getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, QString::number(getCustomMarkerID()));
+              }
+            }
+          }
+          GEOM_Displayer displayer( getStudy() );
+          displayer.Redisplay( selected, true );
+          selMgr->setSelectedObjects( selected );
+        }
       }
     }
   }
@@ -336,7 +337,13 @@ void GEOMToolsGUI_MarkerDlg::addTexture( int id, bool select ) const
 {
   if ( id > 0 && myCustomTypeCombo->index( id ) == -1 ) {
     int tWidth, tHeight;
-    Handle(Graphic3d_HArray1OfBytes) texture = GeometryGUI::getTexture( getStudy(), id, tWidth, tHeight );
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+    Handle(TColStd_HArray1OfByte) texture = GeometryGUI::getTexture(getStudy(), id, tWidth, tHeight);
+#else
+    Handle(Graphic3d_HArray1OfBytes) texture = GeometryGUI::getTexture(getStudy(), id, tWidth, tHeight);
+#endif
+
     if ( !texture.IsNull() && texture->Length() == tWidth*tHeight/8 ) {
       QImage image( tWidth, tHeight, QImage::Format_Mono );
       image.setColor( 0, qRgba( 0, 0, 0, 0   ) );