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 {
};
//-------------------------------------------------------
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 \
#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 <qdir.h>
#include <qfileinfo.h>
#include <qstringlist.h>
#include <memory>
-#include "VISU_Convertor_impl.hxx"
+#include <vtkCellType.h>
#include <vtkUnstructuredGrid.h>
using namespace std;
typedef vtkUnstructuredGrid TOutput;
-void parseFile(const char* theFileName)
-{
+void ParseMEDFile(const char* theFileName)
+{
#ifndef _DEXCEPT_
try{
#endif
#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.absFilePath());
- QStringList aStringList = aDir.entryList("*.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.absFilePath() );
+ QStringList aStringList = aDir.entryList( "*.med", QDir::Files );
int jEnd = aStringList.count();
- for(int j = 0; j < jEnd; j++){
- parseFile(aDir.filePath(aStringList[j]).latin1());
+ for ( int j = 0; j < jEnd; j++ ) {
+ ParseMEDFile( aDir.filePath( aStringList[j] ).latin1() );
}
- }else{
- parseFile(argv[1]);
+ } else {
+ QString anExtension = aFileInfo.extension();
+ if ( anExtension == "med" )
+ ParseMEDFile( argv[1] );
+ else if ( anExtension == "xls" || anExtension == "txt" )
+ ParseXLSFile( argv[1] );
}
}
}
+
return 0;
}
+
return 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
};
//---------------------------------------------------------------
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
//---------------------------------------------------------------
-
-
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.h>
+#include <qstring.h>
+#include <qregexp.h>
+#include <qfile.h>
+
+#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.stripWhiteSpace() == "");
+
+ PTableIDMapper aTableIDMapper( new TTableIDMapper() );
+ TTable2D& aTable2D = *aTableIDMapper;
+ if(MYDEBUG) std::cout << "New table is found" << std::endl;
+
+ while( !aStmIn.eof() && aTmp.stripWhiteSpace() != "" ){
+ QString data = aTmp.stripWhiteSpace();
+ QString cmt = "";
+ QString keyword = "";
+ // split string to data and comment (comment starts from '#' symbol)
+ int index = aTmp.find( "#" );
+ if ( index >= 0 ) {
+ data = aTmp.left( index ).stripWhiteSpace();
+ cmt = aTmp.mid( index+1 ).stripWhiteSpace();
+ }
+ // if comment is not empty, try to get keyword from it (separated by ':' symbol)
+ if ( !cmt.isEmpty() ) {
+ int index1 = cmt.find( ":" );
+ if ( index1 >= 0 ) {
+ QString tmpstr = cmt.left( index1 ).stripWhiteSpace();
+ if ( tmpstr == QString( "TITLE" ) ||
+ tmpstr == QString( "COLUMN_TITLES" ) ||
+ tmpstr == QString( "COLUMN_UNITS" ) ||
+ tmpstr == QString( "COMMENT" ) ) {
+ keyword = tmpstr;
+ cmt = cmt.mid( index1+1 ).stripWhiteSpace();
+ }
+ }
+ }
+ // 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.latin1() << std::endl;
+ aTable2D.myTitle = title.latin1();
+ }
+ else if ( keyword == QString( "COLUMN_TITLES" ) ) {
+ // comment may contain column headers
+ QStringList aStrList = QStringList::split( "|", cmt );
+ if(MYDEBUG) std::cout << "...Column TITLES are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].stripWhiteSpace();
+ if(MYDEBUG) std::cout << tmpstr.latin1() << " ";
+ aTable2D.myColumnTitles.push_back( tmpstr.latin1() );
+ }
+ if(MYDEBUG) std::cout << std::endl;
+ }
+ else if ( keyword == QString( "COLUMN_UNITS" ) ) {
+ // comment may contain column units
+ QStringList aStrList = QStringList::split( " ", cmt );
+ if(MYDEBUG) std::cout << "...Column UNITS are: ";
+ for ( int i = 0; i < aStrList.count(); i++ ) {
+ QString tmpstr = aStrList[ i ].stripWhiteSpace();
+ if(MYDEBUG) std::cout << tmpstr.latin1() << " ";
+ aTable2D.myColumnUnits.push_back( tmpstr.latin1() );
+ }
+ 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.latin1() << std::endl;
+ }
+ }
+ else {
+ if(MYDEBUG) std::cout << "...comment: " << cmt.latin1() << 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.latin1();
+ if(MYDEBUG) std::cout << "......ROW TITLE is: " << cmt.latin1() << std::endl;
+ }
+ QString datar1 = data.replace(QRegExp("\t"), " ");
+ QStringList aValList = QStringList::split( " ", datar1 );
+ for ( int i = 0; i < aValList.count(); i++ ) {
+ if ( aValList[i].stripWhiteSpace() != "" ) {
+ TTable2D::TValue aVal = aValList[i].stripWhiteSpace().latin1();
+ 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 <stdexcept>
#include <sstream>
::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 <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) \
libVisuPipeLine_la_LDFLAGS= \
$(MED2_LIBS) \
$(VTK_LIBS) -lVTKViewer \
+ $(QT_LIBS) \
$(KERNEL_LDFLAGS) -lSALOMELocalTrace \
$(GUI_LDFLAGS) \
$(MED_LDFLAGS) \
#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.h>
+
+#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.extension();
+ 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_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 \
msgid "VisuGUI_BarPrefDlg::AUTO"
msgstr "auto"
+#: VisuGUI_Table3dDlg.cxx
+
+msgid "VisuGUI_Table3DDlg::DLG_PREF_TITLE"
+msgstr "Table 3D Bar Preferences"
+
+msgid "VisuGUI_Table3DDlg::DLG_PROP_TITLE"
+msgstr "Scalar Bar Properties"
+
+msgid "VisuGUI_TableScalarBarPane::SCALAR_RANGE_GRP"
+msgstr "Scalar range"
+
+msgid "VisuGUI_TableScalarBarPane::LOGARITHMIC_SCALING"
+msgstr "Logarithmic scaling"
+
+msgid "VisuGUI_TableScalarBarPane::FIELD_RANGE_BTN"
+msgstr "Use field range"
+
+msgid "VisuGUI_TableScalarBarPane::IMPOSED_RANGE_BTN"
+msgstr "Use imposed range"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_MIN"
+msgstr "Min:"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_MAX"
+msgstr "Max:"
+
+msgid "VisuGUI_TableScalarBarPane::COLORS_LABELS_GRP"
+msgstr "Colors and labels"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_NB_COLORS"
+msgstr "Nb. of colors:"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_NB_LABELS"
+msgstr "Nb. of labels:"
+
+msgid "VisuGUI_TableScalarBarPane::ORIENTATION_GRP"
+msgstr "Orientation"
+
+msgid "VisuGUI_TableScalarBarPane::VERTICAL_BTN"
+msgstr "Vertical"
+
+msgid "VisuGUI_TableScalarBarPane::HORIZONTAL_BTN"
+msgstr "Horizontal"
+
+msgid "VisuGUI_TableScalarBarPane::ORIGIN_GRP"
+msgstr "Origin"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_X"
+msgstr "X:"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_Y"
+msgstr "Y:"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_SHOW_PREVIEW"
+msgstr "Show preview"
+
+msgid "VisuGUI_TableScalarBarPane::DIMENSIONS_GRP"
+msgstr "Dimensions"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_WIDTH"
+msgstr "Width:"
+
+msgid "VisuGUI_TableScalarBarPane::LBL_HEIGHT"
+msgstr "Height:"
+
+msgid "VisuGUI_TableScalarBarPane::SAVE_DEFAULT_CHK"
+msgstr "Save as default values"
+
+msgid "VisuGUI_TableScalarBarPane::MSG_MINMAX_VALUES"
+msgstr "Min value can not be higher or equal to Max value"
+
+msgid "VisuGUI_TableScalarBarPane::WRN_LOGARITHMIC_RANGE"
+msgstr "Logarithmic scaling: use imposed range values > 0"
+
+msgid "VisuGUI_TableScalarBarPane::WRN_LOGARITHMIC_FIELD_RANGE"
+msgstr "Logarithmic scaling: field range contains negative values, use imposed range instead"
+
+msgid "VisuGUI_Table3DPane::SCALE"
+msgstr "Scale Factor:"
+
+msgid "VisuGUI_Table3DPane::PRESENTATION_TYPE"
+msgstr "Presentation type"
+
+msgid "VisuGUI_Table3DPane::SURFACE"
+msgstr "Surface"
+
+msgid "VisuGUI_Table3DPane::CONTOUR"
+msgstr "Contour"
+
+msgid "VisuGUI_Table3DPane::NUMBER_CONTOURS"
+msgstr "Number of contours:"
#: VisuGUI_StreamLinesDlg.cxx
#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"
VISU::VISUType aType = aBase->GetType();
switch (aType) {
case VISU::TCURVE:
- case VISU::TCONTAINER:
+ case VISU::TCONTAINER:
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"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnShowTablePlot()));
+
createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
this, SLOT(OnPlotData()));
VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
if (aType == VISU::TANIMATION) {
action( VISU_SHOW_ANIMATION )->addTo(theMenu);
-
} else if (isOBClient) {
if (IsSObjectTable(aSObject)) {
+ action( VISU_DELETE_OBJS )->removeFrom(theMenu);
+ if (aType == VISU::TPOINTMAP3D) {
+ action( VISU_SHOW_TABLE_PLOT )->addTo(theMenu);
+ theMenu->insertSeparator();
+ action( VISU_ERASE )->addTo(theMenu);
+ action( myEraseAll )->addTo(theMenu);
+ action( VISU_DISPLAY )->addTo(theMenu);
+ action( VISU_DISPLAY_ONLY )->addTo(theMenu);
+ theMenu->insertSeparator();
+ }
action( VISU_SHOW_TABLE )->addTo(theMenu);
action( VISU_CREATE_CURVES )->addTo(theMenu);
action( VISU_EXPORT_TABLE )->addTo(theMenu);
theMenu->insertSeparator();
+ action( VISU_DELETE_OBJS )->addTo(theMenu);
} else {
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
}
}
}
+ } else {
+ if (aType == VISU::TPOINTMAP3D) {
+ action( myEraseAll )->removeFrom(theMenu);
+ action( VISU_SHOW_TABLE_PLOT )->addTo(theMenu);
+ theMenu->insertSeparator();
+ action( VISU_ERASE )->addTo(theMenu);
+ action( myEraseAll )->addTo(theMenu);
+ action( VISU_DISPLAY )->addTo(theMenu);
+ action( VISU_DISPLAY_ONLY )->addTo(theMenu);
+ theMenu->insertSeparator();
+ }
}
}
QApplication::restoreOverrideCursor();
}
-
void OnChangeLines();
void OnShowTable();
+ void OnShowTablePlot();
void OnCreateTable();
void OnDeleteObjects();
void OnPlotData();
#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
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->find(0)->setEnabled(true);
- ButtonGroupIJKAxis->find(1)->setEnabled(false);
- ButtonGroupIJKAxis->find(2)->setEnabled(false);
- break;
- case 2:
- ButtonGroupIJKAxis->find(0)->setEnabled(true);
- ButtonGroupIJKAxis->find(1)->setEnabled(true);
- ButtonGroupIJKAxis->find(2)->setEnabled(false);
- break;
- case 3:
- ButtonGroupIJKAxis->find(0)->setEnabled(true);
- ButtonGroupIJKAxis->find(1)->setEnabled(true);
- ButtonGroupIJKAxis->find(2)->setEnabled(true);
- break;
- }
+ if ( anIDMapper->IsStructured() ) {
+ VISU::TStructuredId aStructuredId = anIDMapper->GetStructure();
+ ButtonGroupIJKAxis->find(0)->setEnabled( aStructuredId[0] >= 0 );
+ ButtonGroupIJKAxis->find(1)->setEnabled( aStructuredId[1] >= 0 );
+ ButtonGroupIJKAxis->find(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;
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());
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),
0,
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;
case 1:
myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
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
myListPoints->setText(i, 0, QString::number( aNodeObjId ));
--- /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_Plot3DDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#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 "QtxDblSpinBox.h"
+
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qtabwidget.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+
+using namespace std;
+
+#define SURFACE_PRS_ID 0
+#define CONTOUR_PRS_ID 1
+
+//=======================================================================
+//function : VisuGUI_Table3DPane
+//purpose :
+//=======================================================================
+VisuGUI_Table3DPane::VisuGUI_Table3DPane (QWidget* parent)
+ : QVBox(parent), myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL),
+ myInitFromPrs(false)
+{
+ layout()->setAlignment(Qt::AlignTop);
+ setSpacing(6);
+
+ // Scale, Presentation type, Nb Contours, Preview
+
+ QFrame* bottomFrame = new QFrame (this);
+ QGridLayout* bottomLayout = new QGridLayout (bottomFrame);
+ bottomLayout->setAlignment(Qt::AlignTop);
+ bottomLayout->setSpacing(6);
+ bottomLayout->setMargin(11);
+ // scale
+ QLabel* scaleLabel = new QLabel (tr("SCALE"), bottomFrame);
+ ScaleSpn = new QtxDblSpinBox (-1.e6, 1.e6, 0.1, bottomFrame);
+ // Presentation type
+ GBPrsType = new QHButtonGroup (tr("PRESENTATION_TYPE"), bottomFrame);
+ new QRadioButton (tr("SURFACE"), GBPrsType);
+ new QRadioButton (tr("CONTOUR"), GBPrsType);
+ // nb Contours
+ QLabel* nbContLabel = new QLabel (tr("NUMBER_CONTOURS"), bottomFrame);
+ NbContoursSpn = new QSpinBox (1, 999, 1, bottomFrame, "NbContoursSpn");
+
+ bottomLayout->addWidget(scaleLabel, 0, 0);
+ bottomLayout->addWidget(ScaleSpn, 0, 1);
+ bottomLayout->addMultiCellWidget(GBPrsType, 1, 1, 0, 1);
+ bottomLayout->addWidget(nbContLabel, 2, 0);
+ bottomLayout->addWidget(NbContoursSpn, 2, 1);
+
+ // signals and slots connections
+
+ connect(GBPrsType, SIGNAL(clicked(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
+ int id = GBPrsType->id (GBPrsType->selected());
+ thePrs->SetContourPrs(id == CONTOUR_PRS_ID);
+
+ // nb contours
+ thePrs->SetNbOfContours(NbContoursSpn->value());
+
+ return 1;
+}
+
+//=======================================================================
+//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->setButton(id);
+ onPrsType(id);
+
+ // nb contours
+ NbContoursSpn->setValue(thePrs->GetNbOfContours());
+}
+
+//=======================================================================
+//function : Table Scalar Bar
+//purpose :
+//=======================================================================
+
+VisuGUI_TableScalarBarPane::VisuGUI_TableScalarBarPane (QWidget * parent):
+ QVBox(parent), myBarPrs(NULL)
+{
+ 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);
+
+ setSpacing(6);
+ setMargin(11);
+
+ // Range ============================================================
+ RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
+ RangeGroup->setColumnLayout(0, Qt::Vertical );
+ RangeGroup->layout()->setSpacing( 0 );
+ RangeGroup->layout()->setMargin( 0 );
+ QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
+ RangeGroupLayout->setAlignment( Qt::AlignTop );
+ RangeGroupLayout->setSpacing( 6 );
+ RangeGroupLayout->setMargin( 11 );
+
+ CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
+ CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ RBFrange = new QRadioButton (tr("FIELD_RANGE_BTN"), RangeGroup, "RBFrange");
+ RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange");
+ RBFrange->setChecked( true );
+
+ MinEdit = new QLineEdit( RangeGroup, "MinEdit" );
+ MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MinEdit->setMinimumWidth( 70 );
+ MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setText( "0.0" );
+ QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel");
+ MinLabel->setBuddy(MinEdit);
+
+ MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" );
+ MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ MaxEdit->setMinimumWidth( 70 );
+ MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setText( "0.0" );
+ QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel");
+ MaxLabel->setBuddy(MaxEdit);
+
+ RangeGroupLayout->addMultiCellWidget( CBLog, 1, 1, 0, 3);
+ RangeGroupLayout->addMultiCellWidget( RBFrange, 2, 2, 0, 1);
+ RangeGroupLayout->addMultiCellWidget( RBIrange, 2, 2, 2, 3);
+ RangeGroupLayout->addWidget( MinLabel, 3, 0 );
+ RangeGroupLayout->addWidget( MinEdit, 3, 1 );
+ RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
+ RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
+
+ //TopLayout->addWidget( RangeGroup );
+
+ // Colors and Labels ========================================================
+ QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
+ ColLabGroup->setColumnLayout(0, Qt::Vertical );
+ ColLabGroup->layout()->setSpacing( 0 );
+ ColLabGroup->layout()->setMargin( 0 );
+ QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
+ ColLabGroupLayout->setAlignment( Qt::AlignTop );
+ ColLabGroupLayout->setSpacing( 6 );
+ ColLabGroupLayout->setMargin( 11 );
+
+ QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
+ ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
+ ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ ColorSpin->setMinimumWidth( 70 );
+ ColorSpin->setValue( 64 );
+
+ QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
+ LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
+ LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ LabelSpin->setMinimumWidth( 70 );
+ LabelSpin->setValue( 5 );
+
+ ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
+ ColLabGroupLayout->addWidget( ColorSpin, 0, 1);
+ ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
+ ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
+
+ //TopLayout->addWidget( ColLabGroup );
+
+ // Orientation ==========================================================
+ QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
+ OrientGroup->setColumnLayout(0, Qt::Vertical );
+ OrientGroup->layout()->setSpacing( 0 );
+ OrientGroup->layout()->setMargin( 0 );
+ QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
+ OrientGroupLayout->setAlignment( Qt::AlignTop );
+ OrientGroupLayout->setSpacing( 6 );
+ OrientGroupLayout->setMargin( 11 );
+
+ RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
+ RBvert->setChecked( true );
+ RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
+ OrientGroupLayout->addWidget( RBvert, 0, 0 );
+ OrientGroupLayout->addWidget( RBhori, 0, 1 );
+
+ // TopLayout->addWidget( OrientGroup );
+
+ // Origin ===============================================================
+ QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
+ OriginGroup->setColumnLayout(0, Qt::Vertical );
+ OriginGroup->layout()->setSpacing( 0 );
+ OriginGroup->layout()->setMargin( 0 );
+ QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+ OriginGroupLayout->setAlignment( Qt::AlignTop );
+ OriginGroupLayout->setSpacing( 6 );
+ OriginGroupLayout->setMargin( 11 );
+
+ QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
+ XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ XSpin->setMinimumWidth( 70 );
+ XSpin->setValue( 0.01 );
+
+ QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
+ YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+ YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ YSpin->setMinimumWidth( 70 );
+ YSpin->setValue( 0.01 );
+
+ OriginGroupLayout->addWidget( XLabel, 0, 0);
+ OriginGroupLayout->addWidget( XSpin, 0, 1);
+ OriginGroupLayout->addWidget( YLabel, 0, 2);
+ OriginGroupLayout->addWidget( YSpin, 0, 3);
+
+ //TopLayout->addWidget( OriginGroup );
+
+ // Dimensions =========================================================
+ QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
+ DimGroup->setColumnLayout(0, Qt::Vertical );
+ DimGroup->layout()->setSpacing( 0 );
+ DimGroup->layout()->setMargin( 0 );
+ QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
+ DimGroupLayout->setAlignment( Qt::AlignTop );
+ DimGroupLayout->setSpacing( 6 );
+ DimGroupLayout->setMargin( 11 );
+
+ QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
+ WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ WidthSpin->setMinimumWidth( 70 );
+ WidthSpin->setValue( 0.1 );
+
+ QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
+ HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+ HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ HeightSpin->setMinimumWidth( 70 );
+ HeightSpin->setValue( 0.8 );
+
+ DimGroupLayout->addWidget( WidthLabel, 0, 0);
+ DimGroupLayout->addWidget( WidthSpin, 0, 1);
+ DimGroupLayout->addWidget( HeightLabel, 0, 2);
+ DimGroupLayout->addWidget( HeightSpin, 0, 3);
+
+ //TopLayout->addWidget( DimGroup );
+
+ QHBox* aSaveBox = new QHBox(this);
+
+ myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myBarBtn = new QPushButton("Bar properties...", aSaveBox);
+ 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( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
+ connect( OrientGroup, SIGNAL( clicked( 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());
+ 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().latin1());
+
+ 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 )
+{
+ QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
+ if ( snd == XSpin ) {
+ WidthSpin->setMaxValue( 1.0 - XSpin->value() );
+ }
+ if ( snd == YSpin ) {
+ HeightSpin->setMaxValue( 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), 0, false )
+{
+ setCaption(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);
+
+ myIsoPane->setMargin(11);
+ myScalarBarPane->setMargin(11);
+ myTabBox->addTab(myIsoPane, tr("DLG_PREF_TITLE"));
+ myTabBox->addTab(myScalarBarPane, tr("DLG_PROP_TITLE"));
+
+ TopLayout->addWidget(myTabBox);
+
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ GroupButtons->setColumnLayout(0, Qt::Vertical);
+ GroupButtons->layout()->setSpacing(0);
+ GroupButtons->layout()->setMargin(0);
+ QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
+ GroupButtonsLayout->setAlignment(Qt::AlignTop);
+ GroupButtonsLayout->setSpacing(6);
+ GroupButtonsLayout->setMargin(11);
+
+ QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
+ buttonOk->setAutoDefault(TRUE);
+ buttonOk->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+ QPushButton* buttonApply = new QPushButton (tr("&Apply"), GroupButtons, "buttonApply");
+ buttonApply->setAutoDefault(TRUE);
+ buttonApply->setDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonApply, 0, 1);
+ GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
+ QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
+ QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp");
+ buttonHelp->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
+
+ 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()));
+}
+
+VisuGUI_Table3DDlg::~VisuGUI_Table3DDlg()
+{}
+
+//=======================================================================
+//function : accept
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::accept()
+{
+ QDialog::accept();
+}
+
+//=======================================================================
+//function : reject
+//purpose :
+//=======================================================================
+void VisuGUI_Table3DDlg::reject()
+{
+ QDialog::reject();
+}
+
+//=======================================================================
+//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_Plot3DDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_TABLE3D_H
+#define VISUGUI_TABLE3D_H
+
+#include "VisuGUI_Prs3dDlg.h"
+
+#include <qhbuttongroup.h>
+#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+
+class SalomeApp_Module;
+
+namespace VISU
+{
+ class PointMap3d_i;
+};
+
+class VISU_Plot3DPL;
+class SVTK_ViewWindow;
+class SALOME_Actor;
+class QtxDblSpinBox;
+
+class VisuGUI_Table3DPane : public QVBox
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Table3DPane(QWidget* parent);
+ ~VisuGUI_Table3DPane();
+
+ void initFromPrsObject (VISU::PointMap3d_i* thePrs);
+ int storeToPrsObject (VISU::PointMap3d_i* thePrs);
+
+ VISU::PointMap3d_i* GetPrs() { return myPrs; }
+
+ private:
+ bool myInitFromPrs;
+
+ SVTK_ViewWindow* myViewWindow;
+ VISU::PointMap3d_i* myPrs;
+
+ QtxDblSpinBox * ScaleSpn;
+ QHButtonGroup * GBPrsType;
+ QSpinBox * NbContoursSpn;
+
+ private slots:
+
+ void onPrsType( int );
+};
+
+class VisuGUI_TableScalarBarPane : public QVBox
+{
+ Q_OBJECT;
+
+ public:
+ VisuGUI_TableScalarBarPane(QWidget* parent);
+ ~VisuGUI_TableScalarBarPane();
+
+ void setRange( double imin, double imax, bool sbRange );
+ void setDefaultRange(double imin, double imax);
+ int getOrientation();
+ void setPosAndSize( double x, double y, double w, double h, bool vert );
+ void setScalarBarData( int colors, int labels );
+ 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* thePrs);
+ int storeToPrsObject(VISU::PointMap3d_i* thePrs);
+
+ bool check();
+
+ protected:
+ QButtonGroup* RangeGroup;
+ QRadioButton* RBFrange;
+ QRadioButton* RBIrange;
+ QLineEdit* MinEdit;
+ QLineEdit* MaxEdit;
+
+ QRadioButton* RBhori;
+ QRadioButton* RBvert;
+
+ QtxDblSpinBox* XSpin;
+ QtxDblSpinBox* YSpin;
+
+ QtxDblSpinBox* WidthSpin;
+ QtxDblSpinBox* 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;
+
+ private slots:
+ void changeDefaults( int );
+ void changeRange( int );
+ void XYChanged( double );
+ void changeScalarMode( int );
+ void onTextPref();
+ void onBarPref();
+
+ private:
+ std::string myTitle;
+ VISU::PointMap3d_i* myBarPrs;
+
+ bool myBusy;
+};
+
+///////////////////////////////////////////////////////
+
+class VisuGUI_Table3DDlg : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ VisuGUI_Table3DDlg (SalomeApp_Module* theModule);
+ ~VisuGUI_Table3DDlg();
+
+ virtual void initFromPrsObject( VISU::PointMap3d_i* thePrs );
+ virtual int storeToPrsObject(VISU::PointMap3d_i* thePrs);
+
+ protected slots:
+ void accept();
+ void reject();
+ 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"));
- 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").latin1());
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,
{
//----------------------------------------------------------------------------
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.hxx"
+#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().latin1(), 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().latin1(), 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" );
+ const char *lf=aLabelsFormat.latin1();
+ SetLabelsFormat(lf);
+
+ // 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 );
+ }
+ 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(strcmp(aMethodName.latin1(),"ImportTables") == 0){
+ aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
+ }
+ }
+ }
+ }
+
+ string anEntry = CreateAttributes( GetStudyDocument(),
+ SO->GetID(),//SComponent->GetID(),
+ "ICON_TREE_TABLE",
+ GetID(),
+ GetName(),
+ "",
+ aComment.latin1(),
+ 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").latin1(), false);
+ myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
+ 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"));
+ SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myBarOrientation").toInt());
+
+ SetTitle(VISU::Storable::FindValue(theMap,"myTitle").latin1());
+ 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 <qstringlist.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
}
}
//----------------------------------------------------------------------------
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.hxx"
#include "SPlot2d_Curve.h"
-#include <memory>
-#include <fstream>
-#include <strstream>
-
-#include <qfileinfo.h>
-#include <qstring.h>
-#include <qregexp.h>
-#include <qfile.h>
-
-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.stripWhiteSpace() == "");
- TTable2D aTable2D;
- if(MYDEBUG) cout << "New table is found" << endl;
- while( !aStmIn.eof() && aTmp.stripWhiteSpace() != "" ){
- QString data = aTmp.stripWhiteSpace();
- QString cmt = "";
- QString keyword = "";
- // split string to data and comment (comment starts from '#' symbol)
- int index = aTmp.find( "#" );
- if ( index >= 0 ) {
- data = aTmp.left( index ).stripWhiteSpace();
- cmt = aTmp.mid( index+1 ).stripWhiteSpace();
- }
- // if comment is not empty, try to get keyword from it (separated by ':' symbol)
- if ( !cmt.isEmpty() ) {
- int index1 = cmt.find( ":" );
- if ( index1 >= 0 ) {
- QString tmpstr = cmt.left( index1 ).stripWhiteSpace();
- if ( tmpstr == QString( "TITLE" ) ||
- tmpstr == QString( "COLUMN_TITLES" ) ||
- tmpstr == QString( "COLUMN_UNITS" ) ||
- tmpstr == QString( "COMMENT" ) ) {
- keyword = tmpstr;
- cmt = cmt.mid( index1+1 ).stripWhiteSpace();
- }
- }
- }
- // 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.latin1() << endl;
- aTable2D.myTitle = title.latin1();
- }
- else if ( keyword == QString( "COLUMN_TITLES" ) ) {
- // comment may contain column headers
- QStringList aStrList = QStringList::split( "|", cmt );
- if(MYDEBUG) cout << "...Column TITLES are: ";
- for ( int i = 0; i < aStrList.count(); i++ ) {
- QString tmpstr = aStrList[ i ].stripWhiteSpace();
- if(MYDEBUG) cout << tmpstr.latin1() << " ";
- aTable2D.myColumnTitles.push_back( tmpstr.latin1() );
- }
- if(MYDEBUG) cout << endl;
- }
- else if ( keyword == QString( "COLUMN_UNITS" ) ) {
- // comment may contain column units
- QStringList aStrList = QStringList::split( " ", cmt );
- if(MYDEBUG) cout << "...Column UNITS are: ";
- for ( int i = 0; i < aStrList.count(); i++ ) {
- QString tmpstr = aStrList[ i ].stripWhiteSpace();
- if(MYDEBUG) cout << tmpstr.latin1() << " ";
- aTable2D.myColumnUnits.push_back( tmpstr.latin1() );
- }
- if(MYDEBUG) cout << endl;
- }
- else if ( keyword == QString( "COMMENT" ) ) {
- // keyword 'COMMENT' processing can be here
- // currently it is ignored
- if(MYDEBUG) cout << "...COMMENT: " << cmt.latin1() << endl;
- }
- }
- else {
- if(MYDEBUG) cout << "...comment: " << cmt.latin1() << 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.latin1();
- if(MYDEBUG) cout << "......ROW TITLE is: " << cmt.latin1() << endl;
- }
- QString datar1 = data.replace(QRegExp("\t"), " ");
- QStringList aValList = QStringList::split( " ", datar1 );
- for ( int i = 0; i < aValList.count(); i++ ) {
- if ( aValList[i].stripWhiteSpace() != "" ) {
- TValue aVal = aValList[i].stripWhiteSpace().latin1();
- 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.absFilePath().latin1());
aComment->SetValue(aString.latin1());
- 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.latin1());
}
+
anAttr = aStudyBuilder->FindOrCreateAttribute(aRealObject, "AttributeTableOfReal");
SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
aTableOfReal->SetTitle(aTable2D.myTitle.c_str());
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include "VISU_ActorFactory.h"
+
#include "SALOME_Event.hxx"
#include "SALOME_ListIO.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
}
+ //----------------------------------------------------------------------------
+ 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.hxx"
#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;
QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();