<br>
</center>
-<address> </address>
-
<center><big><a href="gui/VISU/visu.html">GUI Documentation</a></big></center>
-<address> </address>
-
-<center></center>
+<br>
+
+<center><big><a href="gui/GAUSS/gauss_points_viewer.htm">Gauss Viewer User Guide</a></big></center>
-<center><br>
- </center>
-
-<address> </address>
+<br>
<center><big><a href="tui/VISU/index.html">TUI Documentation</a></big></center>
-
-<address> </address>
-
-<center></center>
-
+
<center><br>
<br>
</center>
docs:
cp -fr $(srcdir)/VISU ./
+ cp -fr $(srcdir)/GAUSS ./
-find $(PWD) -name CVS -exec rm -rf {} \;
clean:
distclean: clean
rm -fr VISU
+ rm -fr GAUSS
install:
mkdir -p $(docdir)/gui
cp -rf VISU $(docdir)/gui
+ cp -rf GAUSS $(docdir)/gui
-find $(PWD) -name CVS -exec rm -rf {} \;
uninstall:
rm -rf $(docdir)/gui/VISU
+ rm -rf $(docdir)/gui/GAUSS
* for further construction of graphical presentations.
*/
interface Result : RemovableObject, SALOME::GenericObj {
- //interface Result : Base{
/*! Reads all data from the corresponding sources. By default the data is loaded on demand.
*/
boolean BuildAll();
+
+ /*! Start to parse the source MED file and publish all its entities into the study*/
+ boolean Build(in boolean theIsBuildAll, in boolean theIsAtOnce);
+
+ /*! Allow to check is all requested MED entites already loaded or not */
+ boolean IsDone();
+
+ /*! Allow to check is corresponding MED entites already loaded or not */
+ boolean IsEntitiesDone();
+
+ /*! Choose to parse MED fields and perform global min / max on the MED timestamps.*/
+ void SetBuildFields(in boolean theIsBuildFields, in boolean theIsCalculateMinMax);
+
+ /*! Allow to check is corresponding MED fields already loaded or not */
+ boolean IsFieldsDone();
+
+ /*! Choose to parse MED groups.*/
+ void SetBuildGroups(in boolean theIsBuildGroups);
+
+ /*! Allow to check is corresponding MED groups and families already loaded or not */
+ boolean IsGroupsDone();
+
+ /*! Allow to check is min / max calculation over field's components already perfrormed or not */
+ boolean IsMinMaxDone();
};
//-------------------------------------------------------
*/
Result ImportFile(in string theFileName);
+ /*!
+ * Create result and initialize its with the file. The access to this file will be conserved outside of the application.
+ * \param theFileName String parameter defining the name of the file
+ * from which the data will be imported.
+ */
+ Result CreateResult(in string theFileName);
+
/*!
* Imports data from a file. The access to this file will closed.
* \param theFileName String parameter defining the name of the file
-attribute int mode;
-attribute float clamp;
-attribute float geomSize;
-attribute float minSize;
-attribute float maxSize;
-attribute float magnification;
+attribute float clamp_size;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FrontColor = gl_Color;
+ gl_FrontColor.x = gl_Color.x;
+ gl_FrontColor.y = gl_Color.y;
+ gl_FrontColor.z = gl_Color.z;
- float size;
- if( mode == 0 )
- size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f );
- else
- size = geomSize;
-
- gl_PointSize = min( magnification * size * gl_ProjectionMatrix[0].x, clamp );
+ gl_PointSize = min( gl_Color.w * gl_ProjectionMatrix[0].x, clamp_size );
}
auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
//aCon->GetSize();
//return;
+ aCon->BuildEntities();
+ aCon->BuildFields();
+ aCon->BuildMinMax();
const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
+ //return;
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
//continue;
}
*/
}
- goto OK;
+ //goto OK;
}
}
}
VISU_Convertor
::GetMeshMap()
{
- if(!myIsDone) { myIsDone = true; Build();}
return myMeshMap;
}
#ifndef VISU_Convertor_HeaderFile
#define VISU_Convertor_HeaderFile
+/*!
+ \file VISU_Convertor.hxx
+ \brief The file contains definitions for basic classes of the VISU CONVERTER package
+*/
+
#include "VISU_IDMapper.hxx"
#include "VISU_ConvertorDef.hxx"
typedef TVector<TName> TNames;
//---------------------------------------------------------------
+ //! Define a basic class for all MED entites which can be identified by its number
struct TIntId: virtual TBaseStructure
{
vtkIdType myId;
typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
typedef std::map<TName,PGroup> TGroupMap;
+ //! Define a basic class which corresponds to MED MESH entity
+ /*!
+ This class in its turn contains map of TMeshOnEntity and TGroup substructures,
+ also it keeps name and dimention of corresponding MED MESH entity.
+ */
struct TMesh: virtual TBaseStructure
{
- TMeshOnEntityMap myMeshOnEntityMap;
- TGroupMap myGroupMap;
- TName myName;
- int myDim;
+ TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
+ TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
+ TName myName; //! Name of the corresponding MED MESH
+ int myDim; //! Dimension of the corresponding MED MESH
TMesh(): myDim(0)
{}
//---------------------------------------------------------------
+ //! Define a basic class which corresponds to MED PROFILE entity
struct TSubProfile: virtual TBaseStructure
{};
//---------------------------------------------------------------
+ //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
struct TProfile: virtual TIDMapper
{};
//---------------------------------------------------------------
+ //! Define a basic class for MED GAUSS entity
struct TGauss: virtual TBaseStructure
{};
//---------------------------------------------------------------
+ //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
struct TGaussSubMesh: virtual TBaseStructure
{
- PSubProfile mySubProfile;
+ PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
};
//---------------------------------------------------------------
+ //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
struct TGaussMesh: virtual TGaussPtsIDMapper
{};
typedef std::map<TName,PFamily> TFamilyMap;
typedef std::map<TName,PField> TFieldMap;
+ //! Define a basic class which corresponds to MED ENTITY
+ /*!
+ This class in its turn contains map of TGaussMesh and TProfile substructures,
+ also it keeps corresponding map of MED FAMILIES and FIELDS.
+ */
struct TMeshOnEntity: virtual TNamedIDMapper
{
- TGaussMeshMap myGaussMeshMap;
- TProfileMap myProfileMap;
+ TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
+ TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
- TFamilyMap myFamilyMap;
- TFieldMap myFieldMap;
+ TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
+ TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
- TName myMeshName;
- TEntity myEntity;
+ TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
+ TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
};
//---------------------------------------------------------------
+ //! Define a basic class for MED FAMILY entity
struct TFamily: virtual TIntId,
virtual TIDMapper
{
- TEntity myEntity;
- TName myName;
+ TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
+ TName myName; //!< Contains name of the corresponding MED FAMILY
};
//---------------------------------------------------------------
typedef std::set<PFamily> TFamilySet;
+ //! Define a basic class for MED GROUP entity
struct TGroup: virtual TIDMapper
{
TFamilySet myFamilySet;
typedef std::map<vtkIdType,PValForTime> TValField;
typedef std::pair<float,float> TMinMax;
+ //! Define a basic class for MED FIELD entity
struct TField: virtual TIntId
{
- TEntity myEntity;
- TName myName;
- TName myMeshName;
- TValField myValField;
- TNames myCompNames;
- TNames myUnitNames;
- vtkIdType myNbComp;
-
+ TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+ TName myName; //!< Contains name of the corresponding MED FIELD
+ TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+ TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
+ TNames myCompNames; //!< Contains names of components of the MED FIELD
+ TNames myUnitNames; //!< Contains names of units of the MED FIELD
+ vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
+
+ //! Calculate min/max values for each of the MED FIELD components among all its timestamps
+ /*!
+ Numeration of the components starts from 1.
+ Zero component contains min/max value for modulus of corresponding vector
+ */
virtual
TMinMax
GetMinMax(vtkIdType theCompID) = 0;
//---------------------------------------------------------------
typedef std::pair<double,std::string> TTime;
+ //! Define a basic class for MED TIMESTAMP entity
struct TValForTime: virtual TIntId
{
- TEntity myEntity;
- TName myMeshName;
- TName myFieldName;
+ TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+ TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+ TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
TTime myTime;
- PProfile myProfile;
+ PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
PGaussMesh myGaussMesh;
};
//---------------------------------------------------------------
+ //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
void
WriteToFile(vtkUnstructuredGrid* theDataSet,
const std::string& theFileName);
//---------------------------------------------------------------
+//! This class defines interface to read VTK interpretation of MED entities
+/*!
+ It is the main class of the VISU CONVERTER package.
+ Following MED entities can be retrived from any MED file:
+ - mesh from corresponding MED ENTITIES;
+ - MED TIMESTAMPS;
+ - MED FAMILIES;
+ - MED GROUPS.
+ The class produce its work in two main steps:
+ 1. Perfrom parsing of MED file to get known what MED entities are pressent in it
+ 2. Get VTK representation for any existing MED entity
+ Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation
+
+*/
class VISU_Convertor
{
protected:
~VISU_Convertor()
{};
+ //! Get brief name of the corresponding source MED file
virtual
const std::string&
GetName(){ return myName;}
+ //! Let known whether the source MED file parsed or not
virtual
int
IsDone() const { return myIsDone; }
+ //! Defines what subtype of vtkDataSet is used for MED to VTK mapping
typedef VISU::TVTKOutput TOutput;
+ //! This method perform first parsing of MED file to get known what MED entities are pressent in it
virtual
VISU_Convertor*
Build() = 0;
+ //! This method perform first parsing of MED file to get known what MED mesh entities are pressent in it
+ virtual
+ VISU_Convertor*
+ BuildEntities() = 0;
+
+ //! This method perform first parsing of MED file to get known what MED fields are pressent in it
+ virtual
+ VISU_Convertor*
+ BuildFields() = 0;
+
+ //! This min /max calculation over existing MED fields
+ virtual
+ VISU_Convertor*
+ BuildMinMax() = 0;
+
+ //! This method perform first parsing of MED file to get known what MED groups are pressent in it
+ virtual
+ VISU_Convertor*
+ BuildGroups() = 0;
+
+ //! This method allow to get known what MED entities are present is the MED file
virtual
const VISU::TMeshMap&
GetMeshMap();
+ //! Get amount of memory to build VTK representations for all existing MED entities
virtual
float
GetSize() = 0;
+ //! Get mesh for corresponding MED ENTITY
virtual
VISU::PNamedIDMapper
GetMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity) = 0;
+ //! Get amount of memory to build mesh for corresponding MED ENTITY
virtual
float
GetMeshOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity) = 0;
+ //! Get mesh for corresponding MED FAMILY
virtual
VISU::PIDMapper
GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName) = 0;
+
+ //! Get amount of memory to build mesh for corresponding MED FAMILY
virtual
float
GetFamilyOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName) = 0;
+
+ //! Get mesh for corresponding MED GROUP
virtual
VISU::PIDMapper
GetMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName) = 0;
+ //! Get amount of memory to build mesh for corresponding MED GROUP
virtual
float
GetMeshOnGroupSize(const std::string& theMeshName,
const std::string& theGroupName) = 0;
+ //! Get mesh with attached values for corresponding MED TIMESTAMP
virtual
VISU::PIDMapper
GetTimeStampOnMesh(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum) = 0;
+ //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP
virtual
VISU::PGaussPtsIDMapper
GetTimeStampOnGaussPts(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum) = 0;
+ //! Get amount of memory to build mesh for corresponding MED TIMESTAMP
virtual
float
GetTimeStampSize(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum) = 0;
+ //! Get amount of memory to build all MED TIMESTAMPS for corresponding MED FIELD
virtual
float
GetFieldOnMeshSize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName) = 0;
+ //! Find MED FIELD container
virtual
const VISU::PField
GetField(const std::string& theMeshName,
VISU::TEntity theEntity,
const std::string& theFieldName) = 0;
+ //! Find MED TIMESTAMP container
virtual
const VISU::PValForTime
GetTimeStamp(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum) = 0;
+ //! Allow to generate pretty name for MED TIMESTAMP
static
std::string
GenerateName(const VISU::TTime& aTime);
extern "C"
{
+ //! Instatiate proper VISU_Convertor subclass
VISU_Convertor*
CreateConvertor(const std::string& theFileName);
};
#ifndef VISU_ConvertorDef_HeaderFile
#define VISU_ConvertorDef_HeaderFile
+/*!
+ \file VISU_ConvertorDef.hxx
+ \brief The file contains predeclarations for basic classes of the VISU CONVERTER package
+*/
+
#include "MED_SharedPtr.hxx"
namespace VISU
// Module : VISU
#include "VISU_ConvertorUtils.hxx"
+
#include <vtkUnstructuredGridWriter.h>
+#include <vtkTimerLog.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
-namespace VISU{
+namespace VISU
+{
void
WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
aWriter->Delete();
}
+
+ TTimerLog
+ ::TTimerLog(int theIsDebug,
+ const std::string& theName):
+ myIsDebug(MYDEBUG + theIsDebug),
+ myTimerLog(vtkTimerLog::New()),
+ myPrefixPrinter(myIsDebug == 1),
+ myName(theName)
+ {
+ myCPUTime = myTimerLog->GetCPUTime();
+ BEGMSG(myIsDebug > 1,"{\n");
+ }
+
+ TTimerLog
+ ::~TTimerLog()
+ {
+ myCPUTime = myTimerLog->GetCPUTime() - myCPUTime;
+
+ if(myIsDebug > 1){
+ BEGMSG(myIsDebug,"} = "<<myCPUTime<<" secs ("<<myName<<")\n");
+ }else{
+ BEGMSG(myIsDebug,myName<<" takes "<<myCPUTime<<" secs\n");
+ }
+
+ myTimerLog->Delete();
+ myTimerLog = NULL;
+ }
+
}
#include "MED_Utilities.hxx"
class vtkUnstructuredGrid;
+class vtkTimerLog;
+
+namespace MED
+{
+ class PrefixPrinter;
+}
namespace VISU{
void
WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+
+ class TTimerLog
+ {
+ int myIsDebug;
+ double myCPUTime;
+ std::string myName;
+ vtkTimerLog* myTimerLog;
+ MED::PrefixPrinter myPrefixPrinter;
+ public:
+ TTimerLog(int theIsDebug,
+ const std::string& theName);
+ ~TTimerLog();
+ };
}
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
-//#define _DEXCEPT_
+#define _DEXCEPT_
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
{}
+//---------------------------------------------------------------
+VISU_Convertor*
+VISU_Convertor_impl
+::Build()
+{
+ if(!myIsDone){
+ myIsDone = true;
+ BuildEntities();
+ BuildFields();
+ BuildMinMax();
+ BuildGroups();
+ }
+ return this;
+}
+
+VISU_Convertor*
+VISU_Convertor_impl
+::BuildEntities()
+{
+ return this;
+}
+
+VISU_Convertor*
+VISU_Convertor_impl
+::BuildFields()
+{
+ return this;
+}
+
+VISU_Convertor*
+VISU_Convertor_impl
+::BuildMinMax()
+{
+ return this;
+}
+
+VISU_Convertor*
+VISU_Convertor_impl
+::BuildGroups()
+{
+ return this;
+}
+
+
//---------------------------------------------------------------
VISU::PNamedIDMapper
VISU_Convertor_impl
namespace VISU
{
+ //! Defines VISU enumeration of geometrical types
enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310,
ePYRA13=313, ePENTA15=315, eHEXA20=320,
ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
+ //! Get number of nodes for defined geometrical type
vtkIdType
VISUGeom2NbNodes(EGeometry theGeom);
+ //! Maps VISU geometrical type to VTK one
vtkIdType
VISUGeom2VTK(EGeometry theGeom);
typedef float TCoord;
//---------------------------------------------------------------
+ //! Define an utility base class which is repsonsible for preventing repetion
struct TIsVTKDone: virtual TBaseStructure
{
TIsVTKDone();
- bool myIsDone;
- bool myIsVTKDone;
+ bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure
+ bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation
};
//---------------------------------------------------------------
+ //! Define an utility base class which allow to keep calculated number of cells and their size
struct TSizeCounter: virtual TIsVTKDone
{
TSizeCounter();
- vtkIdType myNbCells;
- vtkIdType myCellsSize;
+ vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
+ vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
};
//---------------------------------------------------------------
+ //! Define a container for VTK representation
class TSource: public virtual TSizeCounter
{
protected:
public:
TSource();
+ //! This method allow to create corresponding VTK data set by demand (not at once)
const TVTKSource&
GetSource() const;
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
//---------------------------------------------------------------
+ //! Define a container for VTK representation
+ /*!
+ This container allow to combine other VTK representation into single one.
+ */
class TAppendFilter: public virtual TIsVTKDone,
public virtual TIDMapper
{
public:
TAppendFilter();
+ //! This method allow to create corresponding VTK filter by demand (not at once)
const TVTKAppendFilter&
GetFilter() const;
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
//---------------------------------------------------------------
+ //! Define a container for VTK representation
+ /*!
+ This container allow to assign data to mesh and represent them into single VTK representation
+ */
class TMergeFilter: public virtual TIsVTKDone,
public virtual TIDMapper
{
public:
TMergeFilter();
+ //! This method allow to create corresponding VTK filter by demand (not at once)
const TVTKMergeFilter&
GetFilter() const;
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
typedef TSlice<TCoordArray> TCoordSlice;
typedef TCSlice<TCoordArray> TCCoordSlice;
+ //! This class is responsible for representation of mesh nodes
class TPointCoords: public virtual TBaseStructure
{
protected:
- vtkIdType myDim;
- vtkIdType myNbPoints;
+ vtkIdType myDim; //!< Dimension of the nodal coordinates
+ vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
- TCoordArray myCoord;
- TVTKPoints myPoints;
+ //! An container for coordinates of the nodes
+ /*!
+ Usage of slices allow to minimize amount of memory to store the nodal coordinates and
+ provide unifirm way of conversation with this coordinates (independant from mesh dimension)
+ */
+ TCoordArray myCoord;
+ TVTKPoints myPoints; //!< VTK representation for the mesh nodes
public:
TPointCoords();
+ //! To initilize the class
void
Init(vtkIdType theNbPoints,
vtkIdType theDim);
+ //! Get slice of coordinates for defined node (const version)
TCCoordSlice
GetCoordSlice(vtkIdType theNodeId) const;
+ //! Get slice of coordinates for defined node
TCoordSlice
GetCoordSlice(vtkIdType theNodeId);
typedef TVector<vtkIdType> TVectorID;
typedef std::map<vtkIdType,vtkIdType> TObj2VTKID;
+ //! This class is responsible for representation of mesh nodes
+ /*!
+ In additition to its base functionlity it support mapping of VTK to object numeration and
+ keeps names for each of nodes.
+ */
class TNamedPointCoords: public virtual TPointCoords
{
protected:
typedef TVector<std::string> TPointsDim;
- TPointsDim myPointsDim;
- TVectorID myVectorID;
- TObj2VTKID myObj2VTKID;
+ TPointsDim myPointsDim; //!< Keeps name of each dimension
+ TVectorID myVectorID; //!< Keeps object¶ numeration
+ TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
public:
+ //! To initilize the class (numeration of the nodes can be missed)
void
Init(vtkIdType theNbPoints,
vtkIdType theDim,
const TVectorID& theVectorID = TVectorID());
+ //! Get name for defined dimension
std::string&
GetName(vtkIdType theDim);
+ //! Get name for defined dimension (const version)
const std::string&
GetName(vtkIdType theDim) const;
+ //! Get object number for node by its VTK one
virtual
vtkIdType
GetObjID(vtkIdType theID) const;
+ //! Get VTK number for node by its object one
virtual
vtkIdType
GetVTKID(vtkIdType theID) const;
+ //! Get name of node by its object number
virtual
std::string
GetNodeName(vtkIdType theObjID) const;
//---------------------------------------------------------------
+ //! Specialize TMesh to provide VTK mapping for nodes
struct TMeshImpl: virtual TMesh,
virtual TIsVTKDone
{
- PNamedPointCoords myNamedPointCoords;
+ PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
- TVTKPoints myPoints;
- vtkIdType myNbPoints;
+ TVTKPoints myPoints; //!< Keeps VTK representation of the nodes
+ vtkIdType myNbPoints; //!< Keeps number of the nodes
TMeshImpl();
};
typedef TVector<vtkIdType> TSubMeshID;
typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus;
+ //! Specialize TSubProfile to provide VTK mapping
struct TSubProfileImpl: virtual TSubProfile,
virtual TSource
{
TSubProfileImpl();
- EGeometry myGeom;
- std::string myName;
+ EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
+ std::string myName; //!< Keeps its name
+ //! Get object number of mesh cell by its VTK one
virtual
vtkIdType
GetElemObjID(int theVtkI) const;
- ESubMeshStatus myStatus;
- TSubMeshID mySubMeshID;
+ //! Keeps status of the structure
+ /*!
+ In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
+ in order to construct mesh for MED TIEMSTAMPS in uniform way.
+ */
+ ESubMeshStatus myStatus;
+ TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
};
typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
typedef TVector<PSubProfileImpl> TSubProfileArr;
typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
+ //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
struct TProfileImpl: virtual TProfile,
virtual TAppendFilter
{
TProfileImpl();
- bool myIsAll;
+ bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
+ //! Reimplement the TIDMapper::GetNodeObjID
virtual
vtkIdType
GetNodeObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeCoord
virtual
float*
GetNodeCoord(vtkIdType theObjID);
+ //! Reimplement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemVTKID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemCell
virtual
vtkCell*
GetElemCell(vtkIdType theObjID);
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
- TID2ID myElemObj2VTKID;
- TSubProfileArr mySubProfileArr;
- PNamedPointCoords myNamedPointCoords;
- TMeshOnEntityImpl* myMeshOnEntity;
+ TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
+ TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilter
+ PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
+ TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
- TSource mySource;
- TGeom2SubProfile myGeom2SubProfile;
+ TSource mySource; //!< Keeps VTK representation of the MED TIMESTAMP mesh
+ TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
};
typedef SharedPtr<TProfileImpl> PProfileImpl;
//---------------------------------------------------------------
+ //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
struct TIDMapperFilter: virtual TMergeFilter
{
- TAppendFilter myIDMapper;
- TSource mySource;
+ TAppendFilter myIDMapper; //!< Responsible for numbering
+ TSource mySource; //!< Keeps assigned data
+ //! Reimplement the TIDMapper::GetNodeObjID
virtual
vtkIdType
GetNodeObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeCoord
virtual
float*
GetNodeCoord(vtkIdType theObjID);
+ //! Reimplement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemVTKID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemCell
virtual
vtkCell*
GetElemCell(vtkIdType theObjID);
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
//---------------------------------------------------------------
+ //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
struct TGaussImpl: virtual TGauss
{
- EGeometry myGeom;
- std::string myName;
- vtkIdType myNbPoints;
+ EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
+ std::string myName; //!< Keeps name of the MED GAUSS entity
+ vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
};
typedef SharedPtr<TGaussImpl> PGaussImpl;
//---------------------------------------------------------------
+ //! Specialize TGaussSubMesh to provide VTK mapping for the entity
struct TGaussSubMeshImpl: virtual TGaussSubMesh,
virtual TSource
{
TGaussSubMeshImpl();
+ //! To implement the TGaussPtsIDMapper::GetObjID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const;
- PGaussImpl myGauss;
+ PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
+
+ //! Keeps status of the structure
+ /*!
+ In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
+ in order to construct mesh for MED TIEMSTAMPS in uniform way.
+ */
ESubMeshStatus myStatus;
- TPointCoords myPointCoords;
+
+ TPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
};
typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
typedef std::map<EGeometry,PGaussSubMeshImpl> TGeom2GaussSubMesh;
+ //! Specialize TGaussMesh to provide VTK mapping for the entity
struct TGaussMeshImpl: virtual TGaussMesh,
virtual TAppendFilter
{
TGaussMeshImpl();
+ //! Reimplement the TGaussPtsIDMapper::GetObjID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
+ //! Reimplement the TGaussPtsIDMapper::GetParent
virtual
TNamedIDMapper*
GetParent();
- TSource mySource;
- TNamedIDMapper* myParent;
- TGaussSubMeshArr myGaussSubMeshArr;
- TGeom2GaussSubMesh myGeom2GaussSubMesh;
+ TSource mySource; //!< Keeps VTK representation of the Gauss Points
+ TNamedIDMapper* myParent; //!< Refer to parent mesh
+ TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilter
+ TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
};
typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
+ //---------------------------------------------------------------
+ //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
struct TGaussPtsIDFilter: virtual TIDMapperFilter,
virtual TGaussPtsIDMapper
{
PGaussPtsIDMapper myGaussPtsIDMapper;
+ //! Reimplement the TGaussPtsIDMapper::GetObjID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const;
+ //! Reimplement the TGaussPtsIDMapper::GetParent
virtual
TNamedIDMapper*
GetParent();
typedef TVector<vtkIdType> TConnect;
typedef TVector<TConnect> TCell2Connect;
+ //! The class is responsible for mapping of cells of defined geometrical type
struct TSubMeshImpl: virtual TSource
{
+
+ //! To implement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! To implement the TNamedIDMapper::GetElemName
virtual
std::string
GetElemName(vtkIdType theObjID) const;
vtkIdType myStartID;
- TCell2Connect myCell2Connect;
+ TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
};
typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
typedef TVector<PSubMeshImpl> TSubMeshArr;
+ //! Specialize TMeshOnEntity to provide VTK mapping for the entity
struct TMeshOnEntityImpl: virtual TMeshOnEntity,
virtual TAppendFilter,
virtual TSizeCounter
{
+ //! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeObjID
virtual
vtkIdType
GetNodeObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemVTKID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Reimplement the TNamedIDMapper::GetNodeName
virtual
std::string
GetNodeName(vtkIdType theObjID) const;
+ //! Reimplement the TNamedIDMapper::GetElemName
virtual
std::string
GetElemName(vtkIdType theObjID) const;
- TID2ID myElemObj2VTKID;
- TSubMeshArr mySubMeshArr;
- PNamedPointCoords myNamedPointCoords;
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
- TGeom2SubMesh myGeom2SubMesh;
+ TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
};
typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
//---------------------------------------------------------------
typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
+ //! Specialize TFamily to provide VTK mapping for the entity
struct TFamilyImpl: virtual TFamily,
virtual TSource
{
+ //! Reimplement the TIDMapper::GetNodeObjID
vtkIdType
GetNodeObjID(vtkIdType theID) const ;
+ //! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const ;
+ //! Reimplement the TIDMapper::GetElemVTKID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetVTKOutput
virtual
TVTKOutput*
GetVTKOutput();
- PNamedPointCoords myNamedPointCoords;
- TID2ID myElemObj2VTKID;
- TSubMeshID myMeshID;
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
- TGeom2SubMeshID myGeom2SubMeshID;
+ TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
};
typedef SharedPtr<TFamilyImpl> PFamilyImpl;
typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
typedef TVector<PFamilyImpl> TFamilyArr;
+ //! Specialize TGroup to provide VTK mapping for the entity
struct TGroupImpl: virtual TGroup,
virtual TAppendFilter
{
+ //! Calculate pair of values - number of cells and its size
TNbASizeCells
GetNbASizeCells() const;
+ //! Reimplement the TIDMapper::GetElemVTKID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetElemObjID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeObjID
virtual
vtkIdType
GetNodeObjID(vtkIdType theID) const;
+ //! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const;
- TID2ID myElemObj2VTKID;
- TFamilyArr myFamilyArr;
- PNamedPointCoords myNamedPointCoords;
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
};
typedef SharedPtr<TGroupImpl> PGroupImpl;
//---------------------------------------------------------------
typedef TVector<TMinMax> TMinMaxArr;
+ //! Specialize TField to provide VTK mapping for the entity
struct TFieldImpl: virtual TField
{
- vtkIdType myDataSize;
+ vtkIdType myDataSize; //!< Keeps size of the assigned data
- TMinMaxArr myMinMaxArr;
+ TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
+ //! Implement the TField::GetMinMax
virtual
TMinMax
GetMinMax(vtkIdType theCompID);
+ //! To initialize the data structure
void
InitArrays(vtkIdType theNbComp);
typedef TVector<TCValueSlice> TCValueSliceArr;
typedef TVector<TValueSlice> TValueSliceArr;
+ //! Define a container to get access to data assigned to mesh
struct TMeshValue
{
- TValue myValue;
+ TValue myValue; //!< Keeps all values as one dimensional sequence
- vtkIdType myNbElem;
- vtkIdType myNbComp;
- vtkIdType myNbGauss;
- vtkIdType myStep;
+ vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to
+ vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD
+ vtkIdType myNbGauss; //!< Defines number of Gauss Points
+ vtkIdType myStep; //! Internal variable
+ //! To intitilize the data strucutre
void
Init(vtkIdType theNbElem,
vtkIdType theNbGauss,
vtkIdType theNbComp);
+ //! To get assigned values first by Gauss Points and then by components (constant version)
TCValueSliceArr
GetGaussValueSliceArr(vtkIdType theElemId) const;
+ //! To get assigned values first by Gauss Points and then by components
TValueSliceArr
GetGaussValueSliceArr(vtkIdType theElemId);
+ //! To get assigned values first by components and then by Gauss Points (constant version)
TCValueSliceArr
GetCompValueSliceArr(vtkIdType theElemId) const;
+ //! To get assigned values first by components and then by Gauss Points
TValueSliceArr
GetCompValueSliceArr(vtkIdType theElemId);
};
//---------------------------------------------------------------
typedef std::map<EGeometry,TMeshValue> TGeom2Value;
+ //! Specialize TValForTime to provide VTK mapping for the entity
struct TValForTimeImpl: virtual TValForTime
{
- PGaussPtsIDFilter myGaussPtsIDFilter;
- PIDMapperFilter myIDMapperFilter;
- TGeom2Value myGeom2Value;
- vtkIdType myNbGauss;
+ PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
+ PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
+ TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
+ vtkIdType myNbGauss; //!< Keep number of Gauss Points
TValForTimeImpl();
+ //! Get mesh data for defined geometrical type (constant version)
const TMeshValue&
GetMeshValue(EGeometry theGeom) const;
+ //! Get mesh data for defined geometrical type
TMeshValue&
GetMeshValue(EGeometry theGeom);
+ //! Get number of Gauss Points for defined geometrical type
virtual
int
GetNbGauss(EGeometry theGeom) const;
}
+//! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
+/*!
+ It implements VISU_Convertor public interface and declare new pure virtual functions
+ to fill its intermediate data structure from a MED source
+*/
class VISU_Convertor_impl: public VISU_Convertor
{
public:
virtual
~VISU_Convertor_impl();
+ //! Just to define default behaviour
virtual
VISU_Convertor*
- Build()
- {
- return this;
- }
+ Build();
+
+ //! Just to define default behaviour
+ virtual
+ VISU_Convertor*
+ BuildEntities();
+
+ //! Just to define default behaviour
+ virtual
+ VISU_Convertor*
+ BuildFields();
+
+ //! Just to define default behaviour
+ virtual
+ VISU_Convertor*
+ BuildMinMax();
+
+ //! Just to define default behaviour
+ virtual
+ VISU_Convertor*
+ BuildGroups();
+ //! Implemention of the VISU_Convertor::GetSize
virtual
float
GetSize();
+ //! Implemention of the VISU_Convertor::GetMeshOnEntity
virtual
VISU::PNamedIDMapper
GetMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity);
+ //! Implemention of the VISU_Convertor::GetMeshOnEntitySize
virtual
float
GetMeshOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity);
+ //! Implemention of the VISU_Convertor::GetFamilyOnEntity
virtual
VISU::PIDMapper
GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
+ //! Implemention of the VISU_Convertor::GetFamilyOnEntitySize
virtual
float
GetFamilyOnEntitySize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
+ //! Implemention of the VISU_Convertor::GetMeshOnGroup
virtual
VISU::PIDMapper
GetMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
+ //! Implemention of the VISU_Convertor::GetMeshOnGroupSize
virtual
float
GetMeshOnGroupSize(const std::string& theMeshName,
const std::string& theGroupName);
+ //! Implemention of the VISU_Convertor::GetTimeStampOnMesh
virtual
VISU::PIDMapper
GetTimeStampOnMesh(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum);
+ //! Implemention of the VISU_Convertor::GetTimeStampSize
virtual
float
GetTimeStampSize(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum);
+ //! Implemention of the VISU_Convertor::GetTimeStampOnGaussPts
virtual
VISU::PGaussPtsIDMapper
GetTimeStampOnGaussPts(const std::string& theMeshName,
const std::string& theFieldName,
int theStampsNum);
+ //! Implemention of the VISU_Convertor::GetFieldOnMeshSize
virtual
float
GetFieldOnMeshSize(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName);
+ //! Implemention of the VISU_Convertor::GetField
virtual
const VISU::PField
GetField(const std::string& theMeshName,
VISU::TEntity theEntity,
const std::string& theFieldName);
+ //! Implemention of the VISU_Convertor::GetTimeStamp
virtual
const VISU::PValForTime
GetTimeStamp(const std::string& theMeshName,
int theStampsNum);
protected:
+ //! An utility method to find TMesh by its name
VISU::PMeshImpl
FindMesh(const std::string& theMeshName);
+ //! An utility method to find TMeshOnEntity by name of its parent mesh and entity
typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
TFindMeshOnEntity
FindMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity);
+ //! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
TFindFamilyOnEntity
FindFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
+ //! An utility method to find Group by name of its parent mesh and its name
typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
TFindMeshOnGroup
FindMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
+ //! An utility method to find TField by name of its parent mesh, corresponding entity and its name
typedef boost::tuple<VISU::PMeshImpl,
VISU::PMeshOnEntityImpl,
VISU::PMeshOnEntityImpl,
const VISU::TEntity& theEntity,
const std::string& theFieldName);
+ //! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number
typedef boost::tuple<VISU::PMeshImpl,
VISU::PMeshOnEntityImpl,
VISU::PMeshOnEntityImpl,
int theStampsNum);
protected:
+ //! To fill intermeiate representation of TMeshOnEntity from a MED source
virtual
int
LoadMeshOnEntity(VISU::PMeshImpl theMesh,
VISU::PMeshOnEntityImpl theMeshOnEntity) = 0;
+ //! To fill intermeiate representation of TFamily from a MED source
virtual
int
LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
VISU::PMeshOnEntityImpl theMeshOnEntity,
VISU::PFamilyImpl theFamily) = 0;
+ //! To fill intermeiate representation of TGroup from a MED source
virtual
int
LoadMeshOnGroup(VISU::PMeshImpl theMesh,
const VISU::TFamilySet& theFamilySet) = 0;
+ //! To fill intermeiate representation of TValForTime for ordinary mesh from a MED source
virtual
int
LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime) = 0;
+ //! To fill intermeiate representation of TValForTime for mesh on Gauss Points from a MED source
virtual
int
LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
#ifndef VISU_IDMapper_HeaderFile
#define VISU_IDMapper_HeaderFile
+/*!
+ \file VISU_IDMapper.hxx
+ \brief The file contains declarations for basic interfaces that defines mapping of mesh elements
+*/
+
#include "MED_SharedPtr.hxx"
#include <vtkSystemIncludes.h>
using MED::SharedPtr;
//---------------------------------------------------------------
+ //! Defines a basic class for intemediate data structures
struct TBaseStructure
{
+ //! Just to provide possibility of dynamic navigation through the class hierarchy
virtual ~TBaseStructure()
{}
+
+ std::string myEntry; //!< To simplify publication of the object tree
};
typedef SharedPtr<TBaseStructure> PBaseStructure;
//---------------------------------------------------------------
typedef vtkUnstructuredGrid TVTKOutput;
+ //! Defines a basic abstract interface for VTK to object ID's and backward mapping
+ /*!
+ Where object ID means ID which attached to corresponding MED entity.
+ For example, each MED node can have its own ID as well as any other mesh cell
+ */
struct TIDMapper: virtual TBaseStructure
{
+ //! Get node object ID for corresponding VTK ID
virtual
vtkIdType
GetNodeObjID(vtkIdType theID) const;
+ //! Get node VTK ID for corresponding object ID
virtual
vtkIdType
GetNodeVTKID(vtkIdType theID) const;
+ //! Get coordinates of node for corresponding object ID
virtual
float*
GetNodeCoord(vtkIdType theObjID);
+ //! Get cell object ID for corresponding VTK ID
virtual
vtkIdType
GetElemObjID(vtkIdType theID) const;
+ //! Get cell VTK ID for corresponding object ID
virtual
vtkIdType
GetElemVTKID(vtkIdType theID) const;
+ //! Get VTK representation of mesh cell for corresponding object ID
virtual
vtkCell*
GetElemCell(vtkIdType theObjID);
+ //! Get VTK representation of mesh for corresponding MED entity
virtual
TVTKOutput*
GetVTKOutput() = 0;
//---------------------------------------------------------------
+ //! Defines an abstract interface for VTK to object ID's and backward mapping
+ /*!
+ This class defines some additional methods that allow get names for corresponding mesh elements
+ */
struct TNamedIDMapper: virtual TIDMapper
{
+ //! Get name of mesh node for corresponding object ID
virtual
std::string
GetNodeName(vtkIdType theObjID) const = 0;
+ //! Get name of mesh cell for corresponding object ID
virtual
std::string
GetElemName(vtkIdType theObjID) const = 0;
//---------------------------------------------------------------
- typedef vtkIdType TCellID;
+ typedef vtkIdType TCellID;
typedef vtkIdType TLocalPntID;
+ //! Defines a type that represent complex ID for defined Gauss Point
typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
struct TGaussPtsIDMapper: virtual TIDMapper
{
+ //! Gets complex Gauss Point ID by its VTK ID
virtual
TGaussPointID
GetObjID(vtkIdType theID) const = 0;
+ //! Gets parent TNamedIDMapper, which contains reference mesh cells
virtual
TNamedIDMapper*
GetParent() = 0;
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
-static int MYMEMORYDEBUG = 0;
-static int MYTHREADDEBUG = 0;
static int MY_FAMILY_DEBUG = 0;
static int MY_GROUP_DEBUG = 0;
-//#define _DEXCEPT_
+#define _DEXCEPT_
#else
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
-static int MYMEMORYDEBUG = 0;
-static int MYTHREADDEBUG = 0;
static int MY_FAMILY_DEBUG = 0;
static int MY_GROUP_DEBUG = 0;
#endif
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"InitProfile");
INITMSG(MYDEBUG,"InitProfile"<<endl);
TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
INITMSG(MYDEBUG,"GetGaussKey"<<endl);
TGaussKey aGaussKey;
PMEDProfile aProfile = theValForTime.myProfile;
TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
if(theMeshOnEntity.myEntity == NODE_ENTITY)
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
// The order of the function calls is important
//---------------------------------------------------------------
- typedef std::map<TInt,TInt> TFamilyCounterMap;
-
void
BuildMeshOnEntityMap(PMEDMesh theMesh,
- TFamilyCounterMap& theFamilyID2CellsSize,
const MED::TEntityInfo& theEntityInfo,
const MED::PNodeInfo& theNodeInfo,
const MED::PWrapper& theMEDWrapper)
{
+ TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
+
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const std::string& aMeshName = theMesh->myName;
TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
aMeshOnEntity->myEntity = aVEntity;
aMeshOnEntity->myMeshName = aMeshName;
aMeshOnEntity->myGeom2Size = aGeom2Size;
-
+ TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+
INITMSG(MYDEBUG,
"- aMEntity = "<<aMEntity<<
"; aVEntity = "<<aVEntity<<
for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
TInt aFamId = theNodeInfo->GetFamNum(iElem);
if(aFamId != 0)
- theFamilyID2CellsSize[aFamId] += 2;
+ aFamilyID2CellsSize[aFamId] += 2;
}
INITMSG(MYDEBUG,
aMeshOnEntity->myCellsSize += aNbConn;
TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
if(aFamId != 0)
- theFamilyID2CellsSize[aFamId] += aNbConn + 1;
+ aFamilyID2CellsSize[aFamId] += aNbConn + 1;
}
break;
}
aMeshOnEntity->myCellsSize += aCellSize;
TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
if(aFamId != 0)
- theFamilyID2CellsSize[aFamId] += aCellSize + 1;
+ aFamilyID2CellsSize[aFamId] += aCellSize + 1;
}
break;
}
for(TInt iElem = 0; iElem < aNbElem; iElem++){
TInt aFamId = aCellInfo->GetFamNum(iElem);
if(aFamId != 0)
- theFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+ aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
}
}} // end switch(...)
}
}
- //---------------------------------------------------------------
- struct TFieldMinMax
- {
- VISU::PMEDField myField;
- MED::PFieldInfo myFieldInfo;
- TInt myNbTimeStamps;
- MED::EEntiteMaillage myMEntity;
- MED::TGeom2Size myGeom2Size;
- MED::TMKey2Profile myMKey2Profile;
- MED::TKey2Gauss myKey2Gauss;
- MED::PWrapper myMEDWrapper;
-
- TFieldMinMax(const VISU::PMEDField& theField,
- const MED::PFieldInfo& theFieldInfo,
- TInt theNbTimeStamps,
- MED::EEntiteMaillage theMEntity,
- const MED::TGeom2Size& theGeom2Size,
- const MED::TMKey2Profile& theMKey2Profile,
- const MED::TKey2Gauss& theKey2Gauss,
- const MED::PWrapper& theMEDWrapper):
- myField(theField),
- myFieldInfo(theFieldInfo),
- myNbTimeStamps(theNbTimeStamps),
- myMEntity(theMEntity),
- myGeom2Size(theGeom2Size),
- myMKey2Profile(theMKey2Profile),
- myKey2Gauss(theKey2Gauss),
- myMEDWrapper(theMEDWrapper)
- {
- INITMSG(MYMEMORYDEBUG,"TFieldMinMax() - "<<this<<endl);
- }
-
- ~TFieldMinMax()
- {
- INITMSG(MYMEMORYDEBUG,"~TFieldMinMax() - "<<this<<endl);
- }
-
- void
- Calculate()
- {
- INITMSG(MYTHREADDEBUG,"TFieldMinMax::Calculate() - "<<this<<
- "; aFieldName = '"<<myField->myName<<"'"<<
- "; myNbTimeStamps = "<<myNbTimeStamps<<
- endl);
-
- TInt aNbComp = myField->myNbComp;
- int aNbComp2 = aNbComp;
- if(aNbComp == 2 || aNbComp == 4)
- aNbComp2 = 2;
- else if(aNbComp > 4)
- aNbComp2 = 3;
-
- TValField& aValField = myField->myValField;
- TMinMaxArr& aMinMaxArr = myField->myMinMaxArr;
- for(TInt iTimeStamp = 1; iTimeStamp <= myNbTimeStamps; iTimeStamp++){
- INITMSG(MYTHREADDEBUG,"- "<<this<<"; iTimeStamp = "<<iTimeStamp<<endl);
-
- MED::PTimeStampInfo aTimeStampInfo = myMEDWrapper->GetPTimeStampInfo(myFieldInfo,
- myMEntity,
- myGeom2Size,
- iTimeStamp);
- MED::PTimeStampVal aTimeStampVal = myMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
- myMKey2Profile,
- myKey2Gauss);
- PMEDValForTime aValForTime = aValField[iTimeStamp];
-
- const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
-
- PMEDProfile aProfile = aValForTime->myProfile;
- TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
- for(; anIter != aGeom2SubProfile.end(); anIter++){
- VISU::EGeometry aEGeom = anIter->first;
- PMEDSubProfile aSubProfile(anIter->second);
-
- TInt aNbElem = aSubProfile->myNbCells;
- TInt aNbGauss = aValForTime->GetNbGauss(aEGeom);
-
- if(aSubProfile->myStatus != eRemoveAll){
- INITMSG(MYTHREADDEBUG,
- "- "<<this<<
- "; aEGeom = "<<aEGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbGauss = "<<aNbGauss<<
- endl);
-
- MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
- const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
-
- // To calculate min/max per components
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
- TMinMax& aMinMax = aMinMaxArr[iComp+1];
- float& aMin = aMinMax.first;
- float& aMax = aMinMax.second;
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- const float& aVal = aMValueSlice[iGauss];
- aMin = min(aMin,aVal);
- aMax = max(aMax,aVal);
- }
- }
- }
-
- // To calculate min/max per vector modulus
- TMinMax& aMinMax = aMinMaxArr[0];
- float& aMin = aMinMax.first;
- float& aMax = aMinMax.second;
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
- float aValue = 0.0;
- for(TInt iComp = 0; iComp < aNbComp2; iComp++){
- float aVal = aMValueSlice[iComp];
- aValue += aVal*aVal;
- }
- aValue = sqrt(aValue);
- aMin = min(aMin,aValue);
- aMax = max(aMax,aValue);
- }
- }
- }
- }
- }
- for(TInt iComp = 0; iComp <= aNbComp; iComp++){
- VISU::TMinMax aMinMax = myField->GetMinMax(iComp);
- INITMSG(MYTHREADDEBUG,"- "<<this<<"; "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
- }
- }
- };
- typedef SharedPtr<TFieldMinMax> PFieldMinMax;
-
-
- //---------------------------------------------------------------
- void
- GetFieldMinMax(PFieldMinMax theFieldMinMax)
- {
- theFieldMinMax->Calculate();
- }
-
-
- //---------------------------------------------------------------
- struct TCalculateMinMax
- {
- VISU::PMEDMesh myMesh;
- MED::TEntityInfo myEntityInfo;
- MED::TMKey2Profile myMKey2Profile;
- MED::TKey2Gauss myKey2Gauss;
- MED::PWrapper myMEDWrapper;
-
- TCalculateMinMax(const VISU::PMEDMesh& theMesh,
- const MED::TEntityInfo& theEntityInfo,
- const MED::TMKey2Profile& theMKey2Profile,
- const MED::TKey2Gauss& theKey2Gauss,
- const MED::PWrapper& theMEDWrapper):
- myMesh(theMesh),
- myEntityInfo(theEntityInfo),
- myMKey2Profile(theMKey2Profile),
- myKey2Gauss(theKey2Gauss),
- myMEDWrapper(theMEDWrapper)
- {
- INITMSG(MYMEMORYDEBUG,"TCalculateMinMax() - "<<this<<endl);
- }
-
- ~TCalculateMinMax()
- {
- INITMSG(MYMEMORYDEBUG,"~TCalculateMinMax() - "<<this<<endl);
- }
-
- void
- Calculate()
- {
- TInt aNbFields = myMEDWrapper->GetNbFields();
- MED::PMeshInfo aMeshInfo = myMesh->myMeshInfo;
- const std::string& aMeshName = myMesh->myName;
- INITMSG(MYDEBUG,"MinMaxCalculation: aNbFields = "<<aNbFields<<"\n");
- for(TInt iField = 1; iField <= aNbFields; iField++){
- MED::PFieldInfo aFieldInfo = myMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
- TInt aNbComp = aFieldInfo->GetNbComp();
- std::string aFieldName = aFieldInfo->GetName();
-
- MED::TGeom2Size aGeom2Size;
- MED::EEntiteMaillage aMEntity;
- TInt aNbTimeStamps = myMEDWrapper->GetNbTimeStamps(aFieldInfo,
- myEntityInfo,
- aMEntity,
- aGeom2Size);
- if(aNbTimeStamps < 1)
- continue;
-
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = myMesh->myMeshOnEntityMap[aVEntity];
- TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- PMEDField aField = aFieldMap[aFieldName];
-
- PFieldMinMax aFieldMinMax(new TFieldMinMax(aField,
- aFieldInfo,
- aNbTimeStamps,
- aMEntity,
- aGeom2Size,
- myMKey2Profile,
- myKey2Gauss,
- myMEDWrapper));
-
- boost::thread aThread(boost::bind(&GetFieldMinMax,aFieldMinMax));
- }
- }
- };
- typedef SharedPtr<TCalculateMinMax> PCalculateMinMax;
-
-
- //---------------------------------------------------------------
- void
- CalculateMinMax(PCalculateMinMax theCalculateMinMax)
- {
- theCalculateMinMax->Calculate();
- }
-
-
//---------------------------------------------------------------
void
BuildFieldMap(PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
- const MED::TMKey2Profile& theMKey2Profile,
- const MED::TKey2Gauss& theKey2Gauss,
MED::PWrapper theMEDWrapper)
{
+ TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
TInt aNbFields = theMEDWrapper->GetNbFields();
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const std::string& aMeshName = theMesh->myName;
INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
for(TInt iField = 1; iField <= aNbFields; iField++){
+ TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
TInt aNbComp = aFieldInfo->GetNbComp();
std::string aFieldName = aFieldInfo->GetName();
}
for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+ TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
aMEntity,
aGeom2Size,
iTimeStamp);
TFloat aDt = aTimeStampInfo->GetDt();
std::string anUnitDt = aTimeStampInfo->GetUnitDt();
- MED::PTimeStampVal aTimeStampVal = theMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
- theMKey2Profile,
- theKey2Gauss);
+
TValField& aValField = aField->myValField;
PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
aValForTime->myId = iTimeStamp;
aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
-
- InitGaussProfile(theMEDWrapper,
- aMeshInfo,
- aTimeStampVal,
- aMeshOnEntity,
- aMEntity,
- aGeom2Size,
- aValForTime);
}
}
}
//---------------------------------------------------------------
void
BuildFamilyMap(PMEDMesh theMesh,
- const TFamilyCounterMap& theFamilyID2CellsSize,
const MED::TEntityInfo& theEntityInfo,
const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
const MED::TFamilyInfoSet& theFamilyInfoSet,
MED::PWrapper theMEDWrapper)
{
+ TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
INITMSG(MYDEBUG,"BuildFamilyMap\n");
+
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
TEntity aVEntity = MEDEntityToVTK(aMEntity);
PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+ const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
if(aFamilyTSizeSet.empty())
aFamily->myNbCells = aSize;
aFamily->myCellsSize = 0;
- TFamilyCounterMap::const_iterator anIter = theFamilyID2CellsSize.find(anId);
- if(anIter != theFamilyID2CellsSize.end())
+ TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
+ if(anIter != aFamilyID2CellsSize.end())
aFamily->myCellsSize = anIter->second;
INITMSG(MY_FAMILY_DEBUG,
BuildGroupMap(PMEDMesh theMesh,
const MED::TFamilyInfoSet& theFamilyInfoSet)
{
- INITMSG(MYDEBUG,"BuildGroupMap:\n");
+ TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
+ INITMSG(MYDEBUG,"BuildGroupMap\n");
+
TGroupMap& aGroupMap = theMesh->myGroupMap;
MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
return myElemInfo->GetElemName(theObjID);
return TSubMeshImpl::GetElemName(theObjID);
}
+
+ struct TSetIsDone
+ {
+ bool& myIsDone;
+ TSetIsDone(bool& theIsDone):
+ myIsDone(theIsDone)
+ {}
+
+ ~TSetIsDone()
+ {
+ myIsDone = true;
+ }
+
+ };
}
}
VISU_MedConvertor
-::VISU_MedConvertor(const string& theFileName)
+::VISU_MedConvertor(const string& theFileName):
+ myIsEntitiesDone(false),
+ myIsFieldsDone(false),
+ myIsGroupsDone(false),
+ myIsMinMaxDone(false)
{
myFileInfo.setFile(QString(theFileName.c_str()));
myName = myFileInfo.baseName().latin1();
//---------------------------------------------------------------
VISU_Convertor*
VISU_MedConvertor
-::Build()
+::BuildEntities()
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+ if(myIsEntitiesDone)
+ return this;
- MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
- MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+ TSetIsDone aSetIsDone(myIsEntitiesDone);
+ TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
+ MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
TInt aNbMeshes = aMed->GetNbMeshes();
TMeshMap& aMeshMap = myMeshMap;
- MSG(MYDEBUG,"VISU_MedConvertor::Build()");
- INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
+ INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
#ifndef _DEXCEPT_
try{
#endif
+ TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+ std::string aMeshName = aMeshInfo->GetName();
+ TInt aDim = aMeshInfo->GetDim();
MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
- MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
- MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
- MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo);
-
- // creating TMesh structure and TMeshOnEntityMap
- TInt aDim = aMeshInfo->GetDim();
- std::string aMeshName = aMeshInfo->GetName();
+ MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+ // creating TMesh structure and TMeshOnEntityMap
PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
aMesh->myDim = aDim;
aMesh->myName = aMeshName;
aMesh->myNbPoints = aNodeInfo->GetNbElem();
aMesh->myMeshInfo = aMeshInfo;
- aMesh->myEntityInfo = aEntityInfo;
+ aMesh->myEntityInfo = anEntityInfo;
aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
#ifndef _DEXCEPT_
try{
#endif
- BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
- TFamilyCounterMap aFamilyID2CellsSize;
+ BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
BuildMeshOnEntityMap(aMesh,
- aFamilyID2CellsSize,
- aEntityInfo,
+ anEntityInfo,
aNodeInfo,
aMed);
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor*
+VISU_MedConvertor
+::BuildFields()
+{
+ if(myIsFieldsDone)
+ return this;
+
+ TSetIsDone aSetIsDone(myIsFieldsDone);
+ TTimerLog aTimerLog(MYDEBUG,"BuildFields");
+ MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
+
+ INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
+
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+ try{
+#endif
+ TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
+ MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+ std::string aMeshName = aMeshInfo->GetName();
+
+ TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ if(anIter == aMeshMap.end())
+ continue;
+ PMEDMesh aMesh = anIter->second;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
+#ifndef _DEXCEPT_
+ try{
+#endif
+ MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
BuildFieldMap(aMesh,
- aEntityInfo,
- aMKey2Profile,
- aKey2Gauss,
+ anEntityInfo,
aMed);
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor*
+VISU_MedConvertor
+::BuildMinMax()
+{
+ if(myIsMinMaxDone)
+ return this;
+
+ TSetIsDone aSetIsDone(myIsMinMaxDone);
+ TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
+ MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+ MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
+ MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
+
+ INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
+
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+ try{
+#endif
+ TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
+
+ MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+ std::string aMeshName = aMeshInfo->GetName();
+
+ TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ if(anIter == aMeshMap.end())
+ continue;
+ PMEDMesh aMesh = anIter->second;
+
+#ifndef _DEXCEPT_
+ try{
+#endif
+ TInt aNbFields = aMed->GetNbFields();
+
+ INITMSG(MYDEBUG,
+ "- aMeshName = '"<<aMeshName<<"'"<<
+ "; aNbFields = "<<aNbFields<<"\n");
+
+ MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ for(TInt iField = 1; iField <= aNbFields; iField++){
+ TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
+ MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+ std::string aFieldName = aFieldInfo->GetName();
+ INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
+
+ MED::TGeom2Size aGeom2Size;
+ MED::EEntiteMaillage aMEntity;
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
+ anEntityInfo,
+ aMEntity,
+ aGeom2Size);
+ if(aNbTimeStamps < 1)
+ continue;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ PMEDField aField = aFieldMap[aFieldName];
+
+ TInt aNbComp = aField->myNbComp;
+ int aNbComp2 = aNbComp;
+ if(aNbComp == 2 || aNbComp == 4)
+ aNbComp2 = 2;
+ else if(aNbComp > 4)
+ aNbComp2 = 3;
+
+ TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
+ for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
+ TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
+ INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
+
+ MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aGeom2Size,
+ iTimeStamp);
+
+ MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+
+ const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
-#ifdef _LOAD_FAMILIES_
+ const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
+
+ const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value;
+ MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+ for(; anIter != aGeom2Value.end(); anIter++){
+ const MED::TMeshValue& aMMeshValue = anIter->second;
+ MED::EGeometrieElement aMGeom = anIter->first;
+
+ TInt aNbElem = aMMeshValue.myNbElem;
+ TInt aNbGauss = aMMeshValue.myNbGauss;
+
+ MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+ if(aGaussIter == aGeom2Gauss.end())
+ aNbGauss = 1;
+
+ INITMSG(MYDEBUG,
+ "- aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ // To calculate min/max per components
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+ TMinMax& aMinMax = aMinMaxArr[iComp+1];
+ float& aMin = aMinMax.first;
+ float& aMax = aMinMax.second;
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const float& aVal = aMValueSlice[iGauss];
+ aMin = min(aMin,aVal);
+ aMax = max(aMax,aVal);
+ }
+ }
+ }
+
+ // To calculate min/max per vector modulus
+ TMinMax& aMinMax = aMinMaxArr[0];
+ float& aMin = aMinMax.first;
+ float& aMax = aMinMax.second;
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+ float aValue = 0.0;
+ for(TInt iComp = 0; iComp < aNbComp2; iComp++){
+ float aVal = aMValueSlice[iComp];
+ aValue += aVal*aVal;
+ }
+ aValue = sqrt(aValue);
+ aMin = min(aMin,aValue);
+ aMax = max(aMax,aValue);
+ }
+ }
+ }
+ }
+ for(TInt iComp = 0; iComp <= aNbComp; iComp++){
+ VISU::TMinMax aMinMax = aField->GetMinMax(iComp);
+ INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
+ }
+ }
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor*
+VISU_MedConvertor
+::BuildGroups()
+{
+ if(myIsGroupsDone)
+ return this;
+
+ TSetIsDone aSetIsDone(myIsGroupsDone);
+ TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
+ MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
+
+ INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
+
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+ try{
+#endif
+ TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+
+ MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+ std::string aMeshName = aMeshInfo->GetName();
+
+ TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ if(anIter == aMeshMap.end())
+ continue;
+ PMEDMesh aMesh = anIter->second;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
+
+ MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
+ MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo);
+
+#ifndef _DEXCEPT_
+ try{
+#endif
MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo);
BuildFamilyMap(aMesh,
- aFamilyID2CellsSize,
- aEntityInfo,
+ anEntityInfo,
anEntity2TGeom2ElemInfo,
aFamilyInfoSet,
aMed);
BuildGroupMap(aMesh,
aFamilyInfoSet);
-#endif
-
- PCalculateMinMax aCalculateMinMax(new TCalculateMinMax(aMesh,
- aEntityInfo,
- aMKey2Profile,
- aKey2Gauss,
- aMed));
-
- boost::thread aThread(boost::bind(&CalculateMinMax,aCalculateMinMax));
#ifndef _DEXCEPT_
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
}catch(...){
- EXCEPTION(runtime_error,"Unknown exception !!!");
+ MSG(MYDEBUG,"Unknown exception !!!");
}
#endif
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
}catch(...){
- EXCEPTION(runtime_error,"Unknown exception !!!");
+ MSG(MYDEBUG,"Unknown exception !!!");
}
#endif
}
::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
VISU::PMeshOnEntityImpl theMeshOnEntity)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
+ INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
+
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
const TEntity& anEntity = theMeshOnEntity->myEntity;
VISU::PMeshOnEntityImpl theMeshOnEntity,
VISU::PFamilyImpl theFamily)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
+ INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
+
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
const TEntity& anEntity = theMeshOnEntity->myEntity;
::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
const VISU::TFamilySet& theFamilySet)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
+ INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
+
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
+ INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
+
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
const TEntity& anEntity = theMeshOnEntity->myEntity;
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
+ INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
+
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
const TEntity& anEntity = theMeshOnEntity->myEntity;
::LoadPoints(const MED::PWrapper& theMed,
VISU::PMEDMesh theMesh)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
try{
//Check on existing family
PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
const VISU::PMEDMesh theMesh,
const VISU::PMEDFamily theFamily)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
try{
if(theFamily->myIsDone)
return 0;
const VISU::PMEDMesh theMesh,
const VISU::PMEDMeshOnEntity theMeshOnEntity)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
#ifndef _DEXCEPT_
try{
#endif
const VISU::PMEDMeshOnEntity theMeshOnEntity,
const VISU::PMEDFamily theFamily)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
#ifndef _DEXCEPT_
try{
#endif
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
INITMSG(MYDEBUG,"LoadProfile"<<endl);
PMEDProfile aProfile = theValForTime.myProfile;
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
bool theIsGauss,
bool& theIsDone)
{
+ TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
//Check on loading already done
aMKey2Profile,
aKey2Gauss);
+ InitGaussProfile(theMed,
+ aMeshInfo,
+ aTimeStampVal,
+ theMeshOnEntity,
+ aMEntity,
+ aGeom2Size,
+ theValForTime);
+
LoadProfile(theMed,
theMesh,
aTimeStampVal,
PMEDProfile aProfile = theValForTime->myProfile;
TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
TInt aNbComp = theField->myNbComp;
INITMSGA(MYDEBUG,0,
//---------------------------------------------------------------
+ typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
+
struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
{
+ TFamilyID2CellsSize myFamilyID2CellsSize;
MED::TGeom2Size myGeom2Size;
};
typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
VISU_MedConvertor();
VISU_MedConvertor(const VISU_MedConvertor&);
+ bool myIsEntitiesDone;
+ bool myIsFieldsDone;
+ bool myIsGroupsDone;
+ bool myIsMinMaxDone;
+
public:
VISU_MedConvertor(const std::string& theFileName);
virtual
VISU_Convertor*
- Build();
+ BuildEntities();
+
+ virtual
+ VISU_Convertor*
+ BuildFields();
+
+ virtual
+ VISU_Convertor*
+ BuildMinMax();
+
+ virtual
+ VISU_Convertor*
+ BuildGroups();
protected:
QFileInfo myFileInfo;
}
+ Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
+ return myVisuGen->CreateResult(theFileName);
+ }
+
+
Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
return myVisuGen->CopyAndImportFile(theFileName);
}
//Create Result
virtual Result_ptr ImportFile(const char* theFileName);
+ virtual Result_ptr CreateResult(const char* theFileName);
virtual Result_ptr CopyAndImportFile(const char* theFileName);
virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
//----------------------------------------------------------------------------
void
VISU_Actor
-::Update()
+::UpdateFromFactory()
{
myActorFactory->UpdateActor(this);
- Superclass::Update();
+ Update();
}
void
//----------------------------------------------------------------------------
virtual
void
- Update();
+ UpdateFromFactory();
virtual
void
//----------------------------------------------------------------------------
namespace VISU
{
+ //! This class defines an abstaract interface to manage actors
+ /*!
+ Actors are created by corresponding presentations and published in the defined view.
+ Each actor can be published only into one view but one presentation can have many actors.
+ Due to the complexity of the actor presentation interaction the new interface defines common
+ and simply way to manage them properly.
+ @note
+ This interface inherits from boost::bsignals::trackable in order to provide automatic
+ diconnection from defined signals if the object is destroyed.
+ */
struct TActorFactory: public virtual boost::bsignals::trackable
{
+ //! Just to make this class virtual
virtual
~TActorFactory()
{}
+ //! To update the actor
virtual
void
UpdateActor(VISU_Actor* theActor) = 0;
+ //! To unregister the actor
virtual
void
RemoveActor(VISU_Actor* theActor) = 0;
#define VISU_Event_h
#include "SVTK_Event.h"
+#include "SVTK_Selection.h"
namespace VISU
{
LastEvent
};
}
+
+const Selection_Mode GaussPointSelection = 100;
#endif
#include "VISU_ScalarBarCtrl.hxx"
#include "VISU_ScalarBarActor.hxx"
+#include "SALOME_ExtractGeometry.h"
+
#include "VISU_Event.h"
#include "SVTK_Actor.h"
#include <vtkTextProperty.h>
#include <vtkCellData.h>
+#include <vtkPointData.h>
+
#include <vtkDataArray.h>
+#include <vtkFloatArray.h>
#include <vtkSphereSource.h>
#include <vtkPolyDataMapper.h>
theWidgetCtrl->AddObserver(vtkCommand::DisableEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
+ theWidgetCtrl->AddObserver(vtkCommand::StartInteractionEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
theWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
return false;
}
- if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
- return Superclass::PreHighlight(theInteractorStyle,
- theSelectionEvent,
- theIsHighlight);
-
+ if(!theIsHighlight)
+ myLastObjPointID = -1;
- bool anIsSelectionModeChanged = (theSelectionEvent->mySelectionMode != mySelectionMode);
- if(!anIsSelectionModeChanged && mySelectionMode == ActorSelection)
- return false;
+ Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
- mySelectionMode = theSelectionEvent->mySelectionMode;
-
- bool anIsChanged = false;
- if(theIsHighlight){
- switch(mySelectionMode){
- case NodeSelection:
- case CellSelection:
- {
- myPointPicker->Pick(theSelectionEvent->myX,
- theSelectionEvent->myY,
- 0.0,
- theInteractorStyle->GetCurrentRenderer());
-
- if(myPointPicker->GetActor() != this)
- return false;
-
- vtkIdType aVtkId = myPointPicker->GetPointId();
-
- if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
- vtkIdType anObjId = GetNodeObjId( aVtkId );
- if(myLastObjPointID != anObjId){
+ if(aSelectionMode == ActorSelection || !theIsHighlight)
+ return Superclass::PreHighlight(theInteractorStyle,
+ theSelectionEvent,
+ theIsHighlight);
+
+ bool anIsChanged = (mySelectionMode != aSelectionMode);
+ bool anIsPreselected = myIsPreselected;
+ myIsPreselected = false;
+
+ if(aSelectionMode == GaussPointSelection && theIsHighlight){
+ myPointPicker->Pick(theSelectionEvent->myX,
+ theSelectionEvent->myY,
+ 0.0,
+ theInteractorStyle->GetCurrentRenderer());
+
+ if(myPointPicker->GetActor() != this)
+ return (anIsPreselected != myIsPreselected);
+
+ vtkIdType aVtkId = myPointPicker->GetPointId();
+
+ if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
+ vtkIdType anObjId = GetNodeObjId( aVtkId );
+ myIsPreselected = (anObjId >= 0);
+ if(myIsPreselected){
+ anIsChanged = (myLastObjPointID != anObjId);
+ if(anIsChanged){
float* aNodeCoord = GetNodeCoord(anObjId);
vtkDataSet* aDataSet = GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
float aPyramidHeight = myPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+ //float aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
+ float aColor[3];
+ theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
+ aColor[0] = 1. - aColor[0];
+ aColor[1] = 1. - aColor[1];
+ aColor[2] = 1. - aColor[2];
myCursorPyramid->Init(aPyramidHeight,
aRadius,
aNodeCoord,
- myPreHighlightActor->GetProperty()->GetColor());
+ aColor);
}
myLastObjPointID = anObjId;
}
myCursorPyramid->SetVisibility(true);
- myIsPreselected = theIsHighlight;
- anIsChanged = true;
}
}
- break;
- }
}
+
+ mySelectionMode = aSelectionMode;
+ anIsChanged |= (anIsPreselected != myIsPreselected);
return anIsChanged;
}
//----------------------------------------------------------------------------
+inline
+void
+ChangeZoom(VISU_PickingSettings *thePickingSettings,
+ vtkInteractorStyle* theInteractorStyle,
+ int theInitialHasIndex,
+ SVTK_Selector* theSelector,
+ const Handle(SALOME_InteractiveObject)& theIO)
+{
+ int aCurrentHasIndex = theSelector->HasIndex(theIO);
+
+ if(theInitialHasIndex + aCurrentHasIndex == 1){
+ vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
+ vtkCamera *aCamera = aRenderer->GetActiveCamera();
+ float aZoomFactor = thePickingSettings->GetZoomFactor();
+ double aScale = aCamera->GetParallelScale();
+ if (!theInitialHasIndex && aCurrentHasIndex) {
+ aCamera->SetParallelScale(aScale/aZoomFactor);
+ }
+ else {
+ aCamera->SetParallelScale(aScale*aZoomFactor);
+ }
+ }
+
+}
+
bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ Handle(SALOME_InteractiveObject) anIO = getIO();
+ int anInitialHasIndex = mySelector->HasIndex(anIO);
+
+ Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
+ //
+ if(!theIsHighlight && aSelectionMode == GaussPointSelection){
+ mySelector->RemoveIObject(anIO);
+
+ ChangeZoom(myPickingSettings,
+ theInteractorStyle,
+ anInitialHasIndex,
+ mySelector.GetPointer(),
+ anIO);
+
+ return true;
+ }
+
if (!myBarVisibility) {
return false;
}
//
- Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
- //
if(aSelectionMode == ActorSelection){
return Superclass::Highlight(theInteractorStyle,
theSelectionEvent,
theIsHighlight);
}
//
- if(!theSelectionEvent->myIsRectangle){
+ if(aSelectionMode == GaussPointSelection && !theSelectionEvent->myIsRectangle){
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
myPointPicker->Pick(theSelectionEvent->myX,
if(myPointPicker->GetActor() != this) {
mySelector->ClearIObjects();
+
+ ChangeZoom(myPickingSettings,
+ theInteractorStyle,
+ anInitialHasIndex,
+ mySelector.GetPointer(),
+ anIO);
+
return true;
}
mySelectionMode = aSelectionMode;
+ ChangeZoom(myPickingSettings,
+ theInteractorStyle,
+ anInitialHasIndex,
+ mySelector.GetPointer(),
+ anIO);
+
return true;
//
}// if( anObjId >= 0 ) {
}//if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO())
}//if(!theSelectionEvent->myIsRectangle){
+
+ ChangeZoom(myPickingSettings,
+ theInteractorStyle,
+ anInitialHasIndex,
+ mySelector.GetPointer(),
+ anIO);
return false;
}
bool anIsVisible = GetVisibility();
- if(mySelector->SelectionMode() == ActorSelection)
+ Selection_Mode aSelectionMode = mySelector->SelectionMode();
+
+ if(aSelectionMode == ActorSelection)
Superclass::highlight(theIsHighlight);
+ else if(aSelectionMode != GaussPointSelection)
+ return;
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
//
vtkDataSet* aDataSet = GetInput();
- vtkCellData* aCellData = aDataSet->GetCellData();
+ vtkCellData* aDataSetAttributes = aDataSet->GetCellData();
//
- vtkDataArray* aScalarArray = aCellData->GetScalars();
- vtkDataArray *aVectorArray = aCellData->GetVectors();
- //
- if(aScalarArray){
+ if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
aVal = aScalarArray->GetTuple1(aVtkId);
aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
//
GetScalarBarCtrl()->Update();
//
float aPyramidHeight = myPickingSettings->GetPyramidHeight();
- aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+ aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
myCursorPyramidSelected->Init(aPyramidHeight,
aRadius,
aNodeCoord,
aStr<<"\nLocalPntID: "<<aLocalPntID;
aStr<<"\nScalar: "<<aVal;
}
- if(aVectorArray) {
- float* pVec = aVectorArray->GetTuple3(aVtkId);
- aStr<<"\nVector: {"<<pVec[0]<<"; "<<pVec[1]<<"; "<<pVec[2]<<"}";
+
+ if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
+ if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
+ int aNbComp = aFloatArray->GetNumberOfComponents();
+ aStr<<"\nData: {";
+ int anId = 0;
+ while(anId < aNbComp){
+ float aComp = aFloatArray->GetComponent(aVtkId,anId++);
+ aStr<<aComp;
+ if(anId < aNbComp)
+ aStr<<"; ";
+ }
+ aStr<<"}";
+ }
}
//
// myTextActor
myPickingSettings = thePickingSettings;
if(thePickingSettings)
+ {
thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
+ this->UpdatePickingSettings();
+ }
}
void
VISU_GaussPtsAct
::UpdatePickingSettings()
{
- // Update picking parameters using myPickingSettings object
myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
- float aHeight=
- myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
+
+ float aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
myCursorPyramid->SetHeight(aHeight);
myCursorPyramidSelected->SetHeight(aHeight);
- //
+
+ myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
+ myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
+
Highlight(isHighlighted());
Update();
myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
myOutsideDeviceActor->SetVisibility(false);
-
- myCurrentPL = myDeviceActor->GetPipeLine();
}
if(theWidgetCtrl){
if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
myInsideDeviceActor->SetPipeLine(aPipeLine);
+ aPipeLine->Delete();
}
if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
myOutsideDeviceActor->SetPipeLine(aPipeLine);
+ aPipeLine->Delete();
- myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
-
- myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
+ SALOME_ExtractGeometry* anExtractGeometry = aPipeLine->GetExtractGeometryFilter();
+ anExtractGeometry->SetExtractBoundaryCells(true);
+ anExtractGeometry->SetExtractInside(true);
}
}
myOutsideCursorSettings = theOutsideCursorSettings;
if(theOutsideCursorSettings)
+ {
theOutsideCursorSettings->AddObserver(VISU::UpdateOutsideSettingsEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
+ this->UpdateOutsideCursorSettings();
+ }
}
void
::OnInteractorEvent(unsigned long theEvent)
{
switch(theEvent){
+ case vtkCommand::StartInteractionEvent:
+ myDeviceActor->SetVisibility(GetVisibility());
+ myInsideDeviceActor->SetVisibility(false);
+ myOutsideDeviceActor->SetVisibility(false);
+ break;
case vtkCommand::EnableEvent:
case vtkCommand::DisableEvent:
+ case vtkCommand::EndInteractionEvent:
myDeviceActor->SetVisibility(GetVisibility() && !myWidgetCtrl->GetEnabled());
myInsideDeviceActor->SetVisibility(GetVisibility() && myWidgetCtrl->GetEnabled());
myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidgetCtrl->GetEnabled());
default:
break;
}
-
-
- switch(theEvent){
- case vtkCommand::EnableEvent:
- myCurrentPL = myInsideDeviceActor->GetPipeLine();
- break;
- case vtkCommand::DisableEvent:
- myCurrentPL = myDeviceActor->GetPipeLine();
- break;
- default:
- break;
- }
Superclass::OnInteractorEvent(theEvent);
}
if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
myDeviceActor->SetPipeLine(aPipeLine);
myCurrentPL = aPipeLine;
+ aPipeLine->Delete();
}
}
//============================================================================
+//! Base class for Gauss Points Actors.
+/*!
+ The actor is responsible for representation of Gauss Points.
+ It render corresponding presentation by usage of corresponding VISU_GaussPtsDeviceActor.
+ Usage of such technic of rendering gives addititional flexibility to change its behaviour in run-time.
+ Also, the base class implements the following functionality:
+ - implements a highlight and prehighlight functionality;
+ - defining a way to handle VISU_ImplicitFunctionWidget;
+ - global / local scalar bar mamangement.
+*/
class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
{
public:
ShallowCopyPL(VISU_PipeLine* thePipeLine);
//----------------------------------------------------------------------------
+ //! Redefined method of getting a native mapper of the actor.
virtual
vtkMapper*
GetMapper();
+ //! Redefined method of getting an actor bounds.
virtual
float*
GetBounds();
+ //! Redefined method of getting an actor input.
virtual
vtkDataSet*
GetInput();
GetGaussPtsFactory();
//----------------------------------------------------------------------------
+ //! Add actor to the renderer.
virtual
void
AddToRender(vtkRenderer* theRenderer);
+ //! Remove actor from the renderer.
virtual
void
RemoveFromRender(vtkRenderer* theRenderer);
+ //! Set the Render Window Interactor to the actor.
virtual
void
SetInteractor(vtkRenderWindowInteractor* theInteractor);
+ //! Apply the transform on the actor.
virtual
void
SetTransform(VTKViewer_Transform* theTransform);
+ //! Redefined method of rendering the Opaque Geometry.
virtual
int
RenderOpaqueGeometry(vtkViewport *viewport);
+ //! Redefined method of rendering the Translucent Geometry.
virtual
int
RenderTranslucentGeometry(vtkViewport *viewport);
//----------------------------------------------------------------------------
+ //! Set actor visibility.
virtual
void
SetVisibility(int theMode);
+ //! Set Scalar Bar Control to the actor.
VISU_ScalarBarCtrl*
GetScalarBarCtrl();
+ //! Set the Scalar Bar Control visibility.
void
SetBarVisibility(bool theMode);
+ //! Get the Scalar Bar Control visibility.
bool
GetBarVisibility();
virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+ //! Return the information about pipeline magnification changing.
+ /*! True indicates that magnification is increased, false - decreased. */
bool
ChangeMagnification();
//----------------------------------------------------------------------------
+ //! Internal highlight.
virtual
void
Highlight(bool theIsHighlight);
+ //! Redefined method of the actor's prehighlighting
virtual
bool
PreHighlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight);
+
+ //! Redefined method of the actor's highlighting
virtual
bool
Highlight(vtkInteractorStyle* theInteractorStyle,
bool theIsHighlight);
//----------------------------------------------------------------------------
+ //! Set the picking settings to the actor.
void
SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
void
SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+ //! Apply the picking settings on the actor.
void
UpdatePickingSettings();
virtual
~VISU_GaussPtsAct();
+ // Redefined method of setting mapper input.
virtual
void
SetMapperInput(vtkDataSet* theDataSet);
//----------------------------------------------------------------------------
vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
- // Main process VTK event method
+ //! Main process VTK event method
static
void
ProcessEvents(vtkObject* theObject,
unsigned long theEvent,
void* theClientData,
void* theCallData);
+
+ // To process VTK event method
virtual
void
OnInteractorEvent(unsigned long theEvent);
//============================================================================
class VISU_GaussPtsAct2;
+//! Gauss Points Actor, displayed in the Base View.
+/*!
+ * Contains device actor (VISU_GaussPtsDeviceActor),
+ * which has two representation modes - outside and
+ * inside segmentation cursor.
+ */
class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
{
public:
ShallowCopyPL(VISU_PipeLine* thePipeLine);
//----------------------------------------------------------------------------
+ //! Set actor visibility.
virtual
void
SetVisibility(int theMode);
UpdateInsideCursorSettings();
//----------------------------------------------------------------------------
+ //! Set the Outside Cursor Gauss Points settings to the actor.
void
SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
+ //! Apply the Outside Cursor Gauss Points settings on the actor.
void
UpdateOutsideCursorSettings();
//----------------------------------------------------------------------------
+ //! Add actor to the renderer.
virtual
void
AddToRender(vtkRenderer* theRenderer);
+ //! Remove actor from the renderer.
virtual
void
RemoveFromRender(vtkRenderer* theRenderer);
+ //! Apply the transform on the actor.
virtual
void
SetTransform(VTKViewer_Transform* theTransform);
virtual
~VISU_GaussPtsAct1();
+ // Redefined method of setting mapper input.
virtual
void
SetMapperInput(vtkDataSet* theDataSet);
};
-//============================================================================
+//! Gauss Points Actor, displayed in the Segmented View.
class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
{
public:
VISU_GaussPtsAct2*
New();
+ // Redefined method of setting mapper input.
virtual
void
SetMapperInput(vtkDataSet* theDataSet);
ShallowCopyPL(VISU_PipeLine* thePipeLine);
//----------------------------------------------------------------------------
+ //! Set actor visibility.
virtual
void
SetVisibility(int theMode);
+ //! Get actor visibility.
virtual
int
GetVisibility();
//----------------------------------------------------------------------------
namespace VISU
{
+ //! Extend an abstaract interface to manage Gauss points actors
struct TGaussPtsActorFactory: virtual TActorFactory
{
+ //! To create VISU_GaussPtsAct2 actor (segemented representation) from VISU_GaussPtsAct1 (basic representation)
virtual
VISU_GaussPtsAct2*
CloneActor(VISU_GaussPtsAct1* theActor) = 0;
+ //! The VISU_GaussPtsAct can update its presentation
virtual
void
UpdateFromActor(VISU_GaussPtsAct* theActor) = 0;
#include <vtkPolyData.h>
#include <vtkRenderer.h>
#include <vtkTextProperty.h>
+#include <vtkProperty.h>
+#include <vtkTexture.h>
+
#include "utilities.h"
#ifdef _DEBUG_
}
+//----------------------------------------------------------------
+void
+VISU_GaussPtsDeviceActor
+::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
+{
+ if (this->Mapper == NULL)
+ {
+ vtkErrorMacro("No mapper for actor.");
+ return;
+ }
+
+ // render the property
+ if (!this->Property)
+ {
+ // force creation of a property
+ this->GetProperty();
+ }
+ this->Property->Render(this, ren);
+ if (this->BackfaceProperty)
+ {
+ this->BackfaceProperty->BackfaceRender(this, ren);
+ this->Device->SetBackfaceProperty(this->BackfaceProperty);
+ }
+ this->Device->SetProperty(this->Property);
+
+ // render the texture
+ if (this->Texture)
+ {
+ this->Texture->Render(ren);
+ }
+
+ // make sure the device has the same matrix
+ vtkMatrix4x4 *matrix = this->Device->GetUserMatrix();
+ this->GetMatrix(matrix);
+
+ this->Device->Render(ren,Mapper);
+ this->EstimatedRenderTime = Mapper->GetTimeToDraw();
+}
+
+
//----------------------------------------------------------------
void
VISU_GaussPtsDeviceActor
VISU_GaussPtsDeviceActor*
New();
+ virtual
+ void
+ Render(vtkRenderer *, vtkMapper *);
+
//----------------------------------------------------------------------------
void
AddToRender(vtkRenderer* theRenderer);
this->Initial = true;
this->PyramidHeight = -1;
+ this->PointTolerance = -1;
+ this->Color[0] = -1;
+ this->Color[1] = -1;
+ this->Color[1] = -1;
this->InfoWindowTransparency = -1;
this->InfoWindowPosition = -1;
this->ZoomFactor = -1;
//============================================================================
+//! Class of Outside Cursor Gauss Points settings.
+/*!
+ * Contains information about the point sprite parameters:
+ * Clamp, Texture, Alpha threshold, Const size and Color.
+ * Used by Gauss Points Actor.
+ */
class VISU_OutsideCursorSettings : public vtkObject
{
public:
};
-//============================================================================
+//! Class of Picking settings.
+/*!
+ * Contains information about the following parameters:
+ * Cursor Pyramid height, Info Window transparency,
+ * Info Window position, Zoom factor on first selected point,
+ * Camera movement steps number and Display parent mesh.
+ * Used by Gauss Points Actor.
+ */
class VISU_PickingSettings : public vtkObject
{
public:
vtkSetMacro( PyramidHeight, float );
vtkGetMacro( PyramidHeight, float );
+ vtkSetVector3Macro( Color, float );
+ vtkGetVector3Macro( Color, float );
+
+ vtkSetMacro( PointTolerance, float );
+ vtkGetMacro( PointTolerance, float );
+
vtkSetMacro( InfoWindowTransparency, float );
vtkGetMacro( InfoWindowTransparency, float );
bool Initial;
float PyramidHeight;
+ float PointTolerance;
+ float Color[3];
float InfoWindowTransparency;
int InfoWindowPosition;
float ZoomFactor;
VISU_Plot3DPL.hxx \
VISU_OpenGLPointSpriteMapper.hxx \
VISU_ImplicitFunctionWidget.hxx \
+ SALOME_ExtractGeometry.h \
VISU_ScalarBarCtrl.hxx \
VISU_PlanesWidget.hxx \
VISU_SphereWidget.hxx \
{
if(theNbElems < 1 )
return;
- vtkDataArray* aVectors = theInputData->GetVectors();
vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
int aNbComp = aFloatArray->GetNumberOfComponents();
else
output->GetPointData()->CopyScalarsOn();
outData->PassData(inData);
+ outData->AddArray(inData->GetArray("VISU_FIELD"));
}else{
output->GetCellData()->CopyVectorsOn();
int aNbElems = input->GetNumberOfCells();
else
output->GetCellData()->CopyScalarsOn();
outData->PassData(inData);
+ outData->AddArray(inData->GetArray("VISU_FIELD"));
}
}
class vtkWarpVector;
class SALOME_Transform;
+//! Pipeline for the Gauss Points presentation.
+/*!
+ * This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
+ * for rendering the Gauss Points as Point Sprites.
+ */
class VISU_GaussPointsPL : public VISU_ScalarMapPL
{
protected:
void
ShallowCopy(VISU_PipeLine *thePipeLine);
+ //! Get the native mapper.
virtual
TMapper*
GetMapper();
+ //! Get the internal #VISU_OpenGLPointSpriteMapper.
VISU_OpenGLPointSpriteMapper*
GetPSMapper();
+ //! Redefined method for building the pipeline.
virtual
void
Build();
+ //! Redefined method for updating the pipeline.
virtual
void
Update();
const VISU::PGaussPtsIDMapper&
GetGaussPtsIDMapper() const;
+ //! Set the Bicolor mode.
+ /*!
+ * 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(bool theBicolor);
+ //! Get the Bicolor mode.
bool
GetBicolor();
- void SetIsColored(bool theIsColored);
+ //! Set the Multicolored mode.
+ /*!
+ * This parameter is using 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(bool theIsColored);
void
SetPrimitiveType(int thePrimitiveType);
int
GetPrimitiveType() { return myPrimitiveType; }
+ //! Get the maximum Point Sprite size, which is supported by hardware.
float
GetMaximumSupportedSize();
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp.
void
SetClamp(float theClamp);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, float).
float
GetClamp() { return myClamp; }
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
void
SetSize(float theSize);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, float).
float
GetSize() { return mySize; }
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
void
SetMinSize(float theMinSize);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, float).
float
GetMinSize() { return myMinSize; }
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
void
SetMaxSize(float theMaxSize);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, float).
float
GetMaxSize() { return myMaxSize; }
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
void
SetMagnification(float theMagnification);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, float).
float
GetMagnification() { return myMagnification; }
+ //! Set the increment of changing Magnification parameter.
void
SetMagnificationIncrement(float theIncrement);
+ //! Get the increment of changing Magnification parameter.
float
GetMagnificationIncrement() { return myMagnificationIncrement; }
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold.
void
SetAlphaThreshold(float theAlphaThreshold);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, float).
float
GetAlphaThreshold() { return myAlphaThreshold; }
+ //! Method for changing the Magnification parameter.
void
ChangeMagnification( bool up );
+ //! Get the maximum size of Point Sprites in the presentation.
float
GetMaxPointSize();
+ //! Get point size by element's Id.
float
GetPointSize(vtkIdType theID);
+ //! Get point size by element's Id using the specified scalar array.
float
GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
+ //! Set image data for the Point Sprite texture.
void
SetImageData(vtkImageData* theImageData);
+ //! Make the image data for Point Sprite texture.
+ /*!
+ * First parameter - texture for shape.
+ * Second parameter - texture for alpha mask.
+ */
static
vtkImageData*
MakeTexture( const char* theMainTexture,
#include <stdio.h>
#include <cmath>
#include <string>
-#include <vector>
#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$");
#define VTK_PDPSM_NORMAL_TYPE_FLOAT 0x0010
#define VTK_PDPSM_NORMAL_TYPE_DOUBLE 0x0020
#define VTK_PDPSM_OPAQUE_COLORS 0x0040
-#define VTK_PDPSM_ALPHA_ARRAY 0x0080
#ifndef APIENTRY
#define APIENTRY
// Construct empty object.
VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
{
+ this->RenderMode = VISU_OpenGLPointSpriteMapper::Occlude;
+
this->ListId = 0;
this->TotalCells = 0;
this->ExtensionsInitialized = 0;
- this->ExtensionsOK = 0;
- this->AlphaChannelArray = NULL;
- this->SizeChannelArray = NULL;
- this->DefaultPointSize = 10.0;
- this->QuadraticPointDistanceAttenuation[0] = 1.0;
- this->QuadraticPointDistanceAttenuation[1] = 0.0;
- this->QuadraticPointDistanceAttenuation[2] = 0.0;
-
- this->RenderMode = VISU_OpenGLPointSpriteMapper::Occlude;
+ this->DefaultPointSize = 20.0;
this->UsePointSprites = true;
this->UseTextures = true;
this->PointSpritePrimitiveType = 0;
this->PointSpriteClamp = 100.0;
- this->PointSpriteSize = 0.0;
+ this->PointSpriteSize = 30.0;
this->PointSpriteMinSize = 15.0;
this->PointSpriteMaxSize = 50.0;
this->PointSpriteMagnification = 1.0;
{
this->ReleaseGraphicsResources(this->LastWindow);
}
- if (this->AlphaChannelArray)
- {
- delete [] this->AlphaChannelArray;
- this->AlphaChannelArray = NULL;
- }
- if (this->SizeChannelArray)
- {
- delete [] this->SizeChannelArray;
- this->SizeChannelArray = NULL;
- }
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
vglCompileShaderARB( VertexShader );
//this->PrintInfoLog( VertexShader );
- myVertexProgram = vglCreateProgramObjectARB();
- vglAttachObjectARB( myVertexProgram, VertexShader );
+ this->VertexProgram = vglCreateProgramObjectARB();
+ vglAttachObjectARB( this->VertexProgram, VertexShader );
- vglLinkProgramARB( myVertexProgram );
+ vglLinkProgramARB( this->VertexProgram );
//this->PrintInfoLog( VertexProgram );
/*
cout << "Shader from " << fileName << endl;
cout << "Loading vertex program... failed" << endl << endl;
*/
free( shader );
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0f, 0.0f, -4.0f );
- glRotatef( 0.0f, 1.0f, 0.0f, 0.0f );
- glRotatef( 0.0f, 0.0f, 1.0f, 0.0f );
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value )
{
- //cout << myVertexProgram << " ";
- //cout << vglGetAttribLocationARB( myVertexProgram, variable ) << " ";
+ //cout << this->VertexProgram << " ";
+ //cout << vglGetAttribLocationARB( this->VertexProgram, variable ) << " ";
//cout << variable << " " << value << endl;
- vglVertexAttrib1fARB( vglGetAttribLocationARB( myVertexProgram, variable ), value );
+ vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value );
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
if( this->UseShader )
this->InitShader();
- this->ExtensionsOK = 1;
this->ExtensionsInitialized = 1;
}
//-----------------------------------------------------------------------------
// make sure our window is current
ren->GetRenderWindow()->MakeCurrent();
- // For vertex coloring, this sets this->Colors as side effect.
- // Color arrays are cached. If nothing has changed,
- // then the scalars do not have to be regenerted.
- this->ActorOpacity = act->GetProperty()->GetOpacity();
- this->MapScalars(this->ActorOpacity);
-
// Initializing the texture for Point Sprites
if( this->UseTextures && this->PointSpritePrimitiveType == 0 )
this->InitTextures();
act->GetProperty()->GetMTime() > this->BuildTime ||
ren->GetRenderWindow() != this->LastWindow)
{
+ // sets this->Colors as side effect
+ this->MapScalars( act->GetProperty()->GetOpacity() );
+
if (!this->ImmediateModeRendering &&
!this->GetGlobalImmediateModeRendering())
{
if (this->ImmediateModeRendering ||
this->GetGlobalImmediateModeRendering())
{
+ // sets this->Colors as side effect
+ this->MapScalars( act->GetProperty()->GetOpacity() );
+
// Time the actual drawing
this->Timer->StartTimer();
this->Draw(ren,act);
//-----------------------------------------------------------------------------
float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
{
- float maximumSupportedSize = 300.0;
+ float maximumSupportedSize = 512.0;
//glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maximumSupportedSize );
return maximumSupportedSize;
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
{
- // Set GL params back to normal to stop other vtkMappers diusplaying wrongly
+ // Set GL params back to normal to stop other vtkMappers displaying wrongly
glDisable( GL_ALPHA_TEST );
glEnable( GL_BLEND );
};
//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
- vtkPoints *p,
+void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p,
vtkUnsignedCharArray *colors,
vtkFloatArray *alpha,
vtkIdType &cellNum,
glPointSize( this->DefaultPointSize );
- vglUseProgramObjectARB( myVertexProgram );
+ vglUseProgramObjectARB( this->VertexProgram );
- this->SetShaderVariable( "mode", this->PointSpriteMode );
- this->SetShaderVariable( "clamp", this->PointSpriteClamp );
- this->SetShaderVariable( "geomSize", this->PointSpriteSize );
- this->SetShaderVariable( "minSize", this->PointSpriteMinSize );
- this->SetShaderVariable( "maxSize", this->PointSpriteMaxSize );
- this->SetShaderVariable( "magnification", this->PointSpriteMagnification );
+ this->SetShaderVariable( "clamp_size", this->PointSpriteClamp );
TVertex* aVertex = new TVertex[ this->TotalCells ];
aVertex[i].g = green;
aVertex[i].b = blue;
- aVertex[i].hue = ComputeHue( ( int )( red * 255 ), ( int )( green * 255 ), ( int )( blue * 255 ) );
+ float size = 0.0;
+ if( this->PointSpriteMode == 0 )
+ {
+ float h = ComputeHue( ( int )( red * 255 ), ( int )( green * 255 ), ( int )( blue * 255 ) );
+ size = this->PointSpriteMinSize + ( PointSpriteMaxSize - PointSpriteMinSize ) * ( 1 - h / 241.0f );
+ }
+ else
+ size = this->PointSpriteSize;
+
+ aVertex[i].hue = this->PointSpriteMagnification * size;
}
GLuint aBufferObjectID = 0;
glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
+ glEnableClientState( GL_VERTEX_ARRAY );
+ glEnableClientState( GL_COLOR_ARRAY );
- glDrawArrays(GL_POINTS,0,this->TotalCells);
+ glDrawArrays( GL_POINTS, 0, this->TotalCells );
- glDisableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState( GL_COLOR_ARRAY );
+ glDisableClientState( GL_VERTEX_ARRAY );
vglDeleteBuffersARB( 1, &aBufferObjectID );
}
}
- unsigned long idx = 0;
- if (colors)
- {
- idx |= VTK_PDPSM_COLORS;
- if (colors->GetName())
- {
- // In the future, I will look at the number of components.
- // All paths will have to handle 3 component colors.
- idx |= VTK_PDPSM_OPAQUE_COLORS;
- }
- }
- if (cellScalars)
- {
- idx |= VTK_PDPSM_CELL_COLORS;
- }
-
- // store the types in the index
- if (points->GetDataType() == VTK_FLOAT)
- {
- idx |= VTK_PDPSM_POINT_TYPE_FLOAT;
- }
- else if (points->GetDataType() == VTK_DOUBLE)
- {
- idx |= VTK_PDPSM_POINT_TYPE_DOUBLE;
- }
-
- if (this->AlphaChannelArray && (alpha = vtkFloatArray::SafeDownCast(input->GetPointData()->GetArray(this->AlphaChannelArray)))
- )
- {
- idx |= VTK_PDPSM_ALPHA_ARRAY;
- }
-
// we need to know the total number of cells so that we can report progress
this->TotalCells = input->GetVerts()->GetNumberOfCells();
- this->DrawPoints(idx, points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
+ this->DrawPoints(points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
this->UpdateProgress(1.0);
return noAbort;
this->LastWindow = NULL;
}
//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os,indent);
-}
-//-----------------------------------------------------------------------------
typedef GLuint GLhandleARB;
#endif
+//----------------------------------------------------------------------------
+//! OpenGL Point Sprites PolyData Mapper.
+/*!
+ * VISU_OpenGLPointSpriteMapper is a class that maps polygonal data
+ * (i.e., vtkPolyData) to graphics primitives. It is performing the mapping
+ * to the rendering/graphics hardware/software. It is now possible to set a
+ * memory limit for the pipeline in the mapper. If the total estimated memory
+ * usage of the pipeline is larger than this limit, the mapper will divide
+ * the data into pieces and render each in a for loop.
+ */
class VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS
{
public:
-//BTX
- enum RenderModes {
- Accumulate=0,
- Occlude
- };
-//ETX
+ //! The Point Sprites rendering mode.
+ /*!
+ * Accumulate : Uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), and no depth testing
+ * so that points are accumulated. Suitable for Galaxy plots.
+ * Occlude : No blending. Particles are solid spheres and depth testing is
+ * used as usual. Suitable for most particle simulations without the need
+ * for opacity.
+ */
+ enum RenderModes { Accumulate = 0, Occlude };
+
static VISU_OpenGLPointSpriteMapper *New();
vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
- virtual void PrintSelf(ostream& os, vtkIndent indent);
void ShallowCopy(vtkAbstractMapper*);
- // Description:
- // Specify the name of a scalar array which will be used to control
- // the alpha value of each point. The values should be between 0,1
- vtkSetStringMacro(AlphaChannelArray);
- vtkGetStringMacro(AlphaChannelArray);
-
- // Description:
- // Specify the name of a scalar array which will be used to control
- // the size of each point.
- // NOT YET IMPLEMENTED
- vtkSetStringMacro(SizeChannelArray);
- vtkGetStringMacro(SizeChannelArray);
-
- // Description:
- // Set the initial point size to be used. This value forms the
- // base upon which the distance attenuation acts.
- // Usually the pointsize is set to the maximum supported by the graphics
- // card for sprite display, then the quadratic factors are adjusted to
- // bring the size down.
- // Set the default size to -1 if you wish the value returned by
- // glGetFloatv( GL_POINT_SIZE_MAX_ARB, &MaximimSupportedSize );
- // to be used as the initial default point size.
+ //! Set the initial point size to be used.
+ /*!
+ * This value forms the base upon which the distance attenuation acts.
+ * Usually the pointsize is set to the maximum supported by the graphics
+ * card for sprite display, then the quadratic factors are adjusted to
+ * bring the size down.
+ */
vtkSetMacro(DefaultPointSize, float);
- vtkGetMacro(DefaultPointSize, float);
- // Description:
- // Set the 3 values (a,b,c) of the parametric function which controls the
- // reduction in point size with increasing distance (d).
- // e.g. (1,0,0) will give all points the same size regardless of distance.
- // @verbatim
- // point fading = _____1_______
- // (a + bd + cd^2)
- // @endverbatim
- vtkSetVector3Macro(QuadraticPointDistanceAttenuation, float);
- vtkGetVector3Macro(QuadraticPointDistanceAttenuation, float);
+ //! Get the initial point size to be used.
+ vtkGetMacro(DefaultPointSize, float);
- // Description:
- // Set/Get the RenderMode for this mapper. Currently 2 modes are supported
- // Accumulate : Uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), and no depth testing
- // so that points are accumulated. Suitable for Galaxy plots.
- // Occlude : No blending. Particles are solid spheres and depth testing is
- // used as usual. Suitable for most particle simulations without the need
- // for opacity.
+ //! Set the Render Mode for the mapper.
vtkSetMacro(RenderMode, int);
+
+ //! Get the Render Mode for the mapper.
vtkGetMacro(RenderMode, int);
- void SetRenderModeToAccumulate() { this->SetRenderMode(Accumulate); }
- void SetRenderModeToOcclude() { this->SetRenderMode(Occlude); }
- // Description:
- // Implement superclass render method.
+ //! Implement superclass render method.
virtual void RenderPiece(vtkRenderer *ren, vtkActor *a);
- // Description:
- // Release any graphics resources that are being consumed by this mapper.
- // The parameter window could be used to determine which graphic
- // resources to release.
+ //! Release any graphics resources that are being consumed by this mapper.
void ReleaseGraphicsResources(vtkWindow *);
- // Description:
- // Draw method for OpenGL.
+ //! Draw method for OpenGL.
virtual int Draw(vtkRenderer *ren, vtkActor *a);
- // Description:
- // Return the maximum point size supported by the graphics hardware.
- float GetMaximumSupportedSize();
+ //! Return the maximum point size supported by the graphics hardware.
+ static float GetMaximumSupportedSize();
+
+ //! Set usage of #vtkOpenGLPolyDataMapper.
+ /*!
+ * This flags prevents using of the VISU_OpenGLPointSpriteMapper
+ * (#vtkOpenGLPolyDataMapper is using instead).
+ */
+ vtkSetMacro(UseOpenGLMapper, bool);
- // Set/Get usage of Point Sprites
+ //! Get usage of #vtkOpenGLPolyDataMapper.
+ vtkGetMacro(UseOpenGLMapper, bool);
+
+ //! Set usage of Point Sprites.
vtkSetMacro(UsePointSprites, bool);
+
+ //! Get usage of Point Sprites.
vtkGetMacro(UsePointSprites, bool);
- // Set/Get usage of textures for Point Sprites
- // (only if usage of Point Sprites is turned on)
+ //! Set usage of textures for Point Sprites.
+ /*! Works only if usage of Point Sprites is turned on. */
vtkSetMacro(UseTextures, bool);
+
+ //! Get usage of textures for Point Sprites.
vtkGetMacro(UseTextures, bool);
- // Set/Get usage of vertex shader
- // (only if usage of Point Sprites is turned on)
+ //! Set usage of vertex shader.
+ /*! Works only if usage of Point Sprites is turned on. */
vtkSetMacro(UseShader, bool);
+
+ //! Get usage of vertex shader.
vtkGetMacro(UseShader, bool);
// Description:
vtkGetMacro(PointSpritePrimitiveType, int);
void SetPointSpritePrimitiveType( int );
- // Description:
- // Point Sprite size parameters
+ //! Set Point Sprite Clamp.
+ void SetPointSpriteClamp( float );
+
+ //! Get Point Sprite Clamp.
vtkGetMacro(PointSpriteClamp, float);
- vtkGetMacro(PointSpriteSize, float);
- vtkGetMacro(PointSpriteMinSize, float);
- vtkGetMacro(PointSpriteMaxSize, float);
- vtkGetMacro(PointSpriteMagnification, float);
- void SetPointSpriteClamp( float );
+ //! Set Point Sprite Const Size.
void SetPointSpriteSize( float );
+
+ //! Get Point Sprite Const Size.
+ vtkGetMacro(PointSpriteSize, float);
+
+ //! Set Point Sprite Minimum Size.
void SetPointSpriteMinSize( float );
+
+ //! Get Point Sprite Minimum Size.
+ vtkGetMacro(PointSpriteMinSize, float);
+
+ //! Set Point Sprite Maximum Size.
void SetPointSpriteMaxSize( float );
+
+ //! Get Point Sprite Maximum Size.
+ vtkGetMacro(PointSpriteMaxSize, float);
+
+ //! Set Point Sprite Magnification.
void SetPointSpriteMagnification( float );
- vtkGetMacro(PointSpriteAlphaThreshold, float);
+ //! Get Point Sprite Magnification.
+ vtkGetMacro(PointSpriteMagnification, float);
+
+ //! Set Point Sprite AlphaThreshold.
void SetPointSpriteAlphaThreshold( float );
+ //! Get Point Sprite AlphaThreshold.
+ vtkGetMacro(PointSpriteAlphaThreshold, float);
+
+ //! Set ImageData for Point Sprite Texture.
void SetImageData(vtkImageData* theImageData);
+
+ //! Get ImageData for Point Sprite Texture.
vtkImageData* GetImageData();
protected:
VISU_OpenGLPointSpriteMapper();
~VISU_OpenGLPointSpriteMapper();
- void DrawPoints(int idx,
- vtkPoints *p,
+ //! Internal method of the Point Sprites drawing.
+ void DrawPoints(vtkPoints *p,
vtkUnsignedCharArray *c,
vtkFloatArray *alpha,
vtkIdType &cellNum,
vtkRenderer *ren,
vtkActor *act);
- // Initializing OpenGL extensions
+ //! Initializing OpenGL extensions.
void InitExtensions();
- // Activate/deactivate Point Sprites
+ //! Activate Point Sprites.
void InitPointSprites();
+
+ //! Deactivate Point Sprites.
void CleanupPointSprites();
- // Initializing textures for Point Sprites
+ //! Initializing textures for Point Sprites.
void InitTextures();
+ //! Initializing of the Vertex Shader.
+ void InitShader();
+
+ //! Set Vertex Shader variable.
+ void SetShaderVariable( const char* variable, float value );
+
+ //! Getting information about Vertex Shader compiling and linking.
+ void PrintInfoLog( GLhandleARB );
+
+private:
+ bool UseOpenGLMapper;
+
bool UsePointSprites;
bool UseTextures;
bool UseShader;
-
- vtkIdType TotalCells;
-
+ int RenderMode;
int ListId;
+ vtkIdType TotalCells;
int ExtensionsInitialized;
- int ExtensionsOK;
- char *AlphaChannelArray;
- double ActorOpacity;
- char *SizeChannelArray;
float DefaultPointSize;
- float QuadraticPointDistanceAttenuation[3];
- int RenderMode;
-
- void InitShader();
- void PrintInfoLog( GLhandleARB );
- void SetShaderVariable( const char* variable, float value );
- GLhandleARB myVertexProgram;
+ GLhandleARB VertexProgram;
int PointSpriteMode;
float PointSpriteAlphaThreshold;
vtkSmartPointer<vtkImageData> ImageData;
-
- bool UseOpenGLMapper;
};
#endif
return myExtractGeometry->GetImplicitFunction();
}
-void
+SALOME_ExtractGeometry*
VISU_PipeLine
-::SetExtractInside(int theFlag)
+::GetExtractGeometryFilter()
{
- myExtractGeometry->SetExtractInside(theFlag);
+ return myExtractGeometry.GetPointer();
}
vtkImplicitFunction*
GetImplicitFunction();
- void
- SetExtractInside(int);
+ SALOME_ExtractGeometry*
+ GetExtractGeometryFilter();
protected:
VISU_PipeLine();
VisuGUI_CutPlanesDlg.cxx \
VisuGUI_StreamLinesDlg.cxx \
VisuGUI_VectorsDlg.cxx \
+ VisuGUI_BuildProgressDlg.cxx \
VisuGUI_Timer.cxx
LIB_MOC = VisuGUI.h \
VisuGUI_CutLinesDlg.h \
VisuGUI_CutPlanesDlg.h \
VisuGUI_StreamLinesDlg.h \
- VisuGUI_VectorsDlg.h
+ VisuGUI_VectorsDlg.h \
+ VisuGUI_BuildProgressDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
VISU_Gen.idl \
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
+msgid "INF_VISU"
+msgstr "Post-Pro Info"
+
+msgid "IMPORT_DONE"
+msgstr "Importing is done"
+
msgid "VisuGUI_Module::MEN_VISUALISATION"
msgstr "Visualization"
msgid "VisuGUI_Module::VISU_PICKING_PREF_PYRAMID_HEIGHT"
msgstr "Height of the pyramids"
+msgid "VisuGUI_Module::VISU_PICKING_PREF_SELECTION_COLOR"
+msgstr "Selection cursor color"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TOLERANCE_GROUP_TTL"
+msgstr "Tolerance"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE"
+msgstr "Point selection tolerance"
+
msgid "VisuGUI_Module::VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL"
msgstr "Information window"
msgstr "Display parent mesh element"
msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT"
-msgstr "Spacemouse"
+msgstr "Navigation"
msgid "VisuGUI_Module::VISU_MOUSE_PREF_GROUP_TLT"
msgstr "Mouse"
msgid "VisuGUI_GaussPointsDlg::DLG_PROP_TITLE"
msgstr "Gauss Points Properties"
+msgid "VisuGUI_BuildProgressDlg::DLG_BUILD_PROGRESS_TITLE"
+msgstr "Build progress"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_SETTINGS"
+msgstr "Settings"
+
+msgid "VisuGUI_BuildProgressDlg::FILE_NAME"
+msgstr "Import file : "
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_AT_ONCE"
+msgstr "Build at once"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_ALL"
+msgstr "Build all"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_PROGRESS"
+msgstr "Import progress"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_ENTITIES"
+msgstr "Build entities"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_FIELDS"
+msgstr "Build fields"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_GROUPS"
+msgstr "Build groups"
+
+msgid "VisuGUI_BuildProgressDlg::BUILD_MINMAX"
+msgstr "Build min/max"
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_TIME"
+msgstr "Time"
+
+msgid "VisuGUI_BuildProgressDlg::TIME"
+msgstr "Elapsed time : "
+
+msgid "VisuGUI_BuildProgressDlg::IMPORT_FROM_FILE"
+msgstr "Import from File"
+
+msgid "VisuGUI_BuildProgressDlg::FLT_ALL_FILES"
+msgstr "All Files (*.*)"
+
+msgid "VisuGUI_BuildProgressDlg::FLT_MED_FILES"
+msgstr "MED Files (*.med)"
+
+msgid "VisuGUI_BuildProgressDlg::START"
+msgstr "Start"
+
+msgid "VisuGUI_BuildProgressDlg::CLOSE"
+msgstr "Close"
+
msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
msgstr "VISU scene:%1 - viewer:%2"
msgid "VVTK_PickingDlg::PYRAMID_HEIGHT"
msgstr "Height of the pyramids :"
+msgid "VVTK_PickingDlg::SELECTION_COLOR"
+msgstr "Selection cursor color :"
+
+msgid "VVTK_PickingDlg::TOLERANCE_TITLE"
+msgstr "Tolerance"
+
+msgid "VVTK_PickingDlg::POINT_TOLERANCE"
+msgstr "Point tolerance :"
+
msgid "VVTK_PickingDlg::INFO_WINDOW_TITLE"
msgstr "Information window"
#include <qptrlist.h>
#include <qptrvector.h>
#include <qcolordialog.h>
+#include <qdatetime.h>
// VTK Includes
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkActorCollection.h>
+#include <vtkTimerLog.h>
// SALOME Includes
#include "SALOME_LifeCycleCORBA.hxx"
#include "VisuGUI_Plot3DDlg.h"
#include "VisuGUI_OffsetDlg.h"
#include "VisuGUI_Displayer.h"
+#include "VisuGUI_BuildProgressDlg.h"
#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
{
}
-
void
VisuGUI::
OnImportFromFile()
{
- VisuGUI_Timer aTimer;
- aTimer.Start();
-
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
- if ( CheckLock(GetCStudy(GetAppStudy(this))) )
- return;
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
- QStringList aFilter;
- aFilter.append( tr("FLT_MED_FILES") );
- aFilter.append( tr("FLT_ALL_FILES") );
-
- QFileInfo aFileInfo =
- SUIT_FileDlg::getFileName(GetDesktop(this),
- "",
- aFilter,
- tr("MEN_IMPORT_FROM_FILE"),
- true);
- if(aFileInfo.exists()) {
- application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
-
- VISU::Result_var aResult;
- bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
- if (VisuGUI_FileDlg::IsBuild) {
- aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
- if (!CORBA::is_nil(aResult.in()))
- if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
- if (!aRes->IsPossible())
- SUIT_MessageBox::warn1(GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_CANT_BUILD_PRESENTATION"),
- tr("BUT_OK"));
- else
- aRes->BuildAll();
- }
- } else {
- aResourceMgr->setValue("VISU", "full_med_loading", false);
- aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
- aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
- }
+ CheckLock(GetCStudy(GetAppStudy(this)));
- if (CORBA::is_nil(aResult.in())) {
- SUIT_MessageBox::warn1(GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_ERROR_IN_THE_FILE"),
- tr("BUT_OK"));
- }else{
- UpdateObjBrowser(this);
- application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") +
- " in " + aTimer.GetTime() + " seconds", -1 );
- }
- }
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->show();
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
Handle(SALOME_InteractiveObject) anIO;
if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
aViewWindow->highlight(anIO, 1);
}
}
OnEraseAll()
{
startOperation( myEraseAll );
- if (SVTK_ViewWindow* vw = GetViewWindow()) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
vw->unHighlightAll();
if (vtkRenderer *aRen = vw->getRenderer()) {
vtkActor *anActor;
VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrs3d) return;
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrs3d, vw);
VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrs3d) return;
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrs3d, vw);
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrsObject, vw);
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrsObject, vw);
VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (!vw) return;
VISU_Actor* aActor = GetActor(aPrsObject, vw);
VisuGUI::
OnTimeAnimation()
{
+ if(!VISU::GetViewWindow())
+ return;
+
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
VisuGUI_TimeAnimationDlg* aAnimationDlg =
-// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
new VisuGUI_TimeAnimationDlg (this, aCStudy);
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
VisuGUI::
OnShowAnimation()
{
+ if(!VISU::GetViewWindow())
+ return;
+
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
VisuGUI::
OnSelectionInfo()
{
- if (GetViewWindow())
- (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
+ if (GetViewWindow(this))
+ (new VisuGUI_SelectionDlg(this))->show();
else
SUIT_MessageBox::warn1(GetDesktop(this),
tr("WRN_VISU"),
VisuGUI::
OnArrangeActors()
{
- SVTK_ViewWindow* vw = GetViewWindow();
+ SVTK_ViewWindow* vw = GetViewWindow(this);
if (vw) {
ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
aDlg->exec();
aRule = "client='VTKViewer' and selcount=1" + aInsideType;
mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
- aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
+ aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1 and activeView='VTKViewer'";
mgr->setRule( action( VISU_ANIMATION ), aRule, true );
aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
#include "VISU_GaussPoints_i.hh"
#include "VISU_GaussPointsPL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_Convertor.hxx"
#include "VVTK_PrimitiveBox.h"
// signals and slots connections ===========================================
connect( myRBLocal, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
- connect( myRBGlobal, SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setChecked( bool ) ) );
+ connect( myRBGlobal, SIGNAL( clicked() ), this, SLOT( onSetDisplayGlobal() ) );
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()
+{
+ myCBDisplayed->setChecked( true );
+}
+
+
/**
* Initialise dialog box from presentation object
*/
class GaussPoints_i;
}
+//! Specific Scalar Bar tab.
+/*! Uses for set up Gauss Points Scalar Bars preferenses. */
class VisuGUI_GaussScalarBarPane : public QVBox
{
Q_OBJECT
void changeRange( int );
void XYChanged( double );
void onTextPref();
+ void onSetDisplayGlobal();
};
-
+//! Create Gauss Points Presentation Dialog.
+/*!
+ * Uses for set up initial parameters of the Gauss Points
+ * presentation and edit them interactively.
+ */
class VisuGUI_GaussPointsDlg : public QDialog
{
Q_OBJECT
+
public:
VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
~VisuGUI_GaussPointsDlg() {}
+ //! Initializing dialog from the Gauss Points presentation.
void initFromPrsObject(VISU::GaussPoints_i* thePrs);
+
+ //! Update Gauss Points presentation using parameters from the dialog.
int storeToPrsObject(VISU::GaussPoints_i* thePrs);
protected slots:
#include "VVTK_MainWindow.h"
#include "VISU_View_i.hh"
+#include <qaction.h>
+
#include <vtkRenderer.h>
#include <vtkCamera.h>
+#include <vtkTimerLog.h>
#include <sstream>
#define GAUSS_NEW_VIEWER 5100
#define GAUSS_CREATE_PRS 5200
+#define GAUSS_RENAME 5210
#define GAUSS_EDIT_PRS 5300
+#define GAUSS_COPY_PRS 5310
#define GAUSS_ERASE_PRS 5400
#define GAUSS_DISPLAY_PRS 5500
#define GAUSS_DISPLAY_ONLY_PRS 5600
createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
+ createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIconSet(),
+ VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
+ this, SLOT(OnRename()));
+ mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
+ mgr->setRule( action( GAUSS_RENAME ),
+ "selcount=1 and type='VISU::TGAUSSPOINTS'",
+ true );
+
createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(),
VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
this, SLOT(OnEditGaussPoints()));
"selcount=1 and type='VISU::TGAUSSPOINTS'",
true );
+ createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIconSet(),
+ VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
+ this, SLOT(OnCopyPresentation()));
+ mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
+ mgr->setRule( action( GAUSS_COPY_PRS ),
+ "selcount=1 and type='VISU::TGAUSSPOINTS'",
+ true );
+ action( GAUSS_COPY_PRS )->setEnabled(false);
+
aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(),
{
int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
+ // Cursor
int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
+ setPreferenceProperty( cursorGr, "columns", 1 );
+
int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
setPreferenceProperty( pyramidHeightPref, "min", 1 );
setPreferenceProperty( pyramidHeightPref, "max", 100 );
+ int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
+ LightApp_Preferences::Color, "VISU", "picking_selection_color" );
+
+ // Tolerance
+ int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
+
+ int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
+ LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
+ setPreferenceProperty( pointTolerancePref, "min", 0.001 );
+ setPreferenceProperty( pointTolerancePref, "max", 10 );
+ setPreferenceProperty( pointTolerancePref, "step", 0.01 );
+
+ // Info window
int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
setPreferenceProperty( infoWindowGr, "columns", 1 );
setPreferenceProperty( positionPref, "strings", values );
setPreferenceProperty( positionPref, "indexes", indices );
+ // Camera
int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
setPreferenceProperty( cameraGr, "columns", 1 );
setPreferenceProperty( stepNumberPref, "min", 1 );
setPreferenceProperty( stepNumberPref, "max", 100 );
+ // Display parent mesh
int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
setPreferenceProperty( parentMeshGr, "columns", 1 );
VisuGUI_Module
::OnCreateGaussPoints()
{
+ double initialTime = vtkTimerLog::GetCPUTime();
CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
+ INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
+ vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
}
void
if(!CORBA::is_nil(anObject)){
if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
- if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
- VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
- else
+ if(aPrs3d->GetType() == VISU::TGAUSSPOINTS)
VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+ else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
+ QString aType = aViewManager->getType();
+ if(aType == SVTK_Viewer::Type())
+ VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
+ else if(aType == VVTK_Viewer::Type())
+ VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+ }
continue;
}
}
VisuGUI_Module
::OnDisplayOnlyPrs()
{
- if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
- SALOME_ListIO aList;
- aSelectionMgr->selectedObjects(aList);
- for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
- Handle(SALOME_InteractiveObject) anIO = it.Value();
- CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
-
- if(!CORBA::is_nil(anObject)){
- if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
- if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
- VISU::OnEraseAll<SVTK_Viewer>(this);
- else
- VISU::OnEraseAll<VVTK_Viewer>(this);
- break;
- }
- }
- }
- }
+ OnEraseAll();
OnDisplayPrs();
}
typedef std::map<SUIT_ViewManager*,PViewer> TViewerMap;
}
-
+//! This class inherits base VisuGUI.
+/*! Used to display, erase end edit presentations in the VVTK viewer. */
class VisuGUI_Module: public VisuGUI
{
Q_OBJECT;
virtual
~VisuGUI_Module();
+ //! Redifined method of the module initializing.
virtual
void
initialize( CAM_Application* );
+ //! Redefined method of creating prefernces.
virtual
void
createPreferences();
const bool theIsCreate);
public slots:
+ //! Reimplemented method of the module deactivation.
virtual
bool
deactivateModule( SUIT_Study* );
+ //! Reimplemented method of the module activation.
virtual
bool
activateModule( SUIT_Study* );
protected:
+ //! Create preferences for Gauss Points presentation.
virtual
void
createGaussPointsPreferences();
+ //! Create preferences for Gauss Points Scalar Bars.
virtual
void
createScalarBarPreferences();
+ //! Create preferences for Outside Cursor Gauss Points presentations.
virtual
void
createInsideCursorPreferences();
void
createOutsideCursorPreferences();
+ //! Create preferences for Picking.
virtual
void
createPickingPreferences();
+ //! Create preferences for Space Mouse.
virtual
void
createSpaceMousePreferences();
void
OnViewManagerAdded(SUIT_ViewManager*);
+ //! Reimplemented method of the Gauss Points edition.
virtual
void
OnEditGaussPoints();
+ //! Reimplemented method of the Gauss Points displaying.
virtual
void
OnDisplayPrs();
+ //! Reimplemented method of the Gauss Points displaying only.
virtual
void
OnDisplayOnlyPrs();
+ //! Reimplemented method of the Gauss Points full erasing.
virtual
void
OnEraseAll();
+ //! Reimplemented method of the Gauss Points erasing.
virtual
void
OnErasePrs();
+ //! Reimplemented method of saving view parameters.
virtual
void
OnSaveViewParams();
+ //! Reimplemented method of restoring view parameters.
virtual
void
OnRestoreViewParams();
ViewManagerList aViewManagerList;
SalomeApp_Application* anApp = myModule->getApp();
- anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
+ anApp->viewManagers(aViewManagerList);
QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
for (; anVMIter.current(); ++anVMIter) {
SUIT_ViewManager* aViewManager = anVMIter.current();
CreatePrs3d(VisuGUI* theModule,
const bool theIsCreateView = true)
{
- CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+ if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+ QString aType = aViewManager->getType();
+ if(aType == SVTK_Viewer::Type())
+ CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+ else if(aType == VVTK_Viewer::Type())
+ CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+ }
}
+
}
#endif
static VisuGUI_SelectionDlg* mySelectionDlg = NULL;
-VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent)
- : QDialog(parent, 0, false, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- mySelectionMgr(NULL)
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
+ QDialog(VISU::GetDesktop(theModule),
+ 0,
+ false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ mySelectionMgr(NULL),
+ myModule(theModule)
{
if (mySelectionDlg)
mySelectionDlg->close(true);
myFl = false;
// Activate Points pane
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
myWidgetStack->raiseWidget(myPointsPane);
- if (aSVTKVW)
- aSVTKVW->SetSelectionMode(NodeSelection);
+ if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+ aViewWindow->SetSelectionMode(NodeSelection);
onSelectionEvent();
mySelectionDlg = this;
void VisuGUI_SelectionDlg::onSelectionChange (int theId)
{
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return;
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ if (!aViewWindow) return;
switch (theId) {
case 0: // Points
myWidgetStack->raiseWidget(myPointsPane);
- aSVTKVW->SetSelectionMode(NodeSelection);
+ aViewWindow->SetSelectionMode(NodeSelection);
onPointIdEdit(myIDValLbl->text());
break;
case 1: // Cells
myWidgetStack->raiseWidget(myCellsPane);
- aSVTKVW->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
onCellIdEdit(myCellIDValLbl->text());
break;
case 2: // Actor
myWidgetStack->raiseWidget(myActorsPane);
- aSVTKVW->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
onSelectionEvent();
}
}
void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
{
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-
mySelectionDlg = NULL;
- if (aSVTKVW)
- aSVTKVW->SetSelectionMode(ActorSelection);
+ if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+ aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr,0,0,0);
QDialog::closeEvent(theEvent);
}
#define ABS(a) (a>=0)?a:-a
void VisuGUI_SelectionDlg::onSelectionEvent() {
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return;
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ if (!aViewWindow) return;
if (myFl) return;
myFl = true;
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
- SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+ SVTK_Selector* aSelector = aViewWindow->GetSelector();
VISU::Prs3d_i* aPrs3d = NULL;
_PTR(SObject) aSObject;
Handle(SALOME_InteractiveObject) anIO;
SALOME_ListIO aListIO;
- mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
+ mySelectionMgr->selectedObjects(aListIO);
if (aListIO.Extent() == 1) {
anIO = aListIO.First();
myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
VISU_Actor* anVISUActor =
- VISU::FindActor(aSVTKVW, aSObject->GetID().c_str());
+ VISU::FindActor(aViewWindow, aSObject->GetID().c_str());
if (anVISUActor) {
float aCoord[6];
anVISUActor->GetBounds(aCoord);
bool onIdEdit (const QString& theText,
TDataSetMethod theMethod,
bool theIsCell,
+ const SalomeApp_Module* theModule,
LightApp_SelectionMgr* theSelectionMgr,
QLabel* theMeshName,
QString theValue,
QLabel* theFieldName)
{
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return false;
- SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+ SalomeApp_Application* anApp = theModule->getApp();
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule);
+ if (!aViewWindow) return false;
+ SVTK_Selector* aSelector = aViewWindow->GetSelector();
VISU::Prs3d_i* aPrs3d = NULL;
Handle(SALOME_InteractiveObject) anIO;
TColStd_MapOfInteger newIndices;
newIndices.Add(anId);
aSelector->AddOrRemoveIndex(anIO, newIndices, false);
- aSVTKVW->highlight(anIO, true, true);
+ aViewWindow->highlight(anIO, true, true);
return true;
{
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints;
- bool anIsSelected = onIdEdit(theText,aMethod,false,mySelectionMgr,
+ bool anIsSelected = onIdEdit(theText,aMethod,false,myModule,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
if (anIsSelected)
{
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells;
- bool anIsSelected = onIdEdit(theText,aMethod,true,mySelectionMgr,
+ bool anIsSelected = onIdEdit(theText,aMethod,true,myModule,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
if (anIsSelected)
class QTable;
class LightApp_SelectionMgr;
class SalomeApp_Application;
+class SalomeApp_Module;
class VisuGUI_SelectionDlg: public QDialog {
Q_OBJECT
public:
- VisuGUI_SelectionDlg (QWidget*);
+ VisuGUI_SelectionDlg (const SalomeApp_Module* theModule);
virtual ~VisuGUI_SelectionDlg ();
protected:
QLabel* myDYLbl;
QLabel* myDZLbl;
+ const SalomeApp_Module* myModule;
LightApp_SelectionMgr* mySelectionMgr;
bool myFl;
};
int diffr_sys = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
gettimeofday(RefToCurrentTimeB,tz);
- Cumul_user += (double) diffr_user / CLK_TCK ;
- Cumul_sys += (double) diffr_sys / CLK_TCK ;
+ static long aCLK_TCK=sysconf(_SC_CLK_TCK);
+ Cumul_user += (double) diffr_user / aCLK_TCK ;
+ Cumul_sys += (double) diffr_sys / aCLK_TCK ;
#else
SYSTEMTIME st;
GetSystemTime(&st);
ChangeRepresentation (const SalomeApp_Module* theModule,
VISU::PresentationType theType)
{
- SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
- if (!aView) return;
- SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( aView );
+ SVTK_ViewWindow* vw = GetViewWindow( theModule, false );
if( !vw )
return;
/*SVTK_ViewWindow*
GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
{
- if(SalomeApp_Application* anApp = theModule->getApp()){
- if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){
- if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
- return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
- }
+ if (SalomeApp_Application* anApp = theModule->getApp())
+ {
+ SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
+ if( wnd )
+ return wnd;
+ else
+ {
+ if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ))
+ return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
}
}
return NULL;
try {
thePrs->Update();
-
- TViewWindows aViewWindows = GetViews(theModule);
- for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
- SVTK_ViewWindow* aView = aViewWindows[i];
- if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
- isPublished = true;
- thePrs->UpdateActor(anActor);
- }
- }
+ thePrs->UpdateActors();
} catch (std::runtime_error& ex) {
INFOS(ex.what());
QApplication::restoreOverrideCursor();
QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(ex.what()),
QObject::tr("BUT_OK"));
- TViewWindows aViewWindows = GetViews(theModule);
- for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
- SVTK_ViewWindow* aView = aViewWindows[i];
- if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
- aView->RemoveActor(anActor);
- anActor->Delete();
- }
- }
+ thePrs->RemoveActors();
return;
}
QApplication::restoreOverrideCursor();
if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(theBase).in())){
if(aType == VISU::TGAUSSPOINTS)
ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
- else
- ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+ else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+ QString aType = aViewManager->getType();
+ if(aType == SVTK_Viewer::Type())
+ ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+ else if(aType == VVTK_Viewer::Type())
+ ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+ }
}
}} // switch (aType)
}
LIB = libVISUEngineImpl.la
LIB_SRC = \
+ VISU_Result_i.cc \
VISUConfig.cc \
VISU_PrsObject_i.cc \
VISU_Prs3d_i.cc \
VISU_Mesh_i.cc \
VISU_Table_i.cc \
VISU_Gen_i.cc \
- VISU_Result_i.cc \
VISU_ViewManager_i.cc \
VISU_View_i.cc \
VISU_TimeAnimation.cxx \
vtkIdType aScalarMode = GetScalarMode();
TMinMax aTMinMax = myField->GetMinMax(aScalarMode);
aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
-
aScalarBarCtrl->SetOrientation(myOrientation);
int aScalarBarMode;
}
}
+ if (aScalarBarMode==1){
+ float aRangeGlobal[2];
+ //
+ aRangeGlobal[0]=aTMinMax.first;
+ aRangeGlobal[1]=aTMinMax.second;
+
+ GetGaussPointsPL()->GetMapper()->SetScalarRange(aRangeGlobal);
+ }
+
aScalarBarCtrl->SetMode(aScalarBarMode);
// Position
namespace VISU
{
+ //! Class of the Gauss Points presentation.
class GaussPoints_i : public virtual POA_VISU::GaussPoints,
public virtual VISU::TGaussPtsActorFactory,
public virtual ColoredPrs3d_i
typedef VISU::GaussPoints TInterface;
+ //! Get the Gauss Points Pipeline.
VISU_GaussPointsPL*
GetGaussPointsPL();
void
SetScaleFactor( float theScaleFactor );
+ //! Get color for Geometry mode of the presentation.
QColor
GetColor() { return myColor; }
+ //! Set color for Geometry mode of the presentation.
void
SetColor( const QColor& theColor ) { myColor = theColor; }
+ //! Get flag indicating which mode of the presentation is active.
+ /*! When Results mode is active, returns true. Geometry - false. */
bool
GetIsColored() { return myIsColored; }
+ //! Get flag indicating which mode of the presentation is active.
void
SetIsColored( bool theIsColored );
+ //! Set path to the image using for Main Point Sprite texture.
bool
SetMainTexture( const QString& theMainTexture );
+ //! Get path to the image using for Main Point Sprite texture.
const QString&
GetMainTexture();
+ //! Set path to the image using for Alpha Point Sprite texture.
bool
SetAlphaTexture( const QString& theAlphaTexture );
+ //! Get path to the image using for Alpha Point Sprite texture.
const QString&
GetAlphaTexture();
+ //! Convert Main and AlphaMask images to VTI format and set them to pipeline.
void
SetTextures( const QString& theMainTexture,
const QString& theAlphaTexture );
+ //! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold.
void
SetAlphaThreshold(float theAlphaThreshold);
+ //! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold.
float
GetAlphaThreshold();
int
GetPrimitiveType();
+ //! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize.
float
GetMaximumSupportedSize();
+ //! Redirect the request to VISU_GaussPointsPL::SetClamp.
void
SetClamp(float theClamp);
+ //! Redirect the request to VISU_GaussPointsPL::GetClamp.
float
GetClamp();
+ //! Redirect the request to VISU_GaussPointsPL::SetSize.
void
SetGeomSize(float theGeomSize);
+ //! Redirect the request to VISU_GaussPointsPL::GetSize.
float
GetGeomSize();
+ //! Redirect the request to VISU_GaussPointsPL::SetMinSize.
void
SetMinSize(float theMinSize);
+ //! Redirect the request to VISU_GaussPointsPL::GetMinSize.
float
GetMinSize();
+ //! Redirect the request to VISU_GaussPointsPL::SetMaxSize.
void
SetMaxSize(float theMaxSize);
+ //! Redirect the request to VISU_GaussPointsPL::GetMaxSize.
float
GetMaxSize();
- float
- GetMaxPointSize();
-
+ //! Redirect the request to VISU_GaussPointsPL::SetMagnification.
void
SetMagnification(float theMagnification);
+ //! Redirect the request to VISU_GaussPointsPL::GetMagnification.
float
GetMagnification();
+ //! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement.
void
SetMagnificationIncrement(float theIncrement);
+ //! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement.
float
GetMagnificationIncrement();
+ //! Set flag indicating which scalar bar is active.
void
SetIsActiveLocalScalarBar(const bool theFlag);
+ //! Get flag indicating which scalar bar is active.
bool
GetIsActiveLocalScalarBar() const;
+ //! Set flag indicating visibility of global scalar bar.
void
SetIsDispGlobalScalarBar(const bool theFlag);
+ //! Get flag indicating visibility of global scalar bar.
bool
GetIsDispGlobalScalarBar() const;
+ //! Redirect the request to VISU_GaussPointsPL::SetBicolor.
void
SetBiColor(bool theIsBiColor);
+ //! Redirect the request to VISU_GaussPointsPL::GetBicolor.
bool
GetBiColor();
+ //! Set value of the distance between global and local scalar bars.
void
SetSpacing(const float theSpacing);
+ //! Get value of the distance between global and local scalar bars.
float
GetSpacing() const;
}
}
+ Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
+ 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_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
//Create Result
virtual Result_ptr ImportFile(const char* theFileName);
+ virtual Result_ptr CreateResult(const char* theFileName);
virtual Result_ptr CopyAndImportFile(const char* theFileName);
virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
theActor->SetPipeLine(GetPipeLine());
theActor->SetFactory(this);
- myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::Update,theActor));
+ myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,theActor));
myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,theActor));
myActorCollection->AddItem(theActor);
void
VISU::Prs3d_i
-::UpdateActor(VISU_Actor* theActor)
+::RemoveActor(VISU_Actor* theActor)
{
- if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
- theActor->ShallowCopyPL(myPipeLine);
- theActor->SetPosition(myOffset);
- theActor->Modified();
+ if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
+ myActorCollection->RemoveItem(theActor);
}
void
VISU::Prs3d_i
-::RemoveActor(VISU_Actor* theActor)
+::RemoveActors()
{
- if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
- myActorCollection->RemoveItem(theActor);
+ if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActors - this = "<<this);
+ myRemoveActorsFromRendererSignal();
+ myActorCollection->RemoveAllItems();
+}
+
+void
+VISU::Prs3d_i
+::UpdateActor(VISU_Actor* theActor)
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
+ theActor->ShallowCopyPL(myPipeLine);
+ theActor->SetPosition(myOffset);
+ theActor->Modified();
}
void
class Result_i;
//----------------------------------------------------------------------------
+ //! Base class for all VTK 3D presentations.
+ /*!
+ It is a root class for a middle level of VISU functionality.
+ Almost all functionality of the the class implemented through redirection
+ external requestes to its VISU_PipeLine.
+ It define an interface and implement the following topics:
+ - provide persistent mechanism;
+ - implement basic actor management (CreateActor, UpdateActor, UpdateActors, RemoveActor and RemoveActors);
+ - implement common 3D functionality like "clipping planes" and offset.
+ */
class Prs3d_i :
public virtual POA_VISU::Prs3d,
public virtual SALOME::GenericObj_i,
public:
//----------------------------------------------------------------------------
+ //! A constructor to create a fresh instance of the class
explicit
Prs3d_i(Result_i* theResult,
bool theAddToStudy);
+
+ //! A constructor to restore an instance of the class
explicit
Prs3d_i(Result_i* theResult,
SALOMEDS::SObject_ptr theSObject);
+
+ //! To create a deep copy from another instance of the class
virtual
void
SameAs(const Prs3d_i* theOrigin);
~Prs3d_i();
//----------------------------------------------------------------------------
+ //! To generate an unique type name for the class (used into persistent functionality)
virtual
const char*
GetComment() const = 0;
+ //! To generate an unique name for the instance of the class
virtual
QString
GenerateName() = 0;
+ //! To restore paramters of the instance from Storable::TRestoringMap
virtual
Storable*
Restore(const Storable::TRestoringMap& theMap);
+ //! To save paramters of the instance to std::ostringstream
virtual
void
ToStream(std::ostringstream& theStr);
//----------------------------------------------------------------------------
+ //! Get corresponding Result_i
Result_i*
GetResult() const;
+ //! Get corresponding SALOMEDS::SObject
virtual
SALOMEDS::SObject_var
GetSObject();
GetMeshName() const;
//----------------------------------------------------------------------------
+ //! To update is internal state
virtual
void
Update();
+ //! To remove the instance from study
virtual
void
RemoveFromStudy();
//----------------------------------------------------------------------------
+ //! Get corresponding VISU_PipeLine
VISU_PipeLine*
GetPL();
+ //! Get input of the VISU_PipeLine
vtkUnstructuredGrid*
GetInput();
//----------------------------------------------------------------------------
+ //! To define a way to create VTK representation of the instance
virtual
VISU_Actor*
CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
+ //! To unregister the pointed actor
virtual
void
RemoveActor(VISU_Actor* theActor);
+ //! To unregister all actors of the instance
+ virtual
+ void
+ RemoveActors();
+
+ //! To update the pointed actor
virtual
void
UpdateActor(VISU_Actor* theActor);
+ //! To update all actors of the instance
virtual
void
UpdateActors();
#include "VISU_Convertor_impl.hxx"
#include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
#include "VISU_PipeLine.hxx"
#include "SUIT_ResourceMgr.h"
#include "SALOMEDS_Tool.hxx"
#include "HDFascii.hxx"
+#include "SUIT_Session.h"
+#include "SALOME_Event.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
#include <qstring.h>
#include <qfileinfo.h>
+#include <qsemaphore.h>
+#include <qthread.h>
// VTK Includes
#include <vtkCell.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
#else
static int MYDEBUG = 0;
+static int MYTIMEDEBUG = 0;
#endif
-VISU::Result_var VISU::FindResult (SALOMEDS::SObject_ptr theSObject)
+
+namespace VISU
{
- SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
- SALOMEDS::SObject_var aFather = theSObject->GetFather();
- CORBA::String_var aComponentID (aSComponent->GetID());
- CORBA::String_var aFatherID (aFather->GetID());
- VISU::Result_var aResult;
- while (strcmp(aComponentID, aFatherID) != 0) {
- CORBA::Object_var anObject = VISU::SObjectToObject(aFather);
- if (!CORBA::is_nil(anObject)) {
- aResult = VISU::Result::_narrow(anObject);
- if (!aResult->_is_nil()) return aResult;
- }
- aFather = aFather->GetFather();
- aFatherID = aFather->GetID();
+ //---------------------------------------------------------------
+ Result_var
+ FindResult (SALOMEDS::SObject_ptr theSObject)
+ {
+ SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent();
+ SALOMEDS::SObject_var aFather = theSObject->GetFather();
+ CORBA::String_var aComponentID (aSComponent->GetID());
+ CORBA::String_var aFatherID (aFather->GetID());
+ Result_var aResult;
+ while (strcmp(aComponentID, aFatherID) != 0) {
+ CORBA::Object_var anObject = SObjectToObject(aFather);
+ if (!CORBA::is_nil(anObject)) {
+ aResult = Result::_narrow(anObject);
+ if (!aResult->_is_nil()) return aResult;
+ }
+ aFather = aFather->GetFather();
+ aFatherID = aFather->GetID();
+ }
+ return aResult;
}
- return aResult;
-}
-QString GenerateName (const char* theName)
-{
- 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 = VISU::GenerateName(theName,++aMap[theName]);
+
+ //---------------------------------------------------------------
+ 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())) {
+ myResult = aStudy->studyDS();
+ break;
+ }
+ }
+ ++anIter;
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ QString
+ GenerateName (const char* 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;
}
- if(MYDEBUG) MESSAGE("GenerateName - "<<tmp<<" from - "<<theName<<"; " <<aMap[theName]);
- return tmp;
-}
+
-QString GenerateFieldName (const string& theName, const string& theUnits)
-{
- static 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();
-}
+ //---------------------------------------------------------------
+ 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();
+ }
-void CreateReference (SALOMEDS::Study_ptr theStudyDocument,
- const string& theFatherEntry, const string& theRefEntry)
-{
- SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
- SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
- SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
- SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
- aStudyBuilder->Addreference(newObj,aRefSObj);
-}
-string GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
-{
- SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
- CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
- return aDataType.in();
+ //---------------------------------------------------------------
+ string
+ GetComponentDataType (SALOMEDS::SObject_ptr theSObject)
+ {
+ SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
+ CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
+ return aDataType.in();
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ CreateReference (SALOMEDS::Study_ptr theStudyDocument,
+ const string& theFatherEntry,
+ const string& theRefEntry)
+ {
+ SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder();
+ SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str());
+ SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(aFather);
+ SALOMEDS::SObject_var aRefSObj = theStudyDocument->FindObjectID(theRefEntry.c_str());
+ aStudyBuilder->Addreference(newObj,aRefSObj);
+ }
+
+
+ //---------------------------------------------------------------
+ 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);
+ }
+
+ string
+ CreateAttributes(_PTR(Study) theStudyDocument,
+ const string& theFatherEntry,
+ const string& theIOR,
+ const string& theName,
+ const string& thePersistentRef,
+ const string& theComment,
+ CORBA::Boolean theCreateNew)
+ {
+ 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 (thePersistentRef != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePersistentRef");
+ _PTR(AttributePersistentRef) aPRef (anAttr);
+ aPRef->SetValue(thePersistentRef);
+ }
+ if (theComment != "") {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeComment");
+ _PTR(AttributeComment) aCmnt (anAttr);
+ aCmnt->SetValue(theComment);
+ }
+ return aNewObj->GetID();
+ }
+
+ //---------------------------------------------------------------
+ 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,
+ _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;
+ 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);
+ //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;myType=%d;myMeshName=%s;myId=%d",
+ VISU::TENTITY,
+ 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,
+ _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;
+ 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;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+ TFAMILY,
+ 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());
+ string aGroupsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ "",
+ "Groups",
+ "",
+ aComment.latin1(),
+ true);
+ 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;myType=%d;myMeshName=%s;myName=%s",
+ TGROUP,aMeshName.c_str(),aGroupName.c_str());
+ aGroup->myEntry =
+ CreateAttributes(theStudy,
+ aGroupsEntry,
+ "",
+ 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);
+ }
+ }
+ }
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ BuildFields(Result_i* theResult,
+ VISU_Convertor* theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild,
+ _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;
+ 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
+ string aFieldsEntry;
+ bool anIsFieldsEntryCreated = 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(!anIsFieldsEntryCreated){
+ aComment.sprintf("myComment=FIELDS;myMeshName=%s",
+ aMeshName.c_str());
+ aFieldsEntry =
+ CreateAttributes(theStudy,
+ aMesh->myEntry,
+ "",
+ "Fields",
+ "",
+ aComment.latin1(),
+ true);
+ anIsFieldsEntryCreated = 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;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+ TFIELD,
+ aMeshName.c_str(),
+ anEntity,
+ aFieldName.c_str(),
+ aValField.size(),
+ aField->myNbComp);
+ aField->myEntry =
+ CreateAttributes(theStudy,
+ aFieldsEntry,
+ "",
+ 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;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+ TTIMESTAMP,
+ 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);
+ }
+ }
+ }
+ }
+
+ ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone));
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ BuildMinMax(Result_i* theResult,
+ VISU_Convertor* theInput,
+ CORBA::Boolean* theIsDone,
+ CORBA::Boolean theIsBuild)
+ {
+ if(!theIsBuild || *theIsDone)
+ return;
+
+ TTimerLog aTimerLog(MYTIMEDEBUG,"Result_i::BuildMinMax");
+ TResultManager aResultManager(theResult);
+
+ theInput->BuildMinMax();
+ *theIsDone = true;
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ BuildFieldDataTree(Result_i* theResult,
+ VISU_Convertor* theInput,
+ CORBA::Boolean* theIsFieldsDone,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean* theIsMinMaxDone,
+ CORBA::Boolean theIsBuildMinMax,
+ _PTR(Study) theStudy)
+ {
+ BuildFields(theResult,
+ theInput,
+ theIsFieldsDone,
+ theIsBuildFields,
+ theStudy);
+
+ BuildMinMax(theResult,
+ theInput,
+ theIsMinMaxDone,
+ theIsBuildMinMax);
+ }
+
+
+ //---------------------------------------------------------------
+ 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;
+ CORBA::Boolean* myIsGroupsDone;
+ CORBA::Boolean myIsBuildGroups;
+ _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,
+ CORBA::Boolean* theIsGroupsDone,
+ CORBA::Boolean theIsBuildGroups,
+ _PTR(Study) theStudy):
+ myResult(theResult),
+ myInput(theInput),
+ myIsEntitiesDone(theIsEntitiesDone),
+ myResultEntry(theResultEntry),
+ myIsFieldsDone(theIsFieldsDone),
+ myIsBuildFields(theIsBuildFields),
+ myIsMinMaxDone(theIsMinMaxDone),
+ myIsBuildMinMax(theIsBuildMinMax),
+ myIsGroupsDone(theIsGroupsDone),
+ myIsBuildGroups(theIsBuildGroups),
+ myStudy(theStudy)
+ {}
+
+ };
+
+ //---------------------------------------------------------------
+ void
+ BuildDataTree(TBuildArgs theBuildArgs)
+ {
+ BuildEntities(theBuildArgs.myResult,
+ theBuildArgs.myInput,
+ theBuildArgs.myIsEntitiesDone,
+ theBuildArgs.myResultEntry,
+ theBuildArgs.myStudy);
+
+ {
+ boost::thread aThread(boost::bind(&BuildFieldDataTree,
+ theBuildArgs.myResult,
+ theBuildArgs.myInput,
+ theBuildArgs.myIsFieldsDone,
+ theBuildArgs.myIsBuildFields,
+ theBuildArgs.myIsMinMaxDone,
+ theBuildArgs.myIsBuildMinMax,
+ theBuildArgs.myStudy));
+ }
+
+ {
+ boost::thread aThread(boost::bind(&BuildGroups,
+ theBuildArgs.myResult,
+ theBuildArgs.myInput,
+ theBuildArgs.myIsGroupsDone,
+ theBuildArgs.myIsBuildGroups,
+ theBuildArgs.myStudy));
+ }
+ }
+
}
-//==============================================================================
+//---------------------------------------------------------------
const string VISU::Result_i::myComment = "RESULT";
const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
-VISU::Result_i::Result_i (SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId):
+//---------------------------------------------------------------
+VISU::Result_i
+::Result_i (SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately):
myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
myCreationId(theCreationId),
mySourceId(theSourceId),
+ myIsBuildImmediately(theIsBuildImmediately),
myInput(NULL),
- myIsDone(0)
+ myIsEntitiesDone(false),
+ myIsFieldsDone(false),
+ myIsGroupsDone(false),
+ myIsMinMaxDone(false),
+ myIsBuildFields(true),
+ myIsBuildGroups(true),
+ myIsBuildMinMax(true),
+ myIsAllDone(false)
{
+ myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
}
-void VISU::Result_i::RemoveFromStudy()
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::RemoveFromStudy()
{
// Remove the result with all presentations and other possible sub-objects
VISU::RemoveFromStudy(mySObject,false);
}
+//---------------------------------------------------------------
int
-VISU::Result_i::
-IsPossible()
+VISU::Result_i
+::IsPossible()
{
try{
float aSize = myInput->GetSize();
}
+//---------------------------------------------------------------
CORBA::Boolean
-VISU::Result_i::
-BuildAll()
+VISU::Result_i
+::BuildAll()
{
- if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
- if(myIsDone) return 1;
- if(!IsPossible()) return 0;
+ if(MYDEBUG) MESSAGE("Result_i::Build - myIsAllDone = "<<myIsAllDone);
+ if(myIsAllDone)
+ return 1;
+ if(!IsPossible())
+ return 0;
try{
const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
}
}
}
- myIsDone = 1;
+ myIsAllDone = 1;
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
}catch(...){
INFOS("Unknown exception was occured!!!");
}
- return myIsDone;
+ return myIsAllDone;
+}
+
+
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Result_i
+::Build(CORBA::Boolean theIsBuildAll,
+ CORBA::Boolean theIsAtOnce)
+{
+ if(theIsBuildAll)
+ theIsAtOnce = true;
+
+ if(Build(SALOMEDS::SObject::_nil(),theIsAtOnce)){
+ if(theIsBuildAll)
+ return BuildAll();
+ return true;
+ }
+
+ return false;
}
+//---------------------------------------------------------------
VISU::Storable*
-VISU::Result_i::
-Build(SALOMEDS::SObject_ptr theSObject)
+VISU::Result_i
+::Build(SALOMEDS::SObject_ptr theSObject,
+ CORBA::Boolean theIsAtOnce)
+{
+ if(IsDone())
+ return this;
+
+ mySComponent = FindOrCreateVisuComponent(myStudyDocument);
+ CORBA::String_var aSComponentEntry = mySComponent->GetID();
+ CORBA::String_var anIOR(GetID());
+ QString aComment;
+ aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+ GetComment(),
+ VISU::TRESULT,
+ myFileInfo.filePath().latin1(),
+ myInitFileName.c_str()); // Restoring of Python dump
+ string aResultEntry =
+ CreateAttributes(myStudy,
+ aSComponentEntry.in(),
+ anIOR.in(),
+ myName,
+ "",
+ 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());
+ }
+
+ if(theIsAtOnce){
+ BuildEntities(this,
+ myInput,
+ &myIsEntitiesDone,
+ aResultEntry,
+ myStudy);
+
+ BuildFields(this,
+ myInput,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ myStudy);
+
+ BuildMinMax(this,
+ myInput,
+ &myIsMinMaxDone,
+ myIsBuildMinMax);
+
+ BuildGroups(this,
+ myInput,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ myStudy);
+ }else{
+ TBuildArgs aBuildArgs(this,
+ myInput,
+ &myIsEntitiesDone,
+ aResultEntry,
+ &myIsFieldsDone,
+ myIsBuildFields,
+ &myIsMinMaxDone,
+ myIsBuildMinMax,
+ &myIsGroupsDone,
+ myIsBuildGroups,
+ myStudy);
+ boost::thread aThread(boost::bind(&BuildDataTree,
+ aBuildArgs));
+ }
+
+ return this;
+}
+
+
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::Result_i
+::BuildAll(SALOMEDS::SObject_ptr theSObject)
{
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
- aStudyBuilder->NewCommand(); // There is a transaction
if(MYDEBUG) MESSAGE("Result_i::Build");
try{
- const TMeshMap& aMeshMap = myInput->GetMeshMap();
- if(aMeshMap.empty())
- throw std::runtime_error("Build - There is no any mesh information in the file !!!");
- mySComponent = FindOrCreateVisuComponent(myStudyDocument);
- CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
- string aRefFatherEntry = GetRefFatherEntry();
- QString aComment;
- aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
- GetComment(),
- VISU::TRESULT,
- myFileInfo.filePath().latin1(),
- myInitFileName.c_str()); // Restoring of Python dump
- string aResultEntry =
- CreateAttributes(myStudyDocument,
- aSComponentEntry,
- aRefFatherEntry.c_str(),
- anIOR,
- myName.c_str(),
- "",
- aComment.latin1(),
- true);
- mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
- if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
- if(!CORBA::is_nil(theSObject)){
- CORBA::String_var aString = theSObject->GetID();
- CreateReference(myStudyDocument,aResultEntry,aString.in());
- }
- TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
- const string& aMeshName = aMeshMapIter->first;
- const VISU::PMesh aMesh = aMeshMapIter->second;
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
- aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
- aMeshName.c_str(),aMesh->myDim);
- string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
- "",aMeshName.c_str(),"",aComment.latin1(),true);
- if(aMeshOnEntityMap.empty()) continue;
- aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
- string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
- "","Families","",aComment.latin1(),true);
- //Import entities and according families
- aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- typedef std::map<std::string,std::string> TComment2EntryMap;
- TComment2EntryMap aComment2EntryMap;
- typedef std::map<VISU::TEntity,std::string> TEntity2EntryMap;
- TEntity2EntryMap aEntity2EntryMap;
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
- VISU::TENTITY,
- aMeshName.c_str(),
- anEntity);
- string anEntityName;
- switch(anEntity){
- case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
- case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
- case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
- case VISU::CELL_ENTITY : anEntityName = "onCells"; break;
- default:
- throw std::runtime_error("Build >> Value of entity is incorrect!");
- }
- aEntity2EntryMap[anEntity] = CreateAttributes
- (myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(),
- "", anEntityName.c_str(), "", aComment.latin1(), true);
- const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const string& aFamilyName = aFamilyMapIter->first;
- aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- VISU::TFAMILY,
- aMeshName.c_str(),
- anEntity,
- aFamilyName.c_str());
- aComment2EntryMap[aComment.latin1()] =
- CreateAttributes(myStudyDocument,
- aEntity2EntryMap[anEntity].c_str(),
- aRefFatherEntry.c_str(),
- "",
- aFamilyName.c_str(),
- "",
- aComment.latin1(),
- true);
- }
- }
- //Importing groups
- const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
- if(aGroupMap.size() > 0){
- aComment.sprintf("myComment=GROUPS;myMeshName=%s",
- aMeshName.c_str());
- string aGroupsEntry =
- CreateAttributes(myStudyDocument,
- aMeshEntry.c_str(),
- aRefFatherEntry.c_str(),
- "",
- "Groups",
- "",
- aComment.latin1(),
- true);
- VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
- for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const string& aGroupName = aGroupMapIter->first;
- aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
- VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
- string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
- "",aGroupName.c_str(),"",aComment.latin1(),true);
- const VISU::PGroup aGroup = aGroupMapIter->second;
- const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
- VISU::TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
- for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
- const VISU::PFamily& aFamily = *aFamilyIter;
- const string& aFamilyName = aFamily->myName;
- const VISU::TEntity& anEntity = aFamily->myEntity;
- aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
- VISU::TFAMILY,
- aMeshName.c_str(),
- anEntity,
- aFamilyName.c_str());
- TComment2EntryMap::const_iterator anIter = aComment2EntryMap.find(aComment.latin1());
- if(anIter != aComment2EntryMap.end()){
- const std::string& anEntry = anIter->second;
- CreateReference(myStudyDocument,aGroupEntry,anEntry);
- }
- }
- }
- }
- //Import fields
- string aFieldsEntry;
- bool isFieldEntryCreated = 0;
- aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
- for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
- if(!isFieldEntryCreated){
- aComment.sprintf("myComment=FIELDS;myMeshName=%s",
- aMeshName.c_str());
- aFieldsEntry =
- CreateAttributes(myStudyDocument,
- aMeshEntry.c_str(),
- aRefFatherEntry.c_str(),
- "",
- "Fields",
- "",
- aComment.latin1(),
- true);
- isFieldEntryCreated = true;
- }
- const string& aFieldName = aFieldMapIter->first;
- const VISU::PField aField = aFieldMapIter->second;
- const VISU::TValField& aValField = aField->myValField;
- QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]);
- aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
- VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField->myNbComp);
- string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
- "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
- CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]);
- VISU::TValField::const_iterator aValFieldIter = aValField.begin();
- for(; aValFieldIter != aValField.end(); aValFieldIter++){
- int aTimeStamp = aValFieldIter->first;
- const VISU::PValForTime aValForTime = aValFieldIter->second;
- aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
- VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField->myNbComp);
- string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
- CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
- "",aTimeStampId.c_str(),"",aComment.latin1(),true);
- }
- }
- }
- }
- bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
- if(isBuildAll) BuildAll();
+ Build(theSObject);
+ BuildAll();
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
return NULL;
INFOS("Unknown exception was occured!!!");
return NULL;
}
- aStudyBuilder->CommitCommand();
+
return this;
}
+//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i::
Create(const char* theFileName)
myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
}
myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
- if(!myInput)
- throw std::runtime_error("Create - Cannot create a Convertor for this file!!!");
- return Build();
+ if(myInput){
+ if(myIsBuildImmediately)
+ Build(SALOMEDS::SObject::_nil());
+ return this;
+ }
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
}catch(...){
}
+//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i::
Create(SALOMEDS::SObject_ptr theMedSObject)
if(myInput == NULL)
return NULL;
+ myInput->Build();
+
string aCompDataType = GetComponentDataType(theMedSObject);
myFileInfo.setFile(aCompDataType.c_str());
myInitFileName = aCompDataType;
myName = ::GenerateName("aResult").latin1();
- VISU::Storable* aStorable = Build(theMedSObject);
- return aStorable;
+ return Build(theMedSObject);
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
}catch(...){
return NULL;
}
+
+//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i::
Create(SALOME_MED::FIELD_ptr theField)
if(myInput == NULL)
return NULL;
+ myInput->Build();
+
string aCompDataType = "MED";
myFileInfo.setFile(aCompDataType.c_str());
myInitFileName = aCompDataType;
CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
- VISU::Storable* aStorable = Build(aFieldSObject);
- return aStorable;
+ return Build(aFieldSObject);
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
}catch(...){
}
+//---------------------------------------------------------------
VISU::Storable*
VISU::Result_i::
Restore(SALOMEDS::SObject_ptr theSObject,
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
aStudyBuilder->LoadWith(aCompRefSObj, aDriver);
- if (strcmp(aDataType, "MED") == 0)
+ if (strcmp(aDataType, "MED") == 0){
myInput = CreateMEDConvertor(aTargetRefSObj);
- else
+ myInput->Build();
+ }else
throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
} else {
myFileInfo.setFile(thePrefix.c_str());
}
if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
myInput = CreateConvertor(myFileInfo.filePath().latin1());
+ myInput->Build();
QString aComment;
aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
return NULL;
}
-VISU::Result_i::TInput* VISU::Result_i::GetInput() {
+//---------------------------------------------------------------
+VISU::Result_i::TInput*
+VISU::Result_i
+::GetInput()
+{
return myInput;
}
-void VISU::Result_i::ToStream(std::ostringstream& theStr){
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::Result_i
+::IsDone()
+{
+ return
+ myIsEntitiesDone &&
+ (myIsBuildFields? myIsFieldsDone: true) &&
+ (myIsBuildMinMax? myIsMinMaxDone: true) &&
+ (myIsBuildGroups? myIsGroupsDone: true);
+}
+
+CORBA::Boolean
+VISU::Result_i
+::IsEntitiesDone()
+{
+ return myIsEntitiesDone;
+}
+
+void
+VISU::Result_i
+::SetBuildFields(CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsCalculateMinMax)
+{
+ myIsBuildFields = theIsBuildFields;
+ if(theIsBuildFields)
+ myIsBuildMinMax = theIsCalculateMinMax;
+ else
+ myIsBuildMinMax = false;
+}
+
+void
+VISU::Result_i
+::SetBuildGroups(CORBA::Boolean theIsBuildGroups)
+{
+ myIsBuildGroups = theIsBuildGroups;
+}
+
+CORBA::Boolean
+VISU::Result_i
+::IsFieldsDone()
+{
+ return myIsFieldsDone;
+}
+
+CORBA::Boolean
+VISU::Result_i
+::IsGroupsDone()
+{
+ return myIsGroupsDone;
+}
+
+CORBA::Boolean
+VISU::Result_i
+::IsMinMaxDone()
+{
+ return myIsMinMaxDone;
+}
+
+//---------------------------------------------------------------
+void
+VISU::Result_i
+::ToStream(std::ostringstream& theStr)
+{
if(MYDEBUG) MESSAGE(GetComment());
Storable::DataToStream(theStr,"myName",myName.c_str());
Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
Storable::DataToStream(theStr,"myCreationId",myCreationId);
}
+
+//---------------------------------------------------------------
VISU::Storable*
-VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix,
- const Storable::TRestoringMap& theMap)
+VISU::Result_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+ const string& thePrefix,
+ const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
return pResult->Restore(theSObject,theMap,thePrefix);
}
-string VISU::Result_i::GetRefFatherEntry() {
- //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry();
+
+//---------------------------------------------------------------
+string
+VISU::Result_i
+::GetRefFatherEntry()
+{
return "";
}
-string VISU::Result_i::GetEntry(){
+string
+VISU::Result_i
+::GetEntry()
+{
CORBA::String_var anEntry = mySObject->GetID();
return string(anEntry);
}
-const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
-const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
-const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
-std::string VISU::Result_i::GetEntry(const std::string& theComment)
+const SALOMEDS::SObject_var&
+VISU::Result_i
+::GetSObject() const
+{
+ return mySObject;
+}
+
+const SALOMEDS::Study_var&
+VISU::Result_i
+::GetStudyDocument() const
+{
+ return myStudyDocument;
+}
+
+const SALOMEDS::SComponent_var&
+VISU::Result_i
+::GetSComponent() const
+{
+ return mySComponent;
+}
+
+std::string
+VISU::Result_i
+::GetEntry(const std::string& theComment)
{
return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
}
-VISU::Result_i::~Result_i()
+
+//---------------------------------------------------------------
+VISU::Result_i
+::~Result_i()
{
MESSAGE("Result_i::~Result_i() - this = "<<this);
if (mySourceId == eRestoredFile) {
Result_i(SALOMEDS::Study_ptr theStudy,
const ESourceId& theSourceId,
- const ECreationId& theCreationId);
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately = true);
virtual ~Result_i();
virtual 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 SetBuildFields(CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsCalculateMinMax);
+ virtual CORBA::Boolean IsFieldsDone();
+
+ virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups);
+ virtual CORBA::Boolean IsGroupsDone();
+
+ virtual CORBA::Boolean IsMinMaxDone();
+
typedef VISU_Convertor TInput;
private:
ECreationId myCreationId;
TInput *myInput;
- CORBA::Boolean myIsDone;
std::string myName, myInitFileName;
QFileInfo myFileInfo;
protected:
- virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil()) ;
+ virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
+ CORBA::Boolean theIsAtOnce = true) ;
+ virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ;
+
+ _PTR(Study) myStudy;
+ CORBA::Boolean myIsBuildImmediately;
+
+ CORBA::Boolean myIsEntitiesDone;
+ CORBA::Boolean myIsFieldsDone;
+ CORBA::Boolean myIsGroupsDone;
+ CORBA::Boolean myIsMinMaxDone;
+
+ CORBA::Boolean myIsBuildFields;
+ CORBA::Boolean myIsBuildGroups;
+ CORBA::Boolean myIsBuildMinMax;
+
+ CORBA::Boolean myIsAllDone;
public:
virtual int IsPossible();
//************************************************************************
VISU_TimeAnimation::~VISU_TimeAnimation()
{
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
+
for (int i = 0; i < getNbFields(); i++) {
clearData(myFieldsLst[i]);
}
//************************************************************************
void VISU_TimeAnimation::clearData(FieldData& theData) {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
theData.myTiming.clear();
vtkRenderer* aRen = myView->getRenderer();
if (!theData.myActors.empty()) {
//************************************************************************
void VISU_TimeAnimation::nextFrame() {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
stopAnimation();
if (myFrame < (myFieldsLst[0].myNbFrames-1)) {
int i;
//************************************************************************
void VISU_TimeAnimation::prevFrame() {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
stopAnimation();
if (myFrame > 0) {
int i;
//************************************************************************
void VISU_TimeAnimation::firstFrame() {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
stopAnimation();
int i;
for (i = 0; i < getNbFields(); i++)
//************************************************************************
void VISU_TimeAnimation::lastFrame() {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
stopAnimation();
int i;
for (i = 0; i < getNbFields(); i++)
//************************************************************************
// For Batchmode using
void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) {
+ if (!myView) {
+ MESSAGE("Viewer is not defined for animation");
+ return;
+ }
if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
return;
stopAnimation();
if ( myIsLeftButtonDown )
OnLeftButtonDown( ctrl, shift, x, y );
}
-
-//----------------------------------------------------------------------------
-void
-VVTK_InteractorStyle
-::OnKeyDown()
-{
- if( GetSelector()->SelectionMode() != NodeSelection )
- return;
-
- char key = Interactor->GetKeyCode();
-
- if ( key == 'S' ) {
- // current mouse position (from last mouse move event or any other event)
- int x, y;
- Interactor->GetEventPosition( x, y );
- FindPokedRenderer( x, y ); // calls SetCurrentRenderer
-
- myOtherPoint = myPoint = QPoint(x, y);
- //printf ( "--- myPoint[ %d, %d ], myOtherPoint[ %d, %d ] ---\n",
- //myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y() );
-
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
- onFinishOperation();
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- }
-}
-
//----------------------------------------------------------------------------
void VVTK_InteractorStyle::onFinishOperation()
{
- int aNbObjWas, aNbObjNow;
- //
- aNbObjWas=GetSelector()->IObjectCount();
- //
- SVTK_InteractorStyle::onFinishOperation();
- //
- aNbObjNow=GetSelector()->IObjectCount();
-
- if (aNbObjWas+aNbObjNow==1){
- vtkCamera *aCamera = GetCurrentRenderer()->GetActiveCamera();
- float aZoomFactor = myPickingSettings->GetZoomFactor();
- double aScale = aCamera->GetParallelScale();
- if (!aNbObjWas && aNbObjNow) {
- aCamera->SetParallelScale(aScale/aZoomFactor);
- }
- else {
- aCamera->SetParallelScale(aScale*aZoomFactor);
- }
- }
+ Superclass::onFinishOperation();
}
{
Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL);
}
+//============================================================================
+//
+// Controllers
+//
+vtkStandardNewMacro(VVTK_ControllerIncrement);
+//----------------------------------------------------------------------------
+VVTK_ControllerIncrement::VVTK_ControllerIncrement()
+{
+ myIncrement=10;
+}
+//----------------------------------------------------------------------------
+VVTK_ControllerIncrement::~VVTK_ControllerIncrement()
+{
+}
+//----------------------------------------------------------------------------
+int VVTK_ControllerIncrement::Increase()
+{
+ myIncrement*=2;
+ return myIncrement;
+}
+//----------------------------------------------------------------------------
+int VVTK_ControllerIncrement::Decrease()
+{
+ myIncrement/=2;
+ if (!myIncrement){
+ myIncrement=1;
+ }
+ return myIncrement;
+}
+//
+vtkStandardNewMacro(VVTK_ControllerOnKeyDown);
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+VVTK_ControllerOnKeyDown::~VVTK_ControllerOnKeyDown()
+{
+}
+//----------------------------------------------------------------------------
+bool VVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
+{
+ SVTK_InteractorStyle *pIS=dynamic_cast<SVTK_InteractorStyle *>(theIS);
+ if (pIS){
+ if(pIS->GetSelector()->SelectionMode()==GaussPointSelection){
+ char key = pIS->GetInteractor()->GetKeyCode();
+ //
+ if (key == 'S') {
+ pIS->ActionPicking();
+ return false;
+ }
+ }
+ }
+ return Superclass::OnKeyDown(theIS);
+}
#ifndef __VVTK_InteractorStyle_h
#define __VVTK_InteractorStyle_h
+
#include "VVTK.h"
#include "SVTK_InteractorStyle.h"
+//
+//-------------------------------------------
+//! Control the value of increment in new style of interaction.
+/*!
+ This class controls of value of increment,
+ for pan/rotate/zoom operations in new style
+ of interaction
+*/
+class VVTK_ControllerIncrement : public SVTK_ControllerIncrement {
+ public:
+ vtkTypeMacro(VVTK_ControllerIncrement,SVTK_ControllerIncrement);
+ static VVTK_ControllerIncrement* New();
+
+ //! Increace the increment value by multiplying on 2
+ virtual int Increase();
-class VISU_PickingSettings;
+ //! Decreace the increment value by division on 2
+ virtual int Decrease();
+
+ protected:
+ VVTK_ControllerIncrement();
+ virtual ~VVTK_ControllerIncrement();
+ //
+ private:
+ VVTK_ControllerIncrement(const VVTK_ControllerIncrement&); //Not implemented
+ void operator=(const VVTK_ControllerIncrement&); //Not implemented
+};
+//
+//-------------------------------------------
+//! Control the behaviour of KeyDown event in new style of interaction.
+/*!
+ This class controls of behaviour of of KeyDown event
+ in new style of interaction.
+*/
+class VVTK_ControllerOnKeyDown : public SVTK_ControllerOnKeyDown{
+ public:
+ vtkTypeMacro(VVTK_ControllerOnKeyDown, SVTK_ControllerOnKeyDown);
+ static VVTK_ControllerOnKeyDown* New();
+
+ //! Provides the action on event
+ virtual bool OnKeyDown(vtkInteractorStyle* );
+
+ protected:
+ VVTK_ControllerOnKeyDown();
+ virtual ~VVTK_ControllerOnKeyDown();
+
+ private:
+ VVTK_ControllerOnKeyDown(const VVTK_ControllerOnKeyDown&);//Not implemented
+ void operator=(const VVTK_ControllerOnKeyDown&); //Not implemented
+};
+class VISU_PickingSettings;
+//! Introduce new style of interaction (keyboard free)
class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
{
public:
- // Description:
- // This class must be supplied with a vtkRenderWindowInteractor wrapper or
- // parent. This class should not normally be instantiated by application
- // programmers.
static VVTK_InteractorStyle *New();
vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle);
- // redefined in order to add an observer (callback) for custorm event (space mouse event)
+ //! Redefined from SVTK_InteractorStyle::SetInteractor in order to add an observer (callback) for custorm event (space mouse event)
virtual
void
SetInteractor( vtkRenderWindowInteractor* );
+ //! To share the VISU_PickingSettings
void
SetPickingSettings(VISU_PickingSettings* thePickingSettings);
-
+
+
protected:
VVTK_InteractorStyle();
~VVTK_InteractorStyle();
void operator=(const VVTK_InteractorStyle&); // Not implemented
// Generic event bindings must be overridden in subclasses
+
+ //! Redefine SVTK_InteractorStyle::OnLeftButtonDown
virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y);
+
+ //! Redefine SVTK_InteractorStyle::OnMiddleButtonDown
virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
+
+ //! Redefine SVTK_InteractorStyle::OnLeftButtonUp
virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y);
+
+ //! Redefine SVTK_InteractorStyle::OnMiddleButtonUp
virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
- virtual void OnKeyDown();
+
+ //! Redefine SVTK_InteractorStyle::onFinishOperation
virtual void onFinishOperation();
- // Main process VTK event method
+ //! Main process VTK event method
static
void
ProcessEvents(vtkObject* object,
void* clientData,
void* callData );
+ //! Redefine SVTK_InteractorStyle::onSpaceMouseButton
virtual void onSpaceMouseButton( int button );
+
+ //! To decrease magnification of the Gauss Points
void DecreaseGaussPointMagnification();
+
+ //! To increase magnification of the Gauss Points
void IncreaseGaussPointMagnification();
- // SpaceMouse short cuts
+ //! SpaceMouse short cuts
int mySMDecreaseMagnificationBtn;
int mySMIncreaseMagnificationBtn;
#include "VVTK_Recorder.h"
#include "VISU_WidgetCtrl.hxx"
#include "VISU_GaussPtsAct.h"
+#include "VISU_Event.h"
#include "SVTK_RenderWindowInteractor.h"
#include "VVTK_Renderer.h"
const char* theName,
SUIT_ResourceMgr* theResourceMgr):
SVTK_MainWindow(theParent,theName,theResourceMgr),
- myInteractorStyle(VVTK_InteractorStyle::New())
+ myInteractorStyle(VVTK_InteractorStyle::New()),
+ myControllerIncrement(VVTK_ControllerIncrement::New()),
+ myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New())
{
+ myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+ myControllerIncrement->Delete();
+
+ myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+ myControllerOnKeyDown->Delete();
+
myInteractorStyle->Delete();
moveDockWindow(myToolBar,Qt::DockLeft);
}
}
+//----------------------------------------------------------------------------
void
VVTK_MainWindow
::Initialize(SVTK_RenderWindowInteractor* theInteractor)
-{
+{
+ vtkInteractorStyle* pVIS=theInteractor->GetInteractorStyle();
+ SVTK_InteractorStyle *pInteractorStyle=dynamic_cast<SVTK_InteractorStyle*>(pVIS);
+ if (pInteractorStyle){
+ pInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
+ pInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer());
+ }
SVTK_MainWindow::Initialize(theInteractor);
- PushInteractorStyle(myInteractorStyle.GetPointer());
}
VVTK_MainWindow::~VVTK_MainWindow()
VVTK_MainWindow
::OnSelectionModeSwitch(bool theIsSelectionOn)
{
- SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
+ SetSelectionMode(theIsSelectionOn? GaussPointSelection: ActorSelection);
}
//----------------------------------------------------------------------------
"VVTK/SVTK StyleSwitch",
true);
anAction->setToggleAction(true);
- anAction->toggle();
anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
- connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+
anAction->addTo( myPtsToolBar );
myStyleSwitchAction = anAction;
+ if( theResourceMgr->integerValue( "VISU", "mouse_behaviour", true ) == 1 )
+ myStyleSwitchAction->toggle();
+
aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"),
aPixmap,
myRenderer = theRenderer;
VVTK_MainWindow::Initialize(theInteractor);
+ if( myStyleSwitchAction->isOn() )
+ PushInteractorStyle(myInteractorStyle.GetPointer());
+ connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+
mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() );
myPickingDlg->SetInteractor( GetInteractor() );
}
theResourceMgr,
thePickingSettings,
myStyleSwitchAction);
- //myMainWindow2->hide();
return myMainWindow2;
}
class VISU_OutsideCursorSettings;
class VISU_PickingSettings;
class VVTK_InteractorStyle;
+class VVTK_ControllerIncrement;
+class VVTK_ControllerOnKeyDown;
class VVTK_PickingDlg;
class VVTK_MainWindow2;
class VVTK_Renderer1;
class VVTK_Recorder;
//----------------------------------------------------------------------------
+//! Customize SVTK_MainWindow to provide VVTK functionality
class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
{
Q_OBJECT;
public:
+ //! Construct instance of the class
VVTK_MainWindow(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr);
+
+ //! Reimplement SVTK_MainWindow::Initialize
virtual
void
Initialize(SVTK_RenderWindowInteractor* theInteractor);
+ //! Destroy instance of the class
virtual
~VVTK_MainWindow();
public slots:
+ //! To change active interactor style at run-time
virtual
void
OnInteractorStyleSwitch(bool theIsGaussStyleOn);
+ //! To change active selection mode at run-time
virtual void OnSelectionModeSwitch(bool theIsSelectionOn);
virtual
protected:
vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
+ vtkSmartPointer<VVTK_ControllerIncrement> myControllerIncrement;
+ vtkSmartPointer<VVTK_ControllerOnKeyDown> myControllerOnKeyDown;
QToolBar* myRecordingToolBar;
QtxAction* myStartAction;
//----------------------------------------------------------------------------
+//! Extend VVTK_MainWindow to implement functionality for base view
class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow
{
Q_OBJECT;
public:
+ //! Construct instance of the class
VVTK_MainWindow1(QSplitter* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr);
+
+ //! Reimplement VVTK_MainWindow::Initialize
virtual
void
Initialize(SVTK_RenderWindowInteractor* theInteractor,
VVTK_Renderer1* theRenderer);
-
+ //! Destroy instance of the class
virtual
~VVTK_MainWindow1();
+ //! Create instance of the segmented VVTK_MainWindow
+ /*!
+ The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time.
+ So, it is necessary to synhronize them through sharing some common pointers.
+ */
VVTK_MainWindow2*
CreateMainWindow2(QWidget* theParent,
const char* theName,
VISU_InsideCursorSettings*
GetInsideCursorSettings();
+ //! Get contained VISU_OutsideCursorSettings
VISU_OutsideCursorSettings*
GetOutsideCursorSettings();
+ //! Get contained VISU_PickingSettings
VISU_PickingSettings*
GetPickingSettings();
public slots:
+ //! To activate/ deactivate the segementation cursor at run-time
void
OnSegmentationSwitch();//bool theIsSegmentationOn);
+ //! Customize VVTK_MainWindow::OnSelectionModeSwitch
virtual
void
OnSelectionModeSwitch(bool theIsSelectionOn);
protected:
- VVTK_Renderer1* myRenderer;
+ VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer
+
+ VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view
- VVTK_MainWindow2* myMainWindow2;
+ QtxAction* myStyleSwitchAction; //!< Action for switch interactor style
+ QToolBar* myPtsToolBar; //!< Additional tool bar
- QtxAction* myStyleSwitchAction;
- QToolBar* myPtsToolBar;
- QSplitter* mySplitter;
+ //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor
+ QSplitter* mySplitter;
- QtxAction* myPlaneSegmentationAction;
- QtxAction* mySphereSegmentationAction;
+ QtxAction* myPlaneSegmentationAction; //!< Action for switch segmentation mode to plane
+ QtxAction* mySphereSegmentationAction; //!< Action for switch segmentation mode to sphere
- VVTK_SegmentationCursorDlg* mySegmentationCursorDlg;
- VVTK_PickingDlg* myPickingDlg;
+ //! Keep reference to VVTK_SegmentationCursorDlg
+ VVTK_SegmentationCursorDlg* mySegmentationCursorDlg;
+ VVTK_PickingDlg* myPickingDlg; //!< Keep reference to VVTK_PickingDlg
};
//----------------------------------------------------------------------------
+//! Extend VVTK_MainWindow to implement functionality for segmented view
class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow
{
Q_OBJECT;
friend class VVTK_MainWindow1;
+ //! Construct instance of the class
VVTK_MainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
VISU_PickingSettings* thePickingSettings,
QtxAction* theStyleSwitchAction);
public:
+ //! Destroy instance of the class
virtual
~VVTK_MainWindow2();
};
#include "utilities.h"
#include <qcheckbox.h>
+#include <qcolordialog.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
CursorGroupLayout->setMargin(11);
QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
- myPyramidHeightSpinBox = new QtxDblSpinBox( 1.0, 100.0, 1.0, CursorGroup );
+ double aHeightMin=1.e-7;
+ double aHeightMax=10.;
+ double aHeightStep=0.1;
+ myPyramidHeightSpinBox = new QtxDblSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup );
+
myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+
+ QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup );
+ mySelectionColorButton = new QPushButton( CursorGroup );
+ mySelectionColorButton->setPaletteBackgroundColor( Qt::blue );
+ mySelectionColorButton->setPaletteForegroundColor( Qt::blue );
+ connect( mySelectionColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
CursorGroupLayout->addWidget( PyramidHeightLabel, 0, 0 );
CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 0, 1 );
+ CursorGroupLayout->addWidget( SelectionColorLabel, 1, 0 );
+ CursorGroupLayout->addWidget( mySelectionColorButton, 1, 1 );
+
+ // Tolerance
+ QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), aBox, "ToleranceGroup" );
+ ToleranceGroup->setColumnLayout(0, Qt::Vertical );
+ ToleranceGroup->layout()->setSpacing( 0 );
+ ToleranceGroup->layout()->setMargin( 0 );
+
+ QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup->layout());
+ ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ ToleranceGroupLayout->setSpacing(6);
+ ToleranceGroupLayout->setMargin(11);
+
+ QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup );
+ myPointToleranceSpinBox = new QtxDblSpinBox( 0.001, 10.0, 0.01, ToleranceGroup );
+ myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 );
+ ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 );
// Information window
QGroupBox* InfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), aBox, "InfoWindowGroup" );
void VVTK_PickingDlg::Update()
{
float aPyramidHeight = 10.0;
+ float aPointTolerance = 0.1;
+ QColor aColor = Qt::yellow;
int anInfoWindowTransparency = 50;
int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
float aZoomFactor = 1.5;
if( !myPickingSettings->GetInitial() )
{
myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
+ myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() );
+ myTransparencySpinBox->setValue( myPickingSettings->GetInfoWindowTransparency() * 100.0 );
myTransparencySpinBox->setValue( ( int )myPickingSettings->GetInfoWindowTransparency() * 100 );
myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() );
myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
+ float* aColor = myPickingSettings->GetColor();
+ mySelectionColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ),
+ ( int )( aColor[1] * 255.0 ),
+ ( int )( aColor[2] * 255.0 ) ) );
+
return;
}
aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
myPyramidHeightSpinBox->setValue( aPyramidHeight );
+ aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
+ myPointToleranceSpinBox->setValue( aPointTolerance );
+
+ aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
+ mySelectionColorButton->setPaletteBackgroundColor( aColor );
+
anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency );
myTransparencySpinBox->setValue( anInfoWindowTransparency );
myPickingSettings->SetInitial( false );
myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+ myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
myPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentItem() );
myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
+ QColor aButtonColor = mySelectionColorButton->paletteBackgroundColor();
+ float aColor[3];
+ aColor[0] = aButtonColor.red() / 255.0;
+ aColor[1] = aButtonColor.green() / 255.0;
+ aColor[2] = aButtonColor.blue() / 255.0;
+ myPickingSettings->SetColor( aColor );
+
myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
}
myAction->setOn( false );
QDialog::done( r );
}
+
+void VVTK_PickingDlg::onColorButtonPressed()
+{
+ QColor aColor = QColorDialog::getColor( mySelectionColorButton->paletteBackgroundColor(), this );
+ if( aColor.isValid() )
+ mySelectionColorButton->setPaletteBackgroundColor( aColor );
+}
class QLabel;
class QComboBox;
class QCheckBox;
+class QPushButton;
class QtxAction;
class QtxDblSpinBox;
class SVTK_RenderWindowInteractor;
+//! Picking Dialog.
+/*!
+ * Uses for set up picking preferenses and apply
+ * them to all actors in the current renderer.
+ */
class VVTK_PickingDlg : public QDialog
{
Q_OBJECT
VVTK_PickingDlg( QWidget* parent = 0, const char* name = 0 );
~VVTK_PickingDlg();
+ //! Used to switch toggle state of the Picking action.
void SetAction( QtxAction* theAction ) { myAction = theAction; }
+ //! Make an actor to listen the event of Update Picking Settings event.
void AddActor( VISU_GaussPtsAct* );
void RemoveActor( VISU_GaussPtsAct* );
+ //! Update dialog contents.
void Update();
VISU_PickingSettings* GetPickingSettings();
void onClickApply();
void onClickClose();
+ void onColorButtonPressed();
+
private:
static void ProcessEvents(vtkObject* theObject,
unsigned long theEvent,
private:
QtxDblSpinBox* myPyramidHeightSpinBox;
+ QPushButton* mySelectionColorButton;
+ QtxDblSpinBox* myPointToleranceSpinBox;
QtxIntSpinBox* myTransparencySpinBox;
QComboBox* myPositionComboBox;
QtxDblSpinBox* myZoomFactorSpinBox;
#include <vtkObjectFactory.h>
#include <vtkProperty.h>
+#include <vtkPointPicker.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkCallbackCommand.h>
::VVTK_Renderer():
myFPSActor(VISU_FPSActor::New()),
myInsideCursorSettings(NULL),
- myPickingSettings(NULL)
+ myPickingSettings(NULL),
+ myGaussPointPicker(vtkPointPicker::New()),
+ myGaussPreHighlightProperty(vtkProperty::New()),
+ myGaussHighlightProperty(vtkProperty::New())
{
if(MYDEBUG) INFOS("VVTK_Renderer() - "<<this);
aTextMapper->Delete();
GetDevice()->AddActor2D(myFPSActor.GetPointer());
+
+ myGaussPointPicker->Delete();
+
+ myGaussPreHighlightProperty->Delete();
+ myGaussPreHighlightProperty->SetColor(0,1,1);
+
+ myGaussHighlightProperty->Delete();
+ myGaussHighlightProperty->SetColor(1,1,0);
+
}
VVTK_Renderer
VVTK_Renderer
::AddActor(VTKViewer_Actor* theActor)
{
+ Superclass::AddActor(theActor);
if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ anActor->SetPointPicker(myGaussPointPicker.GetPointer());
+ anActor->SetPreHighlightProperty(myGaussPreHighlightProperty.GetPointer());
+ anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer());
+
anActor->SetInsideCursorSettings(myInsideCursorSettings);
anActor->SetPickingSettings(myPickingSettings);
- Superclass::AddActor(anActor);
}
}
VVTK_Renderer
::RemoveActor(VTKViewer_Actor* theActor)
{
- using namespace VISU;
+ Superclass::RemoveActor(theActor);
if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ anActor->SetPointPicker(NULL);
+ anActor->SetPreHighlightProperty(NULL);
+ anActor->SetHighlightProperty(NULL);
+
anActor->SetInsideCursorSettings(NULL);
anActor->SetPickingSettings(NULL);
- Superclass::RemoveActor(theActor);
}
}
VVTK_Renderer1
::AddActor(VTKViewer_Actor* theActor)
{
+ Superclass::AddActor(theActor);
if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
anActor->SetWidgetCtrl(GetWidgetCtrl());
anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
- Superclass::AddActor(anActor);
AdjustWidgetCtrl();
}
}
VVTK_Renderer1
::RemoveActor(VTKViewer_Actor* theActor)
{
- using namespace VISU;
+ Superclass::RemoveActor(theActor);
if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
anActor->SetWidgetCtrl(NULL);
anActor->SetOutsideCursorSettings(NULL);
- Superclass::RemoveActor(theActor);
AdjustWidgetCtrl();
}
}
VVTK_Renderer2* self = reinterpret_cast<VVTK_Renderer2*>(theClientData);
switch(theEvent){
+ case vtkCommand::EnableEvent:
case vtkCommand::EndInteractionEvent:
self->OnEndInteractionEvent();
break;
class VISU_PickingSettings;
class VISU_FPSActor;
+class vtkPointPicker;
class vtkImplicitFunction;
//----------------------------------------------------------------------------
+//! To customize SVTK_Renderer according to VVTK functionality
class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer
{
public:
vtkTypeMacro(VVTK_Renderer,SVTK_Renderer);
static VVTK_Renderer* New();
+ //! Reimplement SVTK_Renderer::AddActor
+ /*!
+ Perform an additional action - apply picking settings on the published VISU_GaussPtsAct actors
+ */
virtual
void
AddActor(VTKViewer_Actor* theActor);
+ //! Reimplement SVTK_Renderer::RemoveActor (remove additional settings)
virtual
void
RemoveActor(VTKViewer_Actor* theActor);
+ //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct actors published into the view
void
SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
VVTK_Renderer();
~VVTK_Renderer();
- VISU_InsideCursorSettings* myInsideCursorSettings;
- VISU_PickingSettings* myPickingSettings;
- vtkSmartPointer<VISU_FPSActor> myFPSActor;
+ VISU_PickingSettings* myPickingSettings; //! Keeps reference of the VISU_PickingSettings
+ VISU_InsideCursorSettings* myInsideCursorSettings; //! Keeps reference of the VISU_InsideCursorSettings
+ vtkSmartPointer<VISU_FPSActor> myFPSActor; //!< To show FPS of the rendering at run-time
+
+ vtkSmartPointer<vtkPointPicker> myGaussPointPicker;
+ vtkSmartPointer<vtkProperty> myGaussPreHighlightProperty;
+ vtkSmartPointer<vtkProperty> myGaussHighlightProperty;
};
//----------------------------------------------------------------------------
+//! To extend VVTK_Renderer to implement base view functionality
class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
{
public:
vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer);
static VVTK_Renderer1* New();
+ //! Reimplement SVTK_Renderer::Initialize
virtual
void
Initialize(vtkRenderWindowInteractor* theInteractor,
SVTK_Selector* theSelector);
+ //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings
virtual
void
AddActor(VTKViewer_Actor* theActor);
+ //! Reimplement VVTK_Renderer::RemoveActor
virtual
void
RemoveActor(VTKViewer_Actor* theActor);
+ //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct1 actors published into the view
void
SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
VVTK_Renderer1();
~VVTK_Renderer1();
+ //! Reimplement VVTK_Renderer::OnAdjustActors
virtual
bool
OnAdjustActors();
vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer);
static VVTK_Renderer2* New();
+ //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings
virtual
void
AddActor(VTKViewer_Actor* theActor);
+ //! Reimplement VVTK_Renderer::RemoveActor
virtual
void
RemoveActor(VTKViewer_Actor* theActor);
void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
+ //! To handle vtkCommand::EndInteractionEvent to redraw the view
void
OnEndInteractionEvent();
VVTK_Renderer2();
~VVTK_Renderer2();
- // Main process VTK event method
+ //! Main process VTK event method
static
void
ProcessEvents(vtkObject* theObject,
void* theClientData,
void* theCallData);
- // Used to process VTK events
+ //! Used to process VTK events
vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
- // Priority at which events are processed
+ //! Priority at which events are processed
float myPriority;
VISU_WidgetCtrl* myWidgetCtrl;
#include "VISU_SphereWidget.hxx"
#include "VISU_GaussPointsPL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints()
{
+ float aClamp = 256.0;
int aPrimitiveType = VVTK_PrimitiveBox::PointSprite;
- float aClamp = 200.0;
QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
float anAlphaThreshold = 0.1;
normal[0] = myDXDirectionSpinBox->value();
normal[1] = myDYDirectionSpinBox->value();
normal[2] = myDZDirectionSpinBox->value();
+
+ if( normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0 )
+ {
+ normal[2] = 1.0;
+ myDZDirectionSpinBox->setValue( 1.0 );
+ }
pPlanesWidget->SetNormal( normal );
pPlanesWidget->SetDistance( myDepthSpinBox->value() );
-
+
myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
myWidgetCtrl->GetInteractor()->Render();
}
class VVTK_PrimitiveBox;
class VVTK_SizeBox;
+//! Segmentation Cursor Dialog.
+/*!
+ * Uses for set up Segmentation and Outside Cursor Gauss Points preferenses
+ * and apply them to all actors in the current renderer.
+ */
class VVTK_SegmentationCursorDlg : public QDialog
{
Q_OBJECT
bool GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; }
void SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; }
+ //! Update contents of the Segmentation tab.
void UpdateSegmentation();
void UpdateInsideGaussPoints();
void UpdateOutsideGaussPoints();
+ //! Update contents of the Outside Cursor tab.
+ void UpdateOutsideCursor();
+
VISU_InsideCursorSettings* GetInsideCursorSettings();
VISU_OutsideCursorSettings* GetOutsideCursorSettings();
class SUIT_Desktop;
+//! Extend SUIT_ViewManager to deal with VVTK_Viewer
class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager
{
Q_OBJECT;
public:
-
+ //! Construct the view manager
VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+
+ //! Destroy the view manager
virtual ~VVTK_ViewManager();
protected:
class VVTK_ViewWindow;
+//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View
class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
{
Q_OBJECT;
VVTK_Viewer();
virtual ~VVTK_Viewer();
+ //! Redefine SUIT_ViewModel::createView
virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
- virtual void setViewManager(SUIT_ViewManager* theViewManager);
- virtual void contextMenuPopup( QPopupMenu* );
- virtual QString getType() const { return Type(); }
+ //! Redefine SUIT_ViewModel::setViewManager
+ virtual void setViewManager(SUIT_ViewManager* theViewManager);
+ //! Redefine SUIT_ViewModel::contextMenuPopup
+ virtual void contextMenuPopup( QPopupMenu* );
+ //! See SUIT_ViewModel::getType
+ virtual QString getType() const { return Type(); }
+ //! Redefine SALOME_View::Repaint
virtual void Repaint();
- virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
+ //! Redefine SALOME_View::isVisible
+ virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
+ //! Get background color of the viewer
QColor backgroundColor() const;
+
+ //! Set background color to the viewer
void setBackgroundColor( const QColor& );
+ //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
int trihedronSize() const;
+
+ //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
void setTrihedronSize( const int );
protected slots:
class SVTK_View;
//----------------------------------------------------------------------------
+//! Customize the SVTK_ViewWindow in order to manage two SVTK_View (base and segmented one)
class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow
{
Q_OBJECT;
public:
+ //! To construct the class
VVTK_ViewWindow(SUIT_Desktop* theDesktop);
+ //! Destroy
virtual
~VVTK_ViewWindow();
+ //! To initialize
virtual
void
Initialize(SVTK_ViewModelBase* theModel);
//----------------------------------------------------------------------------
+ //! Get access to base SVTK_MainWindow
VVTK_MainWindow1*
getMainWindow1();
+ //! Get access to segmented SVTK_MainWindow
VVTK_MainWindow2*
getMainWindow2();
//----------------------------------------------------------------------------
+ //! Redefine SVTK_ViewWindow::AddActor method
+ /*!
+ This is an entry point for publication the presentation into the viewer.
+ Pointed actor published into the basic MainWindow. If the actor is
+ a Gauss Points one second actor is created from initial actor and
+ is put into segemented MainWindow.
+ */
virtual
void
AddActor(VTKViewer_Actor* theActor,
bool theIsUpdate = false);
+ //! Redefine SVTK_ViewWindow::RemoveActor method
virtual
void
RemoveActor(VTKViewer_Actor* theActor,
bool theIsUpdate = false);
+ //! Redefine SVTK_ViewWindow::Repaint method
virtual
void
Repaint(bool theUpdateTrihedron = true);
//----------------------------------------------------------------------------
/* interactive object management */
+ //! Redefine SVTK_ViewWindow::highlight method
virtual
void
highlight(const Handle(SALOME_InteractiveObject)& theIO,
bool theIsHighlight = true,
bool theIsUpdate = true);
+
+ //! Redefine SVTK_ViewWindow::unHighlightAll method
virtual
void
unHighlightAll();
//----------------------------------------------------------------------------
public slots:
+ //! Redefine SVTK_ViewWindow::onSelectionChanged method
virtual
void
onSelectionChanged();
+ //! Redefine SVTK_ViewWindow::onResetView method
virtual
void
onResetView();
+ //! Redefine SVTK_ViewWindow::onFitAll method
virtual
void
onFitAll();
void
action( const int );
- VVTK_MainWindow1* myMainWindow1;
- SVTK_View* myView1;
+ VVTK_MainWindow1* myMainWindow1; //!< The manage base view
+ SVTK_View* myView1; //!< The manage base view
- VVTK_MainWindow2* myMainWindow2;
- SVTK_View* myView2;
+ VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view
+ SVTK_View* myView2; //!< The manage segmented view
};
#ifdef WIN32