TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object */
TGAUSSPOINTS, /*!< Gauss Points 3D presentation object */
TPLOT3D, /*!< Plot3D 3D presentation object */
+ TPOINTMAP3D, /*!< 3D presentation for table object */
TCUTPLANES, /*!< Cut planes 3D presentation object */
TCUTLINES, /*!< Cut lines 3D presentation object */
TVECTORS, /*!< Vectors 3D presentation object */
interface PrsObject : RemovableObject {
};
- //-------------------------------------------------------
- /*! \brief %Table representation interface
- *
- * Presentation parameters of the %Table view.
- */
- interface Table : PrsObject {
- /*!
- * Sets the title of the table.
- * \param theTitle String parameter defining the title of this table.
- */
- void SetTitle(in string theTitle);
-
- /*!
- * Gets the title of the table.
- * \return A string value containing the title of the table.
- */
- string GetTitle();
-
- /*!
- * This enumeration contains a set of elements defining the orientation of the table.
- */
- enum Orientation {
- HORIZONTAL, /*!< Horizontal orientation of the table. */
- VERTIACAL /*!< Vertical orientation of the table. */
- };
-
- /*!
- * Sets orientation of the table.
- * \param theOrientation This input parameter defines the orientation of the table.
- * It is taken from the <VAR>Orientation</VAR> enumeration.
- */
- void SetOrientation(in Orientation theOrientation);
-
- /*!
- * Gets orientation of the table.
- * \return Orientation of the table. The returned value will correspond
- * to one of the elements the <VAR>Orientation</VAR> enumeration.
- */
- Orientation GetOrientation();
-
- /*!
- * Gets the number of rows of the table.
- * \return Long value corresponding to the number of rows of the table
- */
- long GetNbRows();
-
- /*!
- * Gets the number of columns of the table.
- * \return Long value corresponding to the number of columns of the table
- */
- long GetNbColumns();
- };
-
//-------------------------------------------------------
/*! \brief Interface of curve representation.
*
* bar is displayed along with each colored field presentation and serves for
* consulting the correspondance between colors and data values.
*/
- interface ColoredPrs3d : Prs3d
+ interface ColoredPrs3dBase : Prs3d
{
- /*! Sets the method of coloring of the elements composing a 3D presentation.
- */
- void SetScalarMode(in long theScalarMode);
-
- /*! Gets the method of coloring of the elements composing a 3D presentation.
- */
- long GetScalarMode();
-
/*!
* Sets scalar range - min and max boundaries of the scalar bar.
* \param theMin Min boundary of the scalar bar.
/*!
* Gets the min boundary of the scalar bar from source data.
*/
- double GetSourceMin();
+ double GetSourceMin();
/*!
* Gets the max boundary of the scalar bar from source data.
* will be used for visualization of this presentable object.
*/
long GetNbColors();
-
/*!
* Sets the number of labels which will be used for indication of color gradation
* of the scalar bar.
*/
long GetLabels();
- /*!
- * Sets the title of the scalar bar. By default - the name of the selected result is used.
- * \param theName String parameter defining the name of the scalar bar.
- */
- void SetTitle(in string theName);
-
- /*!
- * Gets the title of the scalar bar.
- */
- string GetTitle();
-
/*! %Orientation of the scalar bar (to provide backward compatibility). */
enum Orientation {
HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
* Gets the type of orientation of the scalar bar (to provide backward compatibility).
*/
Orientation GetBarOrientation();
+ };
+
+ /*! \brief Additional Interface for the %Colored 3D Presentations
+ *
+ */
+
+ interface ColoredPrs3d : ColoredPrs3dBase
+ {
+ /*!
+ * Sets the title of the scalar bar. By default - the name of the selected result is used.
+ * \param theName String parameter defining the name of the scalar bar.
+ */
+ void SetTitle(in string theName);
+
+ /*!
+ * Gets the title of the scalar bar.
+ */
+ string GetTitle();
+
+ /*! Sets the method of coloring of the elements composing a 3D presentation.
+ */
+ void SetScalarMode(in long theScalarMode);
+
+ /*! Gets the method of coloring of the elements composing a 3D presentation.
+ */
+ long GetScalarMode();
/*!
* Add group as geometry of presentation.
*/
void AddMeshOnGroup(in string theGroupName);
-
/*!
* PrsMerger method:
* Remove all groups.(The scalar map will be placed on all mesh).
* bar is displayed along with each colored field presentation and serves for
* consulting the correspondance between colors and data values.
*/
- interface ScalarMap : ColoredPrs3d {
+
+ interface ScaledPrs3d {
/*!
* Sets the type of scaling of the values reflected by the scalar bar.
* \param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
* Gets the type of scaling of the values reflected by this presentation.
*/
Scaling GetScaling();
+ };
+
+ interface ScalarMap : ColoredPrs3d, ScaledPrs3d {
};
* consists of deforming initial planar mesh according to values assigned to the mesh elements.
* If mesh not planar but volumic one, it is possible to generate intermediate planar mesh.
*/
- interface Plot3D : ScalarMap {
+ interface Plot3dBase {
+ /*!
+ * Sets the scale factor for scalar values
+ * (how much corresponding mesh elements should be translated).
+ * \param theScaleFactor The scaling factor.
+ */
+ void SetScaleFactor (in double theScaleFactor);
+
+ /*!
+ * Gets the scale factor for scalar values.
+ * (how much corresponding mesh elements is translated)
+ */
+ double GetScaleFactor();
+
+ /*!
+ * Sets presentation type: contour or surface.
+ * \param theIsContourPrs Define, whether presentation type is contour.
+ */
+ void SetContourPrs (in boolean theIsContourPrs );
+
+ /*!
+ * Returns true if presentation type is contour.
+ */
+ boolean GetIsContourPrs();
+
+ /*!
+ * Sets the number of contours.
+ * \param theNb The number of contours.
+ */
+ void SetNbOfContours (in long theNb);
+
+ /*!
+ * Gets the number of contours.
+ */
+ long GetNbOfContours();
+ };
+
+ interface Plot3D : ScalarMap, Plot3dBase {
/*!
* This enumeration contains a set of elements defining
* the type of orientation in 3D space of the cutting plane.
* Returns true if a position of cutting plane is relative
*/
boolean IsPositionRelative();
+ };
+ //-------------------------------------------------------
+ /*! \brief %Table representation interface
+ *
+ * Presentation parameters of the %Table view.
+ */
+ interface Table : PrsObject {
/*!
- * Sets the scale factor for scalar values
- * (how much corresponding mesh elements should be translated).
- * \param theScaleFactor The scaling factor.
+ * Sets the title of the table.
+ * \param theTitle String parameter defining the title of this table.
*/
- void SetScaleFactor (in double theScaleFactor);
+ void SetTitle(in string theTitle);
/*!
- * Gets the scale factor for scalar values.
- * (how much corresponding mesh elements is translated)
+ * Gets the title of the table.
+ * \return A string value containing the title of the table.
+ */
+ string GetTitle();
+
+ /*!
+ * This enumeration contains a set of elements defining the orientation of the table.
*/
- double GetScaleFactor();
+ enum Orientation {
+ HORIZONTAL, /*!< Horizontal orientation of the table. */
+ VERTIACAL /*!< Vertical orientation of the table. */
+ };
/*!
- * Sets presentation type: contour or surface.
- * \param theIsContourPrs Define, whether presentation type is contour.
+ * Sets orientation of the table.
+ * \param theOrientation This input parameter defines the orientation of the table.
+ * It is taken from the <VAR>Orientation</VAR> enumeration.
*/
- void SetContourPrs (in boolean theIsContourPrs );
+ void SetOrientation(in Orientation theOrientation);
/*!
- * Returns true if presentation type is contour.
+ * Gets orientation of the table.
+ * \return Orientation of the table. The returned value will correspond
+ * to one of the elements the <VAR>Orientation</VAR> enumeration.
*/
- boolean GetIsContourPrs();
+ Orientation GetOrientation();
/*!
- * Sets the number of contours.
- * \param theNb The number of contours.
+ * Gets the number of rows of the table.
+ * \return Long value corresponding to the number of rows of the table
*/
- void SetNbOfContours (in long theNb);
+ long GetNbRows();
/*!
- * Gets the number of contours.
+ * Gets the number of columns of the table.
+ * \return Long value corresponding to the number of columns of the table
*/
- long GetNbOfContours();
+ long GetNbColumns();
+ };
+
+ //-------------------------------------------------------
+ /*! \brief %PointMap3d representation interface
+ *
+ * Presentation parameters of the %Table Point Map in 3d view.
+ */
+ interface PointMap3d : ColoredPrs3dBase, ScaledPrs3d, Plot3dBase, Table {
};
//-------------------------------------------------------
/*! Gets current resolution of multi resolution structure for the given mesh and part names */
void SetResolution(in EntityName theMeshName, in EntityName thePartName, in Resolution theResolution);
+
+ /*! Gets information about imported MED file */
+ SALOME_MED::MedFileInfo GetMEDFileInfo();
};
//-------------------------------------------------------
VISU_UsedPointsFilter.hxx \
VISU_CommonCellsFilter.hxx \
VISUConvertor.hxx \
- VISU_GaussMergeFilter.hxx
+ VISU_GaussMergeFilter.hxx \
+ VISU_TableReader.hxx
dist_libVisuConvertor_la_SOURCES= \
VISU_IDMapper.cxx \
VISU_MergeFilterUtilities.cxx \
VISU_UsedPointsFilter.cxx \
VISU_CommonCellsFilter.cxx \
- VISU_GaussMergeFilter.cxx
+ VISU_GaussMergeFilter.cxx \
+ VISU_TableReader.cxx
libVisuConvertor_la_CPPFLAGS= \
-ftemplate-depth-32 \
libVisuConvertor_la_LDFLAGS= \
+ $(MED2_LIBS) \
$(QT_LIBS) \
$(CAS_KERNEL) \
$(CAS_MATH) \
#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "VISU_Convertor_impl.hxx"
+#include "VISU_TableReader.hxx"
+
#include <fstream>
#include <strstream>
-#include <vtkCellType.h>
#include <memory>
-#include "VISU_Convertor_impl.hxx"
+#include <vtkCellType.h>
#include <vtkUnstructuredGrid.h>
#include <QDir>
typedef vtkUnstructuredGrid TOutput;
-void parseFile(const char* theFileName)
+void ParseMEDFile(const char* theFileName)
{
#ifndef _DEXCEPT_
try{
#endif
}
-int main(int argc, char** argv){
- if(argc > 1){
- QFileInfo fi(argv[1]);
- for(int i = 0; i < 1; i++){
- if(fi.exists()){
- if(fi.isDir()){
- QDir aDir(fi.absoluteFilePath());
- QStringList aStringList = aDir.entryList(QStringList("*.med"),QDir::Files);
+void ParseXLSFile(const char* theFileName)
+{
+ VISU::TTableContainer aContainer;
+ VISU::ImportTables( theFileName, aContainer );
+}
+
+int
+main( int argc, char** argv )
+{
+ if ( argc > 1 ) {
+ QFileInfo aFileInfo( argv[1] );
+ for ( int i = 0; i < 1; i++ ) {
+ if ( aFileInfo.exists() ) {
+ if ( aFileInfo.isDir() ) {
+ QDir aDir( aFileInfo.absoluteFilePath() );
+ QStringList wildcards; wildcards << "*.med";
+ QStringList aStringList = aDir.entryList( wildcards, QDir::Files );
int jEnd = aStringList.count();
- for(int j = 0; j < jEnd; j++){
- parseFile((const char*)aDir.filePath(aStringList[j]).toLatin1());
+ for ( int j = 0; j < jEnd; j++ ) {
+ ParseMEDFile( aDir.filePath( aStringList[j] ).toLatin1().data() );
}
- }else{
- parseFile(argv[1]);
+ } else {
+ QString anExtension = aFileInfo.suffix();
+ if ( anExtension == "med" )
+ ParseMEDFile( argv[1] );
+ else if ( anExtension == "xls" || anExtension == "txt" )
+ ParseXLSFile( argv[1] );
}
}
}
vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
VISU::PSubMeshImpl aSubMesh = anIter->second;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aSubMesh->myIsStructured = aMesh->myIsStructured;
- aSubMesh->myType = aMesh->myType;
- aSubMesh->myGrilleStructure = aMesh->myGrilleStructure;
- aSubMesh->myObjID2StructureID = aMesh->myObjID2StructureID;
- //ENK: 23.11.2006
-
- const VISU::PUnstructuredGrid& aSource = aSubMesh->GetSource();
- aSource->ShallowCopy(aMesh->GetPointSet());
+ aSubMesh->CopyStructure( aMesh );
aSubMesh->myStartID = aCellID;
+
+ const VISU::PUnstructuredGrid& aSource = aSubMesh->GetSource();
GetCellsOnSubMesh(aSource, aMeshOnEntity, aSubMesh, aVGeom);
anAppendFilter->AddInput(aSource.GetPointer());
aSubMeshArr[anID] = aSubMesh;
}
- aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aMeshOnEntity->myIsStructured = aMesh->myIsStructured;
- aMeshOnEntity->myType = aMesh->myType;
- aMeshOnEntity->myGrilleStructure = aMesh->myGrilleStructure;
- aMeshOnEntity->myObjID2StructureID = aMesh->myObjID2StructureID;
- //ENK: 23.11.2006
+ aMeshOnEntity->CopyStructure( aMesh );
aMeshOnEntity->myIsVTKDone = true;
#ifndef _DEXCEPT_
try{
#endif
- if(!aFamily->myIsVTKDone){
- const VISU::PUnstructuredGrid& aSource = aFamily->GetSource();
- if(MYVTKDEBUG) aSource->DebugOn();
+ if ( !aFamily->myIsVTKDone ) {
+ GetMeshOnEntity( theMeshName, theEntity );
- GetMeshOnEntity(theMeshName,theEntity);
+ LoadFamilyOnEntity( aMesh, aMeshOnEntity, aFamily );
- LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily);
- aSource->ShallowCopy(aMesh->GetPointSet());
- GetCellsOnFamily(aSource,aMeshOnEntity,aFamily);
+ aFamily->CopyStructure( aMesh );
+
+ const VISU::PUnstructuredGrid& aSource = aFamily->GetSource();
+ GetCellsOnFamily( aSource, aMeshOnEntity, aFamily );
- aFamily->myNamedPointCoords = aMesh->myNamedPointCoords;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aFamily->myIsStructured = aMesh->myIsStructured;
- aFamily->myType = aMesh->myType;
- aFamily->myGrilleStructure = aMesh->myGrilleStructure;
- aFamily->myObjID2StructureID = aMesh->myObjID2StructureID;
- //ENK: 23.11.2006
aFamily->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
}
aFamilyArr[anID] = aFamily;
}
- aGroup->myNamedPointCoords = aMesh->myNamedPointCoords;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aGroup->myIsStructured = aMesh->myIsStructured;
- aGroup->myType = aMesh->myType;
- aGroup->myGrilleStructure = aMesh->myGrilleStructure;
- aGroup->myObjID2StructureID = aMesh->myObjID2StructureID;
- //ENK: 23.11.2006
+
+ aGroup->CopyStructure( aMesh );
+
aGroup->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
aVTKMeshOnEntity->myEntity);
}
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- anUnstructuredGridIDMapper->myIsStructured = aMesh->myIsStructured;
- anUnstructuredGridIDMapper->myType = aMesh->myType;
- anUnstructuredGridIDMapper->myGrilleStructure = aMesh->myGrilleStructure;
- anUnstructuredGridIDMapper->myObjID2StructureID = aMesh->myObjID2StructureID;
- //ENK: 23.11.2006
+ anUnstructuredGridIDMapper->CopyStructure( aMesh );
anUnstructuredGridIDMapper->myIsVTKDone = true;
namespace VISU
{
//---------------------------------------------------------------
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
+ TStructuredId
+ ::TStructuredId()
+ {
+ myData[0] = myData[1] = myData[2] = -1;
+ }
+
+ vtkIdType&
+ TStructuredId
+ ::operator [] ( size_t theId )
+ {
+ return myData[ theId ];
+ }
+
+ const vtkIdType&
+ TStructuredId
+ ::operator [] ( size_t theId ) const
+ {
+ return myData[ theId ];
+ }
+
+ bool
+ TStructuredId
+ ::operator == ( const TStructuredId& theId ) const
+ {
+ return
+ theId[0] == myData[0] &&
+ theId[1] == myData[1] &&
+ theId[2] == myData[2];
+ }
+
+ //---------------------------------------------------------------
+ void
+ TStructured
+ ::CopyStructure(PStructured theStructured)
+ {
+ myIsPolarType = theStructured->myIsPolarType;
+ myIsStructured = theStructured->myIsStructured;
+ myGrilleStructure = theStructured->myGrilleStructure;
+ myObj2StructuredId = theStructured->myObj2StructuredId;
+ }
+
bool
TStructured
::IsStructured() const
return myIsStructured;
}
- TIdTypeVector
+ TStructuredId
TStructured
::GetStructure()
{
return myGrilleStructure;
}
- TIdTypeVector
+ vtkIdType
+ TStructured
+ ::GetStructureDim()
+ {
+ return
+ vtkIdType( myGrilleStructure[0] >= 0) +
+ vtkIdType( myGrilleStructure[1] >= 0) +
+ vtkIdType( myGrilleStructure[2] >= 0);
+ }
+
+ TStructuredId
TStructured
::GetIndexesOfNode(vtkIdType theNodeId)
{
- TIdTypeVector aNullVec;
- if(!IsStructured())
- return aNullVec;
- TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.find(theNodeId);
- if(aIter!=myObjID2StructureID.end())
- return aIter->second;
- else
- return aNullVec;
+ if ( IsStructured() ) {
+ TObj2StructuredId::const_iterator aIter = myObj2StructuredId->find( theNodeId );
+ if ( aIter != myObj2StructuredId->end() )
+ return aIter->second;
+ }
+
+ return TStructuredId();
}
vtkIdType
TStructured
- ::GetObjectIDByIndexes(TIdTypeVector theVec)
+ ::GetObjectIDByIndexes(TStructuredId theVec)
{
- TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.begin();
- for(;aIter!=myObjID2StructureID.end();aIter++){
- if(theVec == aIter->second)
+ TObj2StructuredId::const_iterator aIter = myObj2StructuredId->begin();
+ for (; aIter != myObj2StructuredId->end(); aIter++ ) {
+ if ( theVec == aIter->second )
return aIter->first;
}
+
return -1;
}
- //ENK: 23.11.2006
+
//---------------------------------------------------------------
vtkFloatingPointType*
using MED::SharedPtr;
using MED::TVector;
+
+ //---------------------------------------------------------------
+ class TStructuredId
+ {
+ vtkIdType myData[3];
+
+ public:
+ TStructuredId();
+
+ vtkIdType&
+ operator [] ( size_t theId );
+
+ const vtkIdType&
+ operator [] ( size_t theId ) const;
+
+ bool
+ operator == ( const TStructuredId& theId ) const;
+ };
+
+ typedef std::map<vtkIdType, TStructuredId> TObj2StructuredId;
+ typedef MED::SharedPtr<TObj2StructuredId> PObj2StructuredId;
- typedef TVector<vtkIdType> TIdTypeVector;
- typedef std::map<vtkIdType,TIdTypeVector> TObj2IdTypeVector;
+ struct TStructured;
+ typedef MED::SharedPtr<TStructured> PStructured;
struct VISU_CONVERTOR_EXPORT TStructured
{
TStructured():
myIsStructured(false),
- myType(true)
+ myIsPolarType(true)
{}
+ //! Copys all information which should be sinchronized between two instances
virtual
+ void
+ CopyStructure(PStructured theStructured);
+
bool
IsStructured() const;
* see also MED::TGrilleInfo::GetGrilleStructure
* see also MED::TGrilleInfo::GetNbIndexes
*/
- virtual TIdTypeVector
+ TStructuredId
GetStructure();
+ vtkIdType
+ GetStructureDim();
+
/*!
* Gets i,j,k by object id
* return -1, if not found
*/
- virtual TIdTypeVector
+ TStructuredId
GetIndexesOfNode(vtkIdType theNodeId);
/*!
* Gets object id by i,j,k
* return -1, if not found
*/
- virtual vtkIdType
- GetObjectIDByIndexes(TIdTypeVector theVec);
+ vtkIdType
+ GetObjectIDByIndexes(TStructuredId theVec);
- public:
bool myIsStructured; //!< To define mesh type (structured - true, non structured - false)
- bool myType; //!< To define structured mesh is polair
+ bool myIsPolarType; //!< To define structured mesh is polair
/*!provides grille structure for structured grid.
* Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ...
*/
- TIdTypeVector myGrilleStructure;
-
- TObj2IdTypeVector myObjID2StructureID;//!< map of object id to i,j,k ids of structured grid nodes
+ TStructuredId myGrilleStructure;
+ PObj2StructuredId myObj2StructuredId;//!< map of object id to i,j,k ids of structured grid nodes
};
//---------------------------------------------------------------
// Author : Alexey PETROV
// Module : VISU
-
#include "VISU_MedConvertor.hxx"
#include "VISU_ConvertorUtils.hxx"
aGauss->myGaussInfo = aGaussInfo;
aGauss->myName = aGaussInfo->GetName();
aGauss->myNbPoints = aGaussInfo->GetNbGauss();
- }
+ } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 )
+ EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()"
+ " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" );
aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints;
aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
}
}
-
- //---------------------------------------------------------------
- void
- InitGaussProfile(const MED::PWrapper& theMEDWrapper,
- const MED::PMeshInfo& theMeshInfo,
- MED::PTimeStampValueBase& theTimeStampValue,
- VISU::TMEDMeshOnEntity& theMeshOnEntity,
- MED::EEntiteMaillage theMEntity,
- const MED::TGeom2Size& theGeom2Size,
- VISU::TMEDValForTime& theValForTime)
- {
- VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
- INITMSG(MYDEBUG,"InitGaussProfile"<<std::endl);
-
- // The order of the function calls is important
- InitProfile(theMEDWrapper,
- theMeshInfo,
- theTimeStampValue,
- theMeshOnEntity,
- theMEntity,
- theGeom2Size,
- theValForTime);
-
- InitGaussMesh(theTimeStampValue,
- theMeshOnEntity,
- theGeom2Size,
- theValForTime);
- }
-
-
//---------------------------------------------------------------
void
BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- int iMax,jMax,kMax;
- iMax=jMax=kMax=0;
-
- MED::TIntVector aIntVec;
- if(theGrilleInfo->GetGrilleType()!=MED::eGRILLE_STANDARD)
- for(int i=0;i<theMesh->myDim;i++)
- aIntVec.push_back(theGrilleInfo->GetNbIndexes(i));
- else
- aIntVec = theGrilleInfo->GetGrilleStructure();
-
- theMesh->myGrilleStructure = aIntVec;
-
- switch((theMesh->GetStructure()).size()){
- case 3: kMax=theMesh->GetStructure()[2];
- case 2: jMax=theMesh->GetStructure()[1];
- case 1: iMax=theMesh->GetStructure()[0];
+ VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure;
+ if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD )
+ for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ )
+ aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId);
+ else {
+ MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure();
+ for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ )
+ aGrilleStructure[aDimId] = aVector[aDimId];
}
+
+ int kMax = aGrilleStructure[2];
+ int jMax = aGrilleStructure[1];
+ int iMax = aGrilleStructure[0];
- int iii=0;
- switch(theMesh->myDim){
+ int iii = 0;
+ VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId;
+ switch ( theMesh->myDim ) {
case 1:
- for(int i=1;i<=iMax;i++)
- (theMesh->myObjID2StructureID[i-1]).push_back(i);
+ for ( int i = 1; i <= iMax; i++ )
+ aObj2StructuredId[i-1][0] = i;
break;
case 2:
- for(int j=1;j<=jMax;j++)
- for(int i=1;i<=iMax;i++){
- (theMesh->myObjID2StructureID[iii]).push_back(i);
- (theMesh->myObjID2StructureID[iii]).push_back(j);
+ for ( int j = 1; j <= jMax; j++ )
+ for ( int i = 1; i <= iMax; i++ ) {
+ aObj2StructuredId[iii][0] = i;
+ aObj2StructuredId[iii][1] = j;
iii++;
}
break;
case 3:
- for(int k=1;k<=kMax ;k++)
- for(int j=1;j<=jMax;j++)
- for(int i=1;i<=iMax;i++)
- {
- (theMesh->myObjID2StructureID[iii]).push_back(i);
- (theMesh->myObjID2StructureID[iii]).push_back(j);
- (theMesh->myObjID2StructureID[iii]).push_back(k);
- iii++;
- }
+ for ( int k = 1; k <= kMax; k++ )
+ for ( int j = 1; j <= jMax; j++ )
+ for ( int i = 1; i <= iMax; i++ ) {
+ aObj2StructuredId[iii][0] = i;
+ aObj2StructuredId[iii][1] = j;
+ aObj2StructuredId[iii][2] = k;
+ iii++;
+ }
}
- //ENK: 23.11.2006
for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
aMesh->myEntityInfo = anEntityInfo;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
+
+ aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
aMesh->myIsStructured = true;
- aMesh->myType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
- //ENK: 23.11.2006
#ifndef _DEXCEPT_
try{
#endif
aMKey2Profile,
aKey2Gauss);
- InitGaussProfile(theMed,
- aMeshInfo,
- aTimeStampValue,
- theMeshOnEntity,
- aMEntity,
- aGeom2Size,
- theValForTime);
+ InitProfile(theMed,
+ aMeshInfo,
+ aTimeStampValue,
+ theMeshOnEntity,
+ aMEntity,
+ aGeom2Size,
+ theValForTime);
LoadProfile(theMed,
theMesh,
theValForTime,
theMeshOnEntity);
- if(theIsGauss)
+ if(theIsGauss) {
+ InitGaussMesh(aTimeStampValue,
+ theMeshOnEntity,
+ aGeom2Size,
+ theValForTime);
+
LoadGaussMesh(theMed,
theMesh,
aTimeStampValue,
theValForTime,
theMeshOnEntity);
+ }
VISU::PMEDProfile aProfile = theValForTime->myProfile;
VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
//---------------------------------------------------------------
-
-
TUnstructuredGridIDMapperImpl
::TUnstructuredGridIDMapperImpl():
myIsSpecialKey(false)
myStartID(0)
{}
+ void
+ TSubMeshImpl
+ ::CopyStructure( PStructured theStructured )
+ {
+ TStructured::CopyStructure( theStructured );
+
+ if ( PMeshImpl aMesh = theStructured )
+ GetSource()->ShallowCopy( aMesh->GetPointSet() );
+ }
+
vtkIdType
TSubMeshImpl
::GetElemObjID(vtkIdType theID) const
anAppendFilter->SetMappingInputs(true);
}
+ void
+ TMeshOnEntityImpl
+ ::CopyStructure( PStructured theStructured )
+ {
+ TStructured::CopyStructure( theStructured );
+
+ if ( PMeshImpl aMesh = theStructured )
+ myNamedPointCoords = aMesh->myNamedPointCoords;
+ }
+
vtkIdType
TMeshOnEntityImpl
::GetNodeVTKID(vtkIdType theID) const
}
//---------------------------------------------------------------
+ void
+ TFamilyImpl
+ ::CopyStructure( PStructured theStructured )
+ {
+ TStructured::CopyStructure( theStructured );
+
+ if ( PMeshImpl aMesh = theStructured ) {
+ myNamedPointCoords = aMesh->myNamedPointCoords;
+ GetSource()->ShallowCopy( aMesh->GetPointSet() );
+ }
+ }
+
vtkIdType
TFamilyImpl
::GetElemVTKID(vtkIdType theID) const
//---------------------------------------------------------------
+ void
+ TGroupImpl
+ ::CopyStructure( PStructured theStructured )
+ {
+ TStructured::CopyStructure( theStructured );
+
+ if ( PMeshImpl aMesh = theStructured )
+ myNamedPointCoords = aMesh->myNamedPointCoords;
+ }
+
TNbASizeCells
TGroupImpl
::GetNbASizeCells() const
{
TSubMeshImpl();
+ //! Reimplements the TStructured::CopyStructure
+ virtual
+ void
+ CopyStructure( PStructured theStructured );
+
//! To implement the TIDMapper::GetElemObjID
virtual
vtkIdType
{
TMeshOnEntityImpl();
+ //! Reimplements the TStructured::CopyStructure
+ virtual
+ void
+ CopyStructure( PStructured theStructured );
+
//! Reimplement the TIDMapper::GetNodeVTKID
virtual
vtkIdType
struct VISU_CONVERTOR_EXPORT TFamilyImpl: virtual TFamily,
virtual TUnstructuredGridHolder
{
+ //! Reimplements the TStructured::CopyStructure
+ virtual
+ void
+ CopyStructure( PStructured theStructured );
+
//! Reimplement the TIDMapper::GetNodeObjID
vtkIdType
GetNodeObjID(vtkIdType theID) const ;
struct VISU_CONVERTOR_EXPORT TGroupImpl: virtual TGroup,
virtual TAppendFilterHolder
{
+ //! Reimplements the TStructured::CopyStructure
+ virtual
+ void
+ CopyStructure( PStructured theStructured );
+
//! Calculate pair of values - number of cells and its size
TNbASizeCells
GetNbASizeCells() const;
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:
+// Author:
+// Module : VISU
+
+#include "VISU_TableReader.hxx"
+
+#include <QFileInfo>
+#include <QString>
+#include <QRegExp>
+#include <QFile>
+#include <QStringList>
+
+#include <fstream>
+#include <iostream>
+#include <strstream>
+
+#include <vtkPoints.h>
+#include <vtkDoubleArray.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPolyData.h>
+
+#include <vtkStructuredGrid.h>
+#include <vtkStructuredGridGeometryFilter.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//---------------------------------------------------------------
+int
+VISU::TTable2D
+::Check()
+{
+ if ( myRows.empty() )
+ return 0;
+
+ int iEnd = myRows[0].myValues.size();
+ if ( iEnd == 0 )
+ return 0;
+
+ if ( myColumnTitles.size() != iEnd )
+ myColumnTitles.resize( iEnd );
+
+ if ( myColumnUnits.size() != iEnd )
+ myColumnUnits.resize( iEnd );
+
+ int jEnd = myRows.size();
+ for ( int j = 0; j < jEnd; j++ )
+ if ( myRows[j].myValues.size() != iEnd )
+ return 0;
+
+ return 1;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::TTable2D
+::getColumns(VISU::TTable2D& theTable2D) const
+{
+ TRows& aRows = theTable2D.myRows;
+ aRows.clear();
+ if ( myRows.empty() )
+ return;
+
+ int jEnd = myRows.size();
+
+ //Define Titles & Units
+ theTable2D.myColumnTitles.resize(jEnd);
+ theTable2D.myColumnUnits.resize(jEnd);
+ for ( int j = 0; j < jEnd; j++ ) {
+ theTable2D.myColumnTitles[j] = myRows[j].myTitle;
+ theTable2D.myColumnUnits[j] = myRows[j].myUnit;
+ }
+
+ //Define Rows
+ int iEnd = myRows[0].myValues.size();
+ for ( int i = 0; i < iEnd; i++ ) {
+ TRow aNewRow;
+ aNewRow.myTitle = myColumnTitles[i];
+ aNewRow.myUnit = myColumnUnits[i];
+ aNewRow.myValues.resize(jEnd);
+ for ( int j = 0; j < jEnd; j++ ) {
+ aNewRow.myValues[j] = myRows[j].myValues[i];
+ }
+ aRows.push_back(aNewRow);
+ }
+}
+
+
+//---------------------------------------------------------------
+namespace
+{
+ int getLine( std::ifstream& theStmIn, QString& theString )
+ {
+ char tmp;
+ std::ostrstream aStrOut;
+
+ while ( theStmIn.get( tmp ) ) {
+ aStrOut<<tmp;
+ if ( tmp == '\n' )
+ break;
+ }
+
+ aStrOut<<std::ends;
+ theString = aStrOut.str();
+
+ return !theStmIn.eof();
+ }
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::ImportTables( const char* theFileName, TTableContainer& theContainer )
+{
+ std::ifstream aStmIn;
+ QFileInfo aFileInfo( theFileName );
+ if( !aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size() )
+ return;
+
+ aStmIn.open( theFileName );
+ QString aTmp;
+ do {
+ // find beginning of table (tables are separated by empty lines)
+ while( ::getLine( aStmIn, aTmp ) && aTmp.trimmed() == "");
+
+ PTableIDMapper aTableIDMapper( new TTableIDMapper() );
+ TTable2D& aTable2D = *aTableIDMapper;
+ if(MYDEBUG) std::cout << "New table is found" << std::endl;
+
+ while( !aStmIn.eof() && aTmp.trimmed() != "" ){
+ QString data = aTmp.trimmed();
+ QString cmt = "";
+ QString keyword = "";
+ // split string to data and comment (comment starts from '#' symbol)
+ int index = aTmp.indexOf( "#" );
+ if ( index >= 0 ) {
+ data = aTmp.left( index ).trimmed();
+ cmt = aTmp.mid( index+1 ).trimmed();
+ }
+ // if comment is not empty, try to get keyword from it (separated by ':' symbol)
+ if ( !cmt.isEmpty() ) {
+ int index1 = cmt.indexOf( ":" );
+ if ( index1 >= 0 ) {
+ QString tmpstr = cmt.left( index1 ).trimmed();
+ if ( tmpstr == QString( "TITLE" ) ||
+ tmpstr == QString( "COLUMN_TITLES" ) ||
+ tmpstr == QString( "COLUMN_UNITS" ) ||
+ tmpstr == QString( "COMMENT" ) ) {
+ keyword = tmpstr;
+ cmt = cmt.mid( index1+1 ).trimmed();
+ }
+ }
+ }
+ // if data is empty, process only comment
+ if ( data.isEmpty() ) {
+ // if keyword is found, try to process it
+ // elsewise it is a simple comment, just ignore it
+ if ( !keyword.isEmpty() ) {
+ if ( keyword == QString( "TITLE" ) ) {
+ QString title = cmt;
+ if ( aTable2D.myTitle != "" )
+ title = QString( aTable2D.myTitle.c_str() ) + QString( " " ) + title;
+ if(MYDEBUG) std::cout << "...Table TITLE is: " << title.toLatin1().constData() << std::endl;
+ aTable2D.myTitle = title.toLatin1().constData();
+ }
+ else if ( keyword == QString( "COLUMN_TITLES" ) ) {
+ // comment may contain column headers
+ QStringList aStrList = cmt.split( "|", QString::SkipEmptyParts );
+ if(MYDEBUG) std::cout << "...Column TITLES are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].trimmed();
+ if(MYDEBUG) std::cout << tmpstr.toLatin1().constData() << " ";
+ aTable2D.myColumnTitles.push_back( tmpstr.toLatin1().constData() );
+ }
+ if(MYDEBUG) std::cout << std::endl;
+ }
+ else if ( keyword == QString( "COLUMN_UNITS" ) ) {
+ // comment may contain column units
+ QStringList aStrList = cmt.split( " ", QString::SkipEmptyParts );
+ if(MYDEBUG) std::cout << "...Column UNITS are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].trimmed();
+ if(MYDEBUG) std::cout << tmpstr.toLatin1().constData() << " ";
+ aTable2D.myColumnUnits.push_back( tmpstr.toLatin1().constData() );
+ }
+ if(MYDEBUG) std::cout << std::endl;
+ }
+ else if ( keyword == QString( "COMMENT" ) ) {
+ // keyword 'COMMENT' processing can be here
+ // currently it is ignored
+ if(MYDEBUG) std::cout << "...COMMENT: " << cmt.toLatin1().constData() << std::endl;
+ }
+ }
+ else {
+ if(MYDEBUG) std::cout << "...comment: " << cmt.toLatin1().constData() << std::endl;
+ // simple comment processing can be here
+ // currently it is ignored
+ }
+ }
+ // if data is not empty, try to process it
+ else {
+ TTable2D::TRow aRow;
+ if(MYDEBUG) std::cout << "...New row is found: " << std::endl;
+ if ( !cmt.isEmpty() ) {
+ aRow.myTitle = cmt.toLatin1().constData();
+ if(MYDEBUG) std::cout << "......ROW TITLE is: " << cmt.toLatin1().constData() << std::endl;
+ }
+ QString datar1 = data.replace(QRegExp("\t"), " ");
+ QStringList aValList = datar1.split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < aValList.count(); i++ ) {
+ if ( aValList[i].trimmed() != "" ) {
+ TTable2D::TValue aVal = aValList[i].trimmed().toLatin1().constData();
+ aRow.myValues.push_back( aVal );
+ }
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ // ************** OLD CODE ******************
+ /*
+ TValue aVal;
+ istrstream aStream( data );
+ aStream.precision( STRPRECISION );
+ while( aStream >> aVal ) {
+ aRow.myValues.push_back( aVal );
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ */
+ // ************** OLD CODE ******************
+ }
+ ::getLine( aStmIn, aTmp );
+ }
+ if( aTable2D.Check() ) {
+ if(MYDEBUG) std::cout << "aTable2D is checked OK " << aTable2D.myTitle << std::endl;
+ theContainer.push_back( aTableIDMapper );
+ }
+ } while ( !aStmIn.eof() );
+ aStmIn.close();
+
+ if(MYDEBUG) std::cout << "After close" << std::endl;
+}
+
+
+//---------------------------------------------------------------
+VISU::TTableIDMapper
+::TTableIDMapper():
+ myOutput( vtkPolyData::New() ),
+ myXAxisPosition( -1 )
+{}
+
+VISU::TTableIDMapper
+::~TTableIDMapper()
+{
+ myOutput->Delete();
+}
+
+vtkPolyData*
+VISU::TTableIDMapper
+::GetPolyDataOutput()
+{
+ if ( myXAxisPosition == -1 )
+ SetXAxisPosition( 0 );
+
+ return myOutput;
+}
+
+long unsigned int
+VISU::TTableIDMapper
+::GetMemorySize()
+{
+ return myOutput->GetActualMemorySize() * 1024;
+}
+
+void
+VISU::TTableIDMapper
+::SetXAxisPosition( vtkIdType theAxisPosition )
+{
+ if ( myXAxisPosition == theAxisPosition || !Check() )
+ return;
+
+ myOutput->Initialize();
+
+ if ( !Check() )
+ return;
+
+ TTable2D aTable2D;
+ getColumns( aTable2D );
+
+ vtkIdType aXSize = aTable2D.myRows[0].myValues.size();
+
+ // It is necessary to decrease the size at 1 take intoa account X axis
+ vtkIdType anYSize = aTable2D.myRows.size() - 1;
+
+ vtkIdType aNbPoints = aXSize * anYSize;
+
+ std::vector<double> anXAxis(aXSize);
+ const TTable2D::TValues& aValues = aTable2D.myRows[theAxisPosition].myValues;
+ for ( vtkIdType aX = 0; aX < aXSize; aX++ )
+ anXAxis[aX] = atof( aValues[aX].c_str() );
+
+ double aXRange = anXAxis[aXSize - 1] - anXAxis[0];
+ double anYDelta = aXRange / anYSize;
+ std::vector<double> anYAxis(anYSize);
+ for ( vtkIdType anY = 0; anY < anYSize; anY++ )
+ anYAxis[anY] = anY * anYDelta;
+
+ vtkPoints* aPoints = vtkPoints::New();
+ aPoints->SetNumberOfPoints( aNbPoints );
+
+ vtkIntArray *aPointsIDMapper = vtkIntArray::New();
+ aPointsIDMapper->SetName("VISU_POINTS_MAPPER");
+ aPointsIDMapper->SetNumberOfComponents(2);
+ aPointsIDMapper->SetNumberOfTuples(aNbPoints);
+ int *aPointsIDMapperPtr = aPointsIDMapper->GetPointer(0);
+
+ //vtkIntArray *aCellIDMapper = vtkIntArray::New();
+ //aCellIDMapper->SetName("VISU_POINTS_MAPPER");
+ //aCellIDMapper->SetNumberOfComponents(2);
+ //aCellIDMapper->SetNumberOfTuples(aNbPoints);
+ //int *aCellIDMapperPtr = aCellIDMapper->GetPointer(0);
+
+ for ( vtkIdType aY = 0, aPntId = 0; aY < anYSize; aY++ ) {
+ for ( vtkIdType aX = 0; aX < aXSize; aX++, aPntId++ ) {
+ aPoints->SetPoint( aPntId, anXAxis[aX], anYAxis[aY], 0.0 );
+
+ *aPointsIDMapperPtr++ = aPntId;
+ *aPointsIDMapperPtr++ = 0;
+
+ //*aCellIDMapperPtr++ = aPntId;
+ //*aCellIDMapperPtr++ = 0;
+ }
+ }
+
+ std::vector<TValues> anYData;
+ for ( vtkIdType anY = 0; anY < anYSize + 1; anY++ ) {
+ if ( anY == theAxisPosition )
+ continue;
+ anYData.push_back( aTable2D.myRows[anY].myValues );
+ }
+
+ vtkDoubleArray* aScalars = vtkDoubleArray::New();
+ aScalars->SetNumberOfComponents( 1 );
+ aScalars->SetNumberOfTuples( aNbPoints );
+ double *aScalarsPtr = aScalars->GetPointer(0);
+ for ( vtkIdType anY = 0; anY < anYSize; anY++ ) {
+ const TTable2D::TValues& aValues = anYData[anY];
+ for ( vtkIdType aX = 0; aX < aXSize; aX++ ) {
+ double aValue = atof( aValues[aX].c_str() );
+ *aScalarsPtr++ = aValue;
+ }
+ }
+
+ vtkStructuredGrid* aStructuredGrid = vtkStructuredGrid::New();
+ aStructuredGrid->SetPoints( aPoints );
+ aPoints->Delete();
+
+ aStructuredGrid->SetDimensions( aXSize, anYSize, 1 );
+
+ aStructuredGrid->GetPointData()->AddArray( aPointsIDMapper );
+ aPointsIDMapper->Delete();
+
+ //aStructuredGrid->GetCellData()->AddArray( aCellIDMapper );
+ //aCellIDMapper->Delete();
+
+ aStructuredGrid->GetPointData()->SetScalars( aScalars );
+ aScalars->Delete();
+
+ vtkStructuredGridGeometryFilter* aFilter = vtkStructuredGridGeometryFilter::New();
+ aFilter->SetInput( aStructuredGrid );
+ aFilter->Update();
+ myOutput->ShallowCopy( aFilter->GetOutput() );
+ aFilter->Delete();
+}
--- /dev/null
+// VISU CONVERTOR :
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : VISU_TableReader.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_TableReader_HeaderFile
+#define VISU_TableReader_HeaderFile
+
+/*!
+ \file VISU_TableReader.hxx
+ \brief The file contains definition of the Table reading functionlity
+*/
+
+#include "VISUConvertor.hxx"
+
+#include "VISU_IDMapper.hxx"
+
+#include <string>
+#include <vector>
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ struct VISU_CONVERTOR_EXPORT TTable2D
+ {
+ typedef std::string TValue;
+ typedef std::vector<TValue> TValues;
+
+ struct TRow
+ {
+ std::string myTitle;
+ std::string myUnit;
+ TValues myValues;
+ };
+
+ std::string myTitle;
+ std::vector<std::string> myColumnUnits;
+ std::vector<std::string> myColumnTitles;
+
+ typedef std::vector<TRow> TRows;
+ TRows myRows;
+
+ int
+ Check();
+
+ void
+ getColumns( TTable2D& theTable2D ) const;
+ };
+
+
+ //---------------------------------------------------------------
+ class VISU_CONVERTOR_EXPORT TTableIDMapper:
+ public virtual TPolyDataIDMapper,
+ public virtual TTable2D
+ {
+ public:
+ TTableIDMapper();
+ ~TTableIDMapper();
+
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ virtual
+ long unsigned int
+ GetMemorySize();
+
+ void
+ SetXAxisPosition( vtkIdType theAxisPosition );
+
+ vtkIdType
+ GetXAxisPosition();
+
+ protected:
+ vtkIdType myXAxisPosition;
+ vtkPolyData* myOutput;
+ };
+ typedef MED::SharedPtr<TTableIDMapper> PTableIDMapper;
+
+
+ //---------------------------------------------------------------
+ typedef std::vector<PTableIDMapper> TTableContainer;
+ void ImportTables( const char* theFileName, TTableContainer& theContainer );
+
+
+ //---------------------------------------------------------------
+}
+
+#endif
VISU_MeshAct.h \
VISU_ScalarMapAct.h \
VISU_GaussPtsAct.h \
- VISU_VectorsAct.h
+ VISU_VectorsAct.h \
+ VISU_PointMap3dActor.h \
+ VISU_ActorBase.h
dist_libVisuObject_la_SOURCES = \
VISU_Actor.cxx \
VISU_GaussPtsDeviceActor.cxx \
VISU_GaussPtsSettings.cxx \
VISU_GaussPtsAct.cxx \
- VISU_VectorsAct.cxx
+ VISU_VectorsAct.cxx \
+ VISU_PointMap3dActor.cxx \
+ VISU_ActorBase.cxx
libVisuObject_la_CPPFLAGS= \
$(QT_INCLUDES) \
#include "VISU_PipeLine.hxx"
#include "VTKViewer_ShrinkFilter.h"
#include "VTKViewer_GeometryFilter.h"
+#include "VISU_ActorFactory.h"
#include "SALOME_InteractiveObject.hxx"
#include <stdexcept>
::VISU_Actor():
myIsVTKMapping(false),
myPrs3d(NULL),
- myActorFactory(NULL),
myIsShrunk(false),
myIsShrinkable(false),
myShrinkFilter(VTKViewer_ShrinkFilter::New()),
}
//----------------------------------------------------------------------------
-VISU::TActorFactory*
+/*VISU::TActorFactory*
VISU_Actor
::GetFactory()
{
return myActorFactory;
-}
+}*/
-void
+/*void
VISU_Actor
::SetFactory(VISU::TActorFactory* theActorFactory)
{
_1));
myActorFactory = theActorFactory;
-}
+}*/
//----------------------------------------------------------------------------
-void
+/*void
VISU_Actor
::UpdateFromFactory()
{
myActorFactory->UpdateActor(this);
Update();
}
-}
+}*/
void
VISU_Actor
#define VISU_ACTOR_H
#include "SALOME_Actor.h"
-#include "VISU_ActorFactory.h"
+#include "VISU_ActorBase.h"
#include "VISU_BoostSignals.h"
#include "SVTK_DeviceActor.h"
}
//----------------------------------------------------------------------------
-class VTKOCC_EXPORT VISU_Actor :
- public SALOME_Actor,
- public boost::signalslib::trackable
+class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase
{
public:
- vtkTypeMacro(VISU_Actor,SALOME_Actor);
+ vtkTypeMacro(VISU_Actor, VISU_ActorBase);
//static
//VISU_Actor*
void
SetPrs3d(VISU::Prs3d_i* thePrs3d);
- //----------------------------------------------------------------------------
- VISU::TActorFactory*
- GetFactory();
-
- virtual
- void
- SetFactory(VISU::TActorFactory* theActorFactory);
-
- //----------------------------------------------------------------------------
- virtual
- void
- UpdateFromFactory();
-
virtual
void
RemoveFromRender();
VISU::Prs3d_i* myPrs3d;
vtkSmartPointer<VISU_PipeLine> myPipeLine;
- VISU::TActorFactory* myActorFactory;
- vtkTimeStamp myUpdateFromFactoryTime;
- boost::signal1<void,VISU_Actor*> myDestroySignal;
-
vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
bool myIsShrinkable;
bool myIsShrunk;
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File :
+// Author :
+// Module : VISU
+// $Header$
+
+#include "VISU_ActorBase.h"
+#include "VISU_ActorFactory.h"
+
+#include <vtkObjectFactory.h>
+#include <boost/bind.hpp>
+
+VISU_ActorBase
+::VISU_ActorBase()
+{
+
+}
+
+VISU_ActorBase
+::~VISU_ActorBase()
+{
+
+}
+
+//----------------------------------------------------------------------------
+VISU::TActorFactory*
+VISU_ActorBase
+::GetFactory()
+{
+ return myActorFactory;
+}
+
+void
+VISU_ActorBase
+::SetFactory(VISU::TActorFactory* theActorFactory)
+{
+ using namespace VISU;
+
+ if(myActorFactory == theActorFactory)
+ return;
+
+ if(theActorFactory)
+ myDestroySignal.connect(boost::bind(&TActorFactory::RemoveActor,
+ theActorFactory,
+ _1));
+
+ myActorFactory = theActorFactory;
+}
+
+void
+VISU_ActorBase
+::UpdateFromFactory()
+{
+ if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){
+ myUpdateFromFactoryTime.Modified();
+ myActorFactory->UpdateActor(this);
+ Update();
+ }
+}
+
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File :
+// Author :
+// Module : VISU
+// $Header$
+
+#ifndef VISU_ACTOR_BASE_H
+#define VISU_ACTOR_BASE_H
+
+#include "SALOME_Actor.h"
+#include "VISU_BoostSignals.h"
+
+#ifdef _WIN32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT VTK_EXPORT
+#endif
+
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TActorFactory;
+}
+
+
+//! This class defines an abstaract interface to manage actors
+class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor,
+ public boost::signalslib::trackable
+{
+ public:
+ vtkTypeMacro(VISU_ActorBase, SALOME_Actor);
+
+ //----------------------------------------------------------------------------
+ VISU::TActorFactory*
+ GetFactory();
+
+ virtual
+ void
+ SetFactory(VISU::TActorFactory* theActorFactory);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ UpdateFromFactory();
+
+ protected:
+ VISU_ActorBase();
+ virtual ~VISU_ActorBase();
+
+ VISU::TActorFactory* myActorFactory;
+ vtkTimeStamp myUpdateFromFactoryTime;
+ boost::signal1<void,VISU_ActorBase*> myDestroySignal;
+};
+
+#endif //VISU_ACTOR_BASE_H
#define VISU_ACTOR_FACTORY_H
#include "VISU_BoostSignals.h"
+#include "VISU_ActorBase.h"
-class VISU_Actor;
+class VISU_ActorBase;
//----------------------------------------------------------------------------
namespace VISU
//! To update the actor
virtual
void
- UpdateActor(VISU_Actor* theActor) = 0;
+ UpdateActor(VISU_ActorBase* theActor) = 0;
//! To unregister the actor
virtual
void
- RemoveActor(VISU_Actor* theActor) = 0;
+ RemoveActor(VISU_ActorBase* theActor) = 0;
};
}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File :
+// Author :
+// Module : VISU
+// $Header$
+
+#include "VISU_PointMap3dActor.h"
+#include "VISU_PipeLine.hxx"
+#include "VISU_ScalarBarActor.hxx"
+#include "VISU_DeformedGridPL.hxx"
+
+#include <SALOME_InteractiveObject.hxx>
+
+#include <vtkRenderer.h>
+#include <vtkObjectFactory.h>
+
+//using namespace std;
+vtkStandardNewMacro(VISU_PointMap3dActor);
+
+//==================================================================
+// function: Constructor
+// purpose :
+//==================================================================
+
+VISU_PointMap3dActor
+::VISU_PointMap3dActor()
+{
+ myScalarBar = VISU_ScalarBarActor::New();
+}
+
+//==================================================================
+// function: Destructor
+// purpose :
+//==================================================================
+
+VISU_PointMap3dActor
+::~VISU_PointMap3dActor()
+{
+ myScalarBar->Delete();
+}
+
+//==================================================================
+// function: AddToRender
+// purpose :
+//==================================================================
+void
+VISU_PointMap3dActor
+::AddToRender(vtkRenderer* theRenderer)
+{
+ Superclass::AddToRender(theRenderer);
+ theRenderer->AddActor2D(myScalarBar);
+}
+
+void
+VISU_PointMap3dActor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+ if(myScalarBar)
+ theRenderer->RemoveActor(myScalarBar);
+
+ Superclass::RemoveFromRender(theRenderer);
+}
+
+//==================================================================
+// function: Set & Get PipeLine
+// purpose :
+//==================================================================
+void
+VISU_PointMap3dActor
+::SetPipeLine(VISU_DeformedGridPL* thePipeLine)
+{
+ myPipeLine = thePipeLine;
+ SetMapper(thePipeLine->GetMapper());
+ myScalarBar->SetLookupTable(thePipeLine->GetBarTable());
+}
+
+VISU_DeformedGridPL*
+VISU_PointMap3dActor
+::GetPipeLine()
+{
+ return myPipeLine.GetPointer();
+}
+
+//==================================================================
+// function: Visibility
+// purpose :
+//==================================================================
+
+void
+VISU_PointMap3dActor
+::SetVisibility(int theMode)
+{
+ Superclass::SetVisibility( theMode );
+
+ // myPointsActor->SetVisibility( theMode );
+
+ if(myScalarBar)
+ myScalarBar->SetVisibility(theMode);
+}
+
+VISU_ScalarBarActor*
+VISU_PointMap3dActor
+::GetScalarBar()
+{
+ return myScalarBar;
+}
+
+//==================================================================
+// function: SetIO
+// purpose :
+//==================================================================
+
+void
+VISU_PointMap3dActor
+::setIO(const Handle(SALOME_InteractiveObject)& theIO)
+{
+ Superclass::setIO(theIO);
+ myName = theIO->getName();
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VISU_PointMap3dActor.h
+// Author : Dmitry MATVEICHEV with help of Alexey PETROV
+// Module : VISU
+// $Header$
+
+#ifndef VISU_PointMap3dActor_HeaderFile
+#define VISU_PointMap3dActor_HeaderFile
+
+#include "SALOME_Actor.h"
+#include "VISU_DataSetActor.h"
+#include "VISU_BoostSignals.h"
+
+class VISU_ScalarBarActor;
+
+#ifdef _WIN32
+#define VTKOCC_EXPORT __declspec (dllexport)
+#else
+#define VTKOCC_EXPORT VTK_EXPORT
+#endif
+
+class VISU_DeformedGridPL;
+
+class VTKOCC_EXPORT VISU_PointMap3dActor : public VISU_ActorBase
+{
+ public:
+ vtkTypeMacro(VISU_PointMap3dActor,SALOME_Actor);
+
+ static
+ VISU_PointMap3dActor*
+ New();
+
+ ~VISU_PointMap3dActor();
+
+//----------------------------------------------------------------------------
+ virtual
+ void
+ AddToRender( vtkRenderer* );
+
+ virtual
+ void
+ RemoveFromRender( vtkRenderer* );
+
+ virtual
+ void
+ SetVisibility(int theMode);
+
+ virtual
+ VISU_ScalarBarActor*
+ GetScalarBar();
+
+//----------------------------------------------------------------------------
+ virtual
+ void
+ setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+//----------------------------------------------------------------------------
+ virtual
+ VISU_DeformedGridPL*
+ GetPipeLine();
+
+ virtual
+ void
+ SetPipeLine(VISU_DeformedGridPL* thePipeLine);
+
+ protected:
+ VISU_PointMap3dActor();
+ vtkSmartPointer<VISU_DeformedGridPL> myPipeLine;
+
+ VISU_ScalarBarActor* myScalarBar;
+};
+
+#endif
VISU_PipeLineUtils.hxx \
VISU_PipeLine.hxx \
VISU_ColoredPL.hxx \
+ VISU_MergedPL.hxx \
VISU_UnstructuredGridPL.hxx \
VISU_MeshPL.hxx \
VISU_ScalarMapPL.hxx \
VISU_Extractor.hxx \
VISU_FieldTransform.hxx \
VISU_MaskPointsFilter.hxx \
+ VISU_PolyDataPL.hxx \
VISU_GaussPointsPL.hxx \
VISU_Plot3DPL.hxx \
+ VISU_DeformedGridPL.hxx \
VISU_OpenGLPointSpriteMapper.hxx \
VISU_ImplicitFunctionWidget.hxx \
SALOME_ExtractGeometry.h \
VISU_PipeLineUtils.cxx \
VISU_PipeLine.cxx \
VISU_ColoredPL.cxx \
+ VISU_MergedPL.cxx \
VISU_UnstructuredGridPL.cxx \
VISU_MeshPL.cxx \
VISU_ScalarMapPL.cxx \
VISU_Extractor.cxx \
VISU_FieldTransform.cxx \
VISU_MaskPointsFilter.cxx \
+ VISU_PolyDataPL.cxx \
VISU_GaussPointsPL.cxx \
VISU_Plot3DPL.cxx \
+ VISU_DeformedGridPL.cxx \
SALOME_ExtractGeometry.cxx \
SALOME_ExtractPolyDataGeometry.cxx \
VISU_OpenGLPointSpriteMapper.cxx \
libVisuPipeLine_la_CPPFLAGS= \
$(VTK_INCLUDES) \
+ $(QT_INCLUDES) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(MED_CXXFLAGS) \
$(GUI_LDFLAGS) \
$(MED_LDFLAGS) \
../CONVERTOR/libVisuConvertor.la \
- $(VTK_LIBS) -lVTKViewer
+ $(VTK_LIBS) -lVTKViewer \
+ $(MED2_LIBS) \
+ $(QT_LIBS)
# Executables targets
#include "VISU_Plot3DPL.hxx"
#include "VISU_ScalarBarActor.hxx"
+#include "VISU_DeformedGridPL.hxx"
+
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VTKViewer_GeometryFilter.h"
#include <vtkMaskPoints.h>
#include "VISU_Convertor.hxx"
+#include "VISU_TableReader.hxx"
#include "VISU_ConvertorUtils.hxx"
-typedef VISU_GaussPointsPL TPresent;
+typedef VISU_StreamLinesPL TPresent;
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkProperty.h>
-static int isOnlyMesh = false;
+#include <QFileInfo>
+
+#include <memory>
//#define _DEBUG_ID_MAPPING_
}
+//----------------------------------------------------------------------------
+struct TMEDSource
+{
+ std::auto_ptr<VISU_Convertor> myConvertor;
+
+ TMEDSource(char** argv): myConvertor(CreateConvertor(argv[1]))
+ {
+ myConvertor->BuildEntities();
+ }
+};
+
+
+//----------------------------------------------------------------------------
+struct TMeshBulder: TMEDSource
+{
+ TMeshBulder(char** argv): TMEDSource(argv)
+ {}
+
+ int Publish(vtkRenderer *theRenderer) const
+ {
+ const VISU::TMeshMap& aMeshMap = myConvertor->GetMeshMap();
+ VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ if(aMeshMapIter == aMeshMap.end())
+ return 0;
+
+ const std::string& aMeshName = aMeshMapIter->first;
+ const VISU::PMesh aMesh = aMeshMapIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+
+ VISU::TEntity anEntity = VISU::CELL_ENTITY;
+ aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
+
+ VISU::PNamedIDMapper anIDMapper = myConvertor->GetMeshOnEntity(aMeshName, anEntity);
+
+ VISU_MeshPL* aPresent = VISU_MeshPL::New();
+ aPresent->SetUnstructuredGridIDMapper(anIDMapper);
+
+ vtkActor* anActor = vtkActor::New();
+ anActor->SetMapper(aPresent->GetMapper());
+ anActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
+
+ theRenderer->AddActor(anActor);
+ anActor->Delete();
+
+ return 0;
+ }
+};
+
+
+//----------------------------------------------------------------------------
+struct TColoredPrsBulder: TMEDSource
+{
+ TColoredPrsBulder(char** argv): TMEDSource(argv)
+ {}
+
+ int Publish(vtkRenderer *theRenderer) const
+ {
+ myConvertor->BuildGroups();
+ myConvertor->BuildFields();
+ myConvertor->BuildMinMax();
+ const VISU::TMeshMap& aMeshMap = myConvertor->GetMeshMap();
+ VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
+ if(aMeshMapIter == aMeshMap.end())
+ return 0;
+
+ const std::string& aMeshName = aMeshMapIter->first;
+ const VISU::PMesh aMesh = aMeshMapIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+
+ //Import fields
+ 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++){
+ const VISU::PField aField = aFieldMapIter->second;
+ //if(aField->myNbComp == 1)
+ // continue;
+ const std::string& aFieldName = aFieldMapIter->first;
+ const VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_reverse_iterator aValFieldIter = aValField.rbegin();
+ if(aValFieldIter == aValField.rend())
+ return 0;
+
+ int aTimeStamp = aValFieldIter->first;
+
+ VISU_ColoredPL* aPresent = NULL;
+ if(anEntity != VISU::NODE_ENTITY){
+ aPresent = CreateColoredPL<TPresent>(myConvertor.get(),
+ aMeshName,
+ anEntity,
+ aFieldName,
+ aTimeStamp);
+
+ }else{
+ continue;
+ aPresent = CreateColoredPL<TPresent>(myConvertor.get(),
+ aMeshName,
+ anEntity,
+ aFieldName,
+ aTimeStamp);
+ }
+
+ vtkActor* anActor = vtkActor::New();
+ anActor->SetMapper(aPresent->GetMapper());
+
+ VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
+ aScalarBar->SetLookupTable(aPresent->GetBarTable());
+
+ theRenderer->AddActor(anActor);
+ anActor->Delete();
+
+ theRenderer->AddActor2D(aScalarBar);
+ aScalarBar->Delete();
+ }
+ }
+ return 0;
+ }
+};
+
+
+//----------------------------------------------------------------------------
+struct TXLSSource
+{
+ VISU::TTableContainer myContainer;
+
+ TXLSSource(char** argv)
+ {
+ VISU::ImportTables( argv[1], myContainer );
+ }
+
+ int Publish(vtkRenderer *theRenderer) const
+ {
+ if ( myContainer.empty() )
+ return 0;
+
+ VISU::PPolyDataIDMapper anIDMapper = myContainer[0];
+
+ VISU_DeformedGridPL* aPresent = VISU_DeformedGridPL::New();
+ aPresent->SetPolyDataIDMapper(anIDMapper);
+ //aPresent->SetContourPrs( true );
+ aPresent->Update();
+
+ vtkActor* anActor = vtkActor::New();
+ anActor->SetMapper(aPresent->GetMapper());
+
+ theRenderer->AddActor(anActor);
+ anActor->Delete();
+
+ VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
+ aScalarBar->SetLookupTable(aPresent->GetBarTable());
+
+ theRenderer->AddActor2D(aScalarBar);
+ aScalarBar->Delete();
+
+ return 0;
+ }
+};
+
+
+//----------------------------------------------------------------------------
+template<class TPrsBuilder>
+int RenderPresentation(const TPrsBuilder& thePrsBuilder)
+{
+ vtkRenderWindow *aWindow = vtkRenderWindow::New();
+ vtkRenderer *aRenderer = vtkRenderer::New();
+
+ aWindow->AddRenderer(aRenderer);
+ aRenderer->GetActiveCamera()->ParallelProjectionOn();
+
+ vtkRenderWindowInteractor *anInteractor = vtkRenderWindowInteractor::New();
+ anInteractor->SetRenderWindow(aWindow);
+ aWindow->Delete();
+
+ vtkInteractorStyle* aStyle = vtkInteractorStyleTrackballCamera::New();
+ anInteractor->SetInteractorStyle(aStyle);
+ aStyle->Delete();
+
+ int aRet = thePrsBuilder.Publish(aRenderer);
+
+ aWindow->Render();
+ anInteractor->Start();
+
+ return aRet;
+}
+
+
//----------------------------------------------------------------------------
int
main(int argc, char** argv)
{
try{
- if(argc > 1){
- vtkRenderWindow *aWindow = vtkRenderWindow::New();
- vtkRenderer *aRenderer = vtkRenderer::New();
-
- aWindow->AddRenderer(aRenderer);
- aRenderer->GetActiveCamera()->ParallelProjectionOn();
-
- vtkRenderWindowInteractor *anInteractor = vtkRenderWindowInteractor::New();
- anInteractor->SetRenderWindow(aWindow);
- aWindow->Delete();
-
- vtkInteractorStyle* aStyle = vtkInteractorStyleTrackballCamera::New();
- anInteractor->SetInteractorStyle(aStyle);
- aStyle->Delete();
-
- VISU_Convertor* aConvertor = CreateConvertor(argv[1]);
- aConvertor->BuildEntities();
- aConvertor->BuildGroups();
- aConvertor->BuildFields();
- aConvertor->BuildMinMax();
- const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap();
- VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
- if(aMeshMapIter == aMeshMap.end()) return 0;
- const std::string& aMeshName = aMeshMapIter->first;
- const VISU::PMesh aMesh = aMeshMapIter->second;
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
- if(isOnlyMesh){
- const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
- aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
-
- VISU::PNamedIDMapper anIDMapper =
- aConvertor->GetMeshOnEntity(aMeshName,anEntity);
-
- VISU_MeshPL* aPresent = VISU_MeshPL::New();
- aPresent->SetUnstructuredGridIDMapper(anIDMapper);
-
- vtkActor* aActor = vtkActor::New();
- aActor->SetMapper(aPresent->GetMapper());
- aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
- //aRenderer->ResetCameraClippingRange();
-
- aRenderer->AddActor(aActor);
-
- aWindow->Render();
- anInteractor->Start();
- return 0;
- }
- //Import fields
- 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++){
- const VISU::PField aField = aFieldMapIter->second;
-// if(aField->myNbComp == 1)
-// continue;
- const std::string& aFieldName = aFieldMapIter->first;
- const VISU::TValField& aValField = aField->myValField;
- VISU::TValField::const_iterator aValFieldIter = aValField.begin();
- if(aValFieldIter == aValField.end()) return 0;
- int aTimeStamp = aValFieldIter->first;
-
- vtkActor* anActor = vtkActor::New();
- VISU_ColoredPL* aPresent = NULL;
- if(anEntity != VISU::NODE_ENTITY){
- aPresent = CreateColoredPL<TPresent>(aConvertor,
- aMeshName,
- anEntity,
- aFieldName,
- aTimeStamp);
-
- anActor->SetMapper(aPresent->GetMapper());
- }else{
- continue;
- aPresent = CreateColoredPL<TPresent>(aConvertor,
- aMeshName,
- anEntity,
- aFieldName,
- aTimeStamp);
-
- VTKViewer_GeometryFilter* aGeometryFilter = VTKViewer_GeometryFilter::New();
- aGeometryFilter->SetInput(aPresent->GetOutput());
- aGeometryFilter->SetInside(true);
-
- vtkMaskPoints* aMaskPoints = vtkMaskPoints::New();
- aMaskPoints->SetInput(aGeometryFilter->GetOutput());
- aMaskPoints->SetGenerateVertices(true);
- aMaskPoints->SetOnRatio(1);
-
- VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New();
- aMapper->SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( aPresent->GetOutput() ) );
-
- char aMainTexture[80];
- strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
-
- char anAlphaTexture[80];
- strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
-
- vtkSmartPointer<vtkImageData> aTextureValue =
- VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
- aMapper->SetImageData( aTextureValue.GetPointer() );
-
- //vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
- aMapper->SetLookupTable(aPresent->GetMapperTable());
- aMapper->SetUseLookupTableScalarRange(true);
- aMapper->SetColorModeToMapScalars();
- aMapper->SetScalarVisibility(true);
-
- aMapper->SetInput(aMaskPoints->GetOutput());
- aGeometryFilter->Delete();
-
- anActor->SetMapper(aMapper);
- aMapper->Delete();
- }
-
- VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
- aScalarBar->SetLookupTable(aPresent->GetBarTable());
-
- aRenderer->AddActor(anActor);
- aRenderer->AddActor2D(aScalarBar);
-
- aWindow->Render();
- aRenderer->ResetCamera();
-
- anInteractor->Start();
- return 0;
- }
+ if (argc > 1) {
+ QFileInfo aFileInfo( argv[1] );
+ if ( aFileInfo.isFile() ) {
+ QString anExtension = aFileInfo.suffix();
+ if ( anExtension == "med" ) {
+ //TMeshBulder aBuilder( argv );
+ TColoredPrsBulder aBuilder( argv );
+ return RenderPresentation( aBuilder );
+ } else if ( anExtension == "xls" || anExtension == "txt" )
+ return RenderPresentation( TXLSSource( argv ) );
}
}
}catch(std::exception& exc){
MSG(true, "Follow exception was occured :\n"<<exc.what());
}catch(...){
- MSG(true, "Unknown exception was occured in VISU_Convertor_impl");
+ MSG(true, "Unknown exception was occured!");
}
return 1;
}
SetNbColors(aPipeLine->GetNbColors());
SetScaling(aPipeLine->GetScaling());
SetMapScale(aPipeLine->GetMapScale());
- if(this != thePipeLine){
- if(aPipeLine->IsExternalGeometryUsed()){
- ClearGeometry();
- int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
- for(int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++)
- AddGeometry(aPipeLine->GetGeometry(aGeomNumber));
- }else
- SetSourceGeometry();
- }
}
}
void
SetSourceRange();
-public:
-
- virtual
- void
- SetSourceGeometry()=0;
-
- virtual
- int
- AddGeometry(vtkDataSet* theGeometry)=0;
-
- virtual
- vtkDataSet*
- GetGeometry(int theGeomNumber)=0;
-
- virtual
- int
- GetNumberOfGeometry()=0;
-
- virtual
- bool
- IsExternalGeometryUsed()=0;
-
- virtual
- void
- ClearGeometry()=0;
-
- virtual
- vtkPointSet*
- GetMergedInput()=0;
-
protected:
//----------------------------------------------------------------------------
VISU_ColoredPL();
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_DeformedGridPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_DeformedGridPL.hxx"
+#include "VISU_FieldTransform.hxx"
+#include "VISU_Plot3DPL.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkContourFilter.h>
+#include <vtkWarpScalar.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DeformedGridPL);
+
+
+//----------------------------------------------------------------------------
+VISU_DeformedGridPL
+::VISU_DeformedGridPL():
+ myContourFilter(vtkContourFilter::New()),
+ myWarpScalar(vtkWarpScalar::New()),
+ myIsContour(false),
+ myScaleFactor(1.0)
+{
+ SetIsShrinkable(false);
+ SetNumberOfContours(32);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DeformedGridPL
+::~VISU_DeformedGridPL()
+{}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedGridPL
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ aTime = std::max(aTime, myContourFilter->GetMTime());
+ aTime = std::max(aTime, myWarpScalar->GetMTime());
+
+ return aTime;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DeformedGridPL
+::GetMemorySize()
+{
+ unsigned long int aSize = Superclass::GetMemorySize();
+
+ if(vtkDataObject* aDataObject = myContourFilter->GetInput())
+ aSize += aDataObject->GetActualMemorySize() * 1024;
+
+ if(vtkDataObject* aDataObject = myWarpScalar->GetInput())
+ aSize += aDataObject->GetActualMemorySize() * 1024;
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+
+ if(VISU_DeformedGridPL *aPipeLine = dynamic_cast<VISU_DeformedGridPL*>(thePipeLine)){
+ SetScaleFactor( aPipeLine->GetScaleFactor() );
+ SetContourPrs( aPipeLine->GetIsContourPrs() );
+ SetNumberOfContours( aPipeLine->GetNumberOfContours() );
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Init()
+{
+ Superclass::Init();
+
+ vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput();
+ SetScaleFactor( VISU_Plot3DPL::GetScaleFactor( this, aPointSet ) );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Build()
+{
+ Superclass::Build();
+
+ myWarpScalar->SetInput( GetFieldTransformFilter()->GetPolyDataOutput() );
+ GetPolyDataMapper()->SetInput( myWarpScalar->GetPolyDataOutput() );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::Update()
+{
+ vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput();
+ if ( !myIsContour ) // surface prs
+ {
+ myWarpScalar->SetInput( aPointSet );
+ }
+ else // contour prs
+ {
+ myContourFilter->SetInput( aPointSet );
+
+ vtkFloatingPointType aScalarRange[2];
+ GetSourceRange( aScalarRange );
+
+ myContourFilter->GenerateValues( GetNumberOfContours(), aScalarRange );
+ myWarpScalar->SetInput( myContourFilter->GetOutput() );
+ }
+
+ Superclass::Update();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetNumberOfContours(int theNumber)
+{
+ myContourFilter->SetNumberOfContours(theNumber);
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_DeformedGridPL
+::GetNumberOfContours()
+{
+ return myContourFilter->GetNumberOfContours();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetScaleFactor(vtkFloatingPointType theScaleFactor)
+{
+ if ( VISU::CheckIsSameValue( myWarpScalar->GetScaleFactor(), theScaleFactor ) )
+ return;
+ myScaleFactor = theScaleFactor;
+ myWarpScalar->SetScaleFactor(theScaleFactor);
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_DeformedGridPL
+::GetScaleFactor()
+{
+ return myScaleFactor;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetContourPrs(bool theIsContourPrs )
+{
+ if(myIsContour == theIsContourPrs)
+ return;
+
+ myIsContour = theIsContourPrs;
+ Modified();
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU_DeformedGridPL
+::GetIsContourPrs()
+{
+ return myIsContour;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DeformedGridPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
+ Superclass::SetMapScale(theMapScale);
+
+ if ( myIsContour ) {
+ vtkFloatingPointType aSourceRange[2];
+ GetSourceRange( aSourceRange );
+ vtkFloatingPointType aDeltaRange = aSourceRange[1] - aSourceRange[0];
+ vtkFloatingPointType aNewRange[2] = { aSourceRange[1] - theMapScale*aDeltaRange, aSourceRange[1] };
+ myContourFilter->GenerateValues( GetNumberOfContours(), aNewRange );
+ }
+
+ myWarpScalar->SetScaleFactor( myScaleFactor * theMapScale );
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_ScalarMapPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_DeformedGridPL_HeaderFile
+#define VISU_DeformedGridPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_PolyDataPL.hxx"
+
+class vtkWarpScalar;
+class vtkContourFilter;
+
+
+//----------------------------------------------------------------------------
+class VISU_PIPELINE_EXPORT VISU_DeformedGridPL : public VISU_PolyDataPL
+{
+public:
+ vtkTypeMacro(VISU_DeformedGridPL, VISU_PolyDataPL);
+
+ static
+ VISU_DeformedGridPL*
+ New();
+
+ //----------------------------------------------------------------------------
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ void
+ SetScaleFactor( vtkFloatingPointType theScaleFactor );
+
+ vtkFloatingPointType
+ GetScaleFactor();
+
+ void
+ SetContourPrs( bool theIsContourPrs );
+
+ bool
+ GetIsContourPrs();
+
+ void
+ SetNumberOfContours( int theNumber );
+
+ int
+ GetNumberOfContours();
+
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ Init();
+
+ virtual
+ void
+ Update();
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_DeformedGridPL();
+
+ virtual
+ ~VISU_DeformedGridPL();
+
+ virtual
+ void
+ Build();
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+private:
+ VISU_DeformedGridPL(const VISU_DeformedGridPL&); // Not implemented.
+ void operator=(const VISU_DeformedGridPL&); // Not implemented.
+
+ vtkFloatingPointType myScaleFactor;
+ vtkContourFilter* myContourFilter;
+ vtkWarpScalar *myWarpScalar;
+ bool myIsContour;
+};
+
+#endif
bool theIsCopyInput)
{
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+ VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput);
if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
SetPrimitiveType(aPipeLine->GetPrimitiveType());
#define VISU_GaussPointsPL_HeaderFile
#include "VISUPipeline.hxx"
+#include "VISU_MergedPL.hxx"
#include "VISU_ColoredPL.hxx"
#include <vector>
* This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
* for rendering the Gauss Points as Point Sprites.
*/
-class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_ColoredPL
+class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_MergedPL,
+ public VISU_ColoredPL
{
public:
//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_MergedPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MergedPL.hxx"
+#include "VISU_PipeLine.hxx"
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MergedPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ if(VISU_MergedPL *aPipeLine = dynamic_cast<VISU_MergedPL*>(thePipeLine)){
+ if ( this == aPipeLine )
+ return;
+
+ if ( aPipeLine->IsExternalGeometryUsed() ) {
+ ClearGeometry();
+ int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
+ for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ )
+ AddGeometry( aPipeLine->GetGeometry( aGeomNumber ) );
+ }else
+ SetSourceGeometry();
+ }
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_MergedPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MergedPL_HeaderFile
+#define VISU_MergedPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+
+class vtkDataSet;
+class vtkPointSet;
+class VISU_PipeLine;
+
+
+//----------------------------------------------------------------------------
+struct VISU_PIPELINE_EXPORT VISU_MergedPL
+{
+ virtual
+ void
+ SetSourceGeometry() = 0;
+
+ virtual
+ int
+ AddGeometry( vtkDataSet* theGeometry ) = 0;
+
+ virtual
+ vtkDataSet*
+ GetGeometry( int theGeomNumber ) = 0;
+
+ virtual
+ int
+ GetNumberOfGeometry() = 0;
+
+ virtual
+ bool
+ IsExternalGeometryUsed() = 0;
+
+ virtual
+ void
+ ClearGeometry() = 0;
+
+ virtual
+ vtkPointSet*
+ GetMergedInput() = 0;
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+};
+
+#endif
VISU_MeshPL
::Build()
{
- GetDataSetMapperHolder()->GetDataSetMapper()->SetInput(GetClippedInput());
+ GetDataSetMapper()->SetInput(GetClippedInput());
}
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_Plot3DPL
-::GetScaleFactor(vtkDataSet* theDataSet)
+::GetScaleFactor( VISU_ColoredPL* theColoredPL,
+ vtkDataSet* theDataSet )
{
theDataSet->Update();
vtkFloatingPointType aLength = theDataSet->GetLength(); // diagonal length
vtkFloatingPointType aScalarRange[2];
- GetSourceRange(aScalarRange);
+ theColoredPL->GetSourceRange(aScalarRange);
static vtkFloatingPointType EPS = 0.3;
vtkFloatingPointType aRange = aScalarRange[1];
Superclass::Init();
myOrientation = GetOrientation(GetMergedInput());
- SetScaleFactor(GetScaleFactor(GetMergedInput()));
+ SetScaleFactor( GetScaleFactor( this, GetMergedInput() ) );
}
VISU_CutPlanesPL::PlaneOrientation
GetOrientation(vtkDataSet* theDataSet);
+ static
vtkFloatingPointType
- GetScaleFactor(vtkDataSet* theDataSet);
+ GetScaleFactor( VISU_ColoredPL* theColoredPL,
+ vtkDataSet* theDataSet );
- void SetMapScale(vtkFloatingPointType theMapScale);
+ void
+ SetMapScale(vtkFloatingPointType theMapScale);
protected:
VISU_Plot3DPL();
+
virtual
~VISU_Plot3DPL();
#include "VISU_PolyDataPL.hxx"
-#include "SALOME_ExtractPolyDataGeometry.h"
+#include "VISU_PolyDataMapperHolder.hxx"
-#include "VISU_PipeLineUtils.hxx"
-
-#include <float.h>
-#include <algorithm>
-
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyData.h>
-
-#include <vtkPlane.h>
-#include <vtkImplicitBoolean.h>
-#include <vtkImplicitFunction.h>
-#include <vtkImplicitFunctionCollection.h>
-#include <vtkMath.h>
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
//----------------------------------------------------------------------------
VISU_PolyDataPL
-::VISU_PolyDataPL():
- myExtractPolyDataGeometry(SALOME_ExtractPolyDataGeometry::New())
-{
- if(MYDEBUG) MESSAGE("VISU_PolyDataPL::VISU_PolyDataPL - "<<this);
-
- // Clipping functionality
- myExtractPolyDataGeometry->Delete();
- myExtractPolyDataGeometry->SetStoreMapping(true);
-
- vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
- myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
- anImplicitBoolean->SetOperationTypeToIntersection();
- anImplicitBoolean->Delete();
-}
+::VISU_PolyDataPL()
+{}
//----------------------------------------------------------------------------
VISU_PolyDataPL
::~VISU_PolyDataPL()
-{
- if(MYDEBUG)
- MESSAGE("VISU_PolyDataPL::~VISU_PolyDataPL - "<<this);
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_PolyDataPL
-::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
-{
- myExtractPolyDataGeometry->SetInput(theIDMapper->GetPolyDataOutput());
- myPolyDataIDMapper = theIDMapper;
- SetIDMapper(theIDMapper);
-}
-
-
-//----------------------------------------------------------------------------
-const VISU::PPolyDataIDMapper&
-VISU_PolyDataPL
-::GetPolyDataIDMapper() const
-{
- return myPolyDataIDMapper;
-}
-
-
-//----------------------------------------------------------------------------
-vtkPolyData*
-VISU_PolyDataPL
-::GetPolyDataInput()
-{
- if(myPolyDataIDMapper)
- return myPolyDataIDMapper->GetPolyDataOutput();
-
- return NULL;
-}
-
-
-//----------------------------------------------------------------------------
-vtkPointSet*
-VISU_PolyDataPL
-::GetClippedInput() const
-{
- vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
- aDataSet->Update();
- return aDataSet;
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_PolyDataPL
-::OnCreateMapper()
-{
- myPolyDataMapper = vtkPolyDataMapper::New();
- myPolyDataMapper->Delete();
- SetMapper(myPolyDataMapper.GetPointer());
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_PolyDataPL
-::SetPolyDataMapper(vtkPolyDataMapper* theMapper)
-{
- myPolyDataMapper = theMapper;
- SetMapper(theMapper);
-}
-
-
-//----------------------------------------------------------------------------
-vtkPolyDataMapper*
-VISU_PolyDataPL
-::GetPolyDataMapper()
-{
- return myPolyDataMapper.GetPointer();
-}
+{}
//----------------------------------------------------------------------------
-void
+void
VISU_PolyDataPL
-::DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
+::OnCreateMapperHolder()
{
- if(VISU_PolyDataPL* aPipeLine = dynamic_cast<VISU_PolyDataPL*>(thePipeLine)){
- if(theIsCopyInput)
- SetPolyDataIDMapper(aPipeLine->GetPolyDataIDMapper());
- Update();
- VISU::CopyPolyDataMapper(GetPolyDataMapper(),
- aPipeLine->GetPolyDataMapper(),
- theIsCopyInput);
- }
-}
+ myPolyDataMapperHolder = VISU_PolyDataMapperHolder::New();
+ myPolyDataMapperHolder->Delete();
-
-//----------------------------------------------------------------------------
-void
-VISU_PolyDataPL
-::SetLookupTable(VISU_LookupTable* theLookupTable)
-{
- myPolyDataMapper->SetLookupTable(theLookupTable);
+ SetMapperHolder(myPolyDataMapperHolder.GetPointer());
}
-//----------------------------------------------------------------------------
-unsigned long int
-VISU_PolyDataPL
-::GetMemorySize()
-{
- unsigned long int aSize = 0;
- if(myExtractPolyDataGeometry->GetInput())
- if(vtkDataSet* aDataSet = myExtractPolyDataGeometry->GetOutput())
- aSize = aDataSet->GetActualMemorySize() * 1024;
-
- aSize += Superclass::GetMemorySize();
-
- return aSize;
-}
-
-
-//------------------------ Clipping planes -----------------------------------
-bool
-VISU_PolyDataPL
-::AddClippingPlane(vtkPlane* thePlane)
-{
- if (thePlane) {
- if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- aFunction->AddItem(thePlane);
- // Check, that at least one cell present after clipping.
- // This check was introduced because of bug IPAL8849.
- vtkDataSet* aClippedDataSet = GetClippedInput();
- if(aClippedDataSet->GetNumberOfCells() < 1)
- return false;
- }
- }
- return true;
-}
-
-//----------------------------------------------------------------------------
-vtkPlane*
-VISU_PolyDataPL
-::GetClippingPlane(vtkIdType theID) const
-{
- vtkPlane* aPlane = NULL;
- if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
- if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- vtkImplicitFunction* aFun = NULL;
- aFunction->InitTraversal();
- for(vtkIdType anID = 0; anID <= theID; anID++)
- aFun = aFunction->GetNextItem();
- aPlane = dynamic_cast<vtkPlane*>(aFun);
- }
- }
- return aPlane;
-}
-
//----------------------------------------------------------------------------
void
VISU_PolyDataPL
-::RemoveAllClippingPlanes()
-{
- if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- aFunction->RemoveAllItems();
- aBoolean->Modified(); // VTK bug
- }
-}
-
-//----------------------------------------------------------------------------
-vtkIdType
-VISU_PolyDataPL
-::GetNumberOfClippingPlanes() const
-{
- if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- return aFunction->GetNumberOfItems();
- }
- return 0;
-}
-
-//----------------------------------------------------------------------------
-vtkIdType
-VISU_PolyDataPL
-::GetNodeObjID(vtkIdType theID)
-{
- vtkIdType anID = myExtractPolyDataGeometry->GetNodeObjId(theID);
- return Superclass::GetNodeObjID(anID);
-}
-
-vtkIdType
-VISU_PolyDataPL
-::GetNodeVTKID(vtkIdType theID)
-{
- vtkIdType anID = Superclass::GetNodeVTKID(theID);
- return myExtractPolyDataGeometry->GetNodeVTKId(anID);
-}
-
-vtkFloatingPointType*
-VISU_PolyDataPL
-::GetNodeCoord(int theObjID)
+::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
{
- return Superclass::GetNodeCoord(theObjID);
+ GetPolyDataMapperHolder()->SetPolyDataIDMapper( theIDMapper );
}
//----------------------------------------------------------------------------
-vtkIdType
-VISU_PolyDataPL
-::GetElemObjID(vtkIdType theID)
-{
- vtkIdType anID = myExtractPolyDataGeometry->GetElemObjId(theID);
- return Superclass::GetElemObjID(anID);
-}
-
-vtkIdType
+VISU_PolyDataMapperHolder*
VISU_PolyDataPL
-::GetElemVTKID(vtkIdType theID)
+::GetPolyDataMapperHolder()
{
- vtkIdType anID = Superclass::GetElemVTKID(theID);
- return myExtractPolyDataGeometry->GetElemVTKId(anID);
-}
+ GetMapperHolder();
-vtkCell*
-VISU_PolyDataPL
-::GetElemCell(vtkIdType theObjID)
-{
- return Superclass::GetElemCell(theObjID);
+ return myPolyDataMapperHolder.GetPointer();
}
//----------------------------------------------------------------------------
-void
+vtkPolyDataMapper*
VISU_PolyDataPL
-::SetImplicitFunction(vtkImplicitFunction *theFunction)
-{
- myExtractPolyDataGeometry->SetImplicitFunction(theFunction);
-}
-
-vtkImplicitFunction *
-VISU_PolyDataPL
-::GetImplicitFunction()
+::GetPolyDataMapper()
{
- return myExtractPolyDataGeometry->GetImplicitFunction();
+ return GetPolyDataMapperHolder()->GetPolyDataMapper();
}
-SALOME_ExtractPolyDataGeometry*
-VISU_PolyDataPL
-::GetExtractPolyDataGeometryFilter()
-{
- return myExtractPolyDataGeometry.GetPointer();
-}
-
//----------------------------------------------------------------------------
#ifndef VISU_PolyDataPL_HeaderFile
#define VISU_PolyDataPL_HeaderFile
+#include "VISUPipeline.hxx"
#include "VISU_ColoredPL.hxx"
+class VISU_PolyDataMapperHolder;
class vtkPolyDataMapper;
-class vtkPolyData;
-class SALOME_ExtractPolyDataGeometry;
//----------------------------------------------------------------------------
-class VISU_PolyDataPL : public VISU_ColoredPL
+class VISU_PIPELINE_EXPORT VISU_PolyDataPL : public VISU_ColoredPL
{
public:
vtkTypeMacro(VISU_PolyDataPL, VISU_ColoredPL);
- //----------------------------------------------------------------------------
- virtual
- vtkPolyDataMapper*
- GetPolyDataMapper();
-
- virtual
- vtkPolyData*
- GetPolyDataInput();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- //----------------------------------------------------------------------------
- virtual
- void
- SetImplicitFunction(vtkImplicitFunction *theFunction);
-
- virtual
- vtkImplicitFunction*
- GetImplicitFunction();
-
- virtual
- SALOME_ExtractPolyDataGeometry*
- GetExtractPolyDataGeometryFilter();
-
- //----------------------------------------------------------------------------
- // Clipping planes
- virtual
- void
- RemoveAllClippingPlanes();
-
- virtual
- vtkIdType
- GetNumberOfClippingPlanes() const;
-
- virtual
- bool
- AddClippingPlane(vtkPlane* thePlane);
-
- virtual
- vtkPlane*
- GetClippingPlane(vtkIdType theID) const;
-
- //----------------------------------------------------------------------------
- virtual
- vtkIdType
- GetNodeObjID(vtkIdType theID);
-
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID);
-
- virtual
- vtkFloatingPointType*
- GetNodeCoord(vtkIdType theObjID);
-
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID);
-
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID);
-
- virtual
- vtkCell*
- GetElemCell(vtkIdType theObjID);
-
//----------------------------------------------------------------------------
void
SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper);
- const VISU::PPolyDataIDMapper&
- GetPolyDataIDMapper() const;
+ VISU_PolyDataMapperHolder*
+ GetPolyDataMapperHolder();
+
+ vtkPolyDataMapper*
+ GetPolyDataMapper();
protected:
VISU_PolyDataPL();
virtual
void
- DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
-
- virtual
- void
- OnCreateMapper();
-
- void
- SetPolyDataMapper(vtkPolyDataMapper* theMapper);
-
- virtual
- void
- SetLookupTable(VISU_LookupTable* theLookupTable);
-
- virtual
- vtkPointSet*
- GetClippedInput() const;
+ OnCreateMapperHolder();
private:
- VISU::PPolyDataIDMapper myPolyDataIDMapper;
- vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
- vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
+ vtkSmartPointer<VISU_PolyDataMapperHolder> myPolyDataMapperHolder;
};
#endif
bool theIsCopyInput)
{
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+ VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput);
}
#define VISU_ScalarMapPL_HeaderFile
#include "VISUPipeline.hxx"
+#include "VISU_MergedPL.hxx"
#include "VISU_ColoredPL.hxx"
#include "VISU_UnstructuredGridPL.hxx"
//----------------------------------------------------------------------------
-class VISU_PIPELINE_EXPORT VISU_ScalarMapPL : public VISU_ColoredPL,
+class VISU_PIPELINE_EXPORT VISU_ScalarMapPL : public VISU_MergedPL,
+ public VISU_ColoredPL,
public VISU_UnstructuredGridPL
{
public:
VisuGUI_ScalarMapOnDeformedShapeDlg.cxx \
VisuGUI_SetupPlot2dDlg.cxx \
VisuGUI_BuildProgressDlg.cxx \
+ VisuGUI_Table3dDlg.cxx \
VisuGUI_TransparencyDlg.cxx \
VisuGUI_Timer.cxx \
VisuGUI_Slider.cxx \
VisuGUI_InputPane.cxx \
VisuGUI_CacheDlg.cxx \
- VisuGUI_FieldFilter.cxx
+ VisuGUI_FieldFilter.cxx \
+ VisuGUI_FileInfoDlg.cxx
MOC_FILES= \
VisuGUI_moc.cxx \
VisuGUI_ScalarMapOnDeformedShapeDlg_moc.cxx \
VisuGUI_SetupPlot2dDlg_moc.cxx \
VisuGUI_BuildProgressDlg_moc.cxx \
+ VisuGUI_Table3dDlg_moc.cxx \
VisuGUI_TransparencyDlg_moc.cxx \
VisuGUI_Slider_moc.cxx \
VisuGUI_InputPane_moc.cxx \
- VisuGUI_CacheDlg_moc.cxx
+ VisuGUI_CacheDlg_moc.cxx \
+ VisuGUI_FileInfoDlg_moc.cxx
nodist_libVISU_la_SOURCES=$(MOC_FILES)
<source>SHOW_LEVEL_LABELS</source>
<translation>Show level labels</translation>
</message>
+ <message>
+ <source>MEN_FILE_INFO</source>
+ <translation>MED File information</translation>
+ </message>
</context>
<context>
<name>VisuGUI_AxisWg</name>
<translation>auto</translation>
</message>
</context>
+ <context>
+ <name>VisuGUI_Table3DDlg</name>
+ <message>
+ <source>DLG_PREF_TITLE</source>
+ <translation>Table 3D Bar Preferences</translation>
+ </message>
+ <message>
+ <source>DLG_PROP_TITLE</source>
+ <translation>Scalar Bar Properties</translation>
+ </message>
+ </context>
+ <context>
+ <name>VisuGUI_TableScalarBarPane</name>
+ <message>
+ <source>SCALAR_RANGE_GRP</source>
+ <translation>Scalar range</translation>
+ </message>
+ <message>
+ <source>LOGARITHMIC_SCALING</source>
+ <translation>Logarithmic scaling</translation>
+ </message>
+ <message>
+ <source>FIELD_RANGE_BTN</source>
+ <translation>Use field range</translation>
+ </message>
+ <message>
+ <source>IMPOSED_RANGE_BTN</source>
+ <translation>Use imposed range</translation>
+ </message>
+ <message>
+ <source>LBL_MIN</source>
+ <translation>Min:</translation>
+ </message>
+ <message>
+ <source>LBL_MAX</source>
+ <translation>Max:</translation>
+ </message>
+ <message>
+ <source>COLORS_LABELS_GRP</source>
+ <translation>Colors and labels</translation>
+ </message>
+ <message>
+ <source>LBL_NB_COLORS</source>
+ <translation>Nb. of colors:</translation>
+ </message>
+ <message>
+ <source>LBL_NB_LABELS</source>
+ <translation>Nb. of labels:</translation>
+ </message>
+ <message>
+ <source>ORIENTATION_GRP</source>
+ <translation>Orientation</translation>
+ </message>
+ <message>
+ <source>VERTICAL_BTN</source>
+ <translation>Vertical</translation>
+ </message>
+ <message>
+ <source>HORIZONTAL_BTN</source>
+ <translation>Horizontal</translation>
+ </message>
+ <message>
+ <source>ORIGIN_GRP</source>
+ <translation>Origin</translation>
+ </message>
+ <message>
+ <source>LBL_X</source>
+ <translation>X:</translation>
+ </message>
+ <message>
+ <source>LBL_Y</source>
+ <translation>Y:</translation>
+ </message>
+ <message>
+ <source>LBL_SHOW_PREVIEW</source>
+ <translation>Show preview</translation>
+ </message>
+ <message>
+ <source>DIMENSIONS_GRP</source>
+ <translation>Dimensions</translation>
+ </message>
+ <message>
+ <source>LBL_WIDTH</source>
+ <translation>Width:</translation>
+ </message>
+ <message>
+ <source>LBL_HEIGHT</source>
+ <translation>Height:</translation>
+ </message>
+ <message>
+ <source>SAVE_DEFAULT_CHK</source>
+ <translation>Save as default values</translation>
+ </message>
+ <message>
+ <source>MSG_MINMAX_VALUES</source>
+ <translation>Min value can not be higher or equal to Max value</translation>
+ </message>
+ <message>
+ <source>WRN_LOGARITHMIC_RANGE</source>
+ <translation>Logarithmic scaling: use imposed range values > 0</translation>
+ </message>
+ <message>
+ <source>WRN_LOGARITHMIC_FIELD_RANGE</source>
+ <translation>Logarithmic scaling: field range contains negative values, use imposed range instead</translation>
+ </message>
+ </context>
+ <context>
+ <name>VisuGUI_Table3DPane</name>
+ <message>
+ <source>SCALE</source>
+ <translation>Scale Factor:</translation>
+ </message>
+ <message>
+ <source>PRESENTATION_TYPE</source>
+ <translation>Presentation type</translation>
+ </message>
+ <message>
+ <source>SURFACE</source>
+ <translation>Surface</translation>
+ </message>
+ <message>
+ <source>CONTOUR</source>
+ <translation>Contour</translation>
+ </message>
+ <message>
+ <source>NUMBER_CONTOURS</source>
+ <translation>Number of contours:</translation>
+ </message>
+ </context>
+ <context>
+ <name>VisuGUI_FileInfoDlg</name>
+ <message>
+ <source>CAPTION</source>
+ <translation>File information</translation>
+ </message>
+ <message>
+ <source>FILE_NAME</source>
+ <translation>File name</translation>
+ </message>
+ <message>
+ <source>FILE_SIZE</source>
+ <translation>File size (bytes)</translation>
+ </message>
+ <message>
+ <source>MED_VERSION</source>
+ <translation>MED version</translation>
+ </message>
+ </context>
</TS>
#include "LightApp_SelectionMgr.h"
#include "LightApp_Selection.h"
#include "LightApp_Preferences.h"
+#include "LightApp_DataOwner.h"
#include "QtxAction.h"
#include "QtxFontEdit.h"
#include "VISU_Gen_i.hh"
#include "VISU_Mesh_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
#include "VISU_Result_i.hh"
#include "VISU_View_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VisuGUI_BuildProgressDlg.h"
#include "VisuGUI_TransparencyDlg.h"
#include "VisuGUI_CacheDlg.h"
+#include "VisuGUI_Table3dDlg.h"
#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI_TableDlg.h"
+#include "VisuGUI_FileInfoDlg.h"
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(MED_Gen)
case VISU::TTABLE:
displayer()->Display(anIO->getEntry());
break;
+ case VISU::TPOINTMAP3D:
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+ displayer()->Display(anIO->getEntry());
+ aViewWindow->highlight(anIO, 1);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ }
+ break;
default: {
VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
if(aPrs3d){
dlg->show();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowTablePlot()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
+
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
+ aDlg->initFromPrsObject( aTable );
+ if ( runAndWait(aDlg, 0) > 0 ) {
+ aDlg->storeToPrsObject(aTable);
+ aTable->UpdateActors();
+ }
+ delete aDlg;
+ }
+}
+
//----------------------------------------------------------------------------
void
VisuGUI
VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
- if(aBase->GetType() == VISU::TTABLE) {
+ if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
_PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
this, SLOT(OnShowTable()));
+ createAction( VISU_SHOW_TABLE_PLOT, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnShowTablePlot()));
+
createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
this, SLOT(OnPlotData()));
createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
this, SLOT(OnMultiprViewHide()));
+
+ createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
+ tr("MEN_FILE_INFO"), "", 0, aParent, false,
+ this, SLOT(OnFileInfo()));
}
void
mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
+ mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
+
// Rules
QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
QString aCustomRule = aRule + "resolutionState!='H'";
mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
}
+
+ mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
}
//***************************************************************************
VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
if (aType == VISU::TANIMATION) {
theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
-
} else if (isOBClient) {
if (IsSObjectTable(aSObject)) {
+ theMenu->removeAction( action( VISU_DELETE_OBJS ) );
+ if (aType == VISU::TPOINTMAP3D) {
+ theMenu->addAction( action( VISU_SHOW_TABLE_PLOT ) );
+ theMenu->addSeparator();
+ theMenu->addAction( action( VISU_ERASE ) );
+ theMenu->addAction( action( myEraseAll ) );
+ theMenu->addAction( action( VISU_DISPLAY ) );
+ theMenu->addAction( action( VISU_DISPLAY_ONLY ) );
+ theMenu->addSeparator();
+ }
theMenu->addAction( action( VISU_SHOW_TABLE ) );
theMenu->addAction( action( VISU_CREATE_CURVES ) );
theMenu->addAction( action( VISU_EXPORT_TABLE ) );
theMenu->addSeparator();
+ theMenu->addAction( action( VISU_DELETE_OBJS ) );
} else {
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
}
}
}
+ } else {
+ if (aType == VISU::TPOINTMAP3D) {
+ theMenu->removeAction( action( myEraseAll ) );
+ theMenu->addAction( action( VISU_SHOW_TABLE_PLOT ) );
+ theMenu->addSeparator();
+ theMenu->addAction( action( VISU_ERASE ) );
+ theMenu->addAction( action( myEraseAll ) );
+ theMenu->addAction( action( VISU_DISPLAY ) );
+ theMenu->addAction( action( VISU_DISPLAY_ONLY ) );
+ theMenu->addSeparator();
+ }
}
}
QApplication::restoreOverrideCursor();
}
+//---------------------------------------------------------------
+void VisuGUI::OnFileInfo()
+{
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
+ SUIT_DataOwnerPtrList lst;
+ getApp()->selectionMgr()->selected( lst );
+ LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
+ VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
+ if(!aCResult)
+ return;
+ VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
+ dlg.exec();
+}
void OnChangeLines();
void OnShowTable();
+ void OnShowTablePlot();
void OnCreateTable();
void OnDeleteObjects();
void OnPlotData();
void OnMultiprViewHide();
void OnMultiprChangeRes(VISU::Result::Resolution theResolution);
+ void OnFileInfo();
+
protected:
virtual LightApp_Selection* createSelection() const;
#define VISU_DELETE_OBJS 4022
#define VISU_SHOW_TABLE 4023
+#define VISU_SHOW_TABLE_PLOT 4029
#define VISU_CREATE_CURVES 4024
#define VISU_EXPORT_TABLE 4025
#define VISU_MULTIPR_LOW_RES 4097
#define VISU_MULTIPR_HIDE 4098
+#define VISU_FILE_INFO 4100
+
#endif
SpinBoxIJKIndex ->setEnabled(anIsControlsEnable);
CheckBoxIJKPlaneReverse->setEnabled(anIsControlsEnable);
//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- if(myPrs3d){
+ if ( myPrs3d ) {
VISU_PipeLine* aPipeLine = myPrs3d->GetPipeLine();
VISU::PIDMapper anIDMapper = aPipeLine->GetIDMapper();
- if(anIDMapper->IsStructured()){
- VISU::TIdTypeVector aVec = anIDMapper->GetStructure();
- switch(aVec.size()){
- case 1:
- ButtonGroupIJKAxis->button(0)->setEnabled(true);
- ButtonGroupIJKAxis->button(1)->setEnabled(false);
- ButtonGroupIJKAxis->button(2)->setEnabled(false);
- break;
- case 2:
- ButtonGroupIJKAxis->button(0)->setEnabled(true);
- ButtonGroupIJKAxis->button(1)->setEnabled(true);
- ButtonGroupIJKAxis->button(2)->setEnabled(false);
- break;
- case 3:
- ButtonGroupIJKAxis->button(0)->setEnabled(true);
- ButtonGroupIJKAxis->button(1)->setEnabled(true);
- ButtonGroupIJKAxis->button(2)->setEnabled(true);
- break;
- }
+ if ( anIDMapper->IsStructured() ) {
+ VISU::TStructuredId aStructuredId = anIDMapper->GetStructure();
+ ButtonGroupIJKAxis->button(0)->setEnabled( aStructuredId[0] >= 0 );
+ ButtonGroupIJKAxis->button(1)->setEnabled( aStructuredId[1] >= 0 );
+ ButtonGroupIJKAxis->button(2)->setEnabled( aStructuredId[2] >= 0 );
}
}
//ENK: 23.11.2006
int aNbAxes = 3;
VISU_PipeLine* aPipeLine = myPrs3d->GetPipeLine();
VISU::PIDMapper anIDMapper = aPipeLine->GetIDMapper();
- if(anIDMapper->IsStructured() && !anIDMapper->myType)
- aNbAxes = (anIDMapper->GetStructure()).size();
+ if ( anIDMapper->IsStructured() && !anIDMapper->myIsPolarType )
+ aNbAxes = anIDMapper->GetStructureDim();
for (i = 0; i < aNbAxes; ++i) {
VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i;
CORBA::String_var aMeshName = myPrs3d->GetMeshName();
VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(aBase);
VISU::ColoredPrs3d_var aColoredPrs3d = aHolder->GetDevice();
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aColoredPrs3d).in());
- }else
+ }else if (aType == VISU::TPOINTMAP3D) {
+ VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBaseServant);
+ VISU_PointMap3dActor* aPointMap3dActor = aTable3d->CreateActor();
+ if (aPointMap3dActor) {
+ aViewWindow->AddActor(aPointMap3dActor);
+ aViewWindow->Repaint();
+ }
+ }
+ else
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBaseServant);
if(aPrs3d){
#include <LightApp_Displayer.h>
#include <VISU_Prs3d_i.hh>
#include <VISU_Table_i.hh>
+#include <VISU_PointMap3d_i.hh>
class SalomeApp_Application;
class SVTK_ViewWindow;
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_FileInfoDlg.cxx
+// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. ( alexander.solovyov@opencascade.com)
+// Module : VISU
+//
+
+#include <VisuGUI_FileInfoDlg.h>
+
+#include <MED_Common.hxx>
+
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
+
+VisuGUI_FileInfoDlg::VisuGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
+ : QtxDialog( parent, true, true, QtxDialog::OK )
+{
+ setWindowTitle( tr( "CAPTION" ) );
+ setSizeGripEnabled( true );
+
+ QLineEdit* fname = new QLineEdit( mainFrame() );
+ fname->setReadOnly( true );
+ QLineEdit* fsize = new QLineEdit( mainFrame() );
+ fsize->setReadOnly( true );
+ QLineEdit* medversion = new QLineEdit( mainFrame() );
+ medversion->setReadOnly( true );
+ fname->setMinimumWidth( 300 );
+
+ QGridLayout* lay = new QGridLayout( mainFrame() );
+ lay->setMargin( 5 ); lay->setSpacing( 5 );
+ lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
+ lay->addWidget( fname, 0, 1 );
+ lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
+ lay->addWidget( fsize, 1, 1 );
+ lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
+ lay->addWidget( medversion, 2, 1 );
+
+ fname->setText( (char*)inf->fileName );
+ fname->home( false );
+ fsize->setText( QString::number( inf->fileSize ) );
+
+ QString version;
+ if( inf->major>=0 )
+ {
+ version = QString::number( inf->major );
+ if( inf->minor>=0 )
+ {
+ version += "." + QString::number( inf->minor );
+ if( inf->release>=0 )
+ version += "." + QString::number( inf->release );
+ }
+ }
+ medversion->setText( version );
+}
+
+VisuGUI_FileInfoDlg::~VisuGUI_FileInfoDlg()
+{
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_FileInfoDlg.h
+// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. ( alexander.solovyov@opencascade.com)
+//
+
+#ifndef VISUGUI_FILEINFODLG_H
+#define VISUGUI_FILEINFODLG_H
+
+#include <MED.hh>
+#include <QtxDialog.h>
+
+class VisuGUI_FileInfoDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* );
+ virtual ~VisuGUI_FileInfoDlg();
+};
+
+#endif // VISUGUI_FILEINFODLG_H
thePrs->SetPosition(XSpin->value(), YSpin->value());
thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
- thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3d::VERTICAL : VISU::ColoredPrs3d::HORIZONTAL);
+ thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
thePrs->SetNbColors(ColorSpin->value());
thePrs->SetLabels(LabelSpin->value());
myScalarMap->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data());
myScalarMap->SetUnitsVisible(myBarDlg->isUnitsVisible());
- myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3d::VERTICAL : VISU::ColoredPrs3d::HORIZONTAL);
+ myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
if(isLogarithmic())
myScalarMap->SetScaling(VISU::LOGARITHMIC);
else
using namespace std;
+
+inline
+QString
+GetNumber( const VISU::TStructuredId& theStructuredId,
+ size_t theId )
+{
+ if ( theStructuredId[theId] < 0 )
+ return "-";
+
+ return QString::number( theStructuredId[theId] );
+}
+
+
VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
QDialog(VISU::GetDesktop(theModule),
Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),//WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
myIDValLbl->setText( QString::number(anID) );
myScalarValLbl->setText(getValue(aPntData, aVTKID));
myVectorValLbl->setText(getVector(aPntData, aVTKID));
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
- VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anID);
- switch(aVec.size()){
- case 3:
- myKValLbl->setText(QString::number(aVec[2]));
- case 2:
- myJValLbl->setText(QString::number(aVec[1]));
- case 1:
- myIValLbl->setText(QString::number(aVec[0]));
- break;
- default:
- myIValLbl->setText("-");
- myJValLbl->setText("-");
- myKValLbl->setText("-");
- }
- //ENK: 23.11.2006
+ VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(anID);
+ myKValLbl->setText( GetNumber( aStructuredId, 2 ) );
+ myJValLbl->setText( GetNumber( aStructuredId, 1 ) );
+ myIValLbl->setText( GetNumber( aStructuredId, 0 ) );
}
}
break;
myListPoints->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole );
vtkIdType aNodeObjId = anIter->first;
//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(aNodeObjId);
- QString aI,aJ,aK;
- aI = "-";
- aJ = "-";
- aK = "-";
- switch(aVec.size()){
- case 3:
- aK = QString::number(aVec[2]);
- case 2:
- aJ = QString::number(aVec[1]);
- case 1:
- aI = QString::number(aVec[0]);
- break;
- }
+ VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(aNodeObjId);
+ QString aI = GetNumber(aStructuredId, 0);
+ QString aJ = GetNumber(aStructuredId, 1);
+ QString aK = GetNumber(aStructuredId, 2);
//ENK: 23.11.2006
QAbstractItemModel* aModel = myListPoints->model();
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_Table3dDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+//
+
+#include "VisuGUI_Table3dDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_InputPane.h"
+
+#include "VISU_ColoredPrs3dFactory.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include <SVTK_ViewWindow.h>
+#include <SALOME_Actor.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <LightApp_Application.h>
+#include <SVTK_FontWidget.h>
+#include <QtxDoubleSpinBox.h>
+
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QTabWidget>
+#include <QRadioButton>
+#include <QSpinBox>
+#include <QCheckBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QButtonGroup>
+#include <QGroupBox>
+#include <QLineEdit>
+
+#define SURFACE_PRS_ID 0
+#define CONTOUR_PRS_ID 1
+
+//=======================================================================
+//function : VisuGUI_Table3DPane
+//purpose :
+//=======================================================================
+VisuGUI_Table3DPane::VisuGUI_Table3DPane( QWidget* parent )
+ : QWidget( parent ),
+ myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>() ),
+ myPrs( 0 ),
+ myInitFromPrs( false )
+{
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setMargin( 11 );
+ topLayout->setSpacing( 6 );
+
+ // scale
+ QLabel* scaleLabel = new QLabel( tr( "SCALE" ), this );
+ ScaleSpn = new QtxDoubleSpinBox( -1.e6, 1.e6, 0.1, this );
+ // Presentation type
+ GBPrsTypeBox = new QGroupBox( tr( "PRESENTATION_TYPE" ), this );
+ GBPrsType = new QButtonGroup( GBPrsTypeBox );
+ QRadioButton* rb1 = new QRadioButton( tr( "SURFACE" ), GBPrsTypeBox );
+ QRadioButton* rb2 = new QRadioButton( tr( "CONTOUR" ), GBPrsTypeBox );
+ GBPrsType->addButton( rb1, SURFACE_PRS_ID );
+ GBPrsType->addButton( rb2, CONTOUR_PRS_ID );
+ QHBoxLayout* GBPrsTypeBoxLayout = new QHBoxLayout( GBPrsTypeBox );
+ GBPrsTypeBoxLayout->setMargin( 11 );
+ GBPrsTypeBoxLayout->setSpacing( 6 );
+ GBPrsTypeBoxLayout->addWidget( rb1 );
+ GBPrsTypeBoxLayout->addWidget( rb2 );
+
+ // nb Contours
+ QLabel* nbContLabel = new QLabel( tr( "NUMBER_CONTOURS" ), this );
+ NbContoursSpn = new QSpinBox( this );
+ NbContoursSpn->setMinimum( 1 );
+ NbContoursSpn->setMaximum( 999 );
+ NbContoursSpn->setSingleStep( 1 );
+
+ topLayout->addWidget( scaleLabel, 0, 0 );
+ topLayout->addWidget( ScaleSpn, 0, 1 );
+ topLayout->addWidget( GBPrsTypeBox, 1, 0, 1, 2 );
+ topLayout->addWidget( nbContLabel, 2, 0 );
+ topLayout->addWidget( NbContoursSpn, 2, 1 );
+ topLayout->setRowStretch( 3, 5 );
+
+ // signals and slots connections
+
+ connect( GBPrsType, SIGNAL( buttonClicked( int ) ), this, SLOT( onPrsType( int ) ) );
+}
+
+//=======================================================================
+//function : destructor
+//purpose :
+//=======================================================================
+VisuGUI_Table3DPane::~VisuGUI_Table3DPane()
+{
+}
+
+//=======================================================================
+//function : onPrsType
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DPane::onPrsType( int id )
+{
+ NbContoursSpn->setEnabled( id == CONTOUR_PRS_ID );
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Table3DPane::storeToPrsObject( VISU::PointMap3d_i* thePrs )
+{
+ // scale
+ thePrs->SetScaleFactor( ScaleSpn->value() );
+
+ // prs type
+ thePrs->SetContourPrs( GBPrsType->checkedId() == CONTOUR_PRS_ID );
+
+ // nb contours
+ thePrs->SetNbOfContours( NbContoursSpn->value() );
+
+ return 1;
+}
+
+//=======================================================================
+//function : GetPrs
+//purpose :
+//=======================================================================
+VISU::PointMap3d_i* VisuGUI_Table3DPane::GetPrs()
+{
+ return myPrs;
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DPane::initFromPrsObject( VISU::PointMap3d_i* thePrs )
+{
+ myInitFromPrs = true;
+ myPrs = thePrs;
+
+ // scale
+ ScaleSpn->setValue( thePrs->GetScaleFactor() );
+
+ // prs type
+ int id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID;
+ GBPrsType->button( id )->setChecked( true );
+ onPrsType( id );
+
+ // nb contours
+ NbContoursSpn->setValue( thePrs->GetNbOfContours() );
+}
+
+//=======================================================================
+//function : Table Scalar Bar
+//purpose :
+//=======================================================================
+
+VisuGUI_TableScalarBarPane::VisuGUI_TableScalarBarPane( QWidget* parent )
+ : QWidget( parent ),
+ myBarPrs( 0 )
+{
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setSpacing( 6 );
+ topLayout->setMargin( 11 );
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ QString propertyName;
+ propertyName = QString( "scalar_bar_vertical_" );
+ myVerX = aResourceMgr->doubleValue( "VISU", propertyName + "x", 0. );
+ myVerY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
+ myVerW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
+ myVerH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
+ myVerTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
+ myVerTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
+ myVerLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
+ myVerLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myVerBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
+ myVerBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
+
+ propertyName = QString( "scalar_bar_horizontal_" );
+ myHorX = aResourceMgr->doubleValue( "VISU", propertyName + "x", 0. );
+ myHorY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
+ myHorW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
+ myHorH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
+ myHorTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
+ myHorTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
+ myHorLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
+ myHorLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myHorBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
+ myHorBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
+
+ // Range ============================================================
+ RangeGroup = new QGroupBox( tr( "SCALAR_RANGE_GRP" ), this );
+ QButtonGroup* RangeRB = new QButtonGroup( RangeGroup );
+ QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup );
+ RangeGroupLayout->setSpacing( 6 );
+ RangeGroupLayout->setMargin( 11 );
+
+ CBLog = new QCheckBox( tr( "LOGARITHMIC_SCALING" ), RangeGroup );
+
+ RBFrange = new QRadioButton( tr( "FIELD_RANGE_BTN" ), RangeGroup );
+ RBIrange = new QRadioButton( tr( "IMPOSED_RANGE_BTN" ), RangeGroup );
+ RangeRB->addButton( RBFrange, 0 );
+ RangeRB->addButton( RBIrange, 1 );
+ RBFrange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator( this ) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel( tr( "LBL_MIN" ), RangeGroup );
+ MinLabel->setBuddy( MinEdit );
+
+ MaxEdit = new QLineEdit( RangeGroup );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator( this ) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel( tr( "LBL_MAX" ), RangeGroup );
+ MaxLabel->setBuddy( MaxEdit );
+
+ RangeGroupLayout->addWidget( CBLog, 1, 0, 1, 4 );
+ RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2 );
+ RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2 );
+ RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 3, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
+
+ // Colors and Labels ========================================================
+ QGroupBox* ColLabGroup = new QGroupBox( tr( "COLORS_LABELS_GRP" ), this );
+ QHBoxLayout* ColLabGroupLayout = new QHBoxLayout( ColLabGroup );
+ ColLabGroupLayout->setSpacing( 6 );
+ ColLabGroupLayout->setMargin( 11 );
+
+ QLabel* ColorLabel = new QLabel( tr( "LBL_NB_COLORS" ), ColLabGroup );
+ ColorSpin = new QSpinBox( ColLabGroup );
+ ColorSpin->setMinimum( 2 );
+ ColorSpin->setMaximum( 256 );
+ ColorSpin->setSingleStep( 1 );
+ ColorSpin->setMinimumWidth( 70 );
+ ColorSpin->setValue( 64 );
+
+ QLabel* LabelLabel = new QLabel( tr( "LBL_NB_LABELS" ), ColLabGroup );
+ LabelSpin = new QSpinBox( ColLabGroup );
+ LabelSpin->setMinimum( 2 );
+ LabelSpin->setMaximum( 65 );
+ LabelSpin->setSingleStep( 1 );
+ LabelSpin->setMinimumWidth( 70 );
+ LabelSpin->setValue( 5 );
+
+ ColLabGroupLayout->addWidget( ColorLabel );
+ ColLabGroupLayout->addWidget( ColorSpin );
+ ColLabGroupLayout->addWidget( LabelLabel );
+ ColLabGroupLayout->addWidget( LabelSpin );
+
+ // Orientation ==========================================================
+ QGroupBox* OrientGroup = new QGroupBox( tr( "ORIENTATION_GRP" ), this );
+ QButtonGroup* OrientRB = new QButtonGroup( OrientGroup );
+ QHBoxLayout* OrientGroupLayout = new QHBoxLayout( OrientGroup );
+ OrientGroupLayout->setSpacing( 6 );
+ OrientGroupLayout->setMargin( 11 );
+
+ RBvert = new QRadioButton( tr( "VERTICAL_BTN" ), OrientGroup );
+ RBhori = new QRadioButton( tr( "HORIZONTAL_BTN" ), OrientGroup );
+ OrientRB->addButton( RBvert, 0 );
+ OrientRB->addButton( RBhori, 1 );
+ RBvert->setChecked( true );
+ OrientGroupLayout->addWidget( RBvert );
+ OrientGroupLayout->addWidget( RBhori );
+
+ // Origin ===============================================================
+ QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_GRP" ), this );
+ QHBoxLayout* OriginGroupLayout = new QHBoxLayout( OriginGroup );
+ OriginGroupLayout->setSpacing( 6 );
+ OriginGroupLayout->setMargin( 11 );
+
+ QLabel* XLabel = new QLabel( tr( "LBL_X" ), OriginGroup );
+ XSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ XSpin->setMinimumWidth( 70 );
+ XSpin->setValue( 0.01 );
+
+ QLabel* YLabel = new QLabel( tr( "LBL_Y" ), OriginGroup );
+ YSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ YSpin->setMinimumWidth( 70 );
+ YSpin->setValue( 0.01 );
+
+ OriginGroupLayout->addWidget( XLabel );
+ OriginGroupLayout->addWidget( XSpin );
+ OriginGroupLayout->addWidget( YLabel );
+ OriginGroupLayout->addWidget( YSpin );
+
+ // Dimensions =========================================================
+ QGroupBox* DimGroup = new QGroupBox( tr( "DIMENSIONS_GRP" ), this );
+ QHBoxLayout* DimGroupLayout = new QHBoxLayout( DimGroup );
+ DimGroupLayout->setSpacing( 6 );
+ DimGroupLayout->setMargin( 11 );
+
+ QLabel* WidthLabel = new QLabel( tr( "LBL_WIDTH" ), DimGroup );
+ WidthSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ WidthSpin->setMinimumWidth( 70 );
+ WidthSpin->setValue( 0.1 );
+
+ QLabel* HeightLabel = new QLabel( tr( "LBL_HEIGHT" ), DimGroup );
+ HeightSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ HeightSpin->setMinimumWidth( 70 );
+ HeightSpin->setValue( 0.8 );
+
+ DimGroupLayout->addWidget( WidthLabel );
+ DimGroupLayout->addWidget( WidthSpin );
+ DimGroupLayout->addWidget( HeightLabel );
+ DimGroupLayout->addWidget( HeightSpin );
+
+ myTextBtn = new QPushButton( tr( "Text properties..." ), this );
+ myBarBtn = new QPushButton( tr( "Bar properties..." ), this );
+
+ // main layout =========================================================
+
+ topLayout->addWidget( RangeGroup, 0, 0, 1, 2 );
+ topLayout->addWidget( ColLabGroup, 1, 0, 1, 2 );
+ topLayout->addWidget( OrientGroup, 2, 0, 1, 2 );
+ topLayout->addWidget( OriginGroup, 3, 0, 1, 2 );
+ topLayout->addWidget( DimGroup, 4, 0, 1, 2 );
+ topLayout->addWidget( myTextBtn, 5, 0 );
+ topLayout->addWidget( myBarBtn, 5, 1 );
+
+ // init ================================================================
+
+ myTextDlg = new VisuGUI_TextPrefDlg( this );
+ myTextDlg->setTitleVisible( true );
+ myBarDlg = new VisuGUI_BarPrefDlg( this );
+
+ if ( RBvert->isChecked() ) {
+ myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ } else {
+ myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ }
+
+ myBarDlg->setLabelsFormat( aResourceMgr->stringValue( "VISU", propertyName + "label_format", "%-#6.3g" ) );
+ myBarDlg->setUnitsVisible( aResourceMgr->booleanValue( "VISU", propertyName + "display_units", true ) );
+
+ // signals and slots connections ===========================================
+ connect( RangeRB, SIGNAL( buttonClicked( int ) ), this, SLOT( changeRange( int ) ) );
+ connect( OrientRB, SIGNAL( buttonClicked( int ) ), this, SLOT( changeDefaults( int ) ) );
+ connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+ connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+ connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
+ changeDefaults( 0 );
+ myIsStoreTextProp = true;
+ myBusy = false;
+}
+
+//----------------------------------------------------------------------------
+
+void VisuGUI_TableScalarBarPane::onBarPref()
+{
+ if ( RBvert->isChecked() )
+ myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ else
+ myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ if ( myBarDlg->exec() ) {
+ if ( RBvert->isChecked() )
+ myBarDlg->getRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ else
+ myBarDlg->getRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ }
+}
+
+//----------------------------------------------------------------------------
+/**
+ * Initialise dialog box from presentation object
+ */
+void VisuGUI_TableScalarBarPane::initFromPrsObject( VISU::PointMap3d_i* thePrs )
+{
+ myBarPrs = dynamic_cast<VISU::PointMap3d_i*>( thePrs );
+
+ if ( !myBarPrs )
+ return;
+
+ switch ( myBarPrs->GetScaling() ) {
+ case VISU::LOGARITHMIC:
+ CBLog->setChecked( true );
+ break;
+ default:
+ CBLog->setChecked( false );
+ }
+
+ setRange( myBarPrs->GetMin(), myBarPrs->GetMax(), myBarPrs->IsRangeFixed() );
+
+ setScalarBarData( myBarPrs->GetNbColors(), myBarPrs->GetLabels() );
+
+ // "Title"
+ CORBA::String_var aTitle = myBarPrs->GetTitle();
+ myTextDlg->setTitleText( aTitle.in() );
+ myTitle = aTitle.in();
+
+ vtkFloatingPointType R, G, B;
+ myBarPrs->GetTitleColor( &R, &G, &B );
+
+ setPosAndSize( myBarPrs->GetPosX(),
+ myBarPrs->GetPosY(),
+ myBarPrs->GetWidth(),
+ myBarPrs->GetHeight(),
+ myBarPrs->GetBarOrientation() );
+
+ myVerTW = myBarPrs->GetTitleWidth();
+ myVerTH = myBarPrs->GetTitleHeight();
+ myVerLW = myBarPrs->GetLabelWidth();
+ myVerLH = myBarPrs->GetLabelHeight();
+ myVerBW = myBarPrs->GetBarWidth();
+ myVerBH = myBarPrs->GetBarHeight();
+ myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+
+ myBarDlg->setLabelsFormat( myBarPrs->GetLabelsFormat() );
+ myBarDlg->setUnitsVisible( myBarPrs->IsUnitsVisible() );
+
+ myTextDlg->myTitleFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ),
+ myBarPrs->GetTitFontType(),
+ myBarPrs->IsBoldTitle(),
+ myBarPrs->IsItalicTitle(),
+ myBarPrs->IsShadowTitle() );
+
+ // "Labels"
+ myBarPrs->GetLabelColor( &R, &G, &B );
+
+ myTextDlg->myLabelFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ),
+ myBarPrs->GetLblFontType(),
+ myBarPrs->IsBoldLabel(),
+ myBarPrs->IsItalicLabel(),
+ myBarPrs->IsShadowLabel() );
+}
+
+//----------------------------------------------------------------------------
+/**
+ * Store values to presentation object
+ */
+int VisuGUI_TableScalarBarPane::storeToPrsObject( VISU::PointMap3d_i* thePrs ) {
+ if( !myBarPrs )
+ return 0;
+
+ myBarPrs->SetPosition( XSpin->value(), YSpin->value() );
+ myBarPrs->SetSize( WidthSpin->value(), HeightSpin->value() );
+
+ myBarPrs->SetRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+
+ myBarPrs->SetLabelsFormat( myBarDlg->getLabelsFormat().toLatin1().constData() );
+ myBarPrs->SetUnitsVisible( myBarDlg->isUnitsVisible() );
+
+ myBarPrs->SetBarOrientation( ( RBvert->isChecked() )? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL );
+ if ( CBLog->isChecked() )
+ myBarPrs->SetScaling( VISU::LOGARITHMIC );
+ else
+ myBarPrs->SetScaling( VISU::LINEAR );
+
+ if ( RBFrange->isChecked() ) {
+ myBarPrs->SetSourceRange();
+ } else {
+ myBarPrs->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() );
+ }
+ myBarPrs->SetNbColors( ColorSpin->value() );
+ myBarPrs->SetLabels( LabelSpin->value() );
+
+ if ( myIsStoreTextProp ) {
+ // "Title"
+ myBarPrs->SetTitle( myTextDlg->getTitleText().toLatin1().constData() );
+
+ QColor aTitColor( 255, 255, 255 );
+ int aTitleFontFamily = VTK_ARIAL;
+ bool isTitleBold = false;
+ bool isTitleItalic = false;
+ bool isTitleShadow = false;
+
+ myTextDlg->myTitleFont->GetData( aTitColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow );
+
+ myBarPrs->SetBoldTitle( isTitleBold );
+ myBarPrs->SetItalicTitle( isTitleItalic );
+ myBarPrs->SetShadowTitle( isTitleShadow );
+ myBarPrs->SetTitFontType( aTitleFontFamily );
+ myBarPrs->SetTitleColor( aTitColor.red()/255.,
+ aTitColor.green()/255.,
+ aTitColor.blue()/255. );
+
+ // "Label"
+ QColor aLblColor( 255, 255, 255 );
+ int aLabelFontFamily = VTK_ARIAL;
+ bool isLabelBold = false;
+ bool isLabelItalic = false;
+ bool isLabelShadow = false;
+
+ myTextDlg->myLabelFont->GetData( aLblColor, aLabelFontFamily, isLabelBold, isLabelItalic, isLabelShadow );
+
+ myBarPrs->SetBoldLabel( isLabelBold);
+ myBarPrs->SetItalicLabel( isLabelItalic );
+ myBarPrs->SetShadowLabel( isLabelShadow );
+ myBarPrs->SetLblFontType( aLabelFontFamily );
+ myBarPrs->SetLabelColor( aLblColor.red()/255.,
+ aLblColor.green()/255.,
+ aLblColor.blue()/255. );
+ // myIsStoreTextProp = false;
+ }
+ return 1;
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets default values and range mode
+*/
+void VisuGUI_TableScalarBarPane::setRange( double imin, double imax, bool sbRange )
+{
+ MinEdit->setText( QString::number( imin ) );
+ MaxEdit->setText( QString::number( imax ) );
+
+ if ( sbRange )
+ RBIrange->setChecked( true );
+ else
+ RBFrange->setChecked( true );
+
+ changeRange( sbRange );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when Range mode is changed
+*/
+void VisuGUI_TableScalarBarPane::changeRange( int )
+{
+ if ( RBFrange->isChecked() ) {
+ myBarPrs->SetSourceRange();
+ MinEdit->setEnabled( false );
+ MaxEdit->setEnabled( false );
+ } else {
+ myBarPrs->SetRange( myBarPrs->GetMin(), myBarPrs->GetMax() );
+ myBarPrs->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() );
+ MinEdit->setEnabled( true );
+ MaxEdit->setEnabled( true );
+ }
+
+ MinEdit->setText( QString::number( myBarPrs->GetMin() ) );
+ MaxEdit->setText( QString::number( myBarPrs->GetMax() ) );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when X,Y position is changed
+*/
+void VisuGUI_TableScalarBarPane::XYChanged( double )
+{
+ QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender();
+ if ( snd == XSpin ) {
+ WidthSpin->setMaximum( 1.0 - XSpin->value() );
+ }
+ if ( snd == YSpin ) {
+ HeightSpin->setMaximum( 1.0 - YSpin->value() );
+ }
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets size and position
+*/
+void VisuGUI_TableScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
+{
+ if ( vert ) {
+ myVerX = x;
+ myVerY = y;
+ myVerW = w;
+ myVerH = h;
+ RBvert->setChecked( true );
+ }
+ else {
+ myHorX = x;
+ myHorY = y;
+ myHorW = w;
+ myHorH = h;
+ RBhori->setChecked( true );
+ }
+ changeDefaults( 0 );
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Sets colors and labels number
+*/
+void VisuGUI_TableScalarBarPane::setScalarBarData( int colors, int labels )
+{
+ ColorSpin->setValue( colors );
+ LabelSpin->setValue( labels );
+}
+
+//----------------------------------------------------------------------------
+void VisuGUI_TableScalarBarPane::onTextPref()
+{
+ myTextDlg->storeBeginValues();
+ myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp;
+}
+
+//----------------------------------------------------------------------------
+VisuGUI_TableScalarBarPane::~VisuGUI_TableScalarBarPane()
+{
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Called when orientation is changed
+*/
+void VisuGUI_TableScalarBarPane::changeDefaults( int )
+{
+ if ( RBvert->isChecked() ) {
+ XSpin->setValue( myVerX );
+ YSpin->setValue( myVerY );
+ WidthSpin->setValue( myVerW );
+ HeightSpin->setValue( myVerH );
+ }
+ else {
+ XSpin->setValue( myHorX );
+ YSpin->setValue( myHorY );
+ WidthSpin->setValue( myHorW );
+ HeightSpin->setValue( myHorH );
+ }
+}
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+VisuGUI_Table3DDlg::VisuGUI_Table3DDlg ( SalomeApp_Module* theModule )
+ : QDialog ( VISU::GetDesktop( theModule ) )
+{
+ setModal( false );
+ setWindowTitle( tr( "TITLE" ) );
+ setSizeGripEnabled( true );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ myTabBox = new QTabWidget( this );
+ myIsoPane = new VisuGUI_Table3DPane( this );
+ myScalarBarPane = new VisuGUI_TableScalarBarPane( this );
+
+ myTabBox->addTab( myIsoPane, tr( "DLG_PREF_TITLE" ) );
+ myTabBox->addTab( myScalarBarPane, tr( "DLG_PROP_TITLE" ) );
+
+ QGroupBox* GroupButtons = new QGroupBox( this );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons );
+ buttonOk->setAutoDefault( true );
+ buttonOk->setDefault( true );
+ QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons );
+ buttonApply->setAutoDefault( true );
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons );
+ buttonCancel->setAutoDefault( true );
+ QPushButton* buttonHelp = new QPushButton( tr( "&Help" ), GroupButtons );
+ buttonHelp->setAutoDefault( true );
+
+ GroupButtonsLayout->addWidget( buttonOk );
+ GroupButtonsLayout->addWidget( buttonApply );
+ GroupButtonsLayout->addSpacing( 10 );
+ GroupButtonsLayout->addStretch();
+ GroupButtonsLayout->addWidget( buttonCancel );
+ GroupButtonsLayout->addWidget( buttonHelp );
+
+ TopLayout->addWidget( myTabBox );
+ TopLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
+}
+
+//=======================================================================
+//function : Destructor
+//purpose :
+//=======================================================================
+VisuGUI_Table3DDlg::~VisuGUI_Table3DDlg()
+{
+}
+
+//=======================================================================
+//function : onApply
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::onApply()
+{
+ storeToPrsObject( myPrsCopy );
+ myPrsCopy->UpdateActors();
+}
+
+//=======================================================================
+//function : onHelp
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::onHelp()
+{
+ // "table_3d_page.html";
+}
+
+//=======================================================================
+//function : storeToPrsObject
+//purpose :
+//=======================================================================
+int VisuGUI_Table3DDlg::storeToPrsObject( VISU::PointMap3d_i* thePrs )
+{
+ int anIsOk = myIsoPane->storeToPrsObject( thePrs );
+ anIsOk &= myScalarBarPane->storeToPrsObject( thePrs );
+
+ return anIsOk;
+}
+
+//=======================================================================
+//function : initFromPrsObject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::initFromPrsObject( VISU::PointMap3d_i* thePrs )
+{
+ myPrsCopy = thePrs;
+ myIsoPane->initFromPrsObject( thePrs );
+ myScalarBarPane->initFromPrsObject( thePrs );
+}
+
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_Table3dDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+//
+
+#ifndef VISUGUI_TABLE3D_H
+#define VISUGUI_TABLE3D_H
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include <QWidget>
+#include <string>
+
+class QTabWidget;
+class QButtonGroup;
+class QGroupBox;
+class QComboBox;
+class QCheckBox;
+class QLineEdit;
+class QRadioButton;
+class QPushButton;
+class QSpinBox;
+class QtxDoubleSpinBox;
+class VisuGUI_TextPrefDlg;
+class VisuGUI_BarPrefDlg;
+class SVTK_ViewWindow;
+class SalomeApp_Module;
+
+namespace VISU
+{
+ class PointMap3d_i;
+};
+
+class VisuGUI_Table3DPane : public QWidget
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_Table3DPane( QWidget* );
+ ~VisuGUI_Table3DPane();
+
+ void initFromPrsObject( VISU::PointMap3d_i* );
+ int storeToPrsObject( VISU::PointMap3d_i* );
+
+ VISU::PointMap3d_i* GetPrs();
+
+private slots:
+ void onPrsType( int );
+
+private:
+ bool myInitFromPrs;
+
+ SVTK_ViewWindow* myViewWindow;
+ VISU::PointMap3d_i* myPrs;
+
+ QtxDoubleSpinBox* ScaleSpn;
+ QGroupBox* GBPrsTypeBox;
+ QButtonGroup* GBPrsType;
+ QSpinBox* NbContoursSpn;
+};
+
+class VisuGUI_TableScalarBarPane : public QWidget
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_TableScalarBarPane( QWidget* );
+ ~VisuGUI_TableScalarBarPane();
+
+ void setRange( double, double, bool );
+ void setDefaultRange( double, double );
+ int getOrientation();
+ void setPosAndSize( double, double, double, double, bool );
+ void setScalarBarData( int, int );
+ bool isIRange();
+ double getMin();
+ double getMax();
+ double getX();
+ double getY();
+ double getWidth();
+ double getHeight();
+ int getNbColors();
+ int getNbLabels();
+ bool isLogarithmic();
+ void setLogarithmic( bool on );
+ // bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
+
+ void storeToResources();
+
+ void initFromPrsObject( VISU::PointMap3d_i* );
+ int storeToPrsObject( VISU::PointMap3d_i* );
+
+ bool check();
+
+private slots:
+ void changeDefaults( int );
+ void changeRange( int );
+ void XYChanged( double );
+ void changeScalarMode( int );
+ void onTextPref();
+ void onBarPref();
+
+private:
+ QGroupBox* RangeGroup;
+ QRadioButton* RBFrange;
+ QRadioButton* RBIrange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+
+ QRadioButton* RBhori;
+ QRadioButton* RBvert;
+
+ QtxDoubleSpinBox* XSpin;
+ QtxDoubleSpinBox* YSpin;
+
+ QtxDoubleSpinBox* WidthSpin;
+ QtxDoubleSpinBox* HeightSpin;
+
+ QSpinBox* ColorSpin;
+ QSpinBox* LabelSpin;
+
+ QCheckBox* CBSave;
+ QCheckBox* CBLog;
+ QComboBox* myModeCombo;
+ QPushButton* myTextBtn;
+ QPushButton* myBarBtn;
+ VisuGUI_TextPrefDlg* myTextDlg;
+ VisuGUI_BarPrefDlg* myBarDlg;
+
+ double myHorX, myHorY, myHorW, myHorH;
+ double myVerX, myVerY, myVerW, myVerH;
+ int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
+ int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ bool myIsStoreTextProp;
+
+ std::string myTitle;
+ VISU::PointMap3d_i* myBarPrs;
+
+ bool myBusy;
+};
+
+///////////////////////////////////////////////////////
+
+class VisuGUI_Table3DDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_Table3DDlg( SalomeApp_Module* );
+ ~VisuGUI_Table3DDlg();
+
+ virtual void initFromPrsObject( VISU::PointMap3d_i* );
+ virtual int storeToPrsObject( VISU::PointMap3d_i* );
+
+protected slots:
+ void onHelp();
+ void onApply();
+
+private:
+ QTabWidget* myTabBox;
+ VisuGUI_Table3DPane* myIsoPane;
+ VisuGUI_TableScalarBarPane* myScalarBarPane;
+
+ SALOME::GenericObjPtr<VISU::PointMap3d_i> myPrsCopy;
+};
+
+#endif // VISUGUI_TABLE3D_H
PlotTable(theModule, aTable, VISU::eErase );
break;
}
+ case VISU::TPOINTMAP3D: {
+ if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(theBase)) {
+ if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+ if(VISU_ActorBase* anActor = FindActorBase(aViewWindow, aTable3d)){
+ anActor->VisibilityOff();
+ if(theDoRepaint)
+ aViewWindow->Repaint();
+ }
+ }
+ }
+ break;
+ }
default: {
if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(theBase)){
if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
#include "VISU_Prs3d_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_Actor.h"
VISU_MultiResult_i.hh \
VISU_PrsObject_i.hh \
VISU_Table_i.hh \
+ VISU_PointMap3d_i.hh \
VISU_Prs3d_i.hh \
VISU_Mesh_i.hh \
VISU_ColoredPrs3d_i.hh \
VISU_TimeAnimation.cxx \
VISU_View_i.cc \
VISU_Table_i.cc \
+ VISU_PointMap3d_i.cc \
VISU_DumpPython.cc \
SALOME_GenericObjPointer.cc
return VISU::TCURVE;
if ( theComment == "TABLE" )
return VISU::TTABLE;
+ if ( theComment == "POINTMAP3D" )
+ return VISU::TPOINTMAP3D;
if ( theComment == "CONTAINER" )
return VISU::TCONTAINER;
if ( theComment == "MESH" )
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
-::SetBarOrientation(VISU::ColoredPrs3d::Orientation theOrientation)
+::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation)
{
if(myOrientation == theOrientation)
return;
}
//----------------------------------------------------------------------------
-VISU::ColoredPrs3d::Orientation
+VISU::ColoredPrs3dBase::Orientation
VISU::ColoredPrs3d_i
::GetBarOrientation()
{
// Orientation
int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
if(anOrientation == 1)
- SetBarOrientation(VISU::ColoredPrs3d::HORIZONTAL);
+ SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
else
- SetBarOrientation(VISU::ColoredPrs3d::VERTICAL);
+ SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
// Scalar Bar origin
QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
- vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3d::VERTICAL) ? 0.01 : 0.2;
+ vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2;
aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
myPosition[0] = aXorigin;
- vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3d::VERTICAL) ? 0.1 : 0.012;
+ vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012;
aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
myPosition[1] = aYorigin;
// Scalar Bar size
- myWidth = (myOrientation == VISU::ColoredPrs3d::VERTICAL)? 0.1 : 0.6;
+ myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6;
myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
- myHeight = (myOrientation == VISU::ColoredPrs3d::VERTICAL)? 0.8:0.12;
+ myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
myTitleWidth = 0;
if (anIsArrangeBar){
aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
}
- if(myOrientation == VISU::ColoredPrs3d::HORIZONTAL){
+ if(myOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
myPosition[1] += myHeight*(aPlace-1);
} else {
myPosition[0] += myWidth*(aPlace-1);
SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().data());
- SetBarOrientation((VISU::ColoredPrs3d::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
+ SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().data());
myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
virtual
void
- SetBarOrientation(VISU::ColoredPrs3d::Orientation theOrientation);
+ SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
virtual
- VISU::ColoredPrs3d::Orientation
+ VISU::ColoredPrs3dBase::Orientation
GetBarOrientation();
virtual
int myNumberOfLabels;
std::string myLabelsFormat;
- VISU::ColoredPrs3d::Orientation myOrientation;
+ VISU::ColoredPrs3dBase::Orientation myOrientation;
vtkFloatingPointType myPosition[2],
myWidth, myHeight,
myTitleWidth, myTitleHeight,
vtkIdType aDataType = VTK_DOUBLE;
SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(myField);
- if(aFieldDouble->_is_nil())
- aDataType = VTK_LONG;
+ if(aFieldDouble->_is_nil()) {
+ // PAL18313: Mandriva 64 porting: CRASH at creating presentation on "Import Structure".
+ if (sizeof(long) == 4 ) // Size of CORBA::Long is always 4 (see CORBA_basetypes.h)
+ aDataType = VTK_LONG;
+ else if (sizeof(int) == 4)
+ aDataType = VTK_INT;
+ else {
+ throw std::runtime_error("Can't map CORBA::Long to a VTK type");
+ }
+ }
aField->Init(myField->getNumberOfComponents(), aDataType);
if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
vtkIdType aDataType = VTK_DOUBLE;
SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
- if(aFieldDouble->_is_nil())
- aDataType = VTK_LONG;
+ if(aFieldDouble->_is_nil()) {
+ // PAL18313: Mandriva 64 porting: CRASH at creating presentation on "Import Structure".
+ if (sizeof(long) == 4 ) // Size of CORBA::Long is always 4 (see CORBA_basetypes.h)
+ aDataType = VTK_LONG;
+ else if (sizeof(int) == 4)
+ aDataType = VTK_INT;
+ else {
+ MESSAGE("Can't map CORBA::Long to a VTK type, for Field " << aFieldName);
+ continue;
+ }
+ }
aField->Init(aMEDField->getNumberOfComponents(), aDataType);
if(MYDEBUG)
{
//----------------------------------------------------------------------------
class VISU_I_EXPORT CutLines_i : public virtual POA_VISU::CutLines,
- public virtual ScalarMap_i
+ public virtual ScalarMap_i
{
static int myNbPresent;
CutLines_i(const CutLines_i&);
std::string aParam;
switch(theServant->GetBarOrientation()){
- case ColoredPrs3d::HORIZONTAL:
+ case ColoredPrs3dBase::HORIZONTAL:
aParam = "VISU.ColoredPrs3d.HORIZONTAL";
break;
- case ColoredPrs3d::VERTICAL:
+ case ColoredPrs3dBase::VERTICAL:
aParam = "VISU.ColoredPrs3d.VERTICAL";
break;
}
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
-::UpdateActor(VISU_Actor* theActor)
+::UpdateActor(VISU_ActorBase* theActor)
{
if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl();
virtual
void
- UpdateActor(VISU_Actor* theActor);
+ UpdateActor(VISU_ActorBase* theActor);
virtual
void
#include "VISU_Prs3d_i.hh"
#include "VISU_Mesh_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
#include "VISU_TimeAnimation.h"
#include "VISU_ColoredPrs3dFactory.hh"
{
if(myStudyDocument->GetProperties()->IsLocked())
return SALOMEDS::SObject::_nil();
+
SALOMEDS::SObject_var aRes = VISU::ImportTables(theFileName,myStudyDocument);
+
+ SALOMEDS::Study_var aStudy = aRes->GetStudy();
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aRes);
+ for (; anIter->More(); anIter->Next()) {
+ SALOMEDS::SObject_var SO = anIter->Value();
+ CreateTable( SO->GetID() );
+ }
+
return aRes._retn();
}
theIteration)._retn();
}
-
//---------------------------------------------------------------
struct CreateTableEvent: public SALOME_Event
{
typedef Table_ptr TResult;
TResult myResult;
- CreateTableEvent(const SALOMEDS::Study_var& theStudy, const char* theTableEntry)
+ CreateTableEvent(SALOMEDS::Study_var theStudy, const char* theTableEntry)
{
myStudyDocument = theStudy;
myTableEntry = theTableEntry;
void
Execute()
{
+ SALOMEDS::SObject_var SO = myStudyDocument->FindObjectID(myTableEntry);
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( SO->FindAttribute(anAttr, "AttributeTableOfReal") ) {
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ if ( isSparseMatrix( aTableOfReal ) ) {
+ PointMap3d_i* pPresent = new PointMap3d_i(myStudyDocument,myTableEntry);
+ if(pPresent->Create() != NULL)
+ myResult = pPresent->_this();
+ else {
+ pPresent->_remove_ref();
+ myResult = VISU::Table::_nil();
+ }
+ return;
+ }
+ }
Table_i* pPresent = new Table_i(myStudyDocument,myTableEntry);
if(pPresent->Create() != NULL)
myResult = pPresent->_this();
- else{
+ else {
pPresent->_remove_ref();
myResult = VISU::Table::_nil();
}
}
- };
+ virtual
+ bool
+ isSparseMatrix(SALOMEDS::AttributeTableOfReal_var theTableOfReal)
+ {
+ int aCols = theTableOfReal->GetNbColumns();
+ int aRows = theTableOfReal->GetNbRows();
+
+ for (int i=1; i<=aCols; i++) {
+ for (int j=1; j<=aRows; j++) {
+ if ( !(theTableOfReal->HasValue(j, i)) )
+ return false;
+ }
+ }
+ return true;
+ }
+ };
//---------------------------------------------------------------
Table_ptr
{
if(myStudyDocument->GetProperties()->IsLocked())
return Table::_nil();
- Mutex mt(myMutex);
+
return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry));
}
-
//---------------------------------------------------------------
Curve_ptr
VISU_Gen_i
//----------------------------------------------------------------------------
void
VISU::Mesh_i
-::UpdateActor(VISU_Actor* theActor)
+::UpdateActor(VISU_ActorBase* theActor)
{
if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
virtual
void
- UpdateActor(VISU_Actor* theActor);
+ UpdateActor(VISU_ActorBase* theActor);
};
}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : VISU_PointMap3d_i.cc
+// Author : Vadim SANDLER
+// Module : VISU
+
+#include "VISU_PointMap3d_i.hh"
+
+#include "VISU_CutLines_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_ScalarBarActor.hxx"
+#include "SUIT_ResourceMgr.h"
+
+#include "SALOME_Event.h"
+#include "VISU_Prs3dUtils.hh"
+#include "SPlot2d_Curve.h"
+#include "VISU_PipeLineUtils.hxx"
+
+#include "VISU_TableReader.hxx"
+#include "VISU_ConvertorUtils.hxx"
+#include "VISU_DeformedGridPL.hxx"
+
+#include "SALOME_InteractiveObject.hxx"
+#include "VISU_Gen_i.hh"
+
+#include <vtkTextProperty.h>
+#include <vtkActorCollection.h>
+
+#include <boost/bind.hpp>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------
+// PointMap3d Object
+//----------------------------------------------------------------
+int VISU::PointMap3d_i::myNbPresent = 0;
+const string VISU::PointMap3d_i::myComment = "POINTMAP3D";
+/*!
+ Generate unique name
+*/
+QString VISU::PointMap3d_i::GenerateName()
+{
+ return VISU::GenerateName( "Table3D - ", ++myNbPresent );
+}
+/*!
+ Gets comment string
+*/
+const char* VISU::PointMap3d_i::GetComment() const
+{
+ return myComment.c_str();
+}
+/*!
+ Constructor
+*/
+VISU::PointMap3d_i::PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
+ : Table_i(theStudy, theObjectEntry),
+ myActorCollection(vtkActorCollection::New()),
+ myIsActiveState(true)
+{
+ MESSAGE("PointMap3d_i::PointMap3d_i - "<<this);
+ SetStudyDocument(theStudy);
+ mySObj = theStudy->FindObjectID(theObjectEntry);
+ myOffset[0] = myOffset[1] = myOffset[2] = 0;
+ myActorCollection->Delete();
+}
+/*!
+ Destructor
+*/
+VISU::PointMap3d_i::~PointMap3d_i()
+{
+ MESSAGE("PointMap3d_i::~PointMap3d_i - "<<this);
+}
+
+//----------------------------------------------------------------------------
+namespace VISU
+{
+ struct TInvokeSignalEvent: public SALOME_Event
+ {
+ typedef boost::signal0<void> TSignal;
+ const TSignal& mySignal;
+
+ TInvokeSignalEvent(const TSignal& theSignal):
+ mySignal(theSignal)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ mySignal();
+ }
+ };
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::PointMap3d_i
+::SetTitle( const char* theTitle )
+{
+ SetName( theTitle, true );
+}
+
+//----------------------------------------------------------------------------
+char*
+VISU::PointMap3d_i
+::GetTitle()
+{
+ return CORBA::string_dup( GetName().c_str() );
+}
+
+//----------------------------------------------------------------------------
+SALOMEDS::SObject_var
+VISU::PointMap3d_i
+::GetSObject() const
+{
+ return mySObj;
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::PointMap3d_i
+::GetObjectEntry()
+{
+ CORBA::String_var anEntry = mySObj->GetID();
+ return anEntry.in();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ Creates table3d object
+*/
+VISU::Storable* VISU::PointMap3d_i::Create()
+{
+ // generate name ...
+ SetName(GetTableTitle().toLatin1().constData(), false);
+
+ if ( GetName() == "" ) {
+ if ( !mySObj->_is_nil() ) {
+ CutLines_i* pCutLines = NULL;
+ CORBA::Object_var anObj = SObjectToObject(mySObj);
+ if(!CORBA::is_nil(anObj)){
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+ if(!aCutLines->_is_nil())
+ pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+ }
+ if (!pCutLines)
+ if (mySObj->GetName()) SetName(mySObj->GetName(), false);
+ }
+ }
+
+ if ( GetName() == "" )
+ SetName(GenerateName().toLatin1().constData(), false);
+
+ // Create Pipeline
+ myTablePL = VISU_DeformedGridPL::New();
+ myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
+ myTablePL->Update();
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
+ SetUnitsVisible(isUnits);
+
+ QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
+ SetLabelsFormat(aLabelsFormat.toLatin1().constData());
+
+ // Orientation
+ int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
+ if(anOrientation == 1)
+ SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
+ else
+ SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
+
+ // Scalar Bar origin
+ QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
+
+ vtkFloatingPointType aXorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2;
+ aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
+ myPosition[0] = aXorigin;
+
+ vtkFloatingPointType aYorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012;
+ aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
+ myPosition[1] = aYorigin;
+
+ // Scalar Bar size
+ myWidth = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6;
+ myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
+
+ myHeight = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
+ myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
+
+ myTitleWidth = aResourceMgr->doubleValue("VISU", propertyName + "title_width", 0);
+ myTitleHeight = aResourceMgr->doubleValue("VISU", propertyName + "title_height", 0);
+ myLabelWidth = aResourceMgr->doubleValue("VISU", propertyName + "label_width", 0);
+ myLabelHeight = aResourceMgr->doubleValue("VISU", propertyName + "label_height", 0);
+ myBarWidth = aResourceMgr->doubleValue("VISU", propertyName + "bar_width", 0);
+ myBarHeight = aResourceMgr->doubleValue("VISU", propertyName + "bar_height", 0);
+
+ // Nb of Labels
+ myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
+
+ // Fonts properties definition
+ myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
+ myTitFontType = VTK_ARIAL;
+
+ if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+ if ( f.family() == "Arial" )
+ myTitFontType = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ myTitFontType = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ myTitFontType = VTK_TIMES;
+
+ myIsBoldTitle = f.bold();
+ myIsItalicTitle = f.italic();
+ myIsShadowTitle = f.underline();
+ }
+
+ QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+
+ myTitleColor[0] = aTextColor.red() / 255;
+ myTitleColor[1] = aTextColor.green() / 255;
+ myTitleColor[2] = aTextColor.blue() / 255;
+
+ myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
+ myLblFontType = VTK_ARIAL;
+
+ if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
+ QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+ if ( f.family() == "Arial" )
+ myLblFontType = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ myLblFontType = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ myLblFontType = VTK_TIMES;
+
+ myIsBoldLabel = f.bold();
+ myIsItalicLabel = f.italic();
+ myIsShadowLabel = f.underline();
+ }
+
+ QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+
+ myLabelColor[0] = aLabelColor.red() / 255;
+ myLabelColor[1] = aLabelColor.green() / 255;
+ myLabelColor[2] = aLabelColor.blue() / 255;
+
+ // scalar bar default position
+ bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
+ int aPlace = 1;
+ if (anIsArrangeBar){
+ aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
+ }
+ if(myBarOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
+ myPosition[1] += myHeight*(aPlace-1);
+ } else {
+ myPosition[0] += myWidth*(aPlace-1);
+ }
+
+ return Build( false );
+}
+
+/*
+ GetIDMapper
+*/
+
+VISU::PTableIDMapper
+VISU::PointMap3d_i
+::GetTableIDMapper()
+{
+ //Initialisate table mapper
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ PTableIDMapper aTableIDMapper( new TTableIDMapper() );
+ TTable2D& aTable2D = *aTableIDMapper;
+
+ aTable2D.myTitle = aTableOfReal->GetTitle();
+
+ SALOMEDS::StringSeq_var aColStrList = aTableOfReal->GetColumnTitles();
+ SALOMEDS::StringSeq_var aRowStrList = aTableOfReal->GetRowTitles();
+
+ for ( int i = 0; i < aRowStrList->length(); i++ ) {
+ aTable2D.myColumnTitles.push_back( aRowStrList[ i ].in() );
+ }
+
+ int aCols = aTableOfReal->GetNbColumns();
+ int aRows = aTableOfReal->GetNbRows();
+
+ for (int i=1; i<=aCols; i++) {
+ TTable2D::TRow aRow;
+ aRow.myTitle = aColStrList[ i-1 ].in();
+ for (int j=1; j<=aRows; j++) {
+ double aVal = aTableOfReal->GetValue(j, i);
+ QString aValStr = QString::number(aVal);
+ aRow.myValues.push_back( aValStr.toLatin1().constData() );
+ }
+ if( aRow.myValues.size() > 0 )
+ aTable2D.myRows.push_back( aRow );
+ }
+
+ return aTableIDMapper;
+}
+
+/*
+ Create Actor
+*/
+VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor()
+{
+ VISU_PointMap3dActor* anActor = VISU_PointMap3dActor::New();
+ anActor->SetPipeLine(myTablePL);
+ anActor->SetFactory(this);
+
+ Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str());
+ anActor->setIO(anIO);
+
+ myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,anActor));
+ // myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,anActor));
+
+ myActorCollection->AddItem(anActor);
+
+ UpdateActor( anActor );
+
+ return anActor;
+}
+
+/*
+ Update Actor
+*/
+void VISU::PointMap3d_i::UpdateActor(VISU_ActorBase* theActor)
+{
+ if(VISU_PointMap3dActor* anActor = dynamic_cast<VISU_PointMap3dActor*>(theActor)){
+ VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
+ aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
+ aScalarBar->SetTitle(GetTitle());
+ aScalarBar->SetOrientation(GetBarOrientation());
+ aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
+ aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
+ aScalarBar->SetWidth(GetWidth());
+ aScalarBar->SetHeight(GetHeight());
+ aScalarBar->SetNumberOfLabels(GetLabels());
+ aScalarBar->SetRatios(myTitleWidth, myTitleHeight,
+ myLabelWidth, myLabelHeight,
+ myBarWidth, myBarHeight);
+ aScalarBar->SetNumberOfLabels(GetLabels());
+ aScalarBar->SetLabelFormat(GetLabelsFormat());
+
+ vtkFloatingPointType anRGB[3];
+
+ vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
+ aTitleProp->SetFontFamily(GetTitFontType());
+
+ GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+ IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+ IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+
+ vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
+ aLabelProp->SetFontFamily(GetLblFontType());
+
+ GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
+ aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+ IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+ IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
+ aScalarBar->Modified();
+ }
+ theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+}
+
+void
+VISU::PointMap3d_i
+::UpdateActors()
+{
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_PipeLine>
+ (GetSpecificPL(), &VISU_PipeLine::Update));
+
+ ProcessVoidEvent(new VISU::TInvokeSignalEvent(myUpdateActorsSignal));
+}
+
+/*!
+ Builds presentation of table
+*/
+VISU::Storable* VISU::PointMap3d_i::Build( int theRestoring )
+{
+
+ // look for reference SObject with table attribute
+ SALOMEDS::SObject_var SO = mySObj;
+
+ if ( !SO->_is_nil() ) {
+ CutLines_i* pCutLines = NULL;
+ CORBA::Object_var anObj = SObjectToObject(SO);
+ if(!CORBA::is_nil(anObj)){
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
+ if(!aCutLines->_is_nil())
+ pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
+ }
+ SALOMEDS::Study_var aStudy = GetStudyDocument();
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ // look for component
+ if ( !theRestoring ) {
+ SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
+ // create SObject and set attributes
+ QString aComment;
+ if(pCutLines)
+ aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment());
+ else{
+ aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment());
+ SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
+ if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){
+ SALOMEDS::AttributeString_var aCommentAttr =
+ SALOMEDS::AttributeString::_narrow(anAttr);
+ CORBA::String_var aValue = aCommentAttr->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StringToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ if(anIsExist){
+ if(aMethodName == "ImportTables"){
+ aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
+ }
+ }
+ }
+ }
+
+ string anEntry = CreateAttributes( GetStudyDocument(),
+ SO->GetID(),//SComponent->GetID(),
+ "ICON_TREE_TABLE",
+ GetID(),
+ GetName(),
+ "",
+ aComment.toLatin1().constData(),
+ pCutLines );
+ // create SObject referenced to real table object
+ mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() ));
+ if(pCutLines) {
+ pCutLines->BuildTableOfReal(mySObj);
+ }
+ // mpv (PAL5357): reference attributes are unnecessary now
+ //SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj );
+ //Builder->Addreference( refSO, SO );
+ }
+
+ return this;
+ }
+ return NULL;
+}
+/*!
+ Restores table object from stream
+*/
+VISU::Storable* VISU::PointMap3d_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
+{
+ if(MYDEBUG) MESSAGE(GetComment());
+ SetName(VISU::Storable::FindValue(theMap,"myName").toLatin1().constData(), false);
+ myTitle = VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData();
+ myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
+ mySObj = SALOMEDS::SObject::_duplicate(SO);
+
+ //Create PipeLine
+ myTablePL = VISU_DeformedGridPL::New();
+ myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
+ myTablePL->Update();
+
+ //Restore Other Values
+
+ float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
+ float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
+ SetRange(aMin, aMax);
+
+ UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
+
+ SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
+ SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
+ SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().constData());
+ SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myBarOrientation").toInt());
+
+ SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData());
+ myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
+ myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
+ myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
+ myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
+ myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+ myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt();
+ myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt();
+ myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt();
+ myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt();
+ myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
+ myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
+
+ myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
+ myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
+ myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
+ myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
+ myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
+ myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
+ myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
+
+ myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
+ myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
+ myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
+ myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
+ myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
+ myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
+ myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+
+ myParamsTime.Modified();
+ return Build( true );
+}
+/*!
+ Flushes table data into stream
+*/
+void VISU::PointMap3d_i::ToStream( std::ostringstream& theStr )
+{
+ Storable::DataToStream( theStr, "myName", GetName().c_str() );
+ Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
+ Storable::DataToStream( theStr, "myOrientation", myOrientation );
+
+ Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
+ Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
+ Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
+
+ Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
+ Storable::DataToStream( theStr, "myBarOrientation", myBarOrientation );
+
+ Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
+ Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits );
+ Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+ Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() );
+ Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
+ Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
+ Storable::DataToStream( theStr, "myWidth", myWidth );
+ Storable::DataToStream( theStr, "myHeight", myHeight );
+ Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth );
+ Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight );
+ Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth );
+ Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight );
+ Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
+ Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
+
+ Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
+ Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
+ Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle );
+ Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle );
+ Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] );
+ Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] );
+ Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] );
+
+ Storable::DataToStream( theStr, "myLblFontType", myLblFontType );
+ Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel );
+ Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel );
+ Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel );
+ Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
+ Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
+ Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
+}
+/*!
+ Called from engine to restore table from the file
+*/
+VISU::Storable* VISU::PointMap3d_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile)
+{
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+ VISU::PointMap3d_i* pResent = new VISU::PointMap3d_i( aStudy, "" );
+ return pResent->Restore( theMap, theSObject);
+}
+/*!
+ Gets title for the original table object
+*/
+QString VISU::PointMap3d_i::GetTableTitle()
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeTableOfInteger_var anInt;
+ SALOMEDS::AttributeTableOfReal_var aReal;
+ if ( !SO->_is_nil() ) {
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ CORBA::String_var aString = anInt->GetTitle();
+ return aString.in();
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ CORBA::String_var aString = aReal->GetTitle();
+ return aString.in();
+ }
+ }
+ return "";
+}
+
+//---------------------------------------------------------------
+void VISU::PointMap3d_i::RemoveFromStudy()
+{
+ struct TRemoveFromStudy: public SALOME_Event
+ {
+ VISU::PointMap3d_i* myRemovable;
+ TRemoveFromStudy(VISU::PointMap3d_i* theRemovable):
+ myRemovable(theRemovable)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
+ }
+ };
+
+ // Remove the table with all curves
+ ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+//----------------------------------------------------------------
+void VISU::PointMap3d_i::SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz)
+{
+ myOffset[0] = theDx;
+ myOffset[1] = theDy;
+ myOffset[2] = theDz;
+ myParamsTime.Modified();
+}
+
+void VISU::PointMap3d_i::GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz)
+{
+ theDx = myOffset[0];
+ theDy = myOffset[1];
+ theDz = myOffset[2];
+}
+
+CORBA::Float VISU::PointMap3d_i::GetMemorySize()
+{
+ CORBA::Float aSize = GetSpecificPL()->GetMemorySize();
+
+ int anEnd = myActorCollection->GetNumberOfItems();
+ for(int anId = 0; anId < anEnd; anId++)
+ if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
+ if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
+ aSize += anActor->GetMemorySize();
+ //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
+ }
+
+ // Convert to mega bytes
+ return aSize / (1024.0 * 1024.0);
+}
+
+//------------------ ColoredPrs3dBase Methods --------------------
+CORBA::Double VISU::PointMap3d_i::GetMin()
+{
+ return myTablePL->GetScalarRange()[0];
+}
+
+CORBA::Double VISU::PointMap3d_i::GetMax()
+{
+ return myTablePL->GetScalarRange()[1];
+}
+
+void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax)
+{
+ vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType*>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScalarRange, aScalarRange));
+
+ UseFixedRange(true);
+}
+
+CORBA::Double VISU::PointMap3d_i::GetSourceMin()
+{
+ vtkFloatingPointType aRange[2];
+ GetSpecificPL()->GetSourceRange(aRange);
+ return aRange[0];
+
+ UseFixedRange(false);
+}
+
+CORBA::Double VISU::PointMap3d_i::GetSourceMax()
+{
+ vtkFloatingPointType aRange[2];
+ GetSpecificPL()->GetSourceRange(aRange);
+ return aRange[1];
+}
+
+void VISU::PointMap3d_i::SetSourceRange()
+{
+ GetSpecificPL()->SetSourceRange();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_DeformedGridPL>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetSourceRange));
+}
+
+CORBA::Boolean VISU::PointMap3d_i::IsRangeFixed()
+{
+ return myIsFixedRange;
+}
+
+void VISU::PointMap3d_i::UseFixedRange(bool theRange)
+{
+ if(myIsFixedRange == theRange)
+ return;
+
+ myIsFixedRange = theRange;
+}
+
+void VISU::PointMap3d_i::SetPosition(CORBA::Double theX, CORBA::Double theY)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX);
+ anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY);
+ if(anIsSameValue)
+ return;
+
+ myPosition[0] = theX;
+ myPosition[1] = theY;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetPosX()
+{
+ return myPosition[0];
+}
+
+CORBA::Double VISU::PointMap3d_i::GetPosY()
+{
+ return myPosition[1];
+}
+
+void VISU::PointMap3d_i::SetSize(CORBA::Double theWidth, CORBA::Double theHeight)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight);
+ if(anIsSameValue)
+ return;
+
+ myWidth = theWidth;
+ myHeight = theHeight;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetHeight()
+{
+ return myHeight;
+}
+
+CORBA::Double VISU::PointMap3d_i::GetWidth()
+{
+ return myWidth;
+}
+
+void VISU::PointMap3d_i::SetNbColors(CORBA::Long theNbColors)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetNbColors, theNbColors));
+}
+
+CORBA::Long VISU::PointMap3d_i::GetNbColors()
+{
+ return GetSpecificPL()->GetNbColors();
+}
+
+void VISU::PointMap3d_i::SetLabels(CORBA::Long theNbLabels)
+{
+ if(myNumberOfLabels == theNbLabels)
+ return;
+
+ myNumberOfLabels = theNbLabels;
+}
+
+CORBA::Long VISU::PointMap3d_i::GetLabels()
+{
+ return myNumberOfLabels;
+}
+
+void VISU::PointMap3d_i::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theBarOrientation)
+{
+ if(myBarOrientation == theBarOrientation)
+ return;
+
+ myBarOrientation = theBarOrientation;
+}
+
+VISU::ColoredPrs3dBase::Orientation VISU::PointMap3d_i::GetBarOrientation()
+{
+ return myBarOrientation;
+}
+
+//------------------- ScaledPrs3d Methods -----------------------
+
+void VISU::PointMap3d_i::SetScaling(VISU::Scaling theScaling)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScaling, theScaling));
+}
+
+VISU::Scaling VISU::PointMap3d_i::GetScaling()
+{
+ return VISU::Scaling(GetSpecificPL()->GetScaling());
+}
+
+//------------------- Plot3dBase Methods ------------------------
+
+void VISU::PointMap3d_i::SetScaleFactor (CORBA::Double theScaleFactor)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetScaleFactor, theScaleFactor));
+}
+
+CORBA::Double VISU::PointMap3d_i::GetScaleFactor ()
+{
+ return myTablePL->GetScaleFactor();
+}
+
+void VISU::PointMap3d_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, bool>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetContourPrs, theIsContourPrs));
+}
+
+CORBA::Boolean VISU::PointMap3d_i::GetIsContourPrs()
+{
+ return myTablePL->GetIsContourPrs();
+}
+
+void VISU::PointMap3d_i::SetNbOfContours (CORBA::Long theNb)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
+ (GetSpecificPL(), &VISU_DeformedGridPL::SetNumberOfContours, theNb));
+}
+
+CORBA::Long VISU::PointMap3d_i::GetNbOfContours ()
+{
+ return myTablePL->GetNumberOfContours();
+}
+
+//-------------------- Actor Factory Methods --------------------
+
+bool VISU::PointMap3d_i::GetActiveState ()
+{
+ return myIsActiveState;
+}
+
+void VISU::PointMap3d_i::SetActiveState ( bool theState )
+{
+ myIsActiveState = theState;
+}
+
+unsigned long int VISU::PointMap3d_i::GetMTime ()
+{
+ unsigned long int aTime = myParamsTime.GetMTime();
+ if( GetSpecificPL() )
+ aTime = std::max(aTime, GetSpecificPL()->GetMTime());
+ return aTime;
+}
+
+void VISU::PointMap3d_i::RemoveActor (VISU_ActorBase* theActor)
+{
+ myActorCollection->RemoveItem(theActor);
+}
+
+void VISU::PointMap3d_i::RemoveActors ()
+{
+ ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
+ myActorCollection->RemoveAllItems();
+}
+
+
+//-----------------------Text Properties & Label Properties------------------
+bool VISU::PointMap3d_i::IsBoldTitle()
+{
+ return myIsBoldTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetBoldTitle(bool theIsBoldTitle)
+{
+ if(myIsBoldTitle == theIsBoldTitle)
+ return;
+
+ myIsBoldTitle = theIsBoldTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsItalicTitle()
+{
+ return myIsItalicTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetItalicTitle(bool theIsItalicTitle)
+{
+ if(myIsItalicTitle == theIsItalicTitle)
+ return;
+
+ myIsItalicTitle = theIsItalicTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsShadowTitle()
+{
+ return myIsShadowTitle;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetShadowTitle(bool theIsShadowTitle)
+{
+ if(myIsShadowTitle == theIsShadowTitle)
+ return;
+
+ myIsShadowTitle = theIsShadowTitle;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+int VISU::PointMap3d_i::GetTitFontType()
+{
+ return myTitFontType;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetTitFontType(int theTitFontType)
+{
+ if(myTitFontType == theTitFontType)
+ return;
+
+ myTitFontType = theTitFontType;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType* theR,
+ vtkFloatingPointType* theG,
+ vtkFloatingPointType* theB)
+{
+ *theR = myTitleColor[0];
+ *theG = myTitleColor[1];
+ *theB = myTitleColor[2];
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetTitleColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB);
+ if(anIsSameValue)
+ return;
+
+ myTitleColor[0] = theR;
+ myTitleColor[1] = theG;
+ myTitleColor[2] = theB;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsBoldLabel()
+{
+ return myIsBoldLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetBoldLabel(bool theIsBoldLabel)
+{
+ if(myIsBoldLabel == theIsBoldLabel)
+ return;
+
+ myIsBoldLabel = theIsBoldLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsItalicLabel()
+{
+ return myIsItalicLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetItalicLabel(bool theIsItalicLabel)
+{
+ if(myIsItalicLabel == theIsItalicLabel)
+ return;
+
+ myIsItalicLabel = theIsItalicLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+bool VISU::PointMap3d_i::IsShadowLabel()
+{
+ return myIsShadowLabel;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetShadowLabel(bool theIsShadowLabel)
+{
+ if(myIsShadowLabel == theIsShadowLabel)
+ return;
+
+ myIsShadowLabel = theIsShadowLabel;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+int VISU::PointMap3d_i::GetLblFontType()
+{
+ return myLblFontType;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetLblFontType(int theLblFontType)
+{
+ if(myLblFontType == theLblFontType)
+ return;
+
+ myLblFontType = theLblFontType;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType* theR,
+ vtkFloatingPointType* theG,
+ vtkFloatingPointType* theB)
+{
+ *theR = myLabelColor[0];
+ *theG = myLabelColor[1];
+ *theB = myLabelColor[2];
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetLabelColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB);
+ if(anIsSameValue)
+ return;
+
+ myLabelColor[0] = theR;
+ myLabelColor[1] = theG;
+ myLabelColor[2] = theB;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetTitleWidth()
+{
+ return myTitleWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetTitleHeight()
+{
+ return myTitleHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetLabelWidth()
+{
+ return myLabelWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetLabelHeight()
+{
+ return myLabelHeight;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetBarWidth()
+{
+ return myBarWidth;
+}
+
+//----------------------------------------------------------------------------
+CORBA::Long VISU::PointMap3d_i::GetBarHeight()
+{
+ return myBarHeight;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::PointMap3d_i::SetLabelsFormat(const char* theFormat)
+{
+ if( myLabelsFormat != theFormat ){
+ myLabelsFormat = theFormat;
+ myParamsTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+char* VISU::PointMap3d_i::GetLabelsFormat()
+{
+ return CORBA::string_dup(myLabelsFormat.c_str());
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetUnitsVisible(CORBA::Boolean isVisible)
+{
+ if( myIsUnits != isVisible ){
+ myIsUnits = isVisible;
+ myParamsTime.Modified();
+ }
+}
+
+//----------------------------------------------------------------------------
+CORBA::Boolean VISU::PointMap3d_i::IsUnitsVisible()
+{
+ return myIsUnits;
+}
+
+//----------------------------------------------------------------------------
+void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight)
+{
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
+ anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
+ if(anIsSameValue)
+ return;
+
+ myTitleWidth = theTitleWidth;
+ myTitleHeight = theTitleHeight;
+ myLabelWidth = theLabelWidth;
+ myLabelHeight = theLabelHeight;
+ myBarWidth = theBarWidth;
+ myBarHeight = theBarHeight;
+ myParamsTime.Modified();
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : VISU_PointMap3d_i.hh
+// Author :
+// Module : VISU
+
+#ifndef VISU_PointMap3d_i_HeaderFile
+#define VISU_PointMap3d_i_HeaderFile
+
+#include "VISU_PrsObject_i.hh"
+#include "SALOME_GenericObj_i.hh"
+
+#include "VISU_TableReader.hxx"
+#include "VISU_PointMap3dActor.h"
+#include "VISU_Table_i.hh"
+#include "VISU_ActorFactory.h"
+#include "VISU_DeformedGridPL.hxx"
+
+#include <vtkTimeStamp.h>
+#include <vtkSmartPointer.h>
+
+namespace VISU
+{
+
+ struct TActorFactory;
+
+ //==============================================================================
+ class VISU_I_EXPORT PointMap3d_i : public virtual POA_VISU::PointMap3d,
+ public virtual SALOME::GenericObj_i,
+ public virtual TActorFactory,
+ public virtual Table_i
+ {
+ static int myNbPresent;
+ PointMap3d_i( const PointMap3d_i& );
+ public:
+ PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry);
+
+ virtual ~PointMap3d_i();
+ virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;};
+
+ virtual void SetTitle( const char* theTitle );
+ virtual char* GetTitle();
+
+ virtual void RemoveFromStudy();
+ virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor);
+ virtual void UpdateActors();
+
+ //----------- override Prs3d methods -----------------------------
+
+ //! Move the 3D presentation according to the given offset parameters
+ virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz);
+
+ //! Gets offset parameters for the 3D presentation
+ virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz);
+
+ //! Gets memory size actually used by the presentation (Mb).
+ virtual CORBA::Float GetMemorySize();
+
+ //----------- override ColoredPrs3dBase methods ------------------
+
+ virtual CORBA::Double GetMin();
+ virtual CORBA::Double GetMax();
+ virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
+
+ virtual CORBA::Double GetSourceMin();
+ virtual CORBA::Double GetSourceMax();
+ virtual void SetSourceRange();
+
+ virtual CORBA::Boolean IsRangeFixed();
+
+ virtual void SetPosition(CORBA::Double X, CORBA::Double Y);
+ virtual CORBA::Double GetPosX();
+ virtual CORBA::Double GetPosY();
+
+ virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
+
+ virtual void SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
+ CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ CORBA::Long theBarWidth, CORBA::Long theBarHeight);
+
+ virtual CORBA::Double GetWidth();
+ virtual CORBA::Double GetHeight();
+
+ virtual void SetNbColors(CORBA::Long theNbColors);
+ virtual CORBA::Long GetNbColors();
+
+ virtual void SetLabels(CORBA::Long theNbLabels);
+ virtual CORBA::Long GetLabels();
+
+ virtual void SetLabelsFormat(const char* theFormat);
+ virtual char* GetLabelsFormat();
+
+ virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
+ virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
+
+ void UseFixedRange(bool theUseFixedRange);
+
+ // ScaledMap Methods
+
+ virtual VISU::Scaling GetScaling();
+ virtual void SetScaling(VISU::Scaling theScaling);
+
+ // Plot3dBase methods
+
+ void SetScaleFactor (CORBA::Double theScaleFactor);
+ double GetScaleFactor();
+
+ void SetContourPrs (CORBA::Boolean theIsContourPrs );
+ bool GetIsContourPrs();
+
+ void SetNbOfContours (CORBA::Long);
+ long GetNbOfContours();
+
+ VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; }
+
+ // TActorFactory Methods
+
+ //! Gets know whether the factory instance can be used for actor management or not
+ virtual bool GetActiveState();
+
+ virtual void SetActiveState(bool theState);
+
+ //! Return modified time of the factory
+ virtual unsigned long int GetMTime();
+
+ //! To unregister the actor
+ virtual void RemoveActor(VISU_ActorBase* theActor);
+ virtual void RemoveActors();
+
+ //------ Text Properties & Label Properties ------------------------
+
+ virtual bool IsBoldTitle();
+ virtual void SetBoldTitle(bool isBold);
+ virtual bool IsItalicTitle();
+ virtual void SetItalicTitle(bool isItalic);
+ virtual bool IsShadowTitle();
+ virtual void SetShadowTitle(bool isShadow);
+ virtual int GetTitFontType();
+ virtual void SetTitFontType(int theType);
+ virtual void GetTitleColor(vtkFloatingPointType* theR,
+ vtkFloatingPointType* theG,
+ vtkFloatingPointType* theB);
+ virtual void SetTitleColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB);
+
+ virtual bool IsBoldLabel();
+ virtual void SetBoldLabel(bool isBold);
+ virtual bool IsItalicLabel();
+ virtual void SetItalicLabel(bool isItalic);
+ virtual bool IsShadowLabel();
+ virtual void SetShadowLabel(bool isShadow);
+ virtual int GetLblFontType();
+ virtual void SetLblFontType(int theType);
+ virtual void GetLabelColor(vtkFloatingPointType* theR,
+ vtkFloatingPointType* theG,
+ vtkFloatingPointType* theB);
+ virtual void SetLabelColor(vtkFloatingPointType theR,
+ vtkFloatingPointType theG,
+ vtkFloatingPointType theB);
+
+ //-------------------------------------------------------------------
+ virtual CORBA::Long GetTitleWidth();
+ virtual CORBA::Long GetTitleHeight();
+ virtual CORBA::Long GetLabelWidth();
+ virtual CORBA::Long GetLabelHeight();
+ virtual CORBA::Long GetBarWidth();
+ virtual CORBA::Long GetBarHeight();
+
+ virtual void SetUnitsVisible(CORBA::Boolean isVisible);
+ virtual CORBA::Boolean IsUnitsVisible();
+
+ //-------------------------------------------------------------------
+
+ protected:
+ Storable* Build(int theRestoring);
+
+ VISU::Table::Orientation myOrientation;
+ VISU::ColoredPrs3dBase::Orientation myBarOrientation;
+ std::string myTitle;
+ std::string myScalarBarTitle;
+ bool myIsUnits;
+ SALOMEDS::SObject_var mySObj;
+ int myNumberOfLabels;
+ std::string myLabelsFormat;
+ vtkFloatingPointType myPosition[2],
+ myWidth, myHeight,
+ myTitleWidth, myTitleHeight,
+ myLabelWidth, myLabelHeight,
+ myBarWidth, myBarHeight;
+ bool myIsFixedRange;
+ CORBA::Float myOffset[3];
+ bool myIsActiveState;
+ vtkTimeStamp myParamsTime;
+
+
+ //Font management
+ bool myIsBoldTitle;
+ bool myIsItalicTitle;
+ bool myIsShadowTitle;
+ int myTitFontType;
+ vtkFloatingPointType myTitleColor[3];
+
+ bool myIsBoldLabel;
+ bool myIsItalicLabel;
+ bool myIsShadowLabel;
+ int myLblFontType;
+ vtkFloatingPointType myLabelColor[3];
+
+ boost::signal0<void> myUpdateActorsSignal;
+ boost::signal0<void> myRemoveActorsFromRendererSignal;
+ vtkSmartPointer<vtkActorCollection> myActorCollection;
+
+ public:
+ // virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper );
+ virtual Storable* Create();
+ VISU_PointMap3dActor* CreateActor();
+ VISU::PTableIDMapper GetTableIDMapper();
+
+ SALOMEDS::SObject_var GetSObject() const;
+ VISU_DeformedGridPL* myTablePL;
+
+ virtual Storable* Restore( const Storable::TRestoringMap& theMap,
+ SALOMEDS::SObject_ptr SO);
+
+ static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix,
+ CORBA::Boolean theIsMultiFile);
+
+ virtual void ToStream( std::ostringstream& theStr );
+ static const std::string myComment;
+ virtual const char* GetComment() const;
+ virtual QString GenerateName();
+ virtual QString GetTableTitle();
+
+ virtual std::string GetObjectEntry();
+ };
+}
+
+#endif
//----------------------------------------------------------------------------
void
VISU::Prs3d_i
-::RemoveActor(VISU_Actor* theActor)
+::RemoveActor(VISU_ActorBase* theActor)
{
if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor<<"; "<<theActor->GetReferenceCount());
myActorCollection->RemoveItem(theActor);
//----------------------------------------------------------------------------
void
VISU::Prs3d_i
-::UpdateActor(VISU_Actor* theActor)
+::UpdateActor(VISU_ActorBase* theActor)
{
- if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
- theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
- theActor->ShallowCopyPL(GetPipeLine());
+ if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor)){
+ if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<anActor);
+ anActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
+ anActor->ShallowCopyPL(GetPipeLine());
+ }
}
void
#include <vtkTimeStamp.h>
class VISU_PipeLine;
+class VISU_ActorBase;
class VISU_Actor;
class vtkPlane;
//! To unregister the pointed actor
virtual
void
- RemoveActor(VISU_Actor* theActor);
+ RemoveActor(VISU_ActorBase* theActor);
//! To unregister all actors of the instance
virtual
//! To update the pointed actor
virtual
void
- UpdateActor(VISU_Actor* theActor);
+ UpdateActor(VISU_ActorBase* theActor);
//! To update all actors of the instance
virtual
return components;
}
- if ( !theMesh->IsStructured() || theMesh->myType ) {
+ if ( !theMesh->IsStructured() || theMesh->myIsPolarType ) {
// define axis directions and min cell size in each direction
const int nbAxes = 3;
int iAx;
}
}
else {
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- TIdTypeVector aIndexes = theMesh->GetStructure();
-
+ vtkIdType aMeshDim = theMesh->myDim;
gInfo = & myMeshName2GridInfoMap[ theMeshName ];
- switch(aIndexes.size()){
+ switch ( aMeshDim ) {
case 3: {
gp_Dir aDir(0.0,0.0,1.0);
gInfo->myAxis[ 2 ] = aDir;
gInfo->myAxis[ 0 ] = aDir;
}}
- int nbPoints = aMesh->GetNumberOfPoints();
- vtkFloatingPointType* coords[ 2 ];
- if ( nbPoints > 1 ) {
- coords[0] = aMesh->GetPoints()->GetPoint(0);
- coords[1] = aMesh->GetPoints()->GetPoint(nbPoints-1);
- }
-
+ TStructuredId aStructuredId = theMesh->GetStructure();
vector<vtkFloatingPointType> PointsCoords[3];
- TIdTypeVector aCoordIJK;
- switch ( aIndexes.size() ) {
+ vtkPoints* aPoints = aMesh->GetPoints();
+ switch ( aMeshDim ) {
case 3: {
- vtkIdType nbZ = aIndexes[2];
- aCoordIJK.clear();
- aCoordIJK.resize(aIndexes.size(),1);
- for(int i=0;i<nbZ;i++){
- aCoordIJK[2]=i+1;
+ TStructuredId aCoordIJK;
+ vtkIdType nbZ = aStructuredId[2];
+ for ( int i = 0; i < nbZ; i++ ) {
+ aCoordIJK[2] = i + 1;
vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
PointsCoords[2].push_back(aPCoord[2]);
}
}
case 2: {
- vtkIdType nbJ = aIndexes[1];
- aCoordIJK.clear();
- aCoordIJK.resize(aIndexes.size(),1);
- for(int i=0;i<nbJ;i++){
- aCoordIJK[1]=i+1;
+ TStructuredId aCoordIJK;
+ vtkIdType nbJ = aStructuredId[1];
+ for ( int i = 0; i < nbJ; i++ ) {
+ aCoordIJK[1] = i + 1;
vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
PointsCoords[1].push_back(aPCoord[1]);
}
}
case 1: {
- vtkIdType nbI = aIndexes[0];
- aCoordIJK.clear();
- aCoordIJK.resize(aIndexes.size(),1);
- for(int i=0;i<nbI;i++){
- aCoordIJK[0]=i+1;
+ TStructuredId aCoordIJK;
+ vtkIdType nbI = aStructuredId[0];
+ for ( int i = 0; i < nbI; i++ ) {
+ aCoordIJK[0] = i + 1;
vtkIdType aObjID = anIDMapper->GetObjectIDByIndexes(aCoordIJK);
vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID);
- vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID);
+ vtkFloatingPointType* aPCoord = aPoints->GetPoint(aVTKID);
PointsCoords[0].push_back(aPCoord[0]);
}
}}
- for(int i=0;i<aIndexes.size();i++){
+ for ( int i = 0; i < aMeshDim; i++ ) {
vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ i ];
int aSize = PointsCoords[i].size();
- if(aSize>0){
+ if ( aSize > 0 ) {
vtkFloatingPointType aLen = PointsCoords[i][aSize-1] - PointsCoords[i][0];
myComp.resize(aSize);
myComp[0] = 0;
- for(int k=1;k<aSize;k++){
+ for ( int k = 1; k < aSize; k++ ) {
myComp[k]=myComp[k-1] + (PointsCoords[i][k]-PointsCoords[i][k-1])/aLen;
}
}
}
-
- //ENK: 23.11.2006
}
}
return components;
}
+
+SALOME_MED::MedFileInfo* VISU::Result_i::GetMEDFileInfo()
+{
+ SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo();
+
+ QString fpath = myFileInfo.absoluteFilePath();
+ res->fileName = fpath.toLatin1().constData();
+ res->fileSize = myFileInfo.size();
+ int major, minor, release;
+ if( !MED::getMEDVersion( fpath.toLatin1().constData(), major, minor, release ) )
+ {
+ major = -1;
+ minor = -1;
+ release = -1;
+ }
+ res->major = major;
+ res->minor = minor;
+ res->release = release;
+ return res._retn();
+}
ConnectObserver(TResultObserver* theObserver,
boost::signalslib::connection& theConnection);
+ virtual
+ SALOME_MED::MedFileInfo*
+ GetMEDFileInfo();
+
typedef boost::signal0<void> TUpdateObserverSignal;
typedef VISU_Convertor TInput;
//----------------------------------------------------------------------------
void
VISU::ScalarMap_i
-::UpdateActor(VISU_Actor* theActor)
+::UpdateActor(VISU_ActorBase* theActor)
{
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
virtual
void
- UpdateActor(VISU_Actor* theActor);
+ UpdateActor(VISU_ActorBase* theActor);
private:
VISU_ScalarMapPL* myScalarMapPL;
#include "SALOME_Event.h"
#include "SPlot2d_Curve.h"
-#include <memory>
-#include <fstream>
-#include <strstream>
-
-#include <QString>
-#include <QRegExp>
-#include <QFile>
-
-using namespace std;
+#include "VISU_TableReader.hxx"
+#include "VISU_ConvertorUtils.hxx"
#ifdef _DEBUG_
static int MYDEBUG = 0;
return mySObj;
}
-//-------------------------------------------------------------
-// Implementation of reading from file
-//-------------------------------------------------------------
-typedef string TValue;
-typedef vector<TValue> TValues;
-
-struct TRow{
- string myTitle;
- string myUnit;
- TValues myValues;
-};
-
-typedef vector<TRow> TRows;
-
-struct TTable2D {
- string myTitle;
- vector<string> myColumnUnits;
- vector<string> myColumnTitles;
- TRows myRows;
- int Check(){
- if(myRows.empty()) return 0;
- int iEnd = myRows[0].myValues.size();
- if(iEnd == 0) return 0;
- if(myColumnTitles.size() != iEnd) myColumnTitles.resize(iEnd);
- if(myColumnUnits.size() != iEnd) myColumnUnits.resize(iEnd);
- int jEnd = myRows.size();
- for(int j = 0; j < jEnd; j++)
- if(myRows[j].myValues.size() != iEnd)
- return 0;
- return 1;
- }
- void getColumns(TTable2D& theTable2D) const {
- TRows& aRows = theTable2D.myRows;
- aRows.clear();
- if(myRows.empty()) return;
- int jEnd = myRows.size();
- //Define Titles & Units
- theTable2D.myColumnTitles.resize(jEnd);
- theTable2D.myColumnUnits.resize(jEnd);
- for(int j = 0; j < jEnd; j++){
- theTable2D.myColumnTitles[j] = myRows[j].myTitle;
- theTable2D.myColumnUnits[j] = myRows[j].myUnit;
- }
- //Define Rows
- int iEnd = myRows[0].myValues.size();
- for(int i = 0; i < iEnd; i++){
- TRow aNewRow;
- aNewRow.myTitle = myColumnTitles[i];
- aNewRow.myUnit = myColumnUnits[i];
- aNewRow.myValues.resize(jEnd);
- for(int j = 0; j < jEnd; j++){
- aNewRow.myValues[j] = myRows[j].myValues[i];
- }
- aRows.push_back(aNewRow);
- }
- }
-};
-
-typedef vector<TTable2D> TTableCont;
-
-int getLine(ifstream& theStmIn, QString& theString){
- char tmp;
- ostrstream aStrOut;
- while(theStmIn.get(tmp)){
- aStrOut<<tmp;
- if(tmp == '\n') break;
- }
- aStrOut<<ends;
- theString = aStrOut.str();
- return !theStmIn.eof();
-}
-
-void ImportTables(const char* theFileName, TTableCont& theTableCont){
- ifstream aStmIn;
- QFileInfo aFileInfo( theFileName );
- if( !aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size() )
- return;
- aStmIn.open( theFileName );
- QString aTmp;
- do {
- // find beginning of table (tables are separated by empty lines)
- while( getLine( aStmIn, aTmp ) && aTmp.trimmed() == "");
- TTable2D aTable2D;
- if(MYDEBUG) cout << "New table is found" << endl;
- while( !aStmIn.eof() && aTmp.trimmed() != "" ){
- QString data = aTmp.trimmed();
- QString cmt = "";
- QString keyword = "";
- // split string to data and comment (comment starts from '#' symbol)
- int index = aTmp.indexOf( "#" );
- if ( index >= 0 ) {
- data = aTmp.left( index ).trimmed();
- cmt = aTmp.mid( index+1 ).trimmed();
- }
- // if comment is not empty, try to get keyword from it (separated by ':' symbol)
- if ( !cmt.isEmpty() ) {
- int index1 = cmt.indexOf( ":" );
- if ( index1 >= 0 ) {
- QString tmpstr = cmt.left( index1 ).trimmed();
- if ( tmpstr == QString( "TITLE" ) ||
- tmpstr == QString( "COLUMN_TITLES" ) ||
- tmpstr == QString( "COLUMN_UNITS" ) ||
- tmpstr == QString( "COMMENT" ) ) {
- keyword = tmpstr;
- cmt = cmt.mid( index1+1 ).trimmed();
- }
- }
- }
- // if data is empty, process only comment
- if ( data.isEmpty() ) {
- // if keyword is found, try to process it
- // elsewise it is a simple comment, just ignore it
- if ( !keyword.isEmpty() ) {
- if ( keyword == QString( "TITLE" ) ) {
- QString title = cmt;
- if ( aTable2D.myTitle != "" )
- title = QString( aTable2D.myTitle.c_str() ) + QString( " " ) + title;
- if(MYDEBUG) cout << "...Table TITLE is: " << title.toLatin1().data() << endl;
- aTable2D.myTitle = title.toLatin1().data();
- }
- else if ( keyword == QString( "COLUMN_TITLES" ) ) {
- // comment may contain column headers
- QStringList aStrList = cmt.split( "|", QString::SkipEmptyParts );
- if(MYDEBUG) cout << "...Column TITLES are: ";
- for ( int i = 0; i < aStrList.count(); i++ ) {
- QString tmpstr = aStrList[ i ].trimmed();
- if(MYDEBUG) cout << tmpstr.toLatin1().data() << " ";
- aTable2D.myColumnTitles.push_back( tmpstr.toLatin1().data() );
- }
- if(MYDEBUG) cout << endl;
- }
- else if ( keyword == QString( "COLUMN_UNITS" ) ) {
- // comment may contain column units
- QStringList aStrList = cmt.split( " ", QString::SkipEmptyParts );
- if(MYDEBUG) cout << "...Column UNITS are: ";
- for ( int i = 0; i < aStrList.count(); i++ ) {
- QString tmpstr = aStrList[ i ].trimmed();
- if(MYDEBUG) cout << tmpstr.toLatin1().data() << " ";
- aTable2D.myColumnUnits.push_back( tmpstr.toLatin1().data() );
- }
- if(MYDEBUG) cout << endl;
- }
- else if ( keyword == QString( "COMMENT" ) ) {
- // keyword 'COMMENT' processing can be here
- // currently it is ignored
- if(MYDEBUG) cout << "...COMMENT: " << cmt.toLatin1().data() << endl;
- }
- }
- else {
- if(MYDEBUG) cout << "...comment: " << cmt.toLatin1().data() << endl;
- // simple comment processing can be here
- // currently it is ignored
- }
- }
- // if data is not empty, try to process it
- else {
- TRow aRow;
- if(MYDEBUG) cout << "...New row is found: " << endl;
- if ( !cmt.isEmpty() ) {
- aRow.myTitle = cmt.toLatin1().data();
- if(MYDEBUG) cout << "......ROW TITLE is: " << cmt.toLatin1().data() << endl;
- }
- QString datar1 = data.replace(QRegExp("\t"), " ");
- QStringList aValList = datar1.split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < aValList.count(); i++ ) {
- if ( aValList[i].trimmed() != "" ) {
- TValue aVal = aValList[i].trimmed().toLatin1().data();
- aRow.myValues.push_back( aVal );
- }
- }
- if( aRow.myValues.size() > 0 )
- aTable2D.myRows.push_back( aRow );
- // ************** OLD CODE ******************
- /*
- TValue aVal;
- istrstream aStream( data );
- aStream.precision( STRPRECISION );
- while( aStream >> aVal ) {
- aRow.myValues.push_back( aVal );
- }
- if( aRow.myValues.size() > 0 )
- aTable2D.myRows.push_back( aRow );
- */
- // ************** OLD CODE ******************
- }
- getLine( aStmIn, aTmp );
- }
- if( aTable2D.Check() ) {
- if(MYDEBUG) cout << "aTable2D is checked OK " << aTable2D.myTitle << endl;
- theTableCont.push_back( aTable2D );
- }
- }
- while( !aStmIn.eof() );
- aStmIn.close();
- if(MYDEBUG) cout << "After close" << endl;
-}
+SALOMEDS::SObject_var
+VISU::ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy)
+{
+ TTableContainer aContainer;
+ ImportTables( theFileName, aContainer );
+ if ( aContainer.empty() )
+ return SALOMEDS::SObject::_nil();
-SALOMEDS::SObject_var VISU::ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy){
- TTableCont aTableCont;
- ImportTables(theFileName,aTableCont);
- if(aTableCont.empty()) return SALOMEDS::SObject::_nil();
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::SComponent_var theSComponent = VISU::FindOrCreateVisuComponent(theStudy);
SALOMEDS::SObject_var aFileObject = aStudyBuilder->NewObject(theSComponent);
aString.sprintf("myComment=ImportTables;myFileName=%s",
aFileInfo.absoluteFilePath().toLatin1().data());
aComment->SetValue(aString.toLatin1().data());
- for(int i = 0, iEnd = aTableCont.size(); i < iEnd; i++){
- const TTable2D& aTable2D = aTableCont[i];
+ for(int i = 0, iEnd = aContainer.size(); i < iEnd; i++){
+ PTableIDMapper aTableIDMapper = aContainer[i];
+ const TTable2D& aTable2D = *aTableIDMapper;
SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);
anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
if(MYDEBUG) cout<<"aTable2D.myTitle = "<<aTable2D.myTitle<<endl;
- if(aTable2D.myTitle != "")
+ if ( aTable2D.myTitle != "" ) {
aName->SetValue(aTable2D.myTitle.c_str());
- else{
+ } else {
QString aNewName;
aNewName.sprintf("Table:%d",i);
aName->SetValue(aNewName.toLatin1().data());
}
+
anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeTableOfReal");
SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
aTableOfReal->SetTitle(aTable2D.myTitle.c_str());
#include "VISU_Table_i.hh"
#include "VISU_Actor.h"
+#include "VISU_ActorFactory.h"
#include "SUIT_Tools.h"
#include "SUIT_Session.h"
}
+ //----------------------------------------------------------------------------
+ struct TIsSameActor
+ {
+ VISU::TActorFactory* myActor;
+
+ TIsSameActor(VISU::TActorFactory* theActor):
+ myActor(theActor)
+ {}
+
+ bool
+ operator()(VISU_ActorBase* theActor)
+ {
+ return theActor->GetFactory() == myActor;
+ }
+ };
+
+ //----------------------------------------------------------------------------
+ VISU_ActorBase*
+ FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor)
+ {
+ if(!theActor)
+ return NULL;
+
+ vtkRenderer* aRenderer = theViewWindow->getRenderer();
+ vtkActorCollection* anActors = aRenderer->GetActors();
+ return SVTK::Find<VISU_ActorBase>(anActors, VISU::TIsSameActor(theActor));
+ }
+
+
//----------------------------------------------------------------------------
struct TDeleteActorsEvent: public SALOME_Event
{
class SalomeApp_Application;
class VISU_Actor;
+class VISU_ActorBase;
class SUIT_ViewWindow;
namespace VISU {
class Prs3d_i;
class Curve_i;
+ class TActorFactory;
class VISU_I_EXPORT ViewManager_i : public virtual POA_VISU::ViewManager,
public virtual Base_i
void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
VISU_I_EXPORT VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d);
+ VISU_I_EXPORT VISU_ActorBase* FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor);
void DeleteActors (VISU::Prs3d_i* thePrs);
void DeleteActors (VISU::Curve_i* thePrs);
#include "VISU_Gen_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
#include "VISU_ScalarMap_i.hh"
#include "VISU_ViewManager_i.hh"
#include "VISU_Actor.h"
#include "VISU_ScalarMapAct.h"
+#include "VISU_PointMap3dActor.h"
+#include "VISU_DeformedGridPL.hxx"
#include "SALOME_Event.h"
#include <vtkCamera.h>
#include <vtkRenderer.h>
+#include <vtkActor.h>
using namespace std;
vtkActorCollection* anActors = aRenderer->GetActors();
anActors->InitTraversal();
while (vtkActor *anAct = anActors->GetNextActor()) {
- if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
+ if (VISU_ActorBase* anActor = dynamic_cast<VISU_ActorBase*>(anAct)) {
if (anActor->GetVisibility())
anActor->UpdateFromFactory();
}
}
};
+ class TDisplayTableEvent: public SALOME_Event
+ {
+ SUIT_ViewWindow* myVW;
+ PointMap3d_i* myTable;
+ int myDisplaying;
+ public:
+ TDisplayTableEvent( SUIT_ViewWindow* theView,
+ PointMap3d_i* theTable,
+ int theDisplaying ) :
+ myVW (theView),
+ myTable (theTable),
+ myDisplaying (theDisplaying)
+ {}
+ virtual void Execute() {
+ SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(myVW);
+ VISU_PointMap3dActor* anActor = myTable->CreateActor();
+ myTable->UpdateActor( anActor );
+ aViewWindow->AddActor( anActor );
+ }
+ };
+
void View3D_i::EraseAll()
{
if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
if(MYDEBUG) MESSAGE("View3D_i::Display");
SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
+ Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
if (aVW && aPrs)
ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay));
+ else if (aVW && !aPrs) {
+ PointMap3d_i* aTable = dynamic_cast<PointMap3d_i*>(VISU::GetServant(anObj).in());
+ if (aTable)
+ ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplay));
+ }
}
void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
if (aVW && aPrs)
ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly));
+ else if (aVW && !aPrs) {
+ PointMap3d_i* aTable = dynamic_cast<PointMap3d_i*>(VISU::GetServant(anObj).in());
+ if (aTable)
+ ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplayOnly));
+ }
}
void View3D_i::FitAll()
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "VVTK_ViewModel.h"
-
+#include "VISU_ActorFactory.h"
#include "VVTK_ViewWindow.h"
#include "VTKViewer_Algorithm.h"
#include "SVTK_Functor.h"
-#include "VISU_Actor.h"
+#include "VISU_ActorBase.h"
#include "SVTK_View.h"
#include "SVTK_Prs.h"
return;
if(vtkActorCollection* aCollection = aPrs->GetObjects()){
aCollection->InitTraversal();
- while(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(aCollection->GetNextActor())){
+ while(VISU_ActorBase* anActor = dynamic_cast<VISU_ActorBase*>(aCollection->GetNextActor())){
if(!anActor->GetFactory()->GetActiveState())
continue;
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();