]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/VISU_I/VISU_CutPlanes_i.cc
Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISU_I / VISU_CutPlanes_i.cc
index a0f724b7cdb0330ad02634f061ccd6cb2c6804f1..e3cde2d82e4dba7cb31023765862f8c338926a59 100644 (file)
@@ -1,30 +1,32 @@
-//  VISU OBJECT : interactive object for VISU entities implementation
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  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.
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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. 
-// 
-//  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
+//  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
+//
+
+//  VISU OBJECT : interactive object for VISU entities implementation
 //  File   : VISU_PrsObject_i.cxx
 //  Author : Alexey PETROV
 //  Module : VISU
-
+//
 #include "VISU_CutPlanesPL.hxx"
+#include "VISU_Convertor.hxx"
 #include "VISU_Prs3dUtils.hh"
 #include "VISU_CutPlanes_i.hh"
 
@@ -32,7 +34,7 @@
 #include "VISU_Actor.h"
 
 #include "SUIT_ResourceMgr.h"
-#include "SALOME_Event.hxx"
+#include "SALOME_Event.h"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -40,6 +42,7 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
+using namespace std;
 
 //----------------------------------------------------------------------------
 size_t 
@@ -95,8 +98,12 @@ VISU::CutPlanes_i
 ::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode):
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
-  myCutPlanesPL(NULL)
-{}
+  myCutPlanesPL(NULL),
+  Deformation_i(this),
+  OptionalDeformation_i(this)
+{
+  if(MYDEBUG) MESSAGE("CutPlanes_i::CutPlanes_i()");
+}
 
 
 //----------------------------------------------------------------------------
@@ -125,12 +132,14 @@ VISU::CutPlanes_i
   SetOrientation(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
                 Storable::FindValue(theMap,"aRot[0]").toDouble(),
                 Storable::FindValue(theMap,"aRot[1]").toDouble());
-  QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlanePosition") );
-  QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlaneCondition") );
+  QStringList aPosList = VISU::Storable::FindValue(theMap,"myPlanePosition").split("|", QString::SkipEmptyParts );
+  QStringList aCondList = VISU::Storable::FindValue(theMap,"myPlaneCondition").split("|", QString::SkipEmptyParts );
   for(int i = 0, iEnd = GetNbPlanes(); i < iEnd; i++)
     if(aCondList[i].toInt() == 0)
       SetPlanePosition(i,aPosList[i].toDouble());
 
+  OptionalDeformation_i::RestoreDeformation(theSObject,theMap);
+  
   return this;
 }
 
@@ -150,8 +159,9 @@ void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
     aStrPos.append(QString::number(GetPlanePosition(i)) + "|");
     aStrCon.append(QString::number(IsDefault(i)) + "|");
   }
-  Storable::DataToStream( theStr, "myPlanePosition",  aStrPos.latin1());
-  Storable::DataToStream( theStr, "myPlaneCondition", aStrCon.latin1());
+  Storable::DataToStream( theStr, "myPlanePosition",  (const char*)aStrPos.toLatin1());
+  Storable::DataToStream( theStr, "myPlaneCondition", (const char*)aStrCon.toLatin1());
+  OptionalDeformation_i::DeformationToStream(theStr);
 }
 
 
@@ -321,6 +331,7 @@ VISU::CutPlanes_i
   }else
     myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine);
 
+  InitDeformedPipeLine(myCutPlanesPL);
   TSuperClass::CreatePipeLine(myCutPlanesPL);
 }
 
@@ -348,3 +359,10 @@ VISU::CutPlanes_i
   return NULL;
 }
 
+void
+VISU::CutPlanes_i::
+SameAs(const Prs3d_i* theOrigin){
+  if(MYDEBUG) MESSAGE("CutPlanes_i::SameAs()");
+  TSuperClass::SameAs(theOrigin);
+  OptionalDeformation_i::SameAsDeformation(dynamic_cast<const Deformation_i*>(theOrigin));
+}