// QT Includes
#include <qstring.h>
#include <qfileinfo.h>
+#include <qregexp.h>
// VTK Includes
#include <vtkRenderer.h>
VISU_Gen_i::~VISU_Gen_i(){
if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
}
+
+ void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject)
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) {
+ SALOMEDS::AttributeComment_var aAttComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ if ( aAttComment ) {
+ string aValue = aAttComment->Value();
+ if ( aValue.compare("") ) {
+ const QString aStr = QString( aValue.c_str() );
+ VISU::Storable::TRestoringMap aMap;
+ Storable::StrToMap( aStr, aMap );
+
+ bool isFind = false;
+ QString aType = Storable::FindValue( aMap, "myType", &isFind );
+ if ( isFind ) {
+ VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() );
+ QString aComment = Storable::FindValue( aMap, "myComment", &isFind );
+ if ( isFind ) {
+ if ( !aComment.compare(QString("NONE")) ) aVISUType = VISU::TNONE;
+ else if ( !aComment.compare(QString("CURVE")) ) aVISUType = VISU::TCURVE;
+ else if ( !aComment.compare(QString("TABLE")) ) aVISUType = VISU::TTABLE;
+ else if ( !aComment.compare(QString("CONTAINER")) ) aVISUType = VISU::TCONTAINER;
+ else if ( !aComment.compare(QString("MESH")) ) aVISUType = VISU::TMESH;
+ else if ( !aComment.compare(QString("SCALARMAP")) ) aVISUType = VISU::TSCALARMAP;
+ else if ( !aComment.compare(QString("ISOSURFACE")) ) aVISUType = VISU::TISOSURFACE;
+ else if ( !aComment.compare(QString("DEFORMEDSHAPE")) ) aVISUType = VISU::TDEFORMEDSHAPE;
+ else if ( !aComment.compare(QString("SCALARMAPONDEFORMEDSHAPE")) ) aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE;
+ else if ( !aComment.compare(QString("GAUSSPOINTS")) ) aVISUType = VISU::TGAUSSPOINTS;
+ else if ( !aComment.compare(QString("PLOT3D")) ) aVISUType = VISU::TPLOT3D;
+ else if ( !aComment.compare(QString("CUTPLANES")) ) aVISUType = VISU::TCUTPLANES;
+ else if ( !aComment.compare(QString("CUTLINES")) ) aVISUType = VISU::TCUTLINES;
+ else if ( !aComment.compare(QString("VECTORS")) ) aVISUType = VISU::TVECTORS;
+ else if ( !aComment.compare(QString("STREAMLINES")) ) aVISUType = VISU::TSTREAMLINES;
+ else if ( !aComment.compare(QString("VISUGEN")) ) aVISUType = VISU::TVISUGEN;
+ else if ( !aComment.compare(QString("VIEWMANAGER")) ) aVISUType = VISU::TVIEWMANAGER;
+ else if ( !aComment.compare(QString("RESULT")) ) aVISUType = VISU::TRESULT;
+ else if ( !aComment.compare(QString("XYPLOT")) ) aVISUType = VISU::TXYPLOT;
+ else if ( !aComment.compare(QString("TABLEVIEW,")) ) aVISUType = VISU::TTABLEVIEW;
+ else if ( !aComment.compare(QString("VIEW3D")) ) aVISUType = VISU::TVIEW3D;
+ else if ( !aComment.compare(QString("GAUSSVIEW")) ) aVISUType = VISU::TGAUSSVIEW;
+ else if ( !aComment.compare(QString("ENTITY")) ) aVISUType = VISU::TENTITY;
+ else if ( !aComment.compare(QString("FAMILY")) ) aVISUType = VISU::TFAMILY;
+ else if ( !aComment.compare(QString("GROUP")) ) aVISUType = VISU::TGROUP;
+ else if ( !aComment.compare(QString("FIELD")) ) aVISUType = VISU::TFIELD;
+ else if ( !aComment.compare(QString("TIMESTAMP")) ) aVISUType = VISU::TTIMESTAMP;
+ else if ( !aComment.compare(QString("ANIMATION")) ) aVISUType = VISU::TANIMATION;
+ else if ( !aComment.compare(QString("ALL")) ) aVISUType = VISU::TALL;
+ else
+ if (MYDEBUG) MESSAGE("Error : Unknown type of VISU object!");
+ }
+ QString aNewStr = aStr;
+ aAttComment->SetValue( aNewStr.replace( QRegExp( QString("myType=") + aType ) ,
+ QString("myType=") + QString::number(aVISUType) ).latin1() );
+ }
+ }
+ }
+ }
+ }
+
//===========================================================================
CORBA::Boolean VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile & theStream,
{
Mutex mt(myMutex);
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
+
+ SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent);
+ for (anIter->InitEx(true); anIter->More(); anIter->Next()) {
+ SALOMEDS::SObject_var aSObject = anIter->Value();
+ CorrectSObjectType(aSObject);
+ }
+
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
TCollection_AsciiString aTmpDir (const_cast<char*>(aDir.c_str()));
}
return aString._retn();
}
+
//===========================================================================
SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
if(aCreationId == eImportMed || aCreationId == eImportMedField)
aSourceId = eRestoredComponent;
- CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","0").toInt();
- CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","0").toInt();
- CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","0").toInt();
+ CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","1").toInt();
+ CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","1").toInt();
+ CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","1").toInt();
VISU::Result_i* aResult = new VISU::Result_i(aStudy,
aSourceId,