* This enumeration contains a set of elements defining the
* type of the %entity (topological units) constituting a mesh.
*/
- enum Entity{ NODE, /*!< Node corresponds to a geometrical point. */
- EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
- FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
- CELL /*!< Cell is a volumic element of a mesh */
- };
+ enum Entity {
+ NODE, /*!< Node corresponds to a geometrical point. */
+ EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
+ FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
+ CELL, /*!< Cell is a volumic element of a mesh */
+ NONE /*!< Indicates undefined entity value */
+ };
/*!
* This enumeration contains a set of elements defining the type of the %VISU object.
*/
long GetScalarMode();
+ /*!
+ * Sets scalar range - min and max boundaries of the scalar bar.
+ * \param theMin Min boundary of the scalar bar.
+ * \param theMax Max boundary of the scalar bar.
+ */
+ void SetRange(in double theMin, in double theMax);
+
/*!
* Gets the min boundary of the scalar bar.
*/
*/
double GetMax();
+ /*!
+ * Sets scalar range that corresponds to the source data.
+ */
+ void SetSourceRange();
+
/*!
* Gets the min boundary of the scalar bar from source data.
*/
*/
Scaling GetScaling();
- /*!
- * Sets scalar range - min and max boundaries of the scalar bar.
- * \param theMin Min boundary of the scalar bar.
- * \param theMax Max boundary of the scalar bar.
- */
- void SetRange(in double theMin, in double theMax);
-
- /*!
- * Sets scalar range that corresponds to the source data.
- */
- void SetSourceRange();
-
/*!
* Add group as geometry of presentation.
* \param theMeshName - mesh name
* Presentation parameters of the Gauss Points presentation.
*/
//-------------------------------------------------------
- interface GaussPoints : ColoredPrs3d {
+ interface GaussPoints : ColoredPrs3d
+ {
+ //! Set flag indicating which scalar bar is active.
+ void SetIsActiveLocalScalarBar(in boolean theFlag);
+
+ //! Get flag indicating which scalar bar is active.
+ boolean GetIsActiveLocalScalarBar();
+
+ //! Set flag indicating visibility of global scalar bar.
+ void SetIsDispGlobalScalarBar(in boolean theFlag);
+
+ //! Get flag indicating visibility of global scalar bar.
+ boolean GetIsDispGlobalScalarBar();
+
+ //! Set value of the distance between global and local scalar bars.
+ void SetSpacing(in double theSpacing);
+
+ //! Get value of the distance between global and local scalar bars.
+ double GetSpacing();
+
+ /*!
+ * Set the Multicolored mode.
+ * \param theIsColored is used to switch between Results and Geometry modes.
+ * Multiple colors are using when the presentation is
+ * drawing in the Results mode, one color - in the Geometry mode.
+ */
+ void SetIsColored(in boolean theIsColored);
+
+ //! Gets current color mode
+ boolean GetIsColored();
+
+ /*! Sets the color of this presentation in case of IsColored switched off.
+ * \param theColor The color of this presentation. This parameter
+ * is taken from the <VAR>Color</VAR> enumeration.
+ */
+ void SetColor(in SALOMEDS::Color theColor);
+
+ /*!
+ * When the Bicolor parameter is set to true, scalar bars are
+ * drawing with two colors : red color correspoonds to positive
+ * scalar values, blue color - to negative values.
+ */
+ void SetBiColor(in boolean theIsBiColor);
+
+ //! Get the Bicolor mode.
+ boolean GetBiColor();
+
+ //! Checks whether the Gauss Points will be deformed or not
+ boolean GetIsDeformed();
+
+ //! Apply deformation on the Gauss Points
+ void SetIsDeformed(in boolean theIsDeformed);
+
+ /*!
+ * Sets the scale factor for scalar values
+ * (how much corresponding mesh elements should be translated).
+ * \param theScaleFactor The scaling factor.
+ */
+ void SetScaleFactor(in double theScaleFactor);
+
+ /*!
+ * Gets the scale factor for scalar values.
+ * (how much corresponding mesh elements is translated)
+ */
+ double GetScaleFactor();
+
+ /*!
+ * This enumeration contains a set of elements defining the type of representation of the vector head.
+ */
+ enum PrimitiveType {
+ SPRITE,
+ POINT,
+ SPHERE
+ };
+
+ //! Set type of the primitives which is used for drawing the Gauss Points
+ void SetPrimitiveType(in PrimitiveType thePrimitiveType);
+
+ //! Get type of the primitives which is used for drawing the Gauss Points
+ PrimitiveType GetPrimitiveType();
+
+ //! Sets Point Sprite clamp
+ void SetClamp(in double theClamp);
+
+ //! Gets Point Sprite clamp
+ double GetClamp();
+
+ //! Sets minimum size of Point Sprites
+ void SetMinSize(in double theMinSize);
+
+ //! Gets minimum size of Point Sprites
+ double GetMinSize();
+
+ //! Sets maximum size of Point Sprites
+ void SetMaxSize(in double theMaxSize);
+
+ //! Gets maximum size of Point Sprites
+ double GetMaxSize();
+
+ //! Sets magnification for Point Sprites
+ void SetMagnification(in double theMagnification);
+
+ //! Gets magnification for Point Sprites
+ double GetMagnification();
+
+ //! Sets the increment of changing Magnification parameter
+ void SetMagnificationIncrement(in double theIncrement);
+
+ //! Gets the increment of changing Magnification parameter
+ double GetMagnificationIncrement();
+
+ //! Sets Point Sprites size
+ void SetGeomSize(in double theGeomSize);
+
+ //! Sets size of Point Sprite
+ double GetGeomSize();
+
+ //! Get path to the image using for Main Point Sprite texture
+ string GetMainTexture();
+
+ //! Get path to the image using for Alpha Point Sprite texture
+ string GetAlphaTexture();
+
+ //! Points Main and AlphaMask images to be used by Point Sprites
+ void SetTextures(in string theMainTexture, in string theAlphaTexture);
+
+ //! Sets Point Sprite Alpha threshold
+ void SetAlphaThreshold(in double theAlphaThreshold);
+
+ //! Gets Point Sprite Alpha threshold
+ double GetAlphaThreshold();
+
+ //! Sets resolution of the Geometrical Sphere
+ void SetResolution(in long theResolution);
+
+ //! Sets resolution of the Geometrical Sphere
+ long GetResolution();
+
+ //! Sets how many faces of can be drawn in the Geometrical Sphere primitive mode
+ void SetFaceLimit(in long theFaceLimit);
+
+ //! Defines how many faces of can be drawn in the Geometrical Sphere primitive mode
+ long GetFaceLimit();
};
/*! \brief Deformed shape presentation interface
*
* Presentation parameters of the deformed shape presentation.
*/
- interface DeformedShape : ScalarMap {
+ interface DeformedShape : ScalarMap
+ {
/*!
* Sets the scale of the presentatable object.
* \param theScale Double value defining the scale of this presentable object.
* <BR><B>Time stamp</B> represents a subfield: the results
* of calculations are taken in one definite moment.
*/
- interface Animation : Base {
+ interface Animation : Base
+ {
/*!
* This enumeration contains a set of available animation modes.
*/
void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs);
};
+
/*! \brief Interface %Result
*
* This interface serves for inner representation of data generated
* in other sources (MED object or file). This data is needed
* for further construction of graphical presentations.
*/
- interface Result : RemovableObject, SALOME::GenericObj {
+ interface Result : RemovableObject, SALOME::GenericObj
+ {
/*! Reads all data from the corresponding sources. By default the data is loaded on demand.
*/
boolean BuildAll();
/*! Allow to check is min / max calculation over field's components already perfrormed or not */
boolean IsMinMaxDone();
+
+ /*! Allow to check is corresponding multi resolution structure already loaded or not */
+ boolean IsPartsDone();
+
+ typedef sequence<Entity> Entities;
+
+ typedef string EntityName;
+
+ typedef sequence<EntityName> EntityNames;
+
+ typedef long TimeStampNumber;
+
+ typedef sequence<TimeStampNumber> TimeStampNumbers;
+
+ enum Resolution {
+ FULL,
+ MEDIUM,
+ LOW,
+ HIDDEN
+ };
+
+ typedef sequence<Resolution> Resolutions;
+
+ /*! Gets existing mesh names */
+ EntityNames GetMeshNames();
+
+ /*! Gets existing mesh entites for the given mesh name */
+ Entities GetEntities(in EntityName theMeshName);
+
+ /*! Gets existing families for the given mesh name and entity */
+ EntityNames GetFamilies(in EntityName theMeshName, in Entity theEntity);
+
+ /*! Gets existing families for the given mesh name */
+ EntityNames GetGroups(in EntityName theMeshName);
+
+ /*! Gets existing fields for the given mesh name and entity */
+ EntityNames GetFields(in EntityName theMeshName, in Entity theEntity);
+
+ /*! Gets number of components for the given mesh name, entity and name of field */
+ long GetNumberOfComponents(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
+
+ /*! Gets existing numbers of time stamps for the given mesh name, entity and name of field */
+ TimeStampNumbers GetTimeStampNumbers(in EntityName theMeshName, in Entity theEntity, in EntityName theFieldName);
+
+ /*! Gets existing parts of multi resolution structure for the given mesh name */
+ EntityNames GetPartNames(in EntityName theMeshName);
+
+ /*! Gets available resolutions of multi resolution structure for the given mesh and part names */
+ Resolutions GetResolutions(in EntityName theMeshName, in EntityName thePartName);
+
+ /*! Gets current resolution of multi resolution structure for the given mesh and part names */
+ Resolution GetResolution(in EntityName theMeshName, in EntityName thePartName);
+
+ /*! Gets current resolution of multi resolution structure for the given mesh and part names */
+ void SetResolution(in EntityName theMeshName, in EntityName thePartName, in Resolution theResolution);
};
//-------------------------------------------------------
* post-processing presentations from given %Result and %Table object reference,
* using the views provided by %ViewManager.
*/
- interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base {
+ interface VISU_Gen : Engines::Component, SALOMEDS::Driver, Base
+ {
/*! Sets a definite study to be current.
*/
void SetCurrentStudy(in SALOMEDS::Study theStudy);
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a Gauss Points presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a deformed shape presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a deformed shape presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a vector presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
Vectors VectorsOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates an iso surface presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates an stream lines presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
StreamLines StreamLinesOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a presentation of cut planes.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a presentation of cut lines.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
CutLines CutLinesOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a Plot3D presentation.
* \param theMeshName One of the meshes presented in MED file
* \param theEntity Type of entity where the field is defined
* \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
- * \param theIteration Number of iteration on the field
+ * \param theTimeStampNumber Number of iteration on the field
*/
Plot3D Plot3DOnField(in Result theResult, in string theMeshName,
in Entity theEntity, in string theFieldName,
- in long theIteration);
+ in long theTimeStampNumber);
/*!
* Creates a table presentation.
#include <utility>
+//---------------------------------------------------------------
+VISU_Convertor
+::VISU_Convertor():
+ myIsDone(false)
+{}
+
+
+//---------------------------------------------------------------
+const std::string&
+VISU_Convertor
+::GetName()
+{
+ return myName;
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_Convertor
+::IsDone() const
+{
+ return myIsDone;
+}
+
//---------------------------------------------------------------
const VISU::TMeshMap&
VISU_Convertor
class VISU_CONVERTOR_EXPORT VISU_Convertor
{
public:
- virtual
- ~VISU_Convertor()
- {};
-
//! Get brief name of the corresponding source MED file
virtual
const std::string&
- GetName(){ return myName;}
+ GetName();
//! Let known whether the source MED file parsed or not
virtual
int
- IsDone() const { return myIsDone; }
+ IsDone() const;
//! This method perform first parsing of MED file to get known what MED entities are pressent in it
virtual
GenerateName(const std::string& theName, unsigned int theTimeId);
protected:
+ VISU_Convertor();
+
std::string myName;
VISU::TMeshMap myMeshMap;
int myIsDone;
extern "C"
{
-VISU_CONVERTOR_EXPORT
//! Instatiate proper VISU_Convertor subclass
+ VISU_CONVERTOR_EXPORT
VISU_Convertor*
CreateConvertor(const std::string& theFileName);
};
//---------------------------------------------------------------
VISU_Convertor_impl
-::VISU_Convertor_impl()
-{
- myIsDone = false;
-}
+::VISU_Convertor_impl()
+{}
//---------------------------------------------------------------
VISU_Convertor_impl
::BuildFields()
{
+ BuildEntities();
return this;
}
VISU_Convertor_impl
::BuildMinMax()
{
+ BuildFields();
return this;
}
myIsMinMaxDone(false),
myMed(theMed)
{
- myFileInfo.setFile(QString(theFileName.c_str()));
- myName = myFileInfo.baseName().latin1();
+ myName = theFileName;
}
if(myIsFieldsDone)
return this;
+ VISU_Convertor_impl::BuildFields();
+
TSetIsDone aSetIsDone(myIsFieldsDone);
VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
if(myIsMinMaxDone)
return this;
+ VISU_Convertor_impl::BuildMinMax();
+
TSetIsDone aSetIsDone(myIsMinMaxDone);
VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
#include "MED_GaussUtils.hxx"
#include <boost/thread/mutex.hpp>
-#include <qfileinfo.h>
namespace VISU
{
BuildGroups();
protected:
- QFileInfo myFileInfo;
MED::PWrapper myMed; // mpv : bug 13568: one med per converter
virtual
}
+//----------------------------------------------------------------------------
VISU_ColoredPL
::~VISU_ColoredPL()
{}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ColoredPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myMapperTable->GetMTime());
+ aTime = std::max(aTime, myBarTable->GetMTime());
+ aTime = std::max(aTime, myExtractor->GetMTime());
+ aTime = std::max(aTime, myFieldTransform->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_ColoredPL
{
if(theRange[0] > theRange[1])
return;
+
+ if(VISU::CheckIsSameRange(GetScalarRange(), theRange))
+ return;
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
vtkFloatingPointType *aRange = GetScalarRange();
vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
if(myBarTable->GetScale() == VTK_SCALE_LOG10)
- VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
- myMapperTable->SetRange(aScalarRange);
+ VISU_LookupTable::ComputeLogRange(aRange, aScalarRange);
+ if(!VISU::CheckIsSameRange(myMapperTable->GetRange(), aScalarRange))
+ myMapperTable->SetRange(aScalarRange);
+
myMapperTable->Build();
myBarTable->Build();
public:
vtkTypeMacro(VISU_ColoredPL, VISU_PipeLine);
+ virtual
+ unsigned long int
+ GetMTime();
+
//----------------------------------------------------------------------------
virtual
int
protected:
VISU_CutLinesPL();
- VISU_CutLinesPL(const VISU_CutLinesPL&);
virtual
void
vtkFloatingPointType myBasePnt[3];
vtkFloatingPointType myPosition;
int myCondition;
+
+private:
+ VISU_CutLinesPL(const VISU_CutLinesPL&); // Not implemented.
+ void operator=(const VISU_CutLinesPL&); // Not implemented.
};
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_CutPlanesPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myAppendPolyData->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
{
public:
vtkTypeMacro(VISU_CutPlanesPL, VISU_ScalarMapPL);
- static VISU_CutPlanesPL* New();
+
+ static
+ VISU_CutPlanesPL*
+ New();
virtual
- ~VISU_CutPlanesPL();
+ unsigned long int
+ GetMTime();
+ //----------------------------------------------------------------------------
enum PlaneOrientation {XY, YZ, ZX};
virtual
const std::vector<vtkFloatingPointType>& thePlanePosition,
const std::vector<int>& thePlaneCondition,
vtkFloatingPointType theDisplacement);
+
protected:
VISU_CutPlanesPL();
- VISU_CutPlanesPL(const VISU_CutPlanesPL&);
+
+ virtual
+ ~VISU_CutPlanesPL();
virtual
vtkDataSet*
vtkAppendPolyData *myAppendPolyData;
std::vector<vtkFloatingPointType> myPartPosition;
std::vector<int> myPartCondition;
+
+private:
+ VISU_CutPlanesPL(const VISU_CutPlanesPL&); // Not implemented.
+ void operator=(const VISU_CutPlanesPL&); // Not implemented.
};
#endif
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedShapePL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myWarpVector->GetMTime());
+ aTime = std::max(aTime, myCellDataToPointData->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_DeformedShapePL
VISU_DeformedShapePL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
virtual
void
SetScale(vtkFloatingPointType theScale);
protected:
VISU_DeformedShapePL();
- VISU_DeformedShapePL(const VISU_DeformedShapePL&);
virtual
~VISU_DeformedShapePL();
vtkFloatingPointType myScaleFactor;
vtkWarpVector *myWarpVector;
vtkCellDataToPointData* myCellDataToPointData;
+
+private:
+ VISU_DeformedShapePL(const VISU_DeformedShapePL&); // Not implemented.
+ void operator=(const VISU_DeformedShapePL&); // Not implemented.
};
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPointsPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myWarpVector->GetMTime());
+ aTime = std::max(aTime, myGlyph->GetMTime());
+ aTime = std::max(aTime, mySphereSource->GetMTime());
+
+ for(int i = 0; i < 3; i++)
+ aTime = std::max(aTime, myPassFilter[i]->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
VISU_GaussPointsPL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
//----------------------------------------------------------------------------
void
SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
vtkFloatingPointType myMagnificationIncrement;
int myPrimitiveType;
+
+private:
+ VISU_GaussPointsPL(const VISU_GaussPointsPL&); // Not implemented.
+ void operator=(const VISU_GaussPointsPL&); // Not implemented.
};
#endif
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_IsoSurfacesPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myCellDataToPointData->GetMTime());
+ aTime = std::max(aTime, myContourFilter->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
VISU_IsoSurfacesPL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
virtual
int
GetNbParts();
protected:
VISU_IsoSurfacesPL();
- VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
virtual
~VISU_IsoSurfacesPL();
vtkFloatingPointType myRange[2];
vtkCellDataToPointData* myCellDataToPointData;
vtkContourFilter *myContourFilter;
+
+private:
+ VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);; // Not implemented.
+ void operator=(const VISU_IsoSurfacesPL&); // Not implemented.
+
};
myPipeLine->Init();
myPipeLine->Update();
}
+
+ Modified();
}
VISU_PipeLine
::SetIsShrinkable(bool theIsShrinkable)
{
+ if(myIsShrinkable == theIsShrinkable)
+ return;
+
myIsShrinkable = theIsShrinkable;
+ Modified();
}
//----------------------------------------------------------------------------
VISU_Plot3DPL
::~VISU_Plot3DPL()
+{}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_Plot3DPL
+::GetMTime()
{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myCellDataToPointData->GetMTime());
+ aTime = std::max(aTime, myAppendPolyData->GetMTime());
+ aTime = std::max(aTime, myGeometryFilter->GetMTime());
+ aTime = std::max(aTime, myContourFilter->GetMTime());
+ aTime = std::max(aTime, myWarpScalar->GetMTime());
+
+ return aTime;
}
VISU_Plot3DPL*
New();
- virtual
- ~VISU_Plot3DPL();
+ virtual
+ unsigned long int
+ GetMTime();
+ //----------------------------------------------------------------------------
VISU_CutPlanesPL::PlaneOrientation
GetPlaneOrientation();
protected:
VISU_Plot3DPL();
- VISU_Plot3DPL(const VISU_Plot3DPL&);
+ virtual
+ ~VISU_Plot3DPL();
virtual
vtkDataSet*
vtkSmartPointer<vtkGeometryFilter> myGeometryFilter;
vtkSmartPointer<vtkContourFilter> myContourFilter;
vtkSmartPointer<vtkWarpScalar> myWarpScalar;
+
+private:
+ VISU_Plot3DPL(const VISU_Plot3DPL&);; // Not implemented.
+ void operator=(const VISU_Plot3DPL&); // Not implemented.
};
#endif
{}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ScalarMapPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myAppendFilter->GetMTime());
+ aTime = std::max(aTime, myMergeFilter->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
VISU_ScalarMapPL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
virtual
void
Update();
protected:
//----------------------------------------------------------------------------
VISU_ScalarMapPL();
- VISU_ScalarMapPL(const VISU_ScalarMapPL&);
virtual
~VISU_ScalarMapPL();
bool theIsCopyInput);
private:
+ VISU_ScalarMapPL(const VISU_ScalarMapPL&); // Not implemented.
+ void operator=(const VISU_ScalarMapPL&); // Not implemented.
+
vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
};
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_StreamLinesPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myStream->GetMTime());
+ aTime = std::max(aTime, mySource->GetMTime());
+ aTime = std::max(aTime, myCenters->GetMTime());
+ aTime = std::max(aTime, myGeomFilter->GetMTime());
+ aTime = std::max(aTime, myPointsFilter->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_StreamLinesPL
VISU_StreamLinesPL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
virtual
size_t
SetParams(vtkFloatingPointType theIntStep,
protected:
VISU_StreamLinesPL();
- VISU_StreamLinesPL(const VISU_StreamLinesPL&);
virtual
~VISU_StreamLinesPL();
VTKViewer_GeometryFilter *myGeomFilter;
VISU_MaskPointsFilter *myPointsFilter;
vtkFloatingPointType myPercents;
+
+private:
+ VISU_StreamLinesPL(const VISU_StreamLinesPL&); // Not implemented.
+ void operator=(const VISU_StreamLinesPL&); // Not implemented.
};
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_VectorsPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myBaseGlyph->GetMTime());
+ aTime = std::max(aTime, myTransformedGlyph->GetMTime());
+ aTime = std::max(aTime, myCenters->GetMTime());
+ aTime = std::max(aTime, myGlyphSource->GetMTime());
+ aTime = std::max(aTime, myConeSource->GetMTime());
+ aTime = std::max(aTime, myLineSource->GetMTime());
+ aTime = std::max(aTime, myTransformFilter->GetMTime());
+
+ return aTime;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_VectorsPL
VISU_VectorsPL*
New();
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
virtual
void
SetScale(vtkFloatingPointType theScale);
protected:
VISU_VectorsPL();
- VISU_VectorsPL(const VISU_VectorsPL&);
virtual
~VISU_VectorsPL();
VTKViewer_TransformFilter *myTransformFilter;
VISU_UsedPointsFilter* myUsedPointsFilter;
+
+private:
+ VISU_VectorsPL(const VISU_VectorsPL&); // Not implemented.
+ void operator=(const VISU_VectorsPL&); // Not implemented.
};
application()->putInfo( anInfo );
QApplication::setOverrideCursor(Qt::waitCursor);
- // MULTIPR: CreateResult
VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() );
if (CORBA::is_nil(aResult.in())) {
tr("MEN_CACHE_PROPERTIES"), "", 0, aParent, false,
this, SLOT(OnCacheProperties()));
-#ifdef ENABLE_MULTIPR
- // MULTIPR
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIconSet(aPixmap),
tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIconSet(aPixmap),
tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
this, SLOT(OnMultiprViewHide()));
-#endif
}
void
mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
-#ifdef ENABLE_MULTIPR
- // MULTIPR
mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
-#endif
-
// Rules
mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
" and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
"or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
- mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
+ mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1", true );
+
mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
// rename command
//aRule = "client='ObjectBrowser' and type='MEDFIELD'";
//mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- aRule = "client='ObjectBrowser' and $type in {'VISU::TPART'}";
- mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aRule + " and selcount>=1", true );
- mgr->setRule( action( VISU_MULTIPR_MED_RES ), aRule + " and selcount>=1", true );
- mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aRule + " and selcount>=1", true );
- mgr->setRule( action( VISU_MULTIPR_HIDE), aRule + " and selcount>=1", true );
-#endif
+ aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
+ {
+ QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
+ mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule, true );
+ }
+ {
+ QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
+ mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule, true );
+ }
+ {
+ QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
+ mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule, true );
+ }
+ {
+ QString aCustomRule = aRule + "resolutionState!='H'";
+ mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule, true );
+ }
}
//***************************************************************************
aDlg->exec();
}
-// MULTIPR
+
+//---------------------------------------------------------------
void VisuGUI::OnMultiprViewFullRes()
{
-#ifdef ENABLE_MULTIPR
- OnMultiprChangeRes('F');
-#endif
+ OnMultiprChangeRes(VISU::Result::FULL);
}
-// MULTIPR
+
+//---------------------------------------------------------------
void VisuGUI::OnMultiprViewMediumRes()
{
-#ifdef ENABLE_MULTIPR
- OnMultiprChangeRes('M');
-#endif
+ OnMultiprChangeRes(VISU::Result::MEDIUM);
}
-// MULTIPR
+
+//---------------------------------------------------------------
void VisuGUI::OnMultiprViewLowRes()
{
-#ifdef ENABLE_MULTIPR
- OnMultiprChangeRes('L');
-#endif
+ OnMultiprChangeRes(VISU::Result::LOW);
}
-// MULTIPR
+
+//---------------------------------------------------------------
void VisuGUI::OnMultiprViewHide()
{
-#ifdef ENABLE_MULTIPR
- OnMultiprChangeRes('H');
-#endif
+ OnMultiprChangeRes(VISU::Result::HIDDEN);
}
-// MULTIPR
-void VisuGUI::OnMultiprChangeRes(char resolution)
+
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
{
-#ifdef ENABLE_MULTIPR
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
if (CheckLock(aCStudy,GetDesktop(this)))
return;
if(aSelectionInfo.empty())
return;
- //cout << "selection: #=" << aSelectionInfo.size() << endl;
+ QApplication::setOverrideCursor(Qt::waitCursor);
- for (int i=0; i<aSelectionInfo.size(); i++)
- {
+ typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
+ typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
+ TResult2SObject aResult2SObject;
+
+ for (int i=0; i < aSelectionInfo.size(); i++) {
VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
_PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
continue;
VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
- VISU::Result_i* result = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
+ if(CORBA::is_nil(aResult.in()))
+ continue;
+
+ VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
+ if(!aCResult)
+ continue;
- _PTR(GenericAttribute) anAttr;
- if (aSObject->FindAttribute(anAttr, "AttributePixMap"))
- {
- _PTR(AttributePixMap) aPixMap(anAttr);
- if ( aPixMap->HasPixMap() )
- {
- const char* oldIcon = aPixMap->GetPixMap().c_str();
- if ( (strcmp(oldIcon, "ICON_MULTIPR_VIEW_FULL") == 0) ||
- (strcmp(oldIcon, "ICON_MULTIPR_VIEW_MEDIUM") == 0) ||
- (strcmp(oldIcon, "ICON_MULTIPR_VIEW_LOW") == 0) ||
- (strcmp(oldIcon, "ICON_MULTIPR_VIEW_HIDE") == 0) )
- {
- bool hasMediumOrLow = (strstr(aSObject->GetComment().c_str(), "res=FML") != NULL);
-
- if (resolution == 'F')
- {
- if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'F');
- aPixMap->SetPixMap("ICON_MULTIPR_VIEW_FULL");
- }
- else if ((resolution == 'M') && hasMediumOrLow)
- {
- if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'M');
- aPixMap->SetPixMap("ICON_MULTIPR_VIEW_MEDIUM");
- }
- else if ((resolution == 'L') && hasMediumOrLow)
- {
- if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'L');
- aPixMap->SetPixMap("ICON_MULTIPR_VIEW_LOW");
- }
- else if (resolution == 'H')
- {
- if (result != NULL) result->SetResolutionMultipr(aSObject->GetName().c_str(), 'H');
- aPixMap->SetPixMap("ICON_MULTIPR_VIEW_HIDE");
- }
- }
- }
- }
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
+ bool anIsFound = false;
+ QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
+ if(!anIsFound)
+ continue;
+
+ std::string aPartName = aSObject->GetName();
+
+ aCResult->SetResolution(aMeshName.latin1(), aPartName.c_str(), theResolution);
+
+ aResult2SObject[TResultPtr(aCResult)] = aSObject;
}
- UpdateObjBrowser(this, false);
-#endif
+ // To update all result observers
+ TResult2SObject::const_iterator anIter = aResult2SObject.begin();
+ for(; anIter != aResult2SObject.end(); anIter++){
+ const TResultPtr& aResultPtr = anIter->first;
+ const _PTR(SObject)& aSObject = anIter->second;
+ aResultPtr->UpdateObservers();
+ VISU::UpdateObjBrowser(this, false, aSObject);
+ }
+
+ QApplication::restoreOverrideCursor();
}
void OnMultiprViewMediumRes();
void OnMultiprViewLowRes();
void OnMultiprViewHide();
- void OnMultiprChangeRes(char resolution);
+ void OnMultiprChangeRes(VISU::Result::Resolution theResolution);
protected:
virtual LightApp_Selection* createSelection() const;
aMainLayout->addWidget(aBtnBox);
- myCutLines = NULL;
-
// signals and slots connections
connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
- //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
- //connect(VisuGUI::application()->desktop(),
- // SIGNAL(windowActivated(SUIT_ViewWindow*)),
- // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
}
/*!
*/
VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
{
- cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
deletePlanes();
- if (myCutLines) //delete myCutLines;
- myCutLines->Destroy();
if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
vf->Repaint();
}
hasInit = true;
myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(myPrsCopy, VISU::ColoredPrs3d_i::EDoNotPublish);
myCutLines->CopyCurvesInverted(myPrsCopy->GetCurvesInverted());
- if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
+ if (myCutLines->IsAllCurvesInverted())
+ myAllCurvesInvertedCheck->setChecked(true);
myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
myCBSetDef->setChecked(myPrsCopy->IsDefault());
DrawTable();
if (myAllCurvesInvertedCheck->isChecked())
myPrsCopy->SetAllCurvesInverted(true);
- VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TCUTLINES>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
{
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView == NULL) return;
- if (myCutLines == NULL) return;
+ if (!myCutLines) return;
if (myPreviewActor != 0) return;
storeToPrsObject(myCutLines);
}
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
- if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
- /*myCutLines->SetOrientation2(getOrientaion(false),
- myRotXSpn2->value()*PI/180.,
- myRotYSpn2->value()*PI/180.);
- myCutLines->SetDisplacement2(myPosSpn2->value());*/
- //myCutLines->GetPipeLine()->Update();
+ if (theUpdate && myPreviewCheck->isChecked() && myCutLines) {
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
}
if (myCBSetDef->isChecked()) {
if (!myCutLines->IsDefault()) myCutLines->SetDefault();
- /*myCutLines->SetOrientation(getOrientaion(),
- myRotXSpn->value()*PI/180.,
- myRotYSpn->value()*PI/180.);
- myCutLines->SetDisplacement(myPosSpn->value());*/
- /* float aPos = myCutLines->GetBasePlanePosition();
- myBasePlanePos->setText( QString::number(aPos) );
- myBasePlanePos->setEnabled(false);*/
myCutLines->SetDisplacement(myPosSpn->value());
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
- if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
- //myCutLines->SetBasePlanePosition(aPos);
- // myCutLines->GetPipeLine()->Update();
+ if (theUpdate && myPreviewCheck->isChecked() && myCutLines) {
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
vtkFloatingPointType aPos = myCutLines->GetBasePlanePosition();
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
- // myCutLines->GetPipeLine()->Update();
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
}
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
- //Update Preview
- //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
- // myCutLines->GetPipeLine()->Update();
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
} else if (theCol == 1){
bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
if (isDefault) {
- //myCutLines->SetDefaultPosition(theRow);
- // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
- //Update Preview
- // myCutLines->GetPipeLine()->Update();
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
void VisuGUI_CutLinesDlg::accept()
{
- //if ( !VisuGUI::CheckActiveStudyLock() ) {
- // reject();
- // return;
- //}
- // if (myScalarPane->check()) {
- /*jfa tmp:((QWidget*)sender())->setDisabled(true);
- storeToPrsObject(myPrsCopy);
- if (myIsCreation) {
- if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(myPrsCopy->GetEntry());
- if (isGenerateCurves()) {
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
- if( aSObject ) {
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- visuGUI->CreatePlot(aTblObj);
- }
- }
- }
- }
- }
- }
- if (GET_VTK_VIEWWINDOW(myMgr)) {
- try {
- visuGUI->CreateActor(myPrsCopy);
- } catch (...) {
- reject();
- return;
- }
- GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
- }
- } else {
- visuGUI->RecreateActor(myPrsCopy);
- if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
- if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }
- // Remove old Table
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
- if( aSObject ) {
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
- break;
- }
- }
- }
- if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
- if (isGenerateCurves()) {
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- visuGUI->CreatePlot(aTblObj);
- }
- }
- }
- }
- }
- }
- }
- VisuGUI::application()->objectBrowser()->updateTree();*/
myScalarPane->deletePreview();
deletePlanes();
QDialog::accept();
void VisuGUI_CutLinesDlg::reject()
{
- /*jfa tmp:if (myIsCreation) {
- myPrsCopy->RemoveFromStudy();
- VisuGUI::application()->objectBrowser()->updateTree();
- }*/
myScalarPane->deletePreview();
deletePlanes();
QDialog::reject();
{
if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
if (thePreview) {
- //storeToPrsObject(myCutLines);
- // myCutLines->GetPipeLine()->Update();
createPlanes();
- //vf->onFitAll();
} else {
deletePlanes();
vf->Repaint();
void VisuGUI_CutLinesDlg::onRotation (double theValue)
{
- if (myCutLines == NULL) return;
+ if (!myCutLines) return;
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
-
- /*myCutLines->SetOrientation(getOrientaion(),
- myRotXSpn->value()*PI/180.,
- myRotYSpn->value()*PI/180.);
- myCutLines->SetOrientation2(getOrientaion(false),
- myRotXSpn2->value()*PI/180.,
- myRotYSpn2->value()*PI/180.);*/
- // myCutLines->GetPipeLine()->Update();
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
}
void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
{
- if (myCutLines == NULL) return;
+ if (!myCutLines) return;
SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
- //myCutLines->SetBasePlanePosition(theValue.toDouble());
- // myCutLines->GetPipeLine()->Update();
deletePlanes();
createPlanes();
- //aView->Repaint();
}
}
}
bool hasInit;
QDoubleValidator *mydvalidator;
- VISU::CutLines_i* myCutLines;
+ SALOME::GenericObjPtr<VISU::CutLines_i> myCutLines;
QTabWidget* myTabBox;
VisuGUI_ScalarBarPane* myScalarPane;
connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
// default values
- myCutPlanes = NULL;
hasInit = false;
X1 = 0; X2 = 0;
Y1 = 0; Y2 = 0;
VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
{
deletePlanes();
- if (myCutPlanes)
- myCutPlanes->Destroy();
if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
vf->Repaint();
}
void VisuGUI_CutPlanesPane::createPlanes()
{
if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
- if (myCutPlanes == NULL) return;
+ if (!myCutPlanes) return;
if (myPreviewActor != 0) return;
vtkAppendPolyData* aPolyData = myCutPlanes->GetSpecificPL()->GetAppendPolyData();
*/
void VisuGUI_CutPlanesPane::DrawTable()
{
- if (myCutPlanes == NULL) return;
+ if (!myCutPlanes) return;
if (!hasInit) return;
int aNbRows = myPosTable->numRows();
void VisuGUI_CutPlanesPane::onRotation (double theValue)
{
- if (myCutPlanes == NULL) return;
+ if (!myCutPlanes) return;
if (myPreviewCheck->isChecked()) {
if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
anIsOk &= myScalarPane->storeToPrsObject(myPrsCopy);
anIsOk &= myCutPane->storeToPrsObject(myPrsCopy);
- VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
QRadioButton* RBxy;
QtxDblSpinBox* myPosSpn;
QTable* myPosTable;
- VISU::CutPlanes_i* myCutPlanes;
+ SALOME::GenericObjPtr<VISU::CutPlanes_i> myCutPlanes;
QCheckBox* myPreviewCheck;
double X1, X2;
double Y1, Y2;
VisuGUI_CutPlanesPane* myCutPane;
VisuGUI_ScalarBarPane* myScalarPane;
VisuGUI_InputPane* myInputPane;
- VISU::CutPlanes_i* myPrs;
SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
};
myPrsCopy->SetScale(getFactor());
myPrsCopy->ShowColored(isColored());
- VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
RangeGroupLayout->addWidget( myModeCombo, 0, 1 );
- //TopLayout->addWidget( RangeGroup );
+ RBFieldRange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFieldRange");
+ RBImposedRange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBImposedRange");
+ RBFieldRange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+ MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+ MinLabel->setBuddy(MinEdit);
+
+ MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+ MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+ MaxLabel->setBuddy(MaxEdit);
+
+ RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
+ RangeGroupLayout->addMultiCellWidget( myModeCombo, 0, 0, 1, 3);
+ RangeGroupLayout->addMultiCellWidget( RBFieldRange, 1, 1, 0, 1);
+ RangeGroupLayout->addMultiCellWidget( RBImposedRange, 1, 1, 2, 3);
+ RangeGroupLayout->addWidget( MinLabel, 2, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 2, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 2, 3 );
// Colors and Labels ========================================================
QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
myTextDlg->setTitleVisible(!SetPref);
// signals and slots connections ===========================================
- connect( myRBLocal, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
- connect( myRBGlobal, SIGNAL( clicked() ), this, SLOT( onSetDisplayGlobal() ) );
+ connect( RBFieldRange, SIGNAL( clicked() ), this, SLOT( fieldRangeClicked() ) );
+ connect( RBImposedRange, SIGNAL( clicked() ), this, SLOT( imposedRangeClicked() ) );
+
+ connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) );
+
+ connect( myRBLocal, SIGNAL( clicked() ), this, SLOT( onLocalScalarBar() ) );
+ connect( myRBGlobal, SIGNAL( clicked() ), this, SLOT( onGlobalScalarBar() ) );
+
connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorLabel, SLOT( setEnabled( bool ) ) );
connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorSpin, SLOT( setEnabled( bool ) ) );
connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelLabel, SLOT( setEnabled( bool ) ) );
myIsStoreTextProp = false;
}
-void VisuGUI_GaussScalarBarPane::onSetDisplayGlobal()
+void VisuGUI_GaussScalarBarPane::onGlobalScalarBar()
{
myCBDisplayed->setChecked( true );
+
+ RBImposedRange->setEnabled( false );
+ RBFieldRange->setEnabled( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+
+ myPrsCopy->SetIsActiveLocalScalarBar(false);
+}
+
+
+void VisuGUI_GaussScalarBarPane::onLocalScalarBar()
+{
+ myCBDisplayed->setEnabled( true );
+
+ RBImposedRange->setEnabled( true );
+ RBFieldRange->setEnabled( true );
+
+ if ( RBImposedRange->isChecked() ) {
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ }
+
+ myPrsCopy->SetIsActiveLocalScalarBar(true);
+}
+
+
+/*!
+ Called when Range mode is changed to FieldRange
+*/
+void VisuGUI_GaussScalarBarPane::fieldRangeClicked()
+{
+ RBImposedRange->setChecked( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+
+ MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
+ MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
+
+ myPrsCopy->SetSourceRange();
+}
+
+
+/*!
+ Called when Range mode is changed to FieldRange
+*/
+void VisuGUI_GaussScalarBarPane::imposedRangeClicked()
+{
+ RBFieldRange->setChecked( false );
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+
+ myPrsCopy->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
}
+/*!
+ Called when scalar mode is changed
+*/
+void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode )
+{
+ myPrsCopy->SetScalarMode( theMode );
+ if ( RBFieldRange->isChecked() ) {
+ CORBA::Double aRange[2] = {myPrsCopy->GetSourceMin(), myPrsCopy->GetSourceMax()};
+ MinEdit->setText( QString::number( aRange[0] ) );
+ MaxEdit->setText( QString::number( aRange[1] ) );
+ }
+}
+
/**
* Initialise dialog box from presentation object
*/
void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) {
+ myPrsCopy = thePrs;
+
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+
+ bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
+ if ( activeLocal ) {
+ if ( thePrs->IsRangeFixed() ) {
+ RBImposedRange->setChecked( true );
+ RBFieldRange->setChecked( false );
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ } else {
+ RBImposedRange->setChecked( false );
+ RBFieldRange->setChecked( true );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ }
+ } else {
+ RBImposedRange->setEnabled( false );
+ RBFieldRange->setEnabled( false );
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ }
+
+ if ( RBFieldRange->isChecked() ) {
+ MinEdit->setText( QString::number( thePrs->GetSourceMin() ) );
+ MaxEdit->setText( QString::number( thePrs->GetSourceMax() ) );
+ } else {
+ MinEdit->setText( QString::number( thePrs->GetMin() ) );
+ MaxEdit->setText( QString::number( thePrs->GetMax() ) );
+ }
+
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->GetWidth(),
SpacingSpin->setValue(thePrs->GetSpacing());
- bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
myRBLocal->setChecked( activeLocal );
myRBGlobal->setChecked( !activeLocal );
*/
int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
thePrs->SetScalarMode(myModeCombo->currentItem());
- thePrs->SetPosition(XSpin->value(), YSpin->value());
- thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
+
+ if (RBFieldRange->isChecked()) {
+ thePrs->SetSourceRange();
+ } else {
+ thePrs->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+ }
+
thePrs->SetSpacing(SpacingSpin->value());
- thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3d::VERTICAL : VISU::ColoredPrs3d::HORIZONTAL);
thePrs->SetIsActiveLocalScalarBar(myRBLocal->isChecked());
thePrs->SetIsDispGlobalScalarBar(myCBDisplayed->isChecked());
+ thePrs->SetBiColor(BicolorButton->isChecked());
+
+ thePrs->SetPosition(XSpin->value(), YSpin->value());
+ thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
+ thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3d::VERTICAL : VISU::ColoredPrs3d::HORIZONTAL);
thePrs->SetNbColors(ColorSpin->value());
thePrs->SetLabels(LabelSpin->value());
- thePrs->GetSpecificPL()->SetBicolor(BicolorButton->isChecked());
-
//if (isToSave()) storeToResources();
if (myIsStoreTextProp) {
myPrimitiveBox->setPrimitiveType( myPrsCopy->GetPrimitiveType() );
myPrimitiveBox->setClampMaximum( myPrsCopy->GetMaximumSupportedSize() );
myPrimitiveBox->setClamp( myPrsCopy->GetClamp() );
- myPrimitiveBox->setMainTexture( myPrsCopy->GetMainTexture() );
- myPrimitiveBox->setAlphaTexture( myPrsCopy->GetAlphaTexture() );
+ myPrimitiveBox->setMainTexture( myPrsCopy->GetQMainTexture() );
+ myPrimitiveBox->setAlphaTexture( myPrsCopy->GetQAlphaTexture() );
myPrimitiveBox->setAlphaThreshold( myPrsCopy->GetAlphaThreshold() );
myPrimitiveBox->setResolution( myPrsCopy->GetResolution() );
myPrimitiveBox->setFaceLimit( myPrsCopy->GetFaceLimit() );
mySizeBox->setMaxSize( myPrsCopy->GetMaxSize() );
mySizeBox->setMagnification( myPrsCopy->GetMagnification() );
mySizeBox->setIncrement( myPrsCopy->GetMagnificationIncrement() );
- mySizeBox->setColor( myPrsCopy->GetColor() );
+ mySizeBox->setColor( myPrsCopy->GetQColor() );
if( !theInit )
return;
myPrsCopy->SetIsDeformed( myDefShapeButton->isChecked() );
myPrsCopy->SetScaleFactor( myScaleSpinBox->value() );
- myPrsCopy->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
+ int aPrimitiveType = myPrimitiveBox->getPrimitiveType();
+ myPrsCopy->SetPrimitiveType( VISU::GaussPoints::PrimitiveType( aPrimitiveType ) );
myPrsCopy->SetClamp( myPrimitiveBox->getClamp() );
QString aMainTexture = myPrimitiveBox->getMainTexture();
QString anAlphaTexture = myPrimitiveBox->getAlphaTexture();
- aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetMainTexture() : aMainTexture;
- anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetAlphaTexture() : anAlphaTexture;
+ aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetQMainTexture() : aMainTexture;
+ anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetQAlphaTexture() : anAlphaTexture;
myPrsCopy->SetTextures( aMainTexture, anAlphaTexture );
else
{
myPrsCopy->SetIsColored( false );
- myPrsCopy->SetColor( mySizeBox->getColor() );
+ myPrsCopy->SetQColor( mySizeBox->getColor() );
myPrsCopy->SetGeomSize( mySizeBox->getGeomSize() );
}
myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
- VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
#define VISUGUI_GAUSSPOINTSDLS_H
#include "VisuGUI_Prs3dDlg.h"
+#include "VISU_GaussPoints_i.hh"
#include <qvbox.h>
class VisuGUI_TextPrefDlg;
class VisuGUI_InputPane;
-namespace VISU
-{
- class GaussPoints_i;
-}
//! Specific Scalar Bar tab.
/*! Uses for set up Gauss Points Scalar Bars preferenses. */
protected:
QButtonGroup* RangeGroup;
+ QRadioButton* RBFieldRange;
+ QRadioButton* RBImposedRange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+ SALOME::GenericObjPtr<VISU::GaussPoints_i> myPrsCopy;
QRadioButton* RBhori;
QRadioButton* RBvert;
bool myIsStoreTextProp;
private slots:
+ void onGlobalScalarBar();
+ void onLocalScalarBar();
+
+ void fieldRangeClicked();
+ void imposedRangeClicked();
+ void changeScalarMode( int );
+
void changeDefaults( int );
-//VSR: 08/06/06: void changeRange( int );
void XYChanged( double );
void onTextPref();
- void onSetDisplayGlobal();
};
//! Create Gauss Points Presentation Dialog.
}
}
+ connect( myTimeStamps, SIGNAL( activated( int ) ), this, SLOT( changeTimeStamp( int ) ) );
connect( myReInit, SIGNAL( toggled( bool ) ), SLOT( onReInitialize( bool ) ) );
+
connect( myUseGroupsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( onTypeChanged() ) );
connect( myAllGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
connect( mySelectedGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) );
}
+//---------------------------------------------------------------
+void VisuGUI_InputPane::changeTimeStamp( int theTimeStamp )
+{
+ myPrs->SetTimeStampNumber( myPrs->GetTimeStampNumberByIndex( theTimeStamp ) );
+ myPrs->Apply( true );
+ myDialog->initFromPrsObject( myPrs, false );
+}
+
+
//---------------------------------------------------------------
void VisuGUI_InputPane::onReInitialize( bool on )
{
VISU::GetSelectionMgr( myModule )->installFilter( myFieldFilter );
// type of presentation and groups
- VISU_Convertor* anInput = aResult->GetInput();
+ VISU::Result_i::PInput anInput = aResult->GetInput();
const VISU::TMeshMap& aMeshMap = anInput->GetMeshMap();
std::string aMeshName = thePrs->GetCMeshName();
VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(aMeshName);
public slots:
virtual void onSelectionChanged();
virtual void onReInitialize( bool );
+ virtual void changeTimeStamp( int );
private slots:
void onTypeChanged();
anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
- VISU::TSameAsFactory<VISU::TISOSURFACES>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TISOSURFACES>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
- VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
// Class: VisuGUI_Selection
//////////////////////////////////////////////////
+
+//---------------------------------------------------------------
QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
{
QtxValue val( LightApp_Selection::param( ind, p ) );
else if ( p == "isShading" ) val = QtxValue( isShading( ind ) );
else if ( p == "isScalarMapAct" ) val = QtxValue( isScalarMapAct( ind ) );
else if ( p == "isVisuComponent") val = QtxValue( isVisuComponent( ind ) );
+
+ else if ( p == "fullResolution" ) val = QtxValue( fullResolution( ind ) );
+ else if ( p == "mediumResolution" ) val = QtxValue( mediumResolution( ind ) );
+ else if ( p == "lowResolution" ) val = QtxValue( lowResolution( ind ) );
+ else if ( p == "resolutionState" ) val = QtxValue( resolutionState( ind ) );
}
return val;
}
+
+//---------------------------------------------------------------
// Macro for converting VISU enumeration items into corresponding strings
#define ENUM2STRING( x, y ) \
case y: \
return aResStr;
}
+
+//---------------------------------------------------------------
QString VisuGUI_Selection::nbComponents( const int ind ) const
{
QString aResStr;
return aResStr;
}
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolutions( const int ind ) const
+{
+ QString aResStr;
+ SalomeApp_Study* aStudy = GetStudy();
+ if ( !aStudy )
+ return aResStr;
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+ bool isExist;
+ QString aVal = VISU::Storable::FindValue(aMap,"myResolutions",&isExist);
+ if ( isExist )
+ aResStr = aVal;
+
+ return aResStr;
+}
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const
+{
+ QString aResStr;
+
+ QString aResolutions = resolutions( ind );
+ if(aResolutions.isEmpty())
+ return aResStr;
+
+ if(aResolutions.find(theResoltuion) != -1)
+ aResStr = "1";
+ else
+ aResStr = "0";
+
+ return aResStr;
+}
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::fullResolution( const int ind ) const
+{
+ return resolution( ind, 'F');
+}
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::mediumResolution( const int ind ) const
+{
+ return resolution( ind, 'M');
+}
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::lowResolution( const int ind ) const
+{
+ return resolution( ind, 'L');
+}
+
+
+//---------------------------------------------------------------
+QString VisuGUI_Selection::resolutionState( const int ind ) const
+{
+ QString aResStr;
+ SalomeApp_Study* aStudy = GetStudy();
+ if ( !aStudy )
+ return aResStr;
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+
+ bool isExist;
+ QString aVal = VISU::Storable::FindValue(aMap,"myState",&isExist);
+ if ( isExist ) {
+ if ( aVal.toInt() == VISU::Result::FULL )
+ aResStr = "F";
+ if ( aVal.toInt() == VISU::Result::MEDIUM )
+ aResStr = "M";
+ if ( aVal.toInt() == VISU::Result::LOW )
+ aResStr = "L";
+ if ( aVal.toInt() == VISU::Result::HIDDEN )
+ aResStr = "H";
+ }
+
+ return aResStr;
+}
+
+
+//---------------------------------------------------------------
QString VisuGUI_Selection::medEntity( const int ind ) const
{
SalomeApp_Study* aStudy = GetStudy();
}
};
+
+//---------------------------------------------------------------
QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
{
return TPopupDispatcher<TIsScalarMapActFunctor>()(myModule, entry(ind));
QString isScalarMapAct( const int ) const;
bool isVisuComponent( const int ) const;
+ QString fullResolution( const int ) const;
+ QString mediumResolution( const int ) const;
+ QString lowResolution( const int ) const;
+ QString resolutionState( const int ) const;
+
private:
int nbChild( const int, const bool ) const;
SalomeApp_Study* GetStudy() const;
+ QString resolutions( const int ) const;
+ QString resolution( const int, char theResoltuion ) const;
+
private:
SalomeApp_Module* myModule;
};
int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
- VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
if(myUpdateScalars)
SetScalarField( false );
- VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
QString aTime("");
VISU::TEntity anEntity = VISU::TEntity(theEntity);
VISU::Result_i* theResult = myPrsCopy->GetCResult();
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput();
VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(),
anEntity,
theFieldName);
// tr("ERR_CANT_BUILD_PRESENTATION"),
// tr("BUT_OK"));
- VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
} else
myPrsCopy->SetGlyphType(VISU::Vectors::NONE);
- VISU::TSameAsFactory<VISU::TVECTORS>().Copy(thePrs, myPrsCopy);
+ VISU::TSameAsFactory<VISU::TVECTORS>().Copy(myPrsCopy, thePrs);
return anIsOk;
}
VISUConfig.hh \
VISU_Gen_i.hh \
VISU_Result_i.hh \
+ VISU_MultiResult_i.hh \
VISU_PrsObject_i.hh \
VISU_Table_i.hh \
VISU_Prs3d_i.hh \
SALOME_GenericObjPointer.hh
libVISUEngineImpl_la_SOURCES = \
- VISU_Result_i.cc \
VISUConfig.cc \
+ VISU_Result_i.cc \
+ VISU_ResultUtils.cc \
+ VISU_MultiResult_i.cc \
+ VISU_Gen_i.cc \
+ VISU_CorbaMedConvertor.cxx \
VISU_PrsObject_i.cc \
VISU_Prs3d_i.cc \
+ VISU_Prs3dUtils.cc \
VISU_ColoredPrs3d_i.cc \
VISU_ScalarMap_i.cc \
VISU_GaussPoints_i.cc \
VISU_TimeAnimation.cxx \
VISU_View_i.cc \
VISU_Table_i.cc \
- VISU_Gen_i.cc \
- VISU_CorbaMedConvertor.cxx \
VISU_DumpPython.cc \
SALOME_GenericObjPointer.cc
$(MED_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(CORBA_CXXFLAGS) $(CORBA_INCLUDES) \
- -I$(srcdir)/../CONVERTOR -I$(srcdir)/../PIPELINE -I$(srcdir)/../OBJECT -I$(srcdir)/../VVTK -I$(srcdir)/../GUITOOLS \
+ -I$(srcdir)/../CONVERTOR \
+ -I$(srcdir)/../PIPELINE \
+ -I$(srcdir)/../OBJECT \
+ -I$(srcdir)/../VVTK \
+ -I$(srcdir)/../GUITOOLS \
-I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix
$(MED_LDFLAGS) \
../../idl/libSalomeIDLVISU.la
-libVISUEngineImpl_la_LIBADD= -lboost_signals@BOOST_LIBSUFFIX@ -lboost_thread@BOOST_LIBSUFFIX@ \
+libVISUEngineImpl_la_LIBADD= \
+ -lboost_signals@BOOST_LIBSUFFIX@ \
+ -lboost_thread@BOOST_LIBSUFFIX@ \
-lSalomeHDFPersist \
-lSalomeGenericObj \
-lSalomeContainer \
bin_PROGRAMS = VISU_I
dist_VISU_I_SOURCES=VISU_I.cxx
VISU_I_CPPFLAGS=$(libVISUEngineImpl_la_CPPFLAGS)
-VISU_I_LDADD=$(libVISUEngineImpl_la_LIBADD) $(libVISUEngineImpl_la_LDFLAGS) \
+VISU_I_LDADD=\
+ $(libVISUEngineImpl_la_LIBADD) \
+ $(libVISUEngineImpl_la_LDFLAGS) \
$(KERNEL_LDFLAGS) \
-lSALOMEBasics \
-lSalomeCatalog \
GenericObjPtr&
operator=(TGenericObj* thePointer)
{
- GenericObjPtr(thePointer).swap(*this);
+ GenericObjPtr aTmp(thePointer);
+ aTmp.swap(*this);
return *this;
}
GenericObjPtr&
operator=(const GenericObjPtr& thePointer)
{
- GenericObjPtr(thePointer).swap(*this);
+ GenericObjPtr aTmp(thePointer);
+ aTmp.swap(*this);
return *this;
}
};
}
+template<class T, class U>
+inline
+bool
+operator<(SALOME::GenericObjPtr<T> const & a, SALOME::GenericObjPtr<U> const & b)
+{
+ return a.get() < b.get();
+}
+
template<class T, class U>
inline
bool
#include "SALOMEDSClient_AttributeIOR.hxx"
#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "SALOME_Event.hxx"
+
#include <qregexp.h>
-using namespace std;
+#include <fstream>
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 0;
#endif
-namespace VISU{
+
+namespace VISU
+{
SUIT_Session*
GetSession()
return GetSession()->resourceMgr();
}
- //===========================================================================
+ //---------------------------------------------------------------------------
QMutex* Base_i::myMutex = NULL; //apo - &VISUMutex;
CORBA::ORB_var Base_i::myOrb;
return CORBA::string_dup(myID.c_str());
}
- //===========================================================================
+ //---------------------------------------------------------------------------
static int mySCnt = 0;
static QMutex aMutex(TRUE);
}
- //===========================================================================
- static Storable::TCallbackMap VisuStoreMap;
+ //---------------------------------------------------------------------------
+ Storable::TStorableEngineMap Storable::myStorableEngineMap;
std::string
Storable
}
+ //---------------------------------------------------------------
+ CORBA::Boolean
+ Storable
+ ::CanCopy(SALOMEDS::SObject_ptr theObject)
+ {
+ return false;
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ Storable
+ ::CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID,
+ const std::string& theTmpDir,
+ TFileNames& theFileNames)
+ {
+ TFileName aFileName("copy_persistent");
+ std::string aCopyPersist = theTmpDir + aFileName;
+ std::ofstream anOutputFileStream(aCopyPersist.c_str(), ios::out);
+ anOutputFileStream<<ToString()<<endl;
+
+ theFileNames.push_back(aFileName);
+ theObjectID = 1;
+
+ return true;
+ }
+
+
//---------------------------------------------------------------
void
Storable
- ::Registry(const std::string& theComment,
- TStorableEngine theEngine)
+ ::RegistryStorableEngine(const std::string& theComment,
+ TStorableEngine theEngine)
{
- if(!VisuStoreMap.insert(TCallbackMap::value_type(theComment,theEngine)).second){
- if(MYDEBUG) MESSAGE("Storable::Registry >> dupliacte registring !!!");
+ if(!myStorableEngineMap.insert(TStorableEngineMap::value_type(theComment, theEngine)).second)
throw std::logic_error("Storable::Registry >> dupliacte registring !!!");
+ }
+
+
+ //---------------------------------------------------------------
+ Storable*
+ Storable
+ ::Create(SALOMEDS::SObject_ptr theSObject,
+ const std::string& theLocalPersistentID,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
+ {
+ try{
+ QString aString( CorrectPersistentString( theLocalPersistentID ) );
+ TRestoringMap aRestoringMap;
+ StringToMap(aString, aRestoringMap);
+ bool anIsExists;
+ QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists);
+ if ( anIsExists ) {
+ TStorableEngineMap::const_iterator anIter = myStorableEngineMap.find(aComment.latin1());
+ if(MYDEBUG) MESSAGE("Storable::Create - "<<aComment.latin1()<<" "<<(anIter != myStorableEngineMap.end()));
+ if(anIter == myStorableEngineMap.end())
+ return NULL;
+ TStorableEngine aStorableEngine = anIter->second;
+ return aStorableEngine(theSObject, aRestoringMap, thePrefix, theIsMultiFile);
+ }
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!");
}
+ return NULL;
}
theStr<<output.latin1()<<";";
}
+
+ //---------------------------------------------------------------
void
Storable
::DataToStream(std::ostringstream& theStr,
const QString& theName,
- const int theVal)
+ int theVal)
{
QString output = ( !theName.isNull() ? theName : QString("") )
+ QString( "=" )
theStr<<output.latin1()<<";";
}
- void
+
+ //---------------------------------------------------------------
+ void
Storable
::DataToStream(std::ostringstream& theStr,
const QString& theName,
- const double theVal)
+ long theVal)
{
QString output = ( !theName.isNull() ? theName : QString("") )
+ QString( "=" )
theStr<<output.latin1()<<";";
}
- Storable*
+
+ //---------------------------------------------------------------
+ void
Storable
- ::Create(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const std::string& theLocalPersistentID)
+ ::DataToStream(std::ostringstream& theStr,
+ const QString& theName,
+ double theVal)
{
- try{
- QString aString( CorrectPersistentString( theLocalPersistentID ) );
- TRestoringMap aRestoringMap;
- StringToMap(aString, aRestoringMap);
- bool anIsExists;
- QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists);
- if ( anIsExists ) {
- TCallbackMap::const_iterator anIter = VisuStoreMap.find(aComment.latin1());
- if(MYDEBUG) MESSAGE("Storable::Create - "<<aComment.latin1()<<" "<<(anIter != VisuStoreMap.end()));
- if(anIter == VisuStoreMap.end())
- return NULL;
- TStorableEngine aStorableEngine = anIter->second;
- return aStorableEngine(theSObject, thePrefix, aRestoringMap);
- }
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!");
- }
- return NULL;
+ QString output = ( !theName.isNull() ? theName : QString("") )
+ + QString( "=" )
+ + QString::number( theVal );
+ theStr<<output.latin1()<<";";
}
+
+ //---------------------------------------------------------------
QString
Storable
::FindValue(const TRestoringMap& theMap,
}
+ //---------------------------------------------------------------
QString
Storable
::FindValue(const TRestoringMap& theMap,
}
- //===========================================================================
+ //---------------------------------------------------------------------------
PortableServer::ServantBase_var
GetServant(CORBA::Object_ptr theObject)
{
- if(CORBA::is_nil(theObject)) return NULL;
+ if(CORBA::is_nil(theObject))
+ return NULL;
try{
PortableServer::POA_ptr aPOA = Base_i::GetPOA();
PortableServer::Servant aServant = aPOA->reference_to_servant(theObject);
}
- //===========================================================================
+ //---------------------------------------------------------------------------
CORBA::Object_var
SObjectToObject(SALOMEDS::SObject_ptr theSObject)
{
return anObject;
}
- //===========================================================================
+ //---------------------------------------------------------------------------
CORBA::Object_var
ClientSObjectToObject(_PTR(SObject) theSObject)
{
}
- //===========================================================================
- //===========================================================================
+ //---------------------------------------------------------------------------
std::string
CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
const std::string& theFatherEntry,
else
aNewSObject = aFather;
SALOMEDS::GenericAttribute_var anAttr;
- if(theIOR != ""){
+ if(theIOR != NO_IOR){
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeIOR");
SALOMEDS::AttributeIOR_var aCustomAttr = SALOMEDS::AttributeIOR::_narrow(anAttr);
aCustomAttr->SetValue(theIOR.c_str());
}
- if(theName != ""){
+ if(theName != NO_NAME){
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeName");
SALOMEDS::AttributeName_var aCustomAttr = SALOMEDS::AttributeName::_narrow(anAttr);
aCustomAttr->SetValue(theName.c_str());
}
- if(thePersistentRef != ""){
+ if(thePersistentRef != NO_PERFSITENT_REF){
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributePersistentRef");
SALOMEDS::AttributePersistentRef_var aCustomAttr = SALOMEDS::AttributePersistentRef::_narrow(anAttr);
aCustomAttr->SetValue(thePersistentRef.c_str());
}
- if(theComment != ""){
+ if(theComment != NO_COMMENT){
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeString");
SALOMEDS::AttributeString_var aCustomAttr = SALOMEDS::AttributeString::_narrow(anAttr);
aCustomAttr->SetValue(theComment.c_str());
}
- if(theIconName != ""){
+ if(theIconName != NO_ICON){
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributePixMap");
SALOMEDS::AttributePixMap_var aCustomAttr = SALOMEDS::AttributePixMap::_narrow(anAttr);
aCustomAttr->SetPixMap(theIconName.c_str());
aNewSObject = aFather;
_PTR(GenericAttribute) anAttr;
- if (theIOR != "") {
+ if (theIOR != NO_IOR) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeIOR");
_PTR(AttributeIOR) aCustomAttr (anAttr);
aCustomAttr->SetValue(theIOR);
}
- if (theName != "") {
+ if (theName != NO_NAME) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeName");
_PTR(AttributeName) aCustomAttr (anAttr);
aCustomAttr->SetValue(theName);
}
- if (thePersistentRef != "") {
+ if (thePersistentRef != NO_PERFSITENT_REF) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributePersistentRef");
_PTR(AttributePersistentRef) aCustomAttr (anAttr);
aCustomAttr->SetValue(thePersistentRef);
}
- if (theComment != "") {
+ if (theComment != NO_COMMENT) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributeString");
_PTR(AttributeString) aCustomAttr (anAttr);
aCustomAttr->SetValue(theComment);
}
- if (theIconName != "") {
+ if (theIconName != NO_ICON) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSObject, "AttributePixMap");
_PTR(AttributePixMap) aCustomAttr (anAttr);
aCustomAttr->SetPixMap(theIconName);
return aRet;
}
+
+ //---------------------------------------------------------------
QString
- GenerateName(const string& theFmt, int theId)
+ GenerateName(const std::string& theFmt, int theId)
{
- static QString aName;
+ QString aName;
if(theId > 0)
- aName.sprintf("%s:%d",theFmt.c_str(),theId);
+ aName.sprintf("%s:%d", theFmt.c_str(), theId);
else
- aName.sprintf("%s",theFmt.c_str());
+ aName.sprintf("%s", theFmt.c_str());
return aName;
}
+ //---------------------------------------------------------------
SALOMEDS::StudyManager_var
GetStudyManager()
{
}
+ //---------------------------------------------------------------
SALOMEDS::Study_var
GetDSStudy(_PTR(Study) theStudy)
{
- //std::string aStudyName = theStudy->Name();
- //return GetStudyManager()->GetStudyByName(aStudyName.c_str());
int aStudyID = theStudy->StudyId();
return GetStudyManager()->GetStudyByID(aStudyID);
}
+
+ //---------------------------------------------------------------
+ struct TGetStudyEvent: public SALOME_Event
+ {
+ SALOMEDS::Study_var myStudy;
+
+ typedef SalomeApp_Study* TResult;
+ TResult myResult;
+
+ TGetStudyEvent(SALOMEDS::Study_ptr theStudy):
+ myStudy(SALOMEDS::Study::_duplicate(theStudy)),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if(CORBA::is_nil(myStudy))
+ return;
+
+ int aStudyId = myStudy->StudyId();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* anApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyId == aCStudy->StudyId()) {
+ myResult = aStudy;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ SalomeApp_Study*
+ GetGUIStudy(SALOMEDS::Study_ptr theStudy)
+ {
+ return ProcessEvent(new TGetStudyEvent(theStudy));
+ }
+
+
+ //---------------------------------------------------------------
+ _PTR(Study)
+ GetStudy(SALOMEDS::Study_ptr theStudy)
+ {
+ if(SalomeApp_Study* aStudy = ProcessEvent(new TGetStudyEvent(theStudy)))
+ return aStudy->studyDS();
+
+ return _PTR(Study)();
+ }
+
+
+ //---------------------------------------------------------------
SALOMEDS::SObject_var
GetSObject( _PTR(SObject) obj )
{
return aSalomeDSStudy->FindObjectID( id.c_str() );
}
+ //---------------------------------------------------------------
_PTR(SObject)
- GetClientSObject( SALOMEDS::SObject_var obj,
- _PTR(Study) study )
+ GetClientSObject(SALOMEDS::SObject_ptr theSObject,
+ _PTR(Study) theStudy)
{
- return study->FindObjectID( obj->GetID() );
-
+ CORBA::String_var anEntry = theSObject->GetID();
+ return theStudy->FindObjectID( anEntry.in() );
}
+ //---------------------------------------------------------------
void
RemoveFromStudy (SALOMEDS::SObject_ptr theSObject,
bool theIsAttrOnly,
aStudyBuilder->RemoveObjectWithChildren(theSObject);
}
+
+ //---------------------------------------------------------------
void
RemoveFromStudy (_PTR(SObject) theSObject,
bool theIsAttrOnly,
class SUIT_Session;
class SUIT_ResourceMgr;
+class SalomeApp_Study;
+
namespace VISU
{
//===========================================================================
class VISU_I_EXPORT Storable : public virtual Base_i
{
- protected:
- virtual void ToStream(std::ostringstream& theStr) = 0;
public:
std::string
ToString();
const char*
GetComment() const = 0;
+
+ //---------------------------------------------------------------
typedef std::map<std::string, QString> TRestoringMap;
typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
+ const TRestoringMap& theMap,
const std::string& thePrefix,
- const TRestoringMap& theMap);
- typedef std::map<std::string,TStorableEngine> TCallbackMap;
+ CORBA::Boolean theIsMultiFile);
+
+ typedef std::map<std::string, TStorableEngine> TStorableEngineMap;
+
+ static
+ void
+ RegistryStorableEngine(const std::string& theComment,
+ TStorableEngine theEngine);
+
+ static
+ Storable*
+ Create(SALOMEDS::SObject_ptr theSObject,
+ const std::string& theLocalPersistentID,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
+
+ //---------------------------------------------------------------
static
VISU::VISUType
Comment2Type(const std::string& theComment);
const TRestoringMap& theRestoringMap,
int IsAllLevels = true);
- static
- void
- Registry(const std::string& theComment,
- TStorableEngine theEngine);
-
- static
- Storable*
- Create(SALOMEDS::SObject_ptr,
- const std::string& thePrefix,
- const std::string& theString);
-
static
QString
FindValue(const TRestoringMap& theMap,
void
DataToStream(std::ostringstream& theStr,
const QString& theName,
- const int theVal);
+ int theVal);
+
+ static
+ void
+ DataToStream(std::ostringstream& theStr,
+ const QString& theName,
+ long theVal);
static
void
DataToStream(std::ostringstream& theStr,
const QString& theName,
- const double theVal);
+ double theVal);
+
+ //---------------------------------------------------------------
+ virtual
+ CORBA::Boolean
+ CanCopy(SALOMEDS::SObject_ptr theObject);
+
+ typedef std::string TFileName;
+ typedef std::vector<TFileName> TFileNames;
+
+ virtual
+ bool
+ CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID,
+ const std::string& theTmpDir,
+ TFileNames& theFileNames);
+
+
+ //---------------------------------------------------------------
+ protected:
+ virtual
+ void
+ ToStream(std::ostringstream& theStr) = 0;
+
+ private:
+ static TStorableEngineMap myStorableEngineMap;
};
//===========================================================================
- VISU_I_EXPORT
- const CORBA::Boolean
- IsMultifile();
-
VISU_I_EXPORT
QString
GenerateName(const std::string& theFmt, int theId);
SALOMEDS::SComponent_var
FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
+ const char* const NO_ICON = "";
+ const char* const NO_IOR = "";
+ const char* const NO_NAME = "";
+ const char* const NO_PERFSITENT_REF = "";
+ const char* const NO_COMMENT = "";
+
VISU_I_EXPORT
std::string
CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
VISU_I_EXPORT
_PTR(SObject)
- GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
+ GetClientSObject(SALOMEDS::SObject_ptr theSObject,
+ _PTR(Study) theStudy);
VISU_I_EXPORT
SALOMEDS::Study_var
- GetDSStudy(_PTR(Study));
+ GetDSStudy(_PTR(Study) theStudy);
+
+ VISU_I_EXPORT
+ SalomeApp_Study*
+ GetGUIStudy(SALOMEDS::Study_ptr theStudy);
+
+ VISU_I_EXPORT
+ _PTR(Study)
+ GetStudy(SALOMEDS::Study_ptr theStudy);
VISU_I_EXPORT
void
}
myMemoryMode = theMode;
+ GetStudyDocument()->Modified();
}
VISU::ColoredPrs3dCache::MemoryMode
ClearCache(theMemorySize);
myLimitedMemory = theMemorySize;
+ GetStudyDocument()->Modified();
}
CORBA::Float
VISU::Storable*
VISU::ColoredPrs3dCache_i
::Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
- const string& thePrefix)
+ const Storable::TRestoringMap& theMap)
{
SetMemoryMode( (VISU::ColoredPrs3dCache::MemoryMode)VISU::Storable::FindValue( theMap, "myMemoryMode" ).toInt() );
SetLimitedMemory( VISU::Storable::FindValue( theMap, "myLimitedMemory" ).toInt() );
-
+
return this;
}
//---------------------------------------------------------------
VISU::Storable*
VISU::ColoredPrs3dCache_i
-::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
- const Storable::TRestoringMap& theMap)
+::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
VISU::ColoredPrs3dCache_i* aCache = new VISU::ColoredPrs3dCache_i(aStudy, false);
- return aCache->Restore(theSObject,theMap,thePrefix);
+ return aCache->Restore(theSObject, theMap);
}
virtual
Storable*
Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
- const std::string& thePrefix);
+ const Storable::TRestoringMap& theMap);
static
Storable*
- Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
//----------------------------------------------------------------------------
//! Finds or creates instance of the ColoredPrs3dCache in the given SALOMEDS::Study
#include CORBA_SERVER_HEADER(SALOMEDS)
#include "VISU_I.hxx"
+#include "SALOME_GenericObjPointer.hh"
#include "VISU_ScalarMapOnDeformedShape_i.hh"
#include "VISU_Plot3D_i.hh"
#include "VISU_GaussPoints_i.hh"
typedef typename TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
void
- Copy(ColoredPrs3d_i* theColoredPrs3dTo, ColoredPrs3d_i* theColoredPrs3dFrom)
+ Copy(ColoredPrs3d_i* theColoredPrs3dFrom, ColoredPrs3d_i* theColoredPrs3dTo)
{
theColoredPrs3dTo->SetCResult(theColoredPrs3dFrom->GetCResult());
theColoredPrs3dTo->SetMeshName(theColoredPrs3dFrom->GetCMeshName().c_str());
theColoredPrs3dTo->SameAs(theColoredPrs3dFrom);
}
- TColoredPrs3d*
+ SALOME::GenericObjPtr<TColoredPrs3d>
Create(ColoredPrs3d_i* theColoredPrs3d,
ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
{
- TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode);
- Copy(aSameColoredPrs3d, theColoredPrs3d);
+ SALOME::GenericObjPtr<TColoredPrs3d> aSameColoredPrs3d(new TColoredPrs3d(thePublishInStudyMode));
+ Copy(theColoredPrs3d, aSameColoredPrs3d);
+ aSameColoredPrs3d->Destroy();
return aSameColoredPrs3d;
}
};
VISU::ColoredPrs3dHolder_i
::GetPrs3dDevice()
{
- return myCache.GetLastVisitedPrs(this);
+ try{
+ return myCache.GetLastVisitedPrs(this);
+ }catch(...){}
+
+ return NULL;
}
VISU::ColoredPrs3dHolder_i
::GetDevice()
{
- return GetPrs3dDevice()->_this();
+ if( VISU::ColoredPrs3d_i* aDevice = GetPrs3dDevice() )
+ return aDevice->_this();
+
+ return VISU::ColoredPrs3d::_nil();
}
//---------------------------------------------------------------
VISU::Storable*
VISU::ColoredPrs3dHolder_i
-::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
- const Storable::TRestoringMap& theMap)
+::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
using namespace VISU;
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
static
Storable*
- Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
virtual
QString
// Module : VISU
#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_ColoredPL.hxx"
ProcessVoidEvent(new TRemoveFromStudy(this));
}
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::UpdateFromResult(Result_i* theResult)
+{
+ try{
+ if(theResult == GetCResult()){
+ DoSetInput(false, false);
+ UpdateActors();
+ }
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ }
+}
+
+
//---------------------------------------------------------------
bool
VISU::ColoredPrs3d_i
try{
DoSetInput(anIsCreatNew, theReInit);
+
+ if(anIsCreatNew)
+ GetSpecificPL()->Init();
+
+ // To update scalar range according to the new input
+ if(!IsRangeFixed() || theReInit)
+ SetSourceRange();
+
+ GetCResult()->ConnectObserver(this, myResultConnection);
+
myPreviousEntity = myEntity;
myPreviousFieldName = myFieldName;
myPreviousTimeStampNumber = myTimeStampNumber;
VISU::ColoredPrs3d_i
::SetEntity(VISU::Entity theEntity)
{
- if(myEntity != theEntity){
- myEntity = theEntity;
- myParamsTime.Modified();
- }
+ if(myEntity == theEntity)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myEntity = theEntity;
+ myParamsTime.Modified();
}
VISU::ColoredPrs3d_i
::SetFieldName(const char* theFieldName)
{
- if(myFieldName != theFieldName){
- myFieldName = theFieldName;
- myParamsTime.Modified();
- }
+ if(myFieldName == theFieldName)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myFieldName = theFieldName;
+ myParamsTime.Modified();
}
VISU::ColoredPrs3d_i
::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
{
- if(myTimeStampNumber != theTimeStampNumber){
- myTimeStampNumber = theTimeStampNumber;
- myParamsTime.Modified();
- }
+ if(myTimeStampNumber == theTimeStampNumber)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myTimeStampNumber = theTimeStampNumber;
+ myParamsTime.Modified();
}
SetNbColors(anOrigin->GetNbColors());
SetBarOrientation(anOrigin->GetBarOrientation());
+ // "SetRange" function changes "myIsFixedRange" attribute,
+ // so, it is necessary pay a special attention if "this" equal to "theOrigin"
+ if(anOrigin->IsRangeFixed())
+ SetRange(anOrigin->GetMin(), anOrigin->GetMax());
+ else
+ SetSourceRange();
+
SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
SetLabels(anOrigin->GetLabels());
anOrigin->GetLabelColor(&r,&g,&b);
SetLabelColor(r,g,b);
- UseFixedRange( anOrigin->IsRangeFixed() );
myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
SetHolderEntry( anOrigin->GetHolderEntry() );
return myColoredPL->GetScalarMode();
}
+
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
else if(theScalarMode > aNbComp)
theScalarMode = 0;
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
(GetSpecificPL(), &VISU_ColoredPL::SetScalarMode, theScalarMode));
}
VISU::ColoredPrs3d_i
::SetRange(CORBA::Double theMin, CORBA::Double theMax)
{
+ VISU::TSetModified aModified(this);
+
vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
(GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
VISU::ColoredPrs3d_i
::SetSourceRange()
{
+ VISU::TSetModified aModified(this);
+
if(IsTimeStampFixed()){
GetSpecificPL()->SetSourceRange();
ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
VISU::ColoredPrs3d_i
::SetNbColors(CORBA::Long theNbColors)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
(GetSpecificPL(), &VISU_ColoredPL::SetNbColors, theNbColors));
}
VISU::ColoredPrs3d_i
::SetBarOrientation(VISU::ColoredPrs3d::Orientation theOrientation)
{
- if(myOrientation != theOrientation){
- myOrientation = theOrientation;
- myParamsTime.Modified();
- }
+ if(myOrientation == theOrientation)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myOrientation = theOrientation;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
if(anIsSameValue)
return;
+ VISU::TSetModified aModified(this);
+
myPosition[0] = theX;
myPosition[1] = theY;
myParamsTime.Modified();
if(anIsSameValue)
return;
+ VISU::TSetModified aModified(this);
+
myWidth = theWidth;
myHeight = theHeight;
myParamsTime.Modified();
VISU::ColoredPrs3d_i
::SetLabels(CORBA::Long theNbLabels)
{
- if(myNumberOfLabels != theNbLabels){
- myNumberOfLabels = theNbLabels;
- myParamsTime.Modified();
- }
+ if(myNumberOfLabels == theNbLabels)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myNumberOfLabels = theNbLabels;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
aStream<<theTitle<<" "<<VISU_Convertor::GenerateName(aTime)<<std::ends;
std::string aScalarBarTitle = aStream.str();
if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
+ VISU::TSetModified aModified(this);
+
myScalarBarTitle = aScalarBarTitle;
myTitle = theTitle;
myParamsTime.Modified();
VISU::ColoredPrs3d_i
::SetBoldTitle(bool theIsBoldTitle)
{
- if(myIsBoldTitle != theIsBoldTitle){
- myIsBoldTitle = theIsBoldTitle;
- myParamsTime.Modified();
- }
+ if(myIsBoldTitle == theIsBoldTitle)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsBoldTitle = theIsBoldTitle;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetItalicTitle(bool theIsItalicTitle)
{
- if(myIsItalicTitle != theIsItalicTitle){
- myIsItalicTitle = theIsItalicTitle;
- myParamsTime.Modified();
- }
+ if(myIsItalicTitle == theIsItalicTitle)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsItalicTitle = theIsItalicTitle;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetShadowTitle(bool theIsShadowTitle)
{
- if(myIsShadowTitle != theIsShadowTitle){
- myIsShadowTitle = theIsShadowTitle;
- myParamsTime.Modified();
- }
+ if(myIsShadowTitle == theIsShadowTitle)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsShadowTitle = theIsShadowTitle;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetTitFontType(int theTitFontType)
{
- if(myTitFontType != theTitFontType){
- myTitFontType = theTitFontType;
- myParamsTime.Modified();
- }
+ if(myTitFontType == theTitFontType)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myTitFontType = theTitFontType;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
if(anIsSameValue)
return;
+ VISU::TSetModified aModified(this);
+
myTitleColor[0] = theR;
myTitleColor[1] = theG;
myTitleColor[2] = theB;
VISU::ColoredPrs3d_i
::SetBoldLabel(bool theIsBoldLabel)
{
- if(myIsBoldLabel != theIsBoldLabel){
- myIsBoldLabel = theIsBoldLabel;
- myParamsTime.Modified();
- }
+ if(myIsBoldLabel == theIsBoldLabel)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsBoldLabel = theIsBoldLabel;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetItalicLabel(bool theIsItalicLabel)
{
- if(myIsItalicLabel != theIsItalicLabel){
- myIsItalicLabel = theIsItalicLabel;
- myParamsTime.Modified();
- }
+ if(myIsItalicLabel == theIsItalicLabel)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsItalicLabel = theIsItalicLabel;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetShadowLabel(bool theIsShadowLabel)
{
- if(myIsShadowLabel != theIsShadowLabel){
- myIsShadowLabel = theIsShadowLabel;
- myParamsTime.Modified();
- }
+ if(myIsShadowLabel == theIsShadowLabel)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsShadowLabel = theIsShadowLabel;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::SetLblFontType(int theLblFontType)
{
- if(myIsShadowLabel != theLblFontType){
- myLblFontType = theLblFontType;
- myParamsTime.Modified();
- }
+ if(myLblFontType == theLblFontType)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myLblFontType = theLblFontType;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
if(anIsSameValue)
return;
+ VISU::TSetModified aModified(this);
+
myLabelColor[0] = theR;
myLabelColor[1] = theG;
myLabelColor[2] = theB;
int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
SetScalarMode(aScalarMode);
+ // Scalar Range
+ int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+ if(aRangeType == 1){
+ float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
+ float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
+ SetRange(aMin, aMax);
+ }
+ UseFixedRange(aRangeType == 1);
+
int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
SetNbColors(aNumberOfColors);
Build(ERestore);
SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
+ float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
+ float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
+ SetRange(aMin, aMax);
+
+ UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
+
SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
SetBarOrientation((VISU::ColoredPrs3d::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) );
+ Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
+ Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
+ Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
+
Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
Storable::DataToStream( theStr, "myOrientation", myOrientation );
#define VISU_ColoredPrs3d_i_HeaderFile
#include "VISU_Prs3d_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_BoostSignals.h"
class VISU_ColoredPL;
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
+ public virtual TResultObserver,
public virtual Prs3d_i
{
ColoredPrs3d_i(const ColoredPrs3d_i&);
void
RemoveFromStudy();
+ //----------------------------------------------------------------------------
+ //! To update the presentation from result in automatic way
+ virtual
+ void
+ UpdateFromResult(Result_i* theResult);
+
//----------------------------------------------------------------------------
virtual
void
CORBA::Long myTimeStampNumber;
CORBA::Long myPreviousTimeStampNumber;
+ boost::signalslib::connection myResultConnection;
+
bool myIsTimeStampFixed;
PField myField;
//----------------------------------------------------------------------------
template<class TColoredPrs3d>
Storable*
- Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap)
+ StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
return aColoredPrs3d->Restore(theSObject, theMap);
// Module : VISU
#include "VISU_CutLines_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
}
};
- ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
+ VISU::TSetModified aModified(this);
+ ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
}
//---------------------------------------------------------------
}
};
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
}
VISU::CutLines_i
::SetDisplacement(CORBA::Double theDisp)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, vtkFloatingPointType, int>
(GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 0));
}
VISU::CutLines_i
::SetDisplacement2(CORBA::Double theDisp)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, vtkFloatingPointType, int>
(GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 1));
}
VISU::CutLines_i
::SetBasePlanePosition(CORBA::Double thePlanePosition)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, vtkFloatingPointType>
(GetSpecificPL(), &VISU_CutLinesPL::SetPosition, thePlanePosition));
}
::SetLinePosition(CORBA::Long thePlaneNumber,
CORBA::Double thePlanePosition)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, int, vtkFloatingPointType>
(GetSpecificPL(), &VISU_CutLinesPL::SetPartPosition, thePlaneNumber, thePlanePosition));
}
VISU::CutLines_i
::SetDefault()
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFunEvent<VISU_CutLinesPL>
(GetSpecificPL(), &VISU_CutLinesPL::SetDefault));
}
VISU::CutLines_i
::SetDefaultPosition(CORBA::Long thePlaneNumber)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
(GetSpecificPL(), &VISU_CutLinesPL::SetPartDefault, thePlaneNumber));
}
if(myMapCurvesInverted[theCurveNumber] == theInvert)
return;
+ VISU::TSetModified aModified(this);
+
myMapCurvesInverted[theCurveNumber] = theInvert;
myParamsTime.Modified();
}
if(myUseAbsLength == theAbsLength)
return;
+ VISU::TSetModified aModified(this);
+
myUseAbsLength = theAbsLength;
myParamsTime.Modified();
}
VISU::CutLines_i
::SetNbLines(CORBA::Long theNb)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
(GetSpecificPL(), &VISU_CutLinesPL::SetNbParts, theNb));
}
// Module : VISU
#include "VISU_CutPlanesPL.hxx"
-#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_CutPlanes_i.hh"
+
+#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
#include "SUIT_ResourceMgr.h"
}
};
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TEvent(GetSpecificPL(),
VISU_CutPlanesPL::PlaneOrientation(theOrient),
theXAngle,
VISU::CutPlanes_i
::SetDisplacement(CORBA::Double theDisp)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutPlanesPL, vtkFloatingPointType, int>
(GetSpecificPL(), &VISU_CutPlanesPL::SetDisplacement, theDisp, 0));
}
::SetPlanePosition(CORBA::Long thePlaneNumber,
CORBA::Double thePlanePosition)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutPlanesPL, int, vtkFloatingPointType>
(GetSpecificPL(), &VISU_CutPlanesPL::SetPartPosition, thePlaneNumber, thePlanePosition));
}
VISU::CutPlanes_i
::SetDefault(CORBA::Long thePlaneNumber)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutPlanesPL, int>
(GetSpecificPL(), &VISU_CutPlanesPL::SetPartDefault, thePlaneNumber));
}
VISU::CutPlanes_i
::SetNbPlanes(CORBA::Long theNb)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutPlanesPL, int>
(GetSpecificPL(), &VISU_CutPlanesPL::SetNbParts, theNb));
}
// Module : VISU
#include "VISU_DeformedShape_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_ScalarMapAct.h"
theTimeStampNumber,
theIsMemoryCheck);
if(aResult){
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
VISU::PField aField = anInput->GetField(theMeshName,
(VISU::TEntity)theEntity,
theFieldName);
VISU::DeformedShape_i
::SetScale(CORBA::Double theScale)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedShapePL, vtkFloatingPointType>
(GetSpecificPL(), &VISU_DeformedShapePL::SetScale, theScale));
}
if(anIsSameValue)
return;
+ VISU::TSetModified aModified(this);
+
myColor = theColor;
myParamsTime.Modified();
}
VISU::DeformedShape_i
::SetMapScale(double theMapScale)
{
+ VISU::TSetModified aModified(this);
+
myDeformedShapePL->SetMapScale(theMapScale);
}
namespace VISU
{
+ //---------------------------------------------------------------------------
static std::string PREFIX(" ");
- static std::string aResultName;
-
typedef std::map<std::string,std::string> TName2EntryMap;
typedef std::map<std::string,std::string> TEntry2NameMap;
+
+ //---------------------------------------------------------------------------
inline
std::string
GenerateName(std::string theName,
return theName;
}
- struct TReplacePredicate{
+
+ //---------------------------------------------------------------------------
+ struct TReplacePredicate
+ {
bool operator()(char theChar) const
{
return !(isdigit(theChar) || isalpha(theChar) || theChar == '_');
}
};
+
+ //---------------------------------------------------------------------------
inline
std::string
GetName(SALOMEDS::SObject_ptr theSObject)
return aName;
}
+
+ //---------------------------------------------------------------------------
inline
std::string
GenerateName(SALOMEDS::SObject_ptr theSObject,
{
std::string aName = GetName(theSObject);
- return GenerateName(aName,theSObject,theName2EntryMap,theEntry2NameMap,'X');
+ return GenerateName(aName, theSObject, theName2EntryMap, theEntry2NameMap, 'X');
+ }
+
+
+ //---------------------------------------------------------------------------
+ inline
+ std::string
+ GetBoolean(bool theArgument)
+ {
+ if(theArgument)
+ return "True";
+
+ return "False";
+ }
+
+
+ //---------------------------------------------------------------------------
+ inline
+ std::string
+ GetColor(const SALOMEDS::Color& theColor)
+ {
+ std::ostringstream aStream;
+ aStream<<"SALOMEDS.Color("<<theColor.R<<", "<<theColor.G<<", "<<theColor.B<<")";
+ return aStream.str();
}
theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
+ if(theServant->IsRangeFixed())
+ theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
+ else
+ theStr<<thePrefix<<theName<<".SetSourceRange()"<<endl;
+
return thePrefix;
}
+
+ //---------------------------------------------------------------------------
+ std::string
+ GaussPointsToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::GaussPoints_i* theServant,
+ std::ostream& theStr,
+ const std::string& theName,
+ TColoredPrs3dFactory& thePrsFactory,
+ std::string thePrefix)
+ {
+ thePrefix = ColoredPrs3dToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
+
+ bool aBoolean = theServant->GetIsActiveLocalScalarBar();
+ theStr<<thePrefix<<theName<<".SetIsActiveLocalScalarBar("<<GetBoolean(aBoolean)<<")"<<endl;
+
+ if(aBoolean){
+ aBoolean = theServant->GetIsDispGlobalScalarBar();
+ theStr<<thePrefix<<theName<<".SetIsDispGlobalScalarBar("<<GetBoolean(aBoolean)<<")"<<endl;
+ }
+
+ theStr<<thePrefix<<theName<<".SetSpacing("<<theServant->GetSpacing()<<")"<<endl;
+
+ aBoolean = theServant->GetBiColor();
+ theStr<<thePrefix<<theName<<".SetBiColor("<<GetBoolean(aBoolean)<<")"<<endl;
+
+ aBoolean = theServant->GetIsDeformed();
+ theStr<<thePrefix<<theName<<".SetIsDeformed("<<GetBoolean(aBoolean)<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetScaleFactor("<<theServant->GetScaleFactor()<<")"<<endl;
+
+ std::string aParam;
+ switch(theServant->GetPrimitiveType()){
+ case VISU::GaussPoints::SPRITE :
+ aParam = "VISU.GaussPoints.SPRITE";
+ break;
+ case VISU::GaussPoints::POINT :
+ aParam = "VISU.GaussPoints.POINT";
+ break;
+ case VISU::GaussPoints::SPHERE :
+ aParam = "VISU.GaussPoints.SPHERE";
+ break;
+ }
+ theStr<<thePrefix<<theName<<".SetPrimitiveType("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetClamp("<<theServant->GetClamp()<<")"<<endl;
+
+ QString aMainTexture = theServant->GetQMainTexture();
+ QString anAlphaTexture = theServant->GetQAlphaTexture();
+ theStr<<thePrefix<<theName<<".SetTextures('"<<aMainTexture.latin1()<<"', '"<<anAlphaTexture.latin1()<<"')"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetAlphaThreshold("<<theServant->GetAlphaThreshold()<<")"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetResolution("<<theServant->GetResolution()<<")"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetFaceLimit("<<theServant->GetFaceLimit()<<")"<<endl;
+
+ aBoolean = theServant->GetIsColored();
+ theStr<<thePrefix<<theName<<".SetIsColored("<<GetBoolean(aBoolean)<<")"<<endl;
+
+ if(aBoolean){
+ theStr<<thePrefix<<theName<<".SetMinSize("<<theServant->GetMinSize()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetMaxSize("<<theServant->GetMaxSize()<<")"<<endl;
+ }else{
+ theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetGeomSize("<<theServant->GetGeomSize()<<")"<<endl;
+ }
+
+ theStr<<thePrefix<<theName<<".SetMagnification("<<theServant->GetMagnification()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetMagnificationIncrement("<<theServant->GetMagnificationIncrement()<<")"<<endl;
+
+ return thePrefix;
+ }
+
+
//---------------------------------------------------------------------------
std::string
ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
std::string thePrefix)
{
thePrefix = ColoredPrs3dToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
std::string aParam;
switch(theServant->GetScaling()){
break;
}
theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
- theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
const VISU::ScalarMap_i::TGroupNames aGroupNames = theServant->GetGroupNames();
VISU::ScalarMap_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
+
theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
- theStr<<thePrefix<<theName<<".ShowColored("<<theServant->IsColored()<<")"<<endl;
- SALOMEDS::Color aColor = theServant->GetColor();
- theStr<<thePrefix<<theName<<".SetColor(SALOMEDS.Color("<<
- aColor.R<<", "<<aColor.G<<", "<<aColor.B<<"))"<<endl;
+ theStr<<thePrefix<<theName<<".ShowColored("<<GetBoolean(theServant->IsColored())<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetColor("<<GetColor(theServant->GetColor())<<")"<<endl;
return thePrefix;
}
std::string thePrefix)
{
thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
std::string aParam;
switch(theServant->GetDirection()){
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<", "<<theServant->GetMax()<<")"<<endl;
theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
std::string thePrefix)
{
thePrefix = DeformedShapeToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
theStr<<thePrefix<<theName<<".SetLineWidth("<<theServant->GetLineWidth()<<")"<<endl;
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
+
theStr<<thePrefix<<theName<<".SetNbSurfaces("<<theServant->GetNbSurfaces()<<")"<<endl;
return thePrefix;
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
std::string aParam;
switch(theServant->GetOrientationType()){
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
std::string aParam;
switch(theServant->GetOrientationType()){
std::string thePrefix)
{
thePrefix = ScalarMapToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix);
+ theStr<<thePrefix<<endl;
std::string aParam;
switch(theServant->GetOrientationType()){
<< aName << "_cTitles )" << endl;
if(theSObject->FindAttribute(anAttr,"AttributeIOR")){
- theStr<<endl;
+ theStr<<thePrefix<<endl;
std::string aName = "aTable";
theStr<<thePrefix<<"anID = "<<aSObjectName<<".GetID()"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
}
}
+
//---------------------------------------------------------------------------
void
if (!CORBA::is_nil(anObj)) {
VISU::Base_var aBase = VISU::Base::_narrow(anObj);
if(!CORBA::is_nil(aBase)){
- std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
+ std::string aName = GenerateName(theSObject, theName2EntryMap, theEntry2NameMap);
VISU::VISUType aType = aBase->GetType();
switch(aType){
case VISU::TRESULT:
if(Result_i* aServant = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- aResultName = aName;
- std::string aFileName = aServant->GetFileName();
+ std::string aFileName = aServant->GetInitFileName();
Result_i::ECreationId anId = aServant->GetCreationId();
if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){
switch(anId){
case Result_i::eImportFile:
- //theStr<<thePrefix<<aName<<" = aVisu.ImportFile('"<<aFileName<<"')"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateResult('"<<aFileName<<"')"<<endl;
theStr<<thePrefix<<aName<<".SetBuildGroups("<<
- aServant->IsGroupsDone()<<")"<<
+ GetBoolean(aServant->IsGroupsDone())<<")"<<
endl;
theStr<<thePrefix<<aName<<".SetBuildFields("<<
- aServant->IsFieldsDone()<<", "<<
- aServant->IsMinMaxDone()<<")"<<
+ GetBoolean(aServant->IsFieldsDone())<<", "<<
+ GetBoolean(aServant->IsMinMaxDone())<<")"<<
endl;
- theStr<<thePrefix<<aName<<".Build(0,1)"<<endl;
+ theStr<<thePrefix<<aName<<".Build(False, True)"<<endl;
theStr<<thePrefix<<"if "<<aName<<".IsDone() :"<<endl;
break;
}
thePrefix += PREFIX;
+ {
+ VISU::Result::EntityNames_var aMeshNames = aServant->GetMeshNames();
+ if (aMeshNames->length() > 0) {
+ for(size_t aMeshId = 0; aMeshId < aMeshNames->length(); aMeshId++){
+ CORBA::String_var aMeshName = aMeshNames[aMeshId];
+ VISU::Result::EntityNames_var aParts = aServant->GetPartNames(aMeshName);
+ if (aParts->length() > 0) {
+ for(size_t aPartId = 0; aPartId < aParts->length(); aPartId++){
+ CORBA::String_var aPart = aParts[aPartId];
+ VISU::Result::Resolution aResolution = aServant->GetResolution(aMeshName, aPart);
+ std::string aParam;
+ switch(aResolution){
+ case VISU::Result::FULL:
+ aParam = "VISU.Result.FULL";
+ break;
+ case VISU::Result::MEDIUM:
+ aParam = "VISU.Result.MEDIUM";
+ break;
+ case VISU::Result::LOW:
+ aParam = "VISU.Result.LOW";
+ break;
+ case VISU::Result::HIDDEN:
+ aParam = "VISU.Result.HIDDEN";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetResolution('"<<aMeshName.in()<<"', '"<<aPart.in()<<"', "<<aParam<<")"<<endl;
+ }
+ theStr<<thePrefix<<endl;
+ }
+ }
+ }
+ }
theArgumentName = aName;
DumpChildrenToPython(theStudy,
break;
}
theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
- theStr<<endl;
+ theStr<<thePrefix<<endl;
DumpChildrenToPython(theStudy,
theIsPublished,
case VISU::TGAUSSPOINTS:
if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(GetServant(anObj).in())){
TCreateFromResult aPrsFactory(theSObject, aServant, aName, "GaussPointsOnField", theArgumentName);
- thePrefix = ColoredPrs3dToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
+ thePrefix = GaussPointsToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix);
theStr<<thePrefix<<"pass"<<endl<<endl;
}
return;
// Set name (as this object could be renamed by user)
theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 2"<<endl;
- theStr<<endl;
+ theStr<<thePrefix<<endl;
theArgumentName = aName;
DumpChildrenToPython(theStudy,
// Set name (as this object could be renamed by user)
theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 3"<<endl;
- theStr<<endl;
+ theStr<<thePrefix<<endl;
theArgumentName = aName;
DumpChildrenToPython(theStudy,
}
}
return;
- case VISU::TCOLOREDPRS3DCACHE:
- theStr<<thePrefix<<"aCache = aVisu.GetColoredPrs3dCache(aVisu.GetCurrentStudy())"<<endl<<endl;
- SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject);
- for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
- SALOMEDS::SObject_var aSObject = aChildItet->Value();
- CORBA::Object_var anObject = SObjectToObject(aSObject);
- if (CORBA::is_nil(anObject))
- continue;
- if(ColoredPrs3dHolder_i* aServant = dynamic_cast<ColoredPrs3dHolder_i*>(GetServant(anObject).in())){
- ColoredPrs3dHolder::BasicInput_var anInput = aServant->GetBasicInput();
- std::string anEntity;
- switch(anInput->myEntity){
- case VISU::NODE : anEntity = "VISU.NODE"; break;
- case VISU::EDGE : anEntity = "VISU.EDGE"; break;
- case VISU::FACE : anEntity = "VISU.FACE"; break;
- case VISU::CELL : anEntity = "VISU.CELL"; break;
- }
-
- ColoredPrs3d_var aDevice = aServant->GetDevice();
- theStr<<thePrefix<<"anInput = VISU.ColoredPrs3dHolder.BasicInput("<<
- aResultName<<", '"<<
- anInput->myMeshName<<"', "<<
- anEntity<<", '"<<
- anInput->myFieldName<<"', "<<
- anInput->myTimeStampNumber<<")"<<
- endl;
-
- if(Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(aDevice).in())){
- std::string aComment = aPrs3d->GetComment();
- theStr<<thePrefix<<"aHolder = aCache.CreateHolder(VISU.T"<<aComment<<", anInput)"<<endl;
- theStr<<thePrefix<<"if aHolder != None:"<<endl;
- {
- std::string aPrefix = thePrefix + PREFIX;
- CORBA::String_var aNameInStudy = aSObject->GetName();
- theStr<<aPrefix<<"visu.SetName(aHolder, '"<<aNameInStudy.in()<<"')"<<endl;
- theStr<<aPrefix<<"aDevice = aHolder.GetDevice()"<<endl;
- TColoredPrs3dFactory aPrsFactory;
- switch(aPrs3d->GetType()){
- case VISU::TSCALARMAP:
- if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(aPrs3d)){
- aPrefix = ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TDEFORMEDSHAPE:
- if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(aPrs3d)){
- aPrefix = DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TSTREAMLINES:
- if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(aPrs3d)){
- aPrefix = StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TSCALARMAPONDEFORMEDSHAPE:
- if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aPrs3d)){
- aPrefix = ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TVECTORS:
- if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(aPrs3d)){
- aPrefix = VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TISOSURFACES:
- if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(aPrs3d)){
- aPrefix = IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TCUTPLANES:
- if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(aPrs3d)){
- aPrefix = CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TCUTLINES:
- if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(aPrs3d)){
- aPrefix = CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TPLOT3D:
- if (Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(aPrs3d)) {
- aPrefix = Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TGAUSSPOINTS:
- if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(aPrs3d)){
- aPrefix = ColoredPrs3dToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- }
- theStr<<aPrefix<<"pass"<<endl<<endl;
- }
- }
- }
- }
- return;
}
}
} else { /*if(!CORBA::is_nil(anObj))*/
continue;
if(aBase->GetType() == VISU::TCONTAINER){
- theStr<<endl;
+ theStr<<thePrefix<<endl;
std::string aName = GenerateName(aSObject,theName2EntryMap,theEntry2NameMap);
theStr<<thePrefix<<aName<<" = aVisu.CreateContainer()"<<endl;
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
}
}
+
+ //---------------------------------------------------------------------------
+ void
+ DumpPrs3dCacheToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+
+ SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator(theSObject);
+ for(anIter->InitEx(false); anIter->More(); anIter->Next()){
+ SALOMEDS::SObject_var aSObject = anIter->Value();
+ CORBA::Object_var anObj = SObjectToObject(aSObject);
+ if(CORBA::is_nil(anObj))
+ continue;
+
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(CORBA::is_nil(aBase))
+ continue;
+
+ if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE){
+ ColoredPrs3dCache_i* aCache = dynamic_cast<ColoredPrs3dCache_i*>(GetServant(aBase).in());
+ theStr<<thePrefix<<"aCache = aVisu.GetColoredPrs3dCache(aVisu.GetCurrentStudy())"<<endl;
+ theStr<<thePrefix<<"if aCache != None:"<<endl;
+ {
+ std::string aPrefix = thePrefix + PREFIX;
+ std::string anArgument;
+ VISU::ColoredPrs3dCache::MemoryMode aMode = aCache->GetMemoryMode();
+ switch(aMode){
+ case VISU::ColoredPrs3dCache::MINIMAL : anArgument = "VISU.ColoredPrs3dCache.MINIMAL"; break;
+ case VISU::ColoredPrs3dCache::LIMITED : anArgument = "VISU.ColoredPrs3dCache.LIMITED"; break;
+ }
+ theStr<<aPrefix<<"aCache.SetMemoryMode("<<anArgument<<")"<<endl;
+
+ if(aMode == VISU::ColoredPrs3dCache::LIMITED)
+ theStr<<aPrefix<<"aCache.SetLimitedMemory("<<aCache->GetLimitedMemory()<<") # (Mb)"<<endl;
+
+ SALOMEDS::ChildIterator_var aChildIter = theStudy->NewChildIterator(aSObject);
+ for(aChildIter->InitEx(false); aChildIter->More(); aChildIter->Next()){
+ SALOMEDS::SObject_var aSObject = aChildIter->Value();
+ CORBA::Object_var anObject = SObjectToObject(aSObject);
+ if (CORBA::is_nil(anObject))
+ continue;
+
+ ColoredPrs3dHolder_i* aServant = dynamic_cast<ColoredPrs3dHolder_i*>(GetServant(anObject).in());
+ if(!aServant)
+ continue;
+
+ ColoredPrs3d_i* aDevice = aServant->GetPrs3dDevice();
+ if(!aDevice)
+ continue;
+
+ Result_i* aResult = aDevice->GetCResult();
+ std::string aResultEntry = aResult->GetEntry();
+ std::string aResultName = theEntry2NameMap[aResultEntry];
+
+ ColoredPrs3dHolder::BasicInput_var anInput = aServant->GetBasicInput();
+ std::string anEntity;
+ switch(anInput->myEntity){
+ case VISU::NODE : anEntity = "VISU.NODE"; break;
+ case VISU::EDGE : anEntity = "VISU.EDGE"; break;
+ case VISU::FACE : anEntity = "VISU.FACE"; break;
+ case VISU::CELL : anEntity = "VISU.CELL"; break;
+ }
+
+
+ theStr<<aPrefix<<"anInput = VISU.ColoredPrs3dHolder.BasicInput("<<
+ aResultName<<", '"<<
+ anInput->myMeshName<<"', "<<
+ anEntity<<", '"<<
+ anInput->myFieldName<<"', "<<
+ anInput->myTimeStampNumber<<")"<<
+ endl;
+
+ std::string aComment = aDevice->GetComment();
+ theStr<<aPrefix<<"aHolder = aCache.CreateHolder(VISU.T"<<aComment<<", anInput)"<<endl;
+ theStr<<aPrefix<<"if aHolder != None:"<<endl;
+ {
+ std::string aPrefix2 = aPrefix + PREFIX;
+ CORBA::String_var aNameInStudy = aSObject->GetName();
+ theStr<<aPrefix2<<"visu.SetName(aHolder, '"<<aNameInStudy.in()<<"')"<<endl;
+ theStr<<aPrefix2<<"aDevice = aHolder.GetDevice()"<<endl;
+ theStr<<aPrefix2<<"if aDevice != None:"<<endl;
+ {
+ std::string aPrefix3 = aPrefix2 + PREFIX;
+ TColoredPrs3dFactory aPrsFactory;
+ switch(aDevice->GetType()){
+ case VISU::TSCALARMAP:
+ if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(aDevice)){
+ ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TDEFORMEDSHAPE:
+ if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(aDevice)){
+ DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TSTREAMLINES:
+ if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(aDevice)){
+ StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TSCALARMAPONDEFORMEDSHAPE:
+ if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aDevice)){
+ ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TVECTORS:
+ if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(aDevice)){
+ VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TISOSURFACES:
+ if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(aDevice)){
+ IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TCUTPLANES:
+ if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(aDevice)){
+ CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TCUTLINES:
+ if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(aDevice)){
+ CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TPLOT3D:
+ if(Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(aDevice)){
+ Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TGAUSSPOINTS:
+ if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(aDevice)){
+ GaussPointsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ }
+ theStr<<aPrefix3<<"pass"<<endl;
+ }
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ }
+ }
+ theStr<<aPrefix<<"pass"<<endl;
+ }
+ }
+ }
+ }
+
+
//---------------------------------------------------------------------------
void
DumpAnimationsToPython(SALOMEDS::Study_ptr theStudy,
if(!isExist || aTypeName != "ANIMATION") continue;
//ANIMATION
- theStr<<endl;
+ theStr<<thePrefix<<endl;
QString animName = aSObject->GetName();
theStr<<thePrefix<<"#Animation: "<<animName<<endl;
- theStr<<endl;
+ theStr<<thePrefix<<endl;
theStr<<thePrefix<<"animSO = aBuilder.NewObject(aSComponent)"<<endl;
theStr<<thePrefix<<"aBuilder.SetName(animSO, '"<<animName<<"')"<< endl;
theStr<<thePrefix<<"strAttr = aBuilder.FindOrCreateAttribute(animSO, 'AttributeString')"<< endl;
}
- theStr<<endl;
+ theStr<<thePrefix<<endl;
}
//---------------------------------------------------------------------------
aStr<<endl;
SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
- VISU::DumpChildrenToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
- VISU::DumpContainersToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
- VISU::DumpAnimationsToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aPrefix);
+ VISU::DumpChildrenToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpContainersToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpPrs3dCacheToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpAnimationsToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aPrefix);
//Output the script that sets up the visul parameters.
if(theIsPublished) {
#include "VISU_GaussPoints_i.hh"
#include "VISU_ScalarMap_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_GaussPtsAct.h"
#include <vtkTextProperty.h>
#include <vtkProperty.h>
-#ifdef ENABLE_MULTIPR
-#include "MULTIPR_API.hxx"
-#endif
-
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
return aResult;
try{
bool anIsEstimated = true;
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName,
- (VISU::TEntity)theEntity,
+ VISU::TEntity(theEntity),
theFieldName,
theTimeStampNumber,
anIsEstimated);
SetScaleFactor( aScaleFactor );
int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() );
- SetPrimitiveType( aPrimitiveType );
+ SetPrimitiveType( VISU::GaussPoints::PrimitiveType(aPrimitiveType) );
vtkFloatingPointType aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() );
SetClamp( aClamp );
bool isColored = aResourceMgr->booleanValue( "VISU", "point_sprite_results", GetIsColored() );
SetIsColored( isColored );
- QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetColor() );
- SetColor( aColor );
+ QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetQColor() );
+ SetQColor( aColor );
vtkFloatingPointType anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() );
SetAlphaThreshold( anAlphaThreshold );
if(const GaussPoints_i* aPrs3d = dynamic_cast<const GaussPoints_i*>(theOrigin)){
GaussPoints_i* anOrigin = const_cast<GaussPoints_i*>(aPrs3d);
- // To restore the range after shallow copy of the pipeline mapper
- // in the parent class
- SetSourceRange();
SetIsActiveLocalScalarBar(anOrigin->GetIsActiveLocalScalarBar());
SetIsDispGlobalScalarBar(anOrigin->GetIsDispGlobalScalarBar());
SetBiColor(Storable::FindValue(theMap,"myIsBiColor").toInt());
SetSpacing(Storable::FindValue(theMap,"mySpacing").toDouble());
- SetPrimitiveType(Storable::FindValue(theMap,"myPrimitiveType").toInt());
+ int aPrimitiveType = Storable::FindValue(theMap,"myPrimitiveType").toInt();
+ SetPrimitiveType(VISU::GaussPoints::PrimitiveType(aPrimitiveType));
SetClamp(Storable::FindValue(theMap,"myClamp").toDouble());
SetMinSize(Storable::FindValue(theMap,"myMinSize").toDouble());
SetMaxSize(Storable::FindValue(theMap,"myMaxSize").toDouble());
int aRed = Storable::FindValue(theMap,"myColor.R").toInt();
int aGreen = Storable::FindValue(theMap,"myColor.G").toInt();
int aBlue = Storable::FindValue(theMap,"myColor.B").toInt();
- SetColor( QColor(aRed,aGreen,aBlue) );
+ SetQColor( QColor(aRed, aGreen, aBlue) );
SetAlphaThreshold(Storable::FindValue(theMap,"myAlphaThreshold").toDouble());
Storable::DataToStream( theStr, "myFaceLimit", GetFaceLimit() );
Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
- QColor aColor = GetColor();
+ QColor aColor = GetQColor();
Storable::DataToStream( theStr, "myColor.R", aColor.red() );
Storable::DataToStream( theStr, "myColor.G", aColor.green() );
Storable::DataToStream( theStr, "myColor.B", aColor.blue() );
Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() );
- Storable::DataToStream( theStr, "myMainTexture", GetMainTexture() );
- Storable::DataToStream( theStr, "myAlphaTexture", GetAlphaTexture() );
+ Storable::DataToStream( theStr, "myMainTexture", GetQMainTexture() );
+ Storable::DataToStream( theStr, "myAlphaTexture", GetQAlphaTexture() );
Storable::DataToStream( theStr, "myResolution", GetResolution() );
}
//----------------------------------------------------------------------------
-int
+CORBA::Long
VISU::GaussPoints_i
::GetFaceLimit()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetFaceLimit( int theFaceLimit )
+::SetFaceLimit( CORBA::Long theFaceLimit )
{
- if( myFaceLimit != theFaceLimit ){
- myFaceLimit = theFaceLimit;
- myParamsTime.Modified();
- }
+ if( myFaceLimit == theFaceLimit )
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myFaceLimit = theFaceLimit;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetIsDeformed( bool theIsDeformed )
+::SetIsDeformed( CORBA::Boolean theIsDeformed )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetIsDeformed( theIsDeformed );
}
-bool
+CORBA::Boolean
VISU::GaussPoints_i
::GetIsDeformed()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetScaleFactor( vtkFloatingPointType theScaleFactor )
+::SetScaleFactor( CORBA::Double theScaleFactor )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetScale( theScaleFactor );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetScaleFactor()
{
//----------------------------------------------------------------------------
QColor
VISU::GaussPoints_i
-::GetColor()
+::GetQColor()
{
return myColor;
}
+SALOMEDS::Color
+VISU::GaussPoints_i
+::GetColor()
+{
+ SALOMEDS::Color aColor;
+ aColor.R = myColor.red();
+ aColor.G = myColor.green();
+ aColor.B = myColor.blue();
+ return aColor;
+}
+
+
+//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetColor( const QColor& theColor )
+::SetQColor( const QColor& theColor )
{
+ if(myColor == theColor)
+ return;
+
+ VISU::TSetModified aModified(this);
+
myColor = theColor;
myParamsTime.Modified();
}
+void
+VISU::GaussPoints_i
+::SetColor( const SALOMEDS::Color& theColor )
+{
+ SetQColor(QColor(int(theColor.R), int(theColor.G), int(theColor.B)));
+}
+
+
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
::SetIsColored( bool theIsColored )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetIsColored( theIsColored );
}
VISU::GaussPoints_i
::SetMainTexture( const QString& theMainTexture )
{
- bool update = myMainTexture != theMainTexture;
- myMainTexture = theMainTexture;
- return update;
+ if(myMainTexture != theMainTexture){
+ VISU::TSetModified aModified(this);
+
+ myMainTexture = theMainTexture;
+ myParamsTime.Modified();
+ return true;
+ }
+
+ return false;
}
-const QString&
+QString
VISU::GaussPoints_i
-::GetMainTexture()
+::GetQMainTexture()
{
return myMainTexture;
}
+char*
+VISU::GaussPoints_i
+::GetMainTexture()
+{
+ return CORBA::string_dup(myMainTexture.latin1());
+}
+
+
//----------------------------------------------------------------------------
bool
VISU::GaussPoints_i
::SetAlphaTexture( const QString& theAlphaTexture )
{
- bool update = myAlphaTexture != theAlphaTexture;
- myAlphaTexture = theAlphaTexture;
- return update;
+ if(myAlphaTexture != theAlphaTexture){
+ VISU::TSetModified aModified(this);
+
+ myAlphaTexture = theAlphaTexture;
+ myParamsTime.Modified();
+ return true;
+ }
+
+ return false;
}
-const QString&
+QString
VISU::GaussPoints_i
-::GetAlphaTexture()
+::GetQAlphaTexture()
{
return myAlphaTexture;
}
+char*
+VISU::GaussPoints_i
+::GetAlphaTexture()
+{
+ return CORBA::string_dup(myAlphaTexture.latin1());
+}
+
+
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetAlphaThreshold( vtkFloatingPointType theAlphaThreshold )
+::SetAlphaThreshold( CORBA::Double theAlphaThreshold )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetAlphaThreshold( theAlphaThreshold );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetAlphaThreshold()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetResolution( int theResolution )
+::SetResolution( CORBA::Long theResolution )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetResolution( theResolution );
}
-int
+CORBA::Long
VISU::GaussPoints_i
::GetResolution()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetPrimitiveType(int thePrimitiveType)
+::SetPrimitiveType(VISU::GaussPoints::PrimitiveType thePrimitiveType)
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetPrimitiveType( thePrimitiveType );
}
-int
+VISU::GaussPoints::PrimitiveType
VISU::GaussPoints_i
::GetPrimitiveType()
{
- return myGaussPointsPL->GetPrimitiveType();
+ int aPrimitiveType = myGaussPointsPL->GetPrimitiveType();
+
+ if(aPrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint)
+ return VISU::GaussPoints::POINT;
+
+ if(aPrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere)
+ return VISU::GaussPoints::SPHERE;
+
+ return VISU::GaussPoints::SPRITE;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetClamp(vtkFloatingPointType theClamp)
+::SetClamp(CORBA::Double theClamp)
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetClamp( theClamp );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetClamp()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetGeomSize( vtkFloatingPointType theGeomSize )
+::SetGeomSize( CORBA::Double theGeomSize )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetSize( theGeomSize );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetGeomSize()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetMinSize( vtkFloatingPointType theMinSize )
+::SetMinSize( CORBA::Double theMinSize )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetMinSize( theMinSize );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetMinSize()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetMaxSize( vtkFloatingPointType theMaxSize )
+::SetMaxSize( CORBA::Double theMaxSize )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetMaxSize( theMaxSize );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetMaxSize()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetMagnification( vtkFloatingPointType theMagnification )
+::SetMagnification( CORBA::Double theMagnification )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetMagnification( theMagnification );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetMagnification()
{
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetMagnificationIncrement( vtkFloatingPointType theIncrement )
+::SetMagnificationIncrement( CORBA::Double theIncrement )
{
+ VISU::TSetModified aModified(this);
+
myGaussPointsPL->SetMagnificationIncrement( theIncrement );
}
-vtkFloatingPointType
+CORBA::Double
VISU::GaussPoints_i
::GetMagnificationIncrement()
{
VISU::GaussPoints_i
::DoSetInput(bool theIsInitilizePipe, bool theReInit)
{
- static string aStrPrev = "";
- static VISU::Result_i::TInput* anInputPrev = NULL;
-
- // MULTIPR
- VISU::Result_i::TInput* anInput = NULL;
-#ifdef ENABLE_MULTIPR
- if (GetCResult()->IsDistributedMEDMultipr())
- {
- vector<string> aListMEDFiles = GetCResult()->GetCurrentRepresentationMultipr();
-
- string aStrCurrent = "";
- for (unsigned i = 0 ; i < aListMEDFiles.size() ; i++)
- {
- aStrCurrent +=aListMEDFiles[i];
- }
- aStrCurrent += GetCMeshName();
- aStrCurrent += GetCFieldName();
- if (aStrPrev != aStrCurrent)
- {
- if (anInputPrev != NULL) delete anInputPrev;
-
- char aTmpFilename[256];
- sprintf(aTmpFilename, "__tmp.med");
-
- int res = multipr::merge(aListMEDFiles, GetCMeshName().c_str(), GetCFieldName().c_str(), aTmpFilename);
- if (res == 0) throw std::runtime_error("empty mesh");
-
- anInput = CreateConvertor(aTmpFilename);
- anInput->Build();
- anInputPrev = anInput;
-
- aStrPrev = aStrCurrent;
- }
- else
- {
- anInput = anInputPrev;
- }
- }
- else
-#endif
- {
- anInput = GetCResult()->GetInput();
- }
-
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
+ GetEntity(),
+ GetCFieldName(),
+ GetTimeStampNumber());
if(!anInput)
throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
- SetField(anInput->GetField(GetCMeshName(),GetTEntity(),GetCFieldName()));
+ SetField(anInput->GetField(GetCMeshName(),
+ GetTEntity(),
+ GetCFieldName()));
if(!GetField())
throw std::runtime_error("There is no Field with the parameters !!!");
VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
- anInput->GetTimeStampOnGaussPts(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber());
-
+ anInput->GetTimeStampOnGaussPts(GetCMeshName(),
+ GetTEntity(),
+ GetCFieldName(),
+ GetTimeStampNumber());
if(!aGaussPtsIDMapper)
throw std::runtime_error("There is no TimeStamp with the parameters !!!");
GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper);
- if(theIsInitilizePipe){
- GetSpecificPL()->Init();
- }
- GetCResult()->MinMaxConnect(this);
-
- // To update scalar range according to the new input
- if(!IsTimeStampFixed() || theReInit)
- SetSourceRange();
}
anActor->SetBarVisibility(true);
GetPipeLine()->GetMapper()->SetScalarVisibility(1);
- vtkFloatingPointType aRange[2];
- GetSpecificPL()->GetSourceRange(aRange);
- aScalarBarCtrl->SetRangeLocal(aRange);
-
+ if(IsRangeFixed()){
+ vtkFloatingPointType* aRange = GetSpecificPL()->GetScalarRange();
+ aScalarBarCtrl->SetRangeLocal(aRange);
+ }else{
+ vtkFloatingPointType aRange[2];
+ GetSpecificPL()->GetSourceRange(aRange);
+ aScalarBarCtrl->SetRangeLocal(aRange);
+ }
+
TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT);
bool anIsMinMaxDone = IsGlobalRangeDefined();
if(anIsMinMaxDone)
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetTextures( const QString& theMainTexture,
- const QString& theAlphaTexture )
+::SetQTextures( const QString& theMainTexture,
+ const QString& theAlphaTexture )
{
bool updateMainTexture = SetMainTexture( theMainTexture );
bool updateAlphaTexture = SetAlphaTexture( theAlphaTexture );
if( !updateMainTexture && !updateAlphaTexture )
return;
+ VISU::TSetModified aModified(this);
+
using namespace VISU;
- TTextureValue aTextureValue = GetTexture(theMainTexture,theAlphaTexture);
+ TTextureValue aTextureValue = GetTexture(theMainTexture, theAlphaTexture);
myGaussPointsPL->SetImageData( aTextureValue.GetPointer() );
}
+void
+VISU::GaussPoints_i
+::SetTextures( const char* theMainTexture,
+ const char* theAlphaTexture )
+{
+ SetQTextures(theMainTexture, theAlphaTexture);
+}
+
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::SetIsActiveLocalScalarBar(const bool theIsActiveLocalScalarBar)
+::SetIsActiveLocalScalarBar(CORBA::Boolean theIsActiveLocalScalarBar)
{
- if(myIsActiveLocalScalarBar != theIsActiveLocalScalarBar){
- myIsActiveLocalScalarBar = theIsActiveLocalScalarBar;
- myParamsTime.Modified();
- }
+ if(myIsActiveLocalScalarBar == theIsActiveLocalScalarBar)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsActiveLocalScalarBar = theIsActiveLocalScalarBar;
+ myParamsTime.Modified();
}
-bool
+CORBA::Boolean
VISU::GaussPoints_i
-::GetIsActiveLocalScalarBar() const
+::GetIsActiveLocalScalarBar()
{
return myIsActiveLocalScalarBar;
}
void
VISU::GaussPoints_i
-::SetIsDispGlobalScalarBar(const bool theIsDispGlobalScalarBar)
+::SetIsDispGlobalScalarBar(CORBA::Boolean theIsDispGlobalScalarBar)
{
- if(myIsDispGlobalScalarBar != theIsDispGlobalScalarBar){
- myIsDispGlobalScalarBar = theIsDispGlobalScalarBar;
- myParamsTime.Modified();
- }
+ if(myIsDispGlobalScalarBar == theIsDispGlobalScalarBar)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myIsDispGlobalScalarBar = theIsDispGlobalScalarBar;
+ myParamsTime.Modified();
}
bool
VISU::GaussPoints_i
::SetSourceRange()
{
+ VISU::TSetModified aModified(this);
+
if(IsTimeStampFixed() || GetIsActiveLocalScalarBar())
- GetSpecificPL()->SetSourceRange();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
+ (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
else{
TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
- GetSpecificPL()->SetScalarRange(aScalarRange);
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
+ (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
}
+ UseFixedRange(false);
}
CORBA::Double
//----------------------------------------------------------------------------
-bool
+CORBA::Boolean
VISU::GaussPoints_i
-::GetIsDispGlobalScalarBar() const
+::GetIsDispGlobalScalarBar()
{
return myIsDispGlobalScalarBar;
}
void
VISU::GaussPoints_i
-::SetBiColor(bool theIsBiColor)
+::SetBiColor(CORBA::Boolean theIsBiColor)
{
+ VISU::TSetModified aModified(this);
+
GetSpecificPL()->SetBicolor(theIsBiColor);
}
-bool
+CORBA::Boolean
VISU::GaussPoints_i
::GetBiColor()
{
void
VISU::GaussPoints_i
-::SetSpacing(const vtkFloatingPointType theSpacing)
+::SetSpacing(CORBA::Double theSpacing)
{
- if(!VISU::CheckIsSameValue(mySpacing, theSpacing)){
- mySpacing = theSpacing;
- myParamsTime.Modified();
- }
-}
+ if(VISU::CheckIsSameValue(mySpacing, theSpacing))
+ return;
-vtkFloatingPointType
-VISU::GaussPoints_i
-::GetSpacing() const
-{
- return mySpacing;
+ VISU::TSetModified aModified(this);
+
+ mySpacing = theSpacing;
+ myParamsTime.Modified();
}
-//----------------------------------------------------------------------------
-void
+CORBA::Double
VISU::GaussPoints_i
-::UpdateMinMax()
+::GetSpacing()
{
- MinMaxCunsomer::UpdateMinMax();
- UpdateActors();
+ return mySpacing;
}
#ifndef VISU_GaussPoints_i_HeaderFile
#define VISU_GaussPoints_i_HeaderFile
-#include "VISU_Result_i.hh"
#include "VISU_ColoredPrs3d_i.hh"
#include "VISU_GaussPtsActorFactory.h"
{
//! Class of the Gauss Points presentation.
class VISU_I_EXPORT GaussPoints_i : public virtual POA_VISU::GaussPoints,
- public virtual VISU::TGaussPtsActorFactory,
- public virtual MinMaxCunsomer,
- public virtual ColoredPrs3d_i
+ public virtual TGaussPtsActorFactory,
+ public virtual ColoredPrs3d_i
{
static int myNbPresent;
GaussPoints_i(const GaussPoints_i&);
GetMemorySize();
//----------------------------------------------------------------------------
- int
+ CORBA::Long
GetFaceLimit();
void
- SetFaceLimit( int theFaceLimit );
+ SetFaceLimit( CORBA::Long theFaceLimit );
- bool
+ CORBA::Boolean
GetIsDeformed();
void
- SetIsDeformed( bool theIsDeformed );
+ SetIsDeformed( CORBA::Boolean theIsDeformed );
- vtkFloatingPointType
+ CORBA::Double
GetScaleFactor();
void
- SetScaleFactor( vtkFloatingPointType theScaleFactor );
+ SetScaleFactor( CORBA::Double theScaleFactor );
//! Get color for Geometry mode of the presentation.
- QColor
+ SALOMEDS::Color
GetColor();
+ QColor
+ GetQColor();
+
//! Set color for Geometry mode of the presentation.
void
- SetColor( const QColor& theColor );
+ SetColor( const SALOMEDS::Color& theColor );
+
+ void
+ SetQColor( const QColor& theColor );
//! Get flag indicating which mode of the presentation is active.
/*! When Results mode is active, returns true. Geometry - false. */
SetMainTexture( const QString& theMainTexture );
//! Get path to the image using for Main Point Sprite texture.
- const QString&
+ QString
+ GetQMainTexture();
+
+ char*
GetMainTexture();
//! Set path to the image using for Alpha Point Sprite texture.
SetAlphaTexture( const QString& theAlphaTexture );
//! Get path to the image using for Alpha Point Sprite texture.
- const QString&
+ QString
+ GetQAlphaTexture();
+
+ char*
GetAlphaTexture();
//! Convert Main and AlphaMask images to VTI format and set them to pipeline.
void
- SetTextures( const QString& theMainTexture,
- const QString& theAlphaTexture );
+ SetQTextures( const QString& theMainTexture,
+ const QString& theAlphaTexture );
+
+ void
+ SetTextures( const char* theMainTexture,
+ const char* theAlphaTexture );
//! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold.
void
- SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold);
+ SetAlphaThreshold(CORBA::Double theAlphaThreshold);
//! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold.
- vtkFloatingPointType
+ CORBA::Double
GetAlphaThreshold();
//! Redirect the request to VISU_GaussPointsPL::SetResolution.
void
- SetResolution(int theResolution);
+ SetResolution(CORBA::Long theResolution);
//! Redirect the request to VISU_GaussPointsPL::GetResolution.
- int
+ CORBA::Long
GetResolution();
void
- SetPrimitiveType(int thePrimitiveType);
+ SetPrimitiveType(VISU::GaussPoints::PrimitiveType thePrimitiveType);
- int
+ VISU::GaussPoints::PrimitiveType
GetPrimitiveType();
//! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize.
//! Redirect the request to VISU_GaussPointsPL::SetClamp.
void
- SetClamp(vtkFloatingPointType theClamp);
+ SetClamp(CORBA::Double theClamp);
//! Redirect the request to VISU_GaussPointsPL::GetClamp.
- vtkFloatingPointType
+ CORBA::Double
GetClamp();
//! Redirect the request to VISU_GaussPointsPL::SetSize.
void
- SetGeomSize(vtkFloatingPointType theGeomSize);
+ SetGeomSize(CORBA::Double theGeomSize);
//! Redirect the request to VISU_GaussPointsPL::GetSize.
- vtkFloatingPointType
+ CORBA::Double
GetGeomSize();
//! Redirect the request to VISU_GaussPointsPL::SetMinSize.
void
- SetMinSize(vtkFloatingPointType theMinSize);
+ SetMinSize(CORBA::Double theMinSize);
//! Redirect the request to VISU_GaussPointsPL::GetMinSize.
- vtkFloatingPointType
+ CORBA::Double
GetMinSize();
//! Redirect the request to VISU_GaussPointsPL::SetMaxSize.
void
- SetMaxSize(vtkFloatingPointType theMaxSize);
+ SetMaxSize(CORBA::Double theMaxSize);
//! Redirect the request to VISU_GaussPointsPL::GetMaxSize.
- vtkFloatingPointType
+ CORBA::Double
GetMaxSize();
//! Redirect the request to VISU_GaussPointsPL::SetMagnification.
void
- SetMagnification(vtkFloatingPointType theMagnification);
+ SetMagnification(CORBA::Double theMagnification);
//! Redirect the request to VISU_GaussPointsPL::GetMagnification.
- vtkFloatingPointType
+ CORBA::Double
GetMagnification();
//! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement.
void
- SetMagnificationIncrement(vtkFloatingPointType theIncrement);
+ SetMagnificationIncrement(CORBA::Double theIncrement);
//! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement.
- vtkFloatingPointType
+ CORBA::Double
GetMagnificationIncrement();
//! Set flag indicating which scalar bar is active.
void
- SetIsActiveLocalScalarBar(const bool theFlag);
+ SetIsActiveLocalScalarBar(CORBA::Boolean theIsActiveLocalScalarBar);
//! Get flag indicating which scalar bar is active.
- bool
- GetIsActiveLocalScalarBar() const;
+ CORBA::Boolean
+ GetIsActiveLocalScalarBar();
//! Set flag indicating visibility of global scalar bar.
void
- SetIsDispGlobalScalarBar(const bool theFlag);
+ SetIsDispGlobalScalarBar(CORBA::Boolean theIsDispGlobalScalarBar);
//! Get flag indicating visibility of global scalar bar.
- bool
- GetIsDispGlobalScalarBar() const;
+ CORBA::Boolean
+ GetIsDispGlobalScalarBar();
//! Redirect the request to VISU_GaussPointsPL::SetBicolor.
void
- SetBiColor(bool theIsBiColor);
+ SetBiColor(CORBA::Boolean theIsBiColor);
//! Redirect the request to VISU_GaussPointsPL::GetBicolor.
- bool
+ CORBA::Boolean
GetBiColor();
//! Set value of the distance between global and local scalar bars.
void
- SetSpacing(const vtkFloatingPointType theSpacing);
+ SetSpacing(CORBA::Double theSpacing);
//! Get value of the distance between global and local scalar bars.
- vtkFloatingPointType
- GetSpacing() const;
+ CORBA::Double
+ GetSpacing();
//! Let know is the global range is already calculated
bool
void
SetSourceRange();
- //! To update the min / max automatically
- virtual
- void
- UpdateMinMax();
-
VISU_GaussPointsPL*
GetSpecificPL() const
{
// STL Includes
#include <strstream>
-using namespace std;
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+namespace filesystem = boost::filesystem;
-static QFileInfo aFileInfo;
#ifdef _DEBUG_
static int MYDEBUG = 0;
namespace VISU
{
//----------------------------------------------------------------------------
- static string VisuTmpDir;
+ static std::string VISU_TMP_DIR;
static CORBA::Boolean myIsMultiFile;
- const CORBA::Boolean IsMultifile() { return myIsMultiFile;}
+ const CORBA::Boolean IsMultiFile()
+ {
+ return myIsMultiFile;
+ }
//----------------------------------------------------------------------------
_PTR(SComponent)
void
RegistryStorable()
{
- Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
- Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore));
- Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
- Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore<GaussPoints_i>));
- Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
- Storable::Registry(CutPlanes_i::myComment.c_str(),&(Restore<CutPlanes_i>));
- Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
- Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(Restore<IsoSurfaces_i>));
- Storable::Registry(StreamLines_i::myComment.c_str(),&(Restore<StreamLines_i>));
- Storable::Registry(Plot3D_i::myComment.c_str(),&(Restore<Plot3D_i>));
- Storable::Registry(Vectors_i::myComment.c_str(),&(Restore<Vectors_i>));
- Storable::Registry(Table_i::myComment.c_str(),&(Table_i::Restore));
- Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
- Storable::Registry(Container_i::myComment.c_str(),&(Container_i::Restore));
- Storable::Registry(ScalarMapOnDeformedShape_i::myComment.c_str(),&(Restore<ScalarMapOnDeformedShape_i>));
- Storable::Registry(ColoredPrs3dHolder_i::myComment.c_str(),&(ColoredPrs3dHolder_i::Restore));
- Storable::Registry(ColoredPrs3dCache_i::myComment.c_str(),&(ColoredPrs3dCache_i::Restore));
+ Storable::RegistryStorableEngine(Result_i::myComment.c_str(),&(Result_i::StorableEngine));
+
+ Storable::RegistryStorableEngine(Mesh_i::myComment.c_str(),&(Mesh_i::StorableEngine));
+
+ Storable::RegistryStorableEngine(ScalarMap_i::myComment.c_str(),&(StorableEngine<ScalarMap_i>));
+ Storable::RegistryStorableEngine(GaussPoints_i::myComment.c_str(),&(StorableEngine<GaussPoints_i>));
+ Storable::RegistryStorableEngine(DeformedShape_i::myComment.c_str(),&(StorableEngine<DeformedShape_i>));
+ Storable::RegistryStorableEngine(CutPlanes_i::myComment.c_str(),&(StorableEngine<CutPlanes_i>));
+ Storable::RegistryStorableEngine(CutLines_i::myComment.c_str(),&(StorableEngine<CutLines_i>));
+ Storable::RegistryStorableEngine(IsoSurfaces_i::myComment.c_str(),&(StorableEngine<IsoSurfaces_i>));
+ Storable::RegistryStorableEngine(StreamLines_i::myComment.c_str(),&(StorableEngine<StreamLines_i>));
+ Storable::RegistryStorableEngine(Plot3D_i::myComment.c_str(),&(StorableEngine<Plot3D_i>));
+ Storable::RegistryStorableEngine(Vectors_i::myComment.c_str(),&(StorableEngine<Vectors_i>));
+ Storable::RegistryStorableEngine(ScalarMapOnDeformedShape_i::myComment.c_str(),&(StorableEngine<ScalarMapOnDeformedShape_i>));
+
+ Storable::RegistryStorableEngine(ColoredPrs3dHolder_i::myComment.c_str(),&(ColoredPrs3dHolder_i::StorableEngine));
+ Storable::RegistryStorableEngine(ColoredPrs3dCache_i::myComment.c_str(),&(ColoredPrs3dCache_i::StorableEngine));
+
+ Storable::RegistryStorableEngine(Table_i::myComment.c_str(),&(Table_i::StorableEngine));
+ Storable::RegistryStorableEngine(Curve_i::myComment.c_str(),&(Curve_i::StorableEngine));
+ Storable::RegistryStorableEngine(Container_i::myComment.c_str(),&(Container_i::StorableEngine));
+ }
+
+
+ //----------------------------------------------------------------------------
+ SALOMEDS::ListOfFileNames*
+ GetListOfFileNames(const Result_i::TFileNames& theFileNames)
+ {
+ SALOMEDS::ListOfFileNames_var aListOfFileNames = new SALOMEDS::ListOfFileNames;
+ if(!theFileNames.empty()){
+ aListOfFileNames->length(theFileNames.size());
+ for(int aCounter = theFileNames.size(); aCounter > 0; aCounter--)
+ aListOfFileNames[aCounter-1] = theFileNames[aCounter-1].c_str();
+ }
+ return aListOfFileNames._retn();
}
::Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile & theStream,
const char* theURL,
- bool isMultiFile)
+ CORBA::Boolean theIsMultiFile)
{
Mutex mt(myMutex);
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
}
- string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
- TCollection_AsciiString aTmpDir (const_cast<char*>(aDir.c_str()));
- VisuTmpDir = aTmpDir.ToCString();
+ VISU_TMP_DIR = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
SALOMEDS::ListOfFileNames_var aSeq =
- SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.ToCString(),isMultiFile);
- myIsMultiFile = isMultiFile;
+ SALOMEDS_Tool::PutStreamToFiles(theStream, VISU_TMP_DIR, theIsMultiFile);
+ myIsMultiFile = theIsMultiFile;
return true;
}
::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile & theStream,
const char* theURL,
- bool isMultiFile)
+ bool theIsMultiFile)
{
- return Load(theComponent, theStream, theURL, isMultiFile);
+ return Load(theComponent, theStream, theURL, theIsMultiFile);
}
char*
VISU_Gen_i
::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
- const char* aLocalPersistentID,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII)
+ const char* theLocalPersistentID,
+ CORBA::Boolean theIsMultiFile,
+ CORBA::Boolean theIsASCII)
{
CORBA::String_var aString("");
- if(strcmp(aLocalPersistentID,"") != 0) {
- Mutex mt(myMutex);
- Storable* aStorable =
- Storable::Create(theSObject,VisuTmpDir.c_str(),aLocalPersistentID);
- if(aStorable != NULL) aString = aStorable->GetID();
+ if(strcmp(theLocalPersistentID,"") != 0) {
+ Storable* aStorable = Storable::Create(theSObject,
+ theLocalPersistentID,
+ VISU_TMP_DIR,
+ theIsMultiFile);
+ if(aStorable != NULL)
+ aString = aStorable->GetID();
}
return aString._retn();
}
const char* theURL,
bool theIsMultiFile)
{
- Mutex mt(myMutex);
- string aTmpDir = theURL;
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
-
- typedef std::vector<std::string> TFileNames;
- TFileNames aFileNames;
- TFileNames aFiles;
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - theURL = '"<<theURL<<"'");
+
+ Result_i::TFileNames aFileNames;
+ Result_i::TFileNames aFiles;
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent);
for (; anIter->More(); anIter->Next()) {
- SALOMEDS::SObject_var gotBranch = anIter->Value();
- CORBA::Object_var anObj = SObjectToObject(gotBranch);
- if(CORBA::is_nil(anObj)) continue;
+ SALOMEDS::SObject_var aSObject = anIter->Value();
+ CORBA::Object_var anObj = SObjectToObject(aSObject);
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- switch(aResult->GetCreationId()){
- case Result_i::eImportFile:
- case Result_i::eCopyAndImportFile: {
- const QFileInfo& aFileInfo = aResult->GetFileInfo();
- const std::string& aName = aResult->GetName();
- std::string aFileName = std::string("_") + aName;
- std::string aFile = aFileInfo.filePath().latin1();
- if(theIsMultiFile){
- aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()) + aFileName;
-
- std::ostringstream aStream;
- aStream<<"cp "<<aFile<<" "<<aTmpDir<<aFileName;
- std::string aCommand = aStream.str();
- if(system(aCommand.c_str()) != 0){
- INFOS("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
- continue;
- }
- }
- aFileNames.push_back(aFileName);
- aFiles.push_back(aFile);
- }}
+ aResult->Save(theComponent,
+ theURL,
+ theIsMultiFile,
+ false,
+ aFileNames,
+ aFiles);
}
}
-
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.size() - "<<aFileNames.size());
- SALOMEDS::ListOfFileNames_var aListOfFileNames = new SALOMEDS::ListOfFileNames;
- if(!aFileNames.empty()){
- aListOfFileNames->length(aFileNames.size());
- for(int aCounter = aFileNames.size(); aCounter > 0; aCounter--)
- aListOfFileNames[aCounter-1] = aFileNames[aCounter-1].c_str();
- }
-
- SALOMEDS::ListOfFileNames_var aListOfFiles = new SALOMEDS::ListOfFileNames;
- aListOfFiles->length(aFiles.size());
- if(!aFiles.empty()){
- for(int aCounter = aFileNames.size(); aCounter > 0; aCounter--)
- aListOfFiles[aCounter-1] = aFiles[aCounter-1].c_str();
- }
-
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
+ if(aFileNames.empty())
+ return aStreamFile._retn();
+
+ SALOMEDS::ListOfFileNames_var aListOfFileNames = GetListOfFileNames(aFileNames);
+ SALOMEDS::ListOfFileNames_var aListOfFiles = GetListOfFileNames(aFiles);
+
if(theIsMultiFile)
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aListOfFiles.in(), theIsMultiFile);
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(theURL, aListOfFiles.in(), theIsMultiFile);
else
aStreamFile = SALOMEDS_Tool::PutFilesToStream(aListOfFiles.in(), aListOfFileNames.in());
VISU_Gen_i
::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
- bool isMultiFile)
+ bool theIsMultiFile)
{
- Mutex mt(myMutex);
- string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
- TCollection_AsciiString aTmpDir (const_cast<char*>(aDir.c_str()));
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
- int aCounter = 0;
- TColStd_SequenceOfAsciiString aFileNames;
+ std::string anURL = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - "<<anURL);
+
+ Result_i::TFileNames aFileNames;
+ Result_i::TFileNames aFiles;
+
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
- SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
- for (; itBig->More(); itBig->Next()) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
- CORBA::Object_var anObj = SObjectToObject(gotBranch);
- if(CORBA::is_nil(anObj)) continue;
- if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- switch(pResult->GetCreationId()){
- case Result_i::eImportFile:
- case Result_i::eCopyAndImportFile: {
- const QFileInfo& aFileInfo = pResult->GetFileInfo();
- QString aPrefix("");
- if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str();
- QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
- QString tmpDir = QDir::convertSeparators( QString(aTmpDir.ToCString()) );;
- static QString aCommand;
- aCommand.sprintf(" %s %s%s",aFileInfo.filePath().latin1(),tmpDir.latin1(),aFileName.latin1());
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( COPY_COMMAND );
-
- if(system(aCommand.latin1())){
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
- continue;
- }else
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
-
- QString studyPath = tmpDir.append(aFileName);
- TCollection_AsciiString aString((char *)(aFileName.latin1()));
-
- HDFascii::ConvertFromHDFToASCII(strdup(studyPath.latin1()), true);
-
- aFileNames.Append(aString);
- }}
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent);
+ for (; anIter->More(); anIter->Next()) {
+ SALOMEDS::SObject_var aSObject = anIter->Value();
+ CORBA::Object_var anObj = SObjectToObject(aSObject);
+ if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
+ aResult->Save(theComponent,
+ anURL,
+ theIsMultiFile,
+ true,
+ aFileNames,
+ aFiles);
}
}
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::SaveASCII - aFileNames.size() - "<<aFileNames.size());
+
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.Length() - "<<aFileNames.Length());
- if(aFileNames.Length() > 0){
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(aFileNames.Length());
- for(aCounter = aFileNames.Length(); aCounter > 0; aCounter--)
- aSeq[aCounter-1] = CORBA::string_dup(aFileNames.Value(aCounter).ToCString());
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.ToCString(), aSeq.in(), isMultiFile);
- if(!isMultiFile)
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true);
- }
+ if(aFileNames.empty())
+ return aStreamFile._retn();
+
+ SALOMEDS::ListOfFileNames_var aListOfFileNames = GetListOfFileNames(aFileNames);
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(anURL, aListOfFileNames.in(), theIsMultiFile);
+
+ if(!theIsMultiFile)
+ SALOMEDS_Tool::RemoveTemporaryFiles(anURL, aListOfFileNames, true);
+
return aStreamFile._retn();
}
char*
VISU_Gen_i
::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
- const char* IORString,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII)
+ const char* theIORString,
+ CORBA::Boolean theIsMultiFile,
+ CORBA::Boolean theIsASCII)
{
- CORBA::String_var aString(IORString);
- if(strcmp(IORString,"") != 0){
- CORBA::ORB_ptr anORB = GetORB();
- CORBA::Object_var anObj = anORB->string_to_object(aString);
- if(!CORBA::is_nil(anObj)){
- if(Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj).in())){
- Mutex mt(myMutex);
- aString = pStorable->ToString().c_str();
- return aString._retn();
- }
+ CORBA::String_var aString("");
+ if(strcmp(theIORString, "") != 0){
+ CORBA::Object_var anObj = GetORB()->string_to_object(theIORString);
+ if(Storable* aStorable = dynamic_cast<Storable*>(GetServant(anObj).in())){
+ aString = aStorable->ToString().c_str();
+ return aString._retn();
}
}
return aString._retn();
{
if(myStudyDocument->GetProperties()->IsLocked())
return SALOMEDS::SObject::_nil();
- Mutex mt(myMutex);
SALOMEDS::SObject_var aRes = VISU::ImportTables(theFileName,myStudyDocument);
return aRes._retn();
}
{
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
- Mutex mt(myMutex);
- aFileInfo.setFile(theFileName);
- Result_i* pResult = new Result_i(myStudyDocument,
- Result_i::eFile,
- Result_i::eImportFile);
- if(pResult->Create(theFileName) != NULL)
- return pResult->_this();
- else{
- pResult->_remove_ref();
- return VISU::Result::_nil();
- }
+
+ Result_i* aResult = Result_i::New(myStudyDocument,
+ Result_i::eFile,
+ Result_i::eImportFile,
+ true,
+ true,
+ true,
+ true);
+
+ if(aResult->Create(theFileName) != NULL)
+ return aResult->_this();
+ else
+ aResult->_remove_ref();
+
+ return VISU::Result::_nil();
}
{
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
- Mutex mt(myMutex);
- aFileInfo.setFile(theFileName);
- Result_i* pResult = new Result_i(myStudyDocument,
- Result_i::eFile,
- Result_i::eImportFile,
- false);
- if(pResult->Create(theFileName) != NULL)
- return pResult->_this();
- else{
- pResult->_remove_ref();
- return VISU::Result::_nil();
- }
+
+ Result_i* aResult = Result_i::New(myStudyDocument,
+ Result_i::eFile,
+ Result_i::eImportFile,
+ false,
+ true,
+ true,
+ true);
+
+ if(aResult->Create(theFileName) != NULL)
+ return aResult->_this();
+ else
+ aResult->_remove_ref();
+
+ return VISU::Result::_nil();
}
{
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
- Mutex mt(myMutex);
- VISU::Result_var aResult;
- aFileInfo.setFile(theFileName);
- Result_i* pResult = new Result_i(myStudyDocument,
- Result_i::eRestoredFile,
- Result_i::eCopyAndImportFile);
- if(pResult->Create(theFileName) != NULL)
- aResult = pResult->_this();
- return aResult._retn();
+
+ Result_i* aResult = Result_i::New(myStudyDocument,
+ Result_i::eRestoredFile,
+ Result_i::eCopyAndImportFile,
+ true,
+ true,
+ true,
+ true);
+ if(aResult->Create(theFileName) != NULL)
+ return aResult->_this();
+ else
+ aResult->_remove_ref();
+
+ return VISU::Result::_nil();
}
{
if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
- Mutex mt(myMutex);
- Result_i* pResult = new Result_i(myStudyDocument,
- Result_i::eComponent,
- Result_i::eImportMed);
- if (pResult->Create(theMedSObject) != NULL) {
- return pResult->_this();
- } else {
- pResult->_remove_ref();
- return VISU::Result::_nil();
- }
+
+ Result_i* aResult = Result_i::New(myStudyDocument,
+ Result_i::eComponent,
+ Result_i::eImportMed,
+ true,
+ true,
+ true,
+ true);
+ if (aResult->Create(theMedSObject) != NULL)
+ return aResult->_this();
+ else
+ aResult->_remove_ref();
+
+ return VISU::Result::_nil();
}
{
if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
- Mutex mt(myMutex);
- Result_i* pResult = new Result_i(myStudyDocument,
- Result_i::eComponent,
- Result_i::eImportMedField);
- if (pResult->Create(theField) != NULL) {
- return pResult->_this();
- } else {
- pResult->_remove_ref();
- return VISU::Result::_nil();
- }
+
+ Result_i* aResult = Result_i::New(myStudyDocument,
+ Result_i::eComponent,
+ Result_i::eImportMedField,
+ true,
+ true,
+ true,
+ true);
+
+ if (aResult->Create(theField) != NULL)
+ return aResult->_this();
+ else
+ aResult->_remove_ref();
+
+ return VISU::Result::_nil();
}
void
const std::string& theSubMeshName, // Family or Group name
const std::string& theNewName)
{
- if (myStudyDocument->GetProperties()->IsLocked())
- return;
-
Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
if (!aResult)
return;
+ SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+ if (aStudyDocument->GetProperties()->IsLocked())
+ return;
+
+
QString aComment;
VISU::VISUType aType;
if (theEntity >= 0)
if (anEntry == "")
return;
- SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str());
+ SALOMEDS::SObject_ptr aSObject = aStudyDocument->FindObjectID(anEntry.c_str());
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
SALOMEDS::GenericAttribute_var anAttr =
const char* theMeshName,
VISU::Entity theEntity)
{
- if(myStudyDocument->GetProperties()->IsLocked())
- return Mesh::_nil();
+ Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+ if (!aResult)
+ return VISU::Mesh::_nil();
+
+ SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+ if (aStudyDocument->GetProperties()->IsLocked())
+ return VISU::Mesh::_nil();
+
+ Mesh_i* aPresent = new Mesh_i();
+ if(aPresent->Create(aResult, theMeshName, theEntity))
+ return aPresent->_this();
+ else
+ aPresent->_remove_ref();
- if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
- Mesh_i* aPresent = new Mesh_i();
- if(aPresent->Create(aResult, theMeshName, theEntity))
- return aPresent->_this();
- else{
- aPresent->_remove_ref();
- }
- }
return VISU::Mesh::_nil();
}
VISU::Entity theEntity,
const char* theFamilyName)
{
- if(myStudyDocument->GetProperties()->IsLocked())
- return Mesh::_nil();
+ Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+ if (!aResult)
+ return VISU::Mesh::_nil();
+
+ SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+ if (aStudyDocument->GetProperties()->IsLocked())
+ return VISU::Mesh::_nil();
+
+ Mesh_i* aPresent = new Mesh_i();
+ if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
+ return aPresent->_this();
+ else
+ aPresent->_remove_ref();
- if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
- Mesh_i* aPresent = new Mesh_i();
- if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
- return aPresent->_this();
- else{
- aPresent->_remove_ref();
- }
- }
return VISU::Mesh::_nil();
}
const char* theMeshName,
const char* theGroupName)
{
- if(myStudyDocument->GetProperties()->IsLocked())
- return Mesh::_nil();
+ Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+ if (!aResult)
+ return VISU::Mesh::_nil();
+
+ SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+ if (aStudyDocument->GetProperties()->IsLocked())
+ return VISU::Mesh::_nil();
+
+ Mesh_i* aPresent = new Mesh_i();
+ if(aPresent->Create(aResult, theMeshName, theGroupName))
+ return aPresent->_this();
+ else
+ aPresent->_remove_ref();
- if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
- Mesh_i* aPresent = new Mesh_i();
- if(aPresent->Create(aResult, theMeshName, theGroupName))
- return aPresent->_this();
- else{
- aPresent->_remove_ref();
- }
- }
return VISU::Mesh::_nil();
}
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
DeformedShape_ptr
VISU_Gen_i
::DeformedShapeOnField(Result_ptr theResult,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
ScalarMapOnDeformedShape_ptr
VISU_Gen_i
::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
Vectors_ptr
VISU_Gen_i
::VectorsOnField(Result_ptr theResult,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
IsoSurfaces_ptr
VISU_Gen_i
::IsoSurfacesOnField(Result_ptr theResult,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
StreamLines_ptr
VISU_Gen_i
::StreamLinesOnField(Result_ptr theResult,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
Plot3D_ptr
VISU_Gen_i
::Plot3DOnField(Result_ptr theResult,
theIteration)._retn();
}
- CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+
+ //---------------------------------------------------------------
+ CutPlanes_ptr
+ VISU_Gen_i
+ ::CutPlanesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::CutPlanes_i>(theResult,
theMeshName,
theIteration)._retn();
}
- CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult,
- const char* theMeshName,
- VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theIteration)
+
+ //---------------------------------------------------------------
+ CutLines_ptr
+ VISU_Gen_i
+ ::CutLinesOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Long theIteration)
{
return Prs3dOnField<VISU::CutLines_i>(theResult,
theMeshName,
theIteration)._retn();
}
+
+ //---------------------------------------------------------------
struct CreateTableEvent: public SALOME_Event
{
SALOMEDS::Study_var myStudyDocument;
};
- Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry)
+ //---------------------------------------------------------------
+ Table_ptr
+ VISU_Gen_i
+ ::CreateTable(const char* theTableEntry)
{
if(myStudyDocument->GetProperties()->IsLocked())
return Table::_nil();
return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry));
}
- Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow)
+
+ //---------------------------------------------------------------
+ Curve_ptr
+ VISU_Gen_i
+ ::CreateCurve(Table_ptr theTable,
+ CORBA::Long theHRow,
+ CORBA::Long theVRow)
{
return CreateCurveWithZ( theTable, theHRow, theVRow, 0 );
}
- Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
- CORBA::Long theHRow,
- CORBA::Long theVRow,
- CORBA::Long theZRow)
+
+ //---------------------------------------------------------------
+ Curve_ptr
+ VISU_Gen_i
+ ::CreateCurveWithZ(Table_ptr theTable,
+ CORBA::Long theHRow,
+ CORBA::Long theVRow,
+ CORBA::Long theZRow)
{
if(myStudyDocument->GetProperties()->IsLocked())
return Curve::_nil();
}
}
- Container_ptr VISU_Gen_i::CreateContainer(){
+
+
+ //---------------------------------------------------------------
+ Container_ptr
+ VISU_Gen_i
+ ::CreateContainer()
+ {
if(myStudyDocument->GetProperties()->IsLocked())
return Container::_nil();
Mutex mt(myMutex);
}
}
- Animation_ptr VISU_Gen_i::CreateAnimation(View3D_ptr theView3D){
+
+ //---------------------------------------------------------------
+ Animation_ptr
+ VISU_Gen_i
+ ::CreateAnimation(View3D_ptr theView3D)
+ {
if(myStudyDocument->GetProperties()->IsLocked())
return Animation::_nil();
Mutex mt(myMutex);
return VISU::Animation::_nil();
}
- void VISU_Gen_i::DeleteResult (Result_ptr theResult)
+
+ //---------------------------------------------------------------
+ void
+ VISU_Gen_i
+ ::DeleteResult (Result_ptr theResult)
{
theResult->RemoveFromStudy();
}
- void VISU_Gen_i::DeletePrs3d (Prs3d_ptr thePrs3d)
+
+ //---------------------------------------------------------------
+ void
+ VISU_Gen_i
+ ::DeletePrs3d(Prs3d_ptr thePrs3d)
{
thePrs3d->RemoveFromStudy();
}
- void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
- }
- char* VISU_Gen_i::ComponentDataType(){
+ //---------------------------------------------------------------
+ void
+ VISU_Gen_i
+ ::Close(SALOMEDS::SComponent_ptr theComponent)
+ {}
+
+
+ //---------------------------------------------------------------
+ char*
+ VISU_Gen_i
+ ::ComponentDataType()
+ {
return CORBA::string_dup("VISU");
}
- bool VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) {
+
+ //---------------------------------------------------------------
+ bool
+ VISU_Gen_i
+ ::CanPublishInStudy(CORBA::Object_ptr theIOR)
+ {
Result_var aResultObj = Result::_narrow(theIOR);
return !(aResultObj->_is_nil());
}
- SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject,
- CORBA::Object_ptr theObject,
- const char* theName)
+
+ //---------------------------------------------------------------
+ SALOMEDS::SObject_ptr
+ VISU_Gen_i
+ ::PublishInStudy(SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject,
+ CORBA::Object_ptr theObject,
+ const char* theName)
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SalomeException);
Mutex mt(myMutex);
SALOMEDS::SObject_var aResultSO;
Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject).in());
- if (!aResultObj) return aResultSO._retn();
+ if (!aResultObj)
+ return aResultSO._retn();
const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID();
aResultSO = theStudy->FindObjectID(anEntry);
return aResultSO._retn();
}
- CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
- Mutex mt(myMutex);
- SALOMEDS::GenericAttribute_var anAttr;
- if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return false;
- try {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- CORBA::String_var aValue = anIOR->Value();
- if(strcmp(aValue,"") != 0){
- CORBA::Object_ptr anObj = GetORB()->string_to_object(aValue);
- if (!CORBA::is_nil(anObj)){
- Result_var aResultObj = Result::_narrow(anObj);
- if(!aResultObj->_is_nil()){
- if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj).in())){
- switch(pResult->GetCreationId()){
- case Result_i::eImportFile:
- case Result_i::eCopyAndImportFile:
- return true;
- }
- }
- }
- }
- }
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch (...){
- INFOS("Unknown exception was occured!");
- }
+
+ //---------------------------------------------------------------
+ CORBA::Boolean
+ VISU_Gen_i
+ ::CanCopy(SALOMEDS::SObject_ptr theObject)
+ {
+ CORBA::Object_var anObj = SObjectToObject(theObject);
+ if (Storable* aStorable = dynamic_cast<Storable*>(GetServant(anObj).in()))
+ return aStorable->CanCopy(theObject);
+
return false;
}
- SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
- Mutex mt(myMutex);
+
+ //---------------------------------------------------------------
+ SALOMEDS::TMPFile*
+ VISU_Gen_i
+ ::CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID)
+ {
theObjectID = 0;
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- PortableServer::POA_ptr aPOA = GetPOA();
-
- SALOMEDS::GenericAttribute_var anAttr;
- if (!theObject->FindAttribute(anAttr,"AttributeIOR")) return NULL;
- SALOMEDS::AttributeIOR_var anIORAttr = SALOMEDS::AttributeIOR::_narrow(anAttr);
- CORBA::Object_var aCorbaObj;
- try {
- aCorbaObj = GetORB()->string_to_object(anIORAttr->Value());
- } catch(...) {
+ CORBA::Object_var anObj = SObjectToObject(theObject);
+ if (CORBA::is_nil(anObj)) {
aStreamFile->length(1);
- aStreamFile[0] = strdup("E")[0];
- return aStreamFile._retn();
- }
- if (CORBA::is_nil(aCorbaObj)) {
- return NULL;
- }
+ aStreamFile[0] = CORBA::string_dup("E")[0];
+ } else if (Storable* aStorable = dynamic_cast<Storable*>(GetServant(anObj).in())) {
+ std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
+ Storable::TFileNames aFileNames;
+ bool anIsDone = aStorable->CopyFrom(theObject, theObjectID, aTmpDir, aFileNames);
- Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj).in());
- if (!pStorable) {
- return NULL;
- }
-
- string aTmpDir = SALOMEDS_Tool::GetTmpDir();
- string aCopyPersist = aTmpDir + "copy_persistent";
-
- ofstream stmOut2(aCopyPersist.c_str(),ios::out);
- string aStr = pStorable->ToString().c_str();
- stmOut2<<aStr<<endl;
- stmOut2.close();
-
- if (Result_i* aResultObj = dynamic_cast<Result_i*>(aPOA->reference_to_servant(aCorbaObj))) {
- string aFileName = string(SALOMEDS_Tool::GetNameFromPath(theObject->GetStudy()->URL())) + "_";
- if(strlen(aFileName.c_str()) == 1) aFileName="";
- const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
- aFileName += aFileInfo.fileName().latin1();
- static QString aCommand;
- string aFullFileName = aTmpDir + aFileName;
- aCommand.sprintf(" %s %s",aFileInfo.filePath().latin1(), aFullFileName.c_str() );
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( COPY_COMMAND );
-
- if(system(aCommand.latin1()) == -1) {
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<<aCommand);
- return NULL;
- }
- aSeq->length(2);
- aSeq[0] = "copy_persistent";
- aSeq[1] = aFileName.c_str();
- } else {
- aSeq->length(1);
- aSeq[0] = "copy_persistent";
- }
-
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), false);
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+ SALOMEDS::ListOfFileNames_var aListOfFileNames = new SALOMEDS::ListOfFileNames;
+ aListOfFileNames->length(aFileNames.size());
+ for(size_t anId = 0; anId < aFileNames.size(); anId++)
+ aListOfFileNames[anId] = aFileNames[anId].c_str();
- // Assign an ID = 1 the the type VISU::Result
- theObjectID = 1;
+ if(anIsDone)
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aListOfFileNames.in(), false);
- SALOMEDS::SComponent_var aSComponent = theObject->GetStudy()->FindComponent("VISU");
+ SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aListOfFileNames.in(), true);
+ }
return aStreamFile._retn();
}
- CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
+
+ //---------------------------------------------------------------
+ CORBA::Boolean
+ VISU_Gen_i
+ ::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
// The VISU component can paste only objects copied by VISU component
- // and with the object type = 1
- if (strcmp(theComponentName, ComponentDataType()) != 0 || theObjectID != 1)
- return false;
- return true;
+ CORBA::String_var aString = ComponentDataType();
+ if (strcmp(theComponentName, aString.in()) == 0 && theObjectID == 1)
+ return true;
+ return false;
}
- SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
- CORBA::Long theObjectID,
- SALOMEDS::SObject_ptr theObject)
+
+ //---------------------------------------------------------------
+ SALOMEDS::SObject_ptr
+ VISU_Gen_i
+ ::PasteInto(const SALOMEDS::TMPFile& theStream,
+ CORBA::Long theObjectID,
+ SALOMEDS::SObject_ptr theSObject)
{
- Mutex mt(myMutex);
- SALOMEDS::SObject_var aResultSO;
if (theObjectID != 1)
- return aResultSO._retn();
-
- string aTmpDir = SALOMEDS_Tool::GetTmpDir();
- SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), false);
-
- ifstream stmIn((aTmpDir + string("copy_persistent")).c_str());
- stmIn.seekg(0, ios::end);
- int aLength = stmIn.tellg();
- stmIn.seekg(0, ios::beg);
- char* aString = new char[aLength+1];
- stmIn.read(aString, aLength);
- stmIn.close();
- aString[aLength] = 0;
- myIsMultiFile = false;
-
- string aFileName(aTmpDir);
- string aBasicFileName;
- if(aSeq->length() > 1) {
- aBasicFileName = aSeq[1].in();
- aFileName += aBasicFileName;
- }
+ return SALOMEDS::SObject::_nil();
- SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent();
- SALOMEDS::Study_var aStudy = theObject->GetStudy();
+ SALOMEDS::SComponent_var aComponent = theSObject->GetFatherComponent();
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- CORBA::String_var aComponentID(aComponent->GetID()), aSObjID(theObject->GetID());
-
- if (strcmp(aComponentID, aSObjID) == 0) //create the new result SObject
- aResultSO = aStudyBuilder->NewObject(aComponent);
+ CORBA::String_var aComponentID(aComponent->GetID());
+ CORBA::String_var aSObjectID(theSObject->GetID());
+
+ SALOMEDS::SObject_var aSObject;
+ if (strcmp(aComponentID, aSObjectID) == 0) //create the new result SObject
+ aSObject = aStudyBuilder->NewObject(aComponent);
else
- aResultSO = SALOMEDS::SObject::_duplicate(theObject);
-
+ aSObject = SALOMEDS::SObject::_duplicate(theSObject);
+
+ std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
+ SALOMEDS::ListOfFileNames_var aListOfFileNames =
+ SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
+ if(MYDEBUG) MESSAGE("Result_i::PasteInto - aListOfFileNames->length() = "<<aListOfFileNames->length());
+
+ std::string aLocalPersistentID;
+ {
+ std::string aCopyPersist = aTmpDir + "copy_persistent";
+ std::ifstream anInputFileStream(aCopyPersist.c_str());
+ anInputFileStream>>aLocalPersistentID;
+ anInputFileStream.close();
+ }
+
//Just for Result::Restore to find the Comment attribute :(
- SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
-
- Storable* aStorable = Storable::Create(aResultSO,aFileName,aString);
-
- SALOMEDS::ListOfFileNames_var aSeqToRm = new SALOMEDS::ListOfFileNames;
- aSeqToRm->length(1);
- aSeqToRm[0] = "copy_persistent";
-
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeqToRm.in(), true);
-
- anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR");
+ SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
+
+ std::string aFileName(aTmpDir);
+ if(aListOfFileNames->length() > 1)
+ aFileName += aListOfFileNames[1].in();
+ Storable* aStorable = Storable::Create(aSObject, aLocalPersistentID, aFileName, false);
+
+ SALOMEDS::ListOfFileNames_var aFilesToRemove = new SALOMEDS::ListOfFileNames;
+ aFilesToRemove->length(1);
+ aFilesToRemove[0] = aListOfFileNames[0];
+ SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aFilesToRemove.in(), true);
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var anIORValue(aStorable->GetID());
anIOR->SetValue(anIORValue);
- return aResultSO._retn();
+
+ return aSObject._retn();
}
+
+ //---------------------------------------------------------------
VISU::ColoredPrs3dCache_ptr
- VISU_Gen_i::
- GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+ VISU_Gen_i
+ ::GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
{
return ColoredPrs3dCache_i::GetInstance(theStudy);
}
// Author : Alexey PETROV
// Module : VISU
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_Prs3dUtils.hh"
+
#include "VISU_IsoSurfacesPL.hxx"
#include "VISU_Result_i.hh"
-#include "VISU_IsoSurfaces_i.hh"
#include "VISU_Actor.h"
#include "SUIT_ResourceMgr.h"
VISU::IsoSurfaces_i
::SetNbSurfaces(CORBA::Long theNb)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_IsoSurfacesPL, int>
(GetSpecificPL(), &VISU_IsoSurfacesPL::SetNbParts, theNb));
}
VISU::IsoSurfaces_i
::SetSubRange(CORBA::Double theMin, CORBA::Double theMax)
{
+ VISU::TSetModified aModified(this);
+
vtkFloatingPointType aRange[2] = {theMin, theMax};
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_IsoSurfacesPL, vtkFloatingPointType*>
(GetSpecificPL(), &VISU_IsoSurfacesPL::SetRange, aRange));
// Module : VISU
#include "VISU_Mesh_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
aRestoringMap["myMeshName"] = GetCMeshName();
VISU::PUnstructuredGridIDMapper anIDMapper;
- VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput();
switch(myType){
case VISU::TENTITY :
anIDMapper = anInput->GetMeshOnEntity(aMeshName,
if(IsSameColor(myCellColor, theColor))
return;
+ VISU::TSetModified aModified(this);
+
myCellColor = theColor;
myParamsTime.Modified();
}
if(IsSameColor(myNodeColor, theColor))
return;
+ VISU::TSetModified aModified(this);
+
myNodeColor = theColor;
myParamsTime.Modified();
}
if(IsSameColor(myLinkColor, theColor))
return;
+ VISU::TSetModified aModified(this);
+
myLinkColor = theColor;
myParamsTime.Modified();
}
if(myPresentType == theType)
return;
+ VISU::TSetModified aModified(this);
+
myPresentType = theType;
myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::Storable*
VISU::Mesh_i
-::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
- const Storable::TRestoringMap& theMap)
+::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
Mesh_i* aMesh = new Mesh_i();
return aMesh->Restore(theSObject, theMap);
static
Storable*
- Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
virtual
VISU_Actor*
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_MultiResult_i.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifdef ENABLE_MULTIPR
+
+#include "VISU_MultiResult_i.hh"
+#include "VISU_ResultUtils.hh"
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include "MULTIPR_Obj.hxx"
+#include "MULTIPR_API.hxx"
+#include "MULTIPR_Exceptions.hxx"
+
+#include "SALOMEDS_Tool.hxx"
+#include "HDFascii.hxx"
+
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+
+#include <strstream>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
+#endif
+
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ class TSubString: public std::string
+ {
+ public:
+ typedef std::string::size_type size_type;
+
+ TSubString(std::string& theSource,
+ const std::string& theTarget):
+ mySource(theSource),
+ myPosition(theSource.find(theTarget)),
+ mySize(theTarget.length())
+ {}
+
+ TSubString&
+ operator = (const std::string& theTarget)
+ {
+ if(myPosition != std::string::npos)
+ mySource.replace(myPosition, mySize, theTarget);
+ return *this;
+ }
+
+ private:
+ std::string& mySource;
+ size_type myPosition;
+ size_type mySize;
+ };
+
+
+ //---------------------------------------------------------------
+ inline
+ std::ostream&
+ operator<<(std::ostream& theStream,
+ const MultiResult_i::TPartInfo& thePartInfo)
+ {
+ theStream<<(thePartInfo.myMeshName)<<" ";
+ theStream<<(thePartInfo.myPartID)<<" ";
+ theStream<<(thePartInfo.myName)<<" ";
+ theStream<<(thePartInfo.myPath)<<" ";
+ theStream<<(thePartInfo.myFileName);
+ return theStream;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ std::istream&
+ operator>>(std::istream& theStream,
+ MultiResult_i::TPartInfo& thePartInfo)
+ {
+ theStream>>(thePartInfo.myMeshName);
+ theStream>>(thePartInfo.myPartID);
+ theStream>>(thePartInfo.myName);
+ theStream>>(thePartInfo.myPath);
+ theStream>>(thePartInfo.myFileName);
+ return theStream;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ MultiResult_i::TPartInfo
+ GetPartInfo(const std::string theInfoString)
+ {
+ MultiResult_i::TPartInfo aPartInfo;
+ std::istrstream anOutputStream(theInfoString.c_str());
+ anOutputStream>>aPartInfo;
+ return aPartInfo;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ MultiResult_i::TPartInfo
+ GetPartInfo(multipr::Obj& theMultiprObj,
+ const MultiResult_i::TPartName& thePartName)
+ {
+ return GetPartInfo(theMultiprObj.getPartInfo(thePartName.c_str()));
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ std::string
+ ExtractMainPart(const std::string& thePartName)
+ {
+ size_t aPos = thePartName.rfind('_');
+ if(aPos == std::string::npos)
+ return thePartName;
+
+ std::string aSuffix = thePartName.substr(aPos);
+ if(aSuffix == "_MED" || aSuffix == "_LOW")
+ return thePartName.substr(0, aPos);
+
+ return thePartName;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ bool
+ IsSubString(const std::string& theSource,
+ const std::string& theSubString)
+ {
+ return theSource.rfind(theSubString) != std::string::npos;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ bool
+ IsMediumResolution(const std::string& thePartName)
+ {
+ return IsSubString(thePartName, "_MED");
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ bool
+ IsLowResolution(const std::string& thePartName)
+ {
+ return IsSubString(thePartName, "_LOW");
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ bool
+ IsFullResolution(const std::string& thePartName)
+ {
+ return !IsMediumResolution(thePartName) && !IsLowResolution(thePartName);
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ MultiResult_i::TResolutions
+ GetResolutions(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
+ const std::string& thePartName)
+ {
+ MultiResult_i::TResolutions aResolutions;
+ aResolutions.insert(VISU::Result::FULL);
+
+ MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
+ MultiResult_i::TMainPart2SubPartNames::const_iterator anIter = theMainPart2SubPartNames.find(aMainPart);
+ if(anIter != theMainPart2SubPartNames.end()){
+ const MultiResult_i::TSubPartNames& aSubPartNames = anIter->second;
+
+ if(aSubPartNames.find(aMainPart + "_LOW") != aSubPartNames.end())
+ aResolutions.insert(VISU::Result::LOW);
+
+ if(aSubPartNames.find(aMainPart + "_MED") != aSubPartNames.end())
+ aResolutions.insert(VISU::Result::MEDIUM);
+ }
+ return aResolutions;
+ }
+
+
+ std::string
+ Resolutions2String(const MultiResult_i::TResolutions& theResolutions)
+ {
+ std::string aResult;
+ MultiResult_i::TResolutions::const_iterator anIter = theResolutions.begin();
+ for(; anIter != theResolutions.end(); anIter++){
+ VISU::Result::Resolution aResolution = *anIter;
+ if(aResolution == VISU::Result::FULL)
+ aResult += "F";
+ if(aResolution == VISU::Result::LOW)
+ aResult += "L";
+ if(aResolution == VISU::Result::MEDIUM)
+ aResult += "M";
+ }
+ return aResult;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ VISU::Result::Resolution
+ GetResolution(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
+ const std::string& thePartName)
+ {
+ MultiResult_i::TResolutions aResolutions = GetResolutions(theMainPart2SubPartNames, thePartName);
+
+ if(aResolutions.find(VISU::Result::LOW) != aResolutions.end())
+ return VISU::Result::LOW;
+
+ if(aResolutions.find(VISU::Result::MEDIUM) != aResolutions.end())
+ return VISU::Result::MEDIUM;
+
+ return VISU::Result::FULL;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ std::string
+ GetIconName(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
+ const std::string& thePartName)
+ {
+ VISU::Result::Resolution aResolution = GetResolution(theMainPart2SubPartNames,
+ thePartName);
+ if(aResolution == VISU::Result::LOW)
+ return "ICON_MULTIPR_VIEW_LOW";
+
+ if(aResolution == VISU::Result::MEDIUM)
+ return "ICON_MULTIPR_VIEW_MEDIUM";
+
+ return "ICON_MULTIPR_VIEW_FULL";
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildParts(Result_i* theResult,
+ Result_i::PInput theInput,
+ multipr::Obj* theMultiprObj,
+ MultiResult_i::TPartInfos* thePartInfos,
+ MultiResult_i::TPartName2FileName* thePartName2FileName,
+ MultiResult_i::TPartName2Resolution* thePartName2Resolution,
+ MultiResult_i::TMainPart2SubPartNames* theMainPart2SubPartNames,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ _PTR(Study) theStudy,
+ bool thePublishInStudy)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG, "BuildParts");
+ TResultManager aResultManager(theResult);
+ TTransactionManager aTransactionManager(theStudy);
+
+ try {
+ multipr::Obj& aMultiprObj = *theMultiprObj;
+ const VISU::TMeshMap& aMeshMap = theInput->GetMeshMap();
+ VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ const VISU::PMesh& aMesh = aMeshMapIter->second;
+
+ MultiResult_i::TPartNames aPartNames = aMultiprObj.getParts();
+
+ if(thePublishInStudy){
+ QString aComment = "Sub-parts: #";
+ aComment += QString::number(aPartNames.size());
+
+ CreateAttributes(theStudy,
+ aMesh->myPartsEntry,
+ NO_ICON,
+ NO_IOR,
+ "Parts",
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ false);
+ }
+
+ MultiResult_i::TPartInfos& aPartInfos = *thePartInfos;
+ MultiResult_i::TPartName2FileName& aPartName2FileName = *thePartName2FileName;
+ MultiResult_i::TPartName2Resolution& aPartName2Resolution = *thePartName2Resolution;
+
+ MultiResult_i::TMainPart2SubPartNames& aMainPart2SubPartNames = *theMainPart2SubPartNames;
+
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartName aMainPart = ExtractMainPart(aPartName);
+ aMainPart2SubPartNames[aMainPart].insert(aPartName);
+ }
+
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(aMultiprObj, aPartName);
+
+ QFileInfo aFileInfo(aPartInfo.myFileName.c_str());
+ aPartInfos[aFileInfo.fileName()] = aPartInfo;
+
+ aPartName2FileName[aPartInfo.myName] = aPartInfo.myFileName;
+
+ if(!thePublishInStudy)
+ continue;
+
+ QString aComment = "";
+ MultiResult_i::TResolutions aResoltutions = GetResolutions(aMainPart2SubPartNames, aPartInfo.myName);
+ std::string aResoltutionsString = Resolutions2String(aResoltutions);
+ if ( IsFullResolution(aPartInfo.myName) ) {
+ std::string anIconName = GetIconName(aMainPart2SubPartNames, aPartInfo.myName);
+ VISU::Result::Resolution aResolution = GetResolution(aMainPart2SubPartNames, aPartInfo.myName);
+ aComment.sprintf("myComment=PART;myMeshName=%s;myName=%s;myResolutions=%s;myState=%d",
+ aPartInfo.myMeshName.c_str(), aPartInfo.myName.c_str(), aResoltutionsString.c_str(), aResolution);
+ CreateAttributes(theStudy,
+ aMesh->myPartsEntry,
+ anIconName,
+ NO_IOR,
+ aPartInfo.myName,
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+ aPartName2Resolution[aPartInfo.myName] = aResolution;
+ }
+ }
+
+ *theIsDone = true;
+ }catch(std::exception& exc){
+ INFOS("Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was occured!");
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(), theIsDone));
+ }
+
+
+ //---------------------------------------------------------------
+ struct TBuildPartsArgs
+ {
+ Result_i* myResult;
+ Result_i::PInput myInput;
+ multipr::Obj* myMultiprObj;
+ MultiResult_i::TPartInfos* myPartInfos;
+ MultiResult_i::TPartName2FileName* myPartName2FileName;
+ MultiResult_i::TPartName2Resolution* myPartName2Resolution;
+ MultiResult_i::TMainPart2SubPartNames* myMainPart2SubPartNames;
+ CORBA::Boolean* myIsDone;
+ CORBA::Boolean myIsBuild;
+ _PTR(Study) myStudy;
+ bool myPublishInStudy;
+
+ TBuildPartsArgs(Result_i* theResult,
+ Result_i::PInput theInput,
+ multipr::Obj* theMultiprObj,
+ MultiResult_i::TPartInfos* thePartInfos,
+ MultiResult_i::TPartName2FileName* thePartName2FileName,
+ MultiResult_i::TPartName2Resolution* thePartName2Resolution,
+ MultiResult_i::TMainPart2SubPartNames* theMainPart2SubPartNames,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ _PTR(Study) theStudy,
+ bool thePublishInStudy):
+ myResult(theResult),
+ myInput(theInput),
+ myMultiprObj(theMultiprObj),
+ myPartInfos(thePartInfos),
+ myPartName2FileName(thePartName2FileName),
+ myPartName2Resolution(thePartName2Resolution),
+ myMainPart2SubPartNames(theMainPart2SubPartNames),
+ myIsDone(theIsDone),
+ myIsBuild(theIsBuild),
+ myStudy(theStudy),
+ myPublishInStudy(thePublishInStudy)
+ {}
+ };
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildParts(const TBuildPartsArgs& theArgs)
+ {
+ BuildParts(theArgs.myResult,
+ theArgs.myInput,
+ theArgs.myMultiprObj,
+ theArgs.myPartInfos,
+ theArgs.myPartName2FileName,
+ theArgs.myPartName2Resolution,
+ theArgs.myMainPart2SubPartNames,
+ theArgs.myIsDone,
+ theArgs.myIsBuild,
+ theArgs.myStudy,
+ theArgs.myPublishInStudy);
+ }
+
+
+ //---------------------------------------------------------------
+}
+
+
+//---------------------------------------------------------------
+VISU::MultiResult_i
+::MultiResult_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups):
+ Result_i(theStudy,
+ theSourceId,
+ theCreationId,
+ theIsBuildImmediately,
+ theIsBuildFields,
+ theIsBuildMinMax,
+ theIsBuildGroups)
+{}
+
+
+//---------------------------------------------------------------
+VISU::MultiResult_i
+::MultiResult_i()
+{}
+
+
+//---------------------------------------------------------------
+size_t
+VISU::MultiResult_i
+::IsPossible()
+{
+ return TSuperClass::IsPossible();
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::MultiResult_i
+::Build(SALOMEDS::SObject_ptr theSObject,
+ CORBA::Boolean theIsAtOnce)
+{
+ if(!TSuperClass::Build(theSObject, theIsAtOnce))
+ return NULL;
+
+ if(IsDone())
+ return this;
+
+ if(theIsAtOnce){
+ BuildParts(this,
+ GetInput(),
+ &myMultiprObj,
+ &myPartInfos,
+ &myPartName2FileName,
+ &myPartName2Resolution,
+ &myMainPart2SubPartNames,
+ &myIsPartsDone,
+ myIsBuildParts,
+ myStudy,
+ true);
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::MultiResult_i
+::BuildDataTree(const std::string& theResultEntry)
+{
+ BuildEntities(this,
+ GetInput(),
+ &myIsEntitiesDone,
+ theResultEntry,
+ false,
+ myIsBuildGroups,
+ myIsBuildFields,
+ myIsBuildParts,
+ myStudy);
+ {
+ TBuildPartsArgs anArgs(this,
+ GetInput(),
+ &myMultiprObj,
+ &myPartInfos,
+ &myPartName2FileName,
+ &myPartName2Resolution,
+ &myMainPart2SubPartNames,
+ &myIsPartsDone,
+ myIsBuildParts,
+ myStudy,
+ true);
+
+ boost::thread aThread(boost::bind(&BuildParts, anArgs));
+ }
+ {
+ boost::thread aThread(boost::bind(&BuildGroups,
+ this,
+ GetInput(),
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ false,
+ myStudy));
+ }
+ {
+ boost::thread aThread(boost::bind(&BuildFieldDataTree,
+ this,
+ GetInput(),
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ myStudy));
+ }
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::MultiResult_i
+::Create(const char* theFileName)
+{
+ QFileInfo aFileInfo(theFileName);
+ QString aTargetFileName = aFileInfo.filePath();
+ if(aTargetFileName.endsWith("_grains_maitre.med")){
+ myMultiprObj.create(theFileName);
+ if (myMultiprObj.isValidDistributedMEDFile()) {
+ aTargetFileName = myMultiprObj.getSequentialMEDFilename();
+ SetInitFileName(aFileInfo.filePath().latin1());
+ SetName(VISU::GenerateName(aFileInfo.fileName()).latin1(), false);
+ myIsBuildParts = true;
+ }
+ }
+
+ return TSuperClass::Create(aTargetFileName);
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::MultiResult_i
+::Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ bool theIsASCII,
+ TFileNames& theFileNames,
+ TFileNames& theFiles)
+{
+ bool anIsDone = Result_i::Save(theComponent,
+ theURL,
+ theIsMultiFile,
+ theIsASCII,
+ theFileNames,
+ theFiles);
+ if(!anIsDone)
+ return false;
+
+ if(!myMultiprObj.isValidDistributedMEDFile())
+ return true;
+
+ INITMSG(MYDEBUG, "MultiResult_i::Save - this = "<<this<<"\n");
+ INITMSGA(MYDEBUG, 0, "theIsMultiFile = "<<theIsMultiFile<<"; theIsASCII = "<<theIsASCII<<"\n");
+
+ // To generate an unique prefix for the set of multi sub files
+ std::string aPrefix;
+ if (theIsMultiFile) {
+ CORBA::String_var anURL = GetStudyDocument()->URL();
+ aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ }
+
+ std::string aBase, aSuffix;
+ SplitName(GetFileName(), aBase, aSuffix);
+ BEGMSG(MYDEBUG, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
+
+ aPrefix = aPrefix + "_" + aBase;
+ VISU::TSubString(aPrefix, ".med") = "";
+
+ BEGMSG(MYDEBUG, "aPrefix = '"<<aPrefix<<"'\n");
+
+ // To get a common prefix used in the multi file
+ QFileInfo aFileInfo(myMultiprObj.getSequentialMEDFilename());
+ std::string aFilePrefix = aFileInfo.baseName(TRUE).latin1();
+
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(myMultiprObj, aPartName);
+
+ QFileInfo aFileInfo(aPartInfo.myFileName.c_str());
+ std::string aFile = aFileInfo.absFilePath().latin1();
+
+ std::string aFileName = aFileInfo.fileName().latin1();
+ VISU::TSubString(aFileName, aFilePrefix) = aPrefix;
+ VISU::TSubString(aFileName, aSuffix) = "";
+ aFileName = aFileName + aSuffix;
+ INITMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
+
+ if(theIsMultiFile || theIsASCII){
+ std::string aPathToCopy(theURL + aFileName);
+ BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
+
+ if(!VISU::CopyFile(aFile, aPathToCopy))
+ return false;
+
+ if(theIsASCII)
+ HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ }
+
+ theFileNames.push_back(aFileName);
+ theFiles.push_back(aFile);
+ }
+
+ return true;
+}
+
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::MultiResult_i
+::CanCopy(SALOMEDS::SObject_ptr theObject)
+{
+ if(!myIsPartsDone)
+ return Result_i::CanCopy(theObject);
+
+ return false;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::MultiResult_i
+::ToStream(std::ostringstream& theStr)
+{
+ INITMSG(MYDEBUG, "MultiResult_i::ToStream - this = "<<this<<"\n");
+
+ TSuperClass::ToStream(theStr);
+
+ Storable::DataToStream(theStr,"myIsBuildParts", myIsPartsDone);
+ if(!myIsPartsDone)
+ return;
+
+ {
+ std::ostringstream aPartNames, aResolutions;
+ TPartName2Resolution::const_iterator anIter = myPartName2Resolution.begin();
+ for ( ; anIter != myPartName2Resolution.end() ; anIter++) {
+ const TPartName& aPartName = anIter->first;
+ aPartNames<<aPartName<<"|";
+ const VISU::Result::Resolution& aResolution = anIter->second;
+ aResolutions<<aResolution<<"|";
+ }
+
+ Storable::DataToStream(theStr, "myPartNames", aPartNames.str().c_str());
+ Storable::DataToStream(theStr, "myResolutions", aResolutions.str().c_str());
+ }
+
+ {
+ std::string aBase, aSuffix;
+ VISU::SplitName(GetFileName(), aBase, aSuffix);
+ INITMSG(MYDEBUG, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
+
+ QFileInfo aFileInfo(myMultiprObj.getSequentialMEDFilename());
+ std::string aFilePrefix = aFileInfo.baseName(TRUE).latin1();
+ BEGMSG(MYDEBUG, "aFilePrefix = '"<<aFilePrefix<<"'\n");
+
+ std::ostringstream aPartInfos;
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(myMultiprObj, aPartName);
+
+ QFileInfo aFileInfo(aPartInfo.myFileName.c_str());
+ std::string aFileName = aFileInfo.fileName().latin1();
+ VISU::TSubString(aFileName, aFilePrefix + "_") = "";
+ VISU::TSubString(aFileName, aSuffix) = "";
+ aPartInfo.myFileName = aFileName + aSuffix;
+ aPartInfos<<aPartInfo<<"|";
+
+ INITMSG(MYDEBUG, "aFileName = '"<<aPartInfo.myFileName<<"'\n");
+ }
+
+ Storable::DataToStream(theStr, "myPartInfos", aPartInfos.str().c_str());
+ }
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::MultiResult_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
+{
+ INITMSG(MYDEBUG, "MultiResult_i::Restore - this = "<<this<<"\n");
+
+ if(!TSuperClass::Restore(theSObject, theMap, thePrefix, theIsMultiFile))
+ return NULL;
+
+ myIsBuildParts = Storable::FindValue(theMap, "myIsBuildParts", "0").toInt();
+ if(!myIsBuildParts)
+ return this;
+
+ QStringList aResolutions = QStringList::split("|", VISU::Storable::FindValue(theMap, "myResolutions"));
+ QStringList aPartNames = QStringList::split("|",VISU::Storable::FindValue(theMap, "myPartNames") );
+ for(size_t anId = 0, anEnd = aPartNames.size(); anId < anEnd; anId++){
+ const QString& aPartName = aPartNames[anId];
+ VISU::Result::Resolution aResolution = VISU::Result::Resolution(aResolutions[anId].toInt());
+ myPartName2Resolution[aPartName.latin1()] = aResolution;
+ INITMSG(MYDEBUG, "aPartName = '"<<aPartName<<"' = "<<aResolution<<"\n");
+ }
+
+ std::string aBase, aSuffix;
+ SplitName(GetFileName(), aBase, aSuffix);
+ INITMSGA(MYDEBUG, 0, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
+
+ std::string aSourceFileName = GetFileInfo().absFilePath().latin1();
+ BEGMSG(MYDEBUG, "aSourceFileName = '"<<aSourceFileName<<"'\n");
+
+ std::string aPrefix = aSourceFileName;
+ VISU::TSubString(aPrefix, ".med") = "";
+ VISU::TSubString(aPrefix, aSuffix) = "";
+ BEGMSG(MYDEBUG, "aPrefix = '"<<aPrefix<<"'\n");
+
+ std::string aMultiFileName(aPrefix + "_grains_maitre.med" + aSuffix);
+ BEGMSG(MYDEBUG, "aMultiFileName = '"<<aMultiFileName<<"'\n");
+
+ {
+ std::ofstream aMultiFileStream(aMultiFileName.c_str());
+ aMultiFileStream<<"# MED file v2.3 - Master file created by VISU\n";
+ aMultiFileStream<<"#\n";
+ aMultiFileStream<<"# [SOURCE]="<<aSourceFileName<<"\n";
+ aMultiFileStream<<"#\n";
+
+ QStringList aPartInfos = QStringList::split("|", VISU::Storable::FindValue(theMap, "myPartInfos"));
+ aMultiFileStream<<aPartInfos.size()<<"\n";
+
+ for(size_t anId = 0, anEnd = aPartInfos.size(); anId < anEnd; anId++){
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(aPartInfos[anId].latin1());
+ aPartInfo.myFileName = aPrefix + "_" + aPartInfo.myFileName;
+ INITMSG(MYDEBUG, "aPartInfo.myFileName = '"<<aPartInfo.myFileName<<"'\n");
+ aMultiFileStream<<aPartInfo<<"\n";
+ }
+ }
+
+ {
+ myMultiprObj.create(aMultiFileName.c_str());
+ BuildParts(this,
+ GetInput(),
+ &myMultiprObj,
+ &myPartInfos,
+ &myPartName2FileName,
+ &myPartName2Resolution,
+ &myMainPart2SubPartNames,
+ &myIsPartsDone,
+ myIsBuildParts,
+ myStudy,
+ false);
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::MultiResult_i
+::IsDone()
+{
+ return TSuperClass::IsDone() &&
+ (myIsBuildParts? myIsPartsDone: true);
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::MultiResult_i
+::GetPartNames(const char* theMeshName)
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ if(!myIsBuildParts)
+ return aResult._retn();
+
+ MultiResult_i::TPartNames aMeshParts;
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ if(!IsFullResolution(aPartName))
+ continue;
+
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(myMultiprObj, aPartName);
+ if(aPartInfo.myMeshName == theMeshName)
+ aMeshParts.push_back(aPartName);
+ }
+
+ if(aMeshParts.empty())
+ return aResult._retn();
+
+ aResult->length(aMeshParts.size());
+ for (size_t aPartID = 0 ; aPartID < aMeshParts.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aMeshParts[aPartID];
+ aResult[aPartID] = aPartName.c_str();
+ }
+
+ return aResult._retn();
+}
+
+VISU::Result::Resolutions*
+VISU::MultiResult_i
+::GetResolutions(const char* theMeshName,
+ const char* thePartName)
+{
+ VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
+ if(!myIsBuildParts)
+ return aResult._retn();
+
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
+ if(aMainPart != thePartName)
+ continue;
+
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(myMultiprObj, aPartName);
+ if(aPartInfo.myMeshName != theMeshName)
+ continue;
+
+ MultiResult_i::TResolutions aResolutions = VISU::GetResolutions(myMainPart2SubPartNames, thePartName);
+ if(aResolutions.empty())
+ return aResult._retn();
+
+ aResult->length(aResolutions.size());
+ MultiResult_i::TResolutions::const_iterator anIter = aResolutions.end();
+ for(size_t anId = 0; anIter != aResolutions.end(); anIter++, anId++){
+ const VISU::Result::Resolution& aResolution = *anIter;
+ aResult[anId] = aResolution;
+ }
+
+ break;
+ }
+
+ return aResult._retn();
+}
+
+VISU::Result::Resolution
+VISU::MultiResult_i
+::GetResolution(const char* theMeshName,
+ const char* thePartName)
+{
+ TPartName2Resolution::iterator anIter = myPartName2Resolution.find(thePartName);
+ if(anIter == myPartName2Resolution.end())
+ return VISU::Result::HIDDEN;
+
+ const VISU::Result::Resolution& aResolution = anIter->second;
+ return aResolution;
+}
+
+void
+VISU::MultiResult_i
+::SetResolution(const char* theMeshName,
+ const char* thePartName,
+ VISU::Result::Resolution theResolution)
+{
+ if(!IsFullResolution(thePartName))
+ return;
+
+ TPartName2Resolution::iterator anIter = myPartName2Resolution.find(thePartName);
+ if(anIter == myPartName2Resolution.end())
+ return;
+
+ VISU::Result::Resolution& aResolution = anIter->second;
+ if(aResolution == theResolution)
+ return;
+
+ if(theResolution != VISU::Result::HIDDEN){
+ MultiResult_i::TResolutions aResolutions = VISU::GetResolutions(myMainPart2SubPartNames, thePartName);
+ MultiResult_i::TResolutions::iterator anIter = aResolutions.find(theResolution);
+ if(anIter == aResolutions.end())
+ return;
+ }
+
+ VISU::Storable::TRestoringMap aRestoringMap;
+ aRestoringMap["myComment"] = "PART";
+ aRestoringMap["myMeshName"] = theMeshName;
+ aRestoringMap["myName"] = thePartName;
+
+ const VISU::TMeshMap& aMeshMap = Result_i::GetInput()->GetMeshMap();
+ VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(theMeshName);
+ if(aMeshIter == aMeshMap.end())
+ return;
+
+ std::string aFatherEntry;
+ const VISU::PMesh& aMesh = aMeshIter->second;
+ if(aMesh->myPartsEntry != "")
+ aFatherEntry = Storable::FindEntry(GetStudyDocument(),
+ aMesh->myPartsEntry,
+ aRestoringMap);
+ else
+ aFatherEntry = Result_i::GetEntry(aRestoringMap);
+
+ std::string anIconName = "ICON_MULTIPR_VIEW_HIDE";
+ if(theResolution == VISU::Result::FULL)
+ anIconName = "ICON_MULTIPR_VIEW_FULL";
+ else if(theResolution == VISU::Result::MEDIUM)
+ anIconName = "ICON_MULTIPR_VIEW_MEDIUM";
+ else if(theResolution == VISU::Result::LOW)
+ anIconName = "ICON_MULTIPR_VIEW_LOW";
+
+ _PTR(Study) aStudy = GetStudy();
+ _PTR(SObject) aSObject = aStudy->FindObjectID(aFatherEntry);
+ aRestoringMap = Storable::GetStorableMap(aSObject);
+
+ std::ostrstream anOutputStream;
+ anOutputStream<<"myComment=PART;";
+ anOutputStream<<"myName="<<thePartName<<";";
+ anOutputStream<<"myMeshName="<<theMeshName<<";";
+ anOutputStream<<"myResolutions="<<aRestoringMap["myResolutions"]<<";";
+ anOutputStream<<"myState="<<theResolution;
+ anOutputStream<<ends;
+
+ CreateAttributes(aStudy,
+ aFatherEntry,
+ anIconName,
+ NO_IOR,
+ NO_NAME,
+ NO_PERFSITENT_REF,
+ anOutputStream.str(),
+ false);
+
+ aResolution = theResolution;
+}
+
+
+//---------------------------------------------------------------
+VISU::MultiResult_i
+::~MultiResult_i()
+{
+ INITMSG(MYDEBUG, "MultiResult_i::~MultiResult_i - this = "<<this<<"\n");
+ if(myIsBuildParts){
+ TRepresentation2Input::iterator anIter = myRepresentation2Input.begin();
+ for ( ; anIter != myRepresentation2Input.end() ; anIter++) {
+ const PInput& anInput = anIter->second;
+ std::string aFileName = anInput->GetName();
+ INITMSG(MYDEBUG, "RemoveFile - aFileName = '"<<aFileName<<"'\n");
+ VISU::RemoveFile(aFileName);
+ }
+ if (GetSourceId() == eRestoredFile) {
+ INITMSG(MYDEBUG, "RemoveFile - myMultiprObj.getMEDFilename = '"<<myMultiprObj.getMEDFilename()<<"'\n");
+ VISU::RemoveFile(myMultiprObj.getMEDFilename());
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ MultiResult_i::TPartInfo aPartInfo = GetPartInfo(myMultiprObj, aPartName);
+ INITMSG(MYDEBUG, "RemoveFile - aPartInfo.myFileName = '"<<aPartInfo.myFileName<<"'\n");
+ VISU::RemoveFile(aPartInfo.myFileName);
+ }
+ }
+ }
+}
+
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ inline
+ void
+ UpdateRepresentationKey(const MultiResult_i::TPartName2FileName& thePartName2FileName,
+ MultiResult_i::TRepresentationKey& theRepresentationKey,
+ const std::string& thePartName)
+ {
+ MultiResult_i::TPartName2FileName::const_iterator anIterator = thePartName2FileName.find(thePartName);
+ if (anIterator != thePartName2FileName.end()){
+ const MultiResult_i::TFileName& aFileName = anIterator->second;
+ theRepresentationKey.insert(aFileName);
+ }
+ }
+
+
+ //---------------------------------------------------------------
+ MultiResult_i::TRepresentationKey
+ GetRepresentation(const MultiResult_i::TPartName2FileName& thePartName2FileName,
+ const MultiResult_i::TPartName2Resolution& thePartName2Resolution)
+ {
+ // name of selected parts
+ MultiResult_i::TRepresentationKey aRepresentationKey;
+
+ // for each part of the mesh
+ MultiResult_i::TPartName2Resolution::const_iterator anIter = thePartName2Resolution.begin();
+ for ( ; anIter != thePartName2Resolution.end() ; anIter++) {
+ const MultiResult_i::TPartName& aPartName = anIter->first;
+ if(IsFullResolution(aPartName)){
+ const VISU::Result::Resolution& aResolution = anIter->second;
+ if(aResolution == VISU::Result::FULL)
+ UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName);
+ if(aResolution == VISU::Result::MEDIUM)
+ UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName + "_MED");
+ else if(aResolution == VISU::Result::LOW)
+ UpdateRepresentationKey(thePartName2FileName, aRepresentationKey, aPartName + "_LOW");
+ }
+ }
+ return aRepresentationKey;
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ UseInitialInput(const MultiResult_i::TPartName2FileName& thePartName2FileName,
+ const MultiResult_i::TPartName2Resolution& thePartName2Resolution)
+ {
+ bool aResult = true;
+ MultiResult_i::TPartName2FileName::const_iterator anIter = thePartName2FileName.begin();
+ for ( ; anIter != thePartName2FileName.end() ; anIter++) {
+ const MultiResult_i::TPartName& aPartName = anIter->first;
+ if(IsFullResolution(aPartName)){
+ MultiResult_i::TPartName2Resolution::const_iterator anIter2 = thePartName2Resolution.find(aPartName);
+ if(anIter2 != thePartName2Resolution.end()){
+ const VISU::Result::Resolution& aResolution = anIter2->second;
+ if(aResolution == VISU::Result::FULL)
+ continue;
+ }
+ aResult = false;
+ break;
+ }
+ }
+ return aResult;
+ }
+}
+
+
+//---------------------------------------------------------------
+VISU::Result_i::PInput
+VISU::MultiResult_i
+::GetInput(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber)
+{
+ if(theEntity == NONE) // If client wants use initial behaviour
+ return TSuperClass::GetInput();
+
+ if(!myIsPartsDone) // If corresponding data is not ready yet
+ return TSuperClass::GetInput();
+
+ //if(UseInitialInput(myPartName2FileName, myPartName2Resolution))
+ // return TSuperClass::GetInput();
+
+ MultiResult_i::TRepresentationKey aRepresentationKey =
+ GetRepresentation(myPartName2FileName, myPartName2Resolution);
+
+ typedef std::vector<TFileName> TFileNames;
+ TFileNames aFileNames(aRepresentationKey.begin(), aRepresentationKey.end());
+
+ aRepresentationKey.insert( theMeshName );
+ aRepresentationKey.insert( theFieldName );
+
+ TRepresentation2Input::iterator anIter = myRepresentation2Input.find(aRepresentationKey);
+ if(anIter == myRepresentation2Input.end()){
+ INITMSG(MYDEBUG, "MultiResult_i::GetInput - this = "<<this<<"\n");
+ std::string aFileName = SALOMEDS_Tool::GetTmpDir() + "multipr_merge.med";
+ if(MYDEBUG){
+ INITMSG(MYDEBUG, "aFileName = '"<<aFileName<<"':\n");
+ TFileNames::const_iterator anIter = aFileNames.begin();
+ for ( ; anIter != aFileNames.end() ; anIter++) {
+ const MultiResult_i::TFileName& aFileName = *anIter;
+ INITMSG(MYDEBUG, "'"<<aFileName<<"'\n");
+ }
+ }
+ int aRes = false;
+ std::string anErrorMessage("empty mesh");
+ try {
+ INITMSG(MYDEBUG, "theMeshName = '"<<aFileName<<"'; theFieldName = '"<<theFieldName<<"'\n");
+ aRes = multipr::merge(aFileNames, theMeshName.c_str(), theFieldName.c_str(), aFileName.c_str());
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ anErrorMessage = exc.what();
+ }catch(multipr::RuntimeException& exc){
+ std::ostringstream aStream;
+ exc.dump(aStream);
+ aStream<<ends;
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<aStream.str());
+ anErrorMessage = aStream.str();
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+ INITMSGA(MYDEBUG, 0, "aRes = "<<aRes<<"\n");
+ if (aRes == 0) {
+ VISU::RemoveFile(aFileName);
+ throw std::runtime_error(anErrorMessage);
+ }
+ PInput anInput(CreateConvertor(aFileName));
+ anInput->BuildFields();
+ if(myIsBuildMinMax)
+ anInput->BuildMinMax();
+ myRepresentation2Input[aRepresentationKey] = anInput;
+ return anInput;
+ }
+
+ return anIter->second;
+}
+
+
+#endif // ENABLE_MULTIPR
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_MultiResult_i.hh
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef __VISU_MULTI_RESULT_I_H__
+#define __VISU_MULTI_RESULT_I_H__
+
+#ifndef ENABLE_MULTIPR
+# define RESULT_CLASS_NAME Result_i
+#else
+# define RESULT_CLASS_NAME MultiResult_i
+
+#include "VISU_Result_i.hh"
+#include "MULTIPR_Obj.hxx"
+
+#include <set>
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ class MultiResult_i : public virtual Result_i
+ {
+ MultiResult_i(const MultiResult_i&);
+
+ public:
+ typedef Result_i TSuperClass;
+
+ MultiResult_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups);
+
+ MultiResult_i();
+
+ virtual
+ ~MultiResult_i();
+
+ virtual
+ CORBA::Boolean
+ IsDone();
+
+ virtual
+ VISU::Result::EntityNames*
+ GetPartNames(const char* theMeshName);
+
+ virtual
+ VISU::Result::Resolutions*
+ GetResolutions(const char* theMeshName,
+ const char* thePartName);
+
+ virtual
+ VISU::Result::Resolution
+ GetResolution(const char* theMeshName,
+ const char* thePartName);
+
+ virtual
+ void
+ SetResolution(const char* theMeshName,
+ const char* thePartName,
+ VISU::Result::Resolution theResolution);
+
+
+ typedef std::string TPartName;
+ typedef std::vector<TPartName> TPartNames;
+
+ typedef size_t TPartID;
+ typedef std::string TPath;
+ typedef std::string TMeshName;
+
+ struct TPartInfo
+ {
+ TMeshName myMeshName;
+ TPartName myName;
+ TPartID myPartID;
+ TPath myPath;
+ TFileName myFileName;
+ };
+
+ typedef std::map<TFileName, TPartInfo> TPartInfos;
+ TPartInfos myPartInfos;
+
+ typedef std::map<TPartName, TFileName> TPartName2FileName;
+ typedef std::map<TPartName, VISU::Result::Resolution> TPartName2Resolution;
+ typedef std::set<VISU::Result::Resolution> TResolutions;
+
+ typedef std::set<std::string> TRepresentationKey;
+ typedef std::map<TRepresentationKey, PInput> TRepresentation2Input;
+
+ typedef std::set<TPartName> TSubPartNames;
+ typedef std::map<TPartName, TSubPartNames> TMainPart2SubPartNames;
+
+ private:
+ multipr::Obj myMultiprObj;
+ TPartName2FileName myPartName2FileName;
+ TPartName2Resolution myPartName2Resolution;
+ TMainPart2SubPartNames myMainPart2SubPartNames;
+
+ TRepresentation2Input myRepresentation2Input;
+
+ protected:
+ virtual
+ Storable*
+ Build(SALOMEDS::SObject_ptr theSObject,
+ CORBA::Boolean theIsAtOnce = true) ;
+
+ virtual
+ void
+ BuildDataTree(const std::string& theResultEntry);
+
+ public:
+ virtual
+ size_t
+ IsPossible();
+
+ virtual
+ Storable*
+ Create(const char* theFileName);
+
+ virtual
+ Storable*
+ Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
+
+ //---------------------------------------------------------------
+ virtual
+ bool
+ Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ bool theIsASCII,
+ TFileNames& theFileNames,
+ TFileNames& theFiles);
+
+ virtual
+ CORBA::Boolean
+ CanCopy(SALOMEDS::SObject_ptr theObject);
+
+ virtual
+ void
+ ToStream(std::ostringstream& theStr);
+
+ virtual
+ PInput
+ GetInput(const std::string& theMeshName = "",
+ VISU::Entity theEntity = VISU::NONE,
+ const std::string& theFieldName = "",
+ CORBA::Long theTimeStampNumber = -1);
+ };
+
+}
+
+#endif // ENABLE_MULTIPR
+
+#endif // __VISU_MULTI_RESULT_I_H__
//
#include "VISU_Plot3D_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_Plot3DPL.hxx"
}
};
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TEvent(GetSpecificPL(),
VISU_CutPlanesPL::PlaneOrientation(theOrient),
theXAngle,
::SetPlanePosition(CORBA::Double thePlanePosition,
CORBA::Boolean theIsRelative)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_Plot3DPL, vtkFloatingPointType, bool>
(GetSpecificPL(), &VISU_Plot3DPL::SetPlanePosition, thePlanePosition, theIsRelative));
}
VISU::Plot3D_i
::SetScaleFactor(CORBA::Double theScaleFactor)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_Plot3DPL, vtkFloatingPointType>
(GetSpecificPL(), &VISU_Plot3DPL::SetScaleFactor, theScaleFactor));
}
VISU::Plot3D_i
::SetNbOfContours(CORBA::Long theNb)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_Plot3DPL, int>
(GetSpecificPL(), &VISU_Plot3DPL::SetNumberOfContours, theNb));
}
VISU::Plot3D_i
::SetContourPrs(CORBA::Boolean theIsContourPrs)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_Plot3DPL, bool>
(GetSpecificPL(), &VISU_Plot3DPL::SetContourPrs, theIsContourPrs));
}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_Prs3dUtils.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "VISU_Prs3dUtils.hh"
+#include "SalomeApp_Study.h"
+#include "SALOME_Event.hxx"
+
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ TSetModified
+ ::TSetModified(VISU::Prs3d_i* thePrs3d):
+ myPrs3d(thePrs3d)
+ {
+ this->Modified();
+ }
+
+
+ //----------------------------------------------------------------------------
+ TSetModified
+ ::~TSetModified()
+ {
+ struct TEvent: public SALOME_Event
+ {
+ VISU::TSetModified* mySetModified;
+ TEvent(VISU::TSetModified* theSetModified):
+ mySetModified(theSetModified)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::Prs3d_i* aPrs3d = mySetModified->myPrs3d;
+
+ if(!aPrs3d || aPrs3d->GetActorEntry() == "")
+ return;
+
+ if(aPrs3d->GetMTime() > mySetModified->GetMTime()){
+ if(SalomeApp_Study* aStudy = aPrs3d->GetGUIStudy())
+ aStudy->Modified();
+ }
+ }
+ };
+
+ ProcessVoidEvent(new TEvent(this));
+ }
+
+
+ //----------------------------------------------------------------------------
+};
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_Prs3dUtils.hh
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef __VISU_PRS3D_UTILS_H__
+#define __VISU_PRS3D_UTILS_H__
+
+#include "VISU_Prs3d_i.hh"
+
+#include <vtkTimeStamp.h>
+
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ struct TSetModified: vtkTimeStamp
+ {
+ VISU::Prs3d_i* myPrs3d;
+
+ TSetModified(VISU::Prs3d_i* thePrs3d);
+
+ ~TSetModified();
+ };
+
+
+ //----------------------------------------------------------------------------
+}
+
+
+#endif // __VISU_PRS3D_UTILS_H__
// Author : Alexey PETROV
// Module : VISU
-#include "VISU_PipeLine.hxx"
#include "VISU_Prs3d_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_PipeLine.hxx"
#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
::SameAs(const Prs3d_i* theOrigin)
{
if(Prs3d_i* anOrigin = const_cast<Prs3d_i*>(theOrigin)){
+ VISU::TSetModified aModified(this);
+
GetPipeLine()->SameAs(anOrigin->GetPipeLine());
anOrigin->GetOffset(myOffset);
}
VISU::Prs3d_i
::SetCResult(VISU::Result_i* theResult)
{
- VISU::Result_i* aResult = GetCResult();
- if(aResult != theResult){
- if(aResult)
- aResult->Destroy();
- if(theResult){
- theResult->Register();
- SetStudyDocument(theResult->GetStudyDocument());
- }
- myResult = theResult;
- myParamsTime.Modified();
- }
+ if(GetCResult() == theResult)
+ return;
+
+ if(theResult)
+ SetStudyDocument(theResult->GetStudyDocument());
+
+ VISU::TSetModified aModified(this);
+
+ myResult = theResult;
+ myParamsTime.Modified();
}
//----------------------------------------------------------------------------
VISU::Prs3d_i
::SetMeshName(const char* theMeshName)
{
- if(myMeshName != theMeshName){
- myMeshName = theMeshName;
- myParamsTime.Modified();
- }
+ if(myMeshName == theMeshName)
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myMeshName = theMeshName;
+ myParamsTime.Modified();
}
{
unsigned long int aTime = myParamsTime.GetMTime();
if(IsPipeLineExists())
- aTime = std::max(aTime,GetPipeLine()->GetMTime());
+ aTime = std::max(aTime, GetPipeLine()->GetMTime());
return aTime;
}
namespace VISU
{
+ //----------------------------------------------------------------------------
class Result_i;
+
+ //----------------------------------------------------------------------------
+ struct TResultObserver: public virtual boost::signalslib::trackable
+ {
+ virtual
+ void
+ UpdateFromResult(Result_i* theResult) = 0;
+ };
+
+
//----------------------------------------------------------------------------
//! Base class for all VTK 3D presentations.
/*!
- implement basic actor management (CreateActor, UpdateActor, UpdateActors, RemoveActor and RemoveActors);
- implement common 3D functionality like "clipping planes" and offset.
*/
- class VISU_I_EXPORT Prs3d_i :
- public virtual POA_VISU::Prs3d,
- public virtual SALOME::GenericObj_i,
- public virtual TActorFactory,
- public virtual PrsObject_i
+ class VISU_I_EXPORT Prs3d_i : public virtual POA_VISU::Prs3d,
+ public virtual SALOME::GenericObj_i,
+ public virtual TActorFactory,
+ public virtual PrsObject_i
{
Prs3d_i(const Prs3d_i&);
Handle(SALOME_InteractiveObject)
GetIO();
+ //! Used in derived classes to initilize the IO for actors
+ virtual
+ std::string
+ GetActorEntry();
+
protected:
/*!
Used in Apply method to get know whether it is possible to create presentation
vtkTimeStamp myUpdateTime;
vtkTimeStamp myParamsTime;
- //! Used in derived classes to initilize the IO for actors
- virtual
- std::string
- GetActorEntry();
-
private:
void
SetResultEntry(const std::string& theResultEntry);
{
myName = theName;
if(theIsUpdateStudyAttr){
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(GetEntry().c_str());
+ SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(GetEntry().c_str());
if(!aSObject->_is_nil()){
- SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aBuilder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" );
SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
aNameAttr->SetValue( theName.c_str() );
//---------------------------------------------------------------
-const std::string&
+std::string
VISU::RemovableObject_i
::GetName() const
{
//---------------------------------------------------------------
-const SALOMEDS::Study_var&
+SALOMEDS::Study_var
VISU::RemovableObject_i
::GetStudyDocument() const
{
- return myStudy;
+ return myStudyDocument;
+}
+
+
+//---------------------------------------------------------------
+SalomeApp_Study*
+VISU::RemovableObject_i
+::GetGUIStudy() const
+{
+ return myGUIStudy;
}
VISU::RemovableObject_i
::SetStudyDocument(SALOMEDS::Study_ptr theStudy)
{
- myStudy = SALOMEDS::Study::_duplicate(theStudy);
+ myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+ myGUIStudy = VISU::GetGUIStudy(theStudy);
}
::GetEntry()
{
CORBA::String_var anIOR = GetID();
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in());
+ SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectIOR(anIOR.in());
CORBA::String_var anEntry("");
if(!CORBA::is_nil(aSObject.in()))
anEntry = aSObject->GetID();
virtual
~RemovableObject_i();
- const SALOMEDS::Study_var&
+ SALOMEDS::Study_var
GetStudyDocument() const;
+ SalomeApp_Study*
+ GetGUIStudy() const;
+
virtual
std::string
GetEntry();
virtual
- const std::string&
+ std::string
GetName() const;
virtual
private:
std::string myName;
- SALOMEDS::Study_var myStudy;
+ SalomeApp_Study* myGUIStudy;
+ SALOMEDS::Study_var myStudyDocument;
RemovableObject_i(const RemovableObject_i&);
};
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_ResultUtils.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "VISU_ResultUtils.hh"
+
+#include "SUIT_Session.h"
+#include "SALOME_Event.hxx"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include <qfileinfo.h>
+#include <qfile.h>
+#include <qdir.h>
+
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+
+#ifdef _DEBUG_
+static int MYTIMEDEBUG = 0;
+#else
+static int MYTIMEDEBUG = 0;
+#endif
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ typedef boost::recursive_mutex TMutex;
+ typedef TMutex::scoped_lock TLock;
+
+ static TMutex myMutex;
+
+ //----------------------------------------------------------------------------
+ TResultManager
+ ::TResultManager(Result_i* theResult):
+ myResult(theResult)
+ {
+ myResult->Register();
+ }
+
+
+ //----------------------------------------------------------------------------
+ TResultManager
+ ::~TResultManager()
+ {
+ myResult->Destroy();
+ }
+
+
+ //----------------------------------------------------------------------------
+ TTransactionManager
+ ::TTransactionManager(_PTR(Study) theStudyDocument):
+ myStudyBuilder(theStudyDocument->NewBuilder())
+ {
+ TLock aLock(myMutex);
+ myStudyBuilder->NewCommand();
+ }
+
+
+ //----------------------------------------------------------------------------
+ TTransactionManager
+ ::~TTransactionManager()
+ {
+ TLock aLock(myMutex);
+ myStudyBuilder->CommitCommand();
+ }
+
+
+ //----------------------------------------------------------------------------
+ TUpdateObjBrowser
+ ::TUpdateObjBrowser(const int theStudyId, CORBA::Boolean* theIsDone):
+ myStudyId(theStudyId),
+ myIsDone(theIsDone)
+ {}
+
+
+ //----------------------------------------------------------------------------
+ void
+ TUpdateObjBrowser
+ ::Execute()
+ {
+ TLock aLock(myMutex);
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* aSApp = anIter.current()) {
+ if(SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSApp)){
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy())) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (myStudyId == aCStudy->StudyId()) {
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::updateObjectBrowser");
+ anApp->updateObjectBrowser();
+ *myIsDone = true;
+ break;
+ }
+ }
+ }
+ }
+ ++anIter;
+ }
+ }
+
+
+ //----------------------------------------------------------------------------
+ QString
+ GenerateName(const std::string& theName)
+ {
+ TLock aLock(myMutex);
+
+ typedef std::map<std::string, int> TNameMap;
+ static TNameMap aMap;
+
+ TNameMap::const_iterator anIter = aMap.find(theName);
+ QString aResult;
+ if (anIter == aMap.end()) {
+ aMap[theName] = 0;
+ aResult = theName;
+ } else {
+ aResult = GenerateName(theName,++aMap[theName]);
+ }
+ return aResult;
+ }
+
+
+ //----------------------------------------------------------------------------
+ bool
+ SplitName(const std::string& theName,
+ std::string& theBase,
+ std::string& theSuffix,
+ char theDelimeter)
+ {
+ size_t aPosition = theName.rfind(theDelimeter);
+ if(aPosition == std::string::npos){
+ theBase = theName;
+ theSuffix = "";
+ return false;
+ }
+
+ theBase = theName.substr(0, aPosition);
+ theSuffix = theName.substr(aPosition);
+ return true;
+ }
+
+
+ //----------------------------------------------------------------------------
+ std::string
+ MakeFileName(const std::string& theName,
+ const void* thePointer)
+ {
+ std::ostringstream aStream;
+ aStream<<theName<<":"<<thePointer;
+ return aStream.str();
+ }
+
+
+ //----------------------------------------------------------------------------
+ QString
+ GenerateFieldName(const std::string& theName,
+ const std::string& theUnits)
+ {
+ QString aName;
+ const string tmp (theUnits.size(),' ');
+ if (theUnits == "" || theUnits == tmp)
+ aName.sprintf("%s, -",theName.c_str());
+ else
+ aName.sprintf("%s, %s",theName.c_str(),theUnits.c_str());
+ aName = aName.simplifyWhiteSpace();
+ return aName.latin1();
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ CreateReference(_PTR(Study) theStudyDocument,
+ const std::string& theFatherEntry,
+ const std::string& theRefEntry)
+ {
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
+ _PTR(SObject) aNewObj = aStudyBuilder->NewObject(aFather);
+ _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
+ aStudyBuilder->Addreference(aNewObj,aRefSObj);
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ RemoveSObject(_PTR(Study) theStudyDocument,
+ const string& theEntry)
+ {
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry);
+ aStudyBuilder->RemoveObject(aSObject);
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildEntities(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ const std::string& theResultEntry,
+ CORBA::Boolean theIsAtOnce,
+ CORBA::Boolean theIsBuildGroups,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildParts,
+ _PTR(Study) theStudy)
+ {
+ if(*theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildEntities");
+ TResultManager aResultManager(theResult);
+ TTransactionManager aTransactionManager(theStudy);
+
+ {
+ TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildEntities");
+ theInput->BuildEntities();
+ }
+
+ QString aComment,aTmp;
+ const TMeshMap& aMeshMap = theInput->GetMeshMap();
+ TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+ const string& aMeshName = aMeshMapIter->first;
+ const PMesh& aMesh = aMeshMapIter->second;
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ continue;
+ aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+ aMeshName.c_str(),
+ aMesh->myDim);
+ aMesh->myEntry =
+ CreateAttributes(theStudy,
+ theResultEntry,
+ NO_ICON,
+ NO_IOR,
+ aMeshName,
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+
+ aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
+ aMeshName.c_str());
+ std::string aSubMeshesEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ NO_ICON,
+ NO_IOR,
+ "Families",
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+
+ if(theIsBuildGroups){
+ aMesh->myGroupsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ NO_ICON,
+ NO_IOR,
+ NO_NAME,
+ NO_PERFSITENT_REF,
+ NO_COMMENT,
+ true);
+ }
+
+ if(theIsBuildFields){
+ aMesh->myFieldsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ NO_ICON,
+ NO_IOR,
+ NO_NAME,
+ NO_PERFSITENT_REF,
+ NO_COMMENT,
+ true);
+ }
+
+ if(theIsBuildParts){
+ aMesh->myPartsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ NO_ICON,
+ NO_IOR,
+ NO_NAME,
+ NO_PERFSITENT_REF,
+ NO_COMMENT,
+ true);
+ }
+
+ //Import entities
+ TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+ const TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+ string anEntityName;
+ switch(anEntity){
+ case NODE_ENTITY:
+ anEntityName = "onNodes";
+ break;
+ case EDGE_ENTITY:
+ anEntityName = "onEdges";
+ break;
+ case FACE_ENTITY:
+ anEntityName = "onFaces";
+ break;
+ case CELL_ENTITY:
+ anEntityName = "onCells";
+ break;
+ default:
+ continue;
+ }
+
+ aComment.sprintf("myComment=ENTITY;myMeshName=%s;myId=%d",
+ aMeshName.c_str(),
+ anEntity);
+
+ aMeshOnEntity->myEntry =
+ CreateAttributes(theStudy,
+ aSubMeshesEntry,
+ NO_ICON,
+ NO_IOR,
+ anEntityName.c_str(),
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+ }
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildGroups(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ CORBA::Boolean theIsAtOnce,
+ _PTR(Study) theStudy)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildGroups");
+ TResultManager aResultManager(theResult);
+ TTransactionManager aTransactionManager(theStudy);
+
+ {
+ TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildGroups");
+ theInput->BuildGroups();
+ }
+
+ QString aComment,aTmp;
+ const TMeshMap& aMeshMap = theInput->GetMeshMap();
+ TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+ const string& aMeshName = aMeshMapIter->first;
+ const PMesh& aMesh = aMeshMapIter->second;
+
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ continue;
+
+ TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+ const TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+ const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aFamilyName = aFamilyMapIter->first;
+ const PFamily& aFamily = aFamilyMapIter->second;
+ aComment.sprintf("myComment=FAMILY;myMeshName=%s;myEntityId=%d;myName=%s",
+ aMeshName.c_str(),
+ anEntity,
+ aFamilyName.c_str());
+
+ aFamily->myEntry =
+ CreateAttributes(theStudy,
+ aMeshOnEntity->myEntry,
+ NO_ICON,
+ NO_IOR,
+ aFamilyName,
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+ }
+ }
+ //Importing groups
+ const TGroupMap& aGroupMap = aMesh->myGroupMap;
+ if(!aGroupMap.empty()){
+ aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+ aMeshName.c_str());
+
+ CreateAttributes(theStudy,
+ aMesh->myGroupsEntry,
+ NO_ICON,
+ NO_IOR,
+ "Groups",
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ false);
+
+ TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+ for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+ const string& aGroupName = aGroupMapIter->first;
+ const PGroup& aGroup = aGroupMapIter->second;
+ aComment.sprintf("myComment=GROUP;myMeshName=%s;myName=%s",
+ aMeshName.c_str(),
+ aGroupName.c_str());
+ aGroup->myEntry =
+ CreateAttributes(theStudy,
+ aMesh->myGroupsEntry,
+ NO_ICON,
+ NO_IOR,
+ aGroupName,
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+ const TFamilySet& aFamilySet = aGroup->myFamilySet;
+ TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
+ for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
+ const PFamily& aFamily = *aFamilyIter;
+ CreateReference(theStudy,
+ aGroup->myEntry,
+ aFamily->myEntry);
+ }
+ }
+ }else if(!theIsAtOnce)
+ RemoveSObject(theStudy,
+ aMesh->myGroupsEntry);
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildFields(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ CORBA::Boolean theIsAtOnce,
+ _PTR(Study) theStudy)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
+ TResultManager aResultManager(theResult);
+ TTransactionManager aTransactionManager(theStudy);
+
+ {
+ TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
+ theInput->BuildFields();
+ }
+
+ QString aComment,aTmp;
+ const TMeshMap& aMeshMap = theInput->GetMeshMap();
+ TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+
+ for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++)
+ {
+ const string& aMeshName = aMeshMapIter->first;
+ const PMesh& aMesh = aMeshMapIter->second;
+
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ continue;
+
+ //Import fields
+ bool anIsFieldsEntryUpdated = false;
+ TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+
+ for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++)
+ {
+ const TEntity& anEntity = aMeshOnEntityMapIter->first;
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+ const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
+
+ for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
+ {
+ if(!anIsFieldsEntryUpdated)
+ {
+ aComment = "";
+ aComment.append("myComment=FIELDS;");
+ aComment.append("myMeshName=");aComment.append(aMeshName);
+
+ CreateAttributes(theStudy,
+ aMesh->myFieldsEntry,
+ NO_ICON,
+ NO_IOR,
+ "Fields",
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ false);
+
+ anIsFieldsEntryUpdated = true;
+ }
+
+ const string& aFieldName = aFieldMapIter->first;
+ const PField& aField = aFieldMapIter->second;
+ const TValField& aValField = aField->myValField;
+ QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
+ aComment.sprintf("myComment=FIELD;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aValField.size(),
+ aField->myNbComp);
+
+ aField->myEntry = CreateAttributes(theStudy,
+ aMesh->myFieldsEntry,
+ NO_ICON,
+ NO_IOR,
+ aFieldNameWithUnit.latin1(),
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+
+ CreateReference(theStudy,
+ aField->myEntry,
+ aMeshOnEntity->myEntry);
+
+ TValField::const_iterator aValFieldIter = aValField.begin();
+
+ for(; aValFieldIter != aValField.end(); aValFieldIter++)
+ {
+ int aTimeStamp = aValFieldIter->first;
+ const PValForTime& aValForTime = aValFieldIter->second;
+ aComment.sprintf("myComment=TIMESTAMP;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aTimeStamp,
+ aField->myNbComp);
+
+ string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
+
+ aValForTime->myEntry = CreateAttributes(theStudy,
+ aField->myEntry,
+ NO_ICON,
+ NO_IOR,
+ aTimeStampId,
+ NO_PERFSITENT_REF,
+ aComment.latin1(),
+ true);
+ }
+ }
+ }
+
+ if(!anIsFieldsEntryUpdated && !theIsAtOnce)
+ RemoveSObject(theStudy, aMesh->myFieldsEntry);
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildMinMax(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildMinMax");
+ TResultManager aResultManager(theResult);
+
+ theInput->BuildMinMax();
+
+ *theIsDone = true;
+
+ theResult->UpdateObservers();
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildFieldDataTree(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsFieldsDone,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean* theIsMinMaxDone,
+ CORBA::Boolean theIsBuildMinMax,
+ _PTR(Study) theStudy)
+ {
+ BuildFields(theResult,
+ theInput,
+ theIsFieldsDone,
+ theIsBuildFields,
+ false,
+ theStudy);
+
+ BuildMinMax(theResult,
+ theInput,
+ theIsMinMaxDone,
+ theIsBuildMinMax);
+ }
+
+
+ //----------------------------------------------------------------------------
+ bool
+ RemoveFile(const std::string& theFileName,
+ bool theRemoveEmptyDir)
+ {
+ QFileInfo aFileInfo(theFileName);
+ QFile(aFileInfo.absFilePath()).remove();
+
+ if(theRemoveEmptyDir)
+ QDir().rmdir(aFileInfo.dirPath(TRUE));
+
+ return aFileInfo.exists();
+ }
+
+
+ //----------------------------------------------------------------------------
+ bool
+ CopyFile(const std::string& theSourceFileName,
+ const std::string& theTargetFileName)
+ {
+ QFileInfo aSourceFileInfo(theSourceFileName);
+ QFileInfo aTargetFileInfo(theTargetFileName);
+ if(aSourceFileInfo.absFilePath() == aTargetFileInfo.absFilePath())
+ return true;
+
+ QString aCommand;
+ aCommand.sprintf("%s %s %s",
+ COPY_COMMAND,
+ aSourceFileInfo.filePath().latin1(),
+ aTargetFileInfo.filePath().latin1());
+
+ return system(aCommand.latin1()) == 0;
+ }
+
+
+ //----------------------------------------------------------------------------
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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
+//
+//
+// File : VISU_ResultUtils.hh
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef __VISU_RESULT_UTILS_H__
+#define __VISU_RESULT_UTILS_H__
+
+#include "VISU_Result_i.hh"
+#include "SALOME_Event.hxx"
+
+#include <set>
+
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ struct TUpdateObjBrowser: public SALOME_Event
+ {
+ int myStudyId;
+ CORBA::Boolean* myIsDone;
+ TUpdateObjBrowser(const int theStudyId, CORBA::Boolean* theIsDone);
+
+ virtual
+ void
+ Execute();
+ };
+
+
+ //----------------------------------------------------------------------------
+ struct TResultManager
+ {
+ Result_i* myResult;
+
+ TResultManager(Result_i* theResult);
+
+ ~TResultManager();
+ };
+
+
+ //----------------------------------------------------------------------------
+ struct TTransactionManager
+ {
+ _PTR(StudyBuilder) myStudyBuilder;
+
+ TTransactionManager(_PTR(Study) theStudyDocument);
+
+ ~TTransactionManager();
+ };
+
+
+ //----------------------------------------------------------------------------
+ QString
+ GenerateName(const std::string& theName);
+
+
+ //----------------------------------------------------------------------------
+ bool
+ SplitName(const std::string& theName,
+ std::string& theBase,
+ std::string& theSuffix,
+ char theDelimeter = ':');
+
+
+ //----------------------------------------------------------------------------
+ std::string
+ MakeFileName(const std::string& theName,
+ const void* thePointer);
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildEntities(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ const std::string& theResultEntry,
+ CORBA::Boolean theIsAtOnce,
+ CORBA::Boolean theIsBuildGroups,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildParts,
+ _PTR(Study) theStudy);
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildGroups(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ CORBA::Boolean theIsAtOnce,
+ _PTR(Study) theStudy);
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildFields(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ CORBA::Boolean theIsAtOnce,
+ _PTR(Study) theStudy);
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildMinMax(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild);
+
+
+ //----------------------------------------------------------------------------
+ void
+ BuildFieldDataTree(Result_i* theResult,
+ Result_i::PInput theInput,
+ CORBA::Boolean* theIsFieldsDone,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean* theIsMinMaxDone,
+ CORBA::Boolean theIsBuildMinMax,
+ _PTR(Study) theStudy);
+
+ //----------------------------------------------------------------------------
+ bool
+ RemoveFile(const std::string& theFileName,
+ bool theRemoveEmptyDir = true);
+
+ //----------------------------------------------------------------------------
+ bool
+ CopyFile(const std::string& theSourceFileName,
+ const std::string& theTargetFileName);
+
+ //----------------------------------------------------------------------------
+}
+
+
+#endif // __VISU_RESULT_UTILS_H__
// Author : Alexey PETROV
// Module : VISU
-#include "VISU_Result_i.hh"
+#include "VISU_MultiResult_i.hh"
+#include "VISU_ResultUtils.hh"
+#include "VISU_Prs3d_i.hh"
#include "VISU_Convertor_impl.hxx"
#include "VISU_CorbaMedConvertor.hxx"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
-#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/thread.hpp>
-
-#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>
// QT Includes
// OCCT Includes
#include <Bnd_Box.hxx>
-#ifdef ENABLE_MULTIPR
-// MULTIPR
-#include "MULTIPR_Obj.hxx"
-#endif
-
-using namespace VISU;
-using namespace std;
-
#ifdef _DEBUG_
-static int MYDEBUG = 1;
-static int MYTIMEDEBUG = 0;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
-static int MYTIMEDEBUG = 0;
#endif
{
//---------------------------------------------------------------
Result_var
- FindResult (SALOMEDS::SObject_ptr theSObject)
+ FindResult(SALOMEDS::SObject_ptr theSObject)
{
SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
SALOMEDS::SObject_var aFather = theSObject->GetFather();
//---------------------------------------------------------------
- typedef boost::recursive_mutex TMutex;
- typedef TMutex::scoped_lock TLock;
-
- static TMutex myMutex;
-
- //---------------------------------------------------------------
- struct TGetStudy: public SALOME_Event
- {
- typedef _PTR(Study) TResult;
- TResult myResult;
- int myStudyId;
-
- TGetStudy(const int theStudyId):
- myStudyId(theStudyId)
- {}
-
- virtual
- void
- Execute()
- {
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- while (SUIT_Application* aSApp = anIter.current()) {
- if(SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSApp)){
- if(SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy())) {
- if(_PTR(Study) aStudyDS = aStudy->studyDS()){
- if(aStudyDS->StudyId() == myStudyId){
- myResult = aStudy->studyDS();
- break;
- }
- }
- }
- }
- ++anIter;
- }
- }
- };
-
-
- //---------------------------------------------------------------
- QString
- GenerateName (const std::string& theName)
- {
- TLock aLock(myMutex);
-
- typedef map<string,int> TNameMap;
- static TNameMap aMap;
-
- TNameMap::const_iterator i = aMap.find(theName);
- QString tmp;
- if (i == aMap.end()) {
- aMap[theName] = 0;
- tmp = theName;
- } else {
- tmp = GenerateName(theName,++aMap[theName]);
- }
- if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
- return tmp;
- }
-
-
- //---------------------------------------------------------------
- QString
- GenerateFieldName (const string& theName, const string& theUnits)
- {
- QString aName;
- const string tmp (theUnits.size(),' ');
- if (theUnits == "" || theUnits == tmp)
- aName.sprintf("%s, -",theName.c_str());
- else
- aName.sprintf("%s, %s",theName.c_str(),theUnits.c_str());
- aName = aName.simplifyWhiteSpace();
- return aName.latin1();
- }
-
-
- //---------------------------------------------------------------
- string
+ std::string
GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
{
SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
}
- //---------------------------------------------------------------
- void
- CreateReference (_PTR(Study) theStudyDocument,
- const string& theFatherEntry,
- const string& theRefEntry)
- {
- TLock aLock(myMutex);
-
- _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
- _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
- _PTR(SObject) aNewObj = aStudyBuilder->NewObject(aFather);
- _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
- aStudyBuilder->Addreference(aNewObj,aRefSObj);
- }
-
-
- //---------------------------------------------------------------
- inline
- std::string
- CreateAttributes(_PTR(Study) theStudyDocument,
- const string& theFatherEntry,
- const string& theIOR,
- const string& theName,
- const string& theComment,
- CORBA::Boolean theCreateNew,
- const string& theIcon = "")
- {
- TLock aLock(myMutex);
-
- _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
- _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
-
- _PTR(SObject) aNewObj;
- if(theCreateNew)
- aNewObj = aStudyBuilder->NewObject(aFather);
- else
- aNewObj = aFather;
-
- _PTR(GenericAttribute) anAttr;
- if (theIOR != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeIOR");
- _PTR(AttributeIOR) anIOR (anAttr);
- anIOR->SetValue(theIOR);
- }
- if (theName != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeName");
- _PTR(AttributeName) aName (anAttr);
- aName->SetValue(theName);
- }
- if (theComment != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeString");
- _PTR(AttributeString) aCmnt (anAttr);
- aCmnt->SetValue(theComment);
- }
- // MULTIPR
- if (theIcon != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePixMap");
- _PTR(AttributePixMap) aPixmap (anAttr);
- aPixmap->SetPixMap(theIcon.c_str());
- }
- return aNewObj->GetID();
- }
-
-
- //---------------------------------------------------------------
- inline
- void
- UpdateAttributes(_PTR(Study) theStudyDocument,
- const string& theEntry,
- const string& theIOR,
- const string& theName,
- const string& theComment)
- {
- TLock aLock(myMutex);
-
- _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
- _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry);
-
- _PTR(GenericAttribute) anAttr;
- if (theIOR != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
- _PTR(AttributeIOR) anIOR (anAttr);
- anIOR->SetValue(theIOR);
- }
- if (theName != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeName");
- _PTR(AttributeName) aName (anAttr);
- aName->SetValue(theName);
- }
- if (theComment != "") {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
- _PTR(AttributeString) aCmnt (anAttr);
- aCmnt->SetValue(theComment);
- }
- }
-
-
- //---------------------------------------------------------------
- inline
- void
- RemoveSObject(_PTR(Study) theStudyDocument,
- const string& theEntry)
- {
- TLock aLock(myMutex);
-
- _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
- _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry);
- aStudyBuilder->RemoveObject(aSObject);
- }
-
-
- //---------------------------------------------------------------
- struct TResultManager
- {
- Result_i* myResult;
-
- TResultManager(Result_i* theResult):
- myResult(theResult)
- {
- myResult->Register();
- }
-
- ~TResultManager()
- {
- myResult->Destroy();
- }
- };
-
-
- //---------------------------------------------------------------
- struct TTransactionManager
- {
- _PTR(StudyBuilder) myStudyBuilder;
-
- TTransactionManager(_PTR(Study) theStudyDocument):
- myStudyBuilder(theStudyDocument->NewBuilder())
- {
- TLock aLock(myMutex);
- myStudyBuilder->NewCommand();
- }
-
- ~TTransactionManager()
- {
- TLock aLock(myMutex);
- myStudyBuilder->CommitCommand();
- }
- };
-
-
- //---------------------------------------------------------------
- struct TUpdateObjBrowser: public SALOME_Event
- {
- int myStudyId;
- CORBA::Boolean* myIsDone;
- TUpdateObjBrowser(const int theStudyId,
- CORBA::Boolean* theIsDone):
- myStudyId(theStudyId),
- myIsDone(theIsDone)
- {}
-
- virtual
- void
- Execute()
- {
- TLock aLock(myMutex);
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- while (SUIT_Application* aSApp = anIter.current()) {
- if(SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aSApp)){
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy())) {
- if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if (myStudyId == aCStudy->StudyId()) {
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::updateObjectBrowser");
- anApp->updateObjectBrowser();
- *myIsDone = true;
- break;
- }
- }
- }
- }
- ++anIter;
- }
- }
- };
-
-
- //---------------------------------------------------------------
- void
- BuildEntities(Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- std::string theResultEntry,
- CORBA::Boolean theIsAtOnce,
- CORBA::Boolean theIsBuildGroups,
- CORBA::Boolean theIsBuildFields,
- _PTR(Study) theStudy)
- {
- if(*theIsDone)
- return;
-
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildEntities");
- TResultManager aResultManager(theResult);
- TTransactionManager aTransactionManager(theStudy);
-
- {
- TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildEntities");
- theInput->BuildEntities();
- }
-
- QString aComment,aTmp;
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
- const string& aMeshName = aMeshMapIter->first;
- const PMesh& aMesh = aMeshMapIter->second;
- const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- if(aMeshOnEntityMap.empty())
- continue;
- aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
- aMeshName.c_str(),
- aMesh->myDim);
- aMesh->myEntry =
- CreateAttributes(theStudy,
- theResultEntry,
- "",
- aMeshName,
- aComment.latin1(),
- true);
-
- aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
- aMeshName.c_str());
- string aSubMeshesEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "Families",
- aComment.latin1(),
- true);
-
- if(theIsBuildGroups){
- aMesh->myGroupsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "",
- "",
- true);
- }
-
- if(theIsBuildFields){
- aMesh->myFieldsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "",
- "",
- true);
- }
-
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- aMesh->myPartsEntry =
- CreateAttributes(theStudy,
- aMesh->myEntry,
- "",
- "",
- "",
- true);
-#endif
-
- //Import entities
- TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const TEntity& anEntity = aMeshOnEntityMapIter->first;
- const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-
- string anEntityName;
- switch(anEntity){
- case NODE_ENTITY:
- anEntityName = "onNodes";
- break;
- case EDGE_ENTITY:
- anEntityName = "onEdges";
- break;
- case FACE_ENTITY:
- anEntityName = "onFaces";
- break;
- case CELL_ENTITY:
- anEntityName = "onCells";
- break;
- default:
- continue;
- }
-
- aComment.sprintf("myComment=ENTITY;myMeshName=%s;myId=%d",
- aMeshName.c_str(),
- anEntity);
-
- aMeshOnEntity->myEntry =
- CreateAttributes(theStudy,
- aSubMeshesEntry,
- "",
- anEntityName.c_str(),
- aComment.latin1(),
- true);
- }
- }
-
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
- }
-
- //---------------------------------------------------------------
- void
- BuildGroups(Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- CORBA::Boolean theIsBuild,
- CORBA::Boolean theIsAtOnce,
- _PTR(Study) theStudy)
- {
- if(!theIsBuild || *theIsDone)
- return;
-
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildGroups");
- TResultManager aResultManager(theResult);
- TTransactionManager aTransactionManager(theStudy);
-
- {
- TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildGroups");
- theInput->BuildGroups();
- }
-
- QString aComment,aTmp;
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
- const string& aMeshName = aMeshMapIter->first;
- const PMesh& aMesh = aMeshMapIter->second;
-
- const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- if(aMeshOnEntityMap.empty())
- continue;
-
- TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const TEntity& anEntity = aMeshOnEntityMapIter->first;
- const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-
- const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const string& aFamilyName = aFamilyMapIter->first;
- const PFamily& aFamily = aFamilyMapIter->second;
- aComment.sprintf("myComment=FAMILY;myMeshName=%s;myEntityId=%d;myName=%s",
- aMeshName.c_str(),
- anEntity,
- aFamilyName.c_str());
-
- aFamily->myEntry =
- CreateAttributes(theStudy,
- aMeshOnEntity->myEntry,
- "",
- aFamilyName,
- aComment.latin1(),
- true);
- }
- }
- //Importing groups
- const TGroupMap& aGroupMap = aMesh->myGroupMap;
- if(!aGroupMap.empty()){
- aComment.sprintf("myComment=GROUPS;myMeshName=%s",
- aMeshName.c_str());
-
- UpdateAttributes(theStudy,
- aMesh->myGroupsEntry,
- "",
- "Groups",
- aComment.latin1());
-
- TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
- for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const string& aGroupName = aGroupMapIter->first;
- const PGroup& aGroup = aGroupMapIter->second;
- aComment.sprintf("myComment=GROUP;myMeshName=%s;myName=%s",
- aMeshName.c_str(),
- aGroupName.c_str());
- aGroup->myEntry =
- CreateAttributes(theStudy,
- aMesh->myGroupsEntry,
- "",
- aGroupName,
- aComment.latin1(),
- true);
- const TFamilySet& aFamilySet = aGroup->myFamilySet;
- TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
- for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
- const PFamily& aFamily = *aFamilyIter;
- CreateReference(theStudy,
- aGroup->myEntry,
- aFamily->myEntry);
- }
- }
- }else if(!theIsAtOnce)
- RemoveSObject(theStudy,
- aMesh->myGroupsEntry);
- }
-
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
- }
-
-
- //---------------------------------------------------------------
- void BuildFields(
- Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- CORBA::Boolean theIsBuild,
- CORBA::Boolean theIsAtOnce,
- _PTR(Study) theStudy)
- {
- if(!theIsBuild || *theIsDone)
- return;
-
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildFields");
- TResultManager aResultManager(theResult);
- TTransactionManager aTransactionManager(theStudy);
-
- {
- TTimerLog aTimerLog(MYTIMEDEBUG,"theInput->BuildFields");
- theInput->BuildFields();
- }
-
- QString aComment,aTmp;
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
-
- for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++)
- {
- const string& aMeshName = aMeshMapIter->first;
- const PMesh& aMesh = aMeshMapIter->second;
-
- const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- if(aMeshOnEntityMap.empty())
- continue;
-
- //Import fields
- bool anIsFieldsEntryUpdated = false;
- TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++)
- {
- const TEntity& anEntity = aMeshOnEntityMapIter->first;
- const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
- const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-
- for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
- {
- if(!anIsFieldsEntryUpdated)
- {
- aComment = "";
- aComment.append("myComment=FIELDS;");
- aComment.append("myMeshName=");aComment.append(aMeshName);
-
- UpdateAttributes(
- theStudy,
- aMesh->myFieldsEntry,
- "",
- "Fields",
- aComment.latin1());
-
- anIsFieldsEntryUpdated = true;
- }
-
- const string& aFieldName = aFieldMapIter->first;
- const PField& aField = aFieldMapIter->second;
- const TValField& aValField = aField->myValField;
- QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
- aComment.sprintf("myComment=FIELD;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
- aMeshName.c_str(),
- anEntity,
- aFieldName.c_str(),
- aValField.size(),
- aField->myNbComp);
-
- aField->myEntry = CreateAttributes(
- theStudy,
- aMesh->myFieldsEntry,
- "",
- aFieldNameWithUnit.latin1(),
- aComment.latin1(),
- true);
-
- CreateReference(
- theStudy,
- aField->myEntry,
- aMeshOnEntity->myEntry);
-
- TValField::const_iterator aValFieldIter = aValField.begin();
-
- for(; aValFieldIter != aValField.end(); aValFieldIter++)
- {
- int aTimeStamp = aValFieldIter->first;
- const PValForTime& aValForTime = aValFieldIter->second;
- aComment.sprintf("myComment=TIMESTAMP;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
- aMeshName.c_str(),
- anEntity,
- aFieldName.c_str(),
- aTimeStamp,
- aField->myNbComp);
-
- string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
-
- aValForTime->myEntry = CreateAttributes(
- theStudy,
- aField->myEntry,
- "",
- aTimeStampId,
- aComment.latin1(),
- true);
- }
- }
- }
-
- if(!anIsFieldsEntryUpdated && !theIsAtOnce)
- RemoveSObject(theStudy, aMesh->myFieldsEntry);
- }
-
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
- }
-
-
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- void BuildParts (Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- CORBA::Boolean theIsBuild,
- CORBA::Boolean theIsAtOnce,
- _PTR(Study) theStudy)
- {
- if(!theIsBuild || *theIsDone)
- return;
-
- // if MED file is not a distributed MED file (created with MULTIPR),
- // then it is not necessary to build parts
- if (theResult->GetFileInfoMultipr().filePath().isEmpty())
- return;
-
- try
- {
- multipr::Obj multiprObj;
- multiprObj.create(theResult->GetFileInfoMultipr().filePath().latin1());
- if (multiprObj.isValidDistributedMEDFile())
- {
- theResult->SetIsDistributedMEDMultipr(true);
-
- const TMeshMap& aMeshMap = theInput->GetMeshMap();
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- const PMesh& aMesh = aMeshMapIter->second;
-
- vector<string> listParts = multiprObj.getParts();
-
- QString aComment = "Sub-parts: #";
- aComment += QString::number(listParts.size());
-
- UpdateAttributes(
- theStudy,
- aMesh->myPartsEntry,
- "",
- "Parts",
- aComment.latin1());
-
- string lastEntry;
-
- for (unsigned i = 0 ; i < listParts.size() ; i++)
- {
- const char* strItem = listParts[i].c_str();
- const char* strPartInfo = multiprObj.getPartInfo(strItem).c_str();
-
- char lMeshName[256];
- int lId;
- char lPartName[256];
- char lPath[256];
- char lMEDFileName[256];
-
- // parse infos
- sscanf(strPartInfo, "%s %d %s %s %s",
- lMeshName,
- &lId,
- lPartName,
- lPath,
- lMEDFileName);
-
- if ((strstr(lPartName,"_MED") != NULL) || (strstr(lPartName,"_LOW") != NULL))
- {
- QString aComment = "";
- aComment.append("myComment=PART;");
- aComment.append("res=ML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
-
- CreateAttributes(
- theStudy,
- lastEntry, // father
- "",
- lPartName,
- aComment.latin1(),
- true);
- }
- else
- {
- QString aComment = "";
- QString icon = "";
-
- if (i != listParts.size()-1)
- {
- const char* strItemNext = listParts[i+1].c_str();
- const char* strPartInfoNext = multiprObj.getPartInfo(strItemNext).c_str();
- if ((strstr(strPartInfoNext,"_MED") != NULL) || (strstr(strPartInfoNext,"_LOW") != NULL))
- {
- // next part is MED or LOW resolution
- icon = "ICON_MULTIPR_VIEW_LOW";
- theResult->SetResolutionMultipr(lPartName, 'L');
-
- aComment.append("myComment=PART;");
- aComment.append("res=FML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
- else
- {
- // no resolution associated with this part
- icon = "ICON_MULTIPR_VIEW_FULL";
- theResult->SetResolutionMultipr(lPartName, 'F');
-
- aComment.append("myComment=PART;");
- aComment.append("res=F;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
- }
- else
- {
- // last part
- icon = "ICON_MULTIPR_VIEW_FULL";
- theResult->SetResolutionMultipr(lPartName, 'F');
-
- aComment.append("myComment=PART;");
- aComment.append("res=FML;");
- aComment.append("file=");
- aComment.append(lMEDFileName);
- }
-
- lastEntry = CreateAttributes(
- theStudy,
- aMesh->myPartsEntry, // father
- "",
- lPartName,
- aComment.latin1(),
- true,
- icon.latin1());
- }
-
- theResult->AddPartMultipr(lPartName, lMEDFileName);
- }
- }
- else
- {
- // invalid distributed MED file
- return;
- }
- }
- catch (...)
- {
- throw std::runtime_error("error while reading distributed MED file");
- }
-
- ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
- }
-#endif
-
-
- //---------------------------------------------------------------
- void
- BuildMinMax(Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsDone,
- CORBA::Boolean theIsBuild,
- Result_i::TUpdateMinMaxSignal* theUpdateMinMaxSignal)
- {
- if(!theIsBuild || *theIsDone)
- return;
-
- TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildMinMax");
- TResultManager aResultManager(theResult);
-
- theInput->BuildMinMax();
-
- *theIsDone = true;
-
- (*theUpdateMinMaxSignal)();
- }
-
-
- //---------------------------------------------------------------
- void
- BuildFieldDataTree(Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsFieldsDone,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean* theIsMinMaxDone,
- CORBA::Boolean theIsBuildMinMax,
- Result_i::TUpdateMinMaxSignal* theUpdateMinMaxSignal,
- _PTR(Study) theStudy)
- {
- BuildFields(theResult,
- theInput,
- theIsFieldsDone,
- theIsBuildFields,
- false,
- theStudy);
-
- BuildMinMax(theResult,
- theInput,
- theIsMinMaxDone,
- theIsBuildMinMax,
- theUpdateMinMaxSignal);
- }
-
-
- //---------------------------------------------------------------
- struct TBuildArgs
- {
- Result_i* myResult;
- VISU_Convertor* myInput;
- CORBA::Boolean* myIsEntitiesDone;
- std::string myResultEntry;
- CORBA::Boolean* myIsFieldsDone;
- CORBA::Boolean myIsBuildFields;
- CORBA::Boolean* myIsMinMaxDone;
- CORBA::Boolean myIsBuildMinMax;
- Result_i::TUpdateMinMaxSignal* myUpdateMinMaxSignal;
- CORBA::Boolean* myIsGroupsDone;
- CORBA::Boolean myIsBuildGroups;
-#ifdef ENABLE_MULTIPR
- CORBA::Boolean* myIsPartsDone;
- CORBA::Boolean myIsBuildParts;
-#endif
- _PTR(Study) myStudy;
-
- TBuildArgs(Result_i* theResult,
- VISU_Convertor* theInput,
- CORBA::Boolean* theIsEntitiesDone,
- std::string theResultEntry,
- CORBA::Boolean* theIsFieldsDone,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean* theIsMinMaxDone,
- CORBA::Boolean theIsBuildMinMax,
- Result_i::TUpdateMinMaxSignal* theUpdateMinMaxSignal,
- CORBA::Boolean* theIsGroupsDone,
- CORBA::Boolean theIsBuildGroups,
-#ifdef ENABLE_MULTIPR
- CORBA::Boolean* theIsPartsDone,
- CORBA::Boolean theIsBuildParts,
-#endif
- _PTR(Study) theStudy):
- myResult(theResult),
- myInput(theInput),
- myIsEntitiesDone(theIsEntitiesDone),
- myResultEntry(theResultEntry),
- myIsFieldsDone(theIsFieldsDone),
- myIsBuildFields(theIsBuildFields),
- myIsMinMaxDone(theIsMinMaxDone),
- myIsBuildMinMax(theIsBuildMinMax),
- myUpdateMinMaxSignal(theUpdateMinMaxSignal),
- myIsGroupsDone(theIsGroupsDone),
- myIsBuildGroups(theIsBuildGroups),
-#ifdef ENABLE_MULTIPR
- myIsPartsDone(theIsPartsDone),
- myIsBuildParts(theIsBuildParts),
-#endif
- myStudy(theStudy)
- {}
- };
-
- //---------------------------------------------------------------
- void
- BuildDataTree(TBuildArgs theBuildArgs)
- {
- BuildEntities(theBuildArgs.myResult,
- theBuildArgs.myInput,
- theBuildArgs.myIsEntitiesDone,
- theBuildArgs.myResultEntry,
- false,
- theBuildArgs.myIsBuildGroups,
- theBuildArgs.myIsBuildFields,
- theBuildArgs.myStudy);
-
- {
- boost::thread aThread(boost::bind(&BuildGroups,
- theBuildArgs.myResult,
- theBuildArgs.myInput,
- theBuildArgs.myIsGroupsDone,
- theBuildArgs.myIsBuildGroups,
- false,
- theBuildArgs.myStudy));
- }
- {
- boost::thread aThread(boost::bind(&BuildFieldDataTree,
- theBuildArgs.myResult,
- theBuildArgs.myInput,
- theBuildArgs.myIsFieldsDone,
- theBuildArgs.myIsBuildFields,
- theBuildArgs.myIsMinMaxDone,
- theBuildArgs.myIsBuildMinMax,
- theBuildArgs.myUpdateMinMaxSignal,
- theBuildArgs.myStudy));
- }
-
- /*
- // MULTIPR
- BuildParts(theBuildArgs.myResult,
- theBuildArgs.myInput,
- theBuildArgs.myIsPartsDone,
- theBuildArgs.myIsBuildParts,
- false,
- theBuildArgs.myStudy);
- */
- }
-}
-
-
//---------------------------------------------------------------
-VISU::MinMaxCunsomer
-::MinMaxCunsomer():
- myMinMaxIsInitilized(false)
-{}
-
-bool
-VISU::MinMaxCunsomer
-::IsMinMaxInitilized()
-{
- return myMinMaxIsInitilized;
-}
-
-void
-VISU::MinMaxCunsomer
-::UpdateMinMax()
-{
- myMinMaxIsInitilized = true;
}
//---------------------------------------------------------------
VISU::Result_i
-::Result_i (SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsBuildMinMax,
- CORBA::Boolean theIsBuildGroups):
+::Result_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups):
myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
myCreationId(theCreationId),
mySourceId(theSourceId),
myIsBuildFields(theIsBuildFields),
myIsBuildMinMax(theIsBuildMinMax),
myIsBuildGroups(theIsBuildGroups),
-#ifdef ENABLE_MULTIPR
- myIsBuildParts(true),
-#endif
myIsEntitiesDone(false),
myIsFieldsDone(false),
myIsGroupsDone(false),
myIsMinMaxDone(false),
-#ifdef ENABLE_MULTIPR
- myIsPartsDone(false),
-#endif
myIsAllDone(false),
- myInput(NULL)
+ myIsBuildParts(false),
+ myIsPartsDone(false)
{
- myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
-#ifdef ENABLE_MULTIPR
- myIsDistributedMEDMultipr = false;
-#endif
+ myStudy = VISU::GetStudy(myStudyDocument);
+}
+
+
+//---------------------------------------------------------------
+VISU::Result_i
+::Result_i():
+ myIsEntitiesDone(false),
+ myIsFieldsDone(false),
+ myIsGroupsDone(false),
+ myIsMinMaxDone(false),
+ myIsAllDone(false),
+ myIsBuildParts(false),
+ myIsPartsDone(false)
+{}
+
+
+//---------------------------------------------------------------
+VISU::Result_i
+::~Result_i()
+{
+ MESSAGE("Result_i::~Result_i() - this = "<<this);
+ if (GetSourceId() == eRestoredFile)
+ VISU::RemoveFile(myFileInfo.filePath().latin1());
}
//---------------------------------------------------------------
void
VISU::Result_i
-::MinMaxConnect(VISU::MinMaxCunsomer* theMinMaxCunsomer)
+::ConnectObserver(TResultObserver* theObserver,
+ boost::signalslib::connection& theConnection)
{
- myUpdateMinMaxSignal.connect(boost::bind(&MinMaxCunsomer::UpdateMinMax,theMinMaxCunsomer));
+ if(theConnection.connected())
+ theConnection.disconnect();
+
+ theConnection =
+ myUpdateObserverSignal.connect(boost::bind(boost::bind(&TResultObserver::UpdateFromResult,
+ theObserver,
+ _1),
+ this));
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::UpdateObservers()
+{
+ myUpdateObserverSignal();
}
if(theIsBuildAll)
theIsAtOnce = true;
- if(Build(SALOMEDS::SObject::_nil(),theIsAtOnce)){
+ if(Build(SALOMEDS::SObject::_nil(), theIsAtOnce)){
// Set icon
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
GetComment(),
myFileInfo.filePath().latin1(),
- myInitFileName.c_str()); // Restoring of Python dump
- string aResultEntry =
+ GetInitFileName().c_str()); // Restoring of Python dump
+ std::string aResultEntry =
CreateAttributes(myStudy,
aSComponentEntry.in(),
+ NO_ICON,
anIOR.in(),
- myName,
+ GetName(),
+ NO_PERFSITENT_REF,
aComment.latin1(),
true);
mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
if(!CORBA::is_nil(theSObject)){
CORBA::String_var aString = theSObject->GetID();
- CreateReference(myStudyDocument,aResultEntry,aString.in());
+ CreateReference(myStudyDocument, aResultEntry, aString.in());
}
if(theIsAtOnce){
theIsAtOnce,
myIsBuildGroups,
myIsBuildFields,
+ myIsBuildParts,
myStudy);
BuildGroups(this,
theIsAtOnce,
myStudy);
- BuildFields(this,
+ BuildFieldDataTree(this,
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ myStudy);
+ } else {
+ boost::thread aThread(boost::bind(boost::bind(&Result_i::BuildDataTree, this, _1),
+ aResultEntry));
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::BuildDataTree(const std::string& theResultEntry)
+{
+ BuildEntities(this,
myInput,
- &myIsFieldsDone,
+ &myIsEntitiesDone,
+ theResultEntry,
+ false,
+ myIsBuildGroups,
myIsBuildFields,
- theIsAtOnce,
+ myIsBuildParts,
myStudy);
-
- BuildMinMax(this,
- myInput,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- &myUpdateMinMaxSignal);
-
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- BuildParts(this,
- myInput,
- &myIsPartsDone,
- myIsBuildParts,
- theIsAtOnce,
- myStudy);
-#endif
- }
- else {
-#ifdef ENABLE_MULTIPR
- if (strlen(GetFileInfoMultipr().filePath().latin1()) == 0)
-#endif
- {
- // sequential MED file
- TBuildArgs aBuildArgs(this,
- myInput,
- &myIsEntitiesDone,
- aResultEntry,
- &myIsFieldsDone,
- myIsBuildFields,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- &myUpdateMinMaxSignal,
- &myIsGroupsDone,
- myIsBuildGroups,
-#ifdef ENABLE_MULTIPR
- &myIsPartsDone,
- myIsBuildParts,
-#endif
- myStudy);
- boost::thread aThread(boost::bind(&BuildDataTree, aBuildArgs));
- }
-#ifdef ENABLE_MULTIPR
- else
- {
- // distributed MED file
- BuildEntities(this,
- myInput,
- &myIsEntitiesDone,
- aResultEntry,
- theIsAtOnce,
- myIsBuildGroups,
- myIsBuildFields,
- myStudy);
-
- BuildGroups(this,
- myInput,
- &myIsGroupsDone,
- myIsBuildGroups,
- theIsAtOnce,
- myStudy);
- BuildFields(this,
- myInput,
- &myIsFieldsDone,
- myIsBuildFields,
- theIsAtOnce,
- myStudy);
-
- BuildMinMax(this,
- myInput,
- &myIsMinMaxDone,
- myIsBuildMinMax,
- &myUpdateMinMaxSignal);
-
- // MULTIPR
- BuildParts(this,
- myInput,
- &myIsPartsDone,
- myIsBuildParts,
- theIsAtOnce,
- myStudy);
- }
-#endif
+ {
+ boost::thread aThread(boost::bind(&BuildGroups,
+ this,
+ myInput,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ false,
+ myStudy));
+ }
+ {
+ boost::thread aThread(boost::bind(&BuildFieldDataTree,
+ this,
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ myStudy));
}
-
- return this;
}
-
//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i
//---------------------------------------------------------------
VISU::Storable*
-VISU::Result_i::
-Create(const char* theFileName)
+VISU::Result_i
+::Create(const char* theFileName)
{
try {
myFileInfo.setFile(theFileName);
+ myFileName = myFileInfo.fileName().latin1();
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- if (myFileInfo.filePath().endsWith("_grains_maitre.med"))
- {
- // retrieve source MED file (sequential MED file)
- QString originalMEDFileName = "";
- FILE* aFile = fopen(theFileName, "rt");
- char aBuf[1024];
- while (!feof(aFile))
- {
- fgets(aBuf, 1024, aFile);
- char* strTag = NULL;
- if ((aBuf[0] == '#') && ((strTag = strstr(aBuf, "[SOURCE]=")) != NULL))
- {
- char strSequentialMEDFilename[256];
- int ret = sscanf(strTag, "[SOURCE]=%s", strSequentialMEDFilename);
- if (ret == 1)
- {
- originalMEDFileName = strSequentialMEDFilename;
- break;
- }
- }
- }
- fclose(aFile);
- if (originalMEDFileName == "")
- throw std::runtime_error("distributed MED file; bad format");
-
- //cout << "MULTIPR: original med file=" << originalMEDFileName << endl;
- myFileInfoMultipr.setFile(myFileInfo.filePath());
- myFileInfo.setFile(originalMEDFileName);
+ if(!myIsBuildParts){
+ SetInitFileName(myFileInfo.filePath().latin1());
+ SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false);
}
- else
- {
- myFileInfoMultipr.setFile("");
- }
-#endif
- myInitFileName = myFileInfo.filePath().latin1();
- myName = ::GenerateName(myFileInfo.fileName()).latin1();
if(mySourceId == eRestoredFile){
- std::string aTmpDir(SALOMEDS_Tool::GetTmpDir());
- static QString aCommand;
- aCommand.sprintf(" %s %s", myFileInfo.absFilePath().latin1(), aTmpDir.c_str() );
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( COPY_COMMAND );
-
- if(system(aCommand.latin1()) == -1){
- MESSAGE("Create - Can't execute the command :"<<aCommand);
+ QString aTmpDir(SALOMEDS_Tool::GetTmpDir().c_str());
+ std::string aFileName = VISU::MakeFileName(myFileInfo.fileName().latin1(), this);
+ QString aPathToCopy(aTmpDir + aFileName.c_str());
+ if(!VISU::CopyFile(myFileInfo.absFilePath().latin1(), aPathToCopy.latin1()))
return NULL;
- }
- if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
- myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
- }
- myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
+ myFileInfo.setFile(aPathToCopy);
+ myFileName = myFileInfo.fileName().latin1();
+ }
+
+ myInput.reset(CreateConvertor(myFileInfo.absFilePath().latin1()));
if(myInput){
if(myIsBuildImmediately)
{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
try{
- myInput = CreateMEDConvertor(theMedSObject);
- if(myInput == NULL)
+ myInput.reset(CreateMEDConvertor(theMedSObject));
+ if(!myInput)
return NULL;
myInput->Build();
string aCompDataType = GetComponentDataType(theMedSObject);
myFileInfo.setFile(aCompDataType.c_str());
- myInitFileName = aCompDataType;
+ SetInitFileName(aCompDataType);
- myName = ::GenerateName("aResult").latin1();
+ myFileName = VISU::GenerateName("aResult").latin1();
return Build(theMedSObject);
}catch(std::exception& exc){
{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
try{
- myInput = CreateMEDFieldConvertor(theField);
- if(myInput == NULL)
+ myInput.reset(CreateMEDFieldConvertor(theField));
+ if(!myInput)
return NULL;
myInput->Build();
string aCompDataType = "MED";
myFileInfo.setFile(aCompDataType.c_str());
- myInitFileName = aCompDataType;
+ SetInitFileName(aCompDataType);
- myName = ::GenerateName("aResult").latin1();
+ myFileName = VISU::GenerateName("aResult").latin1();
CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
}catch(...){
INFOS("Unknown exception was occured!!!");
}
- return NULL;
+ return NULL;
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::Result_i
+::Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ bool theIsASCII,
+ TFileNames& theFileNames,
+ TFileNames& theFiles)
+{
+ switch(GetCreationId()){
+ case Result_i::eImportFile:
+ case Result_i::eCopyAndImportFile: {
+ INITMSG(MYDEBUG, "Result::Save - this = "<<this<<"\n");
+ INITMSGA(MYDEBUG, 0, "theIsMultiFile = "<<theIsMultiFile<<"; theIsASCII = "<<theIsASCII<<"\n");
+
+ std::string aPrefix;
+ if (theIsMultiFile) {
+ CORBA::String_var anURL = GetStudyDocument()->URL();
+ aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ }
+
+ std::string aFileName = aPrefix + "_" + GetFileName();
+ BEGMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
+
+ std::string aFile = GetFileInfo().filePath().latin1();
+ BEGMSG(MYDEBUG, "aFile = '"<<aFile<<"'\n");
+
+ if(theIsMultiFile || theIsASCII){
+ std::string aPathToCopy(theURL + aFileName);
+ BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
+
+ if(!VISU::CopyFile(aFile, aPathToCopy))
+ return false;
+
+ if(theIsASCII)
+ HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ }
+
+ theFileNames.push_back(aFileName);
+ theFiles.push_back(aFile);
+
+ return true;
+ }}
+
+ return false;
+}
+
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Result_i
+::CanCopy(SALOMEDS::SObject_ptr theObject)
+{
+ switch(GetCreationId()){
+ case Result_i::eImportFile:
+ case Result_i::eCopyAndImportFile:
+ return true;
+ }
+
+ return false;
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU::Result_i
+::CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID,
+ const std::string& theTmpDir,
+ TFileNames& theFileNames)
+{
+ if(!Storable::CopyFrom(theObject, theObjectID, theTmpDir, theFileNames))
+ return false;
+
+ SALOMEDS::Study_var aStudy = theObject->GetStudy();
+ CORBA::String_var anURL = aStudy->URL();
+ std::string aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ std::string aFileName = aPrefix + GetFileInfo().fileName().latin1();
+
+ static QString aCommand;
+ std::string aFilePath = theTmpDir + aFileName;
+ aCommand.sprintf(" %s %s", GetFileInfo().filePath().latin1(), aFilePath.c_str());
+ aCommand = QDir::convertSeparators( aCommand );
+ aCommand.prepend( COPY_COMMAND );
+
+ if(system(aCommand.latin1()) != 0) {
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<<aCommand);
+ return false;
+ }
+
+ SALOMEDS::SComponent_var aSComponent = aStudy->FindComponent("VISU");
+
+ theFileNames.push_back(aFileName);
+
+ return true;
}
VISU::Result_i
::Restore(SALOMEDS::SObject_ptr theSObject,
const Storable::TRestoringMap& theMap,
- const string& thePrefix)
+ const string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
if(MYDEBUG) MESSAGE("Result_i::Restore - " << thePrefix);
+ mySObject = SALOMEDS::SObject::_duplicate(theSObject);
+ mySComponent = mySObject->GetFatherComponent();
+ myStudyDocument = theSObject->GetStudy();
+ myStudy = VISU::GetStudy(myStudyDocument);
+
+ myCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
+ mySourceId = eRestoredFile;
+ if(myCreationId == eImportMed || myCreationId == eImportMedField)
+ mySourceId = eRestoredComponent;
+
+ myIsBuildFields = Storable::FindValue(theMap, "myIsBuildFields", "1").toInt();
+ myIsBuildMinMax = Storable::FindValue(theMap, "myIsBuildMinMax", "1").toInt();
+ myIsBuildGroups = Storable::FindValue(theMap, "myIsBuildGroups", "1").toInt();
+
+ myIsBuildImmediately = true;
+
try {
- mySObject = SALOMEDS::SObject::_duplicate(theSObject);
- myStudyDocument = mySObject->GetStudy();
- mySComponent = mySObject->GetFatherComponent();
- myName = VISU::Storable::FindValue(theMap, "myName").latin1();
- myInitFileName = VISU::Storable::FindValue(theMap, "myInitFileName").latin1();
+ myFileName = VISU::Storable::FindValue(theMap, "myName").latin1();
+ SetInitFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1());
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
- if (mySObject->FindSubObject(1, aRefSObj) &&
- aRefSObj->ReferencedObject(aTargetRefSObj))
- {
+ if (theSObject->FindSubObject(1, aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)) {
if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
aStudyBuilder->LoadWith(aCompRefSObj, aDriver);
- /*
- if (strcmp(aDataType, "MED") == 0){
- // create field or MED converter
- CORBA::Object_var aMedObject = VISU::SObjectToObject(aTargetRefSObj);
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(aMedObject);
- if(!CORBA::is_nil(aField))
- myInput = CreateMEDFieldConvertor(aField);
- else
- myInput = CreateMEDConvertor(aTargetRefSObj);
- myInput->Build();
- }else
- throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
- //*/
-
// create field or MED converter
CORBA::Object_var aMedObject = VISU::SObjectToObject(aTargetRefSObj);
SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(aMedObject);
if (!CORBA::is_nil(aField)) {
// create field converter
- myInput = CreateMEDFieldConvertor(aField);
+ myInput.reset(CreateMEDFieldConvertor(aField));
myInput->Build();
}
else if (strcmp(aDataType, "MED") == 0) {
// create MED converter
- myInput = CreateMEDConvertor(aTargetRefSObj);
+ myInput.reset(CreateMEDConvertor(aTargetRefSObj));
myInput->Build();
}
else {
} else {
myFileInfo.setFile(thePrefix.c_str());
- string aStudyPrefix ("");
- if (IsMultifile())
- aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL());
+ std::string aStudyPrefix ("");
+ if (theIsMultiFile) {
+ CORBA::String_var anURL(GetStudyDocument()->URL());
+ aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
+ }
if (!myFileInfo.isFile()) {
- string aFileName = thePrefix + aStudyPrefix + "_" + myName;
+ std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName;
myFileInfo.setFile(aFileName.c_str());
}
if(MYDEBUG)
char* aHDFFileName = new char[strlen(aResultPath) + 19];
sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath);
- if (IsMultifile()) { // set this file as new - temporary
+ if (theIsMultiFile) { // set this file as new - temporary
static QString aCommand;
aCommand.sprintf(" %s %s%s",aHDFFileName, aResultPath, myFileInfo.baseName().latin1());
aCommand = QDir::convertSeparators( aCommand );
mySourceId = eRestoredFile;
delete(aResultPath);
delete(aHDFFileName);
- } else if (!IsMultifile()) {
+ } else if (!theIsMultiFile) {
mySourceId = eRestoredFile;
} else {
- mySourceId = eFile;
+ mySourceId = eSavedFile;
}
if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
- myInput = CreateConvertor(myFileInfo.filePath().latin1());
+ myInput.reset(CreateConvertor(myFileInfo.filePath().latin1()));
myInput->BuildEntities();
if(myIsBuildFields){
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
GetComment(),
myFileInfo.filePath().latin1(),
- myInitFileName.c_str()); // Restoring of Python dump
+ GetInitFileName().c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if (!theSObject->FindAttribute(anAttr, "AttributeString"))
throw std::runtime_error("Build - There is no AttributeString for the SObject !!!");
return NULL;
}
+
//---------------------------------------------------------------
-VISU::Result_i::TInput*
+VISU::Result_i::PInput
VISU::Result_i
-::GetInput()
+::GetInput(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber)
{
return myInput;
}
+
//---------------------------------------------------------------
CORBA::Boolean
VISU::Result_i
return myIsMinMaxDone;
}
+CORBA::Boolean
+VISU::Result_i
+::IsPartsDone()
+{
+ return myIsPartsDone;
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetMeshNames()
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult._retn();
+
+ aResult->length(aMeshMap.size());
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.begin();
+ for(size_t anId = 0; anIter != aMeshMap.end(); anIter++, anId++){
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
+ }
+
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::Entities*
+VISU::Result_i
+::GetEntities(const char* theMeshName)
+{
+ VISU::Result::Entities_var anEntities = new VISU::Result::Entities();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return anEntities._retn();
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return anEntities._retn();
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ return anEntities._retn();
+
+ {
+ anEntities->length(aMeshOnEntityMap.size());
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.end();
+ for(size_t anId = 0; anIter != aMeshOnEntityMap.end(); anIter++, anId++){
+ const VISU::TEntity& anEntity = anIter->first;
+ anEntities[anId] = VISU::Entity(anEntity);
+ }
+ }
+
+ return anEntities._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetFamilies(const char* theMeshName,
+ VISU::Entity theEntity)
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult._retn();
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return aResult._retn();
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ return aResult._retn();
+
+ {
+ VISU::TEntity anEntity = VISU::TEntity(theEntity);
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+ if(anIter == aMeshOnEntityMap.end())
+ return aResult._retn();
+
+ const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+ const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ if(aFamilyMap.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aFamilyMap.size());
+ VISU::TFamilyMap::const_iterator anIter = aFamilyMap.end();
+ for(size_t anId = 0; anIter != aFamilyMap.end(); anIter++, anId++){
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
+ }
+ }
+ }
+
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetGroups(const char* theMeshName)
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult._retn();
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return aResult._retn();
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ if(aGroupMap.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aGroupMap.size());
+ VISU::TGroupMap::const_iterator anIter = aGroupMap.end();
+ for(size_t anId = 0; anIter != aGroupMap.end(); anIter++, anId++){
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
+ }
+ }
+
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetFields(const char* theMeshName,
+ VISU::Entity theEntity)
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult._retn();
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return aResult._retn();
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ return aResult._retn();
+
+ {
+ VISU::TEntity anEntity = VISU::TEntity(theEntity);
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+ if(anIter == aMeshOnEntityMap.end())
+ return aResult._retn();
+
+ const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ if(aFieldMap.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aFieldMap.size());
+ VISU::TFieldMap::const_iterator anIter = aFieldMap.end();
+ for(size_t anId = 0; anIter != aFieldMap.end(); anIter++, anId++){
+ const std::string& aName = anIter->first;
+ aResult[anId] = aName.c_str();
+ }
+ }
+ }
+
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::TimeStampNumbers*
+VISU::Result_i
+::GetTimeStampNumbers(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName)
+{
+ VISU::Result::TimeStampNumbers_var aResult = new VISU::Result::TimeStampNumbers();
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult._retn();
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return aResult._retn();
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ return aResult._retn();
+
+ {
+ VISU::TEntity anEntity = VISU::TEntity(theEntity);
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+ if(anIter == aMeshOnEntityMap.end())
+ return aResult._retn();
+
+ const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ if(aFieldMap.empty())
+ return aResult._retn();
+
+ {
+ VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
+ if(anIter == aFieldMap.end())
+ return aResult._retn();
+
+ {
+ const VISU::PField& aField = anIter->second;
+ const VISU::TValField& aValField = aField->myValField;
+ if(aValField.empty())
+ return aResult._retn();
+
+ {
+ aResult->length(aValField.size());
+ VISU::TValField::const_iterator anIter = aValField.end();
+ for(size_t anId = 0; anIter != aValField.end(); anIter++, anId++){
+ const vtkIdType& aTimeStampNumber = anIter->first;
+ aResult[anId] = aTimeStampNumber;
+ }
+ }
+ }
+ }
+ }
+
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+CORBA::Long
+VISU::Result_i
+::GetNumberOfComponents(const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName)
+{
+ CORBA::Long aResult = 0;
+ const VISU::TMeshMap& aMeshMap = GetInput()->GetMeshMap();
+ if(aMeshMap.empty())
+ return aResult;
+
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(theMeshName);
+ if(anIter == aMeshMap.end())
+ return aResult;
+
+ const VISU::PMesh& aMesh = anIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ if(aMeshOnEntityMap.empty())
+ return aResult;
+
+ {
+ VISU::TEntity anEntity = VISU::TEntity(theEntity);
+ VISU::TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(anEntity);
+ if(anIter == aMeshOnEntityMap.end())
+ return aResult;
+
+ const VISU::PMeshOnEntity& aMeshOnEntity = anIter->second;
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ if(aFieldMap.empty())
+ return aResult;
+
+ {
+ VISU::TFieldMap::const_iterator anIter = aFieldMap.find(theFieldName);
+ if(anIter == aFieldMap.end())
+ return aResult;
+
+ {
+ const VISU::PField& aField = anIter->second;
+ aResult = aField->myNbComp;
+ }
+ }
+ }
+
+ return aResult;
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::EntityNames*
+VISU::Result_i
+::GetPartNames(const char* theMeshName)
+{
+ VISU::Result::EntityNames_var aResult = new VISU::Result::EntityNames();
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::Resolutions*
+VISU::Result_i
+::GetResolutions(const char* theMeshName,
+ const char* thePartName)
+{
+ VISU::Result::Resolutions_var aResult = new VISU::Result::Resolutions();
+ return aResult._retn();
+}
+
+
+//---------------------------------------------------------------
+VISU::Result::Resolution
+VISU::Result_i
+::GetResolution(const char* theMeshName,
+ const char* thePartName)
+{
+ return VISU::Result::HIDDEN;
+}
+
+
//---------------------------------------------------------------
void
VISU::Result_i
-::ToStream(std::ostringstream& theStr)
+::SetResolution(const char* theMeshName,
+ const char* thePartName,
+ VISU::Result::Resolution theResolution)
+{}
+
+
+//---------------------------------------------------------------
+VISU::Result_i*
+VISU::Result_i
+::New(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups)
{
- if(MYDEBUG) MESSAGE(GetComment());
- Storable::DataToStream(theStr,"myName",myName.c_str());
- Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
- Storable::DataToStream(theStr,"myCreationId",myCreationId);
- Storable::DataToStream(theStr,"myIsBuildFields",myIsFieldsDone);
- Storable::DataToStream(theStr,"myIsBuildMinMax",myIsMinMaxDone);
- Storable::DataToStream(theStr,"myIsBuildGroups",myIsGroupsDone);
+ return new RESULT_CLASS_NAME(theStudy,
+ theSourceId,
+ theCreationId,
+ theIsBuildImmediately,
+ theIsBuildFields,
+ theIsBuildMinMax,
+ theIsBuildGroups);
}
//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i
-::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
- const Storable::TRestoringMap& theMap)
+::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
- SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-
- ECreationId aCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
- ESourceId aSourceId = eRestoredFile;
- if(aCreationId == eImportMed || aCreationId == eImportMedField)
- aSourceId = eRestoredComponent;
-
- CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","1").toInt();
- CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","1").toInt();
- CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","1").toInt();
-
- VISU::Result_i* aResult = new VISU::Result_i(aStudy,
- aSourceId,
- aCreationId,
- anIsBuildFields,
- anIsBuildMinMax,
- anIsBuildGroups);
- if (aResult == NULL)
- return NULL;
+ VISU::Result_i* aResult = new RESULT_CLASS_NAME();
+ return aResult->Restore(theSObject, theMap, thePrefix, theIsMultiFile);
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::ToStream(std::ostringstream& theStr)
+{
+ Storable::DataToStream(theStr,"myName", GetFileName().c_str());
+ Storable::DataToStream(theStr,"myInitFileName", GetInitFileName().c_str());
+ Storable::DataToStream(theStr,"myCreationId", myCreationId);
+ Storable::DataToStream(theStr,"myIsBuildFields", myIsFieldsDone);
+ Storable::DataToStream(theStr,"myIsBuildMinMax", myIsMinMaxDone);
+ Storable::DataToStream(theStr,"myIsBuildGroups", myIsGroupsDone);
+}
+
+
+//---------------------------------------------------------------
+std::string
+VISU::Result_i
+::GetInitFileName() const
+{
+ return myInitFileName;
+}
+
- return aResult->Restore(theSObject,theMap,thePrefix);
+void
+VISU::Result_i
+::SetInitFileName(const std::string& theFileName)
+{
+ myInitFileName = theFileName;
}
//---------------------------------------------------------------
-string
+std::string
+VISU::Result_i
+::GetFileName() const
+{
+ if(GetSourceId() == eFile)
+ return VISU::MakeFileName(myFileName, this);
+
+ return myFileName;
+}
+
+
+QFileInfo
+VISU::Result_i
+::GetFileInfo() const
+{
+ return myFileInfo;
+}
+
+VISU::Result_i::ECreationId
+VISU::Result_i
+::GetCreationId() const
+{
+ return myCreationId;
+}
+
+
+VISU::Result_i::ESourceId
VISU::Result_i
-::GetRefFatherEntry()
+::GetSourceId() const
{
- return "";
+ return mySourceId;
}
+
+//---------------------------------------------------------------
std::string
VISU::Result_i
::GetEntry()
return anEntry.in();
}
-const SALOMEDS::SObject_var&
+SALOMEDS::SObject_var
VISU::Result_i
::GetSObject() const
{
return mySObject;
}
-const SALOMEDS::Study_var&
+SALOMEDS::Study_var
VISU::Result_i
::GetStudyDocument() const
{
return myStudyDocument;
}
-const SALOMEDS::SComponent_var&
+_PTR(Study)
+VISU::Result_i
+::GetStudy() const
+{
+ return myStudy;
+}
+
+SALOMEDS::SComponent_var
VISU::Result_i
::GetSComponent() const
{
theRestoringMap);
}
-#include <stdio.h>
-//---------------------------------------------------------------
-VISU::Result_i
-::~Result_i()
-{
- MESSAGE("Result_i::~Result_i() - this = "<<this);
- if (mySourceId == eRestoredFile) {
- static QString aCommand;
-#ifndef WNT
- aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
-#else
- aCommand.sprintf("del /F %s",myFileInfo.filePath().latin1());
-#endif
- int res = system(aCommand);
- MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<res);
-
-#ifndef WNT
- aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",myFileInfo.dirPath().latin1());
-#else
- aCommand.sprintf("del /F %s",myFileInfo.dirPath().latin1());
-#endif
-
- res = system(aCommand);
- MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<res);
- }
- if(myInput) delete myInput;
-}
//=======================================================================
//function : GetAxisInfo
//purpose :
//=======================================================================
-const Result_i::TAxisInfo*
-Result_i
+const VISU::Result_i::TAxisInfo*
+VISU::Result_i
::GetAxisInfo(const string& theMeshName,
TAxis theAxis,
gp_Dir& thePlaneNormal)
return components;
}
-
-
-#ifdef ENABLE_MULTIPR
-//=======================================================================
-// MULTIPR
-//=======================================================================
-
-// MULTIPR
-void VISU::Result_i::AddPartMultipr(const char* thePartName, const char* theMEDFilename)
-{
- myMapPartNameToMEDFilename.insert(make_pair(thePartName, theMEDFilename));
-}
-
-// MULTIPR
-void VISU::Result_i::SetResolutionMultipr(const char* theName, char theNewResolution)
-{
- map<string, char>::iterator anIterator = mySelectedResolutionMultipr.find(theName);
-
- if (anIterator == mySelectedResolutionMultipr.end())
- {
- // current name does not exist: create
- mySelectedResolutionMultipr.insert(make_pair(theName, theNewResolution));
- }
- else
- {
- // modify
- (*anIterator).second = theNewResolution;
- }
-}
-
-// MULTIPR
-string VISU::Result_i::FindPartMultipr(const char* theName)
-{
- map<string, string>::iterator anIterator = myMapPartNameToMEDFilename.find(theName);
-
- if (anIterator == myMapPartNameToMEDFilename.end())
- {
- return NULL;
- }
- return (*anIterator).second;
-}
-
-// MULTIPR
-void VISU::Result_i::SetIsDistributedMEDMultipr(bool theIsDistributedMED)
-{
- myIsDistributedMEDMultipr = theIsDistributedMED;
-}
-
-// MULTIPR
-bool VISU::Result_i::IsDistributedMEDMultipr() const
-{
- return myIsDistributedMEDMultipr;
-}
-
-// MULTIPR
-vector<string> VISU::Result_i::GetCurrentRepresentationMultipr()
-{
- // name of selected parts
- vector<string> res;
-
- // for each part of the mesh
- for (map<string, char>::iterator it = mySelectedResolutionMultipr.begin() ;
- it != mySelectedResolutionMultipr.end() ;
- it++)
- {
- const char* partName = ((*it).first).c_str();
- char resolution = (*it).second;
-
- //cout << "name=" << partName << " res=" << resolution << endl;
-
- if (resolution == 'F')
- {
- res.push_back( FindPartMultipr(partName) );
- }
- else if (resolution == 'M')
- {
- char subPartName[256];
- sprintf(subPartName, "%s_MED", partName);
- res.push_back( FindPartMultipr(subPartName) );
- }
- else if (resolution == 'L')
- {
- char subPartName[256];
- sprintf(subPartName, "%s_LOW", partName);
- res.push_back( FindPartMultipr(subPartName) );
- }
- }
-
- return res;
-}
-#endif // ENABLE_MULTIPR
#include "VISU_BoostSignals.h"
#include "SALOME_GenericObj_i.hh"
+#include "SALOME_Event.hxx"
#include "VTKViewer.h"
+#include <boost/shared_ptr.hpp>
#include <gp_Dir.hxx>
#include <vector>
#include <map>
namespace VISU
{
//----------------------------------------------------------------------------
- class VISU_I_EXPORT MinMaxCunsomer: public virtual boost::signalslib::trackable
+ class TResultObserver;
+
+
+ //----------------------------------------------------------------------------
+ class VISU_I_EXPORT Result_i : public virtual POA_VISU::Result,
+ public virtual RemovableObject_i,
+ public virtual SALOME::GenericObj_i
{
- protected:
- bool myMinMaxIsInitilized;
- MinMaxCunsomer();
+ Result_i(const Result_i &);
public:
+ enum ESourceId {
+ eRestoredComponent = -2,
+ eRestoredFile = -1,
+ eSavedFile = 0,
+ eFile = 1,
+ eComponent = 2
+ };
+
+ enum ECreationId {
+ eImportFile,
+ eCopyAndImportFile,
+ eImportMed,
+ eImportMedField
+ };
+
+ static
+ Result_i*
+ New(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups);
+
virtual
- bool
- IsMinMaxInitilized();
+ void
+ RemoveFromStudy();
+
+ virtual
+ VISU::VISUType
+ GetType()
+ {
+ return VISU::TRESULT;
+ }
+
+ virtual
+ CORBA::Boolean
+ BuildAll();
+
+ virtual
+ CORBA::Boolean
+ Build(CORBA::Boolean theIsBuildAll,
+ CORBA::Boolean theIsAtOnce);
+
+ virtual
+ CORBA::Boolean
+ IsDone();
+
+ virtual
+ CORBA::Boolean
+ IsEntitiesDone();
virtual
void
- UpdateMinMax();
- };
+ SetBuildFields(CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsCalculateMinMax);
+ virtual
+ CORBA::Boolean
+ IsFieldsDone();
- //----------------------------------------------------------------------------
- class VISU_I_EXPORT Result_i : public virtual POA_VISU::Result,
- public virtual RemovableObject_i,
- public virtual SALOME::GenericObj_i
- {
- Result_i(const Result_i &);
+ virtual
+ void
+ SetBuildGroups(CORBA::Boolean theIsBuildGroups);
- public:
- enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
- enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
+ virtual
+ CORBA::Boolean
+ IsGroupsDone();
- Result_i(SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately = true,
- CORBA::Boolean theIsBuildFields = true,
- CORBA::Boolean theIsBuildMinMax = true,
- CORBA::Boolean theIsBuildGroups = true);
+ virtual
+ CORBA::Boolean
+ IsMinMaxDone();
- virtual ~Result_i();
- virtual void RemoveFromStudy();
+ virtual
+ CORBA::Boolean
+ IsPartsDone();
- virtual VISU::VISUType GetType() { return VISU::TRESULT;}
- virtual CORBA::Boolean BuildAll();
+ virtual
+ VISU::Result::EntityNames*
+ GetMeshNames();
- virtual CORBA::Boolean Build(CORBA::Boolean theIsBuildAll,
- CORBA::Boolean theIsAtOnce);
- virtual CORBA::Boolean IsDone();
+ virtual
+ VISU::Result::Entities*
+ GetEntities(const char* theMeshName);
- virtual CORBA::Boolean IsEntitiesDone();
+ virtual
+ VISU::Result::EntityNames*
+ GetFamilies(const char* theMeshName,
+ Entity theEntity);
- virtual void SetBuildFields(CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsCalculateMinMax);
- virtual CORBA::Boolean IsFieldsDone();
+ virtual
+ VISU::Result::EntityNames*
+ GetGroups(const char* theMeshName);
- virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups);
- virtual CORBA::Boolean IsGroupsDone();
+ virtual
+ VISU::Result::EntityNames*
+ GetFields(const char* theMeshName,
+ Entity theEntity);
- virtual CORBA::Boolean IsMinMaxDone();
+ virtual
+ VISU::Result::TimeStampNumbers*
+ GetTimeStampNumbers(const char* theMeshName,
+ Entity theEntity,
+ const char* theFieldName);
+
+ virtual
+ CORBA::Long
+ GetNumberOfComponents(const char* theMeshName,
+ Entity theEntity,
+ const char* theFieldName);
+
+ virtual
+ VISU::Result::EntityNames*
+ GetPartNames(const char* theMeshName);
+
+ virtual
+ VISU::Result::Resolutions*
+ GetResolutions(const char* theMeshName,
+ const char* thePartName);
+
+ virtual
+ VISU::Result::Resolution
+ GetResolution(const char* theMeshName,
+ const char* thePartName);
+
+ virtual
+ void
+ SetResolution(const char* theMeshName,
+ const char* thePartName,
+ VISU::Result::Resolution theResolution);
+
+ virtual
+ void
+ UpdateObservers();
virtual
void
- MinMaxConnect(MinMaxCunsomer* theMinMaxCunsomer);
+ ConnectObserver(TResultObserver* theObserver,
+ boost::signalslib::connection& theConnection);
- typedef boost::signal0<void> TUpdateMinMaxSignal;
+ typedef boost::signal0<void> TUpdateObserverSignal;
typedef VISU_Convertor TInput;
+ typedef boost::shared_ptr<TInput> PInput;
private:
ESourceId mySourceId;
ECreationId myCreationId;
- TInput *myInput;
- std::string myName, myInitFileName;
+ PInput myInput;
+ std::string myFileName;
QFileInfo myFileInfo;
-
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- QFileInfo myFileInfoMultipr;
- std::map<std::string, std::string> myMapPartNameToMEDFilename;
- std::map<std::string, char> mySelectedResolutionMultipr;
- bool myIsDistributedMEDMultipr;
-#endif
+ std::string myInitFileName;
protected:
- virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
- CORBA::Boolean theIsAtOnce = true) ;
- virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ;
+ Result_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups);
+
+ Result_i();
+
+ virtual
+ ~Result_i();
+
+ virtual
+ Storable*
+ Build(SALOMEDS::SObject_ptr theSObject,
+ CORBA::Boolean theIsAtOnce = true) ;
+ virtual
+ void
+ BuildDataTree(const std::string& theResultEntry);
+
+ virtual
+ Storable*
+ BuildAll(SALOMEDS::SObject_ptr theSObject) ;
+
+ ESourceId
+ GetSourceId() const;
+
_PTR(Study) myStudy;
CORBA::Boolean myIsBuildImmediately;
CORBA::Boolean myIsEntitiesDone;
- CORBA::Boolean myIsFieldsDone;
- CORBA::Boolean myIsGroupsDone;
- CORBA::Boolean myIsMinMaxDone;
-#ifdef ENABLE_MULTIPR
- CORBA::Boolean myIsPartsDone; // MULTIPR
-#endif
+ CORBA::Boolean myIsFieldsDone;
CORBA::Boolean myIsBuildFields;
+
+ CORBA::Boolean myIsGroupsDone;
CORBA::Boolean myIsBuildGroups;
+ CORBA::Boolean myIsPartsDone;
+ CORBA::Boolean myIsBuildParts;
+
+ CORBA::Boolean myIsMinMaxDone;
CORBA::Boolean myIsBuildMinMax;
-#ifdef ENABLE_MULTIPR
- CORBA::Boolean myIsBuildParts; // MULTIPR
-#endif
- TUpdateMinMaxSignal myUpdateMinMaxSignal;
+ TUpdateObserverSignal myUpdateObserverSignal;
CORBA::Boolean myIsAllDone;
public:
- virtual size_t IsPossible();
+ virtual
+ size_t
+ IsPossible();
+
+ virtual
+ Storable*
+ Create(const char* theFileName);
+
+ virtual
+ Storable*
+ Create(SALOMEDS::SObject_ptr theMedSObject);
+
+ virtual
+ Storable*
+ Create(SALOME_MED::FIELD_ptr theField);
+
+ virtual
+ Storable*
+ Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
+
+ static
+ Storable*
+ StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
- virtual Storable* Create(const char* theFileName);
- virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
- virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
+ virtual
+ void
+ ToStream(std::ostringstream& theStr);
- virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap,
- const std::string& thePrefix);
+ //---------------------------------------------------------------
+ typedef std::string TFileName;
+ typedef std::vector<TFileName> TFileNames;
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ virtual
+ bool
+ Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ bool theIsASCII,
+ TFileNames& theFileNames,
+ TFileNames& theFiles);
+
+ //---------------------------------------------------------------
+ virtual
+ CORBA::Boolean
+ CanCopy(SALOMEDS::SObject_ptr theObject);
+
+ virtual
+ bool
+ CopyFrom(SALOMEDS::SObject_ptr theObject,
+ CORBA::Long& theObjectID,
+ const std::string& theTmpDir,
+ TFileNames& theFileNames);
+
+ //---------------------------------------------------------------
+ virtual
+ const char*
+ GetComment() const;
- virtual void ToStream(std::ostringstream& theStr);
- virtual const char* GetComment() const;
static const std::string myComment;
- TInput* GetInput();
- const std::string& GetName() const { return myName;}
- const QFileInfo& GetFileInfo() const { return myFileInfo;}
-#ifdef ENABLE_MULTIPR
- const QFileInfo& GetFileInfoMultipr() const { return myFileInfoMultipr;}
-#endif
- const std::string& GetFileName() const { return myInitFileName;}
- const ECreationId& GetCreationId() const { return myCreationId;}
-
-#ifdef ENABLE_MULTIPR
- // MULTIPR
- void AddPartMultipr(const char* thePartName, const char* theMEDFilename);
- void SetResolutionMultipr(const char* theName, char theNewResolution); // 'F'=FULL 'M'=MEDIUM 'L'=LOW 'H'=HIDE
- std::string FindPartMultipr(const char* theName);
- std::vector<std::string> GetCurrentRepresentationMultipr();
- void SetIsDistributedMEDMultipr(bool theIsDistributedMED);
- bool IsDistributedMEDMultipr() const;
-#endif
+ virtual
+ PInput
+ GetInput(const std::string& theMeshName = "",
+ VISU::Entity theEntity = VISU::NONE,
+ const std::string& theFieldName = "",
+ CORBA::Long theTimeStampNumber = -1);
+
+ virtual
+ std::string
+ GetInitFileName() const;
+
+ virtual
+ void
+ SetInitFileName(const std::string& theFileName);
+
+ virtual
+ std::string
+ GetFileName() const;
+ QFileInfo
+ GetFileInfo() const;
+
+ ECreationId
+ GetCreationId() const;
+
private:
SALOMEDS::SObject_var mySObject;
SALOMEDS::Study_var myStudyDocument;
SALOMEDS::SComponent_var mySComponent;
public:
- std::string GetRefFatherEntry();
- std::string GetEntry();
- const SALOMEDS::SObject_var& GetSObject() const;
- const SALOMEDS::Study_var& GetStudyDocument() const;
- const SALOMEDS::SComponent_var& GetSComponent() const;
- std::string GetEntry(const Storable::TRestoringMap& theRestoringMap);
+ std::string
+ GetEntry();
+
+ SALOMEDS::SObject_var
+ GetSObject() const;
+
+ SALOMEDS::Study_var
+ GetStudyDocument() const;
+
+ _PTR(Study)
+ GetStudy() const;
+
+ SALOMEDS::SComponent_var
+ GetSComponent() const;
+
+ std::string
+ GetEntry(const Storable::TRestoringMap& theRestoringMap);
// Info on structured mesh contained in TInput
public:
};
//! To find Result object as published on father of the given SObject
- VISU_I_EXPORT Result_var
+ VISU_I_EXPORT
+ Result_var
FindResult(SALOMEDS::SObject_ptr theSObject);
//! To get VISU::Result object published on the given SALOMEDS::SObject
// Module : VISU
#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_Result_i.hh"
+
#include "VISU_ScalarMapAct.h"
#include "VISU_ScalarMapOnDeformedShapePL.hxx"
#include "VISU_Convertor.hxx"
-#include "VISU_Result_i.hh"
#include "SUIT_ResourceMgr.h"
#include "SALOME_Event.hxx"
theTimeStampNumber,
false);
if(theIsMemoryCheck && aResult){
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
const VISU::PField aField = anInput->GetField(theMeshName,
(VISU::TEntity)theEntity,
theFieldName);
if(anIsEstimated)
aSize *= INCMEMORY;
aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
- MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ if(MYDEBUG)
+ MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
}
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
VISU::ScalarMapOnDeformedShape_i
::SetScale(CORBA::Double theScale)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapOnDeformedShapePL, vtkFloatingPointType>
(GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScale, theScale));
}
void
VISU::ScalarMapOnDeformedShape_i
::SetScalarField(VISU::Entity theEntity,
- const char* theFieldName,
- CORBA::Long theTimeStampNumber)
+ const char* theFieldName,
+ CORBA::Long theTimeStampNumber)
{
bool anIsModified = false;
if(!anIsModified)
return;
+ VISU::TSetModified aModified(this);
+
VISU::TEntity aEntity = VISU::TEntity(theEntity);
- VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
myScalarField = anInput->GetField(GetCMeshName(), aEntity, theFieldName);
VISU::PUnstructuredGridIDMapper anIDMapper =
// Module : VISU
#include "VISU_ScalarMap_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
try{
if(theResult){
bool anIsEstimated = true;
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
(VISU::TEntity)theEntity,
theFieldName,
if(const ScalarMap_i* aPrs3d = dynamic_cast<const ScalarMap_i*>(theOrigin)){
ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
- SetRange(anOrigin->GetMin(), anOrigin->GetMax());
- UseFixedRange(anOrigin->IsRangeFixed());
-
SetScaling(anOrigin->GetScaling());
myGroupNames = anOrigin->GetGroupNames();
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- // Scalar Range
- int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
- if(aRangeType == 1){
- float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
- float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
- SetRange(aMin,aMax);
- }
-
- UseFixedRange((aRangeType == 1) ? true : false);
- bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
-
- if( isLog )
+ if( aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false) )
SetScaling(VISU::LOGARITHMIC);
else
SetScaling(VISU::LINEAR);
SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
- float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
- float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
- SetRange(aMin,aMax);
-
- UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt());
-
bool anIsExists;
QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
if(anIsExists){
{
TSuperClass::ToStream(theStr);
- Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
- Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
- Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
Storable::DataToStream( theStr, "myScaling", GetScaling() );
std::ostringstream aGeomNameList;
VISU::ScalarMap_i
::SetScaling(VISU::Scaling theScaling)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ScalarMapPL, int>
(GetSpecificPL(), &VISU_ColoredPL::SetScaling, theScaling));
}
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetRange(CORBA::Double theMin, CORBA::Double theMax)
-{
- TSuperClass::SetRange(theMin, theMax);
-}
-
-//----------------------------------------------------------------------------
-void
-VISU::ScalarMap_i
-::SetSourceRange()
-{
- TSuperClass::SetSourceRange();
-}
-
//----------------------------------------------------------------------------
const VISU::ScalarMap_i::TGroupNames&
VISU::ScalarMap_i
VISU::ScalarMap_i
::AddMeshOnGroup(const char* theGroupName)
{
- VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput();
VISU::PUnstructuredGridIDMapper anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(), theGroupName);
if(anIDMapper){
int aNbGroups = myGroupNames.size();
VISU::ScalarMap_i
::DoSetInput(bool theIsInitilizePipe, bool theReInit)
{
- VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
+ GetEntity(),
+ GetCFieldName(),
+ GetTimeStampNumber());
if(!anInput)
throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
throw std::runtime_error("There is no TimeStamp with the parameters !!!");
GetSpecificPL()->SetUnstructuredGridIDMapper(anIDMapper);
- if(theIsInitilizePipe){
- GetSpecificPL()->Init();
- }
-
- // To update scalar range according to the new input
- if(!IsTimeStampFixed() && !IsRangeFixed() || theReInit)
- SetSourceRange();
}
void
SetScaling(VISU::Scaling theScaling);
- virtual
- void
- SetRange(CORBA::Double theMin, CORBA::Double theMax);
-
- virtual
- void
- SetSourceRange();
-
//----------------------------------------------------------------------------
//! Sets initial source geometry
virtual
// Module : VISU
#include "VISU_StreamLines_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
if(!TSuperClass::IsPossible(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, false))
return 0;
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
VISU::PUnstructuredGridIDMapper anIDMapper =
anInput->GetTimeStampOnMesh(theMeshName,
VISU::TEntity(theEntity),
::SetSource(VISU::Prs3d_i* thePrs3d)
{
mySourceEntry = "";
- if(thePrs3d){
- SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject();
- CORBA::String_var aString = aSObject->GetID();
- if(mySourceEntry == aString.in())
- return;
-
- mySourceEntry = aString.in();
- myParamsTime.Modified();
- }
+ if(!thePrs3d)
+ return;
+
+ SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject();
+ CORBA::String_var aString = aSObject->GetID();
+ if(mySourceEntry == aString.in())
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ mySourceEntry = aString.in();
+ myParamsTime.Modified();
}
//---------------------------------------------------------------
{
if(!myStreamLinesPL->GetSource() && mySourceEntry == "")
return;
+
if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput())
return;
+
VISU::Prs3d_var aPrs3d = GetSource();
SetParams(GetIntegrationStep(),
GetPropagationTime(),
/*!
Generate unique name
*/
-const char* VISU::Table_i::GenerateName()
+QString VISU::Table_i::GenerateName()
{
return VISU::GenerateName( "Table", ++myNbPresent );
}
VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
: PrsObject_i(theStudy)
{
- mySObj = SALOMEDS::SObject::_duplicate((theStudy->FindObjectID(theObjectEntry)));
+ mySObj = theStudy->FindObjectID(theObjectEntry);
myOrientation = VISU::Table::HORIZONTAL;
}
/*!
}
//----------------------------------------------------------------------------
-char*
+std::string
VISU::Table_i
::GetObjectEntry()
{
- return CORBA::string_dup( mySObj->GetID() );
+ CORBA::String_var anEntry = mySObj->GetID();
+ return anEntry.in();
}
//----------------------------------------------------------------------------
VISU::Storable* VISU::Table_i::Create()
{
// generate name ...
- SetName(GetTableTitle(), false);
+ SetName(GetTableTitle().latin1(), false);
// mpv (PAL 5357): if name attribute already exist at this label, use it as name of table
if ( GetName() == "" )
}
if ( GetName() == "" )
- SetName(GenerateName(), false);
+ SetName(GenerateName().latin1(), false);
// ... and build the object
return Build( false );
}
/*!
Called from engine to restore table from the file
*/
-VISU::Storable* VISU::Table_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
+VISU::Storable* VISU::Table_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
VISU::Table_i* pResent = new VISU::Table_i( aStudy, "" );
/*!
Gets title for the original table object
*/
-const char* VISU::Table_i::GetTableTitle()
+QString VISU::Table_i::GetTableTitle()
{
SALOMEDS::SObject_var SO = mySObj;
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
if ( !SO->_is_nil() ) {
if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
- return anInt->GetTitle();
+ CORBA::String_var aString = anInt->GetTitle();
+ return aString.in();
}
else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
- return aReal->GetTitle();
+ CORBA::String_var aString = aReal->GetTitle();
+ return aString.in();
}
}
return "";
/*!
Generate unique name
*/
-const char* VISU::Curve_i::GenerateName()
+QString VISU::Curve_i::GenerateName()
{
return VISU::GenerateName( "Curve", ++myNbPresent );
}
CORBA::Boolean VISU::Curve_i::IsValid()
{
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string title;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string title;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string units;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string units;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
theHorList = 0; theVerList = 0;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry());
+ SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
CORBA::String_var aString = mySObj->GetID();
crv->setIO(new SALOME_InteractiveObject(aString.in(), "VISU", GetName().c_str()));
if ( myTable )
- crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry(), "VISU", myTable->GetName().c_str()));
+ crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry().c_str(), "VISU", myTable->GetName().c_str()));
return crv;
}
/*!
/*!
Gets reference table's entry
*/
-const char* VISU::Curve_i::GetTableID() {
+std::string VISU::Curve_i::GetTableID() {
return myTable->GetObjectEntry();
}
/*!
Called from engine to restore curve from the file
*/
-VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
+VISU::Storable* VISU::Curve_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
VISU::Table_i* pTable = GetTable(aStudy, theSObject->GetFather());
/*!
Generate unique name
*/
-const char* VISU::Container_i::GenerateName()
+QString VISU::Container_i::GenerateName()
{
return VISU::GenerateName( "Plot2DView", ++myNbPresent );
}
/*!
Called from engine to restore container from the file
*/
-VISU::Storable* VISU::Container_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
+VISU::Storable* VISU::Container_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
VISU::Container_i* pResent = new VISU::Container_i( aStudy );
virtual Storable* Restore( const Storable::TRestoringMap& theMap,
SALOMEDS::SObject_ptr SO);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
virtual void ToStream( std::ostringstream& theStr );
static const std::string myComment;
virtual const char* GetComment() const;
- virtual const char* GenerateName();
- virtual const char* GetTableTitle();
+ virtual QString GenerateName();
+ virtual QString GetTableTitle();
- virtual char* GetObjectEntry();
+ virtual std::string GetObjectEntry();
};
SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
virtual void ToStream( std::ostringstream& theStr );
static const std::string myComment;
virtual const char* GetComment() const;
- virtual const char* GenerateName();
- virtual const char* GetTableID();
+ virtual QString GenerateName();
+ virtual std::string GetTableID();
virtual CORBA::Boolean IsAuto() { return myAuto; }
virtual CORBA::Boolean IsValid();
virtual Storable* Create();
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix,
- const Storable::TRestoringMap& theMap);
+ static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
virtual void ToStream( std::ostringstream& theStr );
static const std::string myComment;
virtual const char* GetComment() const;
- virtual const char* GenerateName();
+ virtual QString GenerateName();
void Update();
VISU::Curve_i* GetCurve( CORBA::Long theIndex );
// Module : VISU
#include "VISU_Vectors_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_Result_i.hh"
#include "VISU_VectorsAct.h"
false);
if(theIsMemoryCheck && aResult){
bool anIsEstimated = true;
- VISU::Result_i::TInput* anInput = theResult->GetInput();
+ VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName,
(VISU::TEntity)theEntity,
theFieldName,
if(VISU::CheckIsSameValue(myLineWidth, theWidth))
return;
+ VISU::TSetModified aModified(this);
+
myLineWidth = theWidth;
myParamsTime.Modified();
}
VISU::Vectors_i
::SetGlyphType(VISU::Vectors::GlyphType theType)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_VectorsPL, VISU_VectorsPL::GlyphType>
(GetSpecificPL(), &VISU_VectorsPL::SetGlyphType, VISU_VectorsPL::GlyphType(theType)));
}
VISU::Vectors_i
::SetGlyphPos(VISU::Vectors::GlyphPos thePos)
{
+ VISU::TSetModified aModified(this);
+
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_VectorsPL, VISU_VectorsPL::GlyphPos>
(GetSpecificPL(), &VISU_VectorsPL::SetGlyphPos, VISU_VectorsPL::GlyphPos(thePos)));
}