*/
Result ImportMedField(in SALOME_MED::FIELD theField);
+ /*!
+ * Rename a study object, representing a mesh, specified by given values.
+ * \param theResult Data generated in other sources (MED object or file).
+ * \param theMeshName One of the meshes presented in MED file.
+ * \param theEntity Type of entity where the field is defined.
+ * \param theSubMeshName Name of sub-mesh (group or family).
+ * \param theNewName Name to be given to the study object.
+ */
+ void RenameEntityInStudy(in Result theResult,
+ in string theMeshName,
+ in Entity theEntity,
+ in string theNewName);
+ void RenameFamilyInStudy(in Result theResult,
+ in string theMeshName,
+ in Entity theEntity,
+ in string theSubMeshName,
+ in string theNewName);
+ void RenameGroupInStudy(in Result theResult,
+ in string theMeshName,
+ in string theSubMeshName,
+ in string theNewName);
+
/*!
* Creates a mesh on the basis of the data generated in other sources (MED object or file).
* \param theResult Data generated in other sources. (MED object or file)
return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
}
-
Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
}
-
Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
const char* theMeshName,
const char* theGroupName)
}
+ void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
+ VISU::Entity theEntity, const char* theNewName)
+ {
+ myVisuGen->RenameEntityInStudy(theResult,theMeshName,theEntity,theNewName);
+ }
+
+ void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName,
+ VISU::Entity theEntity, const char* theFamilyName,
+ const char* theNewName)
+ {
+ myVisuGen->RenameFamilyInStudy(theResult,theMeshName,theEntity,theFamilyName,theNewName);
+ }
+
+ void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, const char* theMeshName,
+ const char* theGroupName, const char* theNewName)
+ {
+ myVisuGen->RenameGroupInStudy(theResult,theMeshName,theGroupName,theNewName);
+ }
+
+
ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
virtual ViewManager_ptr GetViewManager();
virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
- virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName );
+ virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
//Create Result
virtual Result_ptr ImportFile(const char* theFileName);
//Create Presentation Of Submeshes
virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity);
- virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName,
+ virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName,
VISU::Entity theEntity, const char* theFamilyName);
virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
- virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual GaussPoints_ptr GaussPointsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ //Rename Presentation Of Submeshes
+ virtual void RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
+ VISU::Entity theEntity, const char* theNewName);
+ virtual void RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFamilyName, const char* theNewName);
+ virtual void RenameGroupInStudy (Result_ptr theResult, const char* theMeshName,
+ const char* theGroupName, const char* theNewName);
+
+ //Create Presentation Of Results
+ virtual ScalarMap_ptr ScalarMapOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual GaussPoints_ptr GaussPointsOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual DeformedShape_ptr DeformedShapeOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual IsoSurfaces_ptr IsoSurfacesOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual CutPlanes_ptr CutPlanesOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual CutLines_ptr CutLinesOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual StreamLines_ptr StreamLinesOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual Plot3D_ptr Plot3DOnField (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+ const char* theFieldName, CORBA::Double theIteration);
+ virtual ScalarMapOnDeformedShape_ptr ScalarMapOnDeformedShapeOnField
+ (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration);
- virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual CutLines_ptr CutLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
- virtual ScalarMapOnDeformedShape_ptr ScalarMapOnDeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration);
//Create Digital Presentation
virtual Table_ptr CreateTable(const char* theTableEntry);
virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
const char* aLocalPersistentID,
CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII);
-
+
virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean theIsPublished,
CORBA::Boolean& theIsValidScript);
-
};
};
-#endif
+#endif
std::string thePrefix)
{
std::string aName = GetName(theSObject);
- if(aName == "")
+ if (aName == "")
return;
+ CORBA::String_var anID = theSObject->GetID();
+ CORBA::String_var aNameInStudy = theSObject->GetName();
+
CORBA::Object_var anObj = SObjectToObject(theSObject);
- if(!CORBA::is_nil(anObj)){
+ if (!CORBA::is_nil(anObj)) {
VISU::Base_var aBase = VISU::Base::_narrow(anObj);
if(!CORBA::is_nil(aBase)){
std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
- CORBA::String_var anID = theSObject->GetID();
VISU::VISUType aType = aBase->GetType();
switch(aType){
theStr<<thePrefix<<"aName2ObjectMap['"<<aName<<"'] = "<<aName<<endl;
// Set name (as this object could be renamed by user)
- CORBA::String_var aNameInStudy = theSObject->GetName();
theStr<<thePrefix<<"visu.SetName("<<aName<<",'"<<aNameInStudy.in()<<"')"<<endl;
// Set parameters common for all Prs3d objects (offset values)
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
// Set name (as this object could be renamed by user)
- CORBA::String_var aNameInStudy = theSObject->GetName();
theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 2"<<endl;
theStr<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
// Set name (as this object could be renamed by user)
- CORBA::String_var aNameInStudy = theSObject->GetName();
theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 3"<<endl;
theStr<<endl;
return;
}
}
- }else{ /*if(!CORBA::is_nil(anObj))*/
+ } else { /*if(!CORBA::is_nil(anObj))*/
SALOMEDS::GenericAttribute_var anAttr;
- if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+ if (theSObject->FindAttribute(anAttr,"AttributeComment")) {
SALOMEDS::AttributeComment_var aComment =
SALOMEDS::AttributeComment::_narrow(anAttr);
CORBA::String_var aValue = aComment->Value();
Storable::StrToMap(aValue.in(),aMap);
bool anIsExist;
QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
- if(anIsExist){
- if(strcmp(aTypeName.latin1(),"ImportTables") == 0){
+ if (anIsExist) {
+ if (strcmp(aTypeName.latin1(),"ImportTables") == 0) {
QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist);
if(anIsExist){
std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
theStr<<thePrefix<<"pass"<<endl<<endl;
return;
}
- }else if(strcmp(aTypeName.latin1(),"VIEW3D") == 0){
+ } else if (strcmp(aTypeName.latin1(),"VIEW3D") == 0) {
std::string aName = GetName(theSObject);
theStr<<thePrefix<<aName<<" = aBuilder.NewObject(aSComponent)"<<endl;
theStr<<thePrefix<<"pass"<<endl<<endl;
return;
+ } else if (aTypeName == "ENTITY" || aTypeName == "FAMILY" || aTypeName == "GROUP") {
+ // Set name (as this object could be renamed by user)
+ string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
+ string aSubMeshName = VISU::Storable::FindValue(aMap,"myName").latin1();
+ string anEntityTypeKey = "myEntityId";
+ if (aTypeName == "ENTITY") anEntityTypeKey = "myId";
+ int anEntity = VISU::Storable::FindValue(aMap,anEntityTypeKey,"0").toInt();
+ std::string anEntityType;
+ switch ((TEntity)anEntity) {
+ case NODE_ENTITY: anEntityType = "VISU.NODE"; break;
+ case EDGE_ENTITY: anEntityType = "VISU.EDGE"; break;
+ case FACE_ENTITY: anEntityType = "VISU.FACE"; break;
+ case CELL_ENTITY: anEntityType = "VISU.CELL"; break;
+ }
+
+ if (aTypeName == "ENTITY" ) {
+ theStr<<thePrefix<<"aVisu.RenameEntityInStudy("<<theArgumentName<<",'"<<aMeshName
+ <<"',"<<anEntityType<<",'"<<aNameInStudy.in()<<"')"<<endl;
+ }
+ else if (aTypeName == "FAMILY") {
+ if (aSubMeshName != aNameInStudy.in()) {
+ theStr<<thePrefix<<"aVisu.RenameFamilyInStudy("<<theArgumentName<<",'"<<aMeshName
+ <<"',"<<anEntityType<<",'"<<aSubMeshName<<"','"<<aNameInStudy.in()<<"')"<<endl;
+ }
+ }
+ else { // "GROUP"
+ if (aSubMeshName != aNameInStudy.in()) {
+ theStr<<thePrefix<<"aVisu.RenameGroupInStudy("<<theArgumentName<<",'"<<aMeshName
+ <<"','"<<aSubMeshName<<"','"<<aNameInStudy.in()<<"')"<<endl;
+ }
+ }
}
}
- }else{
+ } else {
DumpTableAttrToPython(theStudy,
theIsPublished,
theIsValidScript,
}
}
+ void VISU_Gen_i::RenameMeshInStudy(Result_ptr theResult,
+ string theMeshName,
+ int theEntity, // -1 for group indication
+ string theSubMeshName, // Family or Group name
+ string theNewName)
+ {
+ if (myStudyDocument->GetProperties()->IsLocked()) return;
+ Mutex mt(myMutex);
+
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+ if (!pResult) return;
+
+ QString aComment;
+ VISU::VISUType aType;
+ if (theEntity >= 0)
+ if (theSubMeshName == "")
+ aType = VISU::TENTITY;
+ else
+ aType = VISU::TFAMILY;
+ else
+ aType = VISU::TGROUP;
+
+ switch (aType) {
+ case VISU::TENTITY:
+ aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
+ VISU::TENTITY, theMeshName.c_str(), theEntity);
+ break;
+ case VISU::TFAMILY:
+ aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+ VISU::TFAMILY, theMeshName.c_str(), theEntity, theSubMeshName.c_str());
+ break;
+ case VISU::TGROUP:
+ aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+ VISU::TGROUP, theMeshName.c_str(), theSubMeshName.c_str());
+ break;
+ }
+
+ string aResultEntry = pResult->GetEntry();
+ string anEntry = pResult->GetEntry(aComment.latin1());
+ if (anEntry == "") return;
+
+ SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str());
+
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
+
+ SALOMEDS::GenericAttribute_var anAttr =
+ aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
+ SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow(anAttr);
+ aNameAttr->SetValue(theNewName.c_str());
+
+ aStudyBuilder->CommitCommand();
+ }
+
+ void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theNewName)
+ {
+ RenameMeshInStudy(theResult, theMeshName, (int)theEntity, "", theNewName);
+ }
+
+ void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFamilyName,
+ const char* theNewName)
+ {
+ RenameMeshInStudy(theResult, theMeshName, (int)theEntity, theFamilyName, theNewName);
+ }
+
+ void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ const char* theGroupName,
+ const char* theNewName)
+ {
+ RenameMeshInStudy(theResult, theMeshName, -1, theGroupName, theNewName);
+ }
+
Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity)
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
+#include <string>
+
namespace VISU
{
class Result_i;
ImportMedField(SALOME_MED::FIELD_ptr theField);
+ //Rename Presentation Of Submeshes
+ void
+ RenameMeshInStudy(Result_ptr theResult,
+ std::string theMeshName,
+ int theEntity, // -1 for group indication
+ std::string theSubMeshName, // Family or Group name
+ std::string theNewName);
+ virtual
+ void
+ RenameEntityInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theNewName);
+ virtual
+ void
+ RenameFamilyInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFamilyName,
+ const char* theNewName);
+ virtual
+ void
+ RenameGroupInStudy(Result_ptr theResult,
+ const char* theMeshName,
+ const char* theGroupName,
+ const char* theNewName);
+
//Create Presentation Of Submeshes
virtual
Mesh_ptr