From: jfa Date: Tue, 10 Jan 2006 10:53:33 +0000 (+0000) Subject: PAL11080: Wrong magnitude coloring of published animation. The method SameAs() of... X-Git-Tag: T_Before_Join_BR-D5-38-2003~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2570ae068e6ef8f2503fd572875c1f562bc3c6ea;p=modules%2Fvisu.git PAL11080: Wrong magnitude coloring of published animation. The method SameAs() of presentations was not really virtual. --- diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 36fd00a5..e08e3ff7 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -79,10 +79,6 @@ CutLines_i(Result_i* theResult, } -void VISU::CutLines_i::SameAs(const CutLines_i* theOrigin){ - VISU::ScalarMap_i::SameAs(theOrigin); -} - /*! Copy map to /a myMapCurvesInverted. * \param theCurves - map */ diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 93780198..84540a18 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -45,7 +45,6 @@ namespace VISU{ explicit CutLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const CutLines_i* theOrigin); virtual ~CutLines_i(); virtual VISU::VISUType GetType() { return VISU::TCUTLINES;}; diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index b0dca7d0..9cd09af5 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -75,11 +75,6 @@ CutPlanes_i(Result_i* theResult, } -void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){ - VISU::ScalarMap_i::SameAs(theOrigin); -} - - VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 28abd7d3..7c76d8c8 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -45,7 +45,6 @@ namespace VISU{ explicit CutPlanes_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const CutPlanes_i* theOrigin); virtual ~CutPlanes_i(); virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;}; diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 1198ad2d..f99b0794 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -86,13 +86,15 @@ DeformedShape_i(Result_i* theResult, } -void VISU::DeformedShape_i::SameAs(const DeformedShape_i* theOrigin) +void VISU::DeformedShape_i::SameAs(const Prs3d_i* theOrigin) { - DeformedShape_i* aDefShape = const_cast(theOrigin); VISU::ScalarMap_i::SameAs(theOrigin); - SetColor(aDefShape->GetColor()); - ShowColored(aDefShape->IsColored()); + if (const DeformedShape_i* aConstDefShape = dynamic_cast(theOrigin)) { + DeformedShape_i* aDefShape = const_cast(aConstDefShape); + SetColor(aDefShape->GetColor()); + ShowColored(aDefShape->IsColored()); + } } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index a930c37d..de9167b4 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -45,7 +45,7 @@ namespace VISU{ explicit DeformedShape_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const DeformedShape_i* theOrigin); + virtual void SameAs(const Prs3d_i* theOrigin); virtual ~DeformedShape_i(); virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;}; diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 79b2a877..853a5499 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -73,11 +73,6 @@ IsoSurfaces_i(Result_i* theResult, } -void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) { - VISU::ScalarMap_i::SameAs(theOrigin); -} - - VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index c7371b6a..d51f36aa 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -45,7 +45,6 @@ namespace VISU{ explicit IsoSurfaces_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const IsoSurfaces_i* theOrigin); virtual ~IsoSurfaces_i(); virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;}; diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 6d885102..5c3cb317 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -79,7 +79,7 @@ void VISU::Mesh_i::RemoveFromStudy() } -void VISU::Mesh_i::SameAs (const Mesh_i* theOrigin) +void VISU::Mesh_i::SameAs (const Prs3d_i* theOrigin) { return; // "SameAs" command for mesh is not valid in current architecture } diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index 6f7ffd5f..a9eb6f7e 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -44,7 +44,7 @@ namespace VISU{ explicit Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Mesh_i* theOrigin); + virtual void SameAs(const Prs3d_i* theOrigin); virtual ~Mesh_i(); virtual void RemoveFromStudy(); diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index a91f5bd5..8f69fd9f 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -64,11 +64,6 @@ VISU::Plot3D_i::Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject) { } -void VISU::Plot3D_i::SameAs (const Plot3D_i* theOrigin) -{ - VISU::ScalarMap_i::SameAs(theOrigin); -} - VISU::Storable* VISU::Plot3D_i::Create (const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index 14c39015..acd76440 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -39,7 +39,6 @@ namespace VISU { explicit Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs (const Plot3D_i* theOrigin); virtual ~Plot3D_i(); virtual VISU::VISUType GetType() { return VISU::TPLOT3D; }; diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index c8ef879e..ee0d28ed 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -100,11 +100,15 @@ void VISU::ScalarMap_i::RemoveFromStudy() } -void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin) +void VISU::ScalarMap_i::SameAs(const Prs3d_i* theOrigin) { - ScalarMap_i* aScalarMap = const_cast(theOrigin); DoHook(); - VISU::Prs3d_i::SameAs(aScalarMap); + VISU::Prs3d_i::SameAs(theOrigin); + + const ScalarMap_i* aConstScalarMap = dynamic_cast(theOrigin); + if (!aConstScalarMap) return; + + ScalarMap_i* aScalarMap = const_cast(aConstScalarMap); myField = aScalarMap->GetField(); myMeshName = myField->myMeshName; myEntity = myField->myEntity; diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 3ff15020..a1b3f0a5 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -46,7 +46,7 @@ namespace VISU{ explicit ScalarMap_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const ScalarMap_i* theOrigin); + virtual void SameAs(const Prs3d_i* theOrigin); virtual ~ScalarMap_i(); virtual void RemoveFromStudy(); @@ -173,7 +173,7 @@ namespace VISU{ const std::string& GetMeshName() const { return myMeshName;} VISU::Entity GetEntity() const { return VISU::Entity(myEntity);} const string& GetFieldName() const { return myFieldName;} - int GetIteration() const { return myIteration;} + //int GetIteration() const { return myIteration;} virtual void ToStream(std::ostringstream& theStr); diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index ecfe43c5..418d20cb 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -95,10 +95,14 @@ StreamLines_i(Result_i* theResult, } -void VISU::StreamLines_i::SameAs(const StreamLines_i* theOrigin) { - StreamLines_i* aStreamLines = const_cast(theOrigin); +void VISU::StreamLines_i::SameAs(const Prs3d_i* theOrigin) +{ VISU::DeformedShape_i::SameAs(theOrigin); - SetSource(aStreamLines->GetSource()); + + if (const StreamLines_i* aConstStreamLines = dynamic_cast(theOrigin)) { + StreamLines_i* aStreamLines = const_cast(aConstStreamLines); + SetSource(aStreamLines->GetSource()); + } } diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index ab842903..a5a1a253 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -46,7 +46,7 @@ namespace VISU{ explicit StreamLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const StreamLines_i* theOriginal); + virtual void SameAs(const Prs3d_i* theOriginal); virtual ~StreamLines_i(); virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;} diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index bd086a60..3fb10780 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -93,11 +93,14 @@ Vectors_i(Result_i* theResult, } -void VISU::Vectors_i::SameAs(const VISU::Vectors_i* theOrigin) { - Vectors_i* aVectors = const_cast(theOrigin); +void VISU::Vectors_i::SameAs(const VISU::Prs3d_i* theOrigin) +{ VISU::DeformedShape_i::SameAs(theOrigin); - SetLineWidth(aVectors->GetLineWidth()); + if (const VISU::Vectors_i* aConstVec = dynamic_cast(theOrigin)) { + VISU::Vectors_i* aVectors = const_cast(aConstVec); + SetLineWidth(aVectors->GetLineWidth()); + } } diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index bcb4ab2f..7c167ae0 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -45,7 +45,7 @@ namespace VISU{ explicit Vectors_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Vectors_i* theOrigin); + virtual void SameAs(const Prs3d_i* theOrigin); virtual ~Vectors_i(); virtual VISU::VISUType GetType() { return VISU::TVECTORS;};