-This is the version 2.2.0 of VISU
+This is the version 3.0.0 of VISU
Compatible with :
- - KERNEL 2.2.0
- - MED 2.2.0
+ - KERNEL 3.0.0
+ - GUI 3.0.0
+ - MED 3.0.0
--- /dev/null
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#------------------------------------------------------------
+# Check availability of Salome binary distribution
+#
+# Author : Marc Tajchman (CEA, 2002)
+#------------------------------------------------------------
+
+AC_DEFUN([CHECK_SALOME_GUI],[
+
+AC_CHECKING(for SalomeGUI)
+
+SalomeGUI_ok=yes
+
+AC_ARG_WITH(gui,
+ --with-salome_gui=DIR root directory path of SALOME GUI installation,
+ SALOME_GUI_DIR="$withval",SALOME_GUI_DIR="")
+
+if test "x$SALOME_GUI_DIR" = "x" ; then
+ if test "x$GUI_ROOT_DIR" != "x" ; then
+ SALOME_GUI_DIR=$GUI_ROOT_DIR
+ else
+ # search Salome binaries in PATH variable
+ AC_PATH_PROG(TEMP, libSalomeApp.so)
+ if test "x$TEMP" != "x" ; then
+ SALOME_GUI_DIR=`dirname $TEMP`
+ else
+ fi
+ fi
+fi
+
+if test -f ${SALOME_GUI_DIR}/lib/salome/libSalomeApp.so ; then
+ SalomeGUI_ok=yes
+ AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
+ GUI_ROOT_DIR=${SALOME_GUI_DIR}
+ AC_SUBST(GUI_ROOT_DIR)
+else
+ AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
+fi
+
+AC_MSG_RESULT(for SALOME GUI: $SalomeGUI_ok)
+
+])dnl
+
MOC = @MOC@
UIC = @UIC@
+# msg2qm
+MSG2QM = @MSG2QM@
+
#QWT
%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${KERNEL_ROOT_DIR}/idl/salome/%.idl
$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${GUI_ROOT_DIR}/idl/salome/%.idl
+ $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+
%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${MED_ROOT_DIR}/idl/salome/%.idl
$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
-THIS IS SALOME - VISU VERSION: 2.2.0
+THIS IS SALOME - VISU VERSION: 3.0.0
dnl We must test if it exists. If not, add it in include !
dnl
+AC_CXX_USE_STD_IOSTREAM
AC_CXX_HAVE_SSTREAM
echo
CHECK_QT
+echo
+echo ---------------------------------------------
+echo testing msg2qm
+echo ---------------------------------------------
+echo
+
+CHECK_MSG2QM
+
echo
echo ---------------------------------------------
echo testing VTK
<component-username>Post-Pro</component-username>
<component-type>VISU</component-type>
<component-author>NRI</component-author>
- <component-version>2.2.0</component-version>
+ <component-version>3.0.0</component-version>
<component-comment>Post-Pro component</component-comment>
<component-multistudy>1</component-multistudy>
<component-icone>ModuleVisu.png</component-icone>
aCoordHelperPtr->GetCoord(i,eY),
aCoordHelperPtr->GetCoord(i,eZ));
theMesh->myPoints = aPoints;
+ aPoints->Delete();
}
theStorage->SetPoints(aPoints);
}
case ePYRA5: return VTK_PYRAMID;
case ePYRA13: return VTK_PYRAMID;
case ePOLYGONE: return VTK_POLYGON;
-// case ePOLYEDRE: return VTK_POLYEDRE;
+ case ePOLYEDRE: return VTK_CONVEX_POINT_SET;
}
return -1;
}
case VTK_WEDGE: return ePENTA6;
case VTK_PYRAMID: return ePYRA5;
case VTK_POLYGON: return ePOLYGONE;
+ case VTK_CONVEX_POINT_SET: return ePOLYEDRE;
}
return EGeometrieElement(-1);
}
}
VISU_Convertor* VISU_MedConvertor::Build() {
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- MED::TInt aNbMeshes = aMed->GetNbMeshes();
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
MSG(MYDEBUG,"VISU_MedConvertor::Build()");
INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
- for(MED::TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
try{
- MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
-
- MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-
- MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
- MED::TElemGroup anElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
- MED::TInt aDim = aMeshInfo->GetDim();
- std::string aMeshName = aMeshInfo->GetName();
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+
+ MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
- VISU::PMEDMesh aMesh = myMeshMap[aMeshName](new VISU::TMEDMesh());
- aMesh->myDim = aDim;
- aMesh->myName = aMeshName;
- aMesh->myNbPoints = aNodeInfo->GetNbElem();
- aMesh->myMeshInfo = aMeshInfo;
- aMesh->myEntityInfo = aEntityInfo;
+ TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
- INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
- "'; myNbPoints = "<<aMesh->myNbPoints<<
- "; aDim = "<<aDim<<"\n");
-
- BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
-
- typedef std::map<TInt,TInt> TFamilyCounterMap;
- TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
- TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap;
-
- VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- MED::TElemGroup::const_iterator anElemGroupIter = anElemGroup.begin();
- for(; anElemGroupIter != anElemGroup.end(); anElemGroupIter++){
- const MED::EEntiteMaillage& aMEntity = anElemGroupIter->first;
- const MED::TElemMap& anElemMap = anElemGroupIter->second;
-
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMEDMeshOnEntity aMeshOnEntity =
- aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
- aMeshOnEntity->myEntity = aVEntity;
- aMeshOnEntity->myMeshName = aMeshName;
- aMeshOnEntity->myGeom = aEntityInfo[aMEntity];
-
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-
- if(aMEntity == MED::eNOEUD){
- aMeshOnEntity->myNbCells = aMesh->myNbPoints;
- aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
-
- for(MED::TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
- MED::TInt aFamId = aNodeInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += 2;
- }
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
+
+ TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+
+ // creating TMesh structure and TMeshOnEntityMap
+ typedef map<TInt,TInt> TFamilyCounterMap;
+ TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+
+ TInt aDim = aMeshInfo->GetDim();
+ const string& aMeshName = aMeshInfo->GetName();
+
+ PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+ aMesh->myDim = aDim;
+ aMesh->myName = aMeshName;
+ aMesh->myNbPoints = aNodeInfo->GetNbElem();
+ aMesh->myMeshInfo = aMeshInfo;
+ aMesh->myEntityInfo = aEntityInfo;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+ "'; myNbPoints = "<<aMesh->myNbPoints<<
+ "; aDim = "<<aDim<<"\n");
+
+ BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+
+ TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+ const EEntiteMaillage& aMEntity = anEntityIter->first;
+ const MED::TGeom& aTGeom = anEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ aMeshOnEntity->myEntity = aVEntity;
+ aMeshOnEntity->myMeshName = aMeshName;
+ aMeshOnEntity->myGeom = aTGeom;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+
+ if(aMEntity == eNOEUD){
+ aMeshOnEntity->myNbCells = aMesh->myNbPoints;
+ aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+
+ for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
+ TInt aFamId = aNodeInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += 2;
}
+ }
- INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
-
- }else{
- aMeshOnEntity->myNbCells = 0;
- aMeshOnEntity->myCellsSize = 0;
- MED::TElemMap::const_iterator anElemMapIter = anElemMap.begin();
- for(; anElemMapIter != anElemMap.end(); anElemMapIter++){
- const MED::EGeometrieElement& aGeom = anElemMapIter->first;
- MED::PElemInfo anElemInfo = anElemMapIter->second;
-
- switch(aGeom){
- case MED::ePOLYGONE: {
- MED::PPolygoneInfo aPolygoneInfo =
- aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,MED::ePOLYGONE);
- MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
- MED::TElemNum aConn = aPolygoneInfo->GetConnectivite();
- MED::TElemNum aIndex = aPolygoneInfo->GetIndex();
- MED::TInt aNbConn = aConn.size();
-
- aMeshOnEntity->myNbCells += aNbElem;
+ INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
+
+ }else{
+ MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
+ aMeshOnEntity->myNbCells = 0;
+ aMeshOnEntity->myCellsSize = 0;
+ for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
+ const EGeometrieElement& aGeom = anTGeomIter->first;
+
+ switch(aGeom){
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
+ TElemNum aConn = aPolygoneInfo->GetConnectivite();
+ TElemNum aIndex = aPolygoneInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aNbConn = aConn.size();
+
+ aMeshOnEntity->myNbCells += aNbElem;
- for (int ii = 0; ii<aNbElem ; ii++){
+ for (int ii = 0; ii<aNbElem ; ii++){
int aNbConnii = aPolygoneInfo->GetNbConn(ii);
- aMeshOnEntity->myCellsSize += aNbConnii;
- }
-
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
"; myNbPolygones = "<<aNbElem<<
"; nbConn= "<<aNbConn<<"\n");
- for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
- }
- }
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"aFamId="<<aFamId<<" ");
+ aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
+ }
+ }
+ ADDMSG(MYDEBUG,endl);
break;
}
- default: {
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+ TElemNum aConn = aPolyedreInfo->GetConnectivite();
+ TElemNum aIndex = aPolyedreInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aNbConn = aConn.size();
+
+ aMeshOnEntity->myNbCells += aNbElem;
+
+ for (int ii = 0; ii<aNbElem ; ii++){
+ int aNbConnii = aPolyedreInfo->GetNbConn(ii);
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
+ INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
+ "; myNbPolyedres = "<<aNbElem<<
+ "; nbConn= "<<aNbConn<<"\n");
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolyedreInfo->GetFamNum(iElem);
+ std::string aName = aPolyedreInfo->GetElemName(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"(aFamId="<<aFamId<<";Name='"<<aName<<"') ");
+ aFamilyCellsSizeCounterMap[aFamId] += aPolyedreInfo->GetNbConn(iElem) + 1;
+ }
+ }
+ ADDMSG(MYDEBUG,endl);
+ break;
+ }
+ default:
+ {
int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
- MED::PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aCellInfo->GetNbElem();
+ PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
aMeshOnEntity->myNbCells += aNbElem;
aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
"; myNbCells = "<<aMeshOnEntity->myNbCells<<
"; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
-
- for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TInt aFamId = aCellInfo->GetFamNum(iElem);
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aCellInfo->GetFamNum(iElem);
if(aFamId != 0){
aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
}
}
- }}
- }
+ ADDMSG(MYDEBUG,endl);
+ }
+ } // end switch(...)
}
}
-
- BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
-
- MED::TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
-
- MED::TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
-
- MED::TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,anElemGroup,aFamilyGroup);
-
- MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
- for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
- const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
- const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
-
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ }
+
+ TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+ BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+ for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+ const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+ const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- if(aFamilyGroup.empty())
+ if(aFamilyGroup.empty())
+ continue;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+ TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+ for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
+ if (aFamilyInfo->GetId() == 0)
continue;
+
+ const std::string& aFamilyName = aFamilyInfo->GetName();
+ PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
- MED::TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
- for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
- MED::PFamilyInfo aFamilyInfo = *aFamilyGroupIter;
- if(aFamilyInfo->GetId() == 0)
- continue;
-
- std::string aFamilyName = aFamilyInfo->GetName();
- VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
-
- aFamily->myId = aFamilyInfo->GetId();
- aFamily->myName = aFamilyInfo->GetName();
- aFamily->myEntity = aVEntity;
- aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
- aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
-
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
- "'; myId = "<<aFamily->myId<<"; "<<
- "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
- "; myEntity = "<<aFamily->myEntity<<
- "; myNbCells = "<<aFamily->myNbCells<<
- "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
-
- VISU::TBindGroups& aBindGroups = aFamily->myGroups;
- MED::TInt aNbGroup = aFamilyInfo->GetNbGroup();
- for(MED::TInt i = 0; i < aNbGroup; i++){
- std::string aGroupName = aFamilyInfo->GetGroupName(i);
- aBindGroups.insert(aGroupName);
- INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
- }
+ aFamily->myId = aFamilyInfo->GetId();
+ aFamily->myName = aFamilyInfo->GetName();
+ aFamily->myEntity = aVEntity;
+ aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
+ aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+ "'; myId = "<<aFamily->myId<<"; "<<
+ "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+ "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+ "; myEntity = "<<aFamily->myEntity<<
+ "; myNbCells = "<<aFamily->myNbCells<<
+ "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
+
+ VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+ const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+ for(TInt i = 0; i < aNbGroup; i++){
+ const string& aGroupName = aFamilyInfo->GetGroupName(i);
+ aBindGroups.insert(aGroupName);
+ INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
}
}
-
- BEGMSG(MYDEBUG,"VISU::TGroup:\n");
-
- VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
- MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
- for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
- const std::string& aGroupName = aGroupInfoIter->first;
- const MED::TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
- VISU::PMEDGroup aGroup(new TMEDGroup());
- aGroup->myName = aGroupName;
- aGroup->myMeshName = aMeshName;
-
- INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
-
- MED::TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
- for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
- MED::PFamilyInfo aFamilyInfo = *aFamilyIter;
- std::string aFamilyName = aFamilyInfo->GetName();
-
- VISU::TEntity aVEntity = TEntity(-1);
- VISU::PFamily aFamily;
-
- // Find aVisuEntity
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
- const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const std::string& aName = aFamilyMapIter->first;
- aFamily = aFamilyMapIter->second;
- if(aName == aFamilyName){
- aVEntity = aFamily->myEntity;
- goto exit_lable;
- }
+ }
+
+ BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+
+ VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+ for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+ const string& aGroupName = aGroupInfoIter->first;
+ const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
+ PMEDGroup aGroup(new TMEDGroup());
+ aGroup->myName = aGroupName;
+ aGroup->myMeshName = aMesh->myName;
+
+ INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+
+ TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
+ for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyIter;
+ const string& aFamilyName = aFamilyInfo->GetName();
+
+ TEntity aVEntity = TEntity(-1);
+ PFamily aFamily;
+
+ // Find aVisuEntity
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+ const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aName = aFamilyMapIter->first;
+ aFamily = aFamilyMapIter->second;
+ if(aName == aFamilyName){
+ aVEntity = aFamily->myEntity;
+ goto exit_lable;
}
}
- exit_lable:
- if(aFamily && aVEntity >= 0){
- aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
-
- aGroup->myNbCells += aFamily->myNbCells;
- aGroup->myCellsSize += aFamily->myCellsSize;
- }
}
- if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
- BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
- "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
- aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+ exit_lable:
+ if(aFamily && aVEntity >= 0){
+ aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
+
+ aGroup->myNbCells += aFamily->myNbCells;
+ aGroup->myCellsSize += aFamily->myCellsSize;
}
}
-
- MED::TInt aNbFields = aMed->GetNbFields();
- BEGMSG(MYDEBUG,"VISU::TField aNbFields = "<<aNbFields<<"\n");
- for(MED::TInt iField = 1; iField <= aNbFields; iField++){
- MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
- MED::TInt aNbComp = aFieldInfo->GetNbComp();
- std::string aFieldName = aFieldInfo->GetName();
-
- MED::TErr anErr;
- MED::TGeom aTGeom;
- MED::EEntiteMaillage aMEntity;
- MED::TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
- aEntityInfo,
- aMEntity,
- aTGeom,
- &anErr);
- if(anErr < 0)
- continue;
+ if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
+ BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
+ "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
+ aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+ }
+ }
+
+ TInt aNbFields = aMed->GetNbFields();
+ BEGMSG(MYDEBUG,"VISU::TField: NbFields="<<aNbFields<<"\n");
+ for(TInt iField = 1; iField <= aNbFields; iField++){
+ PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+ TInt aNbComp = aFieldInfo->GetNbComp();
+ const string& aFieldName = aFieldInfo->GetName();
+
+ MED::TGeom aTGeom;
+ EEntiteMaillage aMEntity;
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
+ if (aNbTimeStamps<1)
+ continue;
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+ aField->myId = iField;
+ aField->myNbComp = aNbComp;
+ aField->myEntity = aVEntity;
+ aField->myName = aFieldName;
+ aField->myMeshName = aMeshName;
+ aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+ aField->myCompNames.resize(aNbComp);
+ aField->myUnitNames.resize(aNbComp);
+
+ INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
+ "'; myId = "<<aField->myId<<
+ "; myEntity = "<<aField->myEntity<<
+ "; myDataSize = "<<aField->myDataSize<<
+ "; myNbComp = "<<aField->myNbComp<<"\n");
+
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+ aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+ }
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- VISU::PMEDField aField = aFieldMap[aFieldName](new TMEDField());
- aField->myId = iField;
- aField->myNbComp = aNbComp;
- aField->myEntity = aVEntity;
- aField->myName = aFieldName;
- aField->myMeshName = aMeshName;
- aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
- aField->myCompNames.resize(aNbComp);
- aField->myUnitNames.resize(aNbComp);
-
- INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
- "'; myId = "<<aField->myId<<
- "; myEntity = "<<aField->myEntity<<
- "; myDataSize = "<<aField->myDataSize<<
- "; myNbComp = "<<aField->myNbComp<<"\n");
-
- for(MED::TInt iComp = 0; iComp < aNbComp; iComp++){
- aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
- aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
- }
-
- for(MED::TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- MED::PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
- aMEntity,
- aTGeom,
- iTimeStamp,
- &anErr);
- if(anErr < 0)
- continue;
-
- MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp,&anErr);
-
- MED::TFloat aDt = aTimeStamp->GetDt();
- std::string anUnitDt = aTimeStamp->GetUnitDt();
- VISU::TValField& aValField = aField->myValField;
- VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
- aValForTime->myId = iTimeStamp;
- aValForTime->myFieldName = aField->myName;
- aValForTime->myEntity = aField->myEntity;
- aValForTime->myMeshName = aField->myMeshName;
- aValForTime->myNbComp = aField->myNbComp;
- aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
- INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
- }
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+ PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ iTimeStamp);
+ TFloat aDt = aTimeStamp->GetDt();
+ const string& anUnitDt = aTimeStamp->GetUnitDt();
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+ TValField& aValField = aField->myValField;
+ PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+ aValForTime->myId = iTimeStamp;
+ aValForTime->myFieldName = aField->myName;
+ aValForTime->myEntity = aField->myEntity;
+ aValForTime->myMeshName = aField->myMeshName;
+ aValForTime->myNbComp = aField->myNbComp;
+ aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
+ INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
}
- }catch (std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
- throw;
- }catch(...){
- EXCEPTION(runtime_error,"Unknown exception !!!");
}
+ } catch (std::runtime_error& exc){
+ MSG(MYDEBUG,"Follow exception wqs occured in:\n"<<exc.what());
+ } catch(...){
+ EXCEPTION(runtime_error,"Unknown exception !!!");
}
+
return this;
}
int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
const string& theFamilyName)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const std::string& aMeshName = theMeshOnEntity->myMeshName;
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ const string& aMeshName = theMeshOnEntity->myMeshName;
const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
- VISU::PMeshImpl aMesh = myMeshMap[aMeshName];
+ PMeshImpl aMesh = myMeshMap[aMeshName];
int isPointsUpdated;
if(anEntity == VISU::NODE_ENTITY)
isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
- const std::string& aFamilyName = aFamilyAndEntitySetIter->first;
+ const string& aFamilyName = aFamilyAndEntitySetIter->first;
const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
if(anEntity == VISU::NODE_ENTITY){
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = LoadPoints(aMed,theMesh);
int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
aMeshOnEntity->myMeshName = theMesh->myName;
- VISU::PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+ PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
//Check on loading already done
bool isPointsLoaded = !theMesh->myPointsCoord.empty();
if(isPointsLoaded)
return 0;
INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
-
+
//Main part of code
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
- MED::TInt aNbElem = aNodeInfo->GetNbElem();
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+ TInt aNbElem = aNodeInfo->GetNbElem();
if(!isPointsLoaded){
VISU::TMeshImpl::TPointsDim& aPointsDim = theMesh->myPointsDim;
VISU::TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
aPointsCoord.resize(aNbElem*theMesh->myDim);
- for(int iElem = 0; iElem < aNbElem; iElem++)
+ for (int iElem = 0; iElem < aNbElem; iElem++)
for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
aConnForCellType.resize(aNbElem);
for (int iElem = 0; iElem < aNbElem; iElem++)
- aConnForCellType[iElem] = TMeshOnEntityImpl::TConnect(1,iElem);
+ aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
}
if(aFamily && aNbElem > 0){
VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
aSubMeshOnCellType.insert(iElem);
}
return 1;
- }catch(std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+ }catch(std::runtime_error& exc){
theMesh->myPointsCoord.clear();
throw;
}catch(...){
{
try{
//Check on existing family
- VISU::PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
+ PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
//Check on loading already done
bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
if(isCellsLoaded)
BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
- const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+ const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
- MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
- MED::TInt aNbPoints = aNodeInfo->GetNbElem();
+ const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+ TInt aNbPoints = aNodeInfo->GetNbElem();
std::map<TInt,TInt> aNodeIdMap;
#ifdef _EDF_NODE_IDS_
- MED::EBooleen anIsNodeNum = MED::eFAUX;
+ EBooleen anIsNodeNum = eFAUX;
#else
- MED::EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+ EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
if(anIsNodeNum){
- for(MED::TInt i = 0; i < aNbPoints; i++){
+ for(TInt i = 0; i < aNbPoints; i++){
aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
}
}
const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
- VISU::TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
+ TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const MED::EGeometrieElement& aGeom = anTGeomIter->first;
+ const EGeometrieElement& aGeom = anTGeomIter->first;
int aVTKGeomType = MEDGeomToVTK(aGeom);
+ ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<<aGeom<<"\n");
switch(aGeom){
- case MED::ePOLYGONE: {
- MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
-
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
- aConnForPolygoneType.resize(aNbElem);
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
- int aMNbNodes = aPolygoneInfo->GetConnDim();
-
- vector<MED::TInt> aConnect(aMNbNodes);
- vector<MED::TInt> aIndex = aPolygoneInfo->GetIndex();
-
- for(int iElem = 0; iElem < aNbElem; iElem++){
- VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
- int aNbConn = aPolygoneInfo->GetNbConn(iElem);
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
+ aConnForPolygoneType.resize(aNbElem);
- anArray.resize(aNbConn);
+ int aMNbNodes = aPolygoneInfo->GetConnDim();
- aConnect = aPolygoneInfo->GetConnectivite();
-
- for(int i = 0 ; i < aNbConn; i++){
- anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ vector<TInt> aConnect(aMNbNodes);
+ vector<TInt> aIndex = aPolygoneInfo->GetIndex();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
+ int aNbConn = aPolygoneInfo->GetNbConn(iElem);
+
+ anArray.resize(aNbConn);
+
+ aConnect = aPolygoneInfo->GetConnectivite();
+
+ for (int i=0;i<aNbConn;i++){
+ anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ }
}
}
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
+ }
+ break;
}
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+
+ int aMNbNodes = aPolyedreInfo->GetNbConn();
+ vector<TInt> aConnect(aMNbNodes);
+ aConnect = aPolyedreInfo->GetConnectivite();
+
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolyedreType = aCellsConn[aVTKGeomType];
+ aConnForPolyedreType.resize(aNbElem);
+
+ vector<TInt> aFacesIndex = aPolyedreInfo->GetFacesIndex();
+ vector<TInt> aIndex = aPolyedreInfo->GetIndex();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ set<TInt> aArrayNew;
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolyedreType[iElem];
+
+ int aInd1 = aIndex[iElem]-1;
+ int aInd2 = aIndex[iElem+1]-2;
+
+ for (int i=aInd1;i<=aInd2;i++){
+ for (int j=aFacesIndex[i]-1;j<aFacesIndex[i+1]-1;j++){
+ aArrayNew.insert(aConnect[j]);
+ }
+ }
+
+ int aNbConnNew = aArrayNew.size();
+ anArray.resize(aNbConnNew);
+ set<TInt>::iterator aIter = aArrayNew.begin();
+ for (int i=0; aIter!=aArrayNew.end();aIter++, i++)
+ anArray[i] = (*aIter)-1;
+
+ }
+ }
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
+ }
+ break;
}
- break;
- }
- default: {
- int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
-
- MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aCellInfo->GetNbElem();
-
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
- aConnForCellType.resize(aNbElem);
+ default:
+ {
+ int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
- int aMNbNodes = MEDGeom2NbNodes(aGeom);
- vector<MED::TInt> aConnect(aMNbNodes);
+ PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
- for(int iElem = 0; iElem < aNbElem; iElem++) {
- TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
- anArray.resize(aVNbNodes);
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
+ aConnForCellType.resize(aNbElem);
- if(anIsNodeNum){
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
+ int aMNbNodes = MEDGeom2NbNodes(aGeom);
+ vector<TInt> aConnect(aMNbNodes);
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
+ anArray.resize(aVNbNodes);
+
+ if(anIsNodeNum){
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
+ }
+ }else{
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
+ }
}
- }else{
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
+
+ switch(aGeom){
+ case eTETRA4:
+ case eTETRA10:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[1];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[2];
+ break;
+ case ePYRA5:
+ case ePYRA13:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[3];
+ anArray[2] = aConnect[2];
+ anArray[3] = aConnect[1];
+ anArray[4] = aConnect[4];
+ break;
+ default:
+ for(int iNode = 0; iNode < aVNbNodes; iNode++)
+ anArray[iNode] = aConnect[iNode];
}
- }
-
- switch(aGeom){
- case MED::eTETRA4:
- case MED::eTETRA10:
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[1];
- anArray[2] = aConnect[3];
- anArray[3] = aConnect[2];
- break;
- case MED::ePYRA5:
- case MED::ePYRA13:
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[3];
- anArray[2] = aConnect[2];
- anArray[3] = aConnect[1];
- anArray[4] = aConnect[4];
- break;
- default:
for(int iNode = 0; iNode < aVNbNodes; iNode++)
- anArray[iNode] = aConnect[iNode];
+ if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+ EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
+ "<= anArray["<<iElem<<"]"<<
+ "["<<iNode<<"]"<<
+ "("<<anArray[iNode]<<") < 0");
}
- for(int iNode = 0; iNode < aVNbNodes; iNode++)
- if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
- EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
- "<= anArray["<<iElem<<"]"<<
- "["<<iNode<<"]"<<
- "("<<anArray[iNode]<<") < 0");
+ }
+ //Filling aFamily SubMesh
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
}
}
- //Filling aFamily SubMesh
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
- }
- }}
+ }
}
return 1;
- }catch(std::exception& exc){
+ }catch(std::runtime_error& exc){
theMeshOnEntity->myCellsConn.clear();
throw;
}catch(...){
if(!theValForTime->myValForCells.empty()) return 0;
//Main part of code
- MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
- MED::TInt anId = theField->myId;
- MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,anId);
+ const std::string& aMeshName = theMeshOnEntity->myMeshName;
+ const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
MED::TGeom aTGeom;
- MED::EEntiteMaillage aMEntity;
- const MED::TEntityInfo& anEntityInfo = theMesh->myEntityInfo;
- theMed->GetNbTimeStamps(aFieldInfo,anEntityInfo,aMEntity,aTGeom);
+ EEntiteMaillage aMEntity;
+ theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
- anId = theValForTime->myId;
- MED::PTimeStampInfo aTimeStampInfo =
- theMed->GetPTimeStampInfo(aFieldInfo,aMEntity,aTGeom,anId);
-
- MED::PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
-
- MED::TInt aNbGauss = aTimeStampInfo->GetNbGauss();
- MED::TInt aNbComp = theField->myNbComp;
+ PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ theValForTime->myId);
+ TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+ TInt aNbComp = theField->myNbComp;
+ PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
bool anIsTrimmed = theField->myIsTrimmed;
+ INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
+ "'; aFieldName = '"<<aFieldInfo->GetName()<<
+ "'; aMEntity = "<<aMEntity<<
+ "; anId = "<<theValForTime->myId<<endl);
+ BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<endl);
+
const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
- const MED::EGeometrieElement& aGeom = aTGeomIter->first;
- const MED::TInt& aNbElem = aTGeomIter->second;
+ const EGeometrieElement& aGeom = aTGeomIter->first;
+ const TInt& aNbElem = aTGeomIter->second;
- INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<endl);
+ INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
if(aTGeom.find(aGeom) == aTGeom.end()){
if(!theField->myIsTrimmed){
int aVTKGeomType = MEDGeomToVTK(aGeom);
VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
anArray.resize(aNbComp*aNbElem);
- for(MED::TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
- for(MED::TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
- for(MED::TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+ for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
}
anArray[anId] /= aNbGauss;
CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
//aSession->GetInterface();
- Engines::Component_var aComponent = aSession->GetVisuComponent();
+ Engines::Component_var aComponent = aSession->GetComponent("libVISUEngineImpl.so");
myVisuGen = VISU::VISU_Gen::_narrow(aComponent);
}
{
return myVisuGen->PasteInto(theStream,theObjectID,theObject);
}
+ Engines::TMPFile* VISU_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript)
+ {
+ return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
+ }
};
SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject);
+
+ // inherited methods from Engines::Component
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript);
+
};
};
BIN_SRC =
CPPFLAGS+= $(OCC_INCLUDES) $(VTK_INCLUDES) \
- -I${KERNEL_ROOT_DIR}/include/salome
+ -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lVisuPipeLine \
- -L${KERNEL_ROOT_DIR}/lib/salome
+ -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
@CONCLUDE@
#include "VISU_Actor.h"
#include "VISU_PipeLine.hxx"
-#include "SALOME_ShrinkFilter.h"
-#include "SALOME_GeometryFilter.h"
-#include "SALOME_PassThroughFilter.h"
+#include "VTKViewer_ShrinkFilter.h"
+#include "VTKViewer_GeometryFilter.h"
+#include "VTKViewer_PassThroughFilter.h"
#include <stdexcept>
myIsShrunk = false;
myIsShrinkable = false;
- myShrinkFilter = SALOME_ShrinkFilter::New();
+ myShrinkFilter = VTKViewer_ShrinkFilter::New();
myShrinkFilter->SetStoreMapping(true);
SetShrinkFactor();
class vtkProperty;
class vtkDataSetMapper;
-class SALOME_ShrinkFilter;
+class VTKViewer_ShrinkFilter;
class VISU_PipeLine;
namespace VISU {
VISU_PipeLine* myPipeLine;
vtkDataSetMapper* myMapper;
- SALOME_ShrinkFilter* myShrinkFilter;
+ VTKViewer_ShrinkFilter* myShrinkFilter;
bool myIsShrinkable;
bool myIsShrunk;
};
// $Header$
#include "VISU_MeshAct.h"
-#include "SALOME_PassThroughFilter.h"
+#include "VTKViewer_PassThroughFilter.h"
#include <vtkObjectFactory.h>
#include <vtkRenderer.h>
myNodeActor->SetPipeLine(thePipeLine);
}
-void VISU_MeshAct::SetTransform(SALOME_Transform* theTransform){
+void VISU_MeshAct::SetTransform(VTKViewer_Transform* theTransform){
VISU_Actor::SetTransform(theTransform);
mySurfaceActor->SetTransform(theTransform);
myEdgeActor->SetTransform(theTransform);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
virtual void SetPipeLine(VISU_PipeLine* thePipeLine) ;
- virtual void SetTransform(SALOME_Transform* theTransform);
+ virtual void SetTransform(VTKViewer_Transform* theTransform);
virtual vtkProperty* GetSurfaceProperty();
virtual void SetSurfaceProperty(vtkProperty* theProperty);
#include "VISU_VectorsAct.h"
#include "VISU_VectorsPL.hxx"
-#include "SALOME_PassThroughFilter.h"
+#include "VTKViewer_PassThroughFilter.h"
// VTK Includes
#include <vtkObjectFactory.h>
}
-void VISU_VectorsAct::SetTransform(SALOME_Transform* theTransform){
+void VISU_VectorsAct::SetTransform(VTKViewer_Transform* theTransform){
myPipeLine->SetTransform(theTransform);
Modified();
}
#include "VISU_ScalarMapAct.h"
-class SALOME_Transform;
+class VTKViewer_Transform;
class VISU_VectorsPL;
class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct {
virtual void SetPipeLine(VISU_PipeLine* thePipeLine);
- virtual void SetTransform(SALOME_Transform* theTransform);
+ virtual void SetTransform(VTKViewer_Transform* theTransform);
virtual void SetMapper(vtkMapper* theMapper);
BIN = VISUPipeLine
BIN_SRC =
-CPPFLAGS+= $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
- -I${KERNEL_ROOT_DIR}/include/salome $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
+CPPFLAGS+= $(VTK_INCLUDES) \
+ -I${KERNEL_ROOT_DIR}/include/salome \
+ -I${GUI_ROOT_DIR}/include/salome \
+ $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
-LDFLAGS+= $(VTK_LIBS) -lSalomeVTKFilter -lVisuConvertor \
- -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace
+LDFLAGS+= $(VTK_LIBS) -lVTKViewer -lVisuConvertor \
+ -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace \
+ -L${GUI_ROOT_DIR}/lib/salome
+
+LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase
-LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase
@CONCLUDE@
#include "VISU_CutLinesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <vtkAppendPolyData.h>
#include "VISU_CutPlanesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <vtkAppendPolyData.h>
#include <vtkCutter.h>
float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
for (int i = 0; i < theNbPlanes; i++){
aPosition = aStartPosition + i*aDBoundPrj;
- float aDelta = (aBoundPrj[0] - aPosition) / aBoundPrj[2];
if(thePlaneCondition[i]){
aPosition = aStartPosition + i*aDBoundPrj;
}else
#include "VISU_DeformedShapePL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_Transform.h"
+#include "VTKViewer_Transform.h"
#include <vtkWarpVector.h>
// Module : VISU
#include "VISU_FieldTransform.hxx"
-#include "SALOME_Transform.h"
+#include "VTKViewer_Transform.h"
#include <vtkObjectFactory.h>
#include <vtkFloatArray.h>
Modified();
}
-void VISU_FieldTransform::SetSpaceTransform(SALOME_Transform* theTransform){
+void VISU_FieldTransform::SetSpaceTransform(VTKViewer_Transform* theTransform){
if(myTransform != theTransform){
if (myTransform != NULL) myTransform->UnRegister(this);
myTransform = theTransform;
template<typename TypeData> void
ExecVectors(VISU_FieldTransform::TTransformFun theFunction,
- SALOME_Transform* theTransform,
+ VTKViewer_Transform* theTransform,
float theScalarRange[2], int theNbComponent,
TypeData* theInputData, TypeData* theOutputData)
{
#include <vtkDataSetToDataSetFilter.h>
-class SALOME_Transform;
+class VTKViewer_Transform;
class VTK_EXPORT VISU_FieldTransform : public vtkDataSetToDataSetFilter{
public:
void SetScalarTransform(TTransformFun theFunction);
TTransformFun GetScalarTransform() { return myFunction;}
- void SetSpaceTransform(SALOME_Transform* theTransform);
- SALOME_Transform* GetSpaceTransform() { return myTransform;}
+ void SetSpaceTransform(VTKViewer_Transform* theTransform);
+ VTKViewer_Transform* GetSpaceTransform() { return myTransform;}
float* GetScalarRange(){ return myScalarRange; }
void SetScalarRange(float theScalarRange[2]);
void operator=(const VISU_FieldTransform&) {};
void Execute();
- SALOME_Transform *myTransform;
+ VTKViewer_Transform *myTransform;
TTransformFun myFunction;
float myScalarRange[2];
};
#include "VISU_MeshPL.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <vtkProperty.h>
#include <vtkObjectFactory.h>
#include "VISU_StreamLinesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
#include "VISU_UsedPointsFilter.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <algo.h>
#include <vtkStreamLine.h>
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
VISU_StreamLinesPL::VISU_StreamLinesPL(){
myStream = vtkStreamLine::New();
myCenters = vtkCellCenters::New();
- myGeomFilter = SALOME_GeometryFilter::New();
+ myGeomFilter = VTKViewer_GeometryFilter::New();
myPointsFilter = VISU_UsedPointsFilter::New();
myPercents = 0.3;
mySource = NULL;
float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) {
if(!theDataSet) return -1.0;
- float aVolume = 1.0, tmp;
+ float aVolume = 1.0;
int degree = 0;
theDataSet->Update();
float* aBounds = theDataSet->GetBounds();
class vtkPointSet;
class vtkCellCenters;
-class SALOME_GeometryFilter;
+class VTKViewer_GeometryFilter;
class VISU_UsedPointsFilter;
class VISU_StreamLinesPL : public VISU_DeformedShapePL{
vtkStreamLine* myStream;
vtkPointSet* mySource;
vtkCellCenters* myCenters;
- SALOME_GeometryFilter *myGeomFilter;
+ VTKViewer_GeometryFilter *myGeomFilter;
VISU_UsedPointsFilter *myPointsFilter;
float myPercents;
};
anOutput->CopyStructure(anInput);
vtkPoints* aPoints = vtkPoints::New();
- vtkIdType aCellSize = anInput->GetMaxCellSize();
vtkIdList *anIdList = vtkIdList::New();
vtkIdType iEnd = anInput->GetNumberOfPoints();
for(vtkIdType i = 0; i < iEnd; i++){
#include "VISU_VectorsPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_TransformFilter.h"
-#include "SALOME_Transform.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_Transform.h"
#include <vtkGlyph3D.h>
#include <vtkConeSource.h>
myLineSource = vtkLineSource::New();
myCenters = vtkCellCenters::New();
- myTransformFilter = SALOME_TransformFilter::New();
+ myTransformFilter = VTKViewer_TransformFilter::New();
}
VISU_VectorsPL::~VISU_VectorsPL(){
}
-void VISU_VectorsPL::SetTransform(SALOME_Transform* theTransform){
+void VISU_VectorsPL::SetTransform(VTKViewer_Transform* theTransform){
myFieldTransform->SetSpaceTransform(theTransform);
myTransformFilter->SetTransform(theTransform);
myTransformFilter->Modified();
}
-SALOME_Transform* VISU_VectorsPL::GetTransform(){
+VTKViewer_Transform* VISU_VectorsPL::GetTransform(){
return myFieldTransform->GetSpaceTransform();
}
#include "VISU_DeformedShapePL.hxx"
-class SALOME_TransformFilter;
-class SALOME_Transform;
+class VTKViewer_TransformFilter;
+class VTKViewer_Transform;
class vtkCellCenters;
class vtkGlyphSource2D;
virtual void Init();
virtual void Update();
- virtual void SetTransform(SALOME_Transform* theTransform);
- virtual SALOME_Transform* GetTransform();
+ virtual void SetTransform(VTKViewer_Transform* theTransform);
+ virtual VTKViewer_Transform* GetTransform();
virtual void SetMapScale(float theMapScale = 1.0);
vtkConeSource *myConeSource;
vtkCellCenters* myCenters;
- SALOME_TransformFilter *myTransformFilter;
+ VTKViewer_TransformFilter *myTransformFilter;
};
# header files
EXPORT_HEADERS= \
- VisuGUI_NonIsometricDlg.h
+ VisuGUI_NonIsometricDlg.h \
+ VisuGUI_Tools.h
# .po files to transform in .qm
PO_FILES = \
- VISU_msg_en.po VISU_icons.po
+ VISU_msg_en.po VISU_images.po
# Libraries targets
-LIB = libVISUGUI.la
+LIB = libVISU.la
+#LIB_SRC = VisuGUI_MagnitudeDlg.cxx \
+# VisuGUI_CursorDlg.cxx \
+# VisuGUI_SweepPrefDlg.cxx \
+# VisuGUI_NonIsometricDlg.cxx
+#LIB_MOC = \
+# VisuGUI_MagnitudeDlg.h \
+# VisuGUI_CursorDlg.h \
+# VisuGUI_SweepPrefDlg.h \
+# VisuGUI_NonIsometricDlg.h
+
LIB_SRC = VisuGUI.cxx \
VisuGUI_Selection.cxx \
- VisuGUI_MagnitudeDlg.cxx \
- VisuGUI_IsoSurfacesDlg.cxx \
- VisuGUI_CursorDlg.cxx \
- VisuGUI_VectorsDlg.cxx \
- VisuGUI_CutPlanesDlg.cxx \
+ VisuGUI_Tools.cxx \
+ VisuGUI_PopupTools.cxx \
+ VisuGUI_FileDlg.cxx \
+ VisuGUI_TimeAnimation.cxx \
+ VisuGUI_EditContainerDlg.cxx \
VisuGUI_ScalarBarDlg.cxx \
- VisuGUI_SweepPrefDlg.cxx \
- VisuGUI_NonIsometricDlg.cxx \
- VisuGUI_StreamLinesDlg.cxx \
- VisuGUI_TimeAnimation.cxx \
+ VisuGUI_DeformedShapeDlg.cxx \
+ VisuGUI_IsoSurfacesDlg.cxx \
VisuGUI_CutLinesDlg.cxx \
- VisuGUI_FileDlg.cxx \
- VisuGUI_EditContainerDlg.cxx
+ VisuGUI_CutPlanesDlg.cxx \
+ VisuGUI_StreamLinesDlg.cxx \
+ VisuGUI_VectorsDlg.cxx
-LIB_MOC = \
- VisuGUI.h \
- VisuGUI_MagnitudeDlg.h \
- VisuGUI_IsoSurfacesDlg.h \
- VisuGUI_CursorDlg.h \
- VisuGUI_VectorsDlg.h \
- VisuGUI_CutPlanesDlg.h \
- VisuGUI_ScalarBarDlg.h \
- VisuGUI_SweepPrefDlg.h \
- VisuGUI_NonIsometricDlg.h \
- VisuGUI_StreamLinesDlg.h \
- VisuGUI_TimeAnimation.h \
- VisuGUI_CutLinesDlg.h \
+LIB_MOC = VisuGUI.h \
+ VisuGUI_Selection.h \
VisuGUI_FileDlg.h \
+ VisuGUI_TimeAnimation.h \
VisuGUI_EditContainerDlg.h \
- VisuGUI_Selection.h
+ VisuGUI_ScalarBarDlg.h \
+ VisuGUI_DeformedShapeDlg.h \
+ VisuGUI_IsoSurfacesDlg.h \
+ VisuGUI_CutLinesDlg.h \
+ VisuGUI_CutPlanesDlg.h \
+ VisuGUI_StreamLinesDlg.h \
+ VisuGUI_VectorsDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
VISU_Gen.idl \
MED_Gen.idl \
MED.idl \
SALOMEDS.idl \
+ SALOME_GenericObj.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
SALOMEDS_Attributes.idl \
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \
$(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
-I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
+CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) \
+ -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
-LDFLAGS += $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
- -lVisuObject -lVISUEngineImpl -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS += $(QWT_LIBS) -lSalomeNS \
+ -lVisuObject -lVISUEngineImpl -lSVTK -lSPlot2d \
+ -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
@CONCLUDE@
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : VisuGUI_icons.po
+# Module : VISU
+
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: 2005-05-10 15:20+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+msgid "ICON_OBJBROWSER_Visu"
+msgstr "Visu_tree_visu.png"
+
+msgid "ICON_SCALAR_MAP"
+msgstr "Visu_scalars.png"
+
+msgid "ICON_DEFORMED_SHAPE"
+msgstr "Visu_deformed.png"
+
+msgid "ICON_VECTORS"
+msgstr "Visu_vectors.png"
+
+msgid "ICON_ISO_SURFACES"
+msgstr "Visu_isosurfaces.png"
+
+msgid "ICON_CUT_PLANES"
+msgstr "Visu_cutplane.png"
+
+msgid "ICON_CUT_LINES"
+msgstr "Visu_cutlines.png"
+
+msgid "ICON_STREAM_LINES"
+msgstr "Visu_streamlines.png"
-# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#
-#
-#
-# File : VisuGUI_msg_en.po
-# Module : VISU
-
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
-msgid "VISU_BUT_OK"
-msgstr "OK"
-
-msgid "VISU_WARNING"
-msgstr "Post-Pro Warning"
-
-msgid "WARNING"
-msgstr "Warning"
-
-#: isodlg.cxx:20
-msgid "::VISU_MEN_ISOSURFDLG"
-msgstr "Iso Surface"
-
-#: VisuGUI.cxx:1351
-msgid "VisuGUI::BT"
-msgstr "Bad Type for Selected Item"
-
-#: VisuGUI.cxx:1263
-msgid "VisuGUI::II"
-msgstr "Input Information not selected"
-
-#: VisuGUI.cxx:1636
-msgid "VisuGUI::ND"
-msgstr "No Data in file selected"
-
-#: VisuGUI.cxx:1290
-msgid "VisuGUI::NI"
-msgstr "No Data in file selected"
-
-#: VisuGUI.cxx:1644
-msgid "VisuGUI::NO"
-msgstr "Nil Objetc"
-
-#: VisuGUI.cxx:1164
-msgid "VisuGUI::NR"
-msgstr "No Results in file selected"
-
-#: VisuGUI_CursorDlg.cxx:43
-msgid "VisuGUI_CursorDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_CursorDlg.cxx:30
-msgid "VisuGUI_CursorDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_CursorDlg.cxx:37
-msgid "VisuGUI_CursorDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_CursorDlg.cxx:49
-msgid "VisuGUI_CursorDlg::Choose a value"
-msgstr "Choose a Value"
-
-#: VisuGUI_CursorDlg.cxx:20
-msgid "VisuGUI_CursorDlg::MyDialog"
-msgstr "Change Cursor"
-
-#: VisuGUI_IsoSurfacesDlg.cxx:87
-msgid "VisuGUI_IsoSurfacesDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_IsoSurfacesDlg.cxx:74
-msgid "VisuGUI_IsoSurfacesDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_IsoSurfacesDlg.cxx:81
-msgid "VisuGUI_IsoSurfacesDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_IsoSurfacesDlg.cxx:26
-msgid "VisuGUI_IsoSurfacesDlg::Iso Surfaces Representation"
-msgstr ""
-
-#: VisuGUI_IsoSurfacesDlg.cxx:40
-msgid "VisuGUI_IsoSurfacesDlg::Maximum value"
-msgstr ""
-
-#: VisuGUI_IsoSurfacesDlg.cxx:35
-msgid "VisuGUI_IsoSurfacesDlg::Minimum value"
-msgstr ""
-
-#: VisuGUI_IsoSurfacesDlg.cxx:21
-msgid "VisuGUI_IsoSurfacesDlg::MyDialog"
-msgstr "Iso Surface"
-
-#: VisuGUI_IsoSurfacesDlg.cxx:44
-msgid "VisuGUI_IsoSurfacesDlg::Number of surfaces"
-msgstr ""
+msgid "MEN_IMPORT_FROM_FILE"
+msgstr "Import from File"
-#: VisuGUI_IsoSurfacesDlg.cxx:170
-msgid "VisuGUI_IsoSurfacesDlg::WRN_LOGARITHMIC_RANGE_ISOSURF"
-msgstr "Logarithmic scaling: use range values > 0"
+msgid "MEN_EXPLORE_MED_FILE"
+msgstr "Explore MED File"
-#: VisuGUI_MagnitudeDlg.cxx:43
-msgid "VisuGUI_MagnitudeDlg::VISU_BUT_CANCEL"
-msgstr "Cancel"
+msgid "MEN_IMPORT_TABLE"
+msgstr "Import table from File"
-#: VisuGUI_MagnitudeDlg.cxx:30
-msgid "VisuGUI_MagnitudeDlg::VISU_BUT_HELP"
-msgstr "Help"
+msgid "WRN_STUDY_LOCKED"
+msgstr "Current Study is locked"
-#: VisuGUI_MagnitudeDlg.cxx:37
-msgid "VisuGUI_MagnitudeDlg::VISU_BUT_OK"
-msgstr "OK"
-
-#: VisuGUI_MagnitudeDlg.cxx:54
-msgid "VisuGUI_MagnitudeDlg::VISU_MEN_PHASE"
-msgstr "Magnitude"
+msgid "ERR_CANT_FIND_VISU_COMPONENT"
+msgstr "Failed to activate VISU engine!"
-#: VisuGUI_VectorsDlg.cxx:47
-msgid "VisuGUI_VectorsDlg::&Cancel"
-msgstr "Cancel"
+msgid "ERR_CANT_FIND_MED_COMPONENT"
+msgstr "Failed to activate MED engine!"
-#: VisuGUI_VectorsDlg.cxx:34
-msgid "VisuGUI_VectorsDlg::&Help"
-msgstr "Help"
+msgid "ERR_CANT_BUILD_PRESENTATION"
+msgstr "Cannot build presentation"
-#: VisuGUI_VectorsDlg.cxx:41
-msgid "VisuGUI_VectorsDlg::&OK"
+msgid "BUT_OK"
msgstr "OK"
-#: VisuGUI_VectorsDlg.cxx:68
-msgid "VisuGUI_VectorsDlg::0.1"
-msgstr ""
+msgid "WRN_VISU"
+msgstr "VISU Warning"
-#: VisuGUI_VectorsDlg.cxx:129
-msgid "VisuGUI_VectorsDlg::Arrows"
-msgstr ""
+msgid "INF_DONE"
+msgstr " done"
-#: VisuGUI_VectorsDlg.cxx:124
-msgid "VisuGUI_VectorsDlg::Cones (2)"
-msgstr ""
+msgid "ERR_ERROR_IN_THE_FILE"
+msgstr "Error in the file"
-#: VisuGUI_VectorsDlg.cxx:119
-msgid "VisuGUI_VectorsDlg::Cones (6)"
-msgstr ""
+msgid "FLT_ALL_FILES"
+msgstr "All Files (*.*)"
-#: VisuGUI_VectorsDlg.cxx:109
-msgid "VisuGUI_VectorsDlg::Glyph type"
-msgstr ""
+msgid "FLT_MED_FILES"
+msgstr "MED Files (*.med)"
-#: VisuGUI_VectorsDlg.cxx:84
-msgid "VisuGUI_VectorsDlg::Line width"
-msgstr ""
+msgid "FLT_TABLE_FILES"
+msgstr "Tables (*.xls *.txt *.tab)"
-#: VisuGUI_VectorsDlg.cxx:97
-msgid "VisuGUI_VectorsDlg::Magnitude coloring"
-msgstr ""
+msgid "MEN_SCALAR_MAP"
+msgstr "Scalar Map"
-#: VisuGUI_VectorsDlg.cxx:24
-msgid "VisuGUI_VectorsDlg::MyDialog"
-msgstr "Vectors"
+msgid "MEN_DEFORMED_SHAPE"
+msgstr "Deformed Shape"
-#: VisuGUI_VectorsDlg.cxx:63
-msgid "VisuGUI_VectorsDlg::Scale factor"
-msgstr ""
+msgid "MEN_VISUALIZATION"
+msgstr "Visualization"
-#: VisuGUI_VectorsDlg.cxx:103
-msgid "VisuGUI_VectorsDlg::Use glyphs"
-msgstr ""
+msgid "TOOL_VISUALISATION"
+msgstr "Visualization Toolbar"
-#: VisuGUI_VectorsDlg.cxx:53
-msgid "VisuGUI_VectorsDlg::Vectors Representation"
-msgstr ""
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:795
+msgid "VisuGUI::MEN_ANIMATION"
+msgstr "Animation..."
-msgid "VisuGUI_BAD_MEDFILE"
-msgstr "Med file is not correct"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:759
+msgid "VisuGUI::MEN_CELL_COLOR"
+msgstr "Cell color"
-msgid "VisuGUI_IMPORT_FROM_MED"
-msgstr "Import from med file"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:727
+msgid "VisuGUI::MEN_CLEAR_CONTAINER"
+msgstr "Clear"
-msgid "MED_MEN_IMPORT"
-msgstr "Import"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:763
+msgid "VisuGUI::MEN_COLOR"
+msgstr "Color..."
-msgid "MED_MEN_ALL_FILES"
-msgstr "All Files ( * )"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:663
+msgid "VisuGUI::MEN_CREATE_CURVES"
+msgstr "Create Curves"
-msgid "MED_MEN_IMPORT_MED"
-msgstr "MED Files ( *.med )"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:675
+msgid "VisuGUI::MEN_CREATE_MANY_PRS"
+msgstr "Create Presentations"
-msgid "BUT_CLOSE"
-msgstr "Close"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:647
+msgid "VisuGUI::MEN_CREATE_PLOT2D"
+msgstr "Create Plot2d View"
-msgid "BUT_CANCEL"
-msgstr "&Cancel"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:671
+msgid "VisuGUI::MEN_CREATE_PRS"
+msgstr "Create Presentation"
-msgid "WRN_LOGARITHMIC_RANGE"
-msgstr "Logarithmic scaling: use imposed range values > 0"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:783
+msgid "VisuGUI::MEN_CREATE_TABLE"
+msgstr "Create Table"
-msgid "WRN_LOGARITHMIC_FIELD_RANGE"
-msgstr "Logarithmic scaling: field range contains negative values, use imposed range instead"=======
-msgid "TXT_ORIENTATION"
-msgstr "Orientation"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:711
+msgid "VisuGUI::MEN_CURVE_PROPS"
+msgstr "Properties..."
-msgid "LBL_NB_PLANS"
-msgstr "Number of planes:"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:643
+msgid "VisuGUI::MEN_CUT_LINES"
+msgstr "Cut Lines"
-msgid "LBL_ROTATION"
-msgstr "Rotations"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:635
+msgid "VisuGUI::MEN_CUT_PLANES"
+msgstr "Cut Planes"
-msgid "LBL_LINES_PLANE"
-msgstr "Plane of lines"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:651
+msgid "VisuGUI::MEN_DELETE_OBJ"
+msgstr "Delete"
-msgid "LBL_LINES_CUT"
-msgstr "Cut planes"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:707
+msgid "VisuGUI::MEN_DELETE_PRS"
+msgstr "Delete"
-msgid "LBL_ROT_X"
-msgstr "Rotation around X (Y to Z):"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:695
+msgid "VisuGUI::MEN_DISPLAY"
+msgstr "Display"
-msgid "LBL_ROT_Y"
-msgstr "Rotation around Y (Z to X):"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:703
+msgid "VisuGUI::MEN_DISPLAY_ONLY"
+msgstr "Display Only"
-msgid "LBL_ROT_Z"
-msgstr "Rotation around Z (X to Y):"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:767
+msgid "VisuGUI::MEN_EDGE_COLOR"
+msgstr "Edge Color"
-msgid "LBL_POS"
-msgstr "Displacement (0...1):"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:719
+msgid "VisuGUI::MEN_EDIT_CONTAINER"
+msgstr "Edit..."
-msgid "MSG_MINMAX_VALUES"
-msgstr "Min value can not be higher or equal to Max value"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:779
+msgid "VisuGUI::MEN_EDIT_PRS"
+msgstr "Edit..."
-msgid "MSG_NOT_IMPLEMENTED"
-msgstr "Not Yet Implemented"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:699
+msgid "VisuGUI::MEN_ERASE"
+msgstr "Erase"
-msgid "ERR_UNKNOWN_EXCEPTION"
-msgstr "Unknown exception was caught in VISU module"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:667
+msgid "VisuGUI::MEN_EXPORT_TABLE"
+msgstr "Export Table"
-msgid "ERR_BAD_TYPE_POPUP"
-msgstr "Bad Type for Selected Item in Popup Menu"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:805
+#msgid "VisuGUI::MEN_FILE"
+#msgstr ""
-msgid "ERR_NIL_OBJECT"
-msgstr "nil object"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:743
+msgid "VisuGUI::MEN_INSIDEFRAME"
+msgstr "Insideframe"
-msgid "WRN_NO_AVAILABLE_DATA"
-msgstr "No Available data in selection"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:631
+msgid "VisuGUI::MEN_ISO_SURFACES"
+msgstr "Iso Surfaces"
-msgid "ERR_CANT_BUILD_PRESENTATION"
-msgstr "The object can't be built"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:775
+msgid "VisuGUI::MEN_LINE_WIDTH"
+msgstr "Line Width"
-msgid "ERR_CANT_CREATE_ACTOR"
-msgstr "Can't create actor for this presentation"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:771
+msgid "VisuGUI::MEN_OPACITY"
+msgstr "Opacity"
-msgid "ERR_WRONG_SELECTION_MODE"
-msgstr "Wrong selection mode"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:731
+msgid "VisuGUI::MEN_POINTS"
+msgstr "Points"
-msgid "ERR_ERROR_IN_THE_FILE"
-msgstr "There is an error in imported file"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:926
+msgid "VisuGUI::MEN_PROPERTIES"
+msgstr "Properties"
-msgid "ERR_ERROR_DURING_EXPORT"
-msgstr "Error has been occured during exporting to file"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:715
+msgid "VisuGUI::MEN_RENAME"
+msgstr "Rename..."
-msgid "ERR_CANT_VISUALIZE_OBJECT"
-msgstr "Can't visualize current object"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:723
+msgid "VisuGUI::MEN_RENAME_CONTAINER"
+msgstr "Rename..."
-msgid "WRN_CANT_VISUALIZE_PRS"
-msgstr "The presentation can't be visualized.\nNull actor is created."
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:655
+msgid "VisuGUI::MEN_RENAME_TABLE"
+msgstr "Rename..."
-msgid "ERR_NO_MEMORY"
-msgstr "There is no enough memory"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:905
+msgid "VisuGUI::MEN_REPRESENTATION"
+msgstr "Representation"
-msgid "LBL_SOURCE_TYPE"
-msgstr "Source type"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:791
+msgid "VisuGUI::MEN_SELECTION_INFO"
+msgstr "Selection Info..."
-msgid "MSG_NO_ANIMATIONDATA"
-msgstr "There is no data for animation"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:659
+msgid "VisuGUI::MEN_SHOW_TABLE"
+msgstr "Show Table"
-msgid "LBL_SHOW_PREVIEW"
-msgstr "Show preview"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:751
+msgid "VisuGUI::MEN_SHRINK"
+msgstr "Shrink"
-msgid "LBL_GENERATE_TABLE"
-msgstr "Generate Data Table"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:639
+msgid "VisuGUI::MEN_STREAM_LINES"
+msgstr "Stream Lines"
-msgid "LBL_GENERATE_CURVES"
-msgstr "Generate Curves"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:739
+msgid "VisuGUI::MEN_SURFACE"
+msgstr "Surface"
-msgid "TIT_TEXT_PREF"
-msgstr "Text property"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:747
+msgid "VisuGUI::MEN_SURFACEFRAME"
+msgstr "Surfaceframe"
-msgid "LBL_BOLD"
-msgstr "Bold"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:787
+msgid "VisuGUI::MEN_SWEEP"
+msgstr "Sweep"
-msgid "LBL_ITALIC"
-msgstr "Italic"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:755
+msgid "VisuGUI::MEN_UNSHRINK"
+msgstr "Unshrink"
-msgid "LBL_SHADOW"
-msgstr "Shadow"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:627
+msgid "VisuGUI::MEN_VECTORS"
+msgstr "Vectors"
-msgid "LBL_TITLE"
-msgstr "Title"
+#: VISU_SRC/src/VISUGUI/VisuGUI.cxx:735
+msgid "VisuGUI::MEN_WIREFRAME"
+msgstr "Wireframe"
-msgid "LBL_LABELS"
-msgstr "Labels"
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// Module : VISU
// $Header$
-#include "VisuGUI.h"
+#include <exception>
+#include <typeinfo>
+#include <vector>
-#include "VISU_Gen_i.hh"
-#include "VISU_Result_i.hh"
-#include "VISU_PrsObject_i.hh"
-#include "VISU_ViewManager_i.hh"
+#include <qptrlist.h>
+#include <qptrvector.h>
+
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkActorCollection.h>
+
+#include "SALOME_LifeCycleCORBA.hxx"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
+
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
+
+#include "CAM_Module.h"
+
+#include "SVTK_RenderWindow.h"
+#include "SVTK_ViewWindow.h"
-#include "VISU_PipeLine.hxx"
+#include "SVTK_ViewModel.h"
+#include "SVTK_Functor.h"
-#include "VISU_Prs3d_i.hh"
+#include "OB_Browser.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_DataModel.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Selection.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Gen_i.hh"
#include "VISU_Mesh_i.hh"
-#include "VISU_ScalarMap_i.hh"
-#include "VISU_IsoSurfaces_i.hh"
-#include "VISU_DeformedShape_i.hh"
-#include "VISU_CutPlanes_i.hh"
-#include "VISU_CutLines_i.hh"
-#include "VISU_Vectors_i.hh"
-#include "VISU_StreamLines_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_ViewManager_i.hh"
#include "VISU_Actor.h"
-#include "VISU_MeshAct.h"
-#include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_CursorDlg.h"
-#include "VisuGUI_ScalarBarDlg.h"
-#include "VisuGUI_SweepPrefDlg.h"
-#include "VisuGUI_CutPlanesDlg.h"
-#include "VisuGUI_CutLinesDlg.h"
-#include "VisuGUI_VectorsDlg.h"
-#include "VisuGUI_IsoSurfacesDlg.h"
-#include "VisuGUI_StreamLinesDlg.h"
-#include "VisuGUI_EditContainerDlg.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_PopupTools.h"
+#include "VisuGUI_FileDlg.h"
+#include "VisuGUI_Selection.h"
#include "VisuGUI_TimeAnimation.h"
+#include "VisuGUI_EditContainerDlg.h"
-#include "VisuGUI_Selection.h"
-#include "VisuGUI_NonIsometricDlg.h"
+#include "VISU_ScalarMap_i.hh"
+#include "VisuGUI_ScalarBarDlg.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
+#include "VISU_DeformedShape_i.hh"
+#include "VisuGUI_DeformedShapeDlg.h"
-#include "QAD_Config.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Tools.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_ObjectBrowserItem.h"
-#include "QAD_Menus.h"
-#include "QAD_Resource.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_FileDlg.h"
-#include "QAD_WaitCursor.h"
-#include "SALOME_Selection.h"
-#include "SALOMEGUI_NameDlg.h"
-#include "SALOMEGUI_TableDlg.h"
-#include "SALOMEGUI_SetupCurveDlg.h"
-#include "SALOMEGUI_SetValueDlg.h"
-#include "SALOMEGUI_Desktop.h"
-#include "Plot2d_SetupPlot2dDlg.h"
-#include "Plot2d_ViewFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VisuGUI_FileDlg.h"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VisuGUI_IsoSurfacesDlg.h"
-// QT Includes
-#define INCLUDE_MENUITEM_DEF
-#include <qpopupmenu.h>
-#include <qfont.h>
-#include <qpainter.h>
-#include <qstring.h>
-#include <qapplication.h>
-#include <qinputdialog.h>
-#include <qcolordialog.h>
-#include <qlabel.h>
-#include <qspinbox.h>
-#include <qradiobutton.h>
-#include <qthread.h>
-#include <qlistbox.h>
-#include <qcombobox.h>
-#include <qregexp.h>
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qlistview.h>
-#endif
-//VRV: porting on Qt 3.0.5
-#include <qmessagebox.h>
+#include "VISU_CutPlanes_i.hh"
+#include "VisuGUI_CutPlanesDlg.h"
-#include CORBA_CLIENT_HEADER(MED_Gen)
+#include "VISU_CutLines_i.hh"
+#include "VisuGUI_CutLinesDlg.h"
-#include <vtkActor.h>
-#include <vtkRenderer.h>
-#include <vtkDataSetMapper.h>
-#include <vtkActorCollection.h>
+#include "VISU_StreamLines_i.hh"
+#include "VisuGUI_StreamLinesDlg.h"
-// Open CASCADE Include
-#include <TCollection_AsciiString.hxx>
+#include "VISU_Vectors_i.hh"
+#include "VisuGUI_VectorsDlg.h"
-//#define CHECKTIME
-#ifdef CHECKTIME
-static int MYCHECKTIME = 1;
-#else
-static int MYCHECKTIME = 0;
-#endif
-#include <Utils_Timer.hxx>
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(MED_Gen)
+
+#include "utilities.h"
-using namespace std;
+using namespace VISU;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
-class CustomItem : public QCustomMenuItem
-{
-public:
- CustomItem(const QString& s, const QFont& f) : myString(s), myFont(f) {}
- ~CustomItem() {}
-
- void paint(QPainter* p, const QColorGroup& cg, bool act, bool /*enabled*/, int x, int y, int w, int h)
- {
- p->save();
- p->fillRect( x, y, w, h, act ? cg.highlight() : cg.mid() );
- p->setPen( act ? cg.highlightedText() : cg.buttonText() );
- p->setFont( myFont );
- p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- p->restore();
- }
-
- QSize sizeHint()
- {
- return QFontMetrics( myFont ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- }
-
- bool fullSpan() const
- {
- return true;
- }
-
-private:
- QString myString;
- QFont myFont;
-};
-
-inline bool IsSObjectTable(SALOMEDS::SObject_ptr theSObject){
- if(!theSObject->_is_nil()) {
- SALOMEDS::GenericAttribute_var anAttr;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
- return true;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
- return true;
- }
- return false;
-}
-
+//////////////////////////////////////////////////
+// Class: VisuGUI
+//////////////////////////////////////////////////
-static VisuGUI MYVISUGUI;
-VisuGUI *visuGUI = &MYVISUGUI;
-
-VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
- VISU::VISU_Gen_i::GetVisuGenImpl()->SetCurrentStudy(GetStudyDocument());
- return VISU::VISU_Gen_i::GetVisuGenImpl();
-}
-
-static int ComputeVisiblePropBounds(VTKViewer_ViewFrame* theViewFrame, float allBounds[6],
- const char* theActorClassName = "VISU_Actor")
+VisuGUI::VisuGUI():
+ SalomeApp_Module( "VISU" )
{
- vtkRenderer *aRen = theViewFrame->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
- vtkProp *prop;
- float *bounds;
- int nothingVisible=1;
-
- allBounds[0] = allBounds[2] = allBounds[4] = VTK_LARGE_FLOAT;
- allBounds[1] = allBounds[3] = allBounds[5] = -VTK_LARGE_FLOAT;
- // loop through all props
- for (anActColl->InitTraversal(); (prop = anActColl->GetNextProp()); ){
- // if it's invisible, or has no geometry, we can skip the rest
- if ( prop->GetVisibility() && prop->IsA(theActorClassName)){
- bounds = prop->GetBounds();
- // make sure we haven't got bogus bounds
- if ( bounds != NULL &&
- bounds[0] > -VTK_LARGE_FLOAT && bounds[1] < VTK_LARGE_FLOAT &&
- bounds[2] > -VTK_LARGE_FLOAT && bounds[3] < VTK_LARGE_FLOAT &&
- bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT )
- {
- nothingVisible = 0;
- if (bounds[0] < allBounds[0]) allBounds[0] = bounds[0];
- if (bounds[1] > allBounds[1]) allBounds[1] = bounds[1];
- if (bounds[2] < allBounds[2]) allBounds[2] = bounds[2];
- if (bounds[3] > allBounds[3]) allBounds[3] = bounds[3];
- if (bounds[4] < allBounds[4]) allBounds[4] = bounds[4];
- if (bounds[5] > allBounds[5]) allBounds[5] = bounds[5];
- }//not bogus
- }
- }
- return nothingVisible;
}
-VisuGUI::CameraOrient VisuGUI::SetFitAll(VTKViewer_ViewFrame* theViewFrame){
- static float PRECISION = 0.000001;
- static float DEVIATION = 600;
- float XYZ_Bnd[6];
- if(ComputeVisiblePropBounds(theViewFrame,XYZ_Bnd)) return e3D;
-
- float absX = XYZ_Bnd[1]-XYZ_Bnd[0];
-
- float absY = XYZ_Bnd[3]-XYZ_Bnd[2];
-
- float absZ = XYZ_Bnd[5]-XYZ_Bnd[4];
-
- CameraOrient aCameraOrient = e3D;
- if(absX <= PRECISION) aCameraOrient = eFront;
- else {if(absY <= PRECISION) aCameraOrient = eLeft;
- else {if(absZ <= PRECISION) aCameraOrient = eTop;}}
-
- float dev_abs_XY = absX / absY;
- float dev_abs_YZ = absY / absZ;
- float dev_abs_XZ = absX / absZ;
- if(dev_abs_XY >= DEVIATION || 1./dev_abs_YZ >= DEVIATION) aCameraOrient = eLeft;
- else{if(1./dev_abs_XY >= DEVIATION || 1./dev_abs_XZ >= DEVIATION) aCameraOrient = eFront;
- else {if(dev_abs_XZ >= DEVIATION || dev_abs_YZ >= DEVIATION) aCameraOrient = eTop;}}
-
- switch(aCameraOrient){
- case eFront: theViewFrame->onViewFront(); break;
- case eLeft: theViewFrame->onViewLeft(); break;
- case eTop: theViewFrame->onViewTop(); break;
- case e3D: theViewFrame->onViewReset(); break;
- }
- theViewFrame->getRenderer()->ResetCameraClippingRange();
- theViewFrame->onViewFitAll();
- return aCameraOrient;
-}
-
-QAD_Desktop* VisuGUI::GetDesktop(){
- return QAD_Application::getDesktop() ;
-}
-QAD_Study* VisuGUI::GetActiveStudy(){
- return GetDesktop()->getActiveStudy() ;
+VisuGUI::~VisuGUI()
+{
}
-vtkRenderer* VisuGUI::GetRenderer(){
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame())
- return aViewFrame->getRenderer();
- return NULL;
-}
-VTKViewer_ViewFrame* VisuGUI::GetVtkViewFrame(){
- QAD_ViewFrame* aViewFrame = GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
-}
+void
+VisuGUI::
+OnImportFromFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
+ CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_MED_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_IMPORT_FROM_FILE"),
+ true);
+ if(aFileInfo.exists()){
+ application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
-static void UpdateViewFrame() {
- QList<QAD_StudyFrame> aFrameList = VisuGUI::GetActiveStudy()->getStudyFrames();
-
- for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
- if (aStudyFrame->getTypeView() == VIEW_VTK) {
- QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame();
- VTKViewer_ViewFrame* aVtkViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
- if (!aVtkViewFrame) continue;
- VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
- if (anInteractor) {
- anInteractor->SetSelectionProp();
- anInteractor->SetSelectionTolerance();
- VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
- if (aStyle) {
- aStyle->setPreselectionProp();
+ VISU::Result_var aResult;
+ bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
+ if(VisuGUI_FileDlg::IsBuild){
+ aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
+ if(!CORBA::is_nil(aResult.in()))
+ if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
+ if(!aRes->IsPossible())
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_CANT_BUILD_PRESENTATION"),
+ tr("BUT_OK") );
+ else
+ aRes->BuildAll();
}
- }
+ }else{
+ aResourceMgr->setValue("Visu:BuildResult",false);
+ aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
+ aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
}
- }
-}
-
-SALOMEDS::Study_var VisuGUI::GetStudyDocument(){
- return GetActiveStudy()->getStudyDocument();
-}
-
-SALOMEDS::StudyBuilder_var VisuGUI::NewBuilder(){
- return GetStudyDocument()->NewBuilder();
-}
-
-/**
- * Finds value by given key
- */
-
-VISU::Storable::TRestoringMap VisuGUI::getMapOfValue(SALOMEDS::SObject_var theSObject) {
- VISU::Storable::TRestoringMap aMap;
- if(!theSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aString = aComment->Value();
- QString strIn(aString.in());
- VISU::Storable::StrToMap(strIn,aMap);
+ if(CORBA::is_nil(aResult.in())) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK") );
+ }else{
+ application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
+ updateObjBrowser();
}
}
- return aMap;
-}
-
-QString VisuGUI::getValue(SALOMEDS::SObject_var theSObject, QString theKey) {
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if(!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
- return aStr;
}
-CORBA::Object_var GetSelectedObj(Handle(SALOME_InteractiveObject)* pIO = NULL, QAD_Study* theStudy = NULL,
- VISU::Storable::TRestoringMap* pMap = NULL)
+void
+VisuGUI::
+OnExploreMEDFile()
{
- if(theStudy == NULL) theStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection(theStudy->getSelection());
- if(aSel->IObjectCount() > 0){
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- if(pIO != NULL) *pIO = anIO;
- if(anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (pMap != NULL && aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,*pMap);
- }
- return VISU::SObjectToObject(aSObject);
- }
- }
+ if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ CheckLock(GetDSStudy(aStudy),this);
+
+ SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_MED_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_EXPLORE_MED_FILE"),
+ true);
+ if(aFileInfo.exists()){
+ application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
+ std::string aStudyName = aStudy->Name();
+ aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
+ application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
+ updateObjBrowser();
}
- return CORBA::Object::_nil();
}
-int IsTrihedronDisplayed(){
- if(VTKViewer_ViewFrame* aVTKViewFrame = VisuGUI::GetVtkViewFrame())
- return aVTKViewFrame->isTrihedronDisplayed();
- return 1;
-}
+void
+VisuGUI::
+OnImportTableFromFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
+ CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_TABLE_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_IMPORT_TABLE"),
+ true);
+ if(aFileInfo.exists()){
+ application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
+ CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
-void RepaintCurrentView(){
- if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()) vf->Repaint();
+ if(CORBA::is_nil(anObject.in())) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK") );
+ }else{
+ application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
+ updateObjBrowser();
+ }
+ }
}
-VisuGUI::VisuGUI( const QString& theName, QObject* theParent ):
- SALOMEGUI( theName, theParent )
-{
- mySelectionDlg = 0;
+template<class TPrs3d_i>
+TPrs3d_i*
+CreatePrs3d(SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var theTimeStamp,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ int theTimeId)
+{
+ VISU::Result_var aResult;
+ if(CheckResult(theModule,theTimeStamp,aResult)){
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ typedef typename TPrs3d_i::TInterface TPrs3d;
+ typename TPrs3d::_var_type aPrs3d =
+ GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
+ (aResult,theMeshName,theEntity,theFieldName,theTimeId);
+ QApplication::restoreOverrideCursor();
+ if(!CORBA::is_nil(aPrs3d.in()))
+ return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
+ }
+ SUIT_MessageBox::warn1(GetDesktop(theModule),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
+ QObject::tr("BUT_OK") );
+ return NULL;
}
-/* ==================================================================================== */
-/* ==================================================================================== */
-/* ONGUI EVENT */
-/* ==================================================================================== */
-/* ==================================================================================== */
-static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
- return theStudy->GetProperties()->IsLocked();
-}
-
-static int checkLock(const SALOMEDS::Study_var& theStudy) {
- if (isStudyLocked(theStudy)) {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
+template<class TPrs3d_i, class TDlg, int IsDlgModal>
+bool
+CreatePrs3d(SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var theTimeStamp,
+ const Handle(SALOME_InteractiveObject)& theIO)
+{
+ using namespace VISU;
+ Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
+ bool isExist;
+ QString aType = Storable::FindValue(aMap,"myType",&isExist);
+ if(!isExist || aType.toInt() != TTIMESTAMP )
+ return false;
+ QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
+ QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
+ QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
+ QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+ TPrs3d_i* aPrs3d =
+ CreatePrs3d<TPrs3d_i>(theModule,
+ theTimeStamp,
+ aMeshName.latin1(),
+ (Entity)anEntity.toInt(),
+ aFieldName.latin1(),
+ aTimeStampId.toInt());
+ if(aPrs3d){
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
+ if(!aValue){
+ if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){
+ aDlg->initFromPrsObject(aPrs3d);
+ if(IsDlgModal)
+ if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
+ delete aDlg;
+ } else {
+ DeletePrs3d(theModule,aPrs3d,theIO);
+ delete aDlg;
+ return false;
+ }
+ else{
+ aDlg->show();
+ return true;
+ }
+ }
+ }
+ PublishInView(theModule,aPrs3d);
return true;
}
return false;
}
-
-bool VisuGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+template<class TPrs3d_i, class TDlg, int IsDlgModal>
+void
+CreatePrs3d(SalomeApp_Module* theModule)
{
- try{
- QString VisuInputDir = getVisuInputDir();
- QString VisuOutputDir = getVisuOutputDir();
-
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument(); //Document OCAF de l'etude active
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- switch (theCommandID){
- /* ======================================================================================== */
- /* Import Table from file */
- /* ======================================================================================== */
- case 199:
- {
- if(checkLock(aStudy)) break;
- visuGUI->ImportTablesFromFile();
- break;
- }
-
- /* ======================================================================================== */
- /* Import Mesh from MED, DAT file */
- /* ======================================================================================== */
-
- case 111:
- {
- visuGUI->CopyAndImportFile();
- break;
- }
- case 112:
- {
- visuGUI->ImportFile();
- break;
- }
-
- /* ======================================================================================== */
- /* Export results and mesh into a file format */
- /* ======================================================================================== */
-
- case 122:
- {
- //visuGUI->ExportToFile();
- break;
- }
-
- /* ========================================================================== */
- /* Visualization of Results : */
- /* 4011 : Scalar Map */
- /* 4012 : Deformed Shape */
- /* 4013 : Vectors */
- /* 4014 : Iso-Surfaces */
- /* 4015 : Cut Planes */
- /* 4016 : Stream Lines */
- /* ========================================================================== */
-
- case 4011 :
- visuGUI->CreateScalarMap();
- break;
- case 4012 :
- visuGUI->CreateDeformedShape();
- break;
- case 4013 :
- visuGUI->CreateVectors();
- break;
- case 4014 :
- visuGUI->CreateIsoSurfaces();
- break;
- case 4015 :
- visuGUI->CreateCutPlanes();
- break;
- case 4018 :
- visuGUI->CreateCutLines();
- break;
- case 4016 :
- visuGUI->CreateStreamLines();
- break;
-
- case 4111 :
- visuGUI->SelectionInfo();
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Wireframe */
- /* ========================================================================================================================= */
-
- case 4211 :
- ChangeViewer(1);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Surface */
- /* ========================================================================================================================= */
-
- case 4212 :
- ChangeViewer(2);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Points */
- /* ========================================================================================================================= */
-
- case 4213 :
- ChangeViewer(0);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Erase */
- /* ========================================================================================================================= */
-
- case 422 :
- ChangeViewer(-1);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Global */
- /* ========================================================================================================================= */
-
- //case 423 :
-
- /* ========================================================================================================================= */
- /* Visualization - Partial */
- /* ========================================================================================================================= */
-
- //case 424 :
-
- case 430 :
- {
- //Show dialog that allows to select scale function and corresponding scale factor
- VisuGUI_NonIsometricDlg* m_NonIsoDlg = new VisuGUI_NonIsometricDlg ( QAD_Application::getDesktop(), "m_NonIsoDlg",
- FALSE, Qt::WDestructiveClose );
- m_NonIsoDlg->show();
- break;
- }
-
- /* ============================ */
- /* POP-UP OBJECTS BROWSER */
- /* ============================ */
-
- case 900 : // Rename object
- visuGUI->Rename();
- break;
-
- // ---------------- For Popup in Viewer
- case 802 : // Erase
- case 902 : // Erase
- visuGUI->ErasePrs();
- break;
-
- case 803 : // Display only
- case 903 : // Display only
- visuGUI->DisplayOnlyPrs();
- break;
-
- case 901 : // Display
- visuGUI->DisplayPrs();
- break;
-
- case 8041 : // Object representation : Wireframe
- case 9041 : // Object representation : Wireframe
- visuGUI->ChangeRepresentation(VISU::WIREFRAME);
- break;
+ if(CheckLock(GetDSStudy(GetCStudy(GetAppStudy(theModule))),theModule))
+ return;
- case 8042 : // Object representation : Surface
- case 9042 : // Object representation : Surface
- visuGUI->ChangeRepresentation(VISU::SHADED);
- break;
+ SALOMEDS::SObject_var aTimeStampSObj;
+ Handle(SALOME_InteractiveObject) anIO;
+ if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
+ return;
- case 8043 : // Object representation : Points
- case 9043 : // Object representation : Points
- visuGUI->ChangeRepresentation(VISU::POINT);
- break;
+ if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
+ return;
- case 8044 : // Object representation : Shrink/Unshrink
- case 9044 : // Object representation : Shrink/Unshrink
- visuGUI->ChangeRepresentation(VISU::SHRINK);
- break;
+ theModule->application()->putInfo(QObject::tr("INF_DONE"));
+ theModule->updateObjBrowser();
- case 8051 : // Change object color
- case 9051 : // Change object color
- visuGUI->ChageColor();
- break;
+ if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
+ aView->onFitAll();
+}
- case 8052 : // Change object opacity
- case 9052 : // Change object opacity
- visuGUI->ChangeOpacity();
- break;
+void
+VisuGUI::
+OnCreateMesh()
+{
+ SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
+ if (CheckLock(aStudy, this))
+ return;
- case 8053 : // Change object line width
- case 9053 : // Change object line width
- visuGUI->ChangeLines();
- break;
+ // Get selected SObject
+ SALOMEDS::SObject_var aResultSObj;
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
- case 808 : // Sweep IsoSurfaces or Cutplanes
- case 908 : // Sweep IsoSurfaces or Cutplanes
- visuGUI->Sweep();
- break;
+ aResultSObj = aStudy->FindObjectID(anIO->getEntry());
-/* ======================================================================================== */
-/* Preferences for Scalar Bar */
-/* ======================================================================================== */
- case 51:
- {
- ChangeScalarBar();
- break;
- }
+ // Get VISU::Result
+ VISU::Result_var aResult;
+ VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
+ if (pResult == NULL)
+ return;
-/* ======================================================================================== */
-/* Preferences for Sweeping */
-/* ======================================================================================== */
- case 52:
- {
- SetSweepingPreferences();
- }
- break;
+ Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
+ bool isExist;
+ string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
+ if (!isExist)
+ return;
-/* ======================================================================================== */
-/* Preferences for Full loading */
-/* ======================================================================================== */
- case 53:
- case 54:
- {
- QMenuData* pp;
- QMenuItem* item = parent->menuBar()->findItem(theCommandID,&pp);
- bool check = !pp->isItemChecked(theCommandID);
- pp->setItemChecked(theCommandID,check);
- switch(theCommandID){
- case 53:
- QAD_CONFIG->addSetting( "Visu:BuildResult", check );
- break;
- case 54:
- QAD_CONFIG->addSetting( "Visu:BuildDefaultPrs3d", check );
- break;
- }
- }
- break;
+ CORBA::Object_var aMesh;
+ string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+#endif
+ if (aComment == "ENTITY") {
+ VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
+ aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
+ } else if (aComment == "FAMILY") {
+ VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
+ string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
+ aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
+ } else if (aComment == "GROUP") {
+ string aGroupName = Storable::FindValue(aMap,"myName").latin1();
+ if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
+ aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
+ }
+#ifdef CHECKTIME
+ timer.Stop();
+ MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
+ timer.Show();
+#endif
- case 113: // Load MED using MED component
- {
- if (checkLock(GetStudyDocument())) break;
-
- Engines::Component_var aMedComp = GetDesktop()->getEngine("FactoryServer", "MED");
- if (CORBA::is_nil(aMedComp)) return false;
- SALOME_MED::MED_Gen_var aMedGen = SALOME_MED::MED_Gen::_narrow(aMedComp);
- if (CORBA::is_nil(aMedGen)) return false;
-
- QStringList filtersList ;
-
- filtersList.append( tr("MED_MEN_IMPORT_MED") );
- filtersList.append( tr("MED_MEN_ALL_FILES") ) ;
- QString aFileName = QAD_FileDlg::getFileName(GetDesktop(),
- "",
- filtersList,
- tr("MED_MEN_IMPORT"),
- true);
- if (!aFileName.isEmpty()) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- aMedGen->readStructFileWithFieldType(aFileName.latin1(), GetActiveStudy()->getTitle());
- GetActiveStudy()->updateObjBrowser();
- QApplication::restoreOverrideCursor();
- }
- }
- break;
+ QApplication::restoreOverrideCursor();
+ VISU::Mesh_i* pPresent = NULL;
+ if (!CORBA::is_nil(aMesh))
+ pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
+ if (pPresent == NULL) {
+ SUIT_MessageBox::warn1 (GetDesktop(this),
+ tr("VISU_WARNING"),
+ tr("ERR_CANT_BUILD_PRESENTATION"),
+ tr("VISU_BUT_OK"));
+ return;
+ }
- default:
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("MSG_NOT_IMPLEMENTED"),
- tr ("VISU_BUT_OK") );
- break;
- }
- } catch (const std::bad_alloc& e ) {
- INFOS("bad_alloc exception is caught "<<e.what());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_NO_MEMORY") + " " + tr(e.what()),
- tr("VISU_BUT_OK") );
- return false;
+ if (SVTK_ViewWindow* aView = GetViewWindow(this)){
+ try {
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+#endif
+ PublishInView(this, pPresent);
+ aView->onFitAll();
+#ifdef CHECKTIME
+ timer.Stop();
+ MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
+ timer.Show();
+#endif
+ application()->putInfo(QObject::tr("INF_DONE"));
+ } catch (std::runtime_error& exc) {
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1 (GetDesktop(this),
+ tr("VISU_WARNING"),
+ tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
+ tr("VISU_BUT_OK"));
}
- catch (std::exception& e){
- INFOS(e.what());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr(e.what()),
- tr("VISU_BUT_OK") );
- }catch (const SALOME::SALOME_Exception& S_ex) {
- INFOS("const SALOME::SALOME_Exception& S_ex");
- QtCatchCorbaException(S_ex);
- return false;
- }
- catch(...) {
- INFOS(tr("ERR_UNKNOWN_EXCEPTION").latin1());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_UNKNOWN_EXCEPTION"),
- tr("VISU_BUT_OK") );
- return false;
}
- return true;
}
-void VisuGUI::SelectionInfo() {
- mySelectionDlg = new VisuGUI_SelectionDlg();
- mySelectionDlg->show();
+void
+VisuGUI::
+OnCreateScalarMap()
+{
+ CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
}
-
-
-/* ********************************************************************************** */
-/* Function ShowTrihedron */
-/* ********************************************************************************** */
-
-void VisuGUI::ShowTrihedron(bool ShowThd){
- bool ThdIsVisible = true;
- if( ShowThd && !ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
- if( !ShowThd && ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
+void
+VisuGUI::
+OnCreateDeformedShape()
+{
+ CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
}
-/* ********************************************************************************** */
-/* Destructor */
-/* Clear all tmp files used in VISU */
-/* ********************************************************************************** */
-
-VisuGUI::~VisuGUI(){
- if(MYDEBUG) MESSAGE("VisuGUI::~VisuGUI");
-}
-
-/* ********************************************************************************** */
-/* Function ChangeViewer */
-/* Change representation of all actors */
-/* ********************************************************************************** */
-
-void VisuGUI::ChangeViewer(int theType){
- if(theType < 0 )
- GetActiveStudy()->unHighlightAll();
- if(vtkRenderer *aRen = GetRenderer()){
- vtkActor *anActor;
- vtkActorCollection *anActColl = aRen->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(anActor->GetVisibility() > 0)
- if(VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)){
- anVISUActor = anVISUActor->GetParent();
- if(theType >= 0)
- anVISUActor->SetRepresentation(theType);
- else
- anVISUActor->VisibilityOff();
- }
- }
- RepaintCurrentView();
- }
+void
+VisuGUI::
+OnCreateVectors()
+{
+ CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
}
-// -----------------------------------------------------------------------------------------
-// EVENTS
-// -----------------------------------------------------------------------------------------
-
-bool VisuGUI::OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateIsoSurfaces()
{
- return true;
+ CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
}
-// ====================================================================================================================
+void
+VisuGUI::
+OnCreateCutPlanes()
+{
+ CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
+}
-bool VisuGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateCutLines()
{
- return true;
+ CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
}
-// ===================================================================================================================
+void
+VisuGUI::
+OnCreateStreamLines()
+{
+ CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
+}
-bool VisuGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateManyMesh()
{
- if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) // true = Viewer OCC
- return false;
-
- if(MYDEBUG) MESSAGE( "VisuGUI::onKeyPress : " << pe->key() )
-
- switch ( pe->key() )
- {
- case Key_Escape :
- {
- if(MYDEBUG) MESSAGE("--> Key : Escape")
- return true;
- }
- default :
- return true;
- break;
- }
- return true;
}
-
-
-//=====================================================================================
-// Slot-functions for presentations creation
-//=====================================================================================
-
-#define CREATEPRESENTATION(FunctionName) \
- void FunctionName() { \
- if (checkLock(GetStudyDocument())) return; \
- SALOMEDS::SObject_var objVisu; \
- if (!TestObjectBrowser(objVisu)) return; \
- if(!FunctionName(objVisu)) return; \
- GetActiveStudy()->updateObjBrowser(); \
- GetDesktop()->putInfo("Ready"); \
- VTKViewer_ViewFrame* vf = GetVtkViewFrame(); \
- if (vf) { \
- /*vf->getRenderer()->ResetCameraClippingRange();*/ \
- vf->onViewFitAll(); \
- } \
- }
-
-
-CREATEPRESENTATION(VisuGUI::CreateScalarMap);
-CREATEPRESENTATION(VisuGUI::CreateDeformedShape);
-CREATEPRESENTATION(VisuGUI::CreateVectors);
-CREATEPRESENTATION(VisuGUI::CreateIsoSurfaces);
-CREATEPRESENTATION(VisuGUI::CreateCutPlanes);
-CREATEPRESENTATION(VisuGUI::CreateCutLines);
-CREATEPRESENTATION(VisuGUI::CreateStreamLines);
-
-
-
-//=====================================================================================
-// function : SetSettings()
-// purpose :
-//=====================================================================================
-bool VisuGUI::SetSettings(QAD_Desktop* parent)
+void
+VisuGUI::
+OnCreatePlot2dView()
{
- int anId = 53;
- QMenuData* pp;
- QMenuItem* item = parent->menuBar()->findItem(anId,&pp);
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildResult");
-
- if(aValue.isEmpty()? 0 : aValue.toInt())
- pp->setItemChecked(anId, true);
-
- anId = 54;
- item = parent->menuBar()->findItem(anId,&pp);
- aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
-
- if(aValue.isEmpty()? 0 : aValue.toInt())
- pp->setItemChecked(anId, true);
-
- anId = 50;
- parent->menuBar()->changeItem(anId,parent->getComponentUserName("VISU"));
-
- ::UpdateViewFrame();
-
- return true;
+ CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+ GetVisuGen( this )->CreateContainer();
+ updateObjBrowser();
}
-//=====================================================================================
-// function : DisplayPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs");
+void
+VisuGUI::
+OnDisplayPrs()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
if ( !CORBA::is_nil( anObject ) ) {
// is it Prs3d object ?
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
+ UpdateViewer( this, aPrsObject );
+ if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+ vw->highlight(anIO, 1);
}
return;
}
// is it Curve ?
VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
+ PlotCurve( this, aCurve, VISU::eDisplay );
return;
- }
+ }/*
// is it Container ?
VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
PlotTable(aTable, VISU::eDisplay );
return;
- }
+ }*/
}
}
-//=====================================================================================
-// function : DisplayOnlyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayOnlyPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs");
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Prs3d object");
- UpdateViewer(aPrsObject, true);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplayOnly );
- }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplayOnly );
- }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Table object");
- PlotTable(aTable, VISU::eDisplayOnly );
- }
- }
+void
+VisuGUI::
+OnDisplayOnlyPrs()
+{
}
-//=====================================================================================
-// function : ErasePrs()
-// purpose :
-//=====================================================================================
-static void ErasePrs(CORBA::Object_ptr theObject) {
- if(MYDEBUG) MESSAGE("ErasePrs");
+void VisuGUI::ErasePrs (CORBA::Object_ptr theObject)
+{
+ if (MYDEBUG) MESSAGE("ErasePrs");
+
if ( !CORBA::is_nil( theObject ) ) {
VISU::Base_var aBase = VISU::Base::_narrow(theObject);
if ( CORBA::is_nil( aBase ) ) return;
switch (aType){
case VISU::TCURVE:{
if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotCurve(aCurve, VISU::eErase );
+ PlotCurve(this, aCurve, VISU::eErase );
break;
}
case VISU::TCONTAINER:{
if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotContainer(aContainer, VISU::eErase );
+ PlotContainer(this, aContainer, VISU::eErase );
break;
}
case VISU::TTABLE:{
if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotTable(aTable, VISU::eErase );
+ PlotTable(this, aTable, VISU::eErase );
break;
}
default:{
if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
- VisuGUI::ErasePrs(aPrsObject);
- if (VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame())
- vf->Repaint();
- }
- }}
- }
-}
-
-void VisuGUI::ErasePrs() {
- ::ErasePrs(GetSelectedObj());
-}
-
-
-//=====================================================================================
-// function : DisplayManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayManyPrs()
-{
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs: Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplay );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Table object");
- PlotTable(aTable, VISU::eDisplay );
- continue;
- }
- }
+ ErasePrs3d( this, aPrsObject );
+ if (SVTK_ViewWindow* vw = GetViewWindow( this ))
+ vw->Repaint();
}
}
+ } // switch (aType)
}
}
-//=====================================================================================
-// function : DisplayOnlyManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayOnlyManyPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- bool aFirstElem = true;
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Prs3d object");
- UpdateViewer(aPrsObject, aFirstElem);
- if (aFirstElem) aFirstElem = false;
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs: Curve object");
- if (aFirstElem) {
- PlotCurve(aCurve, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotCurve(aCurve, VISU::eDisplay );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Container object");
- if (aFirstElem) {
- PlotContainer(aContainer, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotContainer(aContainer, VISU::eDisplay );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Table object");
- if (aFirstElem) {
- PlotTable(aTable, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotTable(aTable, VISU::eDisplay );
- continue;
- }
- }
- }
- }
- }
-}
-
-
-//=====================================================================================
-// function : EraseManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::EraseManyPrs()
+void
+VisuGUI::
+OnErasePrs()
{
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIO LIO; LIO = Sel->StoredIObjects();
- SALOME_ListIteratorOfListIO It( LIO );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Prs3d object");
- ErasePrs(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->Repaint();
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Curve object");
- PlotCurve(aCurve, VISU::eErase );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Container object");
- PlotContainer(aContainer, VISU::eErase );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Table object");
- PlotTable(aTable, VISU::eErase );
- continue;
- }
- }
- }
- }
- }
-}
-
-//=====================================================================================
-// function : RecreateActor()
-// purpose :
-//=====================================================================================
-void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- try{
- thePrs->Update();
- //UpdateViewer(thePrs); Avoid unnessary settings of visibility on for thePrs
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame))
- thePrs->UpdateActor(anActor);
- }
- }catch(std::runtime_error& ex){
- INFOS(ex.what());
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION") + " " + tr(ex.what()),
- tr ("VISU_BUT_OK") );
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)) {
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)) {
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- }
- return;
- }
- QApplication::restoreOverrideCursor();
-}
-
-
-//=====================================================================================
-// function : EditPrs()
-// purpose :
-//=====================================================================================
-#define EDITPRS(PrsName, DlgName) \
- { \
- PrsName* aPrsObject = dynamic_cast<PrsName*>(aPrs3d); \
- if (aPrsObject) { \
- DlgName* aDlg = new DlgName(); \
- aDlg->initFromPrsObject(aPrsObject); \
- if ( aDlg->exec() ) { \
- if(!(aDlg->storeToPrsObject(aPrsObject))){ \
- delete aDlg; \
- return; \
- } \
- RecreateActor(aPrsObject); \
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) { \
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { \
- vf->getRenderer()->ResetCameraClippingRange(); \
- vf->Repaint(); \
- }\
- } \
- } \
- delete aDlg; \
- } \
- }
-
-void VisuGUI::EditPrs() {
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
-
- switch (aPrs3d->GetType()) {
- case VISU::TMESH: // Mesh 13
- break;
-
- case VISU::TSCALARMAP: // ScalarMap 18
- EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
- break;
-
- case VISU::TDEFORMEDSHAPE: // Deformed Shape 28
- EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
- break;
-
- case VISU::TCUTPLANES: // Cut planes 42
- //EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
- {
- VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false);
- aDlg->initFromPrsObject(aPrsObject);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if ( aDlg->exec() ) {
-// if(!(aDlg->storeToPrsObject(aPrsObject))){
-// delete aDlg;
-// return;
-// }
-// RecreateActor(aPrsObject);
-// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
-// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
-// vf->getRenderer()->ResetCameraClippingRange();
-// vf->Repaint();
-// }
-// }
-// }
-// delete aDlg;
- }
- }
- break;
-
- case VISU::TCUTLINES: // Cut planes 42
- //EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
- {
- VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(false);
- aDlg->initFromPrsObject(aPrsObject);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if ( aDlg->exec() ) {
-// aDlg->storeToPrsObject(aPrsObject);
-// RecreateActor(aPrsObject);
-// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
-// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
-// vf->getRenderer()->ResetCameraClippingRange();
-// vf->Repaint();
-// }
-// }
-// // Remove old Table
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(aPrsObject->GetEntry());
-// if(!aSObject->_is_nil()) {
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
-// break;
-// }
-// }
-// }
-// if (aDlg->isGenerateTable()) {
-// GetVisuGen()->CreateTable(aSObject->GetID());
-// if (aDlg->isGenerateCurves()) {
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// CreatePlot(aTblObj);
-// }
-// }
-
-// }
-// }
-// }
-// GetActiveStudy()->updateObjBrowser();
-// }
-// }
-// delete aDlg;
- }
- }
- break;
-
- case VISU::TISOSURFACE: // Iso surfaces
- EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
- break;
- case VISU::TVECTORS: // Vectors 64
- EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
- break;
-
- case VISU::TSTREAMLINES:
- EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
- break;
- default:
- return;
- }
-
+ if(MYDEBUG) MESSAGE("OnErasePrs");
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) )
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->highlight(anIO, 1);
-}
-
-
-//=====================================================================================
-// function : CreateMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateMesh() {
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOMEDS::SObject_var aSObject = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
-
- if (checkLock(GetStudyDocument())) return;
-
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- }
- VISU::Result_var aResult;
- if (!CORBA::is_nil(anObject)) {
- aResult = VISU::Result::_narrow(anObject);
- }
- if(CORBA::is_nil(aResult)) {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return;
- }
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
- timer.Show();
-#endif
-
- QApplication::restoreOverrideCursor();
- VISU::Mesh_i* pPresent = NULL;
- if(!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- if (pPresent == NULL) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- return;
- }
-
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- try{
- VISU_Actor *anActor = pPresent->CreateActor();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- vf->AddActor(anActor);
- SetFitAll(vf);
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
- timer.Show();
-#endif
- //GetActiveStudy()->updateObjBrowser(); //not necessary
- GetDesktop()->putInfo("Ready");
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- }
- }
-}
-
-//=====================================================================================
-// function : CreateManyMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateManyMesh(){
- if (checkLock(GetStudyDocument())) return;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(It.Value()->getEntry());
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return;
- }
- VISU::Result_var aResult = VISU::Result::_narrow(anObject);
- if(CORBA::is_nil(aResult)) return;
-
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
- QApplication::restoreOverrideCursor();
- if(CORBA::is_nil(aMesh)) return;
-
- VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- try{
- VISU_Actor *anActor = pPresent->CreateActor();
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- vf->AddActor(anActor);
- SetFitAll(vf);
- }
- GetDesktop()->putInfo("Ready");
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- }
- }
-}
-
-//=====================================================================================
-// function : ChangeRepresentation()
-// purpose :
-//=====================================================================================
-
-static void ShrinkMesh(VISU_Actor *theActor){
- if(theActor->IsShrunk())
- theActor->UnShrink();
- else
- theActor->SetShrink();
-}
-
-void VisuGUI::ChangeRepresentation(VISU::PresentationType theType) {
- if(VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d())
- if(VISU_Actor* anActor = GetActor(aPrsObject)){
- switch (theType) {
- case VISU::SHRINK:
- ShrinkMesh(anActor);
- break;
- default:
- if(VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrsObject)){
- aMesh->SetPresentationType(theType);
- RecreateActor(aMesh);
- }else
- anActor->SetRepresentation(theType);
- }
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->Repaint();
- }
-}
-
-
-void VisuGUI::MakeSurfaceframe() {
- ChangeRepresentation(VISU::SURFACEFRAME);
-}
-
-void VisuGUI::MakeInsideframe() {
- ChangeRepresentation(VISU::INSIDEFRAME);
-}
-
-void VisuGUI::MakeWireframe() {
- ChangeRepresentation(VISU::WIREFRAME);
-}
-
-void VisuGUI::MakeSurface() {
- ChangeRepresentation(VISU::SHADED);
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ ErasePrs(anObject);
}
-void VisuGUI::MakePoints() {
- ChangeRepresentation(VISU::POINT);
-}
-
-void VisuGUI::MakeShrink() {
- ChangeRepresentation(VISU::SHRINK);
-}
-
-
-
-//=====================================================================================
-// functions : Change Propertise
-// purpose :
-//=====================================================================================
-VISU::Prs3d_i* VisuGUI::GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO) {
- CORBA::Object_var anObject = GetSelectedObj(theIO);
- if(CORBA::is_nil(anObject)) return NULL;
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(!aServant.in()) return NULL;
- return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-}
-
-void VisuGUI::ChageColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
-
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewColor(anActor);
-}
-
-void VisuGUI::ChangeWireframeColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
-
- VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(GetActor(aPrsObject));
- if (!anActor) return;
- NewWireframeColor(anActor);
-}
-
-
-void VisuGUI::ChangeOpacity() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
-
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewOpacity(anActor);
-}
-
-
-void VisuGUI::ChangeLines() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
-
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewLinewidth(anActor);
-}
-void VisuGUI::PlotTable( VISU::Table_i* table, int theDisplaying )
+void
+VisuGUI::
+OnEditPrs()
{
- if ( table && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- SALOMEDS::SObject_var TableSO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetEntry() );
- if ( !TableSO->_is_nil() ) {
- SALOMEDS::ChildIterator_var Iter = GetActiveStudy()->getStudyDocument()->NewChildIterator( TableSO );
- for ( ; Iter->More(); Iter->Next() ) {
- CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
- if( !CORBA::is_nil( childObject ) ) {
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
- if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- break;
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( theCurve->GetVerTitle().c_str() );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- /* - DATA NOT UPDATED */
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- }
- }
- }
- aPlot->Repaint();
- }
- }
-}
-void VisuGUI::PlotCurve( VISU::Curve_i* theCurve, int theDisplaying )
-{
- if ( theCurve && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
-// if ( theDisplaying == VISU::eDisplayOnly )
-// aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- }
- else if ( theDisplaying == VISU::eDisplayOnly ) {
- aPlot->eraseCurve( clist.at( i ) );
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve )
- aPlot->eraseCurve( plotCurve, false );
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- aPlot->Repaint();
- }
-}
-void VisuGUI::PlotContainer( VISU::Container_i* container, int theDisplaying )
-{
- if ( container && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- if ( container->GetNbCurves() > 0 ) {
- int nbCurves = container->GetNbCurves();
- for ( int k = 1; k <= nbCurves; k++ ) {
- VISU::Curve_i* theCurve = container->GetCurve( k );
- if ( theCurve && theCurve->IsValid() ) {
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( new SALOME_InteractiveObject( theCurve->GetEntry(), "", "" ) );
-// for ( int i = 0; i < clist.count(); i++ ) {
-// if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
-// plotCurve = clist.at( i );
-// break;
-// }
-// }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- }
- }
- }
- aPlot->Repaint();
- }
-}
-
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::ShowTable() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- SALOMEDS::SObject_var SO;
- if ( !CORBA::is_nil( anObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
- CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTable ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- if ( table ) {
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- }
- }
- }
- } else {
- // possibly this is Table SObject
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( anIO->getEntry() );
- }
-
- if(!IsSObjectTable(SO))
- return;
-
- SALOMEGUI_TableDlg* dlg = new SALOMEGUI_TableDlg( QAD_Application::getDesktop(),
- SO,
- false,
- //SAL2670 Orientation of show tables
- SALOMEGUI_TableDlg::ttAuto,
- Qt::Vertical );
- dlg->show();
-}
-
-
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::CreateTable() {
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
- return;
-
- Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()) {
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
- VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
- if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
- GetVisuGen()->CreateTable(aSObject->GetID());
- GetActiveStudy()->updateObjBrowser();
- }
- }
- }
}
-
-/*!
- Slot : deletes SObject with all subobjects
-*/
-void VisuGUI::DeleteObject() {
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- if (checkLock(aStudy)) return;
-
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
- return;
- Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- ::ErasePrs(aChildObj);
- }
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- // There is a transaction
- aStudyBuilder->NewCommand();
- CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
- if(!CORBA::is_nil(anObj)){
- VISU::Base_var aBase = VISU::Base::_narrow(anObj);
- if(!CORBA::is_nil(aBase)){
- VISU::VISUType aType = aBase->GetType();
- switch (aType){
- case VISU::TRESULT:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
- DeletePresentation(pPrs3d);
- }
- break;
- }
- case VISU::TTABLE:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( aChildObj );
- if(CORBA::is_nil(aCurve)) continue;
- VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- DeletePresentation(pCurve);
- }
- break;
- }
- }
- }
- }
- aStudyBuilder->RemoveObjectWithChildren(aSObject);
- aStudyBuilder->CommitCommand();
- GetActiveStudy()->unHighlightAll();
- GetActiveStudy()->updateObjBrowser(true);
- }
- }
-}
-
-
-/*!
- Slot : deletes empty container
-*/
-void VisuGUI::CreatePlot2dView() {
- if (checkLock(GetStudyDocument())) return;
- GetVisuGen()->CreateContainer();
- GetActiveStudy()->updateObjBrowser( true );
-}
-
-
-
-/*!
- Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
-*/
-void VisuGUI::PlotData() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if ( !CORBA::is_nil( anObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
- // Table (VISU object) is selected
- CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTbl ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
- if ( table ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- if ( IsSObjectTable(SO) ) {
- // get name of SObject
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = aName->Value();
- }
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
- if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // if study is not locked - create new container, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
- int horIndex;
- QValueList<int> verIndices;
- dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if( !CORBA::is_nil( aContainer ) ) {
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
- if ( pContainer ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
- if ( pCrv ) {
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
- pCrv->SetColor( c );
- pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
- pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- }
- else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
- delete dlg;
- }
- }
- }
- }
- }
- else {
- // possibly this is Table SObject
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
-
- // check if Table SObject is selected
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( IsSObjectTable(SO) ) {
- // get name of SObject
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = aName->Value();
- }
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
- if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // if study is not locked - create new table and container objects, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
- int horIndex;
- QValueList<int> verIndices;
- dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
- CORBA::Object_var aTable = GetVisuGen()->CreateTable( SO->GetID() );
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-
- if ( pContainer && pTable ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
- if ( pCrv ) {
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
- pCrv->SetColor( c );
- pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
- pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- } else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
- }
- delete dlg;
- }
- }
-}
-
-
-void VisuGUI::CreatePlot(SALOMEDS::SObject_var theTableSO) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
-
- if ( IsSObjectTable(theTableSO) ) {
- CORBA::Object_var aTable = VISU::SObjectToObject(theTableSO);
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant(aContainer).in() );
-
- if ( pContainer && pTable ) {
- for ( int i = 2; i <= pTable->GetNbRows(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), 1, i );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aNewCurve).in() );
- if ( pCrv ) {
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
-}
-
-
-/*!
- Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
-*/
-void VisuGUI::CurveProperties() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if (CORBA::is_nil( anObject )) return;
-
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
- // Curve object
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
- if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- if ( curve && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- SALOMEGUI_SetupCurveDlg* dlg = new SALOMEGUI_SetupCurveDlg( QAD_Application::getDesktop() );
- dlg->setLine( (int)curve->GetLine(), curve->GetLineWidth() );
- dlg->setMarker( (int)curve->GetMarker() );
- SALOMEDS::Color color = curve->GetColor();
- dlg->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- if( dlg->exec() == QDialog::Accepted ) {
- curve->SetLine( (VISU::Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- curve->SetMarker( (VISU::Curve::MarkerType)dlg->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = dlg->getColor().red()/255.;
- newColor.G = dlg->getColor().green()/255.;
- newColor.B = dlg->getColor().blue()/255.;
- curve->SetColor( newColor );
- QList<QAD_StudyFrame> sfList = GetActiveStudy()->getStudyFrames();
- if ( sfList.count() > 0 ) {
- QListIterator<QAD_StudyFrame> it( sfList );
- for ( ; it.current(); ++it ) {
- if ( it.current()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)it.current()->getRightFrame()->getViewFrame();
- Handle(SALOME_InteractiveObject) IO = aPlot->FindIObject( curve->GetEntry() );
- if ( IO.IsNull() )
- continue;
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( IO );
- if ( plotCurve ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)dlg->getMarker() );
- plotCurve->setColor( dlg->getColor() );
- aPlot->updateCurve( plotCurve, true );
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
-
-/*!
- Slot : Clears container contents : for Container object selected
-*/
-void VisuGUI::ClearContainer() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
-
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if (CORBA::is_nil( anObject )) return;
-
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
- // Container object
- CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
- if ( container && container->GetNbCurves() > 0 && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- container->Clear();
- GetActiveStudy()->updateObjBrowser();
- }
- }
- }
+void
+VisuGUI::
+OnDeletePrs()
+{
}
-/*!
- Slot : Edit container contents : for Container object selected
-*/
-void VisuGUI::EditContainer() {
- CORBA::Object_var anObject = GetSelectedObj();
- if(CORBA::is_nil(anObject)) return;
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(!aServant.in()) return;
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
- if(!aContainer) return;
-
- VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg();
- aDlg->initFromPrsObject(aContainer);
- if (aDlg->exec()) {
- aDlg->storeToPrsObject(aContainer);
- GetActiveStudy()->updateObjBrowser( true );
- }
- delete aDlg;
+void
+VisuGUI::
+OnDisplayManyPrs()
+{
}
-
-void VisuGUI::DeletePrs() {
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- if (checkLock(aStudy)) return;
-
- // There is a transaction
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- aStudyBuilder->NewCommand();
-
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if(aPrsObject)
- DeletePresentation(aPrsObject);
- // is it Curve object ?
- VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if(aCurveObject)
- DeletePresentation(aCurveObject);
- }
- aStudyBuilder->CommitCommand();
+void
+VisuGUI::
+OnEraseManyPrs()
+{
}
-
-void VisuGUI::SaveViewParams()
+void
+VisuGUI::
+OnDisplayOnlyManyPrs()
{
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
- if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK )
- return;
- if ( aSel->IObjectCount() == 0 ) {
- VISU::View3D_i::SaveViewParams(aStudyFrame,VISU::View3D_i::GenerateViewParamsName().latin1());
- }else{
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- VISU::View3D_i::SaveViewParams(aStudyFrame,anIO->getName());
- }
- GetActiveStudy()->updateObjBrowser( true );
}
-
-void VisuGUI::RestoreViewParams()
+void
+VisuGUI::
+OnMakeSurfaceframe()
{
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
- if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK )
- return;
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- VISU::View3D_i::RestoreViewParams(aStudyFrame,anIO->getName());
}
-
-//=====================================================================================
-// function : DeleteViewParams()
-// purpose :
-//=====================================================================================
-void VisuGUI::DeleteViewParams() {
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist && aType == VISU::TVIEW3D){
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- aStudy->NewBuilder()->RemoveObject(aSObject);
-
- SALOME_Selection* aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- aSel->RemoveIObject(anIO, 0);
-
- GetActiveStudy()->updateObjBrowser( true );
- }
+void
+VisuGUI::
+OnMakeInsideframe()
+{
}
-
-//=====================================================================================
-// function : Sweep()
-// purpose :
-//=====================================================================================
-void VisuGUI::Sweep() {
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(GetSelectedPrs3d());
- if (!aPrsObject) return;
-
- VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame();
- if(!vf) return;
-
- int aTemp=100000;
- QString aTempoStr = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !aTempoStr.isEmpty() )
- aTemp = int(1.E6*(aTempoStr.toFloat()));
-
- int aCycles=1;
- QString aCyclesStr = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !aCyclesStr.isEmpty() )
- aCycles = aCyclesStr.toInt();
-
- int aSteps=40;
- QString aStepsStr = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !aStepsStr.isEmpty() )
- aSteps = aStepsStr.toInt();
-
- VISU_Actor* aActor = GetActor(aPrsObject);
- if (!aActor) return;
-
- if (!aActor->GetVisibility()) {
- aActor->VisibilityOn();
- }
-
- QApplication::setOverrideCursor( Qt::waitCursor );
- try{
- for (int j=0 ; j<aCycles; j++) {
- for (int i=0 ; i<=aSteps; i++) {
- float aPercents = float(i)/aSteps;
- aPrsObject->SetMapScale(aPercents);
- aPrsObject->UpdateActor(aActor);
- vf->getRW()->getRenderWindow()->Render();
- usleep(aTemp);
- }
- }
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!");
- }
- QApplication::restoreOverrideCursor();
+void
+VisuGUI::
+OnMakeWireframe()
+{
}
-
-
-void VisuGUI::TimeAnimation() {
- VisuGUI_TimeAnimationDlg* aAnimationDlg = new VisuGUI_TimeAnimationDlg(GetStudyDocument());
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
-
- bool isDefined = false;
- long aNbTimes = 0;
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for (; It.More(); It.Next()) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID( It.Value()->getEntry() );
- if (aSObject->_is_nil()) continue;
- if (getValue(aSObject, "myComment") == QString("FIELD")) {
- long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
- if (aNumber > 1) {
- if (!isDefined) {
- aNbTimes = aNumber;
- aAnimationDlg->addField(aSObject);
- isDefined = true;
- } else if (aNbTimes == aNumber) {
- aAnimationDlg->addField(aSObject);
- }
- }
- }
- }
- if (isDefined) aAnimationDlg->show();
- else delete aAnimationDlg;
+void
+VisuGUI::
+OnMakeSurface()
+{
}
-
-void VisuGUI::ImportMedField() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- QApplication::setOverrideCursor( Qt::waitCursor );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) anIO = It.Value();
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
- if(!CORBA::is_nil(anObject)){
- SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow( anObject );
- if(!CORBA::is_nil(aMED.in()))
- GetVisuGen()->ImportMed( aSObject );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField.in()))
- GetVisuGen()->ImportMedField( aField );
- }else{
- SALOMEDS::SObject_var aSFather = aSObject->GetFather();
- SALOMEDS::GenericAttribute_var anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aValue = aName->Value();
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- GetVisuGen()->ImportMed(aSObject);
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // VisuGUI::myComponent->ImportMed(aSObject);
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
+void
+VisuGUI::
+OnMakePoints()
+{
}
-//=====================================================================================
-// functions : Rename()
-// purpose :
-//=====================================================================================
-void VisuGUI::Rename() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
- return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Curve_i* curve = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
- // Curve object
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
- if( !CORBA::is_nil( aCurve ) ) {
- curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( curve )
- curve->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
+void
+VisuGUI::
+OnMakeShrink()
+{
}
-//=====================================================================================
-// functions : RenameTable()
-// purpose :
-//=====================================================================================
-void VisuGUI::RenameTable() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
- return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Table_i* table = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
- // Table object
- CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTable ) ) {
- table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( table )
- table->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
+void
+VisuGUI::
+OnChangeColor()
+{
}
-
-
-//=====================================================================================
-// functions : RenameContainer()
-// purpose :
-//=====================================================================================
-void VisuGUI::RenameContainer() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
- return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Container_i* container = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
- // Curve object
- CORBA::Object_ptr aContainer = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aContainer ) ) {
- container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( container )
- container->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
+void
+VisuGUI::
+OnChangeWireframeColor()
+{
}
-
-
-//=====================================================================================
-// function : CopyPresentation()
-// purpose :
-//=====================================================================================
-void VisuGUI::CopyPresentation(){
- if (checkLock(GetStudyDocument())) return;
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if (!aPrsObject) return;
- switch (aPrsObject->GetType()) {
- case VISU::TMESH:
- {
- VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
- VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
- aSameMesh->SameAs(aMeshPrs);
- UpdateViewer(aSameMesh);
- }
- break;
- case VISU::TSCALARMAP:
- {
- VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
- VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
- aSameScalar->SameAs(aScalarPrs);
- UpdateViewer(aSameScalar);
- }
- break;
- case VISU::TDEFORMEDSHAPE:
- {
- VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
- VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
- aSameDeformed->SameAs(aDefPrs);
- UpdateViewer(aSameDeformed);
- }
- break;
- case VISU::TCUTPLANES:
- {
- VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
- VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
- aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
- break;
- case VISU::TCUTLINES:
- {
- VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
- VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
- aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
- break;
- case VISU::TISOSURFACE:
- {
- VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
- VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
- aSameIso->SameAs(aIsoPrs);
- UpdateViewer(aSameIso);
- }
- break;
- case VISU::TSTREAMLINES:
- {
- VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
- VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
- aSameLines->SameAs(aLinesPrs);
- UpdateViewer(aSameLines);
- }
- break;
- case VISU::TVECTORS:
- {
- VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
- VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
- aSameVectors->SameAs(aVectorsPrs);
- UpdateViewer(aSameVectors);
- }
- break;
- }
- GetActiveStudy()->updateObjBrowser();
+void
+VisuGUI::
+OnChangeOpacity()
+{
}
+void
+VisuGUI::
+OnChangeLines()
+{
+}
-
-//=====================================================================================
-// function : DefinePopup()
-// purpose :
-//=====================================================================================
-void VisuGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject )
+void
+VisuGUI::
+OnShowTable()
{
- theObject = "";
- theContext = "";
}
+void
+VisuGUI::
+OnCreateTable()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
+ _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
+ if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
+ GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
+ updateObjBrowser();
+ }
+}
-//=====================================================================================
-// function : checkHomoSelection()
-// purpose :
-//=====================================================================================
-enum { homoNone=0, homoCurves, homoPresentations, homoPresentable, homoAnimatable, homoOther };
-int VisuGUI::checkHomoSelection()
+void
+VisuGUI::
+OnDeleteObject()
{
- int selMode = homoNone;
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- int selNext = homoOther;
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow( aCORBAObject );
- if ( !CORBA::is_nil( aVisuObj ) ) {
- VISU::VISUType aType = aVisuObj->GetType();
- switch( aType ) {
- case VISU::TTABLE:
- case VISU::TCURVE:
- case VISU::TCONTAINER:
- selNext = homoCurves; break;
- case VISU::TMESH:
- case VISU::TSCALARMAP:
- case VISU::TISOSURFACE:
- case VISU::TDEFORMEDSHAPE:
- case VISU::TCUTPLANES:
- case VISU::TCUTLINES:
- case VISU::TVECTORS:
- case VISU::TSTREAMLINES:
- selNext = homoPresentations; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
- }
- }
- else {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObject->FindAttribute( anAttr, "AttributeComment") ) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- string aComm = aComment->Value();
- QString strIn( aComm.c_str() );
- VISU::Storable::StrToMap( strIn, pMap );
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if( isExist ) {
- switch ( aType ) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- selNext = homoPresentable; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
+ SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
+ if (CheckLock(aStudy, this))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
+
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
+ SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ ErasePrs(aChildObj);
+ }
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ // There is a transaction
+ aStudyBuilder->NewCommand();
+ CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(anObj)) {
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if (!CORBA::is_nil(aBase)) {
+ VISU::VISUType aType = aBase->GetType();
+ switch (aType) {
+ case VISU::TRESULT:
+ {
+ SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ if (CORBA::is_nil(aChildObj)) continue;
+ VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
+ if (CORBA::is_nil(aPrs3d)) continue;
+ VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
+ //jfa tmp:DeletePresentation(pPrs3d);
}
+ break;
}
- }
+ case VISU::TTABLE:
+ {
+ SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ if (CORBA::is_nil(aChildObj)) continue;
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
+ if (CORBA::is_nil(aCurve)) continue;
+ VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ //jfa tmp:DeletePresentation(pCurve);
+ }
+ break;
+ }
+ }
}
}
- if ( selMode == homoNone )
- selMode = selNext;
- else {
- if ( selMode != selNext )
- return homoNone;
- }
+ aStudyBuilder->RemoveObjectWithChildren(aSObject);
+ aStudyBuilder->CommitCommand();
+ //jfa tmp:GetActiveStudy()->unHighlightAll();
+ updateObjBrowser(true);
}
- return selMode;
}
-//=====================================================================================
-// function : GetNbChildren() [ static ]
-// purpose : get number of children
-//=====================================================================================
-int GetNbChildren( SALOMEDS::SObject_var SO, bool refToo )
+void
+VisuGUI::
+OnPlotData()
{
- if ( SO->_is_nil() )
- return 0;
- int cnt = 0;
- SALOMEDS::ChildIterator_var Iter = SO->GetStudy()->NewChildIterator( SO );
- for ( ; Iter->More(); Iter->Next() ) {
- SALOMEDS::SObject_var refSO;
- if ( !Iter->Value()->ReferencedObject( refSO ) || refToo )
- cnt++;
- }
- return cnt;
}
-//=====================================================================================
-// function : CustomPopup()
-// purpose :
-//=====================================================================================
-bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QString & theContext,
- const QString & theParent, const QString & theObject)
+void
+VisuGUI::
+OnCurveProperties()
{
- QAD_ResourceMgr* rmgr = parent->createResourceManager();
+}
- bool aIsLocked = isStudyLocked( GetActiveStudy()->getStudyDocument() );
-
- bool isVTKViewer = (GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK);
- SALOME_Selection* aSelection = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- QString aParentComponent = ((SALOMEGUI_Desktop*)parent)->getComponentFromSelection();
- int nbSel = aSelection->IObjectCount();
+void
+VisuGUI::
+OnClearContainer()
+{
+ SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
+ if (CheckLock(aStudy, this))
+ return;
- thePopup->clear();
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || CORBA::is_nil(anObject))
+ return;
- if ( nbSel == 0 ) {
- if ( theParent == "Viewer" && isVTKViewer && !aIsLocked)
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- return false;
- }
- if( nbSel > 1 ) {
- int selMode = checkHomoSelection();
- if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup: multiple selection : selMode = "<<selMode );
- if ( selMode == homoCurves ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyManyPrs() ) );
- }
- }
- else if ( selMode == homoPresentations ) {
- if (isVTKViewer) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+ // Container object
+ CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
+ if (!CORBA::is_nil(aCnt)) {
+ VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
+ if (container && container->GetNbCurves() > 0) {
+ container->Clear();
+ updateObjBrowser();
}
}
- else if ( selMode == homoPresentable ) {
- if (!aIsLocked) thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));
- }
- else if ( selMode == homoAnimatable ) {
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- }
- return true;
}
- VISU::Storable::TRestoringMap aMap;
+}
+
+void
+VisuGUI::
+OnEditContainer()
+{
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- if (!CORBA::is_nil(anObject)) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj)) {
- VISU::VISUType aType = aVisuObj->GetType();
- if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup - VISU object :: "<<aType);
- switch (aType) {
- case VISU::TVISUGEN:
- thePopup->insertItem("Import MED", visuGUI, SLOT(ImportFile()));
- thePopup->insertItem("Import TABLE", visuGUI, SLOT(ImportTablesFromFile()));
- thePopup->insertItem("Create Plot2d View", visuGUI, SLOT(CreatePlot2dView()));
- break;
-
- case VISU::TRESULT:
- if (!aIsLocked) thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
- break;
-
- case VISU::TTABLE:
- if (!aIsLocked) thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
- thePopup->insertItem( "Show Table", visuGUI, SLOT( ShowTable() ) );
- if (!aIsLocked) thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
- thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
- thePopup->insertSeparator();
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetNbChildren( aSObject, false ) > 0 ) {
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- }
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- break;
-
- case VISU::TCURVE:
- if ( !aIsLocked ) {
- thePopup->insertItem( "Properties", visuGUI, SLOT( CurveProperties() ) );
- thePopup->insertItem( "Rename...", visuGUI, SLOT(Rename()));
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->isVisible( anIO ) )
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- else
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- if ( !aIsLocked ) thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- break;
-
- case VISU::TCONTAINER:
-// if( !CORBA::is_nil( anObject ) ) {
-// CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
-// if( !CORBA::is_nil( aCnt ) ) {
-// VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-// if ( container ) {
-// if ( !aIsLocked ) {
-// thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
-// thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
-// if (container->GetNbCurves() > 0)
-// thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
-// }
-// if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
-// thePopup->insertSeparator();
-// thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
-// thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
-// thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
-// }
-// }
-// }
-// }
- if ( !aIsLocked ) {
- thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
- thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
- thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertSeparator();
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- if ( !aIsLocked ) thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- break;
-
- default: // Presentation
- {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if (aPrsObject) {
- if (isVTKViewer) {
- // Add Presentation menu
- if (VISU_Actor* anVISUActor = visuGUI->GetActor(aPrsObject)){
- QPopupMenu* aPresMenu = new QPopupMenu(GetDesktop());
- int aRepresent = anVISUActor->GetRepresentation();
- switch(aRepresent){
- case VISU::POINT :
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::WIREFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::SHADED :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::INSIDEFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::SURFACEFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- break;
- }
- if(anVISUActor->IsShrunkable())
- if(aType != VISU::TVECTORS && aType != VISU::TSTREAMLINES){
- if (anVISUActor->IsShrunk())
- aPresMenu->insertItem("Unshrink", visuGUI, SLOT(MakeShrink()));
- else
- aPresMenu->insertItem("Shrink", visuGUI, SLOT(MakeShrink()));
- }
- thePopup->insertItem("Representation", aPresMenu);
-
- // Add Properties
- QPopupMenu* aPropMenu = new QPopupMenu(GetDesktop());
- if(aType == VISU::TMESH){
- if(aRepresent == VISU::SURFACEFRAME){
- aPropMenu->insertItem("Cell Color", visuGUI, SLOT(ChageColor()));
- aPropMenu->insertItem("Edge Color", visuGUI, SLOT(ChangeWireframeColor()));
- }else
- aPropMenu->insertItem("Color", visuGUI, SLOT(ChageColor()));
- }else if(aType == VISU::TDEFORMEDSHAPE)
- aPropMenu->insertItem("Color", visuGUI, SLOT(ChageColor()));
-
- if (aType != VISU::TVECTORS && aType != VISU::TSTREAMLINES)
- aPropMenu->insertItem("Opacity", visuGUI, SLOT(ChangeOpacity()));
- if (aType != VISU::TVECTORS){
- aPropMenu->insertItem("Line width", visuGUI, SLOT(ChangeLines()));
- thePopup->insertItem("Properties", aPropMenu);
- }
- thePopup->insertSeparator();
- }
- }
- if ( !aIsLocked ) thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
- if (aType != VISU::TMESH) {
- //if (aType != VISU::TSCALARMAP)
- if ( !aIsLocked ) thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
-
- if (aType == VISU::TCUTLINES) {
- // Check: Does it has living children (tables)
- SALOMEDS::ChildIterator_var aIter =
- GetActiveStudy()->getStudyDocument()->NewChildIterator( aSObject );
- bool isPresent = false;
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDS::SObject_var aTblObj = aIter->Value();
- isPresent = !aTblObj->_is_nil();
- if (isPresent) {
- SALOMEDS::GenericAttribute_var anAttr;
- isPresent = aTblObj->FindAttribute(anAttr, "AttributeName");
- if (isPresent) break; // We have at least a one child
- }
- }
- if ((!isPresent) && (!aIsLocked) )
- thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
- }
- thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
-
- }
- if (isVTKViewer) {
- if ( theParent == "Viewer" &&
- ( aType == VISU::TMESH ||
- aType == VISU::TSCALARMAP ||
- aType == VISU::TDEFORMEDSHAPE ) ) {
- thePopup->insertSeparator();
- thePopup->insertItem("Selection info...", visuGUI, SLOT(SelectionInfo()));
- }
- thePopup->insertSeparator();
-
- if (visuGUI->IsDisplayed(aPrsObject) ){
- thePopup->insertItem("Erase", visuGUI, SLOT(ErasePrs()));
- }
- else
- thePopup->insertItem("Display", visuGUI, SLOT(DisplayPrs()));
-
- thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
- }
- thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- if ((aType != VISU::TMESH) && (!aIsLocked)) {
- thePopup->insertSeparator();
- thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
- }
- }
- }
- }
- return false;
- }
-
- else {
- // possibly this is the MED field/mesh and support objects
- SALOME_MED::MED_ptr aMED = SALOME_MED::MED::_narrow( anObject );
- if(!CORBA::is_nil(aMED))
- thePopup->insertItem( "Import Structure", visuGUI, SLOT( ImportMedField() ) );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField))
- thePopup->insertItem( "Import TimeStamp", visuGUI, SLOT( ImportMedField() ) );
- if ( aParentComponent != parent->getActiveComponent() ) {
- //insert pre-defined Display/Erase items
- if ( thePopup->count() > 0 ) {
- thePopup->insertSeparator();
- }
- thePopup->insertItem (tr ("MEN_APP_DISPLAY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_Display_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_DISPLAY_ONLY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_DisplayOnly_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_ERASE"), GetActiveStudy()->getApp(), SLOT(onErase()), 0, QAD_Erase_Popup_ID);
- }
- return false;
- }
- }else{
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist){
- switch (aType) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- if ( !aIsLocked )thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));
- break;
- case VISU::TVIEW3D:
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
- thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
- if ( !aIsLocked ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // Available only for VTK viewer
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- }
- thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
- thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
- }
- break;
- case VISU::TFIELD:
- if ((getValue(aSObject, "myNbTimeStamps").toLong() > 1) && isVTKViewer)
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- break;
- case VISU::TTIMESTAMP: {
- int aNunComponent = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist).toInt();
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_SCALAR_MAP") ),
- "Scalar Map...", visuGUI, SLOT(CreateScalarMap()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_ISO_SURFACES") ),
- "Iso Surfaces...", visuGUI, SLOT(CreateIsoSurfaces()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_CUT_PLANES") ),
- "Cut Planes...", visuGUI, SLOT(CreateCutPlanes()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_CUT_LINES") ),
- "Cut Lines...", visuGUI, SLOT(CreateCutLines()));
- if(aNunComponent > 1){
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_DEFORMED_SHAPE") ),
- "Deformed Shape...", visuGUI, SLOT(CreateDeformedShape()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_VECTORS") ),
- "Vectors...", visuGUI, SLOT(CreateVectors()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_STREAM_LINES") ),
- "Stream lines...", visuGUI, SLOT(CreateStreamLines()));
- }
- break;
- }
- }
- return false;
- }else{
-
- if(IsSObjectTable(aSObject)){
- thePopup->insertItem( "Show Table", visuGUI, SLOT(ShowTable()));
- thePopup->insertItem( "Create Curves", visuGUI, SLOT(PlotData()));
- thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
- thePopup->insertSeparator();
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- return false;
- }
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
- CORBA::Long aTag = 1;
- SALOMEDS::SObject_var aSubObject;
- if(aSObject->FindSubObject(aTag,aSubObject) && IsSObjectTable(aSubObject)) {
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- return false;
- }
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
+ if (!aContainer) return;
- aSObject = aSObject->GetFather();
- if(aSObject->_is_nil()) return false;
- SALOMEDS::GenericAttribute_var anAttr;
- aSObject->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- if(aName->_is_nil()) return false;
- CORBA::String_var aValue = aName->Value();
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- thePopup->insertItem( "Import Field", visuGUI, SLOT( ImportMedField() ) );
- if ( aParentComponent != parent->getActiveComponent() ) {
- //insert pre-defined Display/Erase items
- if ( thePopup->count() > 0 ) {
- thePopup->insertSeparator();
- }
- thePopup->insertItem (tr ("MEN_APP_DISPLAY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_Display_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_DISPLAY_ONLY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_DisplayOnly_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_ERASE"), GetActiveStudy()->getApp(), SLOT(onErase()), 0, QAD_Erase_Popup_ID);
- }
- return false;
- }
- }
+ VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
+ aDlg->initFromPrsObject(aContainer);
+ if (aDlg->exec()) {
+ aDlg->storeToPrsObject(aContainer);
+ updateObjBrowser(true);
}
- return false;
+ delete aDlg;
}
-//===========================================================================
-// BuildPresentation
-//===========================================================================
-void VisuGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
- QAD_ViewFrame* )
+void
+VisuGUI::
+OnSaveViewParams()
{
- BEGIN_OF("VisuGUI::BuildPresentation");
-
- if (theIO.IsNull()) {
- if(MYDEBUG) MESSAGE("VisuGUI::BuildPresentation(): null SALOME_InteractiveObject passed");
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+ if (CheckLock(aStudy, this))
return;
- }
-
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK &&
- GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_PLOT2D) return;
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
+ return;
- SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID ( theIO->getEntry() );
- SCRUTE(aSObj);
- if (aSObj -> _is_nil() ) {
- if(MYDEBUG) MESSAGE("No SObject for interacative object is found");
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() > 1)
return;
+
+ if (aListIO.Extent() == 0) {
+ VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
+ } else {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
}
-
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(!CORBA::is_nil(anObject)) {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if ( aPrsObject ) {
- VISU_Actor *SelectedActor = visuGUI->GetActor(aPrsObject);
- if(!SelectedActor) {
- try{
- SelectedActor = aPrsObject -> CreateActor();
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->AddActor(SelectedActor);
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- throw exc;
- }
- }
- }
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
- if ( aTable ) {
- // table object
- PlotTable(aTable, VISU::eDisplay );
- }
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
- if ( aContainer ) {
- // container object
- PlotContainer(aContainer, VISU::eDisplay );
- }
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if ( aCurve ) {
- // curve object
- PlotCurve(aCurve, VISU::eDisplay );
- }
- }else
- if(MYDEBUG) MESSAGE("CORBA::is_nil(anObject) = true");
- END_OF("VisuGUI::BuildPresentation");
+ updateObjBrowser();
}
-
-//===========================================================================
-// SupportedViewType
-//===========================================================================
-void VisuGUI::SupportedViewType(int* buffer, int bufferSize)
+void
+VisuGUI::
+OnRestoreViewParams()
{
- if (!buffer || !bufferSize) return;
- buffer[0] = (int)VIEW_VTK;
- if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
-}
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
+ return;
-extern "C"
-{
- Standard_EXPORT SALOMEGUI* GetComponentGUI() {
- if ( !visuGUI )
- visuGUI = new VisuGUI( "" );
- return visuGUI;
- }
-}
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() != 1)
+ return;
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
+ VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
+}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR COLOR ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-///////////////// /////////////////////////////////////////////////////////////////
-// change actor color
-// In : Name of Actor
-//
-//
+void
+VisuGUI::
+OnDeleteViewParams()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+ if (CheckLock(aStudy, this))
+ return;
-void VisuGUI::NewColor(VISU_Actor *theActor){
- if(VISU::Prs3d_i* aPrs3d = theActor->GetPrs3d()){
- VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
- VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
- SALOMEDS::Color anOldColor, aNewColor;
- int aRepresent = theActor->GetRepresentation();
- if(aMesh)
- switch(aRepresent){
- case VISU::POINT :
- anOldColor = aMesh->GetNodeColor();
- break;
- case VISU::WIREFRAME :
- case VISU::INSIDEFRAME :
- anOldColor = aMesh->GetLinkColor();
- break;
- case VISU::SHADED :
- case VISU::SURFACEFRAME :
- anOldColor = aMesh->GetCellColor();
- break;
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject) return;
+
+ VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
+ if (aType == VISU::TVIEW3D) {
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO, aNewListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
+ if (it.Value()->getEntry() != anIO->getEntry()) {
+ aNewListIO.Append(it.Value());
}
- else if(aDeformedShape)
- anOldColor = aDeformedShape->GetColor();
- else
- return;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- if(aMesh)
- switch(aRepresent){
- case VISU::POINT :
- aMesh->SetNodeColor(aNewColor);
- break;
- case VISU::WIREFRAME :
- case VISU::INSIDEFRAME :
- aMesh->SetLinkColor(aNewColor);
- break;
- case VISU::SHADED :
- case VISU::SURFACEFRAME :
- aMesh->SetCellColor(aNewColor);
- break;
- }
- else
- aDeformedShape->SetColor(aNewColor);
- RecreateActor(aPrs3d);
}
- }
-}
+ aSelectionMgr->setSelectedObjects(aNewListIO);
-void VisuGUI::NewWireframeColor(VISU_MeshAct *theActor){
- if(VISU::Prs3d_i* aPrs3d = theActor->GetPrs3d()){
- if(VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)){
- SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- aMesh->SetLinkColor(aNewColor);
- VisuGUI::RecreateActor(aMesh);
- }
- }
+ aCStudy->NewBuilder()->RemoveObject(aSObject);
+
+ updateObjBrowser();
}
}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR OPACITY ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor opacity
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 100
-//
-
-void VisuGUI::NewOpacity(VISU_Actor *Actor)
+void
+VisuGUI::
+OnRename()
{
-
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Opacity"), TRUE );
-
- float oldopac,newopac;
- int intopac;
- CursorDlg->Comment1->setText( tr( "Set value between") );
- CursorDlg->Comment2->setText( tr( "0 (transparent) and 100 (opaque)" ) );
- oldopac=Actor->GetOpacity();
- intopac=int(oldopac*100.+0.5);
- CursorDlg->SpinBox1->setMinValue(0);
- CursorDlg->SpinBox1->setMaxValue(100);
- CursorDlg->SpinBox1->setValue(intopac);
-
- int ret = CursorDlg->exec();
- if (ret == 1)
- {
- intopac = CursorDlg->SpinBox1->value() ;
- newopac = intopac/100.;
- Actor->SetOpacity(newopac);
- }
- delete CursorDlg;
}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR LINEWIDTH ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor linewidth
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 10
-//
-
-void VisuGUI::NewLinewidth(VISU_Actor *Actor)
+void
+VisuGUI::
+OnRenameTable()
{
-
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Line Width"), TRUE );
-
- float oldlwid,newlwid;
- int intlwid;
- CursorDlg->Comment1->setText("Set value between");
- CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
- oldlwid=Actor->GetLineWidth();
- intlwid=int(oldlwid);
- CursorDlg->SpinBox1->setMinValue(1);
- CursorDlg->SpinBox1->setMaxValue(10);
- CursorDlg->SpinBox1->setValue(intlwid);
-
- int ret = CursorDlg->exec();
- if (ret == 1) {
- intlwid = CursorDlg->SpinBox1->value() ;
- newlwid = intlwid;
- Actor->SetLineWidth(newlwid);
- }
- delete CursorDlg;
}
-/* ======================================================================================== */
-/* Setting parameters for Scalar Bar */
-/* ======================================================================================== */
-void VisuGUI::ChangeScalarBar()
+void
+VisuGUI::
+OnRenameContainer()
{
- VisuGUI_ScalarBarDlg* Scbar = new VisuGUI_ScalarBarDlg(TRUE);
- Scbar->initFromResources();
- int ret = Scbar->exec();
- if ( ret ) {
- Scbar->storeToResources();
- }
- delete Scbar;
}
-/* ======================================================================================== */
-/* Setting parameters for Sweeping */
-/* ======================================================================================== */
-void VisuGUI::SetSweepingPreferences()
+void
+VisuGUI::
+OnSweep()
{
- float tempo=0.2;
- int cycles=1;
- int steps=20;
+ // GetSelectedPrs3d
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+ if (!aPrsObject) return;
+
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ VISU_Actor* aActor = GetActor(aPrsObject, vw);
+ if (!aActor) return;
+
+ if (!aActor->GetVisibility()) {
+ aActor->VisibilityOn();
+ }
- QString Tempo = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !Tempo.isEmpty() )
- tempo = Tempo.toFloat();
+ // Get sweep parameters
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
- QString Cycles = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !Cycles.isEmpty() )
- cycles = Cycles.toInt();
+ double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
+ int aTemp = int(1.E6 * aTempoDbl);
- QString Steps = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !Steps.isEmpty() )
- steps = Steps.toInt();
+ int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
+ int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
- VisuGUI_SweepPrefDlg* Sweep = new VisuGUI_SweepPrefDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
+ // Sweep
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ try {
+ for (int j = 0; j < aCycles; j++) {
+ for (int i = 0; i <= aSteps; i++) {
+ float aPercents = float(i)/aSteps;
+ aPrsObject->SetMapScale(aPercents);
+ aPrsObject->UpdateActor(aActor);
+ vw->getRenderWindow()->getRenderWindow()->Render();
+ usleep(aTemp);
+ }
+ }
+ } catch (std::exception& exc) {
+ INFOS("Follow exception was occured :\n" << exc.what());
+ } catch (...) {
+ INFOS("Unknown exception was occured!");
+ }
+ QApplication::restoreOverrideCursor();
+}
- Sweep->setTimeStep( tempo );
- Sweep->setNbCycles( cycles );
- Sweep->setNbSteps ( steps );
+void
+VisuGUI::
+OnTimeAnimation()
+{
+ _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+ new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
- if ( Sweep->exec() )
- {
- tempo = Sweep->getTimeStep();
- cycles = Sweep->getNbCycles();
- steps = Sweep->getNbSteps();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- QAD_CONFIG->addSetting("Visu:SweepTempo", tempo);
- QAD_CONFIG->addSetting("Visu:SweepCycles", cycles);
- QAD_CONFIG->addSetting("Visu:SweepSteps", steps);
+ bool isDefined = false;
+ long aNbTimes = 0;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
+ if (!aSObject) continue;
+ if (getValue(aSObject, "myComment") == QString("FIELD")) {
+ long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
+ if (aNumber > 1) {
+ if (!isDefined) {
+ aNbTimes = aNumber;
+ aAnimationDlg->addField(aSObject);
+ isDefined = true;
+ } else if (aNbTimes == aNumber) {
+ aAnimationDlg->addField(aSObject);
}
- delete Sweep;
+ }
+ }
+ }
+ if (isDefined) aAnimationDlg->show();
+ else delete aAnimationDlg;
}
-/* ======================================================================================== */
-/* Returns Visu input files directory (default is CSF_PATHData) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuInputDir()
+void
+VisuGUI::
+OnCopyPresentation()
{
- QString Tmp = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
}
-/* ======================================================================================== */
-/* Returns Visu output files directory (default is InputDir) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuOutputDir()
+void
+VisuGUI::
+OnSelectionInfo()
{
- QString Tmp = QAD_CONFIG->getSetting("Visu:OutputDir");
- if ( Tmp.isEmpty() )
- {
- QString Tmp2 = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp2.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- else
- Tmp = Tmp2;
- }
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
+ //mySelectionDlg = new VisuGUI_SelectionDlg();
+ //mySelectionDlg->show();
+ (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
}
+void
+VisuGUI::
+initialize( CAM_Application* theApp )
+{
+ SalomeApp_Module::initialize( theApp );
-/* ======================================================================================== */
-/* Global Method for Scalar Map */
-/* ======================================================================================== */
-VISU::Result_i* VisuGUI::CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult){
- if(MYDEBUG) MESSAGE("VisuGUI::CreatePresent");
- SALOMEDS::SObject_var aSObj = theField->GetFather();
- if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return NULL;
- theResult = VISU::Result::_narrow(anObject);
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
- if(pResult == NULL)
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return pResult;
+ createActions();
+ createMenus();
+ createToolBars();
+ createPopupMenus();
}
-#define CREATEPRS(PRSTYPE, FNAME, FCREATE) \
-PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
- const char* theMeshName, VISU::Entity theEntity, \
- const char* theFieldName, int theTimeId) {\
- VISU::Result_var aResult; \
- VISU::Result_i* pResult = CreatePresent(theField,aResult); \
- if(pResult != NULL){ \
- QApplication::setOverrideCursor( Qt::waitCursor ); \
- CORBA::Object_var anObject = \
- GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
- QApplication::restoreOverrideCursor(); \
- if(!CORBA::is_nil(anObject)) \
- return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject).in()); \
- } \
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
- tr ("ERR_CANT_BUILD_PRESENTATION"), \
- tr ("VISU_BUT_OK") ); \
- return NULL; \
-}
-
-CREATEPRS(VISU::ScalarMap_i, VisuGUI::CreateScalarMapPrs, ScalarMapOnField);
-CREATEPRS(VISU::DeformedShape_i, VisuGUI::CreateDeformedShapePrs, DeformedShapeOnField);
-CREATEPRS(VISU::Vectors_i, VisuGUI::CreateVectorsPrs, VectorsOnField);
-CREATEPRS(VISU::IsoSurfaces_i, VisuGUI::CreateIsoSurfacesPrs, IsoSurfacesOnField);
-CREATEPRS(VISU::CutPlanes_i, VisuGUI::CreateCutPlanesPrs, CutPlanesOnField);
-CREATEPRS(VISU::CutLines_i, VisuGUI::CreateCutLinesPrs, CutLinesOnField);
-CREATEPRS(VISU::StreamLines_i, VisuGUI::CreateStreamLinesPrs, StreamLinesOnField);
-
-
-#define BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) \
-bool FNAME(SALOMEDS::SObject_var theField) { \
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); \
- bool isExist; \
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); \
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false; \
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); \
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); \
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); \
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); \
- Utils_Timer timer; \
- if(MYCHECKTIME) timer.Start(); \
- TYPE* pPresent = FCREATE(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt()); \
- if(MYCHECKTIME) { \
- timer.Stop(); \
- MESSAGE("BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT"); \
- timer.Show(); \
- } \
- if (pPresent) { \
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d"); \
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){ \
- DLGNAME* aDlg = new DLGNAME(); \
- aDlg->initFromPrsObject(pPresent); \
- if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) { \
- delete aDlg; \
- } else { \
- DeletePresentation(pPresent); \
- delete aDlg; \
- return false; \
- } \
- } \
- try { \
- CreateActor(pPresent); \
- }catch (...) {\
- return false;} \
- return true; \
- } \
- return false; \
-}
+void
+VisuGUI::
+createActions()
+{
+ QPixmap aPixmap;
+ QWidget* aParent = application()->desktop();
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ // Create actions
+ createAction( 112, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
+ this, SLOT(OnImportFromFile()));
+ createAction( 113, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
+ this, SLOT(OnExploreMEDFile()));
+ createAction( 199, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnImportTableFromFile()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
+ createAction( 4011, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateScalarMap()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
+ createAction( 4012, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
+ this, SLOT(OnCreateDeformedShape()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
+ createAction( 4013, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
+ this, SLOT(OnCreateVectors()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
+ createAction( 4014, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
+ this, SLOT(OnCreateIsoSurfaces()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
+ createAction( 4015, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutPlanes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
+ createAction( 4016, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateStreamLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
+ createAction( 4018, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4020, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot2dView()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
+ this, SLOT(OnDeleteObject()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnRenameTable()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnShowTable()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4024, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
+ this, SLOT(OnPlotData()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4025, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnExportTableToFile()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4026, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateMesh()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4027, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateManyMesh()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4030, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
+ this, SLOT(OnErasePrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4031, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayPrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4032, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayOnlyPrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4033, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnDeletePrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4034, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayManyPrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4035, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
+ this, SLOT(OnEraseManyPrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4036, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayOnlyManyPrs()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4037, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCopyPresentation()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4040, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
+ this, SLOT(OnCurveProperties()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4041, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false,
+ this, SLOT(OnRename()));
-BUILDPRS(VISU::ScalarMap_i, CreateScalarMapPrs, VisuGUI::CreateScalarMap, VisuGUI_ScalarBarDlg);
-BUILDPRS(VISU::DeformedShape_i, CreateDeformedShapePrs, VisuGUI::CreateDeformedShape, VisuGUI_MagnitudeDlg);
-BUILDPRS(VISU::Vectors_i, CreateVectorsPrs, VisuGUI::CreateVectors, VisuGUI_VectorsDlg);
-BUILDPRS(VISU::IsoSurfaces_i, CreateIsoSurfacesPrs, VisuGUI::CreateIsoSurfaces, VisuGUI_IsoSurfacesDlg);
-//BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
-//BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
-BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines, VisuGUI_StreamLinesDlg);
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnEditContainer()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnRenameContainer()));
-bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) {
- try {
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
- bool isExist;
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
- Utils_Timer timer;
- if(MYCHECKTIME) timer.Start();
- VISU::CutPlanes_i* pPresent =
- CreateCutPlanesPrs(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt());
- if(MYCHECKTIME) {
- timer.Stop();
- MESSAGE("BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT");
- timer.Show();
- }
- if (pPresent) {
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(true, false);
- aDlg->initFromPrsObject(pPresent);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) {
-// delete aDlg;
-// } else {
-// DeletePresentation(pPresent);
-// delete aDlg;
-// return false;
-// }
-// }
-// CreateActor(pPresent);
- return true;
- }
- }
-}catch (...){return false;}
- return false;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnClearContainer()));
-bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) {
-try {
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
- bool isExist;
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
- Utils_Timer timer;
- if(MYCHECKTIME) timer.Start();
- VISU::CutLines_i* pPresent = CreateCutLinesPrs(theField,aMeshName,
- (VISU::Entity)anEntity.toInt(),
- aFieldName,aTimeStampId.toInt());
- if(MYCHECKTIME) {
- timer.Stop();
- MESSAGE("BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg) - CREATE PRSOBJECT");
- timer.Show();
- }
- if (pPresent) {
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
- VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(true);
- aDlg->initFromPrsObject(pPresent);
- aDlg->show();
- myActiveDialogBox = aDlg;
- return true;
-// if (aDlg->exec()) {
-// aDlg->storeToPrsObject(pPresent);
-// if (aDlg->isGenerateTable()) {
-// GetVisuGen()->CreateTable(pPresent->GetEntry());
-// if (aDlg->isGenerateCurves()) {
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(pPresent->GetEntry());
-// if(!aSObject->_is_nil()) {
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// CreatePlot(aTblObj);
-// }
-// }
-// }
-// }
-// }
-// GetActiveStudy()->updateObjBrowser();
-// }
-// } else {
-// DeletePresentation(pPresent);
-// delete aDlg;
-// return false;
-// }
-// delete aDlg;
-// }
-// CreateActor(pPresent);
-// return true;
- }
- }
-}catch (...){return false; }
- return false;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4046, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap),
+ tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnSaveViewParams()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4047, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap),
+ tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnRestoreViewParams()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4048, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap),
+ tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnDeleteViewParams()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4050, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
+ this, SLOT(OnMakePoints()));
-/* ======================================================================================== */
-/* Global Method to import tables from file */
-/* ======================================================================================== */
-void VisuGUI::ImportTablesFromFile(){
- if (checkLock(GetActiveStudy()->getStudyDocument())) return;
- QStringList flt;
- flt.append( "Files (*.xls *.txt *.tab)" );
- flt.append( "All Files (*.*)" );
- QString aDir = getVisuInputDir();
- QFileInfo aFileInfo = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
-
- if(aFileInfo.exists()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
- aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QAD_WaitCursor wc;
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4051, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeWireframe()));
- CORBA::Object_var anObject;
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
-
- anObject=GetVisuGen()->ImportTables(aFileInfo.filePath());
-
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::ImportTablesFromFile() - IMPORT FILE");
- timer.Show();
-#endif
-
- if(CORBA::is_nil(anObject)) {
- wc.stop();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_IN_THE_FILE"),
- tr ("VISU_BUT_OK") );
- wc.start();
- }
- else {
- QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
- }
- GetActiveStudy()->updateObjBrowser(); //update Object browser
- }
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4052, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurface()));
-void VisuGUI::ExportTableToFile()
-{
- QAD_Study *aQADStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection ( aQADStudy -> getSelection() );
-
- if( aSel->IObjectCount() > 0 ) {
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- if(anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID(anIO->getEntry());
- if(CORBA::is_nil(aSObj)) return;
-
- QString aTitle;
- SALOMEDS::GenericAttribute_var anAttr;
-
- if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
- !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
- aSObj = aSObj->GetFather(); //if the current SObject is a table title
- // we take a father contaning the table
- if (!CORBA::is_nil(aSObj)) {
- if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
- !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger"))
- return;
- }
- else return;
- }
- if (CORBA::is_nil(anAttr)) return;
-
- SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
- if (!CORBA::is_nil(aTabAttr))
- aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
- else {
- SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
- if (!CORBA::is_nil(aTabAttr))
- aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
- else return;
- }
- aTitle.simplifyWhiteSpace();
- QStringList flt;
- flt.append("Table Files (*.xls)");
-
- QAD_FileDlg *aDlg = new QAD_FileDlg(QAD_Application::getDesktop(), false, true, true);
- aDlg -> setCaption("Export Table To File");
- aDlg -> setDir( getVisuOutputDir() );
- aDlg -> setFilters(flt);
- aDlg -> setSelection(aTitle.replace(QRegExp(" "), "_"));
- aDlg -> exec();
- QString aFile = aDlg -> selectedFile();
- delete aDlg;
-
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
- QString aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
-
- try {
- GetVisuGen() -> ExportTableToFile(aSObj, aFile.latin1());
- QAD_Application::getDesktop()->putInfo(aFile+" exported.");
- } catch(std::exception& ex) {
- INFOS(ex.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
- tr ("VISU_BUT_OK") );
- } catch(...) {
- INFOS(tr ("ERR_ERROR_DURING_EXPORT"));
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT"),
- tr ("VISU_BUT_OK") );
- }
- }
- }
- }
-}
-/* ======================================================================================== */
-/* Global Method to import mesh results in MED and DAT format */
-/* ======================================================================================== */
-void VisuGUI::ImportFile(){
- VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::ImportFile);
-}
-void VisuGUI::CopyAndImportFile(){
- VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::CopyAndImportFile);
-}
-void VisuGUI::ImportFromFile(TImportFun theImportFun){
- if (checkLock(GetActiveStudy()->getStudyDocument())) return;
- QStringList flt;
- //flt.append( "Exportable Files (*.med *.dat)" );
- //flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- flt.append( tr("MED_MEN_ALL_FILES") );
- QString aDir = getVisuInputDir();
- QFileInfo aFileInfo = VisuGUI_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
-
- if(aFileInfo.exists()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
- aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QAD_WaitCursor wc;
-
- VISU::Result_var aResult;
-
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
- bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
- if (VisuGUI_FileDlg::IsBuild){
- aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
- if(!CORBA::is_nil(aResult.in()))
- if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
- if(!pResult->IsPossible())
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- else
- aResult->BuildAll();
- }
- }else{
- QAD_CONFIG->addSetting( "Visu:BuildResult", false );
- //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
- aResult=GetVisuGen()->ImportFile(aFileInfo.filePath()); // APO: 18/12/03 - fix crash on Linux RedHat 7.1
- QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::ImportFromFile() - IMPORT FILE");
- timer.Show();
-#endif
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4053, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeInsideframe()));
- if(CORBA::is_nil(aResult.in())) {
- wc.stop();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_IN_THE_FILE"),
- tr ("VISU_BUT_OK") );
- wc.start();
- }
- else {
- QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
- }
- GetActiveStudy()->updateObjBrowser(); //update Object browser
- }
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4054, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurfaceframe()));
-void VisuGUI::ExportToFile(){
- CORBA::Object_var anObject = GetSelectedObj();
- if(CORBA::is_nil(anObject)) return;
- VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in());
- if(aBase != NULL && aBase->GetType() == VISU::TRESULT){
- QStringList flt;
- flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- QString aDir = getVisuOutputDir();
- QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Export To File"),false);
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
- aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
- if(dynamic_cast<VISU::Result_i*>(aBase)){
- try{
- //APO - aResult->GetInput()->ToFile(aFile.latin1());
- QAD_Application::getDesktop()->putInfo(aFile+" exported.");
- }catch(std::exception& ex) {
- INFOS(ex.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT") + " " +tr(ex.what()),
- tr ("VISU_BUT_OK") );
- }
- catch(...){
- INFOS(tr ("ERR_ERROR_DURING_EXPORT").latin1());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT"),
- tr ("VISU_BUT_OK") );
- }
- }
- }
- }else
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4055, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
-/* ======================================================================================== */
-/* Test and Read Object Browser before display */
-/* ======================================================================================== */
-bool VisuGUI::TestObjectBrowser(SALOMEDS::SObject_var& objVisu ){
- if(MYDEBUG) MESSAGE("VisuGUI::TestObjectBrowser");
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if(!anIO.IsNull() && anIO->hasEntry()){
- objVisu = GetStudyDocument()->FindObjectID(anIO->getEntry());
- QString aValue = getValue(objVisu,"myType");
- if((VISU::VISUType)aValue.toInt() == VISU::TTIMESTAMP) return true;
- }
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("WRN_NO_AVAILABLE_DATA"),
- tr("VISU_BUT_OK") );
- return false;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4056, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
-/**
- * Returns Actor of presentation if it exists
- */
-VISU_Actor* VisuGUI::GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame){
- VTKViewer_ViewFrame* vf = theViewFrame? theViewFrame: GetVtkViewFrame();
- if (!vf) return NULL;
- vtkActor *anActor;
- vtkActorCollection *anActColl = vf->getRenderer()->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;)
- if(VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
- if(thePrs == anVISUActor->GetPrs3d())
- return anVISUActor->GetParent();
- return NULL;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4057, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
-/**
- * Displays only actor of given presentation
- * Creates it if it is abcent
- */
-VISU_Actor* VisuGUI::UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly){
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (!vf) return NULL;
-
- vtkRenderer *aRen = vf->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
-
- vtkActor *anActor;
- VISU_Actor* anVISUActor = NULL;
- VISU_Actor* aResActor = NULL;
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(!SALOME_Actor::SafeDownCast(anActor))
- continue;
- if(anActor->IsA("VISU_Actor")){
- anVISUActor = VISU_Actor::SafeDownCast(anActor);
- VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
- if(aPrs == NULL) continue;
- if (thePrs == aPrs) {
- aResActor = anVISUActor->GetParent();
- thePrs->UpdateActor(aResActor);
- aResActor->VisibilityOn();
-
- } else if (theDispOnly) {
- anVISUActor->GetParent()->VisibilityOff();
- } else {
- }
- } else if (theDispOnly && anActor->GetVisibility()) {
- anActor->VisibilityOff();
- } else {
- }
- }
- if (aResActor) return aResActor;
- try{
- anVISUActor = thePrs->CreateActor();
- vf->AddActor(anVISUActor);
- } catch ( std::runtime_error& exc ){
- INFOS(exc.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_CANT_VISUALIZE_OBJECT") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- anVISUActor = NULL;
- }
- return anVISUActor;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4058, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4059, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeWireframeColor()));
-/**
- * Returns TRUE if Presentation is displayed
- */
-bool VisuGUI::IsDisplayed(VISU::Prs3d_i* thePrs) {
- VISU_Actor* anVISUActor = GetActor(thePrs);
- return (anVISUActor)? anVISUActor->GetVisibility() : false;
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4060, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false,
+ this, SLOT(OnChangeOpacity()));
-/**
- * Erases Presentation
- */
-void VisuGUI::ErasePrs(VISU::Prs3d_i* thePrs) {
- GetActiveStudy()->unHighlightAll();
- VISU_Actor* anVISUActor = GetActor(thePrs);
- if (anVISUActor) {
- anVISUActor->VisibilityOff();
- }
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4061, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
+ this, SLOT(OnChangeLines()));
-/**
- * Deletes given presentation from Data structure
- */
-void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
- if(checkLock(GetStudyDocument()) || !thePrs) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)){
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- aViewFrame->unHighlightAll();
- }
- }
- thePrs->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4062, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditPrs()));
-/**
- * Deletes given curve presentation from Data structure
- */
-void VisuGUI::DeletePresentation(VISU::Curve_i* theCurve) {
- if(checkLock(GetStudyDocument()) || !theCurve) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(Plot2d_ViewFrame* aViewFrame = dynamic_cast<Plot2d_ViewFrame*>(aVFrame)){
- QList<Plot2d_Curve> clist;
- aViewFrame->getCurves( clist );
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) )
- aViewFrame->eraseCurve( clist.at( i ) );
- }
- aViewFrame->Repaint();
- aViewFrame->unHighlightAll();
- }
- }
- theCurve->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4063, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnCreateTable()));
-/**
- * Creates new actor of presentation
- */
-void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
- if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
- if (!thePrs) return;
- QApplication::setOverrideCursor( Qt::waitCursor );
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- try{
- MESSAGE("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- VISU_Actor* aActor = thePrs->CreateActor();
- vf->AddActor(aActor);
- }catch(std::runtime_error& exc) {
- INFOS("std::runtime_error "<<exc.what());
- INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- throw exc;
- } catch (...) {
- MESSAGE(" Unknown exception");
- QApplication::restoreOverrideCursor();
- INFOS("Unknown exception is caught in VisuGUI::CreateActor");
- INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr("ERR_UNKNOWN_EXCEPTION"),
- tr ("VISU_BUT_OK") );
- throw ;
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) - DISPLAY ACTOR");
- timer.Show();
-#endif
- }
- QApplication::restoreOverrideCursor();
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4064, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
+ this, SLOT(OnSweep()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4065, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap),
+ tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
+ this, SLOT(OnSelectionInfo()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnTimeAnimation()));
+}
+
+void
+VisuGUI::
+createMenus()
+{
+ // Add actions to menus
+ int aMenuId;
+ aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
+ createMenu( separator(), aMenuId, 10 );
+ createMenu( 112, aMenuId, 10 );
+ createMenu( 113, aMenuId, 10 );
+ createMenu( 199, aMenuId, 10 );
+
+ aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
+ //aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, 90 );
+ createMenu( 4011, aMenuId, 10 );
+ createMenu( 4012, aMenuId, 10 );
+ createMenu( 4013, aMenuId, 10 );
+ createMenu( 4014, aMenuId, 10 );
+ createMenu( 4015, aMenuId, 10 );
+ createMenu( 4016, aMenuId, 10 );
+ createMenu( 4018, aMenuId, 10 );
+ createMenu( 4065, aMenuId, 10 );
+}
+
+void
+VisuGUI::
+createToolBars()
+{
+ int aToolId = createTool(tr("TOOL_VISUALISATION"));
+ createTool( 4011, aToolId );
+ createTool( 4012, aToolId );
+ createTool( 4013, aToolId );
+ createTool( 4014, aToolId );
+ createTool( 4015, aToolId );
+ createTool( 4016, aToolId );
+ createTool( 4018, aToolId );
+}
+
+void
+VisuGUI::
+createPopupMenus()
+{
+ // Prepare popup menus
+ QtxPopupMgr* mgr = popupMgr();
+
+ // VISU root commands
+ QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
+ mgr->insert( action( 112 ), -1, -1, -1 ); // import MED
+ mgr->setRule( action( 112 ), aRule, true );
+ mgr->insert( action( 199 ), -1, -1, -1 ); // import tables
+ mgr->setRule( action( 199 ), aRule, true );
+ mgr->insert( action( 4020 ), -1, -1, -1 ); // create Plot2d
+ mgr->setRule( action( 4020 ), aRule, true );
+ aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
+ mgr->insert( action( 4021 ), -1, -1, -1 ); // delete object
+ mgr->setRule( action( 4021 ), aRule, true );
+
+ // timestamp commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
+ mgr->insert( action( 4011 ), -1, -1, -1 ); // scalar bar
+ mgr->setRule( action( 4011 ), aRule, true );
+ mgr->insert( action( 4014 ), -1, -1, -1 ); // iso surface
+ mgr->setRule( action( 4014 ), aRule, true );
+ mgr->insert( action( 4015 ), -1, -1, -1 ); // cut planes
+ mgr->setRule( action( 4015 ), aRule, true );
+ mgr->insert( action( 4018 ), -1, -1, -1 ); // cut lines
+ mgr->setRule( action( 4018 ), aRule, true );
+ aRule += " and nbComponents>1";
+ mgr->insert( action( 4012 ), -1, -1, -1 ); // deformed shape
+ mgr->setRule( action( 4012 ), aRule, true );
+ mgr->insert( action( 4013 ), -1, -1, -1 ); // vectors
+ mgr->setRule( action( 4013 ), aRule, true );
+ mgr->insert( action( 4016 ), -1, -1, -1 ); // stream lines
+ mgr->setRule( action( 4016 ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
+ mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
+ mgr->setRule( action( 4022 ), aRule, true );
+ mgr->insert( action( 4023 ), -1, -1, -1 ); // show table
+ mgr->setRule( action( 4023 ), aRule, true );
+ mgr->insert( action( 4024 ), -1, -1, -1 ); // create curves
+ mgr->setRule( action( 4024 ), aRule, true );
+ mgr->insert( action( 4025 ), -1, -1, -1 ); // export table
+ mgr->setRule( action( 4025 ), aRule, true );
+ mgr->insert( separator(), -1, -1, -1 );
+ aRule = "(client='ObjectBrowser' and selcount=1 and ((type='VISU::TTABLE' and nbChildren>0) "
+ "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
+ " or (selcount>0 and $type in {"
+ "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
+ mgr->insert( action( 4030 ), -1, -1, -1 ); // erase
+ mgr->setRule( action( 4030 ), aRule.arg(" and isVisible=1"), true );
+ mgr->insert( action( 4031 ), -1, -1, -1 ); // display
+ mgr->setRule( action( 4031 ), aRule.arg(" and isVisible=0"), true );
+ mgr->insert( action( 4032 ), -1, -1, -1 ); // display only
+ mgr->setRule( action( 4032 ), aRule.arg(""), true );
+
+ // View parameters
+ mgr->insert ( action( 4046 ), -1, -1, -1 ); // save view params
+ //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
+ mgr->setRule( action( 4046 ), "selcount=0", true ); //jfa tmp
+ mgr->insert ( action( 4047 ), -1, -1, -1 ); // restore view params
+ mgr->setRule( action( 4047 ), "selcount=1 and type='VISU::TVIEW3D'", true );
+ mgr->insert ( action( 4048 ), -1, -1, -1 ); // delete view params
+ mgr->setRule( action( 4048 ), "selcount=1 and type='VISU::TVIEW3D'", true );
+
+ // 3D presentations commands
+ QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+ QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
+ QString aSurfType = " and $type in {'VISU::TMESH'}";
+ QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
+ QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
+ aRule = "selcount=1";
+
+ int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
+ mgr->insert( action( 4050 ), parentId, -1, -1 ); // points
+ mgr->setRule( action( 4050 ), aRule + aPrsType +
+ " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
+ mgr->insert( action( 4051 ), parentId, -1, -1 ); // wireframe
+ mgr->setRule( action( 4051 ), aRule + aPrsType +
+ " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
+ mgr->insert( action( 4052 ), parentId, -1, -1 ); // surface
+ mgr->setRule( action( 4052 ), aRule + aPrsType +
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
+ mgr->insert( action( 4053 ), parentId, -1, -1 ); // insideframe
+ mgr->setRule( action( 4053 ), aRule + aInsideType +
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
+ mgr->insert( action( 4054 ), parentId, -1, -1 ); // surfaceframe
+ mgr->setRule( action( 4054 ), aRule + aSurfType +
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
+ mgr->insert( action( 4055 ), parentId, -1, -1 ); // shrink
+ mgr->setRule( action( 4055 ), aRule + aShrinkType + " and isShrunk=0", true );
+ mgr->insert( action( 4056 ), parentId, -1, -1 ); // unshrink
+ mgr->setRule( action( 4056 ), aRule + aShrinkType + " and isShrunk=1", true );
+
+ parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
+ mgr->insert( action( 4057 ), parentId, -1, -1 ); // cell color
+ mgr->setRule( action( 4057 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
+ mgr->insert( action( 4059 ), parentId, -1, -1 ); // edge color
+ mgr->setRule( action( 4059 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
+ mgr->insert( action( 4058 ), parentId, -1, -1 ); // color
+ mgr->setRule( action( 4058 ), aRule + " and ((type='VISU::TMESH'"
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
+ "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
+ mgr->insert( action( 4060 ), parentId, -1, -1 ); // opacity
+ mgr->setRule( action( 4060 ), aRule + aShrinkType + " and hasActor=1", true );
+ mgr->insert( action( 4061 ), parentId, -1, -1 ); // line width
+ mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
+
+ // curve commands
+ aRule = "selcount=1 and type='VISU::TCURVE'";
+ mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
+ mgr->setRule( action( 4040 ), aRule, true );
+ mgr->insert( action( 4041 ), -1, -1, -1 ); // rename curve
+ mgr->setRule( action( 4041 ), aRule, true );
+ QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
+ aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+ aRule = "client='ObjectBrowser' and selcount>1";
+ mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
+ mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
+ mgr->insert( action( 4035 ), -1, -1, -1 ); // erase many
+ mgr->setRule( action( 4035 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
+ mgr->insert( action( 4036 ), -1, -1, -1 ); // display only many
+ mgr->setRule( action( 4036 ), aRule + " and " + aCurveType, true );
+
+ // curve container commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
+ mgr->insert( action( 4042 ), -1, -1, -1 ); // edit container
+ mgr->setRule( action( 4042 ), aRule, true );
+ mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
+ mgr->setRule( action( 4043 ), aRule, true );
+ mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
+ mgr->setRule( action( 4044 ), aRule, true );
+
+ aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
+ mgr->insert( action( 4063 ), -1, -1, -1 ); // create table
+ mgr->setRule( action( 4063 ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
+ mgr->insert ( action( 4064 ), -1, -1, -1 ); // sweep
+ mgr->setRule( action( 4064 ), aRule, true );
+
+ // Selection info popup item
+ aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
+ mgr->insert( action( 4065 ), -1, -1, -1 ); // Selection info
+ mgr->setRule( action( 4065 ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
+ mgr->insert( action( 4066 ), -1, -1, -1 ); // animation
+ mgr->setRule( action( 4066 ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
+ mgr->insert( action( 4026 ), -1, -1, -1 ); // create presentation
+ mgr->setRule( action( 4026 ), aRule + " and selcount=1", true );
+ mgr->insert( action( 4027 ), -1, -1, -1 ); // create presentations
+ mgr->setRule( action( 4027 ), aRule + " and selcount>1", true );
+}
+
+void
+VisuGUI::
+windows( QMap<int, int>& theMap ) const
+{
+ theMap.clear();
+ theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
+}
-/* ======================================================================================== */
-/* Functions to State of VisuGUI and Dialog Box */
-/* ======================================================================================== */
-void VisuGUI::SetState(int aState )
-{
- this->myState = aState ;
- return ;
+void
+VisuGUI::
+viewManagers( QStringList& theList ) const
+{
+ theList.clear();
+ theList.append( SVTK_Viewer::Type() );
}
-void VisuGUI::ResetState()
-{
- this->myState = -1 ;
- return ;
+QString
+VisuGUI::
+engineIOR() const
+{
+ CORBA::String_var anIOR = GetVisuGen(this)->GetID();
+ return QString(anIOR.in());
}
-void VisuGUI::EmitSignalDeactivateDialog()
+
+bool
+VisuGUI::
+activateModule( SUIT_Study* theStudy )
{
- emit this->SignalDeactivateActiveDialog() ;
- return ;
+ SalomeApp_Module::activateModule( theStudy );
+
+ setMenuShown( true );
+ setToolShown( true );
+ return true;
}
-void VisuGUI::EmitSignalCloseAllDialogs()
+
+bool
+VisuGUI::
+deactivateModule( SUIT_Study* theStudy )
{
- emit this->SignalCloseAllDialogs() ;
- return ;
+ setMenuShown( false );
+ setToolShown( false );
+
+ SalomeApp_Module::deactivateModule( theStudy );
+ return true;
}
-QDialog* VisuGUI::GetActiveDialogBox()
+SalomeApp_Selection*
+VisuGUI::
+createSelection() const
{
- return this->myActiveDialogBox ;
+ return new VisuGUI_Selection( (SalomeApp_Module*)this );
}
-void VisuGUI::SetActiveDialogBox(QDialog* aDlg)
-{
- this->myActiveDialogBox = (QDialog*)aDlg ;
- return ;
+extern "C" {
+ CAM_Module*
+ createModule()
+ {
+ return new VisuGUI();
+ }
}
#ifndef VisuGUI_HeaderFile
#define VisuGUI_HeaderFile
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(VISU_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include "SalomeApp_Module.h"
-#include "QAD_Desktop.h"
-class VTKViewer_ViewFrame;
+#include "SALOME_InteractiveObject.hxx"
#include "VISUConfig.hh"
-class VISU_Actor;
-class VISU_MeshAct;
-class VISU_ScalarMapAct;
-class VisuGUI_SelectionDlg;
-
-#include <vtkDataSet.h>
-class vtkRenderer;
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(MED_Gen)
-#include "SALOMEGUI.h"
+class SUIT_Desktop;
namespace VISU{
- class VISU_Gen_i;
-
- class Result_i;
-
- class Prs3d_i;
class ScalarMap_i;
- class DeformedShape_i;
- class IsoSurfaces_i;
- class CutPlanes_i;
- class CutLines_i;
- class Vectors_i;
- class StreamLines_i;
-
- class Table_i;
- class Curve_i;
- class Container_i;
}
-// ======================================================================
-// CLASS VIUSGUI
-// ======================================================================
-//
-
-class VisuGUI : public SALOMEGUI{
+class VisuGUI: public SalomeApp_Module
+{
Q_OBJECT;
- public:
- VisuGUI( const QString& name = "", QObject* parent = 0 );
- virtual ~VisuGUI();
-
- static VISU::VISU_Gen_i* GetVisuGen();
-
- static QAD_Desktop* GetDesktop();
- static QAD_Study* GetActiveStudy();
- static vtkRenderer* GetRenderer();
- static VTKViewer_ViewFrame* GetVtkViewFrame();
- static SALOMEDS::Study_var GetStudyDocument();
- static SALOMEDS::StudyBuilder_var NewBuilder();
- static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
-
- static VISU::Result_i* CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult);
+public:
- enum CameraOrient {e3D, eFront, eLeft, eTop};
- static CameraOrient SetFitAll( VTKViewer_ViewFrame* vf);
+ VisuGUI();
+ virtual ~VisuGUI();
- typedef VISU::Result_ptr (VISU::VISU_Gen_i::* TImportFun)(const char*);
- void ImportFromFile(TImportFun theImportFun);
+ virtual void initialize( CAM_Application* );
+ virtual void windows( QMap<int, int>& ) const;
+ virtual void viewManagers( QStringList& ) const;
+ virtual QString engineIOR() const;
- bool CreateScalarMap(SALOMEDS::SObject_var theField);
- static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateDeformedShape(SALOMEDS::SObject_var theField);
- static VISU::DeformedShape_i* CreateDeformedShapePrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateVectors(SALOMEDS::SObject_var theField);
- static VISU::Vectors_i* CreateVectorsPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateIsoSurfaces(SALOMEDS::SObject_var theField);
- static VISU::IsoSurfaces_i* CreateIsoSurfacesPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateCutPlanes(SALOMEDS::SObject_var theField);
- static VISU::CutPlanes_i* CreateCutPlanesPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateCutLines(SALOMEDS::SObject_var theField);
- static VISU::CutLines_i* CreateCutLinesPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool CreateStreamLines(SALOMEDS::SObject_var theField);
- static VISU::StreamLines_i* CreateStreamLinesPrs(SALOMEDS::SObject_var theField,
- const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theTimeId);
- bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
-
- static void ShowTrihedron(bool Show);
- static void ChangeViewer(int theType);
-
- static void NewColor(VISU_Actor *Actor);
- static void NewWireframeColor(VISU_MeshAct *Actor);
- static void NewOpacity(VISU_Actor *Actor);
- static void NewLinewidth(VISU_Actor *Actor);
-
- static void ChangeScalarBar();
- static void SetSweepingPreferences();
-
- static void PlotTable( VISU::Table_i* table, int theDisplaying );
- static void PlotCurve( VISU::Curve_i* curve, int theDisplaying );
- static void PlotContainer( VISU::Container_i* container, int theDisplaying );
-
- static QString getVisuInputDir();
- static QString getVisuOutputDir();
+public slots:
+ virtual bool deactivateModule( SUIT_Study* );
+ virtual bool activateModule( SUIT_Study* );
+
+protected slots:
+ void OnImportFromFile();
+ void OnExploreMEDFile();
+ void OnImportTableFromFile();
+
+ void OnCreateMesh();
+ void OnCreateScalarMap();
+ void OnCreateDeformedShape();
+ void OnCreateVectors();
+ void OnCreateIsoSurfaces();
+ void OnCreateCutPlanes();
+ void OnCreateCutLines();
+ void OnCreateStreamLines();
+ void OnCreateManyMesh();
+ void OnCreatePlot2dView();
+
+ void OnDisplayPrs();
+ void OnDisplayOnlyPrs();
+ void OnErasePrs();
+ void OnEditPrs();
+ void OnDeletePrs();
+ void OnDisplayManyPrs();
+ void OnEraseManyPrs();
+ void OnDisplayOnlyManyPrs();
- static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
- static int checkHomoSelection();
+ void OnMakeSurfaceframe();
+ void OnMakeInsideframe();
+ void OnMakeWireframe();
+ void OnMakeSurface();
+ void OnMakePoints();
+ void OnMakeShrink();
- static VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
- static bool IsDisplayed(VISU::Prs3d_i* thePrs);
- static void ErasePrs(VISU::Prs3d_i* thePrs);
+ void OnChangeColor();
+ void OnChangeWireframeColor();
+ void OnChangeOpacity();
+ void OnChangeLines();
- static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
- static void RecreateActor(VISU::Prs3d_i* thePrs);
- static void CreateActor(VISU::Prs3d_i* thePrs);
- static VISU_Actor* GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame = NULL);
+ void OnShowTable();
+ void OnCreateTable();
+ void OnDeleteObject();
+ void OnPlotData();
+ void OnCurveProperties();
+ void OnClearContainer();
+ void OnEditContainer();
- void VisuGUI::ChangeRepresentation(VISU::PresentationType theType);
- void DeletePresentation(VISU::Prs3d_i* thePrs);
- void DeletePresentation(VISU::Curve_i* theCurve);
+ void OnSaveViewParams();
+ void OnRestoreViewParams();
+ void OnDeleteViewParams();
+
+ void OnRename();
+ void OnRenameTable();
+ void OnRenameContainer();
+ void OnSweep();
+ void OnTimeAnimation();
- void SetState(int aState );
- void ResetState();
- void EmitSignalDeactivateDialog();
- void EmitSignalCloseAllDialogs();
- QDialog* GetActiveDialogBox();
- void SetActiveDialogBox(QDialog* aDlg);
+ void OnCopyPresentation();
- void CreatePlot(SALOMEDS::SObject_var theTableSO);
+ void OnSelectionInfo();
-// ----------------------------------------
-// All method of standard EXPORT
-// ----------------------------------------
- virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
- virtual bool SetSettings(QAD_Desktop* parent);
- virtual void DefinePopup(QString & theContext,
- QString & theParent,
- QString & theObject ) ;
- virtual bool CustomPopup(QAD_Desktop* parent,
- QPopupMenu* popup,
- const QString & theContext,
- const QString & theParent,
- const QString & theObject);
- virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&,
- QAD_ViewFrame* = 0 );
- virtual bool OnMousePress(QMouseEvent* pe ,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame);
- virtual bool OnMouseMove(QMouseEvent* pe ,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame);
- virtual bool OnKeyPress(QKeyEvent* pe,
- QAD_Desktop* parent,
- QAD_StudyFrame* studyFrame);
- virtual void SupportedViewType (int* buffer, int bufferSize);
-
-public slots:
- void ImportTablesFromFile();
- void ExportTableToFile();
- void ImportFile();
- void CopyAndImportFile();
-
- void ExportToFile();
-
- void CreateMesh();
- void CreateScalarMap();
- void CreateDeformedShape();
- void CreateVectors();
- void CreateIsoSurfaces();
- void CreateCutPlanes();
- void CreateCutLines();
- void CreateStreamLines();
- void CreateManyMesh();
- void CreatePlot2dView();
-
- void DisplayPrs();
- void DisplayOnlyPrs();
- void ErasePrs();
- void EditPrs();
- void DisplayManyPrs();
- void DisplayOnlyManyPrs();
- void EraseManyPrs();
- void EditContainer();
-
- void MakeSurfaceframe();
- void MakeInsideframe();
- void MakeWireframe();
- void MakeSurface();
- void MakePoints();
- void MakeShrink();
-
- void ChageColor();
- void ChangeWireframeColor();
- void ChangeOpacity();
- void ChangeLines();
-
- void ShowTable();
- void CreateTable();
- void DeleteObject();
- void PlotData();
- void CurveProperties();
- void ClearContainer();
-
- void SaveViewParams();
- void RestoreViewParams();
-
- void DeletePrs();
- void Rename();
- void RenameTable();
- void RenameContainer();
- void Sweep();
- void TimeAnimation();
-
- void ImportMedField();
- //void ImportMedMesh();
-
- void DeleteViewParams();
- void CopyPresentation();
+protected:
+ virtual SalomeApp_Selection* createSelection() const;
- void SelectionInfo();
+ void ErasePrs (CORBA::Object_ptr theObject);
-private :
- QDialog* myActiveDialogBox;
- int myState ;
- VisuGUI_SelectionDlg* mySelectionDlg;
+private:
+ void createActions();
+ void createMenus();
+ void createToolBars();
+ void createPopupMenus();
};
#endif
#include "VISU_CutLines_i.hh"
#include "VisuGUI.h"
#include "VISU_PipeLine.hxx"
-#include "VTKViewer_ViewFrame.h"
+//#include "VTKViewer_ViewWindow.h"
#include "VISU_CutLinesPL.hxx"
#include "VISU_Gen_i.hh"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include "SUIT_Desktop.h"
+
+#include "OB_Browser.h"
#include <qlayout.h>
#include <qhbox.h>
using namespace std;
-extern VisuGUI *visuGUI;
+//extern VisuGUI *visuGUI;
-#include "QAD_RightFrame.h"
-#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
+//#define GET_VTK_VIEWWINDOW(aMgr) dynamic_cast<VTKViewer_ViewWindow*>(aMgr->getActiveView())
bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
-VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- myPreviewActor(0),
- myStudy(QAD_Application::getDesktop()->getActiveStudy())
+//SalomeApp_Study* study()
+//{
+// return dynamic_cast<SalomeApp_Study*>(VisuGUI::application()->activeStudy());
+//}
+
+VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
+ : QDialog(parent, "VisuGUI_CutLinesDlg", theIsModal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myPreviewActor(0)
+ //,myMgr(VisuGUI::application()->activeViewManager())
{
- myStudyFrame = myStudy -> getActiveStudyFrame();
- setCaption( "Cut Lines Definition" );
- setSizeGripEnabled( true );
+ //myStudyWnd = myMgr->getActiveView();
+ if (!theIsModal) {
+ setWFlags(getWFlags() | WDestructiveClose);
+ }
+ setCaption("Cut Lines Definition");
+ setSizeGripEnabled(true);
myIsCreation = theIsCreation;
-
- QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
+
+ QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
aMainLayout->setSpacing(5);
-
- hasInit = false;
-
+
+ hasInit = false;
+
// Tab pane
QTabWidget* aTabPane = new QTabWidget(this);
// Plane of lines
QFrame* aPlanePane = new QFrame(this);
- QVBoxLayout* aPlaneLayout = new QVBoxLayout( aPlanePane, 5, 6 );
-
+ QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
+
mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
mySelPlane->setInsideSpacing( 5 );
mySelPlane->setInsideMargin( 5 );
-
+
QRadioButton* aBxy = new QRadioButton( tr( "|| X-Y" ), mySelPlane); // 0
QRadioButton* aByz = new QRadioButton( tr( "|| Y-Z" ), mySelPlane); // 1
QRadioButton* aBzx = new QRadioButton( tr( "|| Z-X" ), mySelPlane); // 2
aBzx->setChecked(true);
aPlaneLayout->addWidget( mySelPlane );
-
+
QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
aRotBox->setColumnLayout(2, Qt::Horizontal );
myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
- myRotXSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
+ myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
myRotXSpn->setValue( 0 );
myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
- myRotYSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
+ myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
myRotYSpn->setValue( 0 );
aPlaneLayout->addWidget( aRotBox );
-
+
QHGroupBox* aBaseBox = new QHGroupBox( tr( "Base plane position" ), aPlanePane );
myBasePlanePos = new QLineEdit (aBaseBox);
mydvalidator = new QDoubleValidator(this);
myBasePlanePos->setValidator(mydvalidator);
myCBSetDef = new QCheckBox(tr("Set default"),aBaseBox);
-
+
aPlaneLayout->addWidget( aBaseBox );
-
+
QHBox* aPosBox = new QHBox(aPlanePane);
aPosBox->setSpacing(5);
QLabel* aPosLbl = new QLabel( tr( "LBL_POS" ), aPosBox );
- myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
- myPosSpn->setValue( 0.5 );
+ myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, aPosBox );
+ myPosSpn->setValue( 0.5 );
aPlaneLayout->addWidget( aPosBox );
myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
-
+
// Number of lines
QFrame* aLinesPane = new QFrame(this);
- QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
-
+ QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
+
mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
mySelPlane2->setInsideSpacing( 5 );
mySelPlane2->setInsideMargin( 5 );
-
+
QRadioButton* aBxy2 = new QRadioButton( tr( "|| X-Y" ), mySelPlane2); // 0
QRadioButton* aByz2 = new QRadioButton( tr( "|| Y-Z" ), mySelPlane2); // 1
QRadioButton* aBzx2 = new QRadioButton( tr( "|| Z-X" ), mySelPlane2); // 2
QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
aRotBox2->setColumnLayout(2, Qt::Horizontal );
-
+
myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
- myRotXSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
+ myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
myRotXSpn2->setValue( 0 );
myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
- myRotYSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
+ myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
myRotYSpn2->setValue( 0 );
aLinesLayout->addWidget( aRotBox2 );
QHBox* aNbBox = new QHBox(aLinesPane);
aNbBox->setSpacing(5);
QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
- myNbSpn = new QAD_SpinBoxDbl( aNbBox, 1, 100, 1 );
- myNbSpn->setValue( 10 );
-
+ myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
+ myNbSpn->setValue( 10 );
+
aLinesLayout->addWidget( aNbBox );
myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
myPosTable->setMinimumWidth( 294 );
myPosTable->setNumCols(2);
myPosTable->setNumRows(0);
-
+
QHeader *th = myPosTable->horizontalHeader();
th->setLabel( 0, "Position" );
th->setLabel( 1, "Set default" );
QHBox* aPosBox2 = new QHBox(aLinesPane);
aPosBox2->setSpacing(5);
QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
- myPosSpn2 = new QAD_SpinBoxDbl( aPosBox2, 0, 1, 0.1 );
- myPosSpn2->setValue( 0.5 );
+ myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
+ myPosSpn2->setValue( 0.5 );
aLinesLayout->addWidget( aPosBox2 );
aLinesLayout->addStretch();
-
+
aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
myScalarPane = new VisuGUI_ScalarBarPane(this, false);
QHBox* aBtnBox = new QHBox(this);
aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
aBtnBox->setLineWidth( 1 );
- QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
+ QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
aBtnLayout->setAutoAdd( false );
aBtnLayout->setSpacing( 5 );
aBtnLayout->setMargin( 11 );
aOkBtn->setAutoDefault( TRUE );
aOkBtn->setDefault( true );
aBtnLayout->addWidget(aOkBtn);
-
+
aBtnLayout->addStretch();
-
+
QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
aBtnLayout->addWidget(aCloseBtn);
-
+
aMainLayout->addWidget(aBtnBox);
myCutLines = NULL;
-
+
// signals and slots connections
- connect(mySelPlane, SIGNAL(clicked(int)), this, SLOT(onPlaneSelect(int)));
- connect(myCBSetDef , SIGNAL( toggled(bool) ), this , SLOT( setBaseDefault() ) );
- connect(myPosSpn , SIGNAL( valueChanged( double ) ), this , SLOT( setBaseDefault() ) );
- connect(mySelPlane2, SIGNAL(clicked(int)), this, SLOT(onCutSelect(int)));
- connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
- connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
- connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
- connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
- connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
- connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
- connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
- connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
- connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
- connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
- connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
+ connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
+ connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
+ connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
+ connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
+ connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
+ connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
+ connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
+ connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
+ connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
+ connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
+ connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
+ connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
+ connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
+ connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
+ connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
- connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
- connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+ //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
+ //connect(VisuGUI::application()->desktop(),
+ // SIGNAL(windowActivated(SUIT_ViewWindow*)),
+ // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
}
/*!
VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
{
deletePlanes();
- if(myCutLines) delete myCutLines;
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
- vf->Repaint();
+ if (myCutLines) delete myCutLines;
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
+ //jfa tmp: vf->Repaint();
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
+void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
+{
myPrs = thePrs;
myScalarPane->initFromPrsObject(thePrs);
myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
myPosSpn->setValue(thePrs->GetDisplacement());
setOrientation(thePrs->GetOrientationType());
-
- myNbSpn->setValue( thePrs->GetNbLines() );
+
+ myNbSpn->setValue( (int)thePrs->GetNbLines() );
myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
myPosSpn2->setValue(thePrs->GetDisplacement2());
}
}
-
//------------------------------------------------------------------------------
-int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
-
+int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
+{
myScalarPane->storeToPrsObject(thePrs);
- thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+ thePrs->SetOrientation(getOrientaion(),
+ myRotXSpn->value()*PI/180.,
+ myRotYSpn->value()*PI/180.);
thePrs->SetDisplacement(myPosSpn->value());
thePrs->SetNbLines((int)myNbSpn->value());
-
- thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+
+ thePrs->SetOrientation2(getOrientaion(false),
+ myRotXSpn2->value()*PI/180.,
+ myRotYSpn2->value()*PI/180.);
thePrs->SetDisplacement2(myPosSpn2->value());
-
+
if (!myCBSetDef->isChecked())
thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
else thePrs->SetDefault();
-
- for (int i = 0; i < (int)myNbSpn->value(); ++i)
- {
- if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
- thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
- else thePrs->SetDefaultPosition(i);
- }
+
+ for (int i = 0; i < (int)myNbSpn->value(); ++i) {
+ if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
+ thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
+ else thePrs->SetDefaultPosition(i);
+ }
return 1;
}
-
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::createPlanes() {
- if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+void VisuGUI_CutLinesDlg::createPlanes()
+{
+ //jfa tmp:if (GET_VTK_VIEWWINDOW(myMgr) == NULL)
+ //jfa tmp: return;
if (myCutLines == NULL) return;
if (myPreviewActor != 0) return;
myPreviewActor->PickableOff();
myPreviewActor->SetMapper(aPlaneMapper);
aPlaneMapper->Delete();
- GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+ //jfa tmp:GET_VTK_VIEWWINDOW(myMgr)->AddActor(myPreviewActor);
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::deletePlanes() {
+void VisuGUI_CutLinesDlg::deletePlanes()
+{
if (myPreviewActor == 0) return;
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
- vf->RemoveActor(myPreviewActor);
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
+ //jfa tmp: vf->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
myPreviewActor = 0;
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
+void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
+{
for (int i = 0; i < mySelPlane2->count(); i++)
mySelPlane2->find(i)->setEnabled(true);
QButton* aBtn = mySelPlane2->find(theId);
case 0:
myRotXLbl->setText( tr("LBL_ROT_X"));
myRotYLbl->setText( tr("LBL_ROT_Y"));
- ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
+ ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
onCutSelect(1, false);
break;
case 1:
myRotXLbl->setText( tr("LBL_ROT_Y"));
myRotYLbl->setText( tr("LBL_ROT_Z"));
- ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
+ ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
onCutSelect(2, false);
break;
case 2:
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
+void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
+{
switch (theId) {
case 0:
myRotXLbl2->setText( tr("LBL_ROT_X"));
myRotXLbl2->setText( tr("LBL_ROT_Z"));
myRotYLbl2->setText( tr("LBL_ROT_X"));
}
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
- myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+ myCutLines->SetOrientation2(getOrientaion(false),
+ myRotXSpn2->value()*PI/180.,
+ myRotYSpn2->value()*PI/180.);
myCutLines->SetDisplacement2(myPosSpn2->value());
myCutLines->GetPL()->Update();
deletePlanes();
- createPlanes();
- vf->Repaint();
+ createPlanes();
+ //jfa tmp:vf->Repaint();
}
- }
+ //jfa tmp:}
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
+void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
+{
if (!hasInit) return;
-
- if ( myCBSetDef->isChecked() )
- {
- if (!myCutLines->IsDefault()) myCutLines->SetDefault();
- myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
- myCutLines->SetDisplacement(myPosSpn->value());
- float aPos = myCutLines->GetBasePlanePosition();
- myBasePlanePos->setText( QString::number(aPos) );
- myBasePlanePos->setEnabled(false);
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
- if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
- myCutLines->SetBasePlanePosition(aPos);
- myCutLines->GetPL()->Update();
- deletePlanes();
- createPlanes();
- vf->Repaint();
- }
+
+ if (myCBSetDef->isChecked()) {
+ if (!myCutLines->IsDefault()) myCutLines->SetDefault();
+ myCutLines->SetOrientation(getOrientaion(),
+ myRotXSpn->value()*PI/180.,
+ myRotYSpn->value()*PI/180.);
+ myCutLines->SetDisplacement(myPosSpn->value());
+ float aPos = myCutLines->GetBasePlanePosition();
+ myBasePlanePos->setText( QString::number(aPos) );
+ myBasePlanePos->setEnabled(false);
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
+ if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+ myCutLines->SetBasePlanePosition(aPos);
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ //jfa tmp:vf->Repaint();
}
- }
- else myBasePlanePos->setEnabled(true);
+ //jfa tmp:}
+ } else {
+ myBasePlanePos->setEnabled(true);
+ }
}
//------------------------------------------------------------------------------
if (!hasInit) return;
int aNbRows = myPosTable->numRows();
- int aNbPlanes = (int)myNbSpn->value();
-
- myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+ int aNbPlanes = (int)myNbSpn->value();
+
+ myCutLines->SetOrientation(getOrientaion(),
+ myRotXSpn->value()*PI/180.,
+ myRotYSpn->value()*PI/180.);
myCutLines->SetNbLines(aNbPlanes);
myCutLines->SetDisplacement2(myPosSpn2->value());
- myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+ myCutLines->SetOrientation2(getOrientaion(false),
+ myRotXSpn2->value()*PI/180.,
+ myRotYSpn2->value()*PI/180.);
if (aNbRows>0)
for (int i = 0; i < aNbRows; ++i) {
if (!aItem->isChecked())
myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
}
-
+
if (aNbPlanes > aNbRows)
myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
else if (aNbPlanes < aNbRows)
QHeader *vh = myPosTable->verticalHeader();
QString str("Plane# %1");
for (int i=aMin; i<aNbPlanes; i++) {
- VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
- QTableItem::OnTyping,
- QString::number(myCutLines->GetLinePosition(i)));
+ VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
+ (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
aEditItem->setReplaceable(false);
aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
myPosTable->setItem(i, 0, aEditItem);
aCheck->setChecked(myCutLines->IsDefaultPosition(i));
aCheck->setReplaceable(false);
myPosTable->setItem(i, 1, aCheck);
-
+
vh->setLabel( i, str.arg(i+1) );
}
// Update preview
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (myPreviewCheck->isChecked()) {
myCutLines->GetPL()->Update();
deletePlanes();
createPlanes();
- vf->Repaint();
+ //jfa tmp:vf->Repaint();
}
- }
+ //jfa tmp:}
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setDefault(int all)
+void VisuGUI_CutLinesDlg::setDefault (int all)
{
myPosTable->setCurrentCell(-1, 1);
myPosTable->clearSelection();
if (all == 0) return;
if (all == 1)
- for (int i = 0; i < (int)myNbSpn->value(); ++i)
+ for (int i = 0; i < (int)myNbSpn->value(); ++i)
((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
-
+
for (int i = 0; i < (int)myNbSpn->value(); ++i) {
if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
myCutLines->SetDefaultPosition(i);
myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
myPosTable->item( i, 0 )->setEnabled(false);
- } else
- myPosTable->item( i, 0 )->setEnabled(true);
+ } else
+ myPosTable->item( i, 0 )->setEnabled(true);
}
}
//------------------------------------------------------------------------------
-VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion(bool IsBasePlane)
+VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
{
QHButtonGroup* aBG;
-
+
if (IsBasePlane)
aBG = mySelPlane;
else
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setOrientation( const VISU::CutPlanes::Orientation orient)
+void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
{
switch (orient) {
case VISU::CutPlanes::XY:
((QRadioButton*)mySelPlane->find(1))->setChecked(true);
onPlaneSelect(1);
break;
- case VISU::CutPlanes::ZX:
+ case VISU::CutPlanes::ZX:
((QRadioButton*)mySelPlane->find(2))->setChecked(true);
onPlaneSelect(2);
}
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation orient )
+void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
{
switch (orient) {
case VISU::CutPlanes::XY:
((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
onCutSelect(1);
break;
- case VISU::CutPlanes::ZX:
+ case VISU::CutPlanes::ZX:
((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
onCutSelect(2);
}
}
-
-void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
+void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
+{
if (theCol == 0) {
QString aTxt = myPosTable->text(theRow, 0);
bool isChanged = !aTxt.isEmpty();
((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (myPreviewCheck->isChecked()) {
//Update Preview
myCutLines->SetLinePosition( theRow, aTxt.toDouble());
myCutLines->GetPL()->Update();
deletePlanes();
createPlanes();
- vf->Repaint();
+ //jfa tmp:vf->Repaint();
}
- }
+ //jfa tmp:}
} else {
bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
if (isDefault) {
myCutLines->SetDefaultPosition(theRow);
myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (myPreviewCheck->isChecked()) {
//Update Preview
myCutLines->GetPL()->Update();
deletePlanes();
createPlanes();
- vf->Repaint();
+ //jfa tmp:vf->Repaint();
}
- }
+ //jfa tmp:}
}
myPosTable->item(theRow, 0)->setEnabled(!isDefault);
}
}
-
-void VisuGUI_CutLinesDlg::accept() {
+void VisuGUI_CutLinesDlg::accept()
+{
MYGenerateTable = myCreateTable->isChecked();
MYGenerateCurve = myCurvesCheck->isChecked();
if (myScalarPane->check()) {
- ((QWidget*)sender())->setDisabled(true);
+ /*((QWidget*)sender())->setDisabled(true);
storeToPrsObject(myPrs);
if (myIsCreation) {
- if (isGenerateTable()) {
+ jfa tmp:if (isGenerateTable()) {
visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
if (isGenerateCurves()) {
- SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
- if(!aSObject->_is_nil()) {
- SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ SALOMEDSClient_Study* aStudy = study()->studyDS();
+ SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ if( aSObject ) {
+ SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
for ( ;aIter->More(); aIter->Next()) {
- SALOMEDS::SObject_var aTblObj = aIter->Value();
- if (!aTblObj->_is_nil()) {
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDSClient_SObject* aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ SALOMEDSClient_GenericAttribute* anAttr;
if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
visuGUI->CreatePlot(aTblObj);
}
}
}
}
- if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ if (GET_VTK_VIEWWINDOW(myMgr)) {
try {
visuGUI->CreateActor(myPrs);
- }
- catch (...) {
+ } catch (...) {
reject();
return;
}
- GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
+ GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
}
} else {
- visuGUI->RecreateActor(myPrs);
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
+ visuGUI->RecreateActor(myPrs);
+ if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
+ if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vf->getRenderer()->ResetCameraClippingRange();
+ vf->Repaint();
}
}
// Remove old Table
- SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
- if(!aSObject->_is_nil()) {
- SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ SALOMEDSClient_Study* aStudy = study()->studyDS();
+ SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ if( aSObject ) {
+ SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
for ( ;aIter->More(); aIter->Next()) {
- SALOMEDS::SObject_var aTblObj = aIter->Value();
- if (!aTblObj->_is_nil()) {
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDSClient_SObject* aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ SALOMEDSClient_GenericAttribute* anAttr;
if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
break;
}
}
if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
+ visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
if (isGenerateCurves()) {
- SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
- SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ SALOMEDSClient_Study* aStudy = study()->studyDS();
+ SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
for ( ;aIter->More(); aIter->Next()) {
- SALOMEDS::SObject_var aTblObj = aIter->Value();
- if (!aTblObj->_is_nil()) {
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDSClient_SObject* aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ SALOMEDSClient_GenericAttribute* anAttr;
if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
visuGUI->CreatePlot(aTblObj);
}
}
}
}
- myStudy->updateObjBrowser();
+ VisuGUI::application()->objectBrowser()->updateTree();*/
QDialog::accept();
}
}
-void VisuGUI_CutLinesDlg::reject() {
- if (myIsCreation) {
- visuGUI->DeletePresentation(myPrs);
- myStudy->updateObjBrowser();
- }
+void VisuGUI_CutLinesDlg::reject()
+{
+ /*if (myIsCreation) {
+ visuGUI->DeletePresentation(myPrs);
+ VisuGUI::application()->objectBrowser()->updateTree();
+ }*/
QDialog::reject();
}
-void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
+{
+ /*jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (thePreview) {
storeToPrsObject(myCutLines);
myCutLines->GetPL()->Update();
createPlanes();
- vf->onViewFitAll();
+ vf->onFitAll();
} else {
deletePlanes();
vf->Repaint();
}
- }
+ }*/
}
-void VisuGUI_CutLinesDlg::onRotation(double theValue) {
+void VisuGUI_CutLinesDlg::onRotation (double theValue)
+{
if (myCutLines == NULL) return;
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (myPreviewCheck->isChecked()) {
- myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
- myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+ myCutLines->SetOrientation(getOrientaion(),
+ myRotXSpn->value()*PI/180.,
+ myRotYSpn->value()*PI/180.);
+ myCutLines->SetOrientation2(getOrientaion(false),
+ myRotXSpn2->value()*PI/180.,
+ myRotYSpn2->value()*PI/180.);
myCutLines->GetPL()->Update();
deletePlanes();
- createPlanes();
- vf->Repaint();
+ createPlanes();
+ //jfa tmp:vf->Repaint();
}
- }
+ //jfa tmp:}
}
-void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
+void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
+{
if (myCutLines == NULL) return;
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
if (myPreviewCheck->isChecked()) {
myCutLines->SetBasePlanePosition(theValue.toDouble());
myCutLines->GetPL()->Update();
deletePlanes();
- createPlanes();
- vf->Repaint();
+ createPlanes();
+ //jfa tmp:vf->Repaint();
}
- }
-}
-
-void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
- if (theFrame != myStudyFrame)
- reject();
+ //jfa tmp:}
}
-
-
+//jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
+//jfa tmp:{
+//jfa tmp: if (theWnd != myStudyWnd)
+//jfa tmp: reject();
+//jfa tmp:}
#include <qhbuttongroup.h>
#include <qvalidator.h>
+class SUIT_ViewManager;
+
namespace VISU{
class CutLines_i;
}
Q_OBJECT
public:
- VisuGUI_CutLinesDlg(bool theIsCreation);
+ VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation = true, bool theIsModal = true);
~VisuGUI_CutLinesDlg();
- void initFromPrsObject(VISU::CutLines_i* thePrs);
- int storeToPrsObject(VISU::CutLines_i* thePrs);
+ void initFromPrsObject (VISU::CutLines_i* thePrs);
+ int storeToPrsObject (VISU::CutLines_i* thePrs);
bool isGenerateTable() { return myCreateTable->isChecked(); }
bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
void reject();
private slots:
- void onPlaneSelect(int theId);
- void onCutSelect(int theId, bool theUpdate = true);
- void setBaseDefault(bool theUpdate = true);
- void setDefault( int all = -1);
+ void onPlaneSelect (int theId);
+ void onCutSelect (int theId, bool theUpdate = true);
+ void setBaseDefault (bool theUpdate = true);
+ void setDefault (int all = -1);
void DrawTable();
- void onValueChanged(int theRow, int theCol);
- void onPreviewCheck(bool thePreview);
- void onRotation(double theValue);
- void onPlanePos(const QString& theValue);
- void onFrameActivated(QAD_StudyFrame* );
+ void onValueChanged (int theRow, int theCol);
+ void onPreviewCheck (bool thePreview);
+ void onRotation (double theValue);
+ void onPlanePos (const QString& theValue);
+ //jfa tmp:void onWindowActivated (SUIT_ViewWindow*);
private:
void createPlanes();
void deletePlanes();
-
QHButtonGroup* mySelPlane;
- QAD_SpinBoxDbl* myRotXSpn;
- QAD_SpinBoxDbl* myRotYSpn;
+ QtxDblSpinBox* myRotXSpn;
+ QtxDblSpinBox* myRotYSpn;
QLabel* myRotXLbl;
QLabel* myRotYLbl;
- QAD_SpinBoxDbl* myPosSpn;
+ QtxDblSpinBox* myPosSpn;
QLineEdit* myBasePlanePos;
QCheckBox* myCBSetDef;
QCheckBox* myCreateTable;
QCheckBox* myCurvesCheck;
- QHButtonGroup* mySelPlane2;
- QAD_SpinBoxDbl* myNbSpn;
- QAD_SpinBoxDbl* myRotXSpn2;
- QAD_SpinBoxDbl* myRotYSpn2;
+ QHButtonGroup* mySelPlane2;
+ QtxDblSpinBox* myNbSpn;
+ QtxDblSpinBox* myRotXSpn2;
+ QtxDblSpinBox* myRotYSpn2;
QLabel* myRotXLbl2;
QLabel* myRotYLbl2;
- QAD_SpinBoxDbl* myPosSpn2;
+ QtxDblSpinBox* myPosSpn2;
QTable* myPosTable;
bool hasInit;
VisuGUI_ScalarBarPane* myScalarPane;
- VISU::CutPlanes::Orientation getOrientaion(bool IsBasePlane = true);
- void setOrientation( const VISU::CutPlanes::Orientation orient);
- void setOrientation2( const VISU::CutPlanes::Orientation orient);
-
+ VISU::CutPlanes::Orientation getOrientaion (bool IsBasePlane = true);
+ void setOrientation (const VISU::CutPlanes::Orientation orient);
+ void setOrientation2 (const VISU::CutPlanes::Orientation orient);
+
SALOME_Actor* myPreviewActor;
QCheckBox* myPreviewCheck;
-
+
VISU::CutLines_i* myPrs;
- QAD_Study *myStudy;
- QAD_StudyFrame *myStudyFrame;
+ //jfa tmp:SUIT_ViewManager *myMgr;
+ //jfa tmp:SUIT_ViewWindow *myStudyWnd;
bool myIsCreation;
static bool MYGenerateCurve;
};
#endif // VISUGUI_CUTLINESDLG_H
-
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_CutPlanesDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_CutPlanesDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
#include "VISU_CutPlanes_i.hh"
#include "VISU_CutPlanesPL.hxx"
-#include "VisuGUI.h"
-#include "VTKViewer_ViewFrame.h"
+#include "OB_Browser.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
+#include "SVTK_ViewWindow.h"
+
+#include "SalomeApp_Application.h"
+
+#include "SUIT_Application.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
#include <qlayout.h>
#include <qcheckbox.h>
#include <vtkAppendPolyData.h>
#include <vtkDataSetMapper.h>
-
-#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
-
using namespace std;
-extern VisuGUI *visuGUI;
+//extern VisuGUI *visuGUI;
-VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
- :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
+VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent/*, SUIT_ViewManager* theMgr*/)
+ : QFrame(theParent), myPreviewActor(0)//, myMgr(theMgr)
{
- QGridLayout* TopLayout = new QGridLayout( this );
+ QGridLayout* TopLayout = new QGridLayout( this );
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 10 );
myPosTable->setNumCols(2);
myPosTable->setNumRows(0);
connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
-
+
QHeader *th = myPosTable->horizontalHeader();
th->setLabel( 0, "Position" );
th->setLabel( 1, "Set default" );
th->setStyle("QStyle::CE_PushButton");
-
+
QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
GBrot->setColumnLayout(0, Qt::Vertical );
GBrot->layout()->setSpacing( 0 );
LabelRot1 = new QLabel( tr( "Rotation around X (Y to Z):" ), GBrot, "LabelRot1" );
GBrotLayout->addWidget( LabelRot1, 0, 0 );
- Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
+ Rot1 = new QtxDblSpinBox( -180, 180, 10, GBrot );
Rot1->setValue( 0 );
Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
GBrotLayout->addWidget( LabelRot2, 1, 0 );
-
- Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
+
+ Rot2 = new QtxDblSpinBox( -180, 180, 10, GBrot );
Rot2->setValue( 0 );
Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
GBrotLayout->addWidget( Rot2, 1, 1 );
QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
- myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
+ myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, this );
myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
myPreviewCheck->setChecked(false);
Y1 = 0; Y2 = 0;
Z1 = 0; Z2 = 0;
RByz->setChecked( true );
-
-} // End of Constructor
+} // End of Constructor
VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
{
deletePlanes();
- if(myCutPlanes) myCutPlanes->Destroy();
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ if (myCutPlanes)
+ myCutPlanes->Destroy();
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
vf->Repaint();
}
-
-void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
+void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
+{
setNbPlanes(thePrs->GetNbPlanes());
setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
setPlanePos(thePrs->GetOrientationType());
}
}
-
-void VisuGUI_CutPlanesPane::createPlanes() {
- if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+void VisuGUI_CutPlanesPane::createPlanes()
+{
+ if (VISU::GetViewWindow() == NULL) return;
if (myCutPlanes == NULL) return;
if (myPreviewActor != 0) return;
myPreviewActor->PickableOff();
myPreviewActor->SetMapper(aPlaneMapper);
aPlaneMapper->Delete();
- GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+ VISU::GetViewWindow()->AddActor(myPreviewActor);
}
-
-
-int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
- thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
+{
+ thePrs->SetOrientation(getOrientaion(), getRotation1()*PI/180., getRotation2()*PI/180.);
thePrs->SetNbPlanes(getNbPlanes());
thePrs->SetDisplacement(myPosSpn->value());
- for (int i = 0; i < getNbPlanes(); ++i)
- {
- if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
- thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
- else thePrs->SetDefault(i);
- }
+ for (int i = 0; i < getNbPlanes(); ++i) {
+ QCheckTableItem* anItem = (QCheckTableItem*)myPosTable->item(i, 1);
+ if (!anItem)
+ break;
+ if (!anItem->isChecked())
+ thePrs->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
+ else
+ thePrs->SetDefault(i);
+ }
return 1;
}
-
/*!
Called when orientation is changed
*/
-void VisuGUI_CutPlanesPane::orientationChanged( int Id )
+void VisuGUI_CutPlanesPane::orientationChanged (int Id)
{
- if ( Id == 0 ) { // RBxy->isChecked()
+ if (Id == 0) { // RBxy->isChecked()
LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
- } else if ( Id == 1 ) { // RByz->isChecked()
+ } else if (Id == 1) { // RByz->isChecked()
LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
- } else {
+ } else {
LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
}
DrawTable();
}
-
-
-
/*!
Sets planes orientation and position
*/
-void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation orient)
+void VisuGUI_CutPlanesPane::setPlanePos (const VISU::CutPlanes::Orientation orient)
{
- if ( orient == VISU::CutPlanes::XY ) // xy
+ if (orient == VISU::CutPlanes::XY) // xy
{
RBxy->setChecked( true );
orientationChanged( 0 );
}
- else if ( orient == VISU::CutPlanes::YZ ) // yz
+ else if (orient == VISU::CutPlanes::YZ) // yz
{
RByz->setChecked( true );
orientationChanged( 1 );
RBzx->setChecked( true );
orientationChanged( 2 );
}
-
+
}
/*!
/*!
Sets planes rotation
*/
-void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
+void VisuGUI_CutPlanesPane::setRotation (const double r1, const double r2)
{
Rot1->setValue( r1 );
Rot2->setValue( r2 );
/*!
Draw the table of planes positions
*/
-
void VisuGUI_CutPlanesPane::DrawTable()
{
if (myCutPlanes == NULL) return;
if (!hasInit) return;
int aNbRows = myPosTable->numRows();
- int aNbPlanes = getNbPlanes();
+ int aNbPlanes = getNbPlanes();
myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
myCutPlanes->SetNbPlanes(aNbPlanes);
if (!aItem->isChecked())
myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
}
-
+
if (aNbPlanes > aNbRows)
myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
else if (aNbPlanes < aNbRows)
QHeader *vh = myPosTable->verticalHeader();
QString str("Plane# %1");
for (int i=aMin; i<aNbPlanes; i++) {
- VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
- QTableItem::OnTyping,
+ VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
+ QTableItem::OnTyping,
QString::number(myCutPlanes->GetPlanePosition(i)));
aEditItem->setReplaceable(false);
aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
aCheck->setChecked(myCutPlanes->IsDefault(i));
aCheck->setReplaceable(false);
myPosTable->setItem(i, 1, aCheck);
-
+
vh->setLabel( i, str.arg(i+1) );
}
// Update preview
if (myPreviewCheck->isChecked()) {
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
myCutPlanes->GetPL()->Update();
deletePlanes();
createPlanes();
}
}
-void VisuGUI_CutPlanesPane::setDefault(int all)
+void VisuGUI_CutPlanesPane::setDefault (int all)
{
myPosTable->setCurrentCell(-1, 1);
myPosTable->clearSelection();
if (all == 0) return;
if (all == 1)
- for (int i = 0; i < getNbPlanes(); ++i)
+ for (int i = 0; i < getNbPlanes(); ++i)
((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
-
+
for (int i = 0; i < getNbPlanes(); ++i) {
if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
myCutPlanes->SetDefault(i);
myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
myPosTable->item( i, 0 )->setEnabled(false);
- } else
- myPosTable->item( i, 0 )->setEnabled(true);
+ } else
+ myPosTable->item( i, 0 )->setEnabled(true);
}
}
-void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
+void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
+{
if (theCol == 0) {
QString aTxt = myPosTable->text(theRow, 0);
bool isChanged = !aTxt.isEmpty();
if (myPreviewCheck->isChecked()) {
//Update Preview
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
myCutPlanes->GetPL()->Update();
deletePlanes();
myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
if (myPreviewCheck->isChecked()) {
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
//Update Preview
myCutPlanes->GetPL()->Update();
deletePlanes();
}
}
-
-void VisuGUI_CutPlanesPane::deletePlanes() {
+void VisuGUI_CutPlanesPane::deletePlanes()
+{
if (myPreviewActor == 0) return;
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
vf->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
myPreviewActor = 0;
}
-void VisuGUI_CutPlanesPane::onRotation(double theValue) {
+void VisuGUI_CutPlanesPane::onRotation (double theValue)
+{
if (myCutPlanes == NULL) return;
if (myPreviewCheck->isChecked()) {
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
myCutPlanes->GetPL()->Update();
deletePlanes();
- createPlanes();
- vf->Repaint();
+ createPlanes();
+ vf->Repaint();
}
}
}
-
-void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
+{
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
if (thePreview) {
storeToPrsObject(myCutPlanes);
myCutPlanes->GetPL()->Update();
createPlanes();
- vf->onViewFitAll();
+ vf->onFitAll();
} else {
deletePlanes();
vf->Repaint();
}
}
-
-
-
//###################################################################
/*!
Constructor
*/
-VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
- myStudy(QAD_Application::getDesktop()->getActiveStudy())
+VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
+ : QDialog(parent, "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ //,myMgr(VisuGUI::application()->activeViewManager())
{
- myStudyFrame = myStudy -> getActiveStudyFrame();
+ //myStudyWnd = myMgr->getActiveView();
if (!theIsModal) {
setWFlags(getWFlags() | WDestructiveClose);
}
- setCaption( tr( "Cut Planes Definition" ) );
- setSizeGripEnabled( TRUE );
+ setCaption("Cut Planes Definition");
+ setSizeGripEnabled(true);
myIsCreation = theIsCreation;
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
+ QVBoxLayout* TopLayout = new QVBoxLayout (this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ // Tab pane
QTabWidget* aTabBox = new QTabWidget(this);
- myCutPane = new VisuGUI_CutPlanesPane(this, myStudy);
+ myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/);
aTabBox->addTab(myCutPane, "Cut Planes");
myScalarPane = new VisuGUI_ScalarBarPane(this, false);
- myScalarPane->setMargin( 5 );
+ myScalarPane->setMargin(5);
aTabBox->addTab(myScalarPane, "Scalar Bar");
TopLayout->addWidget(aTabBox);
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- 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 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
-
- QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+ QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ GroupButtons->setTitle("");
+ 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);
+ GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+ QPushButton* buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
TopLayout->addWidget(GroupButtons);
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
- connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
+ //connect(VisuGUI::application()->desktop(),
+ // SIGNAL(windowActivated(SUIT_ViewWindow*)),
+ // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
}
-
void VisuGUI_CutPlanesDlg::accept() {
+ if (myScalarPane->check())
+ QDialog::accept();
+/*
if (myScalarPane->check()) {
if (!isModal()) {
if (storeToPrsObject(myPrs)) {
- if (myIsCreation) {
- if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ if (myIsCreation) {
+ if (VISU::GetViewWindow() != NULL) {
try {
visuGUI->CreateActor(myPrs);
}
reject();
return;
}
- GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
+ VISU::GetViewWindow()->onFitAll();
}
} else {
visuGUI->RecreateActor(myPrs);
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+ if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
vf->getRenderer()->ResetCameraClippingRange();
vf->Repaint();
}
}
QDialog::accept();
}
+*/
}
void VisuGUI_CutPlanesDlg::reject() {
- if (myIsCreation && (!isModal())) {
- visuGUI->DeletePresentation(myPrs);
- myStudy -> updateObjBrowser();
- }
+ //if (myIsCreation && (!isModal())) {
+ // visuGUI->DeletePresentation(myPrs);
+ // VisuGUI::application()->objectBrowser()->updateTree();
+ //}
QDialog::reject();
}
-void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
- if (theFrame != myStudyFrame)
- reject();
-}
+//void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
+//{
+// if (theWnd != myStudyWnd)
+// reject();
+//}
//###################################################################
-
-
-QWidget* VisuGUI_NumEditItem::createEditor() const
+QWidget* VisuGUI_NumEditItem::createEditor() const
{
QLineEdit *editline = new QLineEdit(text(), table()->viewport());
QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_CutPlanesDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#ifndef VISUGUI_CUTPLANESDLG_H
#define VISUGUI_CUTPLANESDLG_H
-#include "QAD_SpinBoxDbl.h"
-#include "QAD_StudyFrame.h"
-
#include "VisuGUI_ScalarBarDlg.h"
#include "VISU_CutPlanes_i.hh"
+
#include <SALOME_Actor.h>
#include <qradiobutton.h>
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
+class QtxDblSpinBox;
+class SUIT_ViewWindow;
+class SUIT_ViewManager;
+
class VisuGUI_CutPlanesPane : public QFrame
{
Q_OBJECT
public:
- VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study * theStudy);
+ VisuGUI_CutPlanesPane(QWidget* theParent/*, SUIT_ViewManager * theStudy*/);
~VisuGUI_CutPlanesPane();
void setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
QLabel* LabelRot1;
QLabel* LabelRot2;
QSpinBox* nbPlan;
- QAD_SpinBoxDbl* Rot1;
- QAD_SpinBoxDbl* Rot2;
+ QtxDblSpinBox* Rot1;
+ QtxDblSpinBox* Rot2;
QRadioButton* RBzx;
QRadioButton* RByz;
QRadioButton* RBxy;
- QAD_SpinBoxDbl* myPosSpn;
+ QtxDblSpinBox* myPosSpn;
QTable* myPosTable;
- VISU::CutPlanes_i* myCutPlanes;
+ VISU::CutPlanes_i* myCutPlanes;
QCheckBox* myPreviewCheck;
double X1, X2;
double Y1, Y2;
double Z1, Z2;
bool hasInit;
- QAD_Study* myStudy;
+ //SUIT_ViewManager *myMgr;
//vector<SALOME_Actor*> myPreviewActors;
SALOME_Actor* myPreviewActor;
class VisuGUI_CutPlanesDlg : public QDialog
-{
+{
Q_OBJECT
public:
- VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal);
+ //VisuGUI_CutPlanesDlg(QWidget* parent, bool theIsCreation = true, bool theIsModal = false);
+ VisuGUI_CutPlanesDlg(QWidget* parent, bool theIsCreation = true, bool theIsModal = true);
~VisuGUI_CutPlanesDlg() {};
void initFromPrsObject(VISU::CutPlanes_i* thePrs)
int storeToPrsObject(VISU::CutPlanes_i* thePrs)
{return myScalarPane->storeToPrsObject(thePrs) && myCutPane->storeToPrsObject(thePrs);}
-
+
protected slots:
void accept();
void reject();
- void onFrameActivated( QAD_StudyFrame* theFrame);
+ void onWindowActivated( SUIT_ViewWindow* );
private:
VisuGUI_CutPlanesPane* myCutPane;
VisuGUI_ScalarBarPane* myScalarPane;
VISU::CutPlanes_i* myPrs;
-
+
bool myIsCreation;
- QAD_Study *myStudy;
- QAD_StudyFrame *myStudyFrame;
+ //SUIT_ViewManager *myMgr;
+ //SUIT_ViewWindow *myStudyWnd;
};
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_MagnitudeDlg.cxx
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#include "VisuGUI_DeformedShapeDlg.h"
+#include "VISU_DeformedShape_i.hh"
+
+#include <qlayout.h>
+#include <qtabwidget.h>
+
+using namespace std;
+
+/*!
+ Constructor
+*/
+VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg(QWidget* parent)
+ : QDialog( parent, "VisuGUI_DeformedShapeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr( "Deformed Shape" ) );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ QTabWidget* aTabBox = new QTabWidget(this);
+
+ QVBox* aBox = new QVBox(this);
+ aBox->setMargin( 11 );
+ QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
+ TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ TopGroup->setLineWidth(1);
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
+ TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
+ TopGroupLayout->setSpacing( 6 );
+ TopGroupLayout->setMargin( 11 );
+
+ QLabel* ScaleLabel = new QLabel( tr( "Scale Factor:" ), TopGroup, "ScaleLabel" );
+ TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
+
+ ScalFact = new QtxDblSpinBox( 0.0, 1.0E+38, 0.1, TopGroup);
+ ScalFact->setPrecision(5);
+ ScalFact->setValue( 0.1 );
+ TopGroupLayout->addWidget( ScalFact, 0, 1 );
+
+ UseMagn = new QCheckBox( tr( "Magnitude coloring" ), TopGroup, "UseMagn" );
+ UseMagn->setChecked( true );
+ TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
+ //if (!enableUM)
+ // UseMagn->hide();
+ aTabBox->addTab(aBox, "Deformed Shape");
+
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+
+ 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 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( aTabBox );
+ TopLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+void VisuGUI_DeformedShapeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
+ myScalarPane->initFromPrsObject(thePrs);
+ setFactor(thePrs->GetScale());
+ UseMagn->setChecked(thePrs->IsColored());
+}
+
+
+int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
+ myScalarPane->storeToPrsObject(thePrs);
+ thePrs->SetScale(getFactor());
+ thePrs->ShowColored(isColored());
+ return 1;
+}
+
+
+void VisuGUI_DeformedShapeDlg::accept() {
+ if (myScalarPane->check()) QDialog::accept();
+}
+
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_MagnitudeDlg.h
+// Author : Laurent CORNABE & Hubert ROLLAND
+// Module : VISU
+// $Header$
+
+#ifndef VISUGUI_DEFORMEDSHAPEDLS_H
+#define VISUGUI_DEFORMEDSHAPEDLS_H
+
+#include "VisuGUI_ScalarBarDlg.h"
+
+#include <qdialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+
+#include "QtxDblSpinBox.h"
+
+namespace VISU{
+ class DeformedShape_i;
+}
+
+class VisuGUI_DeformedShapeDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_DeformedShapeDlg(QWidget* parent);
+ ~VisuGUI_DeformedShapeDlg() {};
+
+ double getFactor()
+ { return ScalFact->value(); }
+ void setFactor(double theFactor)
+ { ScalFact->setValue(theFactor); }
+
+ bool isColored()
+ { return UseMagn->isChecked(); }
+
+ void initFromPrsObject(VISU::DeformedShape_i* thePrs);
+ int storeToPrsObject(VISU::DeformedShape_i* thePrs);
+
+protected slots:
+ void accept();
+
+ private:
+ QtxDblSpinBox* ScalFact;
+ QCheckBox* UseMagn;
+ VisuGUI_ScalarBarPane* myScalarPane;
+};
+
+#endif // VISUGUI_DEFORMEDSHAPEDLS_H
#include "VisuGUI.h"
#include "VISU_Table_i.hh"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SalomeApp_Application.h"
+#include "SUIT_Desktop.h"
#include <qlayout.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
+#include <qlabel.h>
#include CORBA_SERVER_HEADER(VISU_Gen)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-extern VisuGUI *visuGUI;
+//extern VisuGUI *visuGUI;
using namespace std;
static QPixmap MYRightPix(right_xpm);
-VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_EditContainerDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (QWidget* parent, bool theIsModal)
+ : QDialog(parent, "VisuGUI_EditContainerDlg", theIsModal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- setCaption( "Edit Plot 2D Presentation" );
- setSizeGripEnabled( true );
- QVBoxLayout* TopLayout = new QVBoxLayout(this, 6, 11);
+ if (!theIsModal) {
+ setWFlags(getWFlags() | WDestructiveClose);
+ }
+ setCaption("Edit Plot 2D Presentation");
+ setSizeGripEnabled(true);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout (this, 6, 11);
/***************************************************************/
- QFrame* aControlFrame = new QFrame(this);
+ QFrame* aControlFrame = new QFrame (this);
aControlFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
- QGridLayout* aControlLay = new QGridLayout(aControlFrame);
- aControlLay->setSpacing( 6 );
- aControlLay->setMargin( 11 );
- aControlLay->addRowSpacing( 1, 30 );
- aControlLay->addRowSpacing( 4, 30 );
- aControlLay->setRowStretch( 1, 1 );
- aControlLay->setRowStretch( 4, 1 );
- aControlLay->addColSpacing( 0, 180 );
- aControlLay->addColSpacing( 2, 180 );
-
- QLabel* aSelectLbl = new QLabel(tr("Study"), aControlFrame);
+ QGridLayout* aControlLay = new QGridLayout (aControlFrame);
+ aControlLay->setSpacing(6);
+ aControlLay->setMargin(11);
+ aControlLay->addRowSpacing(1, 30);
+ aControlLay->addRowSpacing(4, 30);
+ aControlLay->setRowStretch(1, 1);
+ aControlLay->setRowStretch(4, 1);
+ aControlLay->addColSpacing(0, 180);
+ aControlLay->addColSpacing(2, 180);
+
+ QLabel* aSelectLbl = new QLabel (tr("Study"), aControlFrame);
aControlLay->addWidget(aSelectLbl, 0, 0);
- myStudyLst = new QListView(aControlFrame);
+ myStudyLst = new QListView (aControlFrame);
myStudyLst->setSelectionMode(QListView::Extended);
myStudyLst->addColumn(tr("Table"), 80);
myStudyLst->addColumn(tr("Curve"), 50);
myStudyLst->addColumn(tr(""), 0);
myStudyLst->setAllColumnsShowFocus(true);
myStudyLst->setMinimumHeight(130);
- connect(myStudyLst, SIGNAL( selectionChanged()), this, SLOT( onLeftSelected() ));
+ connect(myStudyLst, SIGNAL(selectionChanged()), this, SLOT(onLeftSelected()));
aControlLay->addMultiCellWidget(myStudyLst, 1, 4, 0, 0);
-
- myRightBtn = new QToolButton(aControlFrame);
+
+ myRightBtn = new QToolButton (aControlFrame);
myRightBtn->setIconSet(MYRightPix);
myRightBtn->setEnabled(false);
- connect(myRightBtn, SIGNAL( clicked()), this, SLOT( onRightClicked() ));
+ connect(myRightBtn, SIGNAL(clicked()), this, SLOT(onRightClicked()));
aControlLay->addWidget(myRightBtn, 2, 1);
-
+
myLeftBtn = new QToolButton(aControlFrame);
myLeftBtn->setIconSet(MYLeftPix);
myLeftBtn->setEnabled(false);
- connect(myLeftBtn, SIGNAL( clicked()), this, SLOT( onLeftClicked() ));
+ connect(myLeftBtn, SIGNAL(clicked()), this, SLOT(onLeftClicked()));
aControlLay->addWidget(myLeftBtn, 3, 1);
-
+
QLabel* aForceLbl = new QLabel(tr("Container"), aControlFrame);
aControlLay->addWidget(aForceLbl, 0, 2);
myContainerLst->addColumn(tr("Curve"), 50);
myContainerLst->addColumn(tr(""), 0);
myContainerLst->setMinimumWidth(130);
- connect(myContainerLst, SIGNAL( selectionChanged()), this, SLOT( onRightSelected() ));
+ connect(myContainerLst, SIGNAL(selectionChanged()), this, SLOT(onRightSelected()));
aControlLay->addMultiCellWidget(myContainerLst, 1, 4, 2, 2);
-
- TopLayout->addWidget( aControlFrame );
+
+ TopLayout->addWidget(aControlFrame);
// Common buttons ===========================================================
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- 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 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-
- QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( GroupButtons );
-
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+ 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);
+ GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+ QPushButton* buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel");
+ buttonCancel->setAutoDefault(TRUE);
+ GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
+
+ TopLayout->addWidget(GroupButtons);
+
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
}
-
-void VisuGUI_EditContainerDlg::initFromPrsObject(VISU::Container_i* theContainer) {
- SALOMEDS::Study_var aStudy = visuGUI->GetStudyDocument();
+void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContainer)
+{
+ SALOMEDS::Study_var aStudy = theContainer->GetStudyDocument();
SALOMEDS::SComponent_var aVisuSO = aStudy->FindComponent("VISU");
- if (aVisuSO->_is_nil()) {
+ if (CORBA::is_nil(aVisuSO)) {
return;
}
QValueList<CurveStruct> aStudyCurves;
new QListViewItem(myContainerLst, aEntry.TableName, aEntry.CurveName, aEntry.CurveEntry);
}
// Find curves in study
- SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aVisuSO );
+ SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator(aVisuSO);
for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
SALOMEDS::SObject_var aSObject = aIter->Value();
CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
QValueList<CurveStruct>::iterator it;
QValueList<CurveStruct>::iterator it2;
bool isExist = false;
- for (it = aStudyCurves.begin(); it != aStudyCurves.end(); ++it ) {
- for (it2 = aContainerCurves.begin(); it2 != aContainerCurves.end(); ++it2 ) {
+ for (it = aStudyCurves.begin(); it != aStudyCurves.end(); ++it) {
+ for (it2 = aContainerCurves.begin(); it2 != aContainerCurves.end(); ++it2) {
if (isExist = ((*it).CurveEntry == (*it2).CurveEntry))
break;
}
}
}
+/*void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContainer)
+{
+ _PTR(Study) aStudy = theContainer->GetStudyDocument();
+ _PTR(SComponent) aVisuSO = aStudy->FindComponent("VISU");
+ if (!aVisuSO) {
+ return;
+ }
+ QValueList<CurveStruct> aStudyCurves;
+ QValueList<CurveStruct> aContainerCurves;
+ // Find curves in container
+ for (int i = 1; i <= theContainer->GetNbCurves(); i++) {
+ VISU::Curve_i* aCurve = theContainer->GetCurve(i);
+ if (aCurve == NULL) continue;
+ CurveStruct aEntry;
+ aEntry.CurveName = aCurve->GetTitle();
+ aEntry.CurveEntry = aCurve->GetEntry();
+ _PTR(SObject) aTableSO = aStudy->FindObjectID(aCurve->GetTableID());
+ if (!aTableSO) continue;
+ aEntry.TableName = getSObjectName(aTableSO);
+ aContainerCurves.append(aEntry);
+ new QListViewItem(myContainerLst, aEntry.TableName, aEntry.CurveName, aEntry.CurveEntry);
+ }
+ // Find curves in study
+ _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aVisuSO);
+ for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+ _PTR(SObject) aSObject = aIter->Value();
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj)) {
+ if (aVisuObj->GetType() == VISU::TCURVE) {
+ _PTR(SObject) aTableSO = aSObject->GetFather();
+ CurveStruct aEntry;
+ aEntry.TableName = getSObjectName(aTableSO);
+ aEntry.CurveName = getSObjectName(aSObject);
+ aEntry.CurveEntry = aSObject->GetID();
+ aStudyCurves.append(aEntry);
+ }
+ }
+ }
+ //Show Curves which are not in Curve
+ QValueList<CurveStruct>::iterator it;
+ QValueList<CurveStruct>::iterator it2;
+ bool isExist = false;
+ for (it = aStudyCurves.begin(); it != aStudyCurves.end(); ++it) {
+ for (it2 = aContainerCurves.begin(); it2 != aContainerCurves.end(); ++it2) {
+ if (isExist = ((*it).CurveEntry == (*it2).CurveEntry))
+ break;
+ }
+ if (!isExist)
+ new QListViewItem(myStudyLst, (*it).TableName, (*it).CurveName, (*it).CurveEntry);
+ }
+}*/
-void VisuGUI_EditContainerDlg::storeToPrsObject(VISU::Container_i* theContainer) {
+void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer)
+{
theContainer->Clear();
- SALOMEDS::Study_var aStudy = visuGUI->GetStudyDocument();
+ SALOMEDS::Study_var aStudy = theContainer->GetStudyDocument();
QListViewItem* anItem = myContainerLst->firstChild();
while (anItem) {
SALOMEDS::SObject_var aCurveSO = aStudy->FindObjectID(anItem->text(2));
- if (!aCurveSO->_is_nil()) {
+ if (!CORBA::is_nil(aCurveSO)) {
CORBA::Object_var aObject = VISU::SObjectToObject(aCurveSO);
if (!CORBA::is_nil(aObject)) {
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aObject).in() );
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aObject).in());
if (aCurve) theContainer->AddCurve(aCurve->_this());
}
}
}
}
+/*void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer)
+{
+ theContainer->Clear();
+
+ _PTR(Study) aStudy = theContainer->GetStudyDocument();
+ QListViewItem* anItem = myContainerLst->firstChild();
+ while (anItem) {
+ _PTR(SObject) aCurveSO = aStudy->FindObjectID(anItem->text(2));
+ if (aCurveSO) {
+ CORBA::Object_var aObject = VISU::ClientSObjectToObject(aCurveSO);
+ if (!CORBA::is_nil(aObject)) {
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aObject).in());
+ if (aCurve) theContainer->AddCurve(aCurve->_this());
+ }
+ }
+ anItem = anItem->nextSibling();
+ }
+}*/
-QString VisuGUI_EditContainerDlg::getSObjectName(SALOMEDS::SObject_var theSObject) {
- if (theSObject->_is_nil()) return QString("");
+QString VisuGUI_EditContainerDlg::getSObjectName (SALOMEDS::SObject_ptr theSObject)
+{
+ if (CORBA::is_nil(theSObject)) return QString("");
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
- if ( theSObject->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
+ if (theSObject->FindAttribute(anAttr, "AttributeName")) {
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
return QString(aName->Value());
- }
+ }
return QString("");
}
+/*QString VisuGUI_EditContainerDlg::getSObjectName (_PTR(SObject) theSObject)
+{
+ if (!theSObject) return QString("");
+
+ _PTR(GenericAttribute) anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ return QString(aName->Value());
+ }
+ return QString("");
+}*/
-void VisuGUI_EditContainerDlg::onLeftClicked() {
+void VisuGUI_EditContainerDlg::onLeftClicked()
+{
QListViewItem* anItem = myContainerLst->firstChild();
while (anItem) {
if (anItem->isSelected()) {
}
}
-
-void VisuGUI_EditContainerDlg::onRightClicked() {
+void VisuGUI_EditContainerDlg::onRightClicked()
+{
QListViewItem* anItem = myStudyLst->firstChild();
while (anItem) {
if (anItem->isSelected()) {
}
}
-
-void VisuGUI_EditContainerDlg::onLeftSelected() {
+void VisuGUI_EditContainerDlg::onLeftSelected()
+{
QListViewItem* anItem = myStudyLst->firstChild();
bool isSelected = false;
while (anItem) {
myRightBtn->setEnabled(isSelected);
}
-
-void VisuGUI_EditContainerDlg::onRightSelected() {
+void VisuGUI_EditContainerDlg::onRightSelected()
+{
QListViewItem* anItem = myContainerLst->firstChild();
bool isSelected = false;
while (anItem) {
#include <qvaluevector.h>
#include <qtoolbutton.h>
-
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
-namespace VISU{
+class SALOMEDSClient_SObject;
+
+namespace VISU {
class Container_i;
}
Q_OBJECT
public:
- VisuGUI_EditContainerDlg();
+ VisuGUI_EditContainerDlg (QWidget* parent, bool theIsModal = true);
~VisuGUI_EditContainerDlg() {};
- void initFromPrsObject(VISU::Container_i* theContainer);
- void storeToPrsObject(VISU::Container_i* theContainer);
+ void initFromPrsObject (VISU::Container_i* theContainer);
+ void storeToPrsObject (VISU::Container_i* theContainer);
private slots:
void onLeftClicked();
void onRightSelected();
private:
- QString getSObjectName(SALOMEDS::SObject_var theSObject);
+ //QString getSObjectName (_PTR(SObject) theSObject);
+ QString getSObjectName (SALOMEDS::SObject_ptr theSObject);
QListView* myStudyLst;
QListView* myContainerLst;
QToolButton* myRightBtn;
};
-
#endif // VISUGUI_EDITCONTAINER_H
-
//
//
//
-// File : QAD_FileDlg.cxx
+// File : VisuGUI_FileDlg.cxx
// Author :
// Module : SALOME
// $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/VISUGUI/Visu_FileDlg.cxx
#include <qapplication.h>
-#include <qlabel.h>
#include <qpushbutton.h>
+#include <qcheckbox.h>
#include <qstring.h>
-#include "QAD_Config.h"
+#include <qlabel.h>
+
+#include "VISUConfig.hh"
#include "VisuGUI_FileDlg.h"
+#include "SUIT_ResourceMgr.h"
using namespace std;
/*!
Constructor
*/
-VisuGUI_FileDlg::VisuGUI_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) :
- QAD_FileDlg( parent, open, showQuickDir, modal )
+VisuGUI_FileDlg::VisuGUI_FileDlg( QWidget* parent,
+ bool open,
+ bool showQuickDir,
+ bool modal ) :
+ SUIT_FileDlg( parent, open, showQuickDir, modal )
{
myCBuildAll = new QCheckBox( tr("Full loading for current file"), this );
QLabel* label = new QLabel("", this);
QPushButton* pb = new QPushButton(this);
pb->setMaximumWidth(0);
addWidgets( label, myCBuildAll, pb );
- QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+ QString aIsBuild = VISU::GetResourceMgr()->stringValue("Visu:BuildResult");
if (aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) myCBuildAll->setChecked(true);
}
const QString& caption,
bool open,
bool showQuickDir,
- QAD_FileValidator* validator )
+ SUIT_FileValidator* validator )
{
VisuGUI_FileDlg* fd = new VisuGUI_FileDlg( parent, open, showQuickDir, true );
if ( !caption.isEmpty() )
//
//
//
-// File : QAD_FileDlg.h
+// File : VisuGUI_FileDlg.h
// Author :
// Module : SALOME
// $Header: /dn05/salome/CVS/SALOME_ROOT/VISU/src/VISUGUI/VisuGUI_FileDlg.h
#ifndef VISU_FILEDIALOG_H
#define VISU_FILEDIALOG_H
-#include "QAD_FileDlg.h"
-#include <qcheckbox.h>
+#include "SUIT_FileDlg.h"
-class VisuGUI_FileDlg : public QAD_FileDlg
-{
- Q_OBJECT
-
-public:
- VisuGUI_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
- ~VisuGUI_FileDlg();
+class QCheckBox;
-public:
- static bool IsBuild;
- static QString getFileName( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open,
- bool showQuickDir = true,
- QAD_FileValidator* validator = 0);
+class VisuGUI_FileDlg : public SUIT_FileDlg
+{
+ Q_OBJECT;
+ public:
+ VisuGUI_FileDlg( QWidget* parent,
+ bool open,
+ bool showQuickDir = true,
+ bool modal = true );
+ ~VisuGUI_FileDlg();
+
+ public:
+ static bool IsBuild;
+ static QString getFileName( QWidget* parent,
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption,
+ bool open,
+ bool showQuickDir = true,
+ SUIT_FileValidator* validator = 0);
private:
- QCheckBox* myCBuildAll;
- bool IsChecked();
- bool processPath( const QString& path );
-
+ QCheckBox* myCBuildAll;
+ bool IsChecked();
+ bool processPath( const QString& path );
};
#endif
#include "VisuGUI_InitMeshDlg.h"
#include "VisuGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SUIT_Application.h"
+#include "SUIT_Desktop.h"
#include "utilities.h"
// QT Includes
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(GEOM_Shape)
+//#include CORBA_SERVER_HEADER(GEOM_Shape)
class QVBoxLayout;
class QHBoxLayout;
class QPushButton;
class QRadioButton;
class VisuGUI;
-
+class SalomeApp_SelectionMgr;
//=================================================================================
// class : VisuGUI_InitMeshDlg
Q_OBJECT
public:
- VisuGUI_InitMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
+ VisuGUI_InitMeshDlg( QWidget* parent = 0, const char* name = 0, SalomeApp_SelectionMgr* = 0, bool modal = FALSE, WFlags fl = 0 );
~VisuGUI_InitMeshDlg();
private:
- void Init( SALOME_Selection* Sel ) ;
+ void Init( SalomeApp_SelectionMgr* ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
VisuGUI* myVisuGUI ;
- SALOME_Selection* mySelection ;
+ SalomeApp_SelectionMgr* myMgr ;
GEOM::GEOM_Shape_var myGeomShape ;
int myConstructorId ;
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_IsoSurfacesDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_IsoSurfacesDlg.h"
-#include "VISU_IsoSurfaces_i.hh"
+#include "VisuGUI.h"
+//#include "VisuGUI_Selection.h"
+
+#include "SalomeApp_Application.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
#include <limits.h>
#include <qvalidator.h>
#include <qtabwidget.h>
-
using namespace std;
-VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane(QWidget* parent)
- : QVBox(parent)
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent)
+ : QVBox(parent)
{
QFrame* TopGroup = new QFrame( this, "TopGroup" );
TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
TopGroupLayout->addWidget( LabelMin, 1, 0 );
- //MinIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1 );
+ //MinIso = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, TopGroup );
MinIso = new QLineEdit( TopGroup );
- MinIso->setValidator( new QDoubleValidator(TopGroup) );
+ MinIso->setValidator( new QDoubleValidator(TopGroup) );
MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MinIso->setMinimumSize( 70, 0 );
LabelMin->setBuddy(MinIso);
QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
TopGroupLayout->addWidget( LabelMax, 2, 0 );
- //MaxIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1);
+ //MaxIso = new QtxSpinBoxDbl( -DBL_MAX, DBL_MAX, 0.1, TopGroup );
MaxIso = new QLineEdit( TopGroup );
MaxIso->setValidator( new QDoubleValidator(TopGroup) );
MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MaxIso->setMinimumSize( 70, 0 );
LabelMax->setBuddy(MaxIso);
TopGroupLayout->addWidget( MaxIso, 2, 1 );
-
-
+
+
// CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
// CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
// TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
// CBUpdate->setChecked(false);
QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
- connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
-
+ connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
+
// CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
// CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
// TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
-
}
-
-
-void VisuGUI_IsoSurfPane::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
+void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
+{
NbrIso->setValue(thePrs->GetNbSurfaces());
MinIso->setText(QString::number(thePrs->GetSubMin()));
MaxIso->setText(QString::number(thePrs->GetSubMax()));
// switch(thePrs->GetScaling()){
-// case VISU::LOGARITHMIC :
+// case VISU::LOGARITHMIC :
// CBLog->setChecked(true);
// break;
-// default:
+// default:
// CBLog->setChecked(false);
// }
}
-int VisuGUI_IsoSurfPane::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
+int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
+{
thePrs->SetNbSurfaces(NbrIso->value());
thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
return 1;
// thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
// if (CBLog->isChecked())
// thePrs->SetScaling(VISU::LOGARITHMIC);
-// else
+// else
// thePrs->SetScaling(VISU::LINEAR);
// }
}
// else CBLog->setDisabled(true);
}
-
-bool VisuGUI_IsoSurfPane::check() {
+bool VisuGUI_IsoSurfPane::check()
+{
if (MinIso->text().toDouble() >= MaxIso->text().toDouble()) {
MESSAGE(tr("MSG_MINMAX_VALUES"));
- QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
- tr("MSG_MINMAX_VALUES"),
- tr("VISU_BUT_OK"));
+ SUIT_MessageBox::warn1( this,tr("VISU_WARNING"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("VISU_BUT_OK"));
return false;
} // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
// (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
-// QAD_MessageBox::warn1( this,
+// SUIT_MessageBox::warn1( this,
// tr("VISU_WARNING"),
// tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
// tr("VISU_BUT_OK"));
/*!
Constructor
*/
-VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (QWidget* parent)
+ : QDialog(parent, "VisuGUI_IsoSurfacesDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
setCaption( tr( "Iso Surfaces Definition" ) );
setSizeGripEnabled( TRUE );
-
+
QVBoxLayout* TopLayout = new QVBoxLayout(this);
TopLayout->setSpacing( 6 );
TopLayout->setMargin(11);
-
+
QTabWidget* aTabBox = new QTabWidget(this);
myIsoPane = new VisuGUI_IsoSurfPane(this);
myIsoPane->setMargin( 5 );
aTabBox->addTab(myScalarPane, "Scalar Bar");
TopLayout->addWidget(aTabBox);
-
+
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
-
+
QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
+
TopLayout->addWidget(GroupButtons);
-
+
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
-void VisuGUI_IsoSurfacesDlg::accept() {
- if (myIsoPane->check() && myScalarPane->check()) QDialog::accept();
+void VisuGUI_IsoSurfacesDlg::accept()
+{
+ if (myIsoPane->check() && myScalarPane->check())
+ QDialog::accept();
}
-
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_IsoSurfacesDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include <qcheckbox.h>
#include <qlineedit.h>
-
-
class VisuGUI_IsoSurfPane : public QVBox
{
Q_OBJECT
int storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
void setScalarBarPane(VisuGUI_ScalarBarPane* theScalarPane) {myScalarPane = theScalarPane;}
- VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;}
+ VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;}
bool check();
protected slots:
void onCBUpdate();
-
+
private:
QLineEdit* MinIso;
QLineEdit* MaxIso;
QSpinBox* NbrIso;
//QCheckBox* CBUpdate;
- VisuGUI_ScalarBarPane* myScalarPane;
+ VisuGUI_ScalarBarPane* myScalarPane;
// QCheckBox* CBLog;
};
-
-
class VisuGUI_IsoSurfacesDlg : public QDialog
-{
+{
Q_OBJECT
public:
- VisuGUI_IsoSurfacesDlg();
+ VisuGUI_IsoSurfacesDlg(QWidget* parent);
~VisuGUI_IsoSurfacesDlg() {};
-
- void initFromPrsObject(VISU::IsoSurfaces_i* thePrs)
+
+ void initFromPrsObject(VISU::IsoSurfaces_i* thePrs)
{myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs);}
int storeToPrsObject(VISU::IsoSurfaces_i* thePrs)
{return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);}
-
+
protected slots:
void accept();
-
+
private:
VisuGUI_IsoSurfPane* myIsoPane;
VisuGUI_ScalarBarPane* myScalarPane;
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_MagnitudeDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_MagnitudeDlg.h"
+#include "VisuGUI_Selection.h"
#include "VISU_DeformedShape_i.hh"
+#include "VisuGUI.h"
+#include "QtxDblSpinBox.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SalomeApp_Application.h"
+
+#include "SUIT_Desktop.h"
#include <qlayout.h>
#include <qtabwidget.h>
Constructor
*/
VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_MagnitudeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ : QDialog( VisuGUI::application()->desktop(), "VisuGUI_MagnitudeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
setCaption( tr( "Deformed Shape" ) );
setSizeGripEnabled( TRUE );
QLabel* ScaleLabel = new QLabel( tr( "Scale Factor:" ), TopGroup, "ScaleLabel" );
TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
- ScalFact = new QAD_SpinBoxDbl( TopGroup, 0, 1.0E+38, 0.1, 5);
+ ScalFact = new QtxDblSpinBox( 0, 1.0E+38, 0.1, TopGroup );
+ ScalFact->setPrecision( 5 );
ScalFact->setValue( 0.1 );
TopGroupLayout->addWidget( ScalFact, 0, 1 );
#include <qlabel.h>
#include <qpushbutton.h>
-#include "QAD_SpinBoxDbl.h"
+#include "QtxDblSpinBox.h"
namespace VISU{
class DeformedShape_i;
void accept();
private:
- QAD_SpinBoxDbl* ScalFact;
+ QtxDblSpinBox* ScalFact;
QCheckBox* UseMagn;
VisuGUI_ScalarBarPane* myScalarPane;
};
// $Header$
#include "VisuGUI_NonIsometricDlg.h"
+#include "VisuGUI_Selection.h"
+#include "VisuGUI.h"
#include "VISU_Actor.h"
#include "VISU_PipeLine.hxx"
-#include "QAD_SpinBoxDbl.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_StudyFrame.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
+#include "QtxDblSpinBox.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ViewWindow.h"
+#include "VTKViewer_ViewWindow.h"
#include "utilities.h"
#include "SALOME_Selection.h"
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame();
- VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(sf->getRightFrame()->getViewFrame());
+ SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
+ VTKViewer_ViewWindow* aViewWnd = dynamic_cast<VTKViewer_ViewWindow*>(sf);
if ( !name )
setName( "NonIsometricDlg" );
// "X" scaling
QLabel* TextLabelX = new QLabel( "X: ", GroupBox, "TextLabelX" );
- m_sbXcoeff = new QAD_SpinBoxDbl( GroupBox, -DBL_MAX, DBL_MAX, 0.1 );
+ m_sbXcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
//m_sbXcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
m_sbXcoeff->setMinimumWidth( 80 );
m_sbXcoeff->setValue( 1.0 );
// "Y" scaling
QLabel* TextLabelY = new QLabel( "Y", GroupBox, "TextLabelY" );
- m_sbYcoeff = new QAD_SpinBoxDbl( GroupBox, -DBL_MAX, DBL_MAX, 0.1 );
+ m_sbYcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
//m_sbYcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
m_sbYcoeff->setMinimumWidth( 80 );
m_sbYcoeff->setValue( 1.0 );
// "Z" scaling
QLabel* TextLabelZ = new QLabel( "Z", GroupBox, "TextLabelZ" );
- m_sbZcoeff = new QAD_SpinBoxDbl( GroupBox, -DBL_MAX, DBL_MAX, 0.1 );
+ m_sbZcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
//m_sbZcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
m_sbZcoeff->setMinimumWidth( 80 );
m_sbZcoeff->setValue( 1.0 );
// Get initial values from the current VTK viewer
- if ( aViewFrame ) {
+ if ( aViewWnd ) {
double aScaleFactor[3];
- aViewFrame->GetScale(aScaleFactor);
+ aViewWnd->GetScale(aScaleFactor);
m_sbXcoeff -> setValue(aScaleFactor[0]);
m_sbYcoeff -> setValue(aScaleFactor[1]);
m_sbZcoeff -> setValue(aScaleFactor[2]);
}
void VisuGUI_NonIsometricDlg::onClickApply(){
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame();
- SALOME_Selection* Sel = SALOME_Selection::Selection( sf->getStudy()->getSelection() );
-
-
- if( VTKViewer_ViewFrame* vf = dynamic_cast<VTKViewer_ViewFrame*>(sf->getRightFrame()->getViewFrame())){
- double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
- vf->SetScale(aScale);
- }
-
- SALOME_ListIteratorOfListIO Itinit( Sel->StoredIObjects() );
- for (; Itinit.More(); Itinit.Next()) {
- sf->getStudy()->highlight(Itinit.Value(), true);
- }
+ SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
+ SalomeApp_SelectionMgr* mgr = VisuGUI::application()->selectionMgr();
+
+
+ VTKViewer_ViewWindow* vf = dynamic_cast<VTKViewer_ViewWindow*>(sf);
+ if( !vf )
+ return;
+
+ double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
+ vf->SetScale(aScale);
+
+ SALOME_ListIO selected;
+ mgr->selectedObjects( selected );
+ SALOME_ListIteratorOfListIO Itinit( selected );
+ SVTK_RenderWindowInteractor* rw = dynamic_cast<SVTK_RenderWindowInteractor*>( vf->getRWInteractor() );
+
+ if( rw )
+ for (; Itinit.More(); Itinit.Next()) {
+ rw->highlight(Itinit.Value(), true);
+ }
}
void VisuGUI_NonIsometricDlg::onClickReset()
#define VisuGUI_NONISOMETRICDLG_H
#include <qdialog.h>
-class QAD_SpinBoxDbl;
+class QtxDblSpinBox;
class QPushButton;
class VisuGUI_NonIsometricDlg : public QDialog
~VisuGUI_NonIsometricDlg();
private:
- QAD_SpinBoxDbl* m_sbXcoeff;
- QAD_SpinBoxDbl* m_sbYcoeff;
- QAD_SpinBoxDbl* m_sbZcoeff;
+ QtxDblSpinBox* m_sbXcoeff;
+ QtxDblSpinBox* m_sbYcoeff;
+ QtxDblSpinBox* m_sbZcoeff;
QPushButton* m_bReset ;
private slots:
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2005 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_PopupTools.cxx
+// Author : Sergey Anikin
+// Module : VISU
+
+#include "VisuGUI_PopupTools.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Actor.h"
+
+using namespace VISU;
+
+//////////////////////////////////////////////////
+// Class: VisuGUI_Selection
+//////////////////////////////////////////////////
+
+QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
+{
+ QtxValue val( SalomeApp_Selection::param( ind, p ) );
+ if ( !val.isValid() ) {
+ if ( p == "type" ) val = QtxValue( type( ind ) );
+ else if ( p == "nbComponents" ) val = QtxValue( nbComponents( ind ) );
+ else if ( p == "representation" ) val = QtxValue( representation( ind ) );
+ else if ( p == "nbTimeStamps" ) val = QtxValue( nbTimeStamps( ind ) );
+ else if ( p == "nbChildren" ) val = QtxValue( nbChildren( ind ) );
+ else if ( p == "nbNamedChildren") val = QtxValue( nbNamedChildren( ind ) );
+ else if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) );
+ else if ( p == "isShrunk" ) val = QtxValue( isShrunk( ind ) );
+ else if ( p == "hasActor" ) val = QtxValue( hasActor( ind ) );
+ }
+
+ return val;
+}
+
+// Macro for converting VISU enumeration items into corresponding strings
+#define ENUM2STRING( x, y ) \
+ case y: \
+ x = QString( #y ); \
+ break;
+
+QString VisuGUI_Selection::type( const int ind ) const
+{
+ QString aTypeStr;
+ VISU::Storable::TRestoringMap aMap;
+ CORBA::Object_var anObject = GetSelectedObj( study(), entry( ind ), &aMap );
+
+ VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
+
+ if ( !CORBA::is_nil( aVisuObj ) ){
+ VISU::VISUType aType = aVisuObj->GetType();
+ switch (aType) {
+ ENUM2STRING( aTypeStr, VISU::TVISUGEN )
+ ENUM2STRING( aTypeStr, VISU::TRESULT )
+ ENUM2STRING( aTypeStr, VISU::TTABLE )
+ ENUM2STRING( aTypeStr, VISU::TCURVE )
+ ENUM2STRING( aTypeStr, VISU::TCONTAINER )
+ ENUM2STRING( aTypeStr, VISU::TMESH )
+ ENUM2STRING( aTypeStr, VISU::TSCALARMAP )
+ ENUM2STRING( aTypeStr, VISU::TISOSURFACE )
+ ENUM2STRING( aTypeStr, VISU::TDEFORMEDSHAPE )
+ ENUM2STRING( aTypeStr, VISU::TCUTPLANES )
+ ENUM2STRING( aTypeStr, VISU::TCUTLINES )
+ ENUM2STRING( aTypeStr, VISU::TVECTORS )
+ ENUM2STRING( aTypeStr, VISU::TSTREAMLINES )
+ }
+ }
+ else{
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue( aMap, "myType", &isExist).toInt();
+ if( isExist ){
+ switch (aType) {
+ ENUM2STRING( aTypeStr, VISU::TENTITY )
+ ENUM2STRING( aTypeStr, VISU::TFAMILY )
+ ENUM2STRING( aTypeStr, VISU::TGROUP )
+ ENUM2STRING( aTypeStr, VISU::TVIEW3D )
+ ENUM2STRING( aTypeStr, VISU::TFIELD )
+ ENUM2STRING( aTypeStr, VISU::TTIMESTAMP )
+ }
+ }
+ }
+
+ return aTypeStr;
+}
+
+QString VisuGUI_Selection::nbComponents( const int ind ) const
+{
+ QString aResStr;
+ VISU::Storable::TRestoringMap aMap;
+ GetSelectedObj( study(), entry( ind ), &aMap );
+ bool isExist;
+ const QString& aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
+ if ( isExist )
+ aResStr = aVal;
+ return aResStr;
+}
+
+QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
+{
+ QString aResStr;
+ VISU::Storable::TRestoringMap aMap;
+ GetSelectedObj( study(), entry( ind ), &aMap );
+ bool isExist;
+ const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
+ if ( isExist )
+ aResStr = aVal;
+ return aResStr;
+}
+
+QString VisuGUI_Selection::representation( const int ind ) const
+{
+ QString aResStr;
+
+ if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ){
+ if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ){
+ int aRepresent = anVISUActor->GetRepresentation();
+ switch ( aRepresent ){
+ ENUM2STRING( aResStr, VISU::POINT )
+ ENUM2STRING( aResStr, VISU::WIREFRAME )
+ ENUM2STRING( aResStr, VISU::SHADED )
+ ENUM2STRING( aResStr, VISU::INSIDEFRAME )
+ ENUM2STRING( aResStr, VISU::SURFACEFRAME )
+ }
+ }
+ }
+
+ return aResStr;
+}
+
+int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
+{
+ int cnt = 0;
+ _PTR(Study) aStudy = GetCStudy( study() );
+ if ( aStudy ){
+ _PTR(SObject) SO = aStudy->FindObjectID( entry( ind ).latin1() );
+ if ( SO ){
+ for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
+ _PTR(SObject) refSO;
+ if ( !Iter->Value()->ReferencedObject( refSO ) && ( !named || Iter->Value()->GetName().size() ) )
+ cnt++;
+ }
+ }
+ }
+ return cnt;
+}
+
+QString VisuGUI_Selection::nbChildren( const int ind ) const
+{
+ QString aResStr;
+ aResStr.setNum( nbChild( ind, false ) );
+ return aResStr;
+}
+
+QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
+{
+ QString aResStr;
+ aResStr.setNum( nbChild( ind, true ) );
+ return aResStr;
+}
+
+QString VisuGUI_Selection::isVisible( const int ind ) const
+{
+ QString aResStr;
+
+ if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+ if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
+ aResStr = anVISUActor->GetVisibility() ? "1" : "0";
+
+ return aResStr;
+}
+
+QString VisuGUI_Selection::isShrunk( const int ind ) const
+{
+ QString aResStr;
+
+ if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+ if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
+ if ( anVISUActor->IsShrunkable() )
+ aResStr = anVISUActor->IsShrunk() ? "1" : "0";
+
+ return aResStr;
+}
+
+QString VisuGUI_Selection::hasActor( const int ind ) const
+{
+ return representation( ind ).isEmpty() ? "0" : "1";
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2005 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_PopupTools.h
+// Author : Sergey Anikin
+// Module : VISU
+
+#ifndef VisuGUI_PopupTools_HeaderFile
+#define VisuGUI_PopupTools_HeaderFile
+
+#include <SalomeApp_Selection.h>
+
+//////////////////////////////////////////////////
+// Class: VisuGUI_Selection
+//////////////////////////////////////////////////
+
+class SalomeApp_Module;
+
+class VisuGUI_Selection : public SalomeApp_Selection
+{
+public:
+ VisuGUI_Selection( SalomeApp_Module* theModule ) : myModule( theModule ) {};
+ virtual ~VisuGUI_Selection() {};
+
+ virtual QtxValue param( const int, const QString& ) const;
+
+private:
+ QString type( const int ) const;
+ QString nbComponents( const int ) const;
+ QString nbTimeStamps( const int ) const;
+ QString representation( const int ) const;
+ QString nbChildren( const int ) const;
+ QString nbNamedChildren( const int ) const;
+ QString isVisible( const int ) const;
+ QString isShrunk( const int ) const;
+ QString hasActor( const int ) const;
+
+private:
+ int nbChild( const int, const bool ) const;
+
+private:
+ SalomeApp_Module* myModule;
+};
+
+#endif
// Module : VISU
// $Header$
-#include "VisuGUI_ScalarBarDlg.h"
-#include "VISU_ScalarMap_i.hh"
-#include "VISU_ScalarMapPL.hxx"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
-#include "QAD_MessageBox.h"
-#include "VISU_Convertor.hxx"
-
#include <limits.h>
#include <qlayout.h>
#include <qvalidator.h>
#include <qcolordialog.h>
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SalomeApp_Application.h"
+
+#include "VisuGUI.h"
+#include "VISUConfig.hh"
+#include "VISU_Convertor.hxx"
+
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarMap_i.hh"
+
+#include "VisuGUI_ScalarBarDlg.h"
+
using namespace std;
OriginGroupLayout->setMargin( 11 );
QLabel* XLabel = new QLabel( tr( "X:" ), OriginGroup, "XLabel" );
- XSpin = new QAD_SpinBoxDbl( OriginGroup, 0.0, 1.0, 0.1 );
+ 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( "Y:" ), OriginGroup, "YLabel" );
- YSpin = new QAD_SpinBoxDbl( OriginGroup, 0.0, 1.0, 0.1 );
+ YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
YSpin->setMinimumWidth( 70 );
YSpin->setValue( 0.01 );
DimGroupLayout->setMargin( 11 );
QLabel* WidthLabel = new QLabel( tr( "Width:" ), DimGroup, "WidthLabel" );
- WidthSpin = new QAD_SpinBoxDbl( DimGroup, 0.0, 1.0, 0.1 );
+ 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( "Height:" ), DimGroup, "HeightLabel" );
- HeightSpin = new QAD_SpinBoxDbl( DimGroup, 0.0, 1.0, 0.1 );
+ HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
HeightSpin->setMinimumWidth( 70 );
HeightSpin->setValue( 0.8 );
float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
float sbVmin=0., sbVmax=0.;
bool sbRange=false;
+ QString aString;
- QString Orientation = QAD_CONFIG->getSetting("Visu:SBOrientation");
- if ( !Orientation.isEmpty() ) {
- orient = Orientation.toInt();
- if(orient != 1) {
- orient=0;
- sbX1=0.2;
- sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
- }
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ orient = aResourceMgr->integerValue("Visu:SBOrientation",orient);
+ if(orient != 1){
+ orient=0;
+ sbX1=0.2;
+ sbY1=0.01;
+ sbW=0.6;
+ sbH=0.12;
}
- QString SBXorigin = QAD_CONFIG->getSetting("Visu:SBXorigin");
- if ( !SBXorigin.isEmpty() )
- sbX1 = SBXorigin.toFloat();
-
- QString SBYorigin = QAD_CONFIG->getSetting("Visu:SBYorigin");
- if ( !SBYorigin.isEmpty() )
- sbY1 = SBYorigin.toFloat();
-
- QString SBWidth = QAD_CONFIG->getSetting("Visu:SBWidth");
- if ( !SBWidth.isEmpty() )
- sbW = SBWidth.toFloat();
-
- QString SBHeight = QAD_CONFIG->getSetting("Visu:SBHeight");
- if ( !SBHeight.isEmpty() )
- sbH = SBHeight.toFloat();
-
- QString SBColors = QAD_CONFIG->getSetting("Visu:SBNumberOfColors");
- if ( !SBColors.isEmpty() )
- sbCol = SBColors.toInt();
-
- QString SBLabels = QAD_CONFIG->getSetting("Visu:SBNumberOfLabels");
- if ( !SBLabels.isEmpty() )
- sbLab = SBLabels.toInt();
-
- QString ImpRange = QAD_CONFIG->getSetting("Visu:SBImposeRange");
- if ( ImpRange.compare("true") == 0 )
- sbRange=true;
-
- QString SBVmin = QAD_CONFIG->getSetting("Visu:SBMinimumValue");
- if ( !SBVmin.isEmpty() )
- sbVmin = SBVmin.toFloat();
-
- QString SBVmax = QAD_CONFIG->getSetting("Visu:SBMaximumValue");
- if ( !SBVmax.isEmpty() )
- sbVmax = SBVmax.toFloat();
-
- QString aScaling = QAD_CONFIG->getSetting("Visu:SBScaling");
+ sbX1 = aResourceMgr->doubleValue("Visu:SBXorigin",sbX1);
+ sbY1 = aResourceMgr->doubleValue("Visu:SBYorigin",sbY1);
+
+ sbW = aResourceMgr->doubleValue("Visu:SBWidth",sbW);
+ sbH = aResourceMgr->doubleValue("Visu:SBHeight",sbH);
+
+ sbCol = aResourceMgr->integerValue("Visu:SBNumberOfColors",sbCol);
+ sbLab = aResourceMgr->integerValue("Visu:SBNumberOfLabels",sbLab);
+ sbRange = aResourceMgr->booleanValue("Visu:SBImposeRange",sbRange);
+ sbVmin = aResourceMgr->doubleValue("Visu:SBMinimumValue",sbVmin);
+ sbVmax = aResourceMgr->doubleValue("Visu:SBMaximumValue",sbVmax);
+
+ QString aScaling = aResourceMgr->stringValue("Visu:SBMaximumValue","LINEAR");
if(aScaling.compare("LOGARITHMIC") == 0)
setLogarithmic(true);
else
setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 1);
setScalarBarData( sbCol, sbLab );
- QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
- if (aIsBoldTitle.isEmpty())
- myTextDlg->setBoldTitle(true);
- else
- myTextDlg->setBoldTitle(aIsBoldTitle.compare("true") == 0);
+ aString = aResourceMgr->stringValue("Visu:IsBoldTitle","true");
+ myTextDlg->setBoldTitle(aString.compare("true") == 0);
- QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
- if (aIsItalicTitle.isEmpty())
- myTextDlg->setItalicTitle(true);
- else
- myTextDlg->setItalicTitle(aIsItalicTitle.compare("true") == 0);
+ aString = aResourceMgr->stringValue("Visu:IsItalicTitle","true");
+ myTextDlg->setItalicTitle(aString.compare("true") == 0);
- QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
- if (aIsShadowTitle.isEmpty())
- myTextDlg->setShadowTitle(true);
- else
- myTextDlg->setShadowTitle(aIsShadowTitle.compare("true") == 0);
-
- QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
- if (!aTitFontType.isEmpty()) {
- switch (aTitFontType.toInt()) {
- case 0: myTextDlg->setTitleFont(VTK_ARIAL); break;
- case 1: myTextDlg->setTitleFont(VTK_COURIER); break;
- case 2: myTextDlg->setTitleFont(VTK_TIMES); break;
- }
- } else {
- myTextDlg->setTitleFont(VTK_ARIAL);
+ aString = aResourceMgr->stringValue("Visu:IsShadowTitle","true");
+ myTextDlg->setShadowTitle(aString.compare("true") == 0);
+
+ myTextDlg->setTitleFont(VTK_ARIAL);
+ switch(aResourceMgr->integerValue("Visu:TitFontType",0)){
+ case 0:
+ myTextDlg->setTitleFont(VTK_ARIAL);
+ break;
+ case 1:
+ myTextDlg->setTitleFont(VTK_COURIER);
+ break;
+ case 2:
+ myTextDlg->setTitleFont(VTK_TIMES);
+ break;
}
- float R,G,B;
- QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
- R = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
- if (R > 1) R = 1;
- if (R < 0) R = 0;
-
- QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
- G = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
- if (G > 1) G = 1;
- if (G < 0) G = 0;
-
- QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
- B = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
- if (B > 1) B = 1;
- if (B < 0) B = 0;
- myTextDlg->setTitleColor(QColor((int)(R*255.),
- (int)(G*255.),
- (int)(B*255.)));
- ///
+ {
+ float R = aResourceMgr->doubleValue("Visu:TitleColorR",1.0);
+ if (R > 1) R = 1;
+ if (R < 0) R = 0;
+
+ float G = aResourceMgr->doubleValue("Visu:TitleColorG",1.0);
+ if (G > 1) G = 1;
+ if (G < 0) G = 0;
+
+ float B = aResourceMgr->doubleValue("Visu:TitleColorB",1.0);
+ if (B > 1) B = 1;
+ if (B < 0) B = 0;
+
+ myTextDlg->setTitleColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
+ }
- QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
- if (aIsBoldLabel.isEmpty())
- myTextDlg->setBoldLabel(true);
- else
- myTextDlg->setBoldLabel(aIsBoldLabel.compare("true") == 0);
+ aString = aResourceMgr->stringValue("Visu:IsBoldLabel","true");
+ myTextDlg->setBoldLabel(aString.compare("true") == 0);
- QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
- if (aIsItalicLabel.isEmpty())
- myTextDlg->setItalicLabel(true);
- else
- myTextDlg->setItalicLabel(aIsItalicLabel.compare("true") == 0);
+ aString = aResourceMgr->stringValue("Visu:IsItalicLabel","true");
+ myTextDlg->setItalicLabel(aString.compare("true") == 0);
- QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
- if (aIsShadowLabel.isEmpty())
- myTextDlg->setShadowLabel(true);
- else
- myTextDlg->setShadowLabel(aIsShadowLabel.compare("true") == 0);
-
- QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
- if (!aLblFontType.isEmpty()) {
- switch (aLblFontType.toInt()) {
- case 0: myTextDlg->setLabelFont(VTK_ARIAL); break;
- case 1: myTextDlg->setLabelFont(VTK_COURIER); break;
- case 2: myTextDlg->setLabelFont(VTK_TIMES); break;
- }
- } else {
- myTextDlg->setLabelFont(VTK_ARIAL);
- }
- QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
- R = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
- if (R > 1) R = 1;
- if (R < 0) R = 0;
-
- QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
- G = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
- if (G > 1) G = 1;
- if (G < 0) G = 0;
-
- QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
- B = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
- if (B > 1) B = 1;
- if (B < 0) B = 0;
+ aString = aResourceMgr->stringValue("Visu:IsShadowLabel","true");
+ myTextDlg->setShadowLabel(aString.compare("true") == 0);
+
+ switch(aResourceMgr->integerValue("Visu:LblFontType",0)){
+ case 0:
+ myTextDlg->setLabelFont(VTK_ARIAL);
+ break;
+ case 1:
+ myTextDlg->setLabelFont(VTK_COURIER);
+ break;
+ case 2:
+ myTextDlg->setLabelFont(VTK_TIMES);
+ break;
+ }
+
+ {
+ float R = aResourceMgr->doubleValue("Visu:LabelColorR",1.0);
+ if (R > 1) R = 1;
+ if (R < 0) R = 0;
+
+ float G = aResourceMgr->doubleValue("Visu:LabelColorG",1.0);
+ if (G > 1) G = 1;
+ if (G < 0) G = 0;
+
+ float B = aResourceMgr->doubleValue("Visu:LabelColorB",1.0);
+ if (B > 1) B = 1;
+ if (B < 0) B = 0;
+
+ myTextDlg->setLabelColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
+ }
- myTextDlg->setLabelColor(QColor((int)(R*255.),
- (int)(G*255.),
- (int)(B*255.)));
}
sbVmax=0.;
}
- QAD_CONFIG->addSetting("Visu:SBOrientation",orient);
- QAD_CONFIG->addSetting("Visu:SBXorigin",sbX1);
- QAD_CONFIG->addSetting("Visu:SBYorigin",sbY1);
- QAD_CONFIG->addSetting("Visu:SBWidth",sbW);
- QAD_CONFIG->addSetting("Visu:SBHeight",sbH);
- QAD_CONFIG->addSetting("Visu:SBNumberOfColors",sbCol);
- QAD_CONFIG->addSetting("Visu:SBNumberOfLabels",sbLab);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ aResourceMgr->setValue("Visu:SBOrientation",orient);
+ aResourceMgr->setValue("Visu:SBXorigin",sbX1);
+ aResourceMgr->setValue("Visu:SBYorigin",sbY1);
+ aResourceMgr->setValue("Visu:SBWidth",sbW);
+ aResourceMgr->setValue("Visu:SBHeight",sbH);
+ aResourceMgr->setValue("Visu:SBNumberOfColors",sbCol);
+ aResourceMgr->setValue("Visu:SBNumberOfLabels",sbLab);
if(sbRange)
- QAD_CONFIG->addSetting("Visu:SBImposeRange", "true");
+ aResourceMgr->setValue("Visu:SBImposeRange", "true");
else
- QAD_CONFIG->addSetting("Visu:SBImposeRange", "false");
- QAD_CONFIG->addSetting("Visu:SBMinimumValue",sbVmin);
- QAD_CONFIG->addSetting("Visu:SBMaximumValue",sbVmax);
+ aResourceMgr->setValue("Visu:SBImposeRange", "false");
+ aResourceMgr->setValue("Visu:SBMinimumValue",sbVmin);
+ aResourceMgr->setValue("Visu:SBMaximumValue",sbVmax);
if(isLogarithmic())
- QAD_CONFIG->addSetting("Visu:SBScaling", "LOGARITHMIC");
+ aResourceMgr->setValue("Visu:SBScaling", "LOGARITHMIC");
else
- QAD_CONFIG->addSetting("Visu:SBScaling", "LINEAR");
+ aResourceMgr->setValue("Visu:SBScaling", "LINEAR");
////
if (myIsStoreTextProp) {
if (myTextDlg->isBoldTitle())
- QAD_CONFIG->addSetting("Visu:IsBoldTitle","true");
+ aResourceMgr->setValue("Visu:IsBoldTitle","true");
else
- QAD_CONFIG->addSetting("Visu:IsBoldTitle","false");
+ aResourceMgr->setValue("Visu:IsBoldTitle","false");
if (myTextDlg->isItalicTitle())
- QAD_CONFIG->addSetting("Visu:IsItalicTitle","true");
+ aResourceMgr->setValue("Visu:IsItalicTitle","true");
else
- QAD_CONFIG->addSetting("Visu:IsItalicTitle","false");
+ aResourceMgr->setValue("Visu:IsItalicTitle","false");
if (myTextDlg->isShadowTitle())
- QAD_CONFIG->addSetting("Visu:IsShadowTitle","true");
+ aResourceMgr->setValue("Visu:IsShadowTitle","true");
else
- QAD_CONFIG->addSetting("Visu:IsShadowTitle","false");
+ aResourceMgr->setValue("Visu:IsShadowTitle","false");
switch (myTextDlg->getTitleFont()) {
- case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:TitFontType",0); break;
- case VTK_COURIER: QAD_CONFIG->addSetting("Visu:TitFontType",1); break;
- case VTK_TIMES: QAD_CONFIG->addSetting("Visu:TitFontType",2); break;
+ case VTK_ARIAL:
+ aResourceMgr->setValue("Visu:TitFontType",0);
+ break;
+ case VTK_COURIER:
+ aResourceMgr->setValue("Visu:TitFontType",1);
+ break;
+ case VTK_TIMES:
+ aResourceMgr->setValue("Visu:TitFontType",2);
+ break;
}
QColor aColor = myTextDlg->getTitleColor();
- QAD_CONFIG->addSetting("Visu:TitleColorR", aColor.red()/255.);
- QAD_CONFIG->addSetting("Visu:TitleColorG", aColor.green()/255.);
- QAD_CONFIG->addSetting("Visu:TitleColorB", aColor.blue()/255.);
- ///
+ aResourceMgr->setValue("Visu:TitleColorR", aColor.red()/255.);
+ aResourceMgr->setValue("Visu:TitleColorG", aColor.green()/255.);
+ aResourceMgr->setValue("Visu:TitleColorB", aColor.blue()/255.);
if (myTextDlg->isBoldLabel())
- QAD_CONFIG->addSetting("Visu:IsBoldLabel","true");
+ aResourceMgr->setValue("Visu:IsBoldLabel","true");
else
- QAD_CONFIG->addSetting("Visu:IsBoldLabel","false");
+ aResourceMgr->setValue("Visu:IsBoldLabel","false");
if (myTextDlg->isItalicLabel())
- QAD_CONFIG->addSetting("Visu:IsItalicLabel","true");
+ aResourceMgr->setValue("Visu:IsItalicLabel","true");
else
- QAD_CONFIG->addSetting("Visu:IsItalicLabel","false");
+ aResourceMgr->setValue("Visu:IsItalicLabel","false");
if (myTextDlg->isShadowLabel())
- QAD_CONFIG->addSetting("Visu:IsShadowLabel","true");
+ aResourceMgr->setValue("Visu:IsShadowLabel","true");
else
- QAD_CONFIG->addSetting("Visu:IsShadowLabel","false");
+ aResourceMgr->setValue("Visu:IsShadowLabel","false");
switch (myTextDlg->getLabelFont()) {
- case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:LblFontType",0); break;
- case VTK_COURIER: QAD_CONFIG->addSetting("Visu:LblFontType",1); break;
- case VTK_TIMES: QAD_CONFIG->addSetting("Visu:LblFontType",2); break;
+ case VTK_ARIAL:
+ aResourceMgr->setValue("Visu:LblFontType",0);
+ break;
+ case VTK_COURIER:
+ aResourceMgr->setValue("Visu:LblFontType",1);
+ break;
+ case VTK_TIMES:
+ aResourceMgr->setValue("Visu:LblFontType",2);
+ break;
}
aColor = myTextDlg->getLabelColor();
- QAD_CONFIG->addSetting("Visu:LabelColorR", aColor.red()/255.);
- QAD_CONFIG->addSetting("Visu:LabelColorG", aColor.green()/255.);
- QAD_CONFIG->addSetting("Visu:LabelColorB", aColor.blue()/255.);
+ aResourceMgr->setValue("Visu:LabelColorR", aColor.red()/255.);
+ aResourceMgr->setValue("Visu:LabelColorG", aColor.green()/255.);
+ aResourceMgr->setValue("Visu:LabelColorB", aColor.blue()/255.);
}
}
*/
void VisuGUI_ScalarBarPane::XYChanged( double )
{
- QAD_SpinBoxDbl* snd = (QAD_SpinBoxDbl*)sender();
+ QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
if ( snd == XSpin ) {
WidthSpin->setMaxValue( 1.0 - XSpin->value() );
}
double maxVal = MaxEdit->text().toDouble();
if ( RBIrange->isChecked() ) {
if (minVal >= maxVal) {
- QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
+ SUIT_MessageBox::warn1( this,tr("VISU_WARNING"),
tr("MSG_MINMAX_VALUES"),
tr("VISU_BUT_OK"));
return false;
// nothing to do
}
else {
- QAD_MessageBox::warn1( this,
+ SUIT_MessageBox::warn1( this,
tr("VISU_WARNING"),
tr("WRN_LOGARITHMIC_RANGE"),
tr("VISU_BUT_OK"));
// nothing to do
}
else {
- QAD_MessageBox::warn1( this,
+ SUIT_MessageBox::warn1( this,
tr("VISU_WARNING"),
tr("WRN_LOGARITHMIC_FIELD_RANGE"),
tr("VISU_BUT_OK"));
/*!
Constructor
*/
-VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
- : QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(QWidget* parent, bool SetPref)
+ : QDialog( parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
setName( "VisuGUI_ScalarBarDlg" );
setCaption( SetPref ? tr( "Scalar Bar Preferences" ) : tr( "Scalar Bar Properties" ) );
#ifndef VISUGUI_SCALARBARDLG_H
#define VISUGUI_SCALARBARDLG_H
-#include "QAD_SpinBoxDbl.h"
-
-#include <qdialog.h>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qtoolbutton.h>
-#include "VISU_ScalarMap_i.hh"
+#include "QtxDblSpinBox.h"
+
+class QButtonGroup;
+class QGroupBox;
+class QLabel;
+class QRadioButton;
+class QCheckBox;
+class QPushButton;
+class QSpinBox;
+class QLineEdit;
+class QComboBox;
+class QVBox;
+class QToolButton;
+class QtxDblSpinBox;
+
+#include <qdialog.h>
+
+#include "VISU_ScalarMap_i.hh"
class VisuGUI_TextPrefDlg: public QDialog
{
- Q_OBJECT
+ Q_OBJECT;
public:
VisuGUI_TextPrefDlg(QWidget* parent);
class VisuGUI_ScalarBarPane : public QVBox
{
- Q_OBJECT
+ Q_OBJECT;
public:
VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
QRadioButton* RBhori;
QRadioButton* RBvert;
- QAD_SpinBoxDbl* XSpin;
- QAD_SpinBoxDbl* YSpin;
+ QtxDblSpinBox* XSpin;
+ QtxDblSpinBox* YSpin;
- QAD_SpinBoxDbl* WidthSpin;
- QAD_SpinBoxDbl* HeightSpin;
+ QtxDblSpinBox* WidthSpin;
+ QtxDblSpinBox* HeightSpin;
QSpinBox* ColorSpin;
QSpinBox* LabelSpin;
class VisuGUI_ScalarBarDlg : public QDialog
{
- Q_OBJECT
+ Q_OBJECT;
public:
- VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
+ VisuGUI_ScalarBarDlg( QWidget* parent = 0, bool SetPref = FALSE );
~VisuGUI_ScalarBarDlg() {};
bool isToSave() {return myScalarPane->isToSave();}
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI_Selection.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_Selection.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_Selection.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
#include "VISU_Actor.h"
#include "VISU_PrsObject_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_PipeLine.hxx"
-#include "VisuGUI.h"
-#include "QAD_MessageBox.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include <TColStd_IndexedMapOfInteger.hxx>
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_VTKSelector.h"
-#include <map>
+#include "SUIT_MessageBox.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_Session.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_Selector.h"
+
+#include "utilities.h"
+
+// OCCT Includes
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+// QT Includes
#include <qstring.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qvalidator.h>
#include <qpushbutton.h>
+#include <qwidgetstack.h>
+#include <qvbox.h>
+#include <qgroupbox.h>
+#include <qlineedit.h>
+#include <qvalidator.h>
+#include <qtable.h>
+#include <qlistview.h>
+// VTK Includes
#include <vtkDataSetMapper.h>
#include <vtkDataSet.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkCell.h>
-#include "utilities.h"
+// STL Includes
+#include <map>
using namespace std;
-extern VisuGUI *visuGUI;
-static QAD_Study* myStudy = NULL;
+//extern VisuGUI *visuGUI;
static VisuGUI_SelectionDlg* mySelectionDlg = NULL;
-VisuGUI_SelectionDlg::VisuGUI_SelectionDlg()
- : QDialog( QAD_Application::getDesktop(), 0, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent)
+ : QDialog(parent, 0, false, WStyle_Customize | WStyle_NormalBorder |
+ WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ mySelectionMgr(NULL)
{
- if(mySelectionDlg)
+ //MESSAGE("VisuGUI_SelectionDlg::VisuGUI_SelectionDlg()");
+ if (mySelectionDlg)
mySelectionDlg->close(true);
setCaption( "Data on elements" );
setSizeGripEnabled( TRUE );
-
+
QGridLayout* TopLayout = new QGridLayout(this);
TopLayout->setSpacing(6);
TopLayout->setMargin(11);
TopLayout->setRowStretch(2, 1);
TopLayout->setRowStretch(3, 0);
- QHButtonGroup* aTypeBox = new QHButtonGroup("Selection", this);
-
+ QHButtonGroup* aTypeBox = new QHButtonGroup("Selection", this);
+
QRadioButton* aPointBtn = new QRadioButton("Point", aTypeBox);
QRadioButton* aCellBtn = new QRadioButton("Cell", aTypeBox);
QRadioButton* aActorBtn = new QRadioButton("Actor", aTypeBox);
aPointBtn->setChecked(true);
connect(aTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int)));
-
+
TopLayout->addWidget(aTypeBox, 0, 0);
QWidget* aNamePane = new QWidget(this);
TopLayout->addWidget(aNamePane, 1, 0);
myWidgetStack = new QWidgetStack(this);
-
+
// Create Points pane
myPointsPane = new QVBox(myWidgetStack);
myPointsPane->layout()->setSpacing(6);
-
+
QGroupBox* aDataGrp = new QGroupBox(2, Qt::Horizontal, "Data of Point", myPointsPane);
aDataGrp->layout()->setSpacing(6);
QLabel* aValueLbl = new QLabel("Scalar Value:", aDataGrp);
myScalarValLbl = new QLabel("", aDataGrp);
- QLabel* aVectorLbl = new QLabel("Vector Value:", aDataGrp);
+ QLabel* aVectorLbl = new QLabel("Vector Value:", aDataGrp);
myVectorValLbl = new QLabel("", aDataGrp);
myVectorValLbl->setMinimumWidth(150);
myXValLbl = new QLabel("", aCoordGrp);
QLabel* aYLbl = new QLabel("Y:", aCoordGrp);
myYValLbl = new QLabel("", aCoordGrp);
- QLabel* aZLbl = new QLabel("Z:",aCoordGrp );
+ QLabel* aZLbl = new QLabel("Z:",aCoordGrp );
myZValLbl = new QLabel("", aCoordGrp);
myWidgetStack->addWidget(myPointsPane, 0);
-
+
// Create Cells pane
myCellsPane = new QWidget(myWidgetStack);
QGridLayout* aCellLayout = new QGridLayout(myCellsPane);
aCellLayout->setRowStretch(1, 1);
QGroupBox* aCellGrp = new QGroupBox(2, Qt::Horizontal, "Data of Cell", myCellsPane);
-
+
QLabel* aCellIDLbl = new QLabel("ID:", aCellGrp);
myCellIDValLbl = new QLineEdit("", aCellGrp);
myCellIDValLbl->setValidator(aIntValidator);
QLabel* aCellValueLbl = new QLabel("Scalar Value:", aCellGrp);
myCellScalarValLbl = new QLabel("", aCellGrp);
- QLabel* aCellVectorLbl = new QLabel("Vector Value:", aCellGrp);
+ QLabel* aCellVectorLbl = new QLabel("Vector Value:", aCellGrp);
myCellVectorValLbl = new QLabel("", aCellGrp);
aCellLayout->addWidget(aCellGrp, 0, 0);
aCellLayout->addWidget(myListPoints, 1, 0);
myWidgetStack->addWidget(myCellsPane, 1);
-
+
// Actor Pane
myActorsPane = new QVBox(myWidgetStack);
myActorsPane->layout()->setSpacing(6);
myXPosLbl = new QLabel("0", aPosGrp);
QLabel* aYPosLbl = new QLabel("Y:", aPosGrp);
myYPosLbl = new QLabel("0", aPosGrp);
- QLabel* aZPosLbl = new QLabel("Z:", aPosGrp);
+ QLabel* aZPosLbl = new QLabel("Z:", aPosGrp);
myZPosLbl = new QLabel("0", aPosGrp);
QGroupBox* aSizeGrp = new QGroupBox(2, Qt::Horizontal, "Size", myActorsPane);
myDXLbl = new QLabel("0", aSizeGrp);
QLabel* aYSizeLbl = new QLabel("dY:", aSizeGrp);
myDYLbl = new QLabel("0", aSizeGrp);
- QLabel* aZSizeLbl = new QLabel("dZ:",aSizeGrp );
+ QLabel* aZSizeLbl = new QLabel("dZ:",aSizeGrp );
myDZLbl = new QLabel("0", aSizeGrp);
myWidgetStack->addWidget(myActorsPane, 2);
// Create buttons group
QHBox* aBtnBox = new QHBox(this);
- QHBoxLayout* aBtnLayout = (QHBoxLayout*)aBtnBox->layout();
+ QHBoxLayout* aBtnLayout = (QHBoxLayout*)aBtnBox->layout();
aBtnLayout->addStretch();
QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
-
+
TopLayout->addWidget(aBtnBox, 3, 0);
- myStudy = visuGUI->GetActiveStudy();
- mySelection = SALOME_Selection::Selection(myStudy->getSelection());
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ mySelectionMgr = anApp->selectionMgr();
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
- connect(visuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
+ //connect(visuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
myFl = false;
- onSelectionChange(0);
+
+ //onSelectionChange(0);
+ SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
+ // Activate Points pane
+ myWidgetStack->raiseWidget(myPointsPane);
+ aSVTKVW->SetSelectionMode(NodeSelection);
+ //onPointIdEdit(myIDValLbl->text());
+ onSelectionEvent();
mySelectionDlg = this;
}
+VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()
+{
+ //MESSAGE("VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()");
+}
+
+void VisuGUI_SelectionDlg::onSelectionChange (int theId)
+{
+ //MESSAGE("VisuGUI_SelectionDlg::onSelectionChange()");
+ SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-void VisuGUI_SelectionDlg::onSelectionChange(int theId) {
- // clearFields();
switch (theId) {
case 0: // Points
- myWidgetStack->raiseWidget(myPointsPane);
- QAD_Application::getDesktop()->SetSelectionMode(NodeSelection, true);
+ myWidgetStack->raiseWidget(myPointsPane);
+ //mySelectionMgr->setSelectionModes(NodeSelection);
+ aSVTKVW->SetSelectionMode(NodeSelection);
onPointIdEdit(myIDValLbl->text());
break;
case 1: // Cells
myWidgetStack->raiseWidget(myCellsPane);
- QAD_Application::getDesktop()->SetSelectionMode(CellSelection, true);
+ //mySelectionMgr->setSelectionModes(CellSelection);
+ aSVTKVW->SetSelectionMode(CellSelection);
onCellIdEdit(myCellIDValLbl->text());
break;
case 2: // Actor
myWidgetStack->raiseWidget(myActorsPane);
- QAD_Application::getDesktop()->SetSelectionMode(ActorSelection, true);
+ //mySelectionMgr->setSelectionModes(ActorSelection);
+ aSVTKVW->SetSelectionMode(ActorSelection);
+ onSelectionEvent();
}
- onSelectionEvent();
-// if (VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame())
-// vf->Repaint();
}
-void VisuGUI_SelectionDlg::closeEvent(QCloseEvent* theEvent) {
+void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
+{
+ //MESSAGE("VisuGUI_SelectionDlg::closeEvent()");
+ SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
+
mySelectionDlg = NULL;
- myStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->SetSelectionMode( ActorSelection );
- QAD_Application::getDesktop()->SetSelectionMode(ActorSelection, true);
- disconnect(mySelection,0,0,0);
+ //mySelectionMgr->setSelectionModes(ActorSelection);
+ aSVTKVW->SetSelectionMode(ActorSelection);
+ disconnect(mySelectionMgr,0,0,0);
QDialog::closeEvent(theEvent);
}
float aVal = aScalar->GetTuple1(theId);
return QString::number(aVal);
} else {
- return QString("No data");
+ return QString("No data");
}
}
template<class TData> QString getVector(TData* theData, int theId){
if (vtkDataArray *aVector = theData->GetVectors()) {
float *aVal = aVector->GetTuple3(theId);
- return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]);
+ return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]);
} else {
return QString("No data");
}
}
-
#define ABS(a) (a>=0)?a:-a
void VisuGUI_SelectionDlg::onSelectionEvent() {
+ //MESSAGE("VisuGUI_SelectionDlg::onSelectionEvent()");
if (myFl) return;
- myFl = true;
- Handle(SALOME_InteractiveObject) anIO;
+ myFl = true;
int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
- if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){
- SALOMEDS::SObject_var aSObject = visuGUI->GetStudyDocument()->FindObjectID(anIO->getEntry());
- QString aMeshName = VisuGUI::getValue(aSObject, "myMeshName");
- QString aFieldName = VisuGUI::getValue(aSObject, "myFieldName");
- myMeshName->setText((aMeshName == "NULL")? QString("No name") : aMeshName);
- myFieldName->setText((aFieldName == "NULL")? QString("No name") : aFieldName);
-
- VISU_Actor* anVISUActor = visuGUI->GetActor(aPrs3d);
+
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+
+ SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
+ SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+
+ VISU::Prs3d_i* aPrs3d = NULL;
+ _PTR(SObject) aSObject;
+ Handle(SALOME_InteractiveObject) anIO;
+
+ //SALOME_ListIO aListIO;
+ //mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
+
+ const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+
+ //MESSAGE("aListIO.Extent() = " << aListIO.Extent());
+ if (aListIO.Extent() == 1) {
+ anIO = aListIO.First();
+
+ if (anIO->hasEntry()) {
+ SalomeApp_Study* theStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
+ _PTR(Study) aStudy = theStudy->studyDS();
+ aSObject = aStudy->FindObjectID(anIO->getEntry());
+ //MESSAGE("anIO->hasEntry(): " << anIO->getEntry());
+
+ if (aSObject) {
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+
+ if (!CORBA::is_nil(anObject)) {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+
+ if (aServant.in()) {
+ aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ }
+ }
+ }
+ }
+ }
+
+ if (aPrs3d) {
+ VISU::Storable::TRestoringMap aMap;
+ if (aSObject) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ std::string aString = aComment->Value();
+ QString strIn (aString);
+ VISU::Storable::StrToMap(strIn, aMap);
+ }
+ }
+
+ QString aMeshName("NULL"), aFieldName("NULL");
+ if (!aMap.empty()) {
+ aMeshName = VISU::Storable::FindValue(aMap, "myMeshName");
+ aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
+ }
+
+ myMeshName ->setText((aMeshName == "NULL") ? QString("No name") : aMeshName);
+ myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
+
+ VISU_Actor* anVISUActor =
+ VISU::FindActor(aSVTKVW, aSObject->GetID().c_str());
if (anVISUActor) {
float aCoord[6];
anVISUActor->GetBounds(aCoord);
myXPosLbl->setText(QString::number( aCoord[0] ));
myYPosLbl->setText(QString::number( aCoord[2] ));
myZPosLbl->setText(QString::number( aCoord[4] ));
-
+
myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) ));
myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) ));
myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) ));
- }
- TColStd_IndexedMapOfInteger aMapIndex;
- typedef map<int,float*> PointsMap;
- PointsMap aPointsMap;
- mySelection->GetIndex(anIO, aMapIndex);
-
- VISU_Actor* anActor = visuGUI->GetActor(aPrs3d);
- if(!anActor)
- return;
- vtkDataSet* aDataSet = anActor->GetInput();
- vtkPointData* aPntData = aDataSet->GetPointData();
-
- for ( int ind = 1; ind <= aMapIndex.Extent(); ind++){
- int aID = aMapIndex( ind );
-
- switch (aType) {
- case 0:
- {
- float aCoord[3];
- aDataSet->GetPoint(aID, aCoord);
- myXValLbl->setText( QString::number( aCoord[0] ) );
- myYValLbl->setText( QString::number( aCoord[1] ) );
- myZValLbl->setText( QString::number( aCoord[2] ) );
- myIDValLbl->setText( QString::number(aID) );
- myScalarValLbl->setText(getValue(aPntData, aID));
- myVectorValLbl->setText(getVector(aPntData, aID));
- // adjustSize();
- //qApp->processEvents();
- }
- break;
- case 1:
- {
- //int aMaxId = aDataSet->GetNumberOfCells();
- //cout<<"### MaxId="<<aMaxId<<endl;
- //cout<<"### SelectedId="<<aID<<endl;
- vtkCellData* aData = aDataSet->GetCellData();
- vtkCell* aCell = aDataSet->GetCell(aID);
- if (aCell != NULL) {
- int aNbOfPoints = aCell->GetNumberOfPoints();
- if (aNbOfPoints <=1 ) { // Cell is point
- clearFields();
- }
- else {
- myCellIDValLbl->setText( QString::number(aID) );
- myCellScalarValLbl->setText(getValue(aData, aID));
- myCellVectorValLbl->setText(getVector(aData, aID));
-
- float* aCoord;
- vtkIdList *aPointList = aCell->GetPointIds();
- QListViewItem* anItem = NULL;
-
- for(int i = 0; i < aNbOfPoints; i++){
- int idCurrent = aPointList->GetId(i);
- aCoord = aDataSet->GetPoint(idCurrent);
- aPointsMap.insert(PointsMap::value_type(idCurrent,aCoord));
- }
- }
- }
- }
- break;
+ TColStd_IndexedMapOfInteger aMapIndex;
+ typedef map<int,float*> PointsMap;
+ PointsMap aPointsMap;
+
+ aSelector->GetIndex(anIO, aMapIndex);
+
+ vtkDataSet* aDataSet = anVISUActor->GetInput();
+ vtkPointData* aPntData = aDataSet->GetPointData();
+
+ for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
+ int aID = aMapIndex(ind);
+
+ switch (aType) {
+ case 0:
+ {
+ float aCoord[3];
+ aDataSet->GetPoint(aID, aCoord);
+ myXValLbl->setText( QString::number( aCoord[0] ) );
+ myYValLbl->setText( QString::number( aCoord[1] ) );
+ myZValLbl->setText( QString::number( aCoord[2] ) );
+ myIDValLbl->setText( QString::number(aID) );
+ myScalarValLbl->setText(getValue(aPntData, aID));
+ myVectorValLbl->setText(getVector(aPntData, aID));
+ }
+ break;
+ case 1:
+ {
+ vtkCellData* aData = aDataSet->GetCellData();
+ vtkCell* aCell = aDataSet->GetCell(aID);
+ if (aCell != NULL) {
+ int aNbOfPoints = aCell->GetNumberOfPoints();
+ if (aNbOfPoints <=1 ) { // Cell is point
+ clearFields();
+ } else {
+ myCellIDValLbl->setText( QString::number(aID) );
+ myCellScalarValLbl->setText(getValue(aData, aID));
+ myCellVectorValLbl->setText(getVector(aData, aID));
+
+ float* aCoord;
+ vtkIdList *aPointList = aCell->GetPointIds();
+ QListViewItem* anItem = NULL;
+
+ for (int i = 0; i < aNbOfPoints; i++) {
+ int idCurrent = aPointList->GetId(i);
+ aCoord = aDataSet->GetPoint(idCurrent);
+ aPointsMap.insert(PointsMap::value_type(idCurrent,aCoord));
+ }
+ }
+ }
+ }
+ break;
+ }
}
- }
- myListPoints->setNumRows(aPointsMap.size());
- PointsMap::const_iterator It = aPointsMap.begin();
- for(int i=0; It!=aPointsMap.end()&&i<myListPoints->numRows() ; It++,i++){
- myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
- int id = It->first;
- myListPoints->setText(i, 0, QString::number( id ));
- float* aCoord = It->second;
- myListPoints->setText(i, 1, QString::number( aCoord[0] ));
- myListPoints->setText(i, 2, QString::number( aCoord[1] ));
- myListPoints->setText(i, 3, QString::number( aCoord[2] ));
- myListPoints->setText(i, 4, getValue(aPntData, id));
- myListPoints->setText(i, 5, getVector(aPntData, id));
+ myListPoints->setNumRows(aPointsMap.size());
+ PointsMap::const_iterator It = aPointsMap.begin();
+ for (int i = 0; It != aPointsMap.end() && i < myListPoints->numRows(); It++, i++) {
+ myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
+ int id = It->first;
+ myListPoints->setText(i, 0, QString::number( id ));
+ float* aCoord = It->second;
+ myListPoints->setText(i, 1, QString::number( aCoord[0] ));
+ myListPoints->setText(i, 2, QString::number( aCoord[1] ));
+ myListPoints->setText(i, 3, QString::number( aCoord[2] ));
+ myListPoints->setText(i, 4, getValue(aPntData, id));
+ myListPoints->setText(i, 5, getVector(aPntData, id));
+ }
}
-
} else {
clearFields();
}
void VisuGUI_SelectionDlg::clearFields() {
+ //MESSAGE("VisuGUI_SelectionDlg::clearFields()");
int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
switch (aType) {
case 0:
case 2:
myXPosLbl->setText("");
myYPosLbl->setText("");
- myZPosLbl->setText("");
+ myZPosLbl->setText("");
myDXLbl->setText("");
myDYLbl->setText("");
myDZLbl->setText("");
typedef vtkIdType (vtkDataSet::* TDataSetMethod)();
-bool onIdEdit(const QString& theText,
- TDataSetMethod theMethod,
- bool theIsCell,
- SALOME_Selection* theSelection,
- QLabel* theMeshName,
- QString theValue,
- QLabel* theFieldName)
+bool onIdEdit (const QString& theText,
+ TDataSetMethod theMethod,
+ bool theIsCell,
+ SalomeApp_SelectionMgr* theSelectionMgr,
+ QLabel* theMeshName,
+ QString theValue,
+ QLabel* theFieldName)
{
+ //MESSAGE("onIdEdit()");
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
+ SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+
+ VISU::Prs3d_i* aPrs3d = NULL;
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){
+
+ //SALOME_ListIO aListIO;
+ //theSelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
+
+ const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+
+ if (aListIO.Extent() == 1) {
+ anIO = aListIO.First();
+
+ if (anIO->hasEntry()) {
+ SalomeApp_Study* theStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
+ _PTR(Study) aStudy = theStudy->studyDS();
+ _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
+
+ if (aSObject) {
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+
+ if (!CORBA::is_nil(anObject)) {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+
+ if (aServant.in()) {
+ aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ }
+ }
+ }
+ }
+ }
+
+ if (aPrs3d) {
int anId = theText.toInt();
vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput();
int aMaxId = (aDataSet->*theMethod)();
- if(anId < 0) anId = 0;
- if(anId >= aMaxId) anId = aMaxId-1;
- theSelection->ClearIObjects();
- theSelection->AddIObject(anIO);
- theSelection->AddOrRemoveIndex( anIO, anId, false );
+ if (anId < 0) anId = 0;
+ if (anId >= aMaxId) anId = aMaxId - 1;
+
+ //SALOME_ListIO sel;
+ //sel.Append(anIO);
+ //theSelectionMgr->setSelectedObjects(sel);
+
+ TColStd_MapOfInteger newIndices;
+ newIndices.Add(anId);
+ aSelector->AddOrRemoveIndex(anIO, newIndices, false);
+ aSVTKVW->highlight(anIO, true, true);
+
return true;
- }else{
+
+ } else {
theMeshName->setText(theValue);
theFieldName->setText("");
}
return false;
}
-void VisuGUI_SelectionDlg::onPointIdEdit(const QString& theText){
+void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
+{
+ //MESSAGE("onPointIdEdit()");
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints;
- bool anIsSelected = onIdEdit(theText,aMethod,false,mySelection,
+ bool anIsSelected = onIdEdit(theText,aMethod,false,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
- if(!anIsSelected)
+ if (!anIsSelected)
clearFields();
}
-void VisuGUI_SelectionDlg::onCellIdEdit(const QString& theText){
+void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText)
+{
+ //MESSAGE("onCellIdEdit()");
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells;
- bool anIsSelected = onIdEdit(theText,aMethod,true,mySelection,
+ bool anIsSelected = onIdEdit(theText,aMethod,true,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
- if(!anIsSelected)
+ if (!anIsSelected)
clearFields();
}
#define VisuGUI_Selection_HeaderFile
#include "SALOMEconfig.h"
-#include "QAD_Desktop.h"
#include "VISU_Actor.h"
-#include "SALOME_Selection.h"
-
+#include "SVTK_Selection.h"
+
#include <vtkDataSet.h>
#include <qdialog.h>
-#include <qwidgetstack.h>
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qtable.h>
-#include <qlineedit.h>
+class QLabel;
+class QWidgetStack;
+class QVBox;
+class QLineEdit;
+class QTable;
+class SalomeApp_SelectionMgr;
+class SalomeApp_Application;
class VisuGUI_SelectionDlg: public QDialog {
Q_OBJECT
-
+
public:
- VisuGUI_SelectionDlg();
- ~VisuGUI_SelectionDlg(){};
+ VisuGUI_SelectionDlg (QWidget*);
+ virtual ~VisuGUI_SelectionDlg ();
protected:
- void closeEvent(QCloseEvent* theEvent);
+ void closeEvent (QCloseEvent* theEvent);
private slots:
- void onSelectionChange(int theId);
- void onSelectionEvent();
- void onPointIdEdit(const QString& theText);
- void onCellIdEdit(const QString& theText);
+ void onSelectionChange (int theId);
+ void onSelectionEvent ();
+ void onPointIdEdit (const QString& theText);
+ void onCellIdEdit (const QString& theText);
private:
- void clearFields();
+ void clearFields ();
QLabel* myMeshName;
QLabel* myFieldName;
QLabel* myXValLbl;
QLabel* myYValLbl;
QLabel* myZValLbl;
-
+
QLineEdit* myIDValLbl;
QLabel* myScalarValLbl;
QLabel* myVectorValLbl;
QLabel* myDYLbl;
QLabel* myDZLbl;
- SALOME_Selection* mySelection;
+ SalomeApp_SelectionMgr* mySelectionMgr;
bool myFl;
};
-
#endif
// Module : VISU
#include "VisuGUI_StreamLinesDlg.h"
-#include "VISU_StreamLines_i.hh"
+
+#include "VisuGUI.h"
+//#include "VisuGUI_Selection.h"
+
#include "VISU_Mesh_i.hh"
#include "VISU_Gen_i.hh"
+#include "VISU_StreamLines_i.hh"
#include "VISU_StreamLinesPL.hxx"
#include "VISU_Actor.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
-#include "QAD_MessageBox.h"
-#include "VisuGUI.h"
-#include "SALOME_Selection.h"
-#include "VTKViewer_ViewFrame.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
+
+#include "SALOME_ListIO.hxx"
+
+#include "SVTK_ViewWindow.h"
#include <limits.h>
#include <qlayout.h>
#include <qcolordialog.h>
#include <qtabwidget.h>
+#include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDS_SObject.hxx>
using namespace std;
-VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_StreamLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (QWidget* parent)
+ : QDialog(parent, "VisuGUI_StreamLinesDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
myPrs = NULL;
setCaption("Stream lines Preferences");
QFrame* aTopBox = new QFrame(this);
aTopBox->setMargin( 11 );
- QGridLayout* TopLayout = new QGridLayout( aTopBox );
+ QGridLayout* TopLayout = new QGridLayout( aTopBox );
TopLayout->setAlignment( Qt::AlignTop );
TopLayout->setSpacing( 8 );
TopLayout->setMargin( 11 );
// Source box
QGroupBox* aSourceBox = new QGroupBox(tr("Source"), aTopBox);
aSourceBox->setColumnLayout(0, Qt::Vertical);
- QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() );
+ QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() );
aSrcLayout->setSpacing( 6 );
aSrcLayout->setMargin( 0 );
-
+
QLabel* aTypeLbl = new QLabel( tr( "LBL_SOURCE_TYPE" ), aSourceBox);
aSrcLayout->addWidget(aTypeLbl, 0, 0);
mySrcCombo = new QComboBox(aSourceBox);
mySrcCombo->setEnabled((myUseSrcCombo->currentItem() == 0));
-
+
connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
// Find All prs obj
- QAD_Study* aActiveStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() );
- if( aSel->IObjectCount() > 0 ) {
- Handle(SALOME_InteractiveObject) aIO = aSel->firstIObject();
+/*
+ SUIT_Study* aActiveStudy = VisuGUI::GetActiveStudy();
+ SalomeApp_SelectionMgr* aSel = VisuGUI::application()->selectionMgr();
+ SALOME_ListIO selected; aSel->selectedObjects( selected );
+ if( selected.Extent() > 0 ) {
+ Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()){
- SALOMEDS::SObject_var aSObject = VisuGUI::GetStudyDocument()->FindObjectID(aIO->getEntry());
+ SALOMEDSClient_SObject* aSObject = VisuGUI::GetStudyDocument()->FindObjectID(aIO->getEntry());
aSObject = aSObject->GetFather();
aSObject = aSObject->GetFather();
aSObject = aSObject->GetFather();
aSObject = aSObject->GetFather();
mySelectionObj = aSObject;
- CORBA::Object_var anObject = VISU::SObjectToObject(mySelectionObj);
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject( mySelectionObj );
VISU::Result_var aResult;
if (CORBA::is_nil(anObject)) {
mySelectionObj = mySelectionObj->GetFather();
}
- SALOMEDS::ChildIterator_var aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
+ SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
- SALOMEDS::SObject_var aChildSObj = aIter->Value();
- CORBA::Object_var aChildObject = VISU::SObjectToObject( aChildSObj );
+ SALOMEDSClient_SObject* aChildSObj = aIter->Value();
+ CORBA::Object_var aChildObject = VISU::ClientSObjectToObject( aChildSObj );
if(!CORBA::is_nil( aChildObject ) ) {
VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow( aChildObject );
if( !CORBA::is_nil( aPrsObj ) ) { // if this is a Prs object
- if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
+ if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
(aPrsObj->GetType() != VISU::TMESH)) {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aChildSObj->FindAttribute(anAttr, "AttributeName") ) {
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ SALOMEDSClient_GenericAttribute* anAttr;
+ if ( aChildSObj->FindAttribute(anAttr, "AttributeName") ) {
+ SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>( anAttr );
myPrsLst += QString(aName->Value());
myPrsList.append(aPrsObj);
continue;
}
}
// else { // This is not a Prs object
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDSClient_GenericAttribute* anAttr;
if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ SALOMEDSClient_AttributeComment* aComment = dynamic_cast<SALOMEDSClient_AttributeComment*>( anAttr );
string aComm = aComment->Value();
QString strIn(aComm.c_str());
VISU::Storable::TRestoringMap aMap;
bool isExist;
VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
if (isExist) {
- if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
- SALOMEDS::GenericAttribute_var aNameAttr;
- if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(aNameAttr);
+ if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
+ SALOMEDSClient_GenericAttribute* aNameAttr;
+ if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
+ SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>( aNameAttr );
VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow( aChildObject );
switch(aType) {
case VISU::TFAMILY:
}
}
}
- }
+ }
+*/
// connect(myUseSrcChk, SIGNAL(toggled(bool)), mySrcCombo, SLOT(setEnabled(bool)));
aSrcLayout->addMultiCellWidget(mySrcCombo, 1, 1, 0, 1);
QLabel* aPercentLbl = new QLabel( tr( "Used points (0..1)" ), aSourceBox);
aSrcLayout->addWidget(aPercentLbl, 2, 0);
- myPntPercent = new QAD_SpinBoxDbl( aSourceBox, 0, 1, 0.1);
+ myPntPercent = new QtxDblSpinBox( 0, 1, 0.1, aSourceBox );
aSrcLayout->addWidget(myPntPercent, 2, 1);
TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), aTopBox);
TopLayout->addWidget(aStepLenLbl, 1, 0);
- myStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
+ myStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myStepLen, 1, 1);
connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), aTopBox);
TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
- myIntegStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
+ myIntegStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myIntegStepLen, 2, 1);
connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
-
+
QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), aTopBox);
TopLayout->addWidget(aPropagationLbl, 3, 0);
- myPropTime = new QAD_SpinBoxDbl(aTopBox, DBL_MIN, DBL_MAX, 1);
+ myPropTime = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 1, aTopBox );
myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myPropTime, 3, 1);
connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
-
+
QLabel* aDirLbl = new QLabel( tr( "Direction" ),aTopBox);
TopLayout->addWidget(aDirLbl, 4, 0);
myDirCombo = new QComboBox(aTopBox);
aTabBox->addTab(aTopBox, "Stream Lines");
myScalarPane = new VisuGUI_ScalarBarPane(this, false);
myScalarPane->setMargin( 5 );
- aTabBox->addTab(myScalarPane, "Scalar Bar");
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
aBoxLayout->addWidget(aTabBox);
-
+
QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
aGroupButtons->setColumnLayout(0, Qt::Vertical );
aGroupButtons->layout()->setSpacing( 0 );
aGroupButtons->layout()->setMargin( 0 );
-
+
QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons->layout() );
aGroupButtonsLayout->setAlignment( Qt::AlignTop );
aGroupButtonsLayout->setSpacing( 6 );
-void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
+void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
+{
myScalarPane->initFromPrsObject(thePrs);
myPrs = thePrs;
myStepLen->setRange(aMin,aMax);
myStepLen->setValue(aStreamLinesPL->GetStepLength());
myStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
-
+
aMin = aStreamLinesPL->GetMinIntegrationStep();
aMax = aStreamLinesPL->GetMaxIntegrationStep();
myIntegStepLen->setRange(aMin,aMax);
myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
-
+
switch (thePrs->GetDirection()) {
case VISU::StreamLines::FORWARD:
myDirCombo->setCurrentItem(0);
}
myUseScalar->setChecked(thePrs->IsColored());
myPntPercent->setValue(thePrs->GetUsedPoints());
-
+
mySrcCombo->setEnabled(false);
QString aSrcEntry = thePrs->GetSourceEntry();
-
+
SALOMEDS::Color anOldColor = thePrs->GetColor();
QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
setColor(aColor);
enableSetColor();
-
+
#define INITPRS(PRSLIST, PRSNUM) \
for (int i = 0; i < PRSLIST.count(); i++) { \
VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
return; \
} \
}
-
+
if (!aSrcEntry.isEmpty()) {
INITPRS(myEntityList, 1);
INITPRS(myFamilyList, 2);
- INITPRS(myGroupList, 3);
+ INITPRS(myGroupList, 3);
INITPRS(myPrsList, 4);
}
-
#undef INITPRS
-
}
-
-int VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
+int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
+{
bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
- if(isAccepted){
+ if (isAccepted) {
thePrs->ShowColored(myUseScalar->isChecked());
- if(!thePrs->IsColored()){
+ if (!thePrs->IsColored()) {
SALOMEDS::Color aColor;
aColor.R = myColor.red()/255.;
aColor.G = myColor.green()/255.;
if ((aSrcSelection > 0) && (aSrcItem > -1)) {
VISU::VISUType aType;
QString aName;
- switch (aSrcSelection){
+ switch (aSrcSelection) {
case 1: // Entity
aPrs = myEntityList[aSrcItem];
aType = VISU::TENTITY;
aPrs = myPrsList[aSrcItem];
break;
}
- if(CORBA::is_nil(aPrs) && aSrcSelection != 4){
+ if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
aPrs = createMesh(aType, aName);
}
}
myPntPercent->value(),
aDirection);
}
- if(!isAccepted)
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
+ //if (!isAccepted)
+ // SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+ // tr("ERR_CANT_BUILD_PRESENTATION"),
+ // tr("VISU_BUT_OK"));
return isAccepted;
}
}
-VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
- CORBA::Object_var anObject = VISU::SObjectToObject(mySelectionObj);
+VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
+{
+ return VISU::Mesh::_nil();
+/*
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
VISU::Result_var aResult;
if (!CORBA::is_nil(anObject)) {
aResult = VISU::Result::_narrow(anObject);
}
- if(CORBA::is_nil(aResult)) {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
+ if (CORBA::is_nil(aResult)) {
+ SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+ tr("WRN_NO_AVAILABLE_DATA"),
+ tr("VISU_BUT_OK"));
return VISU::Mesh::_nil();
}
- SALOMEDS::ChildIterator_var aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
+ SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
VISU::Storable::TRestoringMap aMap;
for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
- SALOMEDS::SObject_var aChildSObj = aIter->Value();
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDSClient_SObject* aChildSObj = aIter->Value();
+ SALOMEDSClient_GenericAttribute* anAttr;
if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aComm = aComment->Value();
+ SALOMEDSClient_AttributeComment* aComment = dynamic_cast<SALOMEDSClient_AttributeComment*>( anAttr );
+ CORBA::String_var aComm = aComment->Value().c_str();
QString strIn(aComm.in());
aMap.clear();
VISU::Storable::StrToMap(strIn,aMap);
if (isExist) {
if (aType != theType) continue;
- SALOMEDS::GenericAttribute_var aNameAttr;
- if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(aNameAttr);
+ SALOMEDSClient_GenericAttribute* aNameAttr;
+ if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
+ SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>(aNameAttr);
if (QString(aName->Value()) == theName) break; //use current map
}
}
VISU::Mesh_var aMesh;
QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
switch (theType) {
- case VISU::TFAMILY:
+ case VISU::TFAMILY:
{
VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1());
}
if(!CORBA::is_nil(aMesh)){ // Create Actor
VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()){
+ if(VTKViewer_ViewWindow* vf = VisuGUI::GetVtkViewWindow()){
try{
pPresent->SetPresentationType(VISU::POINT);
VISU_Actor *anActor = pPresent->CreateActor();
vf->AddActor(anActor);
}catch(...){
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_CREATE_ACTOR"),
- tr ("VISU_BUT_OK") );
+ SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr ("VISU_WARNING"),
+ tr ("ERR_CANT_CREATE_ACTOR"),
+ tr ("VISU_BUT_OK") );
}
- }
- }else{
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
+ }
+ } else {
+ SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+ tr("ERR_CANT_BUILD_PRESENTATION"),
+ tr("VISU_BUT_OK"));
}
return aMesh._retn();
+*/
}
void VisuGUI_StreamLinesDlg::accept() {
- if (myScalarPane->check()) QDialog::accept();
+ if (myScalarPane->check())
+ QDialog::accept();
}
#define VISUGUI_STREAMLINESDLG_H
#include "VisuGUI_ScalarBarDlg.h"
-#include "QAD_SpinBoxDbl.h"
#include <qdialog.h>
#include <qcombobox.h>
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
+class QtxDblSpinBox;
+class SALOMEDSClient_SObject;
+
namespace VISU{
class StreamLines_i;
}
class VisuGUI_StreamLinesDlg: public QDialog
-{
+{
Q_OBJECT
public:
- VisuGUI_StreamLinesDlg();
+ VisuGUI_StreamLinesDlg(QWidget* parent);
~VisuGUI_StreamLinesDlg() {};
void initFromPrsObject(VISU::StreamLines_i* thePrs);
private:
VISU::Mesh_ptr createMesh(VISU::VISUType theType, QString theName);
- QAD_SpinBoxDbl* myStepLen;
- QAD_SpinBoxDbl* myIntegStepLen;
- QAD_SpinBoxDbl* myPropTime;
+ QtxDblSpinBox* myStepLen;
+ QtxDblSpinBox* myIntegStepLen;
+ QtxDblSpinBox* myPropTime;
QComboBox* myDirCombo;
QCheckBox* myUseScalar;
QPushButton* SelColor;
QColor myColor;
//QCheckBox* myUseSrcChk;
QComboBox* myUseSrcCombo;
- QAD_SpinBoxDbl* myPntPercent;
+ QtxDblSpinBox* myPntPercent;
QComboBox* mySrcCombo;
QValueList<VISU::Prs3d_var> myPrsList;
QValueList<VISU::Prs3d_var> myEntityList;
QStringList myFamilisLst;
QStringList myGroupsLst;
QStringList myPrsLst;
- SALOMEDS::SObject_var mySelectionObj;
+ SALOMEDSClient_SObject* mySelectionObj;
VisuGUI_ScalarBarPane* myScalarPane;
VISU::StreamLines_i* myPrs;
+
private slots:
void setVColor();
void enableSetColor();
setName( "VisuGUI_SweepPrefDlg" );
setCaption( tr( "Sweeping Preferences" ) );
setSizeGripEnabled( TRUE );
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this );
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 11 );
-
+
TopGroup = new QGroupBox( this, "TopGroup" );
TopGroup->setColumnLayout(0, Qt::Vertical );
TopGroup->layout()->setSpacing( 0 );
TopGroupLayout->setMargin( 11 );
TimeLabel = new QLabel( tr( "Time step (second):" ), TopGroup, "TimeLabel" );
- TimeSpin = new QAD_SpinBoxDbl( TopGroup, 0.1, 1000.0, 0.1 );
+ TimeSpin = new QtxDblSpinBox( 0.1, 1000.0, 0.1, TopGroup );
TimeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TimeSpin->setMinimumSize( 70, 0 );
TimeSpin->setValue( 0.2 );
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlabel.h>
-#include "QAD_SpinBoxDbl.h"
+#include "QtxDblSpinBox.h"
class VisuGUI_SweepPrefDlg : public QDialog
{
private:
QGroupBox* TopGroup;
QLabel* TimeLabel;
- QAD_SpinBoxDbl* TimeSpin;
+ QtxDblSpinBox* TimeSpin;
QLabel* CyclesLabel;
QSpinBox* CyclesSpin;
QLabel* StepsLabel;
// Module : VISU
#include "VisuGUI_TimeAnimation.h"
-#include "VisuGUI.h"
-#include <qlayout.h>
-#include <qhbox.h>
-#include <qhgroupbox.h>
-#include <qmessagebox.h>
-#include <qwt_wheel.h>
-#include <qlcdnumber.h>
-#include <qlistbox.h>
-#include <qvgroupbox.h>
-#include <qthread.h>
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_FileDlg.h"
-
-#include "VTKViewer_ViewFrame.h"
-#include "VISU_ScalarBarActor.hxx"
-
-#include "VisuGUI_MagnitudeDlg.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+//#include "VisuGUI_MagnitudeDlg.h"
#include "VisuGUI_CutPlanesDlg.h"
#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI_IsoSurfacesDlg.h"
#include "VisuGUI_StreamLinesDlg.h"
+
#include "VISU_TimeAnimation.h"
#include "VISU_ScalarMap_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
-static double MAXVALUE = 1.0E+300;
+#include "VISU_ScalarBarActor.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_FileDlg.h"
+
+#include "VTKViewer_ViewWindow.h"
+
+#include <qlayout.h>
+#include <qhbox.h>
+#include <qhgroupbox.h>
+#include <qwt_wheel.h>
+#include <qlcdnumber.h>
+#include <qlistbox.h>
+#include <qvgroupbox.h>
+#include <qthread.h>
-SetupDlg::SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
- : QDialog( theParent, "SetupDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+//static double MAXVALUE = 1.0E+300;
+
+
+SetupDlg::SetupDlg (QWidget* theParent, VISU_TimeAnimation* theAnimator)
+ : QDialog(theParent, "SetupDlg", true, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
setCaption("Setup Animation");
setSizeGripEnabled( TRUE );
myAnimator = theAnimator;
-
+
QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
aMainLayout->setSpacing(5);
QFrame* aRangeGrp = new QFrame(this);
- QGridLayout* aRangeLayout = new QGridLayout( aRangeGrp );
+ QGridLayout* aRangeLayout = new QGridLayout( aRangeGrp );
aRangeLayout->setSpacing( 6 );
aRangeLayout->setMargin( 11 );
aRangeGrp->setFrameStyle(QFrame::Box | QFrame::Raised);
myUseRangeChk = new QCheckBox("Use range of time stamps", aRangeGrp);
aRangeLayout->addMultiCellWidget(myUseRangeChk, 0, 0, 0, 3);
myUseRangeChk->setChecked(myAnimator->isRangeDefined());
-
+
QLabel* aMinLbl = new QLabel("From", aRangeGrp);
aMinLbl->setEnabled(myUseRangeChk->isChecked());
aRangeLayout->addWidget(aMinLbl, 1, 0);
double aStep = (myAnimator->getMaxTime() - myAnimator->getMinTime())/(theAnimator->getFieldData(0).myNbTimes - 1);
- myMinVal = new QAD_SpinBoxDbl(aRangeGrp, myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep );
+ myMinVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp );
myMinVal->setEnabled(myUseRangeChk->isChecked());
if (myUseRangeChk->isChecked())
myMinVal->setValue( myAnimator->getMinRange() );
else
myMinVal->setValue( myAnimator->getMinTime() );
-
+
connect(myMinVal, SIGNAL( valueChanged(double)),
this, SLOT( onMinValue(double) ));
aRangeLayout->addWidget(myMinVal, 1, 1);
QLabel* aMaxLbl = new QLabel("To", aRangeGrp);
aMaxLbl->setEnabled(myUseRangeChk->isChecked());
aRangeLayout->addWidget(aMaxLbl, 1, 2);
- myMaxVal = new QAD_SpinBoxDbl(aRangeGrp, myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep );
+ myMaxVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp );
myMaxVal->setEnabled(myUseRangeChk->isChecked());
if (myUseRangeChk->isChecked())
myMaxVal->setValue( myAnimator->getMaxRange() );
connect(myMaxVal, SIGNAL( valueChanged(double)),
this, SLOT( onMaxValue(double) ));
aRangeLayout->addWidget(myMaxVal, 1, 3);
-
+
connect(myUseRangeChk, SIGNAL( toggled(bool)),
aMinLbl, SLOT( setEnabled(bool) ));
connect(myUseRangeChk, SIGNAL( toggled(bool)),
aMainLayout->addWidget(aRangeGrp);
-
+
QHBox* aPropFrame = new QHBox(this);
aPropFrame->setSpacing(5);
-
- QVGroupBox* aNamesBox = new QVGroupBox("Fields",aPropFrame);
+
+ QVGroupBox* aNamesBox = new QVGroupBox("Fields",aPropFrame);
myFieldLst = new QListBox(aNamesBox);
QStringList aFieldNames;
// Find names of fields
for (int i = 0; i < theAnimator->getNbFields(); i++) {
- aFieldNames.append(VisuGUI::getValue(theAnimator->getFieldData(i).myField, "myName"));
+ _PTR(SObject) aSO = theAnimator->getFieldData(i).myField;
+ aFieldNames.append(VISU::getValue(aSO, "myName"));
}
myFieldLst->insertStringList(aFieldNames);
myFieldLst->setSelected(0, true);
- connect( myFieldLst, SIGNAL( highlighted(int) ),
+ connect( myFieldLst, SIGNAL( highlighted(int) ),
this, SLOT( onFieldChange(int) ) );
-
- QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
+
+ QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
myTypeCombo = new QComboBox(aPropBox);
- connect( myTypeCombo, SIGNAL( activated(int) ),
+ connect( myTypeCombo, SIGNAL( activated(int) ),
this, SLOT( onTypeChanged(int) ) );
-
+
// QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
- //connect( aBarBtn, SIGNAL( clicked() ),
+ //connect( aBarBtn, SIGNAL( clicked() ),
// this, SLOT( onScalarBarDlg() ) );
-
+
myPropBtn = new QPushButton("Properties...", aPropBox);
// myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
- connect( myPropBtn, SIGNAL( clicked() ),
+ connect( myPropBtn, SIGNAL( clicked() ),
this, SLOT( onPreferencesDlg() ) );
onFieldChange(0);
aMainLayout->addWidget(aPropFrame);
-
+
QHBox* aBtnBox = new QHBox(this);
- QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
+ QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
aBtnLayout->addStretch();
-
+
QPushButton* aCloseBtn = new QPushButton(tr("VISU_BUT_OK"), aBtnBox);
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
-
+
aMainLayout->addWidget(aBtnBox);
}
-
//************************************************************************
-void SetupDlg::onFieldChange(int theIndex) {
+void SetupDlg::onFieldChange (int theIndex)
+{
FieldData& aData = myAnimator->getFieldData(theIndex);
myTypeCombo->clear();
myTypeCombo->insertItem("Scalar Map");
myTypeCombo->insertItem("Iso Surfaces");
myTypeCombo->insertItem("Cut Planes");
- SALOMEDS::SObject_var aSObject = aData.myField;
- long aNumComp = VisuGUI::getValue(aSObject, "myNumComponent").toLong();
+ _PTR(SObject) aSObject = aData.myField;
+ long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong();
if (aNumComp > 1) {
myTypeCombo->insertItem("Deformed Shape");
myTypeCombo->insertItem("Vectors");
myTypeCombo->setCurrentItem(5);
aData.myPrsType = VISU::TSTREAMLINES;
break;
- }
+ }
//myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
}
//************************************************************************
-void SetupDlg::onTypeChanged(int theIndex) {
+void SetupDlg::onTypeChanged (int theIndex)
+{
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
switch (theIndex) {
case 0: //Scalar Map
//myAnimator->generatePresentations(myFieldLst->currentItem());
}
-
//************************************************************************
/*void SetupDlg::onScalarBarDlg() {
QApplication::setOverrideCursor( Qt::waitCursor );
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
- if (aData.myPrs == 0)
+ if (aData.myPrs == 0)
myAnimator->generatePresentations(myFieldLst->currentItem());
QApplication::restoreOverrideCursor();
}
}
*/
+
//************************************************************************
-void SetupDlg::onPreferencesDlg() {
- QApplication::setOverrideCursor( Qt::waitCursor );
+void SetupDlg::onPreferencesDlg()
+{
+ MESSAGE("SetupDlg::onPreferencesDlg() is not implemented");
+/* SUIT_OverrideCursor c;
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
if (aData.myPrs.empty())
myAnimator->generatePresentations(myFieldLst->currentItem());
- QApplication::restoreOverrideCursor();
// BUG VISU5725 : Compatibility gcc 2.95
// #define EDITPRS(TYPE, DLG) \
break;
}
#undef EDITPRS
+*/
}
//************************************************************************
-void SetupDlg::onRangeCheck(bool theCheck) {
- for (int i = 0; i < myAnimator->getNbFields(); i++)
+void SetupDlg::onRangeCheck (bool theCheck)
+{
+ for (int i = 0; i < myAnimator->getNbFields(); i++)
myAnimator->clearData(myAnimator->getFieldData(i));
myMinVal->setEnabled(theCheck);
myAnimator->setAnimationRange(0, 0);
else {
// if (myMinVal->value() < myMaxVal->value())
- myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value());
+ myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value());
// else if (myMinVal->value() > myMaxVal->value())
// myAnimator->setAnimationRange(myMaxVal->value(), myMinVal->value());
// else // equal case
}
//************************************************************************
-void SetupDlg::onMinValue(double theVal) {
+void SetupDlg::onMinValue (double theVal)
+{
if (theVal > myAnimator->getMaxRange()) {
myMinVal->setValue( myAnimator->getMinTime() );
myMinVal->setFocus();
return;
}
- for (int i = 0; i < myAnimator->getNbFields(); i++)
+ for (int i = 0; i < myAnimator->getNbFields(); i++)
myAnimator->clearData(myAnimator->getFieldData(i));
myAnimator->setAnimationRange(theVal, myAnimator->getMaxRange());
}
//************************************************************************
-void SetupDlg::onMaxValue(double theVal) {
+void SetupDlg::onMaxValue (double theVal)
+{
if (theVal < myAnimator->getMinRange()) {
myMaxVal->setValue( myAnimator->getMaxTime() );
myMaxVal->setFocus();
return;
}
- for (int i = 0; i < myAnimator->getNbFields(); i++)
+ for (int i = 0; i < myAnimator->getNbFields(); i++)
myAnimator->clearData(myAnimator->getFieldData(i));
myAnimator->setAnimationRange(myAnimator->getMinRange(), theVal);
}
-
static const char * firstIco[] = {
"18 10 2 1",
" g None",
static QPixmap MYplayPixmap(playIco);
-
static const char * rightIco[] = {
"11 10 2 1",
" g None",
static QPixmap MYpausePixmap(pauseIco);
-VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg(SALOMEDS::Study_var theStudy)
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_TimeAnimationDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (QWidget* parent, _PTR(Study) theStudy)
+ : QDialog(parent, "VisuGUI_TimeAnimationDlg", false, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
{
setCaption("Animation");
setSizeGripEnabled( TRUE );
myStudy = theStudy;
isClosing = false;
- myAnimator = new VISU_TimeAnimation(theStudy);
+ //myAnimator = new VISU_TimeAnimation (VISU::GetDSStudy(theStudy));
+ myAnimator = new VISU_TimeAnimation (theStudy);
myAnimator->setSpeed(1);
- myAnimator->setViewer(VisuGUI::GetVtkViewFrame());
- connect( myAnimator, SIGNAL( frameChanged(long, double) ),
- this, SLOT( onExecution(long, double) ) );
- connect( myAnimator, SIGNAL( stopped() ),
- this, SLOT( onStop() ) );
+ myAnimator->setViewer(VISU::GetViewWindow());
+ connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double)));
+ connect(myAnimator, SIGNAL(stopped()), this, SLOT(onStop()));
QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
aMainLayout->setSpacing(5);
mySetupBtn = new QPushButton("Setup Animation...", this);
- connect( mySetupBtn, SIGNAL( clicked() ),
+ connect( mySetupBtn, SIGNAL( clicked() ),
this, SLOT( onSetupDlg() ) );
- aMainLayout->addWidget(mySetupBtn);
-
+ aMainLayout->addWidget(mySetupBtn);
+
myGenBtn = new QPushButton("Generate frames", this);
- connect( myGenBtn, SIGNAL( clicked() ),
+ connect( myGenBtn, SIGNAL( clicked() ),
this, SLOT( createFrames() ) );
aMainLayout->addWidget(myGenBtn);
myPlayFrame = new QFrame(this);
myPlayFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
myPlayFrame->setLineWidth( 1 );
-
+
// --- Play controls ---
- QGridLayout* TopLayout = new QGridLayout( myPlayFrame );
+ QGridLayout* TopLayout = new QGridLayout( myPlayFrame );
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 11 );
mySlider->setTickInterval(1);
//mySlider->setTickmarks(QSlider::Below);
mySlider->setTracking(false);
- connect( mySlider, SIGNAL( valueChanged(int) ),
- this, SLOT( onFrameChanged(int) ) );
+ connect( mySlider, SIGNAL( valueChanged(int) ),
+ this, SLOT( onWindowChanged(int) ) );
TopLayout->addMultiCellWidget(mySlider, 1, 1, 0, 2);
myPlayBtn = new QToolButton(myPlayFrame);
myPlayBtn->setIconSet(MYplayPixmap);
myPlayBtn->setToggleButton(true);
- connect( myPlayBtn, SIGNAL( clicked() ),
+ connect( myPlayBtn, SIGNAL( clicked() ),
this, SLOT( onPlayPressed() ) );
TopLayout->addMultiCellWidget(myPlayBtn, 2, 2, 0, 1);
QToolButton* aBackBtn = new QToolButton(myPlayFrame);
aBackBtn->setIconSet(QPixmap(leftIco));
- connect( aBackBtn, SIGNAL( clicked() ),
+ connect( aBackBtn, SIGNAL( clicked() ),
this, SLOT( onBackPressed() ) );
TopLayout->addWidget(aBackBtn, 3, 0);
QToolButton* aForvardBtn = new QToolButton(myPlayFrame);
aForvardBtn->setIconSet(QPixmap(rightIco));
- connect( aForvardBtn, SIGNAL( clicked() ),
+ connect( aForvardBtn, SIGNAL( clicked() ),
this, SLOT( onForvardPressed() ) );
TopLayout->addWidget(aForvardBtn, 3, 1);
QToolButton* aFirstBtn = new QToolButton(myPlayFrame);
aFirstBtn->setIconSet(QPixmap(firstIco));
- connect( aFirstBtn, SIGNAL( clicked() ),
+ connect( aFirstBtn, SIGNAL( clicked() ),
this, SLOT( onFirstPressed() ) );
TopLayout->addWidget(aFirstBtn, 4, 0);
-
+
QToolButton* aLastBtn = new QToolButton(myPlayFrame);
aLastBtn->setIconSet(QPixmap(lastIco));
- connect( aLastBtn, SIGNAL( clicked() ),
+ connect( aLastBtn, SIGNAL( clicked() ),
this, SLOT( onLastPressed() ) );
TopLayout->addWidget(aLastBtn, 4, 1);
-
+
QLabel* aSpeedLbl = new QLabel("Speed", myPlayFrame);
TopLayout->addWidget(aSpeedLbl, 4, 2, Qt::AlignRight);
QwtWheel* aWheel = new QwtWheel(myPlayFrame);
aWheel->setOrientation(Qt::Vertical);
aWheel->setRange(1, 99, 1);
- connect( aWheel, SIGNAL(valueChanged(double)),
+ connect( aWheel, SIGNAL(valueChanged(double)),
aSpeedNum, SLOT(display(double)) );
- connect( aWheel, SIGNAL(valueChanged(double)),
+ connect( aWheel, SIGNAL(valueChanged(double)),
this, SLOT(onSpeedChange(double)) );
TopLayout->addMultiCellWidget(aWheel, 1, 3, 3, 3, Qt::AlignRight);
connect(mySaveCheck, SIGNAL( toggled(bool)),
aPathLbl, SLOT( setEnabled(bool) ));
aSaveLay->addWidget(aPathLbl, 1, 0);
-
+
myPathEdit = new QLineEdit(aSaveBox);
myPathEdit->setEnabled(false);
connect(mySaveCheck, SIGNAL( toggled(bool)),
aMainLayout->addWidget(myPlayFrame);
QHBox* aBtnBox = new QHBox(this);
- QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
+ QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
aBtnLayout->addStretch();
QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
-
+
aMainLayout->addWidget(aBtnBox);
myPlayFrame->setEnabled(false);
}
-
//************************************************************************
-VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg() {
+VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg()
+{
delete myAnimator;
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onTypeChange(int index) {
+void VisuGUI_TimeAnimationDlg::onTypeChange (int index)
+{
stopAnimation();
myPropBtn->setEnabled(index != 0);
-
+
clearView();
myPlayFrame->setEnabled(false);
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::addField(SALOMEDS::SObject_var theSObject) {
+void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject)
+{
myPlayFrame->setEnabled(false);
- myAnimator->addField(theSObject);
+ myAnimator->addField(VISU::GetSObject(theSObject));
}
-
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::createFrames() {
+void VisuGUI_TimeAnimationDlg::createFrames()
+{
stopAnimation();
- QApplication::setOverrideCursor( Qt::waitCursor );
+ SUIT_OverrideCursor c;
for (int i = 0; i < myAnimator->getNbFields(); i++) {
- if (myAnimator->getFieldData(i).myPrs.empty())
+ if (myAnimator->getFieldData(i).myPrs.empty())
myAnimator->generatePresentations(i);
}
if (myAnimator->getNbFrames() == 0) {
myPlayFrame->setEnabled(false);
- QApplication::restoreOverrideCursor();
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NO_ANIMATIONDATA"));
- return;
- }
+ c.suspend();
+ SUIT_MessageBox::warn1(this,
+ tr("ERROR"),
+ tr("MSG_NO_ANIMATIONDATA"),
+ tr("OK"));
+ return;
+ }
mySlider->setMaxValue(myAnimator->getNbFrames()-1);
myPlayFrame->setEnabled(true);
if (!myAnimator->generateFrames()) {
- QApplication::restoreOverrideCursor();
+ c.suspend();
//myPlayFrame->setEnabled(false);
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), myAnimator->getLastErrorMsg());
+ SUIT_MessageBox::warn1(this,
+ tr("ERROR"),
+ myAnimator->getLastErrorMsg(),
+ tr("OK"));
return;
}
//myPlayFrame->setEnabled(true);
- QApplication::restoreOverrideCursor();
}
-
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onPlayPressed() {
+void VisuGUI_TimeAnimationDlg::onPlayPressed()
+{
if (myPlayBtn->isOn() && (!myAnimator->running())) {
myPlayBtn->setIconSet(MYpausePixmap);
if (mySaveCheck->isChecked())
}
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onBackPressed() {
+void VisuGUI_TimeAnimationDlg::onBackPressed()
+{
//stopAnimation();
myAnimator->prevFrame();
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onForvardPressed() {
+void VisuGUI_TimeAnimationDlg::onForvardPressed()
+{
myAnimator->nextFrame();
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onLastPressed() {
+void VisuGUI_TimeAnimationDlg::onLastPressed()
+{
myAnimator->lastFrame();
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onFirstPressed() {
+void VisuGUI_TimeAnimationDlg::onFirstPressed()
+{
myAnimator->firstFrame();
}
-
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::clearView() {
+void VisuGUI_TimeAnimationDlg::clearView()
+{
myAnimator->clearView();
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::closeEvent(QCloseEvent* theEvent) {
+void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent)
+{
myAnimator->stopAnimation();
if (myAnimator->running() && (! myAnimator->finished())) {
isClosing = true;
}
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onFrameChanged(int index) {
+void VisuGUI_TimeAnimationDlg::onWindowChanged (int index)
+{
if (myAnimator->isRunning()) return;
myAnimator->gotoFrame(index);
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onSpeedChange(double theSpeed) {
+void VisuGUI_TimeAnimationDlg::onSpeedChange (double theSpeed)
+{
myAnimator->setSpeed((int)theSpeed);
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::stopAnimation() {
+void VisuGUI_TimeAnimationDlg::stopAnimation()
+{
myAnimator->stopAnimation();
myPlayBtn->setOn(false);
myPlayBtn->setIconSet(MYplayPixmap);
}
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onExecution(long theNewFrame, double theTime) {
+void VisuGUI_TimeAnimationDlg::onExecution (long theNewFrame, double theTime)
+{
myTimeLbl->setText(QString("%1").arg(theTime));
mySlider->setValue(theNewFrame);
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onSetupDlg() {
+void VisuGUI_TimeAnimationDlg::onSetupDlg()
+{
if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame();
SetupDlg* aDlg = new SetupDlg(this, myAnimator);
aDlg->exec();
}
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onBrowse() {
- QString aPath = QAD_FileDlg::getExistingDirectory(this, "/","Select path");
+void VisuGUI_TimeAnimationDlg::onBrowse()
+{
+ QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/","Select path");
if (!aPath.isEmpty())
myPathEdit->setText(aPath);
}
-
//************************************************************************
-void VisuGUI_TimeAnimationDlg::onStop() {
+void VisuGUI_TimeAnimationDlg::onStop()
+{
if (isClosing) {
QDialog::closeEvent(myEvent);
} else {
#include "VisuGUI_ScalarBarDlg.h"
-#include "SALOMEconfig.h"
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-#include CORBA_CLIENT_HEADER(VISU_Gen)
+//#include "SALOMEconfig.h"
+//#include CORBA_SERVER_HEADER(SALOMEDS)
+//#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+//#include CORBA_CLIENT_HEADER(VISU_Gen)
class VISU_TimeAnimation;
QComboBox* myTypeCombo;
QPushButton* myPropBtn;
QCheckBox* myUseRangeChk;
- QAD_SpinBoxDbl* myMinVal;
- QAD_SpinBoxDbl* myMaxVal;
+ QtxDblSpinBox* myMinVal;
+ QtxDblSpinBox* myMaxVal;
};
+//class SALOMEDSClient_Study;
+//class SALOMEDSClient_SObject;
+
class VisuGUI_TimeAnimationDlg: public QDialog
{
Q_OBJECT
public:
- VisuGUI_TimeAnimationDlg(SALOMEDS::Study_var theStudy);
+ VisuGUI_TimeAnimationDlg(QWidget* parent, _PTR(Study) theStudy);
~VisuGUI_TimeAnimationDlg();
- void addField(SALOMEDS::SObject_var theField);
+ void addField(_PTR(SObject) theField);
void clearView();
protected:
void onLastPressed();
void onFirstPressed();
void onSetupDlg();
- void onFrameChanged(int index);
+ void onWindowChanged(int index);
void createFrames();
void onSpeedChange(double theSpeed);
void onExecution(long theNewFrame, double theTime);
QPushButton* myGenBtn;
QFrame* myPlayFrame;
- SALOMEDS::Study_var myStudy;
+ _PTR(Study) myStudy;
VISU_TimeAnimation* myAnimator;
QCheckBox* mySaveCheck;
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2005 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Tools.cxx
+// Author : Sergey Anikin
+// Module : VISU
+
+
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Actor.h"
+
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_Functor.h"
+
+#include "VTKViewer_Algorithm.h"
+
+#include "SPlot2d_ViewModel.h"
+#include "Plot2d_ViewFrame.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+
+#include <vtkRenderer.h>
+#include <vtkActorCollection.h>
+
+
+//=============================================================================
+namespace VISU
+{
+ SUIT_Desktop*
+ GetDesktop(const CAM_Module* theModule)
+ {
+ return theModule->application()->desktop();
+ }
+
+ SalomeApp_SelectionMgr*
+ GetSelectionMgr(const SalomeApp_Module* theModule)
+ {
+ return theModule->getApp()->selectionMgr();
+ }
+
+ SalomeApp_Study*
+ GetAppStudy(const CAM_Module* theModule)
+ {
+ return
+ dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
+ }
+
+ _PTR(Study)
+ GetCStudy(const SalomeApp_Study* theStudy)
+ {
+ return theStudy->studyDS();
+ }
+
+ SALOMEDS::StudyManager_var
+ GetStudyManager()
+ {
+ static SALOMEDS::StudyManager_var aStudyManager;
+ if(CORBA::is_nil(aStudyManager)){
+ SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+ CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
+ aStudyManager = SALOMEDS::StudyManager::_narrow(anObject);
+ }
+ return aStudyManager;
+ }
+
+ bool
+ IsStudyLocked(const SALOMEDS::Study_var& theStudy)
+ {
+ if(!CORBA::is_nil(theStudy))
+ return theStudy->GetProperties()->IsLocked();
+ return true;
+ }
+
+ bool
+ CheckLock(const SALOMEDS::Study_var& theStudy,
+ const CAM_Module* theModule)
+ {
+ if(IsStudyLocked(theStudy))
+ throw std::runtime_error(QObject::tr("WRN_STUDY_LOCKED").latin1());
+ return false;
+ }
+
+ VISU_Gen_i*
+ GetVisuGen(const CAM_Module* theModule)
+ {
+ static VISU_Gen_i* aGen = NULL;
+ if(!aGen){
+ SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
+ Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU");
+ VISU_Gen_var aVISU = VISU_Gen::_narrow(aComponent);
+ if(!CORBA::is_nil(aVISU)){
+ aGen = VISU_Gen_i::GetVisuGenImpl();
+ aGen->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(theModule))));
+ }
+ }
+ if(!aGen)
+ throw std::runtime_error(QObject::tr("ERR_CANT_FIND_VISU_COMPONENT").latin1());
+ return aGen;
+ }
+
+ SALOME_MED::MED_Gen_var
+ GetMEDEngine()
+ {
+ static SALOME_MED::MED_Gen_var aGen;
+ if(CORBA::is_nil(aGen)){
+ SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService());
+ Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED");
+ aGen = SALOME_MED::MED_Gen::_narrow(aComponent);
+ }
+ if(CORBA::is_nil(aGen))
+ throw std::runtime_error(QObject::tr("ERR_CANT_FIND_MED_COMPONENT").latin1());
+ return aGen;
+ }
+
+ CORBA::Object_var
+ GetSelectedObj(const SalomeApp_Study* theStudy,
+ const QString& theEntry,
+ VISU::Storable::TRestoringMap* theMap)
+ {
+ if ( !theStudy || theEntry.isEmpty() )
+ return CORBA::Object::_nil();
+
+ SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy( theStudy ));
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( theEntry.latin1() );
+ if(!aSObject->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theMap && aSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ std::string aValue = aComment->Value();
+ QString aString(aValue.c_str());
+ VISU::Storable::StrToMap(aString,*theMap);
+ }
+ return VISU::SObjectToObject(aSObject);
+ }
+ return CORBA::Object::_nil();
+ }
+
+ CORBA::Object_var
+ GetSelectedObj(const SalomeApp_Module* theModule,
+ Handle(SALOME_InteractiveObject)* theIO,
+ VISU::Storable::TRestoringMap* theMap)
+ {
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ if(anIter.More()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(theIO)
+ *theIO = anIO;
+ if(anIO->hasEntry())
+ return GetSelectedObj( GetAppStudy(theModule), anIO->getEntry(), theMap );
+ }
+ return CORBA::Object::_nil();
+ }
+
+ VISU::Storable::TRestoringMap
+ getMapOfValue(SALOMEDS::SObject_var theSObject)
+ {
+ VISU::Storable::TRestoringMap aMap;
+ if(!theSObject->_is_nil()){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
+ SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ QString aString(aValue.in());
+ VISU::Storable::StrToMap(aString,aMap);
+ }
+ }
+ return aMap;
+ }
+
+ QString
+ getValue(SALOMEDS::SObject_var theSObject,
+ QString theKey)
+ {
+ QString aStr("");
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
+ if(!aMap.empty())
+ aStr = VISU::Storable::FindValue(aMap,theKey.latin1());
+ return aStr;
+ }
+
+ VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject)
+ {
+ VISU::Storable::TRestoringMap aMap;
+ if (theSObject) {
+ _PTR(GenericAttribute) anAttr;
+ if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ std::string aValue = aComment->Value();
+ QString aString (aValue.c_str());
+ VISU::Storable::StrToMap(aString, aMap);
+ }
+ }
+ return aMap;
+ }
+
+ QString getValue (_PTR(SObject) theSObject, QString theKey)
+ {
+ QString aStr("");
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
+ if (!aMap.empty())
+ aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
+ return aStr;
+ }
+
+
+ bool
+ CheckTimeStamp(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var& theSObject,
+ Handle(SALOME_InteractiveObject)* theIO)
+ {
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(theModule,&anIO);
+ if(theIO)
+ *theIO = anIO;
+ if(!anIO.IsNull() && anIO->hasEntry()){
+ SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(theModule)));
+ theSObject = aStudy->FindObjectID(anIO->getEntry());
+ QString aValue = getValue(theSObject,"myType");
+ if(aValue.toInt() == int(VISU::TTIMESTAMP))
+ return true;
+ }
+ SUIT_MessageBox::warn1(GetDesktop(theModule),
+ QObject::tr("VISU_WARNING"),
+ QObject::tr("WRN_NO_AVAILABLE_DATA"),
+ QObject::tr("VISU_BUT_OK") );
+ return false;
+ }
+
+
+ VISU::Result_i*
+ CheckResult(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var theSource,
+ VISU::Result_var& theResult)
+ {
+ SALOMEDS::SObject_var aSObj;
+
+ aSObj = theSource->GetFather();
+ if (CORBA::is_nil(aSObj))
+ return NULL;
+
+ aSObj = aSObj->GetFather();
+ if (CORBA::is_nil(aSObj))
+ return NULL;
+
+ aSObj = aSObj->GetFather();
+ if (CORBA::is_nil(aSObj))
+ return NULL;
+
+ CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
+ if (CORBA::is_nil(anObject)) {
+ aSObj = aSObj->GetFather();
+ if (CORBA::is_nil(aSObj))
+ return NULL;
+ anObject = VISU::SObjectToObject(aSObj);
+ }
+
+ if (CORBA::is_nil(anObject))
+ return NULL;
+
+ theResult = VISU::Result::_narrow(anObject);
+ VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
+ if(pResult == NULL)
+ SUIT_MessageBox::warn1(GetDesktop(theModule),
+ QObject::tr("VISU_WARNING"),
+ QObject::tr("WRN_NO_AVAILABLE_DATA"),
+ QObject::tr("VISU_BUT_OK"));
+ return pResult;
+ }
+
+ SVTK_ViewWindow*
+ GetViewWindow(const SalomeApp_Module* theModule)
+ {
+ if(SalomeApp_Application* anApp = theModule->getApp()){
+ if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), true )){
+ if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
+ return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ }
+ }
+ }
+ return NULL;
+ }
+
+ SVTK_ViewWindow*
+ GetViewWindow()
+ {
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ if (anApp) {
+ if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) {
+ if (aViewManager->getType() == SVTK_Viewer::Type()) {
+ if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
+ return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ }
+ }
+ }
+ }
+ return NULL;
+ }
+
+ TViewWindows
+ GetViews(const SalomeApp_Module* theModule)
+ {
+ TViewWindows aViewWindows;
+ if(SalomeApp_Application* anApp = theModule->getApp()){
+ ViewManagerList aViewManagerList;
+ anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList);
+ QPtrListIterator<SUIT_ViewManager> anIter(aViewManagerList);
+ while(SUIT_ViewManager* aViewManager = anIter.current()){
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+ if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+ if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
+ aViewWindows.push_back(aView);
+ }
+ ++anIter;
+ }
+ }
+ return aViewWindows;
+ }
+
+ VISU_Actor*
+ PublishInView(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs)
+ {
+ VISU_Actor* aActor = NULL;
+ if(!thePrs)
+ return aActor;
+ if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ if(aActor = thePrs->CreateActor()){
+ aView->AddActor(aActor);
+ }
+ QApplication::restoreOverrideCursor();
+ }
+ return aActor;
+ }
+
+ VISU_Actor*
+ UpdateViewer(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ bool theDispOnly)
+ {
+ SVTK_ViewWindow* vw = GetViewWindow( theModule );
+ if (!vw) return NULL;
+
+ vtkRenderer *aRen = vw->getRenderer();
+ vtkActorCollection *anActColl = aRen->GetActors();
+
+ vtkActor *anActor;
+ VISU_Actor* anVISUActor = NULL;
+ VISU_Actor* aResActor = NULL;
+ for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
+ if(!SALOME_Actor::SafeDownCast(anActor))
+ continue;
+ if(anActor->IsA("VISU_Actor")){
+ anVISUActor = VISU_Actor::SafeDownCast(anActor);
+ VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
+ if(aPrs == NULL) continue;
+ if (thePrs == aPrs) {
+ aResActor = anVISUActor->GetParent();
+ thePrs->UpdateActor(aResActor);
+ aResActor->VisibilityOn();
+
+ } else if (theDispOnly) {
+ anVISUActor->GetParent()->VisibilityOff();
+ } else {
+ }
+ } else if (theDispOnly && anActor->GetVisibility()) {
+ anActor->VisibilityOff();
+ } else {
+ }
+ }
+ if (aResActor)
+ return aResActor;
+
+ anVISUActor = PublishInView( theModule, thePrs );
+ return anVISUActor;
+ }
+
+ VISU_Actor*
+ FindActor(SVTK_ViewWindow* theViewWindow,
+ const char* theEntry)
+ {
+ using namespace VTK;
+ if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
+ if(vtkActorCollection* aCollection = aRenderer->GetActors()){
+ if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
+ return anActor->GetParent();
+ }
+ }
+ }
+ return NULL;
+ }
+
+ VISU_Actor*
+ FindActor(SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs)
+ {
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+ return FindActor(theViewWindow,anEntry.in());
+ }
+
+ void
+ Add(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ SALOME_ListIO aListIO;
+ theSelectionMgr->selectedObjects(aListIO);
+ aListIO.Append(theIO);
+ theSelectionMgr->setSelectedObjects(aListIO);
+ }
+
+ void
+ Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ SALOME_ListIO aListIO;
+ theSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ while(anIter.More()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(anIO->isSame(theIO)){
+ aListIO.Remove(anIter);
+ }
+ anIter.Next();
+ }
+ theSelectionMgr->setSelectedObjects(aListIO);
+ }
+
+ void
+ DeletePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ const Handle(SALOME_InteractiveObject)& theIO)
+ {
+ if(!thePrs)
+ return;
+ if(CheckLock(GetDSStudy(GetCStudy(GetAppStudy(theModule))),theModule))
+ return;
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ CORBA::String_var anEntry = aSObject->GetID();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ Remove(aSelectionMgr,theIO);
+ TViewWindows aViewWindows = GetViews(theModule);
+ for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){
+ SVTK_ViewWindow* aView = aViewWindows[i];
+ if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){
+ aView->RemoveActor(anActor);
+ anActor->Delete();
+ }
+ }
+ thePrs->RemoveFromStudy();
+ theModule->updateObjBrowser(); //update Object browser
+ }
+
+ void
+ ErasePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs)
+ {
+ if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){
+ VISU_Actor* anVISUActor = FindActor( vw, thePrs );
+ if (anVISUActor) {
+ anVISUActor->VisibilityOff();
+ }
+ }
+ }
+
+ SPlot2d_Viewer*
+ GetPlot2dViewer(const SalomeApp_Module* theModule)
+ {
+ if(SalomeApp_Application* anApp = theModule->getApp()){
+ if(SUIT_ViewManager* aViewManager = anApp->getViewManager( Plot2d_Viewer::Type(), true )){
+ return dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
+ }
+ }
+ return NULL;
+ }
+
+ // Internal function used by several public functions below
+ void
+ UpdateCurve(VISU::Curve_i* theCurve,
+ Plot2d_ViewFrame* aPlot,
+ SPlot2d_Curve* plotCurve,
+ int theDisplaying)
+ {
+ if ( theDisplaying == VISU::eErase ) {
+ if ( plotCurve )
+ aPlot->eraseCurve( plotCurve, false );
+ }
+ else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
+ if ( plotCurve ) {
+ plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
+ //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) );
+ plotCurve->setVerTitle( theCurve->GetName() );
+ plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
+ plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
+ double* xList = 0;
+ double* yList = 0;
+ int nbPoints = theCurve->GetData( xList, yList );
+ if ( nbPoints > 0 && xList && yList ) {
+ plotCurve->setData( xList, yList, nbPoints );
+ }
+ if ( !theCurve->IsAuto() ) {
+ plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
+ plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
+ SALOMEDS::Color color = theCurve->GetColor();
+ plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+ }
+ plotCurve->setAutoAssign( theCurve->IsAuto() );
+ aPlot->displayCurve( plotCurve, false );
+ }
+ else {
+ Plot2d_Curve* crv = theCurve->CreatePresentation();
+ if ( crv ) {
+ aPlot->displayCurve( crv, false );
+ theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
+ theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
+ SALOMEDS::Color newColor;
+ newColor.R = crv->getColor().red()/255.;
+ newColor.G = crv->getColor().green()/255.;
+ newColor.B = crv->getColor().blue()/255.;
+ theCurve->SetColor( newColor );
+ crv->setAutoAssign( theCurve->IsAuto() );
+ }
+ }
+ }
+ }
+
+ void
+ PlotTable(const SalomeApp_Module* theModule,
+ VISU::Table_i* table,
+ int theDisplaying)
+ {
+ SPlot2d_Viewer* aView = GetPlot2dViewer( theModule );
+ if ( !aView )
+ return;
+ Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
+
+ if ( theDisplaying == VISU::eDisplayOnly )
+ aPlot->EraseAll();
+ QList<Plot2d_Curve> clist;
+ aPlot->getCurves( clist );
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
+ _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry() );
+ if ( TableSO ) {
+ _PTR(ChildIterator) Iter = aStudy->NewChildIterator( TableSO );
+ for ( ; Iter->More(); Iter->Next() ) {
+ CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() );
+ if( !CORBA::is_nil( childObject ) ) {
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
+ if( !CORBA::is_nil( aCurve ) ) {
+ VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ SPlot2d_Curve* plotCurve = 0;
+ SPlot2d_Curve* tmpCurve;
+ for ( int i = 0; i < clist.count(); i++ ) {
+ tmpCurve = dynamic_cast<SPlot2d_Curve*>( clist.at( i ) );
+ if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+ plotCurve = tmpCurve;
+ break;
+ }
+ }
+
+ UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
+
+ if ( theDisplaying == VISU::eErase && plotCurve ) {
+ clist.remove( plotCurve );
+ }
+ }
+ }
+ }
+ aPlot->Repaint();
+ }
+ }
+
+ void
+ PlotCurve(const SalomeApp_Module* theModule,
+ VISU::Curve_i* theCurve,
+ int theDisplaying)
+ {
+ SPlot2d_Viewer* aView = GetPlot2dViewer( theModule );
+ if ( !aView )
+ return;
+ Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
+// if ( theDisplaying == VISU::eDisplayOnly )
+// aPlot->EraseAll();
+ QList<Plot2d_Curve> clist;
+ aPlot->getCurves( clist );
+ SPlot2d_Curve* plotCurve = 0;
+ SPlot2d_Curve* tmpCurve;
+ for ( int i = 0; i < clist.count(); i++ ) {
+ tmpCurve = dynamic_cast<SPlot2d_Curve*>( clist.at( i ) );
+ if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) {
+ plotCurve = tmpCurve;
+ }
+ else if ( theDisplaying == VISU::eDisplayOnly ) {
+ aPlot->eraseCurve( clist.at( i ) );
+ }
+ }
+
+ UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
+
+ aPlot->Repaint();
+ }
+
+ void
+ PlotContainer(const SalomeApp_Module* theModule,
+ VISU::Container_i* container,
+ int theDisplaying)
+ {
+ SPlot2d_Viewer* aView = GetPlot2dViewer( theModule );
+ if ( !aView )
+ return;
+ Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
+ if ( theDisplaying == VISU::eDisplayOnly )
+ aPlot->EraseAll();
+ QList<Plot2d_Curve> clist;
+ aPlot->getCurves( clist );
+ if ( container->GetNbCurves() > 0 ) {
+ int nbCurves = container->GetNbCurves();
+ for ( int k = 1; k <= nbCurves; k++ ) {
+ VISU::Curve_i* theCurve = container->GetCurve( k );
+ if ( theCurve && theCurve->IsValid() ) {
+ SPlot2d_Curve* plotCurve = dynamic_cast<SPlot2d_Curve*>( aView->getCurveByIO( new SALOME_InteractiveObject( theCurve->GetEntry(), "", "" ) ) );
+
+ UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying );
+
+ if ( plotCurve && theDisplaying == VISU::eErase ) {
+ clist.remove( plotCurve );
+ }
+ }
+ }
+ }
+ aPlot->Repaint();
+ }
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2005 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Tools.h
+// Author : Sergey Anikin
+// Module : VISU
+
+#ifndef VisuGUI_Tools_HeaderFile
+#define VisuGUI_Tools_HeaderFile
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include "VISUConfig.hh"
+
+#include "SALOMEDSClient_Study.hxx"
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(MED_Gen)
+
+class SUIT_Desktop;
+class VISU_Actor;
+class SVTK_ViewWindow;
+class SPlot2d_Viewer;
+class CAM_Module;
+class SalomeApp_Module;
+class SalomeApp_SelectionMgr;
+class SalomeApp_Study;
+
+namespace VISU{
+ class Prs3d_i;
+ class Result_i;
+ class Table_i;
+ class Curve_i;
+ class Container_i;
+
+ typedef std::vector<SVTK_ViewWindow*> TViewWindows;
+
+ SUIT_Desktop* GetDesktop(const CAM_Module* theModule);
+ SalomeApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule);
+ SalomeApp_Study* GetAppStudy(const CAM_Module* theModule);
+ _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy);
+ bool IsStudyLocked(const SALOMEDS::Study_var& theStudy);
+ bool CheckLock(const SALOMEDS::Study_var& theStudy, const CAM_Module* theModule);
+ VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
+ VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject);
+ QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
+ QString getValue(_PTR(SObject) theSObject, QString theKey);
+ SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
+ SVTK_ViewWindow* GetViewWindow();
+ VISU_Actor* PublishInView(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs);
+ VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ bool theDispOnly = false);
+ VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,
+ const char* theEntry);
+ VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs);
+ void Add(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO);
+ void Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+ const Handle(SALOME_InteractiveObject)& theIO);
+
+ SALOMEDS::StudyManager_var GetStudyManager();
+ VISU_Gen_i* GetVisuGen(const CAM_Module* theModule);
+ SALOME_MED::MED_Gen_var GetMEDEngine();
+ CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy,
+ const QString& theEntry,
+ VISU::Storable::TRestoringMap* theMap = NULL);
+ CORBA::Object_var GetSelectedObj(const SalomeApp_Module* theModule,
+ Handle(SALOME_InteractiveObject)* theIO = NULL,
+ VISU::Storable::TRestoringMap* theMap = NULL);
+ bool CheckTimeStamp(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var& theSObject,
+ Handle(SALOME_InteractiveObject)* theIO = NULL);
+ inline bool IsSObjectTable(_PTR(SObject) theSObject);
+ VISU::Result_i* CheckResult(const SalomeApp_Module* theModule,
+ SALOMEDS::SObject_var theSource,
+ VISU::Result_var& theResult);
+ TViewWindows GetViews(const SalomeApp_Module* theModule);
+ void DeletePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ const Handle(SALOME_InteractiveObject)& theIO);
+ void ErasePrs3d(SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs);
+
+ SPlot2d_Viewer* GetPlot2dViewer(const SalomeApp_Module* theModule);
+ void PlotTable( const SalomeApp_Module* theModule,
+ VISU::Table_i* table,
+ int theDisplaying );
+ void PlotCurve( const SalomeApp_Module* theModule,
+ VISU::Curve_i* curve,
+ int theDisplaying );
+ void PlotContainer( const SalomeApp_Module* theModule,
+ VISU::Container_i* container,
+ int theDisplaying );
+}
+
+bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
+{
+ if( theSObject ) {
+ _PTR(GenericAttribute) anAttr;
+ if(theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
+ return true;
+ if(theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
+ return true;
+ }
+ return false;
+}
+
+#endif
#include "VisuGUI_VectorsDlg.h"
#include "VISU_Vectors_i.hh"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Selection.h"
#include <qlayout.h>
#include <qcolordialog.h>
/*!
Constructor
*/
-VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_VectorsDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_VectorsDlg::VisuGUI_VectorsDlg( QWidget* parent )
+ : QDialog( parent, "VisuGUI_VectorsDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
setCaption( tr( "Vector Field Representation" ) );
setSizeGripEnabled( TRUE );
// Scale factor
ScaleLabel = new QLabel( tr( "Scale factor:" ), TopGroup, "ScaleLabel" );
- ScalFact = new QAD_SpinBoxDbl( TopGroup, 1e-20, 1.0E+38, 0.1, 5);
+ ScalFact = new QtxDblSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup );
+ ScalFact->setPrecision( 5 );
ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
ScalFact->setValue( 0.1 );
/* ColorLab = new QLabel( TopGroup, "ColorLab" );
ColorLab->setFixedSize( SelColor->sizeHint().height(), SelColor->sizeHint().height() );
ColorLab->setFrameStyle( QLabel::Plain | QLabel::Box );
- */
+ */
TopGroupLayout->addWidget( UseMagn, 2, 0 );
//TopGroupLayout->addWidget( ColorLab, 2, 1 );
TopGroupLayout->addWidget( SelColor, 2, 1 );
#define VISUGUI_VECTORSDLG_H
#include "VisuGUI_ScalarBarDlg.h"
-#include "QAD_SpinBoxDbl.h"
+#include "QtxDblSpinBox.h"
#include <qdialog.h>
#include <qbuttongroup.h>
Q_OBJECT
public:
- VisuGUI_VectorsDlg();
+ VisuGUI_VectorsDlg(QWidget* parent);
~VisuGUI_VectorsDlg() {};
void setScaleFactor( double sf );
QLabel* LineWidLabel;
QSpinBox* LinWid;
QLabel* ScaleLabel;
- QAD_SpinBoxDbl* ScalFact;
+ QtxDblSpinBox* ScalFact;
QCheckBox* UseGlyph;
QButtonGroup* TypeGlyph;
QRadioButton* RBCones6;
# File : Makefile.in
# Author : Alexey Petrov
# Module : VISU
-# $Header:
+# $Header:
top_srcdir=@top_srcdir@
top_builddir=../..
# Libraries targets
LIB = libVISUEngineImpl.la
-LIB_SRC = VISUConfig.cc VISU_Gen_i.cc VISU_Result_i.cc \
- VISU_ViewManager_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
+
+LIB_SRC = VISUConfig.cc VISU_Gen_i.cc \
+ VISU_Result_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \
VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \
VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
VISU_Vectors_i.cc VISU_StreamLines_i.cc \
- VISU_TimeAnimation.cxx VISU_CorbaMedConvertor.cxx
+ VISU_ViewManager_i.cc VISU_View_i.cc \
+ VISU_TimeAnimation.cxx VISU_CorbaMedConvertor.cxx \
+ VISU_DumpPython.cc
LIB_MOC = VISU_TimeAnimation.h
LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Comm.idl
# Executables targets
-BIN =
-BIN_SRC =
+BIN =
+BIN_SRC =
-BIN_CLIENT_IDL =
+BIN_CLIENT_IDL =
BIN_SERVER_IDL =
-
-EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh VISU_Result_i.hh \
- VISU_PrsObject_i.hh VISU_ViewManager_i.hh VISU_Table_i.hh \
+
+EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh \
+ VISU_Result_i.hh VISU_PrsObject_i.hh VISU_Table_i.hh \
VISU_Prs3d_i.hh VISU_Mesh_i.hh VISU_ScalarMap_i.hh \
VISU_IsoSurfaces_i.hh VISU_DeformedShape_i.hh \
VISU_CutPlanes_i.hh VISU_CutLines_i.hh \
VISU_Vectors_i.hh VISU_StreamLines_i.hh \
+ VISU_ViewManager_i.hh VISU_View_i.hh \
VISU_TimeAnimation.h
# additionnal information to compil and link file
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
- $(HDF5_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)\
- -I${KERNEL_ROOT_DIR}/include/salome
+ $(HDF5_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)\
+ -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
LDFLAGS += $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
- -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer -lSalomeHDFPersist \
+ -lSalomeContainer -lOpUtil -lSalomeApp -lVTKViewer -lSVTK -lSPlot2d -lSalomeHDFPersist \
-lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj \
- -L${KERNEL_ROOT_DIR}/lib/salome
+ -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lEvent
LIBS+= -lPlot2d -L${KERNEL_ROOT_DIR}/lib/salome
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISUConfig.cc
#include "VISUConfig.hh"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include <SALOMEDSClient_GenericAttribute.hxx>
+#include <SALOMEDSClient_AttributeIOR.hxx>
+
+#include <SalomeApp_Application.h>
+
using namespace std;
#ifdef _DEBUG_
#endif
namespace VISU{
+
+ SUIT_Session*
+ GetSession()
+ {
+ return SUIT_Session::session();
+ }
+
+ SUIT_ResourceMgr*
+ GetResourceMgr()
+ {
+ return GetSession()->resourceMgr();
+ }
+
//===========================================================================
+
QMutex* Base_i::myMutex = NULL; //apo - &VISUMutex;
CORBA::ORB_var Base_i::myOrb;
PortableServer::POA_var Base_i::myPoa;
return NULL;
}
- const QString& Storable::FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind)
+ QString Storable::FindValue(const TRestoringMap& theMap, const string& theArg, bool* isFind)
{
TRestoringMap::const_iterator i = theMap.find(theArg);
if(i == theMap.end()) {
return anObj;
}
+ //===========================================================================
+ CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject){
+ _PTR(GenericAttribute) anAttr;
+ CORBA::Object_var anObj;
+ try{
+ if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
+ _PTR(AttributeIOR) anIOR = anAttr;
+ CORBA::String_var aValue = anIOR->Value().c_str();
+ CORBA::ORB_ptr anORB = Base_i::GetORB();
+ if(strcmp(aValue,"") != 0)
+ anObj = anORB->string_to_object(aValue);
+ }
+ }catch(...){
+ INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
+ }
+ return anObj;
+ }
+
//===========================================================================
string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
INFOS("CreateAttributes - StudyId = "<<theStudyDocument->StudyId()<<"; anEntry = "<<aRet<<"; IOR = '"<<theIOR<<"'");
return aRet;
}
-}
+ string CreateAttributes(_PTR(Study) theStudyDocument,
+ const char* theFatherEntry, const char* theRefFatherEntry,
+ const char* theIOR, const char* theName,
+ const char* thePersistentRef, const char* theComment,
+ CORBA::Boolean theCreateNew)
+ {
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry);
+ _PTR(SObject) newObj;
+ if (theCreateNew)
+ newObj = aStudyBuilder->NewObject(aFather);
+ else
+ newObj = aFather;
+ _PTR(GenericAttribute) anAttr;
+ if (strcmp(theIOR, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ _PTR(AttributeIOR) anIOR (anAttr);
+ anIOR->SetValue(theIOR);
+ }
+ if (strcmp(theName, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ _PTR(AttributeName) aName (anAttr);
+ aName->SetValue(theName);
+ }
+ if (strcmp(thePersistentRef, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef");
+ _PTR(AttributePersistentRef) aPRef (anAttr);
+ aPRef->SetValue(thePersistentRef);
+ }
+ if (strcmp(theComment, "") != 0) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
+ _PTR(AttributeComment) aCmnt (anAttr);
+ aCmnt->SetValue(theComment);
+ if (MYDEBUG) INFOS("CreateAttributes - Comment = " << theComment);
+ }
+ if (strcmp(theRefFatherEntry, "") != 0) {
+ _PTR(SObject) aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
+ _PTR(SObject) anObj = aStudyBuilder->NewObject(aRefFather);
+ aStudyBuilder->Addreference(anObj, newObj);
+ }
+ string aRet = newObj->GetID();
+ if (MYDEBUG)
+ INFOS("CreateAttributes - StudyId = " << theStudyDocument->StudyId()
+ << "; anEntry = " << aRet << "; IOR = '" << theIOR << "'");
+ return aRet;
+ }
-QString VISU::GenerateName(const string& theFmt, int theId){
- static QString aName;
- if(theId > 0)
- aName.sprintf("%s:%d",theFmt.c_str(),theId);
- else
- aName.sprintf("%s",theFmt.c_str());
- return aName;
+ QString GenerateName(const string& theFmt, int theId){
+ static QString aName;
+ if(theId > 0)
+ aName.sprintf("%s:%d",theFmt.c_str(),theId);
+ else
+ aName.sprintf("%s",theFmt.c_str());
+ return aName;
+ }
+
+
+ SALOMEDS::StudyManager_var GetStudyManager()
+ {
+ static SALOMEDS::StudyManager_var aStudyManager;
+ if(CORBA::is_nil(aStudyManager)){
+ SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+ CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
+ aStudyManager = SALOMEDS::StudyManager::_narrow(anObject);
+ }
+ return aStudyManager;
+ }
+
+
+ SALOMEDS::Study_var GetDSStudy(_PTR(Study) theStudy)
+ {
+ std::string aStudyName = theStudy->Name();
+ return GetStudyManager()->GetStudyByName(aStudyName.c_str());
+ }
+
+ SALOMEDS::SObject_var GetSObject( _PTR(SObject) obj )
+ {
+ _PTR(Study) aStudy = obj->GetStudy();
+ SALOMEDS::Study_var aSalomeDSStudy = GetDSStudy( aStudy );
+ std::string id = obj->GetID();
+ return aSalomeDSStudy->FindObjectID( id.c_str() );
+ }
+
+ _PTR(SObject) GetClientSObject( SALOMEDS::SObject_var obj,
+ _PTR(Study) study )
+ {
+ return study->FindObjectID( obj->GetID() );
+
+ }
}
// 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
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#include "Utils_CorbaException.hxx"
#include "utilities.h"
+#include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDSClient_Study.hxx>
+
#include <stdexcept>
-#include <sstream>
+#include <sstream>
+
+class SUIT_Session;
+class SUIT_ResourceMgr;
+
namespace VISU{
+
+ SUIT_Session *GetSession();
+ SUIT_ResourceMgr *GetResourceMgr();
+
//===========================================================================
+
class VISU_Gen_i;
class Base_i : public virtual POA_VISU::Base,
typedef std::map<std::string,TStorableEngine> TCallbackMap;
static void Registry(const char* theComment, TStorableEngine theEngine);
static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
- static const QString& FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
+ static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal);
QString GenerateName(const std::string& theFmt, int theId);
PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
- CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
+ CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject);
+ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr);
+ _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument);
SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
const char* thePersistentRef, const char* theComment,
CORBA::Boolean theCreateNew = true);
+ std::string CreateAttributes(_PTR(Study) theStudyDocument,
+ const char* theFatherEntry, const char* theRefFatherEntry,
+ const char* theIOR, const char* theName,
+ const char* thePersistentRef, const char* theComment,
+ CORBA::Boolean theCreateNew = true);
+
std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry,
const char* theComment, int IsAllLevels = true);
+
+ SALOMEDS::SObject_var GetSObject( _PTR(SObject) );
+ _PTR(SObject) GetClientSObject( SALOMEDS::SObject_var, _PTR(Study) );
+ SALOMEDS::Study_var GetDSStudy( _PTR(Study) );
}
#endif
+
}else{
const TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
- for(int anId = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
+ for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
int aVGeom = aCellsConnIter->first;
const TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConnIter->second;
TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File : VISU_DumpPython.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_PrsObject_i.hh"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Mesh_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_Table_i.hh"
+
+#include "utilities.h"
+
+#include <cctype>
+#include <strstream>
+#include <functional>
+
+#include <qstring.h>
+#include <qfileinfo.h>
+
+//#define COUT
+
+using namespace std;
+
+namespace VISU{
+ static std::string PREFIX(" ");
+
+ typedef std::map<std::string,std::string> TName2EntryMap;
+ typedef std::map<std::string,std::string> TEntry2NameMap;
+
+ inline
+ std::string
+ GenerateName(std::string theName,
+ SALOMEDS::SObject_ptr theSObject,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ char theSuffix)
+ {
+ if(theName2EntryMap.find(theName) != theName2EntryMap.end()){
+ theName = GenerateName(theName + theSuffix, theSObject, theName2EntryMap, theEntry2NameMap, theSuffix);
+ }else{
+ CORBA::String_var anID = theSObject->GetID();
+ theName2EntryMap[theName] = anID.in();
+ theEntry2NameMap[anID.in()] = theName;
+ //cout<<"GenerateName - "<<theName<<" => "<<anID.in()<<endl;
+ }
+
+ return theName;
+ }
+
+ struct TReplacePredicate{
+ bool operator()(char theChar) const
+ {
+ return !(isdigit(theChar) || isalpha(theChar) || theChar == '_');
+ }
+ };
+
+ inline
+ std::string
+ GetName(SALOMEDS::SObject_ptr theSObject)
+ {
+ CORBA::String_var aString = theSObject->GetName();
+
+ std::string aName = QString(aString.in()).simplifyWhiteSpace().latin1();
+
+ //replace_if(aName.begin(),aName.end(),not1(ptr_fun(isxdigit)),'_');
+ replace_if(aName.begin(),aName.end(),TReplacePredicate(),'_');
+
+ if ( isdigit( aName[0] ))
+ aName.insert( 0, 1, 'a' );
+
+ return aName;
+ }
+
+ inline
+ std::string
+ GenerateName(SALOMEDS::SObject_ptr theSObject,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap)
+ {
+ std::string aName = GetName(theSObject);
+
+ return GenerateName(aName,theSObject,theName2EntryMap,theEntry2NameMap,'X');
+ }
+
+
+ //===========================================================================
+ typedef void (*TDumpToPython)(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix);
+
+
+ void
+ DumpToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix);
+
+
+ //===========================================================================
+ std::string
+ ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::ScalarMap_i* theServant,
+ std::ostream& theStr,
+ std::string& theName,
+ const std::string& theConstructorName,
+ const std::string& theArgumentName,
+ std::string thePrefix)
+ {
+ std::string aParam;
+ switch(theServant->GetEntity()){
+ case NODE:
+ aParam = "VISU.NODE";
+ break;
+ case EDGE:
+ aParam = "VISU.EDGE";
+ break;
+ case FACE:
+ aParam = "VISU.FACE";
+ break;
+ case CELL:
+ aParam = "VISU.CELL";
+ break;
+ }
+
+ theStr<<thePrefix<<theName<<" = aVisu."<<theConstructorName<<"("<<theArgumentName<<
+ ",'"<<theServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ",'"<<theServant->GetFieldName()<<"'"<<
+ ","<<theServant->GetIteration()<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"if "<<theName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"aName2ObjectMap['"<<theName<<"'] = "<<theName<<endl;
+
+ theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
+
+ switch(theServant->GetScaling()){
+ case LINEAR:
+ aParam = "VISU.LINEAR";
+ break;
+ case LOGARITHMIC:
+ aParam = "VISU.LOGARITHMIC";
+ break;
+ }
+ theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<","<<theServant->GetMax()<<")"<<endl;
+
+ switch(theServant->GetBarOrientation()){
+ case ScalarMap::HORIZONTAL:
+ aParam = "VISU.ScalarMap.HORIZONTAL";
+ break;
+ case ScalarMap::VERTICAL:
+ aParam = "VISU.ScalarMap.VERTICAL";
+ break;
+ }
+ theStr<<thePrefix<<theName<<".SetBarOrientation("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetPosition("<<theServant->GetPosX()<<","<<theServant->GetPosY()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetSize("<<theServant->GetWidth()<<","<<theServant->GetHeight()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetNbColors("<<theServant->GetNbColors()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetLabels("<<theServant->GetLabels()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetTitle('"<<theServant->GetTitle()<<"')"<<endl;
+
+ return thePrefix;
+ }
+
+
+ //===========================================================================
+ std::string
+ DeformedShapeToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::DeformedShape_i* theServant,
+ std::ostream& theStr,
+ std::string& theName,
+ const std::string& theConstructorName,
+ const std::string& theArgumentName,
+ std::string thePrefix)
+ {
+ thePrefix = ScalarMapToPython(theSObject,theServant,theStr,theName,theConstructorName,theArgumentName,thePrefix);
+ theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".ShowColored("<<theServant->IsColored()<<")"<<endl;
+ SALOMEDS::Color aColor = theServant->GetColor();
+ theStr<<thePrefix<<theName<<".SetColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ return thePrefix;
+ }
+
+
+ //===========================================================================
+ template<class TTableAttr>
+ void
+ TableAttrToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ TTableAttr theTableAttr,
+ const std::string& theAttrName,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::SObject_var aFatherSObject = theSObject->GetFather();
+ if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
+ return;
+ }
+ }
+ }
+
+ std::string aSObjectName = GetName(theSObject);
+ theStr<<thePrefix<<aSObjectName<<" = aBuilder.NewObject(aSComponent)"<<endl;
+ theStr<<thePrefix<<"if "<<aSObjectName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ std::string aName = "aTableAttr";
+ theStr<<thePrefix<<aName<<" = aBuilder.FindOrCreateAttribute("<<
+ aSObjectName<<",'"<<theAttrName<<"')"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix = thePrefix;
+ thePrefix += PREFIX;
+
+ CORBA::String_var aString = theTableAttr->GetTitle();
+ theStr<<thePrefix<<aName<<".SetTitle('"<<aString.in()<<"')"<<endl;
+
+ CORBA::Long aNbColumns = theTableAttr->GetNbColumns();
+ theStr<<thePrefix<<aName<<".SetNbColumns("<<aNbColumns<<")"<<endl;
+
+ CORBA::Long aNbRows = theTableAttr->GetNbRows();
+
+ // push values and their indices into streams
+ strstream values, rows, columns;
+ string comma = "";
+ for(CORBA::Long i = 1; i <= aNbColumns; i++){
+ for(CORBA::Long j = aNbRows; j > 0; j--){
+ if(theTableAttr->HasValue(j,i)){
+ values << comma << theTableAttr->GetValue(j,i);
+ rows << comma << j;
+ columns << comma << i;
+ if ( comma.empty() )
+ comma = ",";
+ }
+ }
+ }
+ // push titles and units into streams
+ strstream rowUnits, rowTitles, colTitles;
+ SALOMEDS::StringSeq_var aRowUnits = theTableAttr->GetRowUnits();
+ SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles();
+ comma = "";
+ for(CORBA::Long j = 1; j <= aNbRows; j++){
+ rowUnits << comma << "'" << aRowUnits [ j - 1 ] << "'";
+ rowTitles << comma << "'" << aRowTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
+ }
+ SALOMEDS::StringSeq_var aColumnTitles = theTableAttr->GetColumnTitles();
+ comma = "";
+ for(CORBA::Long j = 1; j <= aNbColumns; j++){
+ colTitles << comma << "'" << aColumnTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
+ }
+ values << '\0';
+ rows << '\0';
+ columns << '\0';
+ rowUnits << '\0';
+ rowTitles << '\0';
+ colTitles << '\0';
+ // write FillTable command
+ theStr<< thePrefix << aName << "_values = [" << values.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rows = [" << rows.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_columns = [" << columns.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rUnits = [" << rowUnits.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rTitles = [" << rowTitles.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_cTitles = [" << colTitles.str() << "]" << endl;
+ theStr<< thePrefix << "visu.FillTable( "
+ << aName << ", "
+ << aName << "_values, "
+ << aName << "_rows, "
+ << aName << "_columns, "
+ << aName << "_rTitles, "
+ << aName << "_rUnits, "
+ << aName << "_cTitles )" << endl;
+
+ if(theSObject->FindAttribute(anAttr,"AttributeIOR")){
+ theStr<<endl;
+ std::string aName = "aTable";
+ theStr<<thePrefix<<"anID = "<<aSObjectName<<".GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theArgumentName = aName;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix2 = thePrefix + PREFIX;
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ aPrefix2);
+
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ }
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }
+
+
+ //===========================================================================
+ void
+ DumpChildrenToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject);
+ for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
+ SALOMEDS::SObject_var aSObject = aChildItet->Value();
+ DumpToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ aSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpTableAttrToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeTableOfInteger")){
+ SALOMEDS::AttributeTableOfInteger_var aTableAttr =
+ SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
+
+ TableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ aTableAttr,
+ "AttributeTableOfInteger",
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ }else if(theSObject->FindAttribute(anAttr,"AttributeTableOfReal")){
+ SALOMEDS::AttributeTableOfReal_var aTableAttr =
+ SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ TableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ aTableAttr,
+ "AttributeTableOfReal",
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ std::string aName = GetName(theSObject);
+ if(aName == "")
+ return;
+
+ CORBA::Object_var anObj = SObjectToObject(theSObject);
+ 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){
+ case VISU::TRESULT:
+ if(Result_i* aServant = dynamic_cast<Result_i*>(GetServant(anObj).in())){
+ std::string aFileName = aServant->GetFileName();
+ Result_i::ECreationId anId = aServant->GetCreationId();
+ if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){
+ switch(anId){
+ case Result_i::eImportFile:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportFile('"<<aFileName<<"')"<<endl;
+ break;
+ case Result_i::eCopyAndImportFile:
+ theStr<<thePrefix<<aName<<" = aVisu.CopyAndImportFile('"<<aFileName<<"')"<<endl;
+ break;
+ }
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }else{
+ SALOMEDS::SObject_var aRefSObj;
+ if(theSObject->FindSubObject(1,aRefSObj)){
+ SALOMEDS::SObject_var aTargetRefSObj;
+ if(aRefSObj->ReferencedObject(aTargetRefSObj)){
+ CORBA::String_var aString = aTargetRefSObj->GetName();
+ theStr<<thePrefix<<"aSObject = theStudy.FindObject('"<<aString.in()<<"')"<<endl;
+ theStr<<thePrefix<<"if aSObject:"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"anObject = aSObject.GetObject()"<<endl;
+ theStr<<thePrefix<<"if anObject:"<<endl;
+ std::string aPrefix1 = thePrefix;
+ thePrefix += PREFIX;
+
+ switch(anId){
+ case Result_i::eImportMed:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportMed(aSObject)"<<endl;
+ break;
+ case Result_i::eImportMedField:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportMedField(anObject)"<<endl;
+ break;
+ }
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix2 = thePrefix;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ theStr<<aPrefix1<<"pass"<<endl<<endl;
+ }
+ }
+ }
+ }
+ return;
+ case VISU::TMESH:
+ if(Mesh_i* aServant = dynamic_cast<Mesh_i*>(GetServant(anObj).in())){
+ VISU::Entity anEntity = aServant->GetEntity();
+ const std::string& aSubMeshName = aServant->GetSubMeshName();
+ if(anEntity >= 0){
+ std::string aParam;
+ switch(anEntity){
+ case NODE:
+ aParam = "VISU.NODE";
+ break;
+ case EDGE:
+ aParam = "VISU.EDGE";
+ break;
+ case FACE:
+ aParam = "VISU.FACE";
+ break;
+ case CELL:
+ aParam = "VISU.CELL";
+ break;
+ }
+
+ if(aSubMeshName == "")
+ theStr<<thePrefix<<aName<<" = aVisu.MeshOnEntity("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ")"<<endl;
+ else
+ theStr<<thePrefix<<aName<<" = aVisu.FamilyMeshOnEntity("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ",'"<<aSubMeshName<<"'"<<
+ ")"<<endl;
+ }else
+ theStr<<thePrefix<<aName<<" = aVisu.GroupMesh("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ",'"<<aSubMeshName<<"'"<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"aName2ObjectMap['"<<aName<<"'] = "<<aName<<endl;
+
+ SALOMEDS::Color aColor;
+ aColor = aServant->GetCellColor();
+ theStr<<thePrefix<<aName<<".SetCellColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ aColor = aServant->GetNodeColor();
+ theStr<<thePrefix<<aName<<".SetNodeColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ aColor = aServant->GetLinkColor();
+ theStr<<thePrefix<<aName<<".SetLinkColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ std::string aParam;
+ switch(aServant->GetPresentationType()){
+ case POINT:
+ aParam = "VISU.POINT";
+ break;
+ case WIREFRAME:
+ aParam = "VISU.WIREFRAME";
+ break;
+ case SHADED:
+ aParam = "VISU.SHADED";
+ break;
+ case INSIDEFRAME:
+ aParam = "VISU.INSIDEFRAME";
+ break;
+ case SURFACEFRAME:
+ aParam = "VISU.SURFACEFRAME";
+ break;
+ case SHRINK:
+ aParam = "VISU.SHRINK";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
+ theStr<<endl;
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ break;
+ case VISU::TSCALARMAP:
+ if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TDEFORMEDSHAPE:
+ if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"DeformedShapeOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TSTREAMLINES:
+ if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"StreamLinesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetDirection()){
+ case StreamLines::FORWARD:
+ aParam = "VISU.StreamLines.FORWARD";
+ break;
+ case StreamLines::BACKWARD:
+ aParam = "VISU.StreamLines.BACKWARD";
+ break;
+ case StreamLines::BOTH:
+ aParam = "VISU.StreamLines.BOTH";
+ break;
+ }
+
+ theStr<<thePrefix<<"aPrs3d = None"<<endl;
+ VISU::Prs3d_var aPrs3d = aServant->GetSource();
+ if(!CORBA::is_nil(aPrs3d)){
+ if(Prs3d_i* aServant3d = dynamic_cast<Prs3d_i*>(GetServant(aPrs3d).in())){
+ SALOMEDS::SObject_var aSObject = aServant3d->GetSObject();
+ CORBA::String_var anID = aSObject->GetID();
+ std::string anArg = theEntry2NameMap[anID.in()];
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<anArg<<"'):"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"aPrs3d = aName2ObjectMap['"<<anArg<<"']"<<endl;
+ }
+ }
+
+ theStr<<thePrefix<<aName<<".SetParams("<<
+ aServant->GetIntegrationStep()<<","<<
+ aServant->GetPropagationTime()<<","<<
+ aServant->GetStepLength()<<","<<
+ "aPrs3d"<<","<<
+ aServant->GetUsedPoints()<<","<<
+ aParam<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TVECTORS:
+ if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"VectorsOnField",theArgumentName,thePrefix);
+
+ theStr<<thePrefix<<aName<<".SetLineWidth("<<aServant->GetLineWidth()<<")"<<endl;
+
+ std::string aParam;
+ switch(aServant->GetGlyphType()){
+ case Vectors::ARROW:
+ aParam = "VISU.Vectors.ARROW";
+ break;
+ case Vectors::CONE2:
+ aParam = "VISU.Vectors.CONE2";
+ break;
+ case Vectors::CONE6:
+ aParam = "VISU.Vectors.CONE6";
+ break;
+ case Vectors::NONE:
+ aParam = "VISU.Vectors.NONE";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetGlyphType("<<aParam<<")"<<endl;
+
+ switch(aServant->GetGlyphPos()){
+ case Vectors::CENTER:
+ aParam = "VISU.Vectors.CENTER";
+ break;
+ case Vectors::TAIL:
+ aParam = "VISU.Vectors.TAIL";
+ break;
+ case Vectors::HEAD:
+ aParam = "VISU.Vectors.HEAD";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetGlyphPos("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TISOSURFACE:
+ if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"IsoSurfacesOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<aName<<".SetNbSurfaces("<<aServant->GetNbSurfaces()<<")"<<endl;
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCUTPLANES:
+ if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutPlanesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetOrientationType()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
+ CORBA::Long aNbPlanes = aServant->GetNbPlanes();
+ theStr<<thePrefix<<aName<<".SetNbPlanes("<<aNbPlanes<<")"<<endl;
+
+ for(CORBA::Long anId = 0; anId < aNbPlanes; anId++){
+ if(!aServant->IsDefault(anId))
+ theStr<<thePrefix<<aName<<".SetPlanePosition("<<anId<<","<<aServant->GetPlanePosition(anId)<<")"<<endl;
+ }
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCUTLINES:
+ if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutLinesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetOrientationType()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
+
+ switch(aServant->GetOrientationType2()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation2("<<aParam<<","<<aServant->GetRotateX2()<<","<<aServant->GetRotateY2()<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetDisplacement2("<<aServant->GetDisplacement2()<<")"<<endl;
+
+ if(!aServant->IsDefault())
+ theStr<<thePrefix<<aName<<".SetBasePlanePosition("<<aServant->GetBasePlanePosition()<<")"<<endl;
+
+ CORBA::Long aNbLines = aServant->GetNbLines();
+ theStr<<thePrefix<<aName<<".SetNbLines("<<aNbLines<<")"<<endl;
+ for(CORBA::Long anId = 0; anId < aNbLines; anId++){
+ if(!aServant->IsDefaultPosition(anId))
+ theStr<<thePrefix<<aName<<".SetLinePosition("<<anId<<","<<aServant->GetLinePosition(anId)<<")"<<endl;
+ }
+
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCURVE:
+ if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
+ {
+ theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve(" <<
+ theArgumentName<< // table
+ ","<<aServant->GetHRow()<< // H row
+ ","<<aServant->GetVRow()<< // V row
+ ",'"<<aServant->GetTitle()<<"'"; // title
+ SALOMEDS::Color aColor = aServant->GetColor();
+ theStr << ",SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<")"; // color
+
+ std::string aParam;
+ switch(aServant->GetMarker()){
+ case Curve::NONE: aParam = "VISU.Curve.NONE"; break;
+ case Curve::CIRCLE: aParam = "VISU.Curve.CIRCLE"; break;
+ case Curve::RECTANGLE: aParam = "VISU.Curve.RECTANGLE"; break;
+ case Curve::DIAMOND: aParam = "VISU.Curve.DIAMOND"; break;
+ case Curve::DTRIANGLE: aParam = "VISU.Curve.DTRIANGLE"; break;
+ case Curve::UTRIANGLE: aParam = "VISU.Curve.UTRIANGLE"; break;
+ case Curve::LTRIANGLE: aParam = "VISU.Curve.LTRIANGLE"; break;
+ case Curve::RTRIANGLE: aParam = "VISU.Curve.RTRIANGLE"; break;
+ case Curve::CROSS: aParam = "VISU.Curve.CROSS"; break;
+ case Curve::XCROSS: aParam = "VISU.Curve.XCROSS"; break;
+ }
+ theStr<<","<<aParam; // marker
+
+ switch(aServant->GetLine()){
+ case Curve::VOIDLINE: aParam = "VISU.Curve.VOIDLINE"; break;
+ case Curve::SOLIDLINE: aParam = "VISU.Curve.SOLIDLINE"; break;
+ case Curve::DASHLINE: aParam = "VISU.Curve.DASHLINE"; break;
+ case Curve::DOTLINE: aParam = "VISU.Curve.DOTLINE"; break;
+ case Curve::DASHDOTLINE: aParam = "VISU.Curve.DASHDOTLINE"; break;
+ case Curve::DASHDOTDOTLINE: aParam = "VISU.Curve.DASHDOTDOTLINE"; break;
+ }
+ theStr<<","<<aParam<<","<<aServant->GetLineWidth()<<")"<<endl; // line type,width
+ }
+ return;
+ case VISU::TTABLE:
+ if(Table_i* aServant = dynamic_cast<Table_i*>(GetServant(anObj).in())){
+ SALOMEDS::SObject_var aSObject = aServant->GetSObject();
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+ using namespace SALOMEDS;
+ AttributeComment_var aComment = AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aSourceId.latin1(),"CutLines") == 0){
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<theArgumentName<<"'):"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anObject = aName2ObjectMap['"<<theArgumentName<<"']"<<endl;
+ theStr<<thePrefix<<"anIOR = anObject.GetID()"<<endl;
+ theStr<<thePrefix<<"aSObject = theStudy.FindObjectIOR(anIOR)"<<endl;
+ theStr<<thePrefix<<"if aSObject:"<<endl;
+ std::string aPrefix = thePrefix;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }else if(strcmp(aSourceId.latin1(),"TableFile") == 0){
+ CORBA::Short aTag = theSObject->Tag();
+ theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
+ theStr<<thePrefix<<"if anIsFound:"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }else if(strcmp(aSourceId.latin1(),"TableAttr") == 0){
+ theArgumentName = aName;
+ DumpTableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+ }
+ }
+ return;
+ }
+ }
+ }else{
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ 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<<aName<<" = aVisu.ImportTables('"<<aFileName.latin1()<<"')"<<endl;
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ }else if(strcmp(aTypeName.latin1(),"VIEW3D") == 0){
+ std::string aName = GetName(theSObject);
+ theStr<<thePrefix<<aName<<" = aBuilder.NewObject(aSComponent)"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anAttr = aBuilder.FindOrCreateAttribute("<<aName<<",'AttributeName')"<<endl;
+ theStr<<thePrefix<<"anAttr.SetValue('"<<aName<<"')"<<endl;
+
+ theStr<<thePrefix<<"anAttr = aBuilder.FindOrCreateAttribute("<<aName<<",'AttributeComment')"<<endl;
+ theStr<<thePrefix<<"anAttr.SetValue('"<<aValue.in()<<"')"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ }
+ }else{
+ DumpTableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+
+
+ //===========================================================================
+ void
+ DumpCurveToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::SObject_var aTargetRefSObj;
+ if(theSObject->ReferencedObject(aTargetRefSObj)){
+ CORBA::Object_var anObj = SObjectToObject(aTargetRefSObj);
+ if(CORBA::is_nil(anObj))
+ return;
+
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(CORBA::is_nil(aBase))
+ return;
+
+ if(aBase->GetType() == VISU::TCURVE){
+ CORBA::String_var anID = aTargetRefSObj->GetID();
+ std::string anArg = theEntry2NameMap[anID.in()];
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<anArg<<"'):"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"anObject = aName2ObjectMap['"<<anArg<<"']"<<endl;
+ theStr<<thePrefix<<"if anObject: " <<theArgumentName<<".AddCurve(anObject)"<<endl;
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpContainersToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject);
+ for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
+ SALOMEDS::SObject_var aSObject = aChildItet->Value();
+ CORBA::Object_var anObj = SObjectToObject(aSObject);
+ if(CORBA::is_nil(anObj))
+ continue;
+
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(CORBA::is_nil(aBase))
+ continue;
+
+ if(aBase->GetType() == VISU::TCONTAINER){
+ theStr<<endl;
+ std::string aName = GenerateName(aSObject,theName2EntryMap,theEntry2NameMap);
+ theStr<<thePrefix<<aName<<" = aVisu.CreateContainer()"<<endl;
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix = thePrefix + PREFIX;
+ theArgumentName = aName;
+
+ SALOMEDS::ChildIterator_var aCurveIter = theStudy->NewChildIterator(aSObject);
+ for(aCurveIter->InitEx(false); aCurveIter->More(); aCurveIter->Next()){
+ SALOMEDS::SObject_var aRefSObj = aCurveIter->Value();
+ DumpCurveToPython(theStudy,theIsPublished,theIsValidScript,aRefSObj,theStr,theName2EntryMap,theEntry2NameMap,theArgumentName,aPrefix);
+ }
+
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }
+ }
+ }
+
+
+ //===========================================================================
+ Engines::TMPFile*
+ VISU_Gen_i::
+ DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript)
+ {
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+ if(CORBA::is_nil(aStudy))
+ return new Engines::TMPFile(0);
+
+ TName2EntryMap aName2EntryMap;
+ TEntry2NameMap aEntry2NameMap;
+
+#ifndef COUT
+ ostringstream aStr;
+#else
+#define aStr cout
+#endif
+
+ std::string aPrefix(PREFIX);
+ aStr<<"### This file is generated by SALOME automatically by dump python funcitonality"
+ " of VISU component"<<endl<<endl;
+ aStr<<"def RebuildData(theStudy):"<<endl;
+ aStr<<aPrefix<<"from batchmode_salome import orb, naming_service, lcc, myStudyManager"<<endl;
+ aStr<<aPrefix<<"import SALOME_MED"<<endl;
+ aStr<<aPrefix<<"import SALOMEDS"<<endl;
+ aStr<<aPrefix<<"import VISU"<<endl;
+ aStr<<aPrefix<<"import visu"<<endl;
+ aStr<<endl;
+ aStr<<aPrefix<<"aVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,theStudy,0)"<<endl;
+ aStr<<aPrefix<<"aSComponent = visu.PublishComponent(theStudy)"<<endl;
+ aStr<<aPrefix<<"aMed = lcc.FindOrLoadComponent('FactoryServer','MED')"<<endl;
+ aStr<<aPrefix<<"aBuilder = theStudy.NewBuilder()"<<endl;
+ aStr<<aPrefix<<"aName2ObjectMap = {}"<<endl;
+ aStr<<endl;
+
+ SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
+ VISU::DumpChildrenToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
+ VISU::DumpContainersToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
+
+ aStr<<aPrefix<<"pass"<<endl;
+
+#ifndef COUT
+ std::string aResult = aStr.str();
+ //ofstream anFStream("/tmp/dump.py");
+ //anFStream<<aResult<<endl;
+
+ CORBA::ULong aSize = aResult.size() + 1;
+ char* aBuffer = new char[aSize];
+ strcpy(aBuffer,&aResult[0]);
+ return new Engines::TMPFile(aSize,aSize,(CORBA::Octet*)aBuffer,1);
+#else
+#undef aStr
+ return new Engines::TMPFile(0);
+#endif
+ }
+
+}
#include "HDFascii.hxx"
#include "SALOMEDS_Tool.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+#include "SALOMEDSClient_AttributePixMap.hxx"
+
#include "utilities.h"
#include <strstream>
const CORBA::Boolean IsMultifile() { return myIsMultiFile;}
//===========================================================================
+ _PTR(SComponent) ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument)
+ {
+ _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("VISU");
+ if (!aSComponent) {
+ _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder();
+ aStudyBuilder->NewCommand();
+ int aLocked = theStudyDocument->GetProperties()->IsLocked();
+ if (aLocked) theStudyDocument->GetProperties()->SetLocked(false);
+ aSComponent = aStudyBuilder->NewComponent("VISU");
+ _PTR(GenericAttribute) anAttr =
+ aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
+ _PTR(AttributeName) aName (anAttr);
+
+ CORBA::ORB_var anORB = Base_i::GetORB();
+ SALOME_NamingService *NamingService = new SALOME_NamingService( anORB );
+ CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
+ SALOME_ModuleCatalog::ModuleCatalog_var Catalogue =
+ SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
+ SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "VISU" );
+ if (!Comp->_is_nil()) {
+ aName->SetValue(Comp->componentusername());
+ }
+
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap");
+ _PTR(AttributePixMap) aPixmap (anAttr);
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_Visu" );
+
+ VISU_Gen_var aVisuGen = Base_i::GetVisuGenImpl()->_this();
+ aStudyBuilder->DefineComponentInstance(aSComponent, aVisuGen->GetID());
+ if (aLocked) theStudyDocument->GetProperties()->SetLocked(true);
+ aStudyBuilder->CommitCommand();
+ }
+ return aSComponent;
+ }
+
SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument){
SALOMEDS::SComponent_var aSComponent = theStudyDocument->FindComponent("VISU");
if (aSComponent->_is_nil()) {
int aCounter = 0;
TColStd_SequenceOfAsciiString aFileNames;
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
+
+ //CORBA::Boolean anIsValidScript;
+ //Engines::TMPFile_var aDump = DumpPython(aStudy,false,anIsValidScript);
+
SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
for (; itBig->More(); itBig->Next()) {
SALOMEDS::SObject_var gotBranch = itBig->Value();
CORBA::Object_var anObj = SObjectToObject(gotBranch);
if(CORBA::is_nil(anObj)) continue;
if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
- if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+ switch(pResult->GetCreationId()){
+ case Result_i::eImportFile:
+ case Result_i::eCopyAndImportFile: {
const QFileInfo& aFileInfo = pResult->GetFileInfo();
QString aPrefix("");
if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str();
QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
static QString aCommand;
aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
-
+
int aRes = system(aCommand);
if(aRes){
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
continue;
}else
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aCommand = "<<aCommand);
-
+
TCollection_AsciiString aString(strdup(aFileName.latin1()));
aFileNames.Append(aString);
- }
+ }}
}
}
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
CORBA::Object_var anObj = SObjectToObject(gotBranch);
if(CORBA::is_nil(anObj)) continue;
if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
- if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+ switch(pResult->GetCreationId()){
+ case Result_i::eImportFile:
+ case Result_i::eCopyAndImportFile: {
const QFileInfo& aFileInfo = pResult->GetFileInfo();
QString aPrefix("");
if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str();
HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);
aFileNames.Append(aString);
- }
+ }}
}
}
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
return Result::_nil();
Mutex mt(myMutex);
aFileInfo.setFile(theFileName);
- Result_i* pResult = new Result_i(myStudyDocument);
+ Result_i* pResult = new Result_i(myStudyDocument,
+ Result_i::eFile,
+ Result_i::eImportFile);
if(pResult->Create(theFileName) != NULL)
return pResult->_this();
else{
Mutex mt(myMutex);
VISU::Result_var aResult;
aFileInfo.setFile(theFileName);
- Result_i* pResult = new Result_i(myStudyDocument,Result_i::eRestoredFile);
+ Result_i* pResult = new Result_i(myStudyDocument,
+ Result_i::eRestoredFile,
+ Result_i::eCopyAndImportFile);
if(pResult->Create(theFileName) != NULL)
aResult = pResult->_this();
return aResult._retn();
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
- Result_i* pResult = new Result_i(myStudyDocument);
+ Result_i* pResult = new Result_i(myStudyDocument,
+ Result_i::eComponent,
+ Result_i::eImportMed);
if(pResult->Create(theMedSObject) != NULL)
return pResult->_this();
else{
if(myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
- Result_i* pResult = new Result_i(myStudyDocument);
+ Result_i* pResult = new Result_i(myStudyDocument,
+ Result_i::eComponent,
+ Result_i::eImportMedField);
if(pResult->Create(theField) != NULL)
return pResult->_this();
else{
Result_var aResultObj = Result::_narrow(anObj);
if(!aResultObj->_is_nil()){
if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj).in())){
- const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
- if(aSourceId == Result_i::eComponent || aSourceId == Result_i::eRestoredComponent)
- if((pResult->GetFileInfo()).filePath() == "MED")
- return false;
- return true;
+ switch(pResult->GetCreationId()){
+ case Result_i::eImportFile:
+ case Result_i::eCopyAndImportFile:
+ return true;
+ }
}
}
}
virtual Container_ptr CreateContainer();
virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
- virtual void DeleteResult(Result_ptr theResult);
- virtual void DeletePrs3d(Prs3d_ptr thePrs3d);
-
+ virtual void DeleteResult(Result_ptr theResult) {} // apo
+ virtual void DeletePrs3d(Prs3d_ptr thePrs3d) {} // apo
+
+ // inherited methods from Engines::Component
+ virtual
+ Engines::TMPFile*
+ DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript);
// inherited methods from SALOMEDS::Driver
virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
static int IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName);
virtual Storable* Create(const char* theMeshName, const char* theGroupName);
+ const std::string& GetMeshName() const { return myMeshName;}
+ VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
+ const string& GetSubMeshName() const { return mySubMeshName;}
+
virtual void ToStream(std::ostringstream& theStr);
virtual const char* GetComment() const;
#include "VISU_CorbaMedConvertor.hxx"
#include "VISU_PipeLine.hxx"
-#include "QAD_Config.h"
+#include "SUIT_ResourceMgr.h"
#include "SALOMEDS_Tool.hxx"
#include "HDFascii.hxx"
const string VISU::Result_i::myComment = "RESULT";
const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
-VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId) {
- myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- mySourceId = aSourceId;
- myInput = NULL;
- myIsDone = 0;
- CORBA::String_var aName = theStudy->Name();
- MESSAGE("Result_i::Result_i - this = "<<this<<"; StudyId = "<<
- theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
+VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId):
+ myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
+ myCreationId(theCreationId),
+ mySourceId(theSourceId),
+ myInput(NULL),
+ myIsDone(0)
+{
}
}
-int VISU::Result_i::IsPossible(){
+int
+VISU::Result_i::
+IsPossible()
+{
try{
float aSize = myInput->GetSize();
bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
}
-CORBA::Boolean VISU::Result_i::BuildAll(){
+CORBA::Boolean
+VISU::Result_i::
+BuildAll()
+{
if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
if(myIsDone) return 1;
if(!IsPossible()) return 0;
return myIsDone;
}
-VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
+
+VISU::Storable*
+VISU::Result_i::
+Build(SALOMEDS::SObject_ptr theSObject)
{
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
}
}
}
- QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+ QString aIsBuild = VISU::GetResourceMgr()->stringValue("Visu:BuildResult");
bool isBuildAll = aIsBuild.isEmpty()? 0 : aIsBuild.toInt();
if(isBuildAll) BuildAll();
}catch(std::exception& exc){
return this;
}
-VISU::Storable* VISU::Result_i::Create(const char* theFileName){
+
+VISU::Storable*
+VISU::Result_i::
+Create(const char* theFileName)
+{
try{
myFileInfo.setFile(theFileName);
myInitFileName = myFileInfo.filePath().latin1();
myName = ::GenerateName(myFileInfo.fileName()).latin1();
- if(GetSourceId() == eRestoredFile){
- auto_ptr<char> aTmpDir((char*)SALOMEDS_Tool::GetTmpDir().c_str());
+ if(mySourceId == eRestoredFile){
+ std::string aTmpDir(SALOMEDS_Tool::GetTmpDir());
static QString aCommand;
- aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.get());
+ aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.c_str());
if(system(aCommand) == -1){
MESSAGE("Create - Can't execute the command :"<<aCommand);
return NULL;
}
if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
- myFileInfo.setFile(QString(aTmpDir.get()) + myFileInfo.fileName());
+ myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
}
myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
if(!myInput)
return NULL;
}
-VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
+
+VISU::Storable*
+VISU::Result_i::
+Create(SALOMEDS::SObject_ptr theMedSObject)
+{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
try{
myInput = CreateMEDConvertor(theMedSObject);
- if(myInput == NULL) return NULL;
- mySourceId = eComponent;
+ if(myInput == NULL)
+ return NULL;
+
string aCompDataType = GetComponentDataType(theMedSObject);
myFileInfo.setFile(aCompDataType.c_str());
+ myInitFileName = aCompDataType;
+
myName = ::GenerateName("aResult").latin1();
+
VISU::Storable* aStorable = Build(theMedSObject);
return aStorable;
}catch(std::exception& exc){
return NULL;
}
-VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
+VISU::Storable*
+VISU::Result_i::
+Create(SALOME_MED::FIELD_ptr theField)
+{
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
try{
myInput = CreateMEDFieldConvertor(theField);
- if(myInput == NULL) return NULL;
- mySourceId = eComponent;
+ if(myInput == NULL)
+ return NULL;
+
string aCompDataType = "MED";
myFileInfo.setFile(aCompDataType.c_str());
myInitFileName = aCompDataType;
+
myName = ::GenerateName("aResult").latin1();
+
CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
+
VISU::Storable* aStorable = Build(aFieldSObject);
return aStorable;
}catch(std::exception& exc){
return NULL;
}
-VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap, const string& thePrefix)
+
+VISU::Storable*
+VISU::Result_i::
+Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap,
+ const string& thePrefix)
{
if(MYDEBUG) MESSAGE("Result_i::Restore - "<<thePrefix);
try{
myInitFileName = VISU::Storable::FindValue(theMap,"myInitFileName").latin1();
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
- mySourceId = eRestoredComponent;
if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
aCmnt->SetValue(aComment.latin1());
}
- QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+ QString aIsBuild = VISU::GetResourceMgr()->stringValue("Visu:BuildResult");
if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt())
BuildAll();
return this;
if(MYDEBUG) MESSAGE(GetComment());
Storable::DataToStream(theStr,"myName",myName.c_str());
Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
+ Storable::DataToStream(theStr,"myCreationId",myCreationId);
}
-VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
+VISU::Storable*
+VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
+ const string& thePrefix,
+ const Storable::TRestoringMap& theMap)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
- VISU::Result_i* pResult = new VISU::Result_i(aStudy);
- if(pResult == NULL) return NULL;
+
+ ECreationId aCreationId = ECreationId(Storable::FindValue(theMap,"myCreationId").toInt());
+ ESourceId aSourceId = eRestoredFile;
+ if(aCreationId == eImportMed || aCreationId == eImportMedField)
+ aSourceId = eRestoredComponent;
+
+ VISU::Result_i* pResult = new VISU::Result_i(aStudy,aSourceId,aCreationId);
+ if(pResult == NULL)
+ return NULL;
+
return pResult->Restore(theSObject,theMap,thePrefix);
}
VISU::Result_i::~Result_i() {
MESSAGE("Result_i::~Result_i() - this = "<<this);
- if(GetSourceId() == eRestoredFile){
+ if(mySourceId == eRestoredFile){
static QString aCommand;
aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
MESSAGE("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
Result_i(const Result_i &);
public:
- enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
- Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId = eFile);
+ enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+ enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
+
+ Result_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId);
+
virtual ~Result_i();
virtual void RemoveFromStudy();
typedef VISU_Convertor TInput;
private:
- TSourceId mySourceId;
+ ESourceId mySourceId;
+ ECreationId myCreationId;
+
TInput *myInput;
CORBA::Boolean myIsDone;
std::string myName, myInitFileName;
virtual Storable* Create(const char* theFileName);
virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
+
virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const Storable::TRestoringMap& theMap, const std::string& thePrefix);
+ const Storable::TRestoringMap& theMap,
+ const std::string& thePrefix);
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const std::string& thePrefix, const Storable::TRestoringMap& theMap);
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap);
virtual void ToStream(std::ostringstream& theStr);
virtual const char* GetComment() const;
static const std::string myComment;
TInput* GetInput();
+
const std::string& GetName() const { return myName;}
const QFileInfo& GetFileInfo() const { return myFileInfo;}
- const Result_i::TSourceId& GetSourceId() const { return mySourceId;}
+ const std::string& GetFileName() const { return myInitFileName;}
+ const ECreationId& GetCreationId() const { return myCreationId;}
private:
SALOMEDS::SObject_var mySObject;
Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
}
+
+
#endif
#include "VISU_Result_i.hh"
#include "VISU_ScalarMap_i.hh"
#include "VISU_ScalarMapAct.h"
-#include "QAD_Config.h"
+#include "SUIT_ResourceMgr.h"
#include <vtkDataSetMapper.h>
#include <vtkTextProperty.h>
const string VISU::ScalarMap_i::myComment = "SCALARMAP";
const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
-
VISU::ScalarMap_i::
ScalarMap_i(Result_i* theResult,
bool theAddToStudy) :
DoHook();
// Orientation
- QString aOrient = QAD_CONFIG->getSetting("Visu:SBOrientation");
+ QString aOrient = VISU::GetResourceMgr()->stringValue("Visu:SBOrientation");
if ( !aOrient.isEmpty() )
myOrientation = (VISU::ScalarMap::Orientation) aOrient.toInt();
else
myOrientation = VISU::ScalarMap::VERTICAL;
// Scalar Bar origin
- QString aXorigin = QAD_CONFIG->getSetting("Visu:SBXorigin");
+ QString aXorigin = VISU::GetResourceMgr()->stringValue("Visu:SBXorigin");
if ( !aXorigin.isEmpty() )
myPosition[0] = aXorigin.toFloat();
else {
}
}
- QString aYorigin = QAD_CONFIG->getSetting("Visu:SBYorigin");
+ QString aYorigin = VISU::GetResourceMgr()->stringValue("Visu:SBYorigin");
if ( !aYorigin.isEmpty() )
myPosition[1] = aYorigin.toFloat();
else {
}
// Scalar Bar size
- QString aWidth = QAD_CONFIG->getSetting("Visu:SBWidth");
+ QString aWidth = VISU::GetResourceMgr()->stringValue("Visu:SBWidth");
if ( !aWidth.isEmpty() )
myWidth = aWidth.toFloat();
else {
myWidth =(myOrientation == VISU::ScalarMap::VERTICAL)? 0.17:0.6;
}
- QString aHeight = QAD_CONFIG->getSetting("Visu:SBHeight");
+ QString aHeight = VISU::GetResourceMgr()->stringValue("Visu:SBHeight");
if ( !aHeight.isEmpty() )
myHeight = aHeight.toFloat();
else {
}
// Nb of Colors
- QString aColors = QAD_CONFIG->getSetting("Visu:SBNumberOfColors");
+ QString aColors = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfColors");
int aNumberOfColors = (aColors.isEmpty())? 64 : aColors.toInt();
if (aNumberOfColors > 64)
aNumberOfColors = 64;
SetNbColors(aNumberOfColors);
// Nb of Labels
- QString aLabels = QAD_CONFIG->getSetting("Visu:SBNumberOfLabels");
+ QString aLabels = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfLabels");
myNumberOfLabels = (aLabels.isEmpty())? 5 : aLabels.toInt();
if (myNumberOfLabels > 65)
myNumberOfLabels = 65;
// Scalar Range
- QString aFixRange = QAD_CONFIG->getSetting("Visu:SBImposeRange");
+ QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
myIsFixedRange = (aFixRange.compare("true") == 0);
if(myIsFixedRange){
- QString aRangeMin = QAD_CONFIG->getSetting("Visu:SBMinimumValue");
+ QString aRangeMin = VISU::GetResourceMgr()->stringValue("Visu:SBMinimumValue");
float aMin = (aRangeMin.isEmpty())? 0 : aRangeMin.toFloat();
- QString aRangeMax = QAD_CONFIG->getSetting("Visu:SBMaximumValue");
+ QString aRangeMax = VISU::GetResourceMgr()->stringValue("Visu:SBMaximumValue");
float aMax = (aRangeMax.isEmpty())? 0 : aRangeMax.toFloat();
SetRange(aMin,aMax);
}
- QString aScaling = QAD_CONFIG->getSetting("Visu:SBScaling");
+ QString aScaling = VISU::GetResourceMgr()->stringValue("Visu:SBScaling");
if(aScaling.compare("LOGARITHMIC") == 0)
SetScaling(VISU::LOGARITHMIC);
else
SetScaling(VISU::LINEAR);
// Fonts properties definition
- QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
+ QString aIsBoldTitle = VISU::GetResourceMgr()->stringValue("Visu:IsBoldTitle");
myIsBoldTitle = (aIsBoldTitle.isEmpty())? true : (aIsBoldTitle.compare("true") == 0);
- QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
+ QString aIsItalicTitle = VISU::GetResourceMgr()->stringValue("Visu:IsItalicTitle");
myIsItalicTitle = (aIsItalicTitle.isEmpty())? true : (aIsItalicTitle.compare("true") == 0);
- QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
+ QString aIsShadowTitle = VISU::GetResourceMgr()->stringValue("Visu:IsShadowTitle");
myIsShadowTitle = (aIsShadowTitle.isEmpty())? true : (aIsShadowTitle.compare("true") == 0);
- QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
+ QString aTitFontType = VISU::GetResourceMgr()->stringValue("Visu:TitFontType");
if (!aTitFontType.isEmpty()) {
switch (aTitFontType.toInt()) {
case 0: myTitFontType = VTK_ARIAL; break;
} else {
myTitFontType = VTK_ARIAL;
}
- QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
+ QString aRTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorR");
myTitleColor[0] = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
if (myTitleColor[0] > 1) myTitleColor[0] = 1;
if (myTitleColor[0] < 0) myTitleColor[0] = 0;
- QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
+ QString aGTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorG");
myTitleColor[1] = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
if (myTitleColor[1] > 1) myTitleColor[1] = 1;
if (myTitleColor[1] < 0) myTitleColor[1] = 0;
- QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
+ QString aBTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorB");
myTitleColor[2] = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
if (myTitleColor[2] > 1) myTitleColor[2] = 1;
if (myTitleColor[2] < 0) myTitleColor[2] = 0;
///
- QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
+ QString aIsBoldLabel = VISU::GetResourceMgr()->stringValue("Visu:IsBoldLabel");
myIsBoldLabel = (aIsBoldLabel.isEmpty())? true : (aIsBoldLabel.compare("true") == 0);
- QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
+ QString aIsItalicLabel = VISU::GetResourceMgr()->stringValue("Visu:IsItalicLabel");
myIsItalicLabel = (aIsItalicLabel.isEmpty())? true : (aIsItalicLabel.compare("true") == 0);
- QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
+ QString aIsShadowLabel = VISU::GetResourceMgr()->stringValue("Visu:IsShadowLabel");
myIsShadowLabel = (aIsShadowLabel.isEmpty())? true : (aIsShadowLabel.compare("true") == 0);
- QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
+ QString aLblFontType = VISU::GetResourceMgr()->stringValue("Visu:LblFontType");
if (!aLblFontType.isEmpty()) {
switch (aLblFontType.toInt()) {
case 0: myLblFontType = VTK_ARIAL; break;
} else {
myLblFontType = VTK_ARIAL;
}
- QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
+ QString aRLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorR");
myLabelColor[0] = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
if (myLabelColor[0] > 1) myLabelColor[0] = 1;
if (myLabelColor[0] < 0) myLabelColor[0] = 0;
- QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
+ QString aGLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorG");
myLabelColor[1] = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
if (myLabelColor[1] > 1) myLabelColor[1] = 1;
if (myLabelColor[1] < 0) myLabelColor[1] = 0;
- QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
+ QString aBLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorB");
myLabelColor[2] = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
if (myLabelColor[2] > 1) myLabelColor[2] = 1;
if (myLabelColor[2] < 0) myLabelColor[2] = 0;
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
+ const std::string& GetMeshName() const { return myMeshName;}
+ VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
+ const string& GetFieldName() const { return myFieldName;}
+ int GetIteration() const { return myIteration;}
+
virtual void ToStream(std::ostringstream& theStr);
static const string myComment;
virtual void SetMapScale(double theMapScale = 1.0);
const VISU::PField GetField() const { return myField;}
- const string& GetFieldName() const { return myFieldName;}
virtual bool IsRangeFixed() { return myIsFixedRange; }
virtual void SetSourceRange();
#include "VISU_Table_i.hh"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Study.h"
-
#include "VISU_CutLines_i.hh"
#include "VISU_Result_i.hh"
+#include "SPlot2d_Curve.h"
+
#include <memory>
#include <fstream>
#include <strstream>
SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
// create SObject and set attributes
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TTABLE);
+ if(pCutLines)
+ aComment.sprintf("myComment=%s;myType=%d;mySourceId=CutLines",GetComment(),VISU::TTABLE);
+ else{
+ aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableAttr",GetComment(),VISU::TTABLE);
+ SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
+ if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aCommentAttr =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aCommentAttr->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(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;myType=%d;mySourceId=TableFile",GetComment(),VISU::TTABLE);
+ }
+ }
+ }
+ }
+
string anEntry = CreateAttributes( myStudy,
SO->GetID(),//SComponent->GetID(),
"",
/*!
Creates curve Plot2d presentation object
*/
-Plot2d_Curve* VISU::Curve_i::CreatePresentation()
+SPlot2d_Curve* VISU::Curve_i::CreatePresentation()
{
- Plot2d_Curve* crv = new Plot2d_Curve();
+ return NULL; // apo
+ SPlot2d_Curve* crv = new SPlot2d_Curve();
crv->setHorTitle( GetHorTitle().c_str() );
string tlt = GetTitle();
if ( tlt.length() <= 0 )
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
QFileInfo aFileInfo(theFileName);
aName->SetValue(aFileInfo.fileName().latin1());
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aFileObject, "AttributeComment");
+ SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ QString aString;
+ 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];
SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);
#define VISU_Table_i_HeaderFile
#include "VISU_PrsObject_i.hh"
-#include "Plot2d_Curve.h"
#include <qstringlist.h>
+class SPlot2d_Curve;
+
namespace VISU{
//==============================================================================
class Table_i : public virtual POA_VISU::Table,
protected:
VISU::Table::Orientation myOrientation;
- string myTitle;
+ std::string myTitle;
SALOMEDS::SObject_var mySObj;
public:
virtual Storable* Create();
+ SALOMEDS::SObject_var GetSObject() const { return mySObj;}
+
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO);
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap);
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual const char* GenerateName();
virtual const char* GetTableTitle();
VISU::Curve::MarkerType myMarker;
VISU::Curve::LineType myLine;
int myLineWidth;
- string myTitle;
+ std::string myTitle;
bool myAuto;
SALOMEDS::SObject_var mySObj;
public:
virtual Storable* Create();
+
+ int GetHRow() const { return myHRow;}
+ int GetVRow() const { return myVRow;}
+
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap);
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual const char* GenerateName();
virtual const char* GetTableID();
virtual CORBA::Boolean IsAuto() { return myAuto; }
virtual CORBA::Boolean IsValid();
- virtual string GetHorTitle();
- virtual string GetVerTitle();
- virtual string GetHorUnits();
- virtual string GetVerUnits();
+ virtual std::string GetHorTitle();
+ virtual std::string GetVerTitle();
+ virtual std::string GetHorUnits();
+ virtual std::string GetVerUnits();
virtual int GetData( double*& theHorList, double*& theVerList );
- virtual Plot2d_Curve* CreatePresentation();
+ virtual SPlot2d_Curve* CreatePresentation();
};
//==============================================================================
virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap);
+ const std::string& thePrefix,
+ const Storable::TRestoringMap& theMap);
virtual void ToStream( std::ostringstream& theStr );
- static const string myComment;
+ static const std::string myComment;
virtual const char* GetComment() const;
virtual const char* GenerateName();
// Module : VISU
#include "VISU_TimeAnimation.h"
+
+#include "VISUConfig.hh"
+
#include "VISU_Result_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Mesh_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
#include "VISU_ViewManager_i.hh"
+#include "VISU_View_i.hh"
+
#include "VISU_ScalarBarActor.hxx"
#include "VISU_Actor.h"
+#include "SalomeApp_Study.h"
+
+#include "SVTK_ViewWindow.h"
+
#include "SALOME_Event.hxx"
-#include "VTKViewer_ViewFrame.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Application.h"
+#include "SUIT_Session.h"
+#include "SUIT_Study.h"
-#include "QAD_Config.h"
+#include "SALOMEDSClient_AttributeComment.hxx"
+#include "SALOMEDSClient_AttributeName.hxx"
+
+#include <qpixmap.h>
using namespace std;
//************************************************************************
-VISU_TimeAnimation::VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D) {
+VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
+ VISU::View3D_ptr theView3D)
+{
myStudy = theStudy;
myIsActive = false;
myFrame = 0;
myProportional = false;
myView = 0;
- if(!CORBA::is_nil(theView3D)){
+ if (!CORBA::is_nil(theView3D)) {
VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
- QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
- myView = VISU::GetViewFrame(aStudyFrame);
+ //QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
+ //myView = VISU::GetViewFrame(aStudyFrame);
+ SUIT_ViewWindow* aVW = pView->myViewWindow;
+ myView = VISU::GetViewWindow(aVW);
}
myMaxVal = 0;
//************************************************************************
-VISU_TimeAnimation::~VISU_TimeAnimation() {
+VISU_TimeAnimation::~VISU_TimeAnimation()
+{
for (int i = 0; i < getNbFields(); i++) {
clearData(myFieldsLst[i]);
}
//************************************************************************
-void VISU_TimeAnimation::addField(SALOMEDS::SObject_ptr theField) {
+//void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
+void VISU_TimeAnimation::addField (_PTR(SObject) theField)
+{
+ FieldData aNewData;
+ //aNewData.myField = SALOMEDS::SObject::_duplicate(theField);
+ aNewData.myField = theField;
+ aNewData.myNbFrames = 0;
+ aNewData.myPrsType = VISU::TSCALARMAP;
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
+ aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
+ myFieldsLst.append(aNewData);
+
+ //find Min/Max timestamps
+ if ((myTimeMin == 0) && (myTimeMax == 0)) {
+ _PTR(ChildIterator) anIter = myStudy->NewChildIterator(theField);
+ anIter->Next(); // First is reference on support
+ myTimeMin = getTimeValue(anIter->Value());
+ for(; anIter->More(); anIter->Next()) {
+ myTimeMax = getTimeValue(anIter->Value());
+ }
+ }
+}
+
+//************************************************************************
+void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField)
+{
FieldData aNewData;
- aNewData.myField = SALOMEDS::SObject::_duplicate(theField);
+ //aNewData.myField = SALOMEDS::SObject::_duplicate(theField);
+ _PTR(SObject) aField = VISU::GetClientSObject(theField, myStudy);
+ aNewData.myField = aField;
aNewData.myNbFrames = 0;
aNewData.myPrsType = VISU::TSCALARMAP;
VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
//find Min/Max timestamps
if ((myTimeMin == 0) && (myTimeMax == 0)) {
- SALOMEDS::ChildIterator_var anIter = myStudy->NewChildIterator(theField);
- SALOMEDS::SObject_var aTimeStamp;
+ _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aField);
anIter->Next(); // First is reference on support
myTimeMin = getTimeValue(anIter->Value());
for(; anIter->More(); anIter->Next()) {
theData.myActors.clear();
}
if (!theData.myPrs.empty()) {
- for (int i = 0, iEnd = theData.myPrs.size(); i < iEnd; i++)
+ for (int i = 0, iEnd = theData.myPrs.size(); i < iEnd; i++)
if (theData.myPrs[i] != 0) {
theData.myPrs[i]->_remove_ref();
}
theData.myPrs.clear();
- }
+ }
theData.myNbFrames = 0;
myView->update();
}
// Delete previous presentations
clearData(aData);
- VISU::Result_i* pResult = createPresent(aData.myField);
+ VISU::Result_i* pResult = createPresent(aData.myField);
VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
aData.myNbFrames = aData.myNbTimes;
//VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
aData.myPrs.resize(aData.myNbTimes,NULL);
aData.myTiming.resize(aData.myNbTimes);
- SALOMEDS::ChildIterator_var anIter = myStudy->NewChildIterator(aData.myField);
- SALOMEDS::SObject_var aTimeStamp;
+ _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aData.myField);
+ _PTR(SObject) aTimeStamp;
anIter->Next(); // First is reference on support
long i = 0;
double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
- for(;anIter->More();anIter->Next()) {
+ for (; anIter->More(); anIter->Next()) {
if (i == aData.myNbTimes) {
MESSAGE("There are extra timestamps in field");
return;
}
aTimeStamp = anIter->Value();
- if (aTimeStamp->_is_nil()) continue;
+ if (!aTimeStamp) continue;
aData.myTiming[i] = getTimeValue(aTimeStamp);
if (isRangeDefined()) {
}
VISU::Storable::TRestoringMap aTimeMap = getMapOfValue(aTimeStamp);
- QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName");
- VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt();
- QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName");
- int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt();
-
+ QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName");
+ VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt();
+ QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName");
+ int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt();
+
switch (aData.myPrsType) {
case VISU::TSCALARMAP: // ScalarMap
{
VISU::ScalarMap_i* aPresent = new VISU::ScalarMap_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::ScalarMap_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
aData.myPrs[i] = aPresent;
}
break;
-
+
case VISU::TISOSURFACE: // Iso Surfaces
{
VISU::IsoSurfaces_i* aPresent = new VISU::IsoSurfaces_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::IsoSurfaces_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
aData.myPrs[i] = aPresent;
}
break;
-
+
case VISU::TCUTPLANES: // Cut Planes
{
VISU::CutPlanes_i* aPresent = new VISU::CutPlanes_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::CutPlanes_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
aData.myPrs[i] = aPresent;
}
break;
-
+
case VISU::TDEFORMEDSHAPE: // Deformed Shape
{
VISU::DeformedShape_i* aPresent = new VISU::DeformedShape_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::DeformedShape_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
aData.myPrs[i] = aPresent;
}
break;
-
+
case VISU::TVECTORS: // Vectors
{
VISU::Vectors_i* aPresent = new VISU::Vectors_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::Vectors_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
aData.myPrs[i] = aPresent;
}
break;
-
+
case VISU::TSTREAMLINES: // Stream Lines
{
VISU::StreamLines_i* aPresent = new VISU::StreamLines_i(pResult, false);
- aPresent->Create(aMeshName.latin1(), anEntity,
+ aPresent->Create(aMeshName.latin1(), anEntity,
aFieldName.latin1(), aTimeStampId);
//VISU::StreamLines_var aTmp = aPresent->_this();
//aPresent->_remove_ref();
i++;
}
aData.myNbFrames = i;
- QString aFixRange = QAD_CONFIG->getSetting("Visu:SBImposeRange");
+ QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
if (aFixRange.compare("true") != 0) {
- for (i = 0; i < aData.myNbFrames; i++)
+ for (i = 0; i < aData.myNbFrames; i++)
aData.myPrs[i]->SetRange(aMin, aMax);
if(aData.myPrsType == VISU::TISOSURFACE)
for (i = 0; i < aData.myNbFrames; i++)
aData.myActors[i]->RemoveFromRender(aRen);
aData.myActors[i]->Delete();
}
- }
+ }
aData.myActors.clear();
}
}
VISU::RepaintView(myView);
- //myView->update();
}
//************************************************************************
stopAnimation();
if (myFrame < (myFieldsLst[0].myNbFrames-1)) {
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame++;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
-
+
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
}
stopAnimation();
if (myFrame > 0) {
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame--;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- myFieldsLst[i].myActors[myFrame]->VisibilityOn();
-
+ myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
}
void VISU_TimeAnimation::firstFrame() {
stopAnimation();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if(!myFieldsLst[i].myActors.empty())
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = 0;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if(!myFieldsLst[i].myActors.empty())
if (myFieldsLst[i].myActors[myFrame] != 0)
- myFieldsLst[i].myActors[myFrame]->VisibilityOn();
+ myFieldsLst[i].myActors[myFrame]->VisibilityOn();
if(!myFieldsLst[0].myTiming.empty()){
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
void VISU_TimeAnimation::lastFrame() {
stopAnimation();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = myFieldsLst[0].myNbFrames-1;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
//************************************************************************
// For Batchmode using
void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) {
- if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
+ if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
return;
stopAnimation();
qApp->lock();
qApp->syncX();
int i;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOff();
myFrame = theFrame;
- for (i = 0; i < getNbFields(); i++)
+ for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
myView->Repaint();
- qApp->flushX();
+ qApp->flushX();
qApp->processEvents(3);
qApp->unlock();
}
//************************************************************************
-CORBA::Long VISU_TimeAnimation::getNbFrames() {
+CORBA::Long VISU_TimeAnimation::getNbFrames() {
return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0;
}
bool isDumping = !myDumpPath.isEmpty();
aOneVal = (myFieldsLst[0].myNbFrames > 2) ?
myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0] : 1;
- qApp->lock();
+ qApp->lock();
while (myIsActive) {
emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
for (int i = 0; i < getNbFields(); i++) {
FieldData& aData = myFieldsLst[i];
if (myFrame > 0) {
- if (aData.myActors[myFrame-1] != 0)
+ if (aData.myActors[myFrame-1] != 0)
aData.myActors[myFrame-1]->VisibilityOff();
- } else {
+ } else {
if (aData.myActors[aData.myNbFrames-1] != 0)
aData.myActors[aData.myNbFrames-1]->VisibilityOff();
}
}
myView->Repaint(false);
if (isDumping) {
- QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
+ QPixmap px = QPixmap::grabWindow(myView->winId());
QString aFile(myDumpPath);
QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]);
int aPos = -1;
switch (myFrame) {
case 0:
k=1;
- break;
+ break;
case 1:
if (myFieldsLst[0].myNbFrames > 2)
k = (myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal;
else
k = 1;
- break;
+ break;
default:
- k = (myFrame < (myFieldsLst[0].myNbFrames-1))?
+ k = (myFrame < (myFieldsLst[0].myNbFrames-1))?
(myFieldsLst[0].myTiming[myFrame+1] - myFieldsLst[0].myTiming[myFrame])/aOneVal : 1;
}
} else
}
//************************************************************************
-VISU::Result_i* VISU_TimeAnimation::createPresent(SALOMEDS::SObject_var theField) {
- SALOMEDS::SObject_var aSObj = theField->GetFather();
+//VISU::Result_i* VISU_TimeAnimation::createPresent (SALOMEDS::SObject_var theField)
+VISU::Result_i* VISU_TimeAnimation::createPresent (_PTR(SObject) theField)
+{
+ //SALOMEDS::SObject_var aSObj = theField->GetFather();
+ _PTR(SObject) aSObj = theField->GetFather();
aSObj = aSObj->GetFather();
aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return NULL;
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObj);
+ if (CORBA::is_nil(anObject)) return NULL;
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
-
//************************************************************************
-VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue(SALOMEDS::SObject_var theSObject) {
+//VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (SALOMEDS::SObject_var theSObject)
+VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) theSObject)
+{
VISU::Storable::TRestoringMap aMap;
- if(!theSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
+ //if (!theSObject->_is_nil()) {
+ if (theSObject) {
+ //SALOMEDS::GenericAttribute_var anAttr;
+ _PTR(GenericAttribute) anAttr;
if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aString = aComment->Value();
- QString strIn(aString.in());
- VISU::Storable::StrToMap(strIn,aMap);
+ //SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ _PTR(AttributeComment) aComment (anAttr);
+ //CORBA::String_var aString = aComment->Value();
+ std::string aString = aComment->Value();
+ //QString strIn (aString.in());
+ QString strIn (aString.c_str());
+ VISU::Storable::StrToMap(strIn, aMap);
}
}
return aMap;
}
//************************************************************************
-double VISU_TimeAnimation::getTimeValue(SALOMEDS::SObject_var theTimeStamp) {
- SALOMEDS::GenericAttribute_var anAttr;
- if(theTimeStamp->FindAttribute(anAttr, "AttributeName")) {
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- QString aNameString(aName->Value());
+//double VISU_TimeAnimation::getTimeValue (SALOMEDS::SObject_var theTimeStamp)
+double VISU_TimeAnimation::getTimeValue (_PTR(SObject) theTimeStamp)
+{
+ //SALOMEDS::GenericAttribute_var anAttr;
+ _PTR(GenericAttribute) anAttr;
+ if (theTimeStamp->FindAttribute(anAttr, "AttributeName")) {
+ //SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ _PTR(AttributeName) aName (anAttr);
+ //QString aNameString (aName->Value());
+ QString aNameString (aName->Value().c_str());
return aNameString.toDouble();
}
return -1.0;
}
-
+
//************************************************************************
-void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed) {
- mySpeed = (theSpeed<1)? 1 : theSpeed;
+void VISU_TimeAnimation::setSpeed(CORBA::Long theSpeed)
+{
+ mySpeed = (theSpeed<1)? 1 : theSpeed;
}
//========================================================================
-VISU_TimeAnimation_i::VISU_TimeAnimation_i(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D){
- myAnim = new VISU_TimeAnimation(theStudy,theView3D);
+VISU_TimeAnimation_i::VISU_TimeAnimation_i (SALOMEDS::Study_ptr theStudy,
+ VISU::View3D_ptr theView3D)
+{
+ //myAnim = new VISU_TimeAnimation (theStudy,theView3D);
+
+ std::string aStudyName = theStudy->Name();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ while (SUIT_Application* anApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyName == aCStudy->Name()) {
+ myAnim = new VISU_TimeAnimation (aCStudy, theView3D);
+ break;
+ }
+ }
+ }
+ }
+ }
}
-
-VISU_TimeAnimation_i::~VISU_TimeAnimation_i(){
+VISU_TimeAnimation_i::~VISU_TimeAnimation_i()
+{
delete myAnim;
}
-
-void VISU_TimeAnimation_i::addField(SALOMEDS::SObject_ptr theField){
+void VISU_TimeAnimation_i::addField (SALOMEDS::SObject_ptr theField)
+{
myAnim->addField(theField);
}
-
-CORBA::Boolean VISU_TimeAnimation_i::generateFrames(){
- return ProcessEvent(new TMemFunEvent<VISU_TimeAnimation,bool>(myAnim,&VISU_TimeAnimation::generateFrames));
+CORBA::Boolean VISU_TimeAnimation_i::generateFrames()
+{
+ return ProcessEvent(new TMemFunEvent<VISU_TimeAnimation,bool>
+ (myAnim,&VISU_TimeAnimation::generateFrames));
}
-
-void VISU_TimeAnimation_i::generatePresentations(CORBA::Long theFieldNum){
+void VISU_TimeAnimation_i::generatePresentations (CORBA::Long theFieldNum)
+{
myAnim->generatePresentations(theFieldNum);
}
-
-void VISU_TimeAnimation_i::clearView(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::clearView));
+void VISU_TimeAnimation_i::clearView()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::clearView));
}
-
-void VISU_TimeAnimation_i::stopAnimation(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::stopAnimation));
+void VISU_TimeAnimation_i::stopAnimation()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::stopAnimation));
}
-
-void VISU_TimeAnimation_i::startAnimation(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::startAnimation));
+void VISU_TimeAnimation_i::startAnimation()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::startAnimation));
}
-
-void VISU_TimeAnimation_i::nextFrame(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::nextFrame));
+void VISU_TimeAnimation_i::nextFrame()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::nextFrame));
}
-
-void VISU_TimeAnimation_i::prevFrame(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::prevFrame));
+void VISU_TimeAnimation_i::prevFrame()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::prevFrame));
}
-
-void VISU_TimeAnimation_i::firstFrame(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::firstFrame));
+void VISU_TimeAnimation_i::firstFrame()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::firstFrame));
}
-
-void VISU_TimeAnimation_i::lastFrame(){
- ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(myAnim,&VISU_TimeAnimation::lastFrame));
+void VISU_TimeAnimation_i::lastFrame()
+{
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>
+ (myAnim,&VISU_TimeAnimation::lastFrame));
}
-
-void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_TimeAnimation,CORBA::Long>(myAnim,&VISU_TimeAnimation::gotoFrame,theFrame));
+void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame)
+{
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_TimeAnimation,CORBA::Long>
+ (myAnim,&VISU_TimeAnimation::gotoFrame,theFrame));
}
-
-CORBA::Long VISU_TimeAnimation_i::getNbFields(){
+CORBA::Long VISU_TimeAnimation_i::getNbFields()
+{
return myAnim->getNbFields();
}
-
-CORBA::Long VISU_TimeAnimation_i::getNbFrames(){
+CORBA::Long VISU_TimeAnimation_i::getNbFrames()
+{
return myAnim->getNbFrames();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isRunning(){
+CORBA::Boolean VISU_TimeAnimation_i::isRunning()
+{
return myAnim->isRunning();
}
-
-CORBA::Long VISU_TimeAnimation_i::getCurrentFrame(){
+CORBA::Long VISU_TimeAnimation_i::getCurrentFrame()
+{
return myAnim->getCurrentFrame();
}
-
-VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation(CORBA::Long theField, CORBA::Long theFrame){
+VISU::ScalarMap_ptr VISU_TimeAnimation_i::getPresentation
+ (CORBA::Long theField, CORBA::Long theFrame)
+{
return myAnim->getPresentation(theField,theFrame);
}
-
-void VISU_TimeAnimation_i::setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType){
+void VISU_TimeAnimation_i::setPresentationType (CORBA::Long theFieldNum,
+ VISU::VISUType theType)
+{
myAnim->setPresentationType(theFieldNum,theType);
}
-
-VISU::VISUType VISU_TimeAnimation_i::getPresentationType(CORBA::Long theFieldNum){
+VISU::VISUType VISU_TimeAnimation_i::getPresentationType (CORBA::Long theFieldNum)
+{
return myAnim->getPresentationType(theFieldNum);
}
-
-void VISU_TimeAnimation_i::setSpeed(CORBA::Long theSpeed){
+void VISU_TimeAnimation_i::setSpeed(CORBA::Long theSpeed)
+{
myAnim->setSpeed(theSpeed);
}
-
-CORBA::Long VISU_TimeAnimation_i::getSpeed(){
+CORBA::Long VISU_TimeAnimation_i::getSpeed()
+{
return myAnim->getSpeed();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isProportional(){
+CORBA::Boolean VISU_TimeAnimation_i::isProportional()
+{
return myAnim->isProportional();
}
-
-void VISU_TimeAnimation_i::setAnimationRange(CORBA::Double theMin, CORBA::Double theMax){
+void VISU_TimeAnimation_i::setAnimationRange (CORBA::Double theMin,
+ CORBA::Double theMax)
+{
myAnim->setAnimationRange(theMin,theMax);
}
-
-CORBA::Double VISU_TimeAnimation_i::getMinRange(){
+CORBA::Double VISU_TimeAnimation_i::getMinRange()
+{
return myAnim->getMinRange();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMaxRange(){
+CORBA::Double VISU_TimeAnimation_i::getMaxRange()
+{
return myAnim->getMaxRange();
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isRangeDefined(){
+CORBA::Boolean VISU_TimeAnimation_i::isRangeDefined()
+{
return myAnim->isRangeDefined();
}
-
-void VISU_TimeAnimation_i::dumpTo(const char* thePath){
+void VISU_TimeAnimation_i::dumpTo (const char* thePath)
+{
myAnim->dumpTo(thePath);
}
-
-CORBA::Boolean VISU_TimeAnimation_i::isCycling(){
+CORBA::Boolean VISU_TimeAnimation_i::isCycling()
+{
return myAnim->isCycling();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMinTime(){
+CORBA::Double VISU_TimeAnimation_i::getMinTime()
+{
return myAnim->getMinTime();
}
-
-CORBA::Double VISU_TimeAnimation_i::getMaxTime(){
+CORBA::Double VISU_TimeAnimation_i::getMaxTime()
+{
return myAnim->getMaxTime();
}
-
-void VISU_TimeAnimation_i::setProportional(CORBA::Boolean theProp){
+void VISU_TimeAnimation_i::setProportional (CORBA::Boolean theProp)
+{
myAnim->setProportional(theProp);
}
-
-void VISU_TimeAnimation_i::setCycling(CORBA::Boolean theCycle){
+void VISU_TimeAnimation_i::setCycling (CORBA::Boolean theCycle)
+{
myAnim->setCycling(theCycle);
}
-
-
#include <qvaluelist.h>
#include <qthread.h>
-class VTKViewer_ViewFrame;
+class SVTK_ViewWindow;
class VISU_Actor;
namespace VISU{
struct FieldData
{
VISU::VISUType myPrsType;
- SALOMEDS::SObject_var myField; // field label
+ //SALOMEDS::SObject_var myField; // field label
+ _PTR(SObject) myField; // field label
long myNbTimes; // number of Timestamps
long myNbFrames; // number of created Frames
std::vector<VISU::ScalarMap_i*> myPrs; // Presentations
{
Q_OBJECT;
public:
- static VISU::Result_i* createPresent(SALOMEDS::SObject_var theField);
- static VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject);
- static double getTimeValue(SALOMEDS::SObject_var theTimestamp);
+ //static VISU::Result_i* createPresent (SALOMEDS::SObject_var theField);
+ //static VISU::Storable::TRestoringMap getMapOfValue (SALOMEDS::SObject_var theSObject);
+ //static double getTimeValue (SALOMEDS::SObject_var theTimestamp);
- VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy, VISU::View3D_ptr theView3D = VISU::View3D::_nil());
+ static VISU::Result_i* createPresent (_PTR(SObject) theField);
+ static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject);
+ static double getTimeValue (_PTR(SObject) theTimestamp);
+
+ //VISU_TimeAnimation(SALOMEDS::Study_ptr theStudy,
+ VISU_TimeAnimation(_PTR(Study) theStudy,
+ VISU::View3D_ptr theView3D = VISU::View3D::_nil());
~VISU_TimeAnimation();
virtual VISU::VISUType GetType() { return VISU::TNONE;};
- void addField(SALOMEDS::SObject_ptr theField);
- FieldData& getFieldData(int theNum) { return myFieldsLst[theNum]; }
+ void addField (_PTR(SObject) theField);
+ void addField (SALOMEDS::SObject_ptr theField);
+ FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; }
CORBA::Boolean generateFrames();
void generatePresentations(CORBA::Long theFieldNum);
- void setViewer(VTKViewer_ViewFrame* theView) { myView = theView; }
- VTKViewer_ViewFrame* getViewer() { return myView; }
+ void setViewer(SVTK_ViewWindow* theView) { myView = theView; }
+ SVTK_ViewWindow* getViewer() { return myView; }
void clearView();
void clearData(FieldData& theData);
int mySpeed;
bool myProportional;
bool myCycling;
- SALOMEDS::Study_var myStudy;
+ //SALOMEDS::Study_var myStudy;
+ _PTR(Study) myStudy;
double myMaxVal, myMinVal;
double myTimeMin, myTimeMax;
QString myDumpPath;
- VTKViewer_ViewFrame* myView;
+ SVTK_ViewWindow* myView;
};
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_ViewManager_i.cc
// Module : VISU
#include "VISU_ViewManager_i.hh"
-
-#include "VISU_PrsObject_i.hh"
-#include "VISU_Result_i.hh"
-#include "VISU_Gen_i.hh"
-
+#include "VISU_View_i.hh"
#include "VISU_Prs3d_i.hh"
-#include "VISU_Mesh_i.hh"
-#include "VISU_ScalarMap_i.hh"
-#include "VISU_IsoSurfaces_i.hh"
-#include "VISU_DeformedShape_i.hh"
-#include "VISU_CutPlanes_i.hh"
-#include "VISU_CutLines_i.hh"
-#include "VISU_Vectors_i.hh"
-#include "VISU_StreamLines_i.hh"
-
#include "VISU_Table_i.hh"
-#include "VISU_ScalarBarActor.hxx"
-#include "VISU_Actor.h"
-#include "SALOME_Event.hxx"
+#include "VISU_Actor.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Tools.h"
-#include "QAD_Study.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_StudyFrame.h"
-#include "QAD_PyEditor.h"
+#include "SUIT_Tools.h"
+#include "SUIT_Session.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-#include "SALOMEGUI_TableDlg.h"
-#include "Plot2d_CurveContainer.h"
+#include "SVTK_RenderWindow.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SPlot2d_Curve.h"
#include "Plot2d_ViewFrame.h"
+#include "Plot2d_ViewModel.h"
-#include <memory>
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
-#include <qstring.h>
-#include <qfileinfo.h>
+#include "SALOME_Event.hxx"
-#include <vtkRenderer.h>
#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
using namespace std;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
-static QFileInfo aFileInfo;
+namespace VISU {
-namespace VISU{
- //===========================================================================
- typedef TVoidMemFunEvent<QAD_StudyFrame> TFrameActionEvent;
+ struct TNewViewManagerEvent: public SALOME_Event
+ {
+ std::string myStudyName;
+ typedef SalomeApp_Application* TResult;
+ TResult myResult;
- template<class TObject>
- class TSetBackgroundEvent: public SALOME_Event{
- TObject* myView;
- const SALOMEDS::Color& myColor;
- public:
- TSetBackgroundEvent(TObject* theView, const SALOMEDS::Color& theColor):
- myView(theView), myColor(theColor)
+ TNewViewManagerEvent(const char* theStudyName):
+ myStudyName(theStudyName),
+ myResult(NULL)
{}
- virtual void Execute(){
- int aColor[3];
- aColor[0] = int(255.0*myColor.R);
- aColor[1] = int(255.0*myColor.G);
- aColor[2] = int(255.0*myColor.B);
- QColor aNewColor(aColor[0],aColor[1],aColor[2]);
- myView->setBackgroundColor(aNewColor);
+
+ virtual
+ void
+ Execute()
+ {
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter(anApplications);
+ while(SUIT_Application* anApp = anIter.current()){
+ ++anIter;
+ if(SUIT_Study* aSStudy = anApp->activeStudy()){
+ if(SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)){
+ if(_PTR(Study) aCStudy = aStudy->studyDS()){
+ if(myStudyName == aCStudy->Name()){
+ myResult = dynamic_cast<SalomeApp_Application*>(anApp);
+ break;
+ }
+ }
+ }
+ }
+ }
}
};
- class TSetViewRepresentation: public SALOME_Event{
- VISU::View::ViewRepresentation myViewRepr;
- View_i* myView;
- CORBA::Boolean myState;
- public:
- TSetViewRepresentation( View_i* aView,
- VISU::View::ViewRepresentation ViewRepr,
- CORBA::Boolean State ):
- SALOME_Event(), myViewRepr( ViewRepr ), myView( aView ), myState( State )
- {}
- virtual void Execute(){
+ //===========================================================================
+ ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy)
+ {
+ if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i - "<<this);
- bool old = myView->IsPartShown( myViewRepr );
+ CORBA::String_var aStudyName = theStudy->Name();
+ myApplication = ProcessEvent(new TNewViewManagerEvent(aStudyName.in()));
+ }
- QAD_RightFrame* fr = myView->myStudyFrame->getRightFrame();
- if( myView->myStudyFrame != NULL ){
- switch( myViewRepr )
- {
- case VISU::View::OBJECTBROWSER:
- if( myState!=old )
- if( myState )
- myView->myStudyFrame->unCompressLeft();
- else
- myView->myStudyFrame->compressLeft();
- break;
- case VISU::View::VIEWER:
- if( myState!=old )
- if( myState )
- fr->unCompressUp();
- else
- fr->compressUp();
- break;
- case VISU::View::PYTHON:
- if( myState!=old )
- if( myState )
- fr->unCompressLeft();
- else
- fr->compressLeft();
- break;
- case VISU::View::MESSAGES:
- if( myState!=old )
- if( myState )
- fr->unCompressRight();
- else
- fr->compressRight();
- break;
- };
- }
+ ViewManager_i::~ViewManager_i()
+ {
+ if(MYDEBUG) MESSAGE("ViewManager_i::~ViewManager_i - "<<this);
}
-};
- class TGetViewRepresentation: public SALOME_Event
+
+ struct TCurrentViewEvent: public SALOME_Event
{
- public:
- typedef CORBA::Boolean TResult;
+ const SalomeApp_Application* myApplication;
+ typedef VISU::View_ptr TResult;
TResult myResult;
- VISU::View::ViewRepresentation myPart;
- View_i* myView;
- TGetViewRepresentation( View_i* aView, VISU::View::ViewRepresentation Part ):
- SALOME_Event(), myResult( false ), myPart( Part ), myView( aView )
- {
- }
- virtual void Execute(){
- switch( myPart )
- {
- case VISU::View::OBJECTBROWSER:
- myResult = !myView->myStudyFrame->isCompressedLeft();
- break;
- case VISU::View::VIEWER:
- myResult = !myView->myStudyFrame->getRightFrame()->isCompressedViewFrame();
- break;
- case VISU::View::PYTHON:
- myResult = !myView->myStudyFrame->getRightFrame()->isCompressedPython();
- break;
- case VISU::View::MESSAGES:
- myResult = !myView->myStudyFrame->getRightFrame()->isCompressedMessage();
- }
- }
+ TCurrentViewEvent(const SalomeApp_Application* theApplication):
+ myApplication(theApplication),
+ myResult(VISU::View::_nil())
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ //if (SUIT_ViewManager *aViewManager = myApplication->activeViewManager()) {
+ // if (aViewManager->getType() == "VTKViewer") {
+ // if (SUIT_ViewWindow *aViewWindow = aViewManager->getActiveView()) {
+ VISU::View3D_i* pView =
+ new View3D_i ((SalomeApp_Application*)myApplication);
+ if (pView->Create(0))
+ myResult = pView->_this();
+ // }
+ // }
+ //}
+ }
};
- class TSetViewWidthHeight: public SALOME_Event{
- CORBA::Long mySize;
- bool myIsWidth;
- View_i* myView;
- public:
- TSetViewWidthHeight( View_i* aView, CORBA::Long Size, bool IsWidth ):
- SALOME_Event(), mySize( Size ), myView( aView ), myIsWidth( IsWidth )
- {}
- virtual void Execute(){
- if( myView->myStudyFrame != NULL ){
- QWidget* aStudyParent = myView->myStudyFrame->parentWidget(true);
- int aleft = aStudyParent->frameGeometry().left();
- int atop = aStudyParent->frameGeometry().top();
- int aheight = aStudyParent->frameGeometry().height();
- int awidth = aStudyParent->frameGeometry().width();
- QRect aQRect;
- if( myIsWidth )
- aQRect = QRect( aleft, atop, mySize, aheight );
- else
- aQRect = QRect( aleft, atop, awidth, mySize );
+ VISU::View_ptr ViewManager_i::GetCurrentView(){
+ return ProcessEvent(new TCurrentViewEvent(myApplication));
+ }
- aStudyParent->setGeometry(aQRect);
- }
- }
- };
- class TGetViewWidthHeight: public SALOME_Event{
- public:
- typedef CORBA::Long TResult;
+ template<class TViewFrame>
+ struct TCreateViewFrameEvent: public SALOME_Event
+ {
+ //const SUIT_Application* myApplication;
+ SalomeApp_Application* myApplication;
+ typedef typename TViewFrame::TInterface TInterface;
+ typedef typename TInterface::_ptr_type TResult;
TResult myResult;
- bool myIsWidth;
- View_i* myView;
- public:
- TGetViewWidthHeight( View_i* aView, bool IsWidth ):
- SALOME_Event(), myView( aView ), myIsWidth( IsWidth )
- {}
-
- virtual void Execute()
- {
- if( myView ) {
- QWidget* aStudyParent = myView->myStudyFrame->parentWidget(true);
- if( myIsWidth )
- myResult = aStudyParent->frameGeometry().width();
- else
- myResult = aStudyParent->frameGeometry().height();
- }
- }
- };
- class TSetViewPositionHorizontal: public SALOME_Event{
- VISU::View::ViewPosition myViewPos;
- View_i* myView;
- public:
- TSetViewPositionHorizontal ( View_i* aView,
- VISU::View::ViewPosition ViewPos ):
- SALOME_Event(), myView( aView ), myViewPos(ViewPos)
+ //TCreateViewFrameEvent (const SUIT_Application* theApplication):
+ TCreateViewFrameEvent (SalomeApp_Application* theApplication):
+ myApplication(theApplication),
+ myResult(TInterface::_nil())
{}
- virtual void Execute(){
- QWidget* aWorkspace = dynamic_cast <QWidget*> (myView->myStudy->getApp()->getDesktop()->getMainFrame());
- QWidget* aStudy = dynamic_cast <QWidget*> (myView->myStudyFrame);
- QWidget* aStudyParent = aStudy->parentWidget(true);
- if ( aStudyParent != 0 )
- if ( aWorkspace!=NULL || aStudy != NULL )
- switch(myViewPos){
- case VISU::View::LEFT:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignLeft);
- break;
- case VISU::View::CENTER:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignHCenter);
- break;
- case VISU::View::RIGHT:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignRight);
- break;
- }
- }
- };
- class TSetViewPositionVertical: public SALOME_Event{
- VISU::View::ViewPosition myViewPos;
- View_i* myView;
- public:
- TSetViewPositionVertical ( View_i* aView,
- VISU::View::ViewPosition ViewPos ):
- SALOME_Event(), myView( aView ), myViewPos(ViewPos)
- {}
- virtual void Execute(){
- QWidget* aWorkspace = dynamic_cast <QWidget*> (myView->myStudy->getApp()->getDesktop()->getMainFrame());
- QWidget* aStudy = dynamic_cast <QWidget*>(myView->myStudyFrame);
- QWidget* aStudyParent = aStudy->parentWidget(true);
- if ( aStudyParent != 0 )
- if ( aWorkspace!=NULL || aStudy != NULL )
- switch(myViewPos){
- case VISU::View::TOP:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignTop);
- break;
- case VISU::View::CENTER:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignVCenter);
- break;
- case VISU::View::BOTTOM:
- QAD_Tools::alignWidget(aStudyParent,aWorkspace,Qt::AlignBottom);
- break;
- }
+ virtual
+ void
+ Execute()
+ {
+ //if (CheckStudy(myStudyDocument)){
+ TViewFrame* pView = new TViewFrame (myApplication);
+ if (pView->Create(1))
+ myResult = pView->_this();
+ //}
}
};
- class TSetRelativePosition : public SALOME_Event
+
+ VISU::View3D_ptr ViewManager_i::Create3DView()
+ {
+ if (MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
+ return ProcessEvent(new TCreateViewFrameEvent<View3D_i>(myApplication));
+ }
+
+ VISU::XYPlot_ptr ViewManager_i::CreateXYPlot()
+ {
+ if (MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
+ return ProcessEvent(new TCreateViewFrameEvent<XYPlot_i>(myApplication));
+ }
+
+ class TCreateViewEvent: public SALOME_Event
{
- View_i* myView;
- CORBA::Double myX, myY;
public:
- TSetRelativePosition ( View_i* aView, CORBA::Double X, CORBA::Double Y ):
- SALOME_Event(), myView( aView ), myX( X ), myY( Y )
+ TCreateViewEvent (SalomeApp_Application* theApplication)
+ : myApplication(theApplication)
{}
- virtual void Execute(){
- QWidget* aWorkspace = dynamic_cast <QWidget*> (myView->myStudy->getApp()->getDesktop()->getMainFrame());
- if( aWorkspace )
- {
- QAD_StudyFrame* aFrame = myView->myStudyFrame;
- QWidget* aStudyParent = aFrame->parentWidget(true);
- aStudyParent->move( int( myX * aWorkspace->width() ), int( myY * aWorkspace->height() ) );
- }
- }
+ protected:
+ SalomeApp_Application* myApplication;
};
- class TSetRelativeSize : public SALOME_Event
+ class TCreateTableViewFrameEvent: public TCreateViewEvent
{
- View_i* myView;
- CORBA::Double myX, myY;
+ Table_ptr myTable;
public:
- TSetRelativeSize ( View_i* aView, CORBA::Double X, CORBA::Double Y ):
- SALOME_Event(), myView( aView ), myX( X ), myY( Y )
+ TCreateTableViewFrameEvent (SalomeApp_Application* theApplication,
+ Table_ptr theTable):
+ TCreateViewEvent(theApplication),
+ myTable(theTable),
+ myResult(VISU::TableView::_nil())
{}
- virtual void Execute(){
- QWidget* aWorkspace = dynamic_cast <QWidget*> (myView->myStudy->getApp()->getDesktop()->getMainFrame());
- if( aWorkspace )
- {
- QAD_StudyFrame* aFrame = myView->myStudyFrame;
- QWidget* aStudyParent = aFrame->parentWidget(true);
- aStudyParent->setGeometry( aStudyParent->x(), aStudyParent->y(),
- int( myX * aWorkspace->width() ), int( myY * aWorkspace->height() ) );
- }
+
+ virtual void Execute()
+ {
+ //if (CheckStudy(myStudyDocument)) {
+ VISU::TableView_i* pView = new TableView_i (myApplication);
+ if (pView->Create(myTable) != NULL)
+ myResult = pView->_this();
+ //}
}
+ typedef VISU::TableView_ptr TResult;
+ TResult myResult;
};
+ VISU::TableView_ptr ViewManager_i::CreateTableView (VISU::Table_ptr theTable)
+ {
+ if (MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
+ //return ProcessEvent(new TCreateViewFrameEvent<TableView_i>(myApplication));
+ return ProcessEvent(new TCreateTableViewFrameEvent (myApplication, theTable));
+ }
-
- class TSavePictureEvent: public SALOME_Event{
- QWidget* myWidget;
- const char* myFileName;
- public:
- typedef CORBA::Boolean TResult;
- TResult myResult;
- TSavePictureEvent(QWidget* theWidget, const char* theFileName):
- myWidget(theWidget),
- myFileName(theFileName),
- myResult(false)
- {}
- virtual void Execute(){
- if(myWidget){
- QPixmap px = QPixmap::grabWindow(myWidget->winId());
- if (!QString(myFileName).isNull()) {
- QString fmt = QAD_Tools::getFileExtensionFromPath(myFileName).upper();
- if (fmt.isEmpty())
- fmt = QString("BMP"); // default format
- if (fmt == "JPG")
- fmt = "JPEG";
- myResult = px.save(myFileName, fmt.latin1());
+ void ViewManager_i::Destroy (View_ptr theView)
+ {
+ class TEvent: public SALOME_Event {
+ View_ptr myView;
+ public:
+ TEvent(View_ptr theView):
+ myView(theView)
+ {}
+ virtual void Execute(){
+ if (!CORBA::is_nil(myView)) {
+ if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(myView).in())) {
+ pView->Close();
+ pView->_remove_ref();
+ }
}
}
- }
- };
-
-
- void RepaintView(QAD_StudyFrame* theStudyFrame);
- class TRepaintViewEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- public:
- TRepaintViewEvent(QAD_StudyFrame* theStudyFrame):
- myStudyFrame(theStudyFrame)
- {}
- virtual void Execute(){
- RepaintView(myStudyFrame);
- }
- };
-
+ };
- VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame){
- return dynamic_cast<VTKViewer_ViewFrame*>(theStudyFrame->getRightFrame()->getViewFrame());
- }
- vtkRenderer* GetRenderer(QAD_StudyFrame* theStudyFrame){
- return GetViewFrame(theStudyFrame)->getRenderer();
- }
- vtkCamera* GetCamera(QAD_StudyFrame* theStudyFrame){
- return GetRenderer(theStudyFrame)->GetActiveCamera();
+ if (MYDEBUG) MESSAGE("ViewManager_i::Destroy - " << theView->_is_nil());
+ ProcessVoidEvent(new TEvent(theView));
}
+ //===========================================================================
+ // VISU namespace functions
+ //===========================================================================
+ SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame)
+ {
+ return dynamic_cast<SVTK_ViewWindow*>(theStudyFrame);
+ }
- void RepaintView(VTKViewer_ViewFrame* theViewFrame){
- theViewFrame->getRenderer()->ResetCameraClippingRange();
- theViewFrame->getRW()->getRenderWindow()->Render();
- //GetViewFrame(theStudyFrame)->Repaint();
+ vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame)
+ {
+ return GetViewWindow(theStudyFrame)->getRenderer();
}
- void RepaintView(QAD_StudyFrame* theStudyFrame){
- RepaintView(GetViewFrame(theStudyFrame));
+ vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame)
+ {
+ return GetRenderer(theStudyFrame)->GetActiveCamera();
}
+ void RepaintView (SUIT_ViewWindow* theViewWindow)
+ {
+ SVTK_ViewWindow* vf = GetViewWindow(theViewWindow);
+ vf->getRenderer()->ResetCameraClippingRange();
+ vf->getRenderWindow()->getRenderWindow()->Render();
+ }
- VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs){
- VTKViewer_ViewFrame* vf = GetViewFrame(theStudyFrame);
+ VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs)
+ {
+ SVTK_ViewWindow* vf = GetViewWindow(theStudyFrame);
if (!vf) return NULL;
if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
vtkRenderer *aRen = vf->getRenderer();
vtkActor *anActor;
VISU_Actor *anVISUActor = NULL, *aResActor = NULL;
for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
- if(anActor->IsA("VISU_Actor")){
+ if(anActor->IsA("VISU_Actor")){
anVISUActor = VISU_Actor::SafeDownCast(anActor);
if (thePrs == anVISUActor->GetPrs3d()) {
aResActor = anVISUActor->GetParent();
anVISUActor->VisibilityOff();
else
anVISUActor->VisibilityOn();
- }
+ }
}
}
if (aResActor) {
RepaintView(theStudyFrame);
return anVISUActor;
}
- void UpdatePlot2d(Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve) {
- if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = "<<theDisplaying);
- if ( !theView )
+
+ void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve)
+ {
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying);
+ if (!theView)
return;
QList<Plot2d_Curve> clist;
- theView->getCurves( clist );
- if ( theDisplaying == eEraseAll ) {
- for ( int i = 0; i < clist.count(); i++ ) {
- if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - "<<clist.at( i ));
- theView->eraseCurve( clist.at( i ) );
- }
- }
- else if ( theDisplaying == eErase ) {
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - "<<clist.at( i ) );
- theView->eraseCurve( clist.at( i ) );
- }
+ theView->getCurves(clist);
+ if (theDisplaying == eEraseAll) {
+ for (int i = 0; i < clist.count(); i++) {
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing all : curve - " << clist.at(i));
+ theView->eraseCurve(clist.at(i));
}
- }
- else if ( theDisplaying == eDisplay ) {
- bool bFound = false;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - "<<clist.at( i ) );
- clist.at( i )->setHorTitle( theCurve->GetHorTitle().c_str() );
- clist.at( i )->setVerTitle( theCurve->GetVerTitle().c_str() );
- clist.at( i )->setHorUnits( theCurve->GetHorUnits().c_str() );
- clist.at( i )->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- clist.at( i )->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- clist.at( i )->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- clist.at( i )->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- clist.at( i )->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+ } else if (theDisplaying == eErase) {
+ if (theCurve) {
+ for (int i = 0; i < clist.count(); i++) {
+ SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (aSPlot2dC->hasIO() &&
+ !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC);
+ theView->eraseCurve(aSPlot2dC);
}
- clist.at( i )->setAutoAssign( theCurve->IsAuto() );
- theView->displayCurve( clist.at( i ) );
- bFound = true;
}
}
- if ( !bFound ) {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
- if ( crv ) {
- theView->displayCurve( crv );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- else if ( theDisplaying == eDisplayOnly ) {
- bool bFound = false;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( theCurve && clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - "<<clist.at( i ) );
- clist.at( i )->setHorTitle( theCurve->GetHorTitle().c_str() );
- clist.at( i )->setVerTitle( theCurve->GetVerTitle().c_str() );
- clist.at( i )->setHorUnits( theCurve->GetHorUnits().c_str() );
- clist.at( i )->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- clist.at( i )->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- clist.at( i )->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- clist.at( i )->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- clist.at( i )->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
+ } else if (theDisplaying == eDisplay) {
+ if (theCurve) {
+ bool bFound = false;
+ for (int i = 0; i < clist.count(); i++) {
+ SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (aSPlot2dC->hasIO() &&
+ !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);
+ aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
+ aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
+ aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
+ aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
+ double* xList = 0;
+ double* yList = 0;
+ int nbPoints = theCurve->GetData( xList, yList );
+ if (nbPoints > 0 && xList && yList) {
+ aSPlot2dC->setData( xList, yList, nbPoints );
+ }
+ if (!theCurve->IsAuto()) {
+ aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(),
+ theCurve->GetLineWidth());
+ aSPlot2dC->setMarker((Plot2d_Curve::MarkerType)theCurve->GetMarker());
+ SALOMEDS::Color color = theCurve->GetColor();
+ aSPlot2dC->setColor(QColor((int)(color.R*255.),
+ (int)(color.G*255.),
+ (int)(color.B*255.)));
+ }
+ aSPlot2dC->setAutoAssign(theCurve->IsAuto());
+ theView->displayCurve(aSPlot2dC);
+ bFound = true;
}
- clist.at( i )->setAutoAssign( theCurve->IsAuto() );
- theView->displayCurve( clist.at( i ) );
- bFound = true;
}
- else {
- theView->eraseCurve( clist.at( i ) );
- }
- }
- if ( !bFound ) {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - "<<crv );
- if ( crv ) {
- theView->displayCurve( crv );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
+ if (!bFound) {
+ Plot2d_Curve* crv = theCurve->CreatePresentation();
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<<crv );
+ if (crv) {
+ theView->displayCurve( crv );
+ theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
+ theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
+ SALOMEDS::Color newColor;
+ newColor.R = crv->getColor().red()/255.;
+ newColor.G = crv->getColor().green()/255.;
+ newColor.B = crv->getColor().blue()/255.;
+ theCurve->SetColor( newColor );
+ crv->setAutoAssign( theCurve->IsAuto() );
+ }
}
}
- }
- }
-
- QAD_Study* CheckStudy( SALOMEDS::Study_ptr theStudy ) {
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- QAD_Study* aStudy = aDesktop->findStudy(theStudy);
- if(!aStudy){
- CORBA::String_var aName = theStudy->Name();
- aFileInfo.setFile(aName.in());
- if (aFileInfo.exists())
- aStudy = aDesktop->loadStudy(aFileInfo.baseName());
- else
- aStudy = aDesktop->loadStudy(aName.in());
- if (!aStudy) {
- MESSAGE("CheckStudy()::ERROR: Can't load study");
- }
- }
- return aStudy;
- }
- //===========================================================================
- ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy) {
- if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i");
- myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- }
-
-
- class TGetCurrentViewEvent: public SALOME_Event{
- SALOMEDS::Study_ptr myStudyDocument;
- public:
- TGetCurrentViewEvent( SALOMEDS::Study_ptr theStudy):
- myStudyDocument(theStudy),
- myResult(VISU::View::_nil())
- {}
- virtual void Execute(){
- if(QAD_Study* aStudy = QAD_Application::getDesktop()->findStudy( myStudyDocument )){
- if ( QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame() ) {
- if(MYDEBUG)
- MESSAGE("GetCurrentView::Execute - TypeView = "<<aStudyFrame->getTypeView());
- if ( aStudyFrame->getTypeView() == VIEW_VTK ) {
- VISU::View3D_i* pView = new View3D_i(myStudyDocument);
- if(pView->Create(0))
- myResult = pView->_this();
- } else if ( aStudyFrame->getTypeView() == VIEW_PLOT2D ) {
- VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
- if(pView->Create(0))
- myResult = pView->_this();
+ } else if (theDisplaying == eDisplayOnly) {
+ if (theCurve) {
+ bool bFound = false;
+ for (int i = 0; i < clist.count(); i++) {
+ SPlot2d_Curve* aSPlot2dC = dynamic_cast<SPlot2d_Curve*>(clist.at(i));
+ if (aSPlot2dC->hasIO() &&
+ !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) {
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC);
+ aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() );
+ aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() );
+ aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() );
+ aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
+ double* xList = 0;
+ double* yList = 0;
+ int nbPoints = theCurve->GetData( xList, yList );
+ if ( nbPoints > 0 && xList && yList ) {
+ aSPlot2dC->setData( xList, yList, nbPoints );
+ }
+ if ( !theCurve->IsAuto() ) {
+ aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth());
+ aSPlot2dC->setMarker((Plot2d_Curve::MarkerType)theCurve->GetMarker());
+ SALOMEDS::Color color = theCurve->GetColor();
+ aSPlot2dC->setColor(QColor((int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.)));
+ }
+ aSPlot2dC->setAutoAssign(theCurve->IsAuto());
+ theView->displayCurve(aSPlot2dC);
+ bFound = true;
+ } else {
+ theView->eraseCurve(aSPlot2dC);
}
}
- }
- }
- typedef VISU::View_ptr TResult;
- TResult myResult;
- };
-
- VISU::View_ptr ViewManager_i::GetCurrentView(){
- return ProcessEvent(new TGetCurrentViewEvent( myStudyDocument ));
- }
-
-
- class TCreateViewEvent: public SALOME_Event{
- public:
- TCreateViewEvent( SALOMEDS::Study_ptr theStudy):
- myStudyDocument(theStudy)
- {};
- protected:
- SALOMEDS::Study_ptr myStudyDocument;
- };
-
-
- template<class TViewFrame>
- class TCreateViewFrameEvent: public TCreateViewEvent{
- public:
- typedef typename TViewFrame::TInterface TInterface;
- typedef typename TInterface::_ptr_type TResult;
- TResult myResult;
- TCreateViewFrameEvent(SALOMEDS::Study_ptr theStudy):
- TCreateViewEvent(theStudy),
- myResult(TInterface::_nil())
- {}
- virtual void Execute(){
- if(CheckStudy(myStudyDocument)){
- TViewFrame* pView = new TViewFrame(myStudyDocument);
- if(pView->Create(1))
- myResult = pView->_this();
- }
- }
- };
-
-
- VISU::View3D_ptr ViewManager_i::Create3DView(){
- if(MYDEBUG) MESSAGE("ViewManager_i::Create3DView");
- return ProcessEvent(new TCreateViewFrameEvent<VISU::View3D_i>(myStudyDocument));
- }
-
-
- VISU::XYPlot_ptr ViewManager_i::CreateXYPlot(){
- if(MYDEBUG) MESSAGE("ViewManager_i::CreateXYPlot");
- return ProcessEvent(new TCreateViewFrameEvent<VISU::XYPlot_i>(myStudyDocument));
- }
-
-
- class TCreateTableViewEvent: public TCreateViewEvent{
- Table_ptr myTable;
- public:
- TCreateTableViewEvent(SALOMEDS::Study_ptr theStudy,
- Table_ptr theTable):
- TCreateViewEvent(theStudy),
- myTable(theTable),
- myResult(VISU::TableView::_nil())
- {}
- virtual void Execute(){
- if ( CheckStudy( myStudyDocument ) ) {
- VISU::TableView_i* pView = new TableView_i(myStudyDocument);
- if(pView->Create(myTable) != NULL)
- myResult = pView->_this();
- }
- }
- typedef VISU::TableView_ptr TResult;
- TResult myResult;
- };
-
- VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
- if(MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
- return ProcessEvent(new TCreateTableViewEvent(myStudyDocument,theTable));
- }
-
-
- void ViewManager_i::Destroy(View_ptr theView){
- class TEvent: public SALOME_Event{
- View_ptr myView;
- public:
- TEvent(View_ptr theView):
- myView(theView)
- {}
- virtual void Execute(){
- if(!CORBA::is_nil(myView)){
- if(VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(myView).in())) {
- pView->Close();
- pView->_remove_ref();
+ if (!bFound) {
+ Plot2d_Curve* crv = theCurve->CreatePresentation();
+ if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - " << crv);
+ if (crv) {
+ theView->displayCurve(crv);
+ theCurve->SetLine((VISU::Curve::LineType)crv->getLine(), crv->getLineWidth());
+ theCurve->SetMarker((VISU::Curve::MarkerType)crv->getMarker());
+ SALOMEDS::Color newColor;
+ newColor.R = crv->getColor().red()/255.;
+ newColor.G = crv->getColor().green()/255.;
+ newColor.B = crv->getColor().blue()/255.;
+ theCurve->SetColor(newColor);
+ crv->setAutoAssign(theCurve->IsAuto());
}
}
}
- };
- if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - "<<theView->_is_nil());
- ProcessVoidEvent(new TEvent(theView));
- }
-
-
- //===========================================================================
- View_i::View_i(SALOMEDS::Study_ptr theStudy) {
- myStudyFrame = NULL;
- if(MYDEBUG) MESSAGE("View_i::View_i");
- CORBA::String_var aName = theStudy->Name();
- myStudy = CheckStudy(theStudy);
- if(MYDEBUG) MESSAGE("View_i::View_i - isStudyOpened = "<<myStudy<<"; aName = "<<aName.in());
- }
-
- View_i::~View_i(){
- if(MYDEBUG) MESSAGE("View_i::~View_i");
- }
-
- void View_i::SetBackground(const SALOMEDS::Color& theColor) {}
- SALOMEDS::Color View_i::GetBackground() { return SALOMEDS::Color();}
- void View_i::Minimize() {}
- void View_i::Restore() {}
- void View_i::Maximize() {}
- void View_i::EraseAll() {}
- void View_i::DisplayAll() {}
- void View_i::Erase(PrsObject_ptr thePrsObj) {}
- void View_i::Display(PrsObject_ptr thePrsObj) {}
- void View_i::DisplayOnly(PrsObject_ptr thePrsObj) {}
- void View_i::Update() {}
-
- CORBA::Boolean View_i::SavePicture(const char* theFileName) { return false; }
-
- const char* View_i::GetComment() const { return "";}
- void View_i::ToStream(std::ostringstream& theStr) {}
-
- string View_i::GetEntry(){
- SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectIOR(GetID());
- CORBA::String_var anEntry = aSObject->GetID();
- return string(anEntry.in());
- }
-
-
- //===========================================================================
- XYPlot_i::XYPlot_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {
- if(MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
- }
-
- Storable* XYPlot_i::Create(int theNew){
- if(theNew)
- myStudyFrame = myStudy->newWindow3d("",VIEW_PLOT2D);
- else
- myStudyFrame = myStudy->getActiveStudyFrame();
- myView = dynamic_cast<Plot2d_ViewFrame*>(myStudyFrame->getRightFrame()->getViewFrame());
- myView->Repaint();
- return this;
- }
-
-
- void XYPlot_i::Update() {
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
- }
-
-
- void XYPlot_i::Close(){
- myStudyFrame->close();
- }
-
- XYPlot_i::~XYPlot_i() {
- if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
- }
-
-
- void XYPlot_i::SetTitle(const char* theTitle){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
- (myStudyFrame,&QAD_StudyFrame::setCaption,QString(theTitle)));
- }
- char* XYPlot_i::GetTitle() {
- return CORBA::string_dup(myStudyFrame->title().latin1());
+ }
}
-
- void XYPlot_i::SetSubTitle(const char* theTitle){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
- (myView,&Plot2d_ViewFrame::setTitle,QString(theTitle)));
- }
- char* XYPlot_i::GetSubTitle() {
- return CORBA::string_dup(myView->getTitle());
+ VISU_Actor* GetActor (VISU::Prs3d_i* thePrs3d, SVTK_ViewWindow* theVTKFrame)
+ {
+ vtkActorCollection *anActColl = theVTKFrame->getRenderer()->GetActors();
+ anActColl->InitTraversal();
+ while (vtkActor *anActor = anActColl->GetNextActor())
+ if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+ if (thePrs3d == anVISUActor->GetPrs3d())
+ return anVISUActor->GetParent();
+ return NULL;
}
-
-
- void XYPlot_i::SetCurveType(VISU::XYPlot::CurveType theType){
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
- }
- VISU::XYPlot::CurveType XYPlot_i::GetCurveType(){
- return (VISU::XYPlot::CurveType)myView->getCurveType();
- }
-
-
- void XYPlot_i::SetMarkerSize(CORBA::Long theSize){
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
- }
- CORBA::Long XYPlot_i::GetMarkerSize(){
- return myView->getMarkerSize();
- }
-
-
- class TEnbleGridEvent: public SALOME_Event{
- public:
- typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool = true);
- TEnbleGridEvent(Plot2d_ViewFrame* theView, TFun theFun,
- CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor):
- myView(theView), myFun(theFun),
- myMajor(theMajor), myNumMajor(theNumMajor),
- myMinor(theMinor), myNumMinor(theNumMinor)
- {}
- virtual void Execute(){
- (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor);
- }
- protected:
- Plot2d_ViewFrame* myView;
- TFun myFun;
- CORBA::Boolean myMajor, myNumMajor;
- CORBA::Boolean myMinor, myNumMinor;
- };
-
-
- void XYPlot_i::EnableXGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor)
- {
- ProcessVoidEvent(new TEnbleGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
- theMajor,theNumMajor,theMinor,theNumMinor));
- }
- void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor)
- {
- ProcessVoidEvent(new TEnbleGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
- theMajor,theNumMajor,theMinor,theNumMinor));
- }
-
-
- class TSetScaleModeEvent: public SALOME_Event{
- public:
- typedef void (Plot2d_ViewFrame::* TFun)(const int, bool = true);
- TSetScaleModeEvent(Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
- myView(theView), myFun(theFun), myScaling(theScaling)
- {}
- virtual void Execute(){
- (myView->*myFun)(myScaling);
- }
- protected:
- Plot2d_ViewFrame* myView;
- TFun myFun;
- int myScaling;
- };
-
-
- void XYPlot_i::SetHorScaling(VISU::Scaling theScaling){
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
- theScaling == VISU::LOGARITHMIC));
- }
- VISU::Scaling XYPlot_i::GetHorScaling(){
- return (VISU::Scaling)myView->getHorScaleMode();
- }
-
-
- void XYPlot_i::SetVerScaling(VISU::Scaling theScaling){
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
- theScaling == VISU::LOGARITHMIC));
- }
- VISU::Scaling XYPlot_i::GetVerScaling(){
- return (VISU::Scaling)myView->getVerScaleMode();
- }
-
-
- class TSetTitleEvent: public SALOME_Event{
- public:
- typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, bool = true);
- TSetTitleEvent(Plot2d_ViewFrame* theView, TFun theFun, const char* theTitle):
- myView(theView), myFun(theFun), myTitle(theTitle)
- {}
- virtual void Execute(){
- (myView->*myFun)(true,myTitle);
- }
- protected:
- Plot2d_ViewFrame* myView;
- TFun myFun;
- const char* myTitle;
- };
-
-
- void XYPlot_i::SetXTitle(const char* theTitle){
- ProcessVoidEvent(new TSetTitleEvent(myView,&Plot2d_ViewFrame::setXTitle,theTitle));
- }
- char* XYPlot_i::GetXTitle() {
- return CORBA::string_dup(myView->getXTitle());
- }
-
-
- void XYPlot_i::SetYTitle(const char* theTitle){
- ProcessVoidEvent(new TSetTitleEvent(myView,&Plot2d_ViewFrame::setYTitle,theTitle));
- }
- char* XYPlot_i::GetYTitle() {
- return CORBA::string_dup(myView->getYTitle());
- }
-
-
- void XYPlot_i::ShowLegend(CORBA::Boolean theShowing){
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
- (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
- }
-
-
- void XYPlot_i::SetBackground(const SALOMEDS::Color& theColor){
- ProcessVoidEvent(new TSetBackgroundEvent<Plot2d_ViewFrame>(myView,theColor));
- }
- SALOMEDS::Color XYPlot_i::GetBackground() {
- SALOMEDS::Color aColor;
- aColor.R = myView->backgroundColor().red()/255.0;
- aColor.G = myView->backgroundColor().green()/255.0;
- aColor.B = myView->backgroundColor().blue()/255.0;
- return aColor;
- }
-
- void XYPlot_i::Minimize() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame,&QAD_StudyFrame::showMinimized));
- }
-
- void XYPlot_i::Restore() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showNormal));
- }
-
- void XYPlot_i::Maximize() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showMaximized));
- }
-
-
- class TXYPlotViewEvent: public SALOME_Event{
- QAD_Study* myStudy;
- Plot2d_ViewFrame* myView;
- PrsObject_ptr myPrsObj;
- int myDisplaing;
- public:
- TXYPlotViewEvent(QAD_Study* theStudy,
- Plot2d_ViewFrame* theView,
- PrsObject_ptr thePrsObj,
- int theDisplaing):
- myStudy(theStudy),
- myView(theView),
- myPrsObj(thePrsObj),
- myDisplaing(theDisplaing)
- {}
- virtual void Execute(){
- // is it Curve ?
- if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
- UpdatePlot2d(myView,myDisplaing,aCurve);
- }
- // is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
- int nbCurves = aContainer->GetNbCurves();
- for ( int i = 1; i <= nbCurves; i++ ) {
- VISU::Curve_i* aCurve = aContainer->GetCurve( i );
- if ( aCurve && aCurve->IsValid() ) {
- UpdatePlot2d(myView,myDisplaing,aCurve);
- }
- }
- myView->Repaint();
- }
- // is it Table ?
- if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
- SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
- SALOMEDS::SObject_var TableSO = aStudy->FindObjectID( aTable->GetEntry() );
- if ( !TableSO->_is_nil() ) {
- SALOMEDS::ChildIterator_var Iter = aStudy->NewChildIterator( TableSO );
- for ( ; Iter->More(); Iter->Next() ) {
- CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
- if( !CORBA::is_nil( childObject ) ) {
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
- if( !CORBA::is_nil( aCurve ) )
- UpdatePlot2d(myView,myDisplaing,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
- }
- }
- myView->Repaint();
- }
- }
- }
- };
-
-
- void XYPlot_i::Display(PrsObject_ptr thePrsObj) {
- ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eDisplay));
- }
-
-
- void XYPlot_i::Erase(PrsObject_ptr thePrsObj) {
- ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eErase));
- }
-
-
- void XYPlot_i::DisplayOnly(PrsObject_ptr thePrsObj) {
- ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eDisplayOnly));
- }
-
-
- void XYPlot_i::EraseAll() {
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::EraseAll));
- }
-
-
- void XYPlot_i::FitAll() {
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::fitAll));
- }
-
-
- CORBA::Boolean XYPlot_i::SavePicture(const char* theFileName) {
- return ProcessEvent(new TSavePictureEvent(myView->getViewWidget(),theFileName));
- }
-
-
- //===========================================================================
- TableView_i::TableView_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {}
- Storable* TableView_i::Create(VISU::Table_ptr theTable){
- if(MYDEBUG) MESSAGE("TableView_i::Create - "<<(!theTable->_is_nil()));
- if(!theTable->_is_nil()){
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
- if(MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = "<<table);
- if(table != NULL) {
- SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectID(table->GetObjectEntry());
- if(!aSObject->_is_nil()) {
- myView = new SALOMEGUI_TableDlg(QAD_Application::getDesktop(),
- aSObject,
- false,
- SALOMEGUI_TableDlg::ttAuto,
- Qt::Vertical);
- myView->show();
- return this;
- }
- }
- }
- return NULL;
- }
-
-
- TableView_i::~TableView_i() {
- if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
- delete myView;
- }
-
-
- void TableView_i::SetTitle(const char* theTitle){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<SALOMEGUI_TableDlg,const QString&,QString>
- (myView,&SALOMEGUI_TableDlg::setCaption,QString(theTitle)));
- }
-
-
- char* TableView_i::GetTitle() {
- return CORBA::string_dup(myView->caption().latin1());
- }
-
-
- void TableView_i::Close(){
- myView->close();
- }
-
-
- //===========================================================================
- int View3D_i::myNbViewParams = 0;
- const string View3D_i::myComment = "VIEW3D";
- const char* View3D_i::GetComment() const { return myComment.c_str();}
- QString View3D_i::GenerateViewParamsName() {
- return VISU::GenerateName( "ViewParams", ++myNbViewParams );
- }
-
- View3D_i::View3D_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {
- if(MYDEBUG) MESSAGE("View3D_i::View3D_i");
- }
-
- Storable* View3D_i::Create(int theNew){
- if(MYDEBUG) MESSAGE("View3D_i::Create");
- if(theNew)
- myStudyFrame = myStudy->newWindow3d("",VIEW_VTK);
- else
- myStudyFrame = myStudy->getActiveStudyFrame();
- return this;
- }
-
-
- void View3D_i::Update(){
- class TEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- public:
- TEvent(QAD_StudyFrame* theStudyFrame):
- myStudyFrame(theStudyFrame)
- {}
- virtual void Execute(){
- VTKViewer_ViewFrame* vf = GetViewFrame(myStudyFrame);
- vtkRenderer* Renderer = vf->getRenderer();
- vtkActorCollection* theActors = Renderer->GetActors();
- theActors->InitTraversal();
- while(vtkActor *anAct = theActors->GetNextActor()){
- if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
- VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d();
- if(anActor->GetVisibility() && aPrs3d){
- aPrs3d->Update();
- aPrs3d->UpdateActor(anActor);
- }
- }
- }
- RepaintView(myStudyFrame);
- }
- };
- ProcessVoidEvent(new TEvent(myStudyFrame));
- }
-
-
- CORBA::Boolean View3D_i::SavePicture(const char* theFileName) {
- return ProcessEvent(new TSavePictureEvent(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget(),theFileName));
- }
-
-
- bool View3D_i::SaveViewParams(QAD_StudyFrame* theStudyFrame, const char* theName){
- QAD_Study* aStudy = theStudyFrame->getStudy();
- SALOMEDS::Study_var aStudyDoc = aStudy->getStudyDocument();
- if ( theName ) {
- SALOMEDS::Study::ListOfSObject_var aList =
- aStudyDoc->FindObjectByName(theName,"VISU");
- SALOMEDS::GenericAttribute_var anAttr;
- int iEnd = aList->length();
- for(int i = 0; i < iEnd; i++){
- SALOMEDS::SObject_var anObj = aList[i];
- CORBA::String_var aString = anObj->GetID();
- string anEntry(aString);
- if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = "<<anEntry);
- if(anObj->FindAttribute(anAttr, "AttributeComment")){
- SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
- aString = aCmnt->Value();
- string aComm(aString);
- if(MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = "<<aComm);
- if(aComm.compare(View3D_i::myComment) >= 0){
- aCmnt->SetValue(ToString(theStudyFrame).c_str());
- return true;
- }
- }
- }
- }
- SALOMEDS::SComponent_var aSComponent = FindOrCreateVisuComponent(aStudyDoc);
- CORBA::String_var aSComponentEntry = aSComponent->GetID();
- string anEntry = CreateAttributes(aStudyDoc,aSComponentEntry.in(),"","",theName,"",ToString(theStudyFrame).c_str());
- return true;
- }
- CORBA::Boolean View3D_i::SaveViewParams(const char* theName){
- return SaveViewParams(myStudyFrame,theName);
- }
-
-
- bool View3D_i::RestoreViewParams(QAD_StudyFrame* theStudyFrame, const char* theName){
- SALOMEDS::Study::ListOfSObject_var aList =
- theStudyFrame->getStudy()->getStudyDocument()->FindObjectByName(theName,"VISU");
- SALOMEDS::GenericAttribute_var anAttr;
- int iEnd = aList->length();
- if(MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = "<<iEnd);
- for(int i = 0; i < iEnd; i++){
- SALOMEDS::SObject_var anObj = aList[i];
- CORBA::String_var aString = anObj->GetID();
- string anEntry(aString);
- if(MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = "<<anEntry);
- if(anObj->FindAttribute(anAttr, "AttributeComment")){
- SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
- aString = aCmnt->Value();
- QString strIn(aString);
- Storable::TRestoringMap aMap;
- Storable::StrToMap(strIn,aMap);
- if ( Storable::FindValue( aMap,"myComment").compare( View3D_i::myComment.c_str() ) >= 0 ) {
- if(MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = "<<strIn);
- Restore(theStudyFrame,aMap);
- return true;
- }
- }
- }
- return false;
- }
-
-
- class TRestoreViewParamsEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- const char* myName;
- public:
- TRestoreViewParamsEvent(QAD_StudyFrame* theStudyFrame,
- const char* theName):
- myStudyFrame(theStudyFrame),
- myName(theName)
- {}
- virtual void Execute(){
- myResult = View3D_i::RestoreViewParams(myStudyFrame,myName);
- }
- typedef CORBA::Boolean TResult;
- TResult myResult;
- };
-
- CORBA::Boolean View3D_i::RestoreViewParams(const char* theName){
- return ProcessEvent(new TRestoreViewParamsEvent(myStudyFrame,theName));
- }
-
-
- void View3D_i::Restore(QAD_StudyFrame* theStudyFrame, const Storable::TRestoringMap& theMap){
- SALOMEDS::Color aColor;
- aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
- aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
- aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
-
- double aPosition[3];
- aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
- aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
- aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
-
- double aFocalPnt[3];
- aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
- aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
- aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
-
- double aViewUp[3];
- aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
- aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
- aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
-
- double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
-
- double aScaleFactor[3];
- aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
- aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
- aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
-
- SetBackground(theStudyFrame,aColor);
- SetPointOfView(theStudyFrame,aPosition);
- SetViewUp(theStudyFrame,aViewUp);
- SetFocalPoint(theStudyFrame,aFocalPnt);
- SetParallelScale(theStudyFrame,aParallelScale);
- ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
- ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
- ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
- }
-
-
- string View3D_i::ToString(QAD_StudyFrame* theStudyFrame){
- ostringstream strOut;
- Storable::DataToStream( strOut, "myComment", myComment.c_str() );
- ToStream(theStudyFrame,strOut);
- strOut<<ends;
- if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
- return strOut.str();
- }
- void View3D_i::ToStream(QAD_StudyFrame* theStudyFrame, std::ostringstream& theStr) {
- Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
-
- float backint[3];
- GetRenderer(theStudyFrame)->GetBackground(backint);
- Storable::DataToStream(theStr,"myColor.R",backint[0]);
- Storable::DataToStream(theStr,"myColor.G",backint[1]);
- Storable::DataToStream(theStr,"myColor.B",backint[2]);
-
- double aPosition[3];
- GetPointOfView(theStudyFrame,aPosition);
- Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
- Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
- Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
-
- double aFocalPnt[3];
- GetFocalPoint(theStudyFrame,aFocalPnt);
- Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
- Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
- Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
-
- double aViewUp[3];
- GetCamera(theStudyFrame)->GetViewUp(aViewUp);
- Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
- Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
- Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
-
- Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
-
- double aScaleFactor[3];
- GetViewFrame(theStudyFrame)->GetScale(aScaleFactor);
- Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
- Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
- Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
- }
- void View3D_i::ToStream(std::ostringstream& theStr) {
- ToStream(myStudyFrame,theStr);
- }
-
-
- void View3D_i::Close(){
- myStudyFrame->close();
- }
-
- View3D_i::~View3D_i() {
- if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
- }
-
- //-------------------- View interface --------------------
-
- void View_i::ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state ) {
- ProcessVoidEvent( new TSetViewRepresentation( this, ViewRepr, state ) );
- Update();
- }
-
- CORBA::Boolean View_i::IsPartShown( VISU::View::ViewRepresentation Part )
- {
- return ProcessEvent( new TGetViewRepresentation( this, Part ) );
- }
-
- void View_i::SetViewWidth(CORBA::Long Width){
- ProcessVoidEvent( new TSetViewWidthHeight( this, Width, true ) );
- }
-
- void View_i::SetViewHeight(CORBA::Long Height){
- ProcessVoidEvent( new TSetViewWidthHeight( this, Height, false ) );
- }
-
- CORBA::Long View_i::GetViewWidth()
- {
- return ProcessEvent( new TGetViewWidthHeight( this, true ) );
- }
-
- CORBA::Long View_i::GetViewHeight()
- {
- return ProcessEvent( new TGetViewWidthHeight( this, false ) );
- }
-
- void View_i::SetViewPositionHorizontal( VISU::View::ViewPosition ViewPosHor ){
- ProcessVoidEvent( new TSetViewPositionHorizontal( this, ViewPosHor ) );
- }
-
- void View_i::SetViewPositionVertical( VISU::View::ViewPosition ViewPosVer ){
- ProcessVoidEvent( new TSetViewPositionVertical( this, ViewPosVer ) );
- }
-
- void View_i::SetRelativePosition( CORBA::Double x, CORBA::Double y )
- {
- ProcessVoidEvent( new TSetRelativePosition( this, x, y ) );
- }
-
- void View_i::SetRelativeSize( CORBA::Double x, CORBA::Double y )
- {
- ProcessVoidEvent( new TSetRelativeSize( this, x, y ) );
- }
-
-
-
-
- void View3D_i::SetTitle(const char* theTitle){
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
- (myStudyFrame,&QAD_StudyFrame::setTitle,QString(theTitle)));
- }
- char* View3D_i::GetTitle() {
- return CORBA::string_dup(myStudyFrame->title().latin1());
- }
-
-
- void View3D_i::SetBackground(QAD_StudyFrame* theStudyFrame, const SALOMEDS::Color& theColor) {
- int aColor[3];
- aColor[0] = int(255.0*theColor.R);
- aColor[1] = int(255.0*theColor.G);
- aColor[2] = int(255.0*theColor.B);
- QColor aNewColor(aColor[0],aColor[1],aColor[2]);
- GetViewFrame(theStudyFrame)->setBackgroundColor(aNewColor);
- }
- void View3D_i::SetBackground(const SALOMEDS::Color& theColor) {
- ProcessVoidEvent(new TSetBackgroundEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),theColor));
- }
-
-
- SALOMEDS::Color View3D_i::GetBackground(QAD_StudyFrame* theStudyFrame) {
- SALOMEDS::Color aColor;
- float backint[3];
- GetRenderer(theStudyFrame)->GetBackground(backint);
- aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
- return aColor;
- }
- SALOMEDS::Color View3D_i::GetBackground() {
- return GetBackground(myStudyFrame);
- }
-
-
- void View3D_i::Minimize() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame,&QAD_StudyFrame::showMinimized));
- }
- void View3D_i::Restore() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showNormal));
- }
- void View3D_i::Maximize() {
- ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showMaximized));
- }
-
-
- //===========================================================================
- class TUpdateViewerEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- Prs3d_i* myPrs3d;
- int myDisplaing;
- public:
- TUpdateViewerEvent(QAD_StudyFrame* theStudyFrame,
- Prs3d_i* thePrs3d,
- int theDisplaing):
- myStudyFrame(theStudyFrame),
- myPrs3d(thePrs3d),
- myDisplaing(theDisplaing)
- {}
- virtual void Execute(){
- UpdateViewer(myStudyFrame,myDisplaing,myPrs3d);
- }
- };
-
- void View3D_i::EraseAll() {
- if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
- ProcessVoidEvent(new TUpdateViewerEvent(myStudyFrame,NULL,eEraseAll));
- }
-
- void View3D_i::DisplayAll() {
- if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
- ProcessVoidEvent(new TUpdateViewerEvent(myStudyFrame,NULL,eDisplayAll));
- }
-
- void View3D_i::Erase(PrsObject_ptr thePrsObj) {
- if(MYDEBUG) MESSAGE("View3D_i::Erase");
- CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myStudyFrame,aPrs,eErase));
- }
- }
-
- void View3D_i::Display(PrsObject_ptr thePrsObj) {
- if(MYDEBUG) MESSAGE("View3D_i::Display");
- CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myStudyFrame,aPrs,eDisplay));
- }
- }
-
- void View3D_i::DisplayOnly(PrsObject_ptr thePrsObj) {
- if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
- CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
- ProcessVoidEvent(new TUpdateViewerEvent(myStudyFrame,aPrs,eDisplayOnly));
- }
- }
-
- //-------------------- View3D interface --------------------
- void View3D_i::FitAll() {
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFitAll));
- Update();
- }
-
-
- void View3D_i::SetView(VISU::View3D::ViewType theType) {
- switch(theType){
- case VISU::View3D::FRONT :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFront));
- break;
- case VISU::View3D::BACK :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBack));
- break;
- case VISU::View3D::LEFT :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewLeft));
- break;
- case VISU::View3D::RIGHT :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewRight));
- break;
- case VISU::View3D::TOP :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewTop));
- break;
- case VISU::View3D::BOTTOM :
- ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBottom));
- break;
- }
- Update();
- }
-
-
- class TSet3DViewParamEvent: public SALOME_Event{
- public:
- typedef void (*TFun)(QAD_StudyFrame* theStudyFrame, const CORBA::Double theParam[3]);
- TSet3DViewParamEvent(TFun theFun,
- QAD_StudyFrame* theStudyFrame,
- const CORBA::Double theParam[3]):
- myFun(theFun),
- myStudyFrame(theStudyFrame),
- myParam(theParam)
- {}
- virtual void Execute(){
- myFun(myStudyFrame,myParam);
- }
- private:
- TFun myFun;
- QAD_StudyFrame* myStudyFrame;
- const CORBA::Double* myParam;
- };
-
-
- void View3D_i::SetPointOfView(QAD_StudyFrame* theStudyFrame, const CORBA::Double thePosition[3]) {
- GetCamera(theStudyFrame)->SetPosition(thePosition);
- }
- void View3D_i::SetPointOfView(const VISU::View3D::XYZ thePosition) {
- if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myStudyFrame,thePosition));
- }
-
-
- void View3D_i::GetPointOfView(QAD_StudyFrame* theStudyFrame, CORBA::Double thePosition[3]) {
- GetCamera(theStudyFrame)->GetPosition(thePosition);
- }
- VISU::View3D::XYZ_slice* View3D_i::GetPointOfView() {
- if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
- CORBA::Double aPosition[3];
- GetPointOfView(myStudyFrame,aPosition);
- return VISU::View3D::XYZ_dup(aPosition);
- }
-
-
- void View3D_i::SetViewUp(QAD_StudyFrame* theStudyFrame, const CORBA::Double theViewUp[3]) {
- GetCamera(theStudyFrame)->SetViewUp(theViewUp);
- }
- void View3D_i::SetViewUp(const VISU::View3D::XYZ theViewUp) {
- if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myStudyFrame,theViewUp));
- }
-
-
- void View3D_i::GetViewUp(QAD_StudyFrame* theStudyFrame, CORBA::Double theViewUp[3]) {
- GetCamera(theStudyFrame)->GetViewUp(theViewUp);
- }
- VISU::View3D::XYZ_slice* View3D_i::GetViewUp() {
- if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
- CORBA::Double aViewUp[3];
- GetCamera(myStudyFrame)->GetViewUp(aViewUp);
- return VISU::View3D::XYZ_dup(aViewUp);
- }
-
-
- void View3D_i::SetFocalPoint(QAD_StudyFrame* theStudyFrame, const CORBA::Double theFocalPnt[3]) {
- GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
- }
- void View3D_i::SetFocalPoint(const VISU::View3D::XYZ theCoord) {
- if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myStudyFrame,theCoord));
- }
-
-
- void View3D_i::GetFocalPoint(QAD_StudyFrame* theStudyFrame, CORBA::Double theFocalPnt[3]) {
- GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
- }
- VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint() {
- if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
- CORBA::Double aFocalPnt[3];
- GetFocalPoint(myStudyFrame,aFocalPnt);
- return VISU::View3D::XYZ_dup(aFocalPnt);
- }
-
-
- class TSetViewParamEvent: public SALOME_Event{
- public:
- typedef void (*TFun)(QAD_StudyFrame* theStudyFrame, CORBA::Double theParam);
- TSetViewParamEvent(TFun theFun,
- QAD_StudyFrame* theStudyFrame,
- CORBA::Double theParam):
- myFun(theFun),
- myStudyFrame(theStudyFrame),
- myParam(theParam)
- {}
- virtual void Execute(){
- myFun(myStudyFrame,myParam);
- }
- private:
- TFun myFun;
- QAD_StudyFrame* myStudyFrame;
- CORBA::Double myParam;
- };
-
-
- void View3D_i::SetParallelScale(QAD_StudyFrame* theStudyFrame, CORBA::Double theScale) {
- GetCamera(theStudyFrame)->SetParallelScale(theScale);
- }
- void View3D_i::SetParallelScale(CORBA::Double theScale) {
- if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
- ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myStudyFrame,theScale));
- }
-
-
- CORBA::Double View3D_i::GetParallelScale(QAD_StudyFrame* theStudyFrame) {
- return GetCamera(theStudyFrame)->GetParallelScale();
- }
- CORBA::Double View3D_i::GetParallelScale() {
- if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
- return GetParallelScale(myStudyFrame);
- }
-
- void View3D_i::ScaleView(QAD_StudyFrame* theStudyFrame, VISU::View3D::Axis theAxis, CORBA::Double theParam) {
- VTKViewer_ViewFrame* aViewFrame = GetViewFrame(theStudyFrame);
- double aScaleFactor[3];
- aViewFrame->GetScale(aScaleFactor);
- aScaleFactor[theAxis] = theParam;
- aViewFrame->SetScale(aScaleFactor);
- }
-
- void SetScaleView(QAD_StudyFrame* theStudyFrame, const CORBA::Double theScale[3]){
- double aScale[3] = {theScale[0], theScale[1], theScale[2]};
- GetViewFrame(theStudyFrame)->SetScale(aScale);
- }
- void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam) {
- if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
- double aScale[3];
- GetViewFrame(myStudyFrame)->GetScale(aScale);
- aScale[theAxis] = theParam;
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myStudyFrame,aScale));
- }
- void View3D_i::RemoveScale() {
- if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
- double aScale[3] = {1.0, 1.0, 1.0};
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myStudyFrame,aScale));
- }
- //===========================================================================
-
-
- VISU_Actor* GetActor(VISU::Prs3d_i* thePrs3d, VTKViewer_ViewFrame* theVTKFrame){
- vtkActorCollection *anActColl = theVTKFrame->getRenderer()->GetActors();
- anActColl->InitTraversal();
- while(vtkActor *anActor = anActColl->GetNextActor())
- if(VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
- if(thePrs3d == anVISUActor->GetPrs3d())
- return anVISUActor->GetParent();
- return NULL;
- }
-
-
- void DeletePrs3d(Prs3d_ptr thePrs3d){
- if(Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(thePrs3d).in())){
- SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
- if(QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument)){
- aStudy->unHighlightAll();
- int aNbStudyFrames = aStudy->getStudyFramesCount();
- for(int aFrameId = 0; aFrameId < aNbStudyFrames; aFrameId++){
- if(QAD_StudyFrame* aFrame = aStudy->getStudyFrame(aFrameId)){
- QAD_ViewFrame* aViewFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame)){
- if(VISU_Actor* anActor = VISU::GetActor(aPrs3d,aVTKFrame)){
- aVTKFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- aVTKFrame->unHighlightAll();
- }
- }
- }
-
- aPrs3d->RemoveFromStudy();
- aPrs3d->Destroy();
-
- aStudy->updateObjBrowser(); //update Object browser
- }
- }
- }
- }
-
-
- void VISU_Gen_i::DeleteResult(Result_ptr theResult)
- {
- class TEvent: public SALOME_Event{
- Result_ptr myResult;
- public:
- TEvent(Result_ptr theResult): myResult(theResult) {}
- virtual void Execute(){
- if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())){
- SALOMEDS::SObject_var aSObject = aResult->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::DeletePrs3d(aPrs3d);
- }
-
- aResult->RemoveFromStudy();
- aResult->Destroy();
-
- if(QAD_Desktop* aDesktop = QAD_Application::getDesktop())
- if(QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
- aStudy->updateObjBrowser(); //update Object browser
- }
- }
- };
-
- ProcessVoidEvent(new TEvent(theResult));
- }
-
-
- void VISU_Gen_i::DeletePrs3d(Prs3d_ptr thePrs3d)
- {
- class TEvent: public SALOME_Event{
- Prs3d_ptr myPrs3d;
- public:
- TEvent(Prs3d_ptr thePrs3d): myPrs3d(thePrs3d) {}
- virtual void Execute(){
- VISU::DeletePrs3d(myPrs3d);
- }
- };
-
- ProcessVoidEvent(new TEvent(thePrs3d));
- }
-
}
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File : VISU_ViewManager_i.hh
#include "VISUConfig.hh"
-class QAD_Study;
-class QAD_StudyFrame;
-
-class VTKViewer_ViewFrame;
-class SALOMEGUI_TableDlg;
-class Plot2d_ViewFrame;
+class SalomeApp_Application;
class VISU_Actor;
+class SUIT_ViewWindow;
+
+class SVTK_ViewWindow;
+class Plot2d_ViewFrame;
+
class vtkRenderer;
class vtkCamera;
-namespace VISU{
+
+namespace VISU {
class Prs3d_i;
+ class Curve_i;
+
class ViewManager_i : public virtual POA_VISU::ViewManager,
public virtual Base_i
{
public:
ViewManager_i(SALOMEDS::Study_ptr theStudy);
- virtual ~ViewManager_i() {};
+ virtual ~ViewManager_i();
virtual VISU::VISUType GetType() { return VISU::TVIEWMANAGER;};
virtual View3D_ptr Create3DView();
virtual void Destroy(View_ptr theView);
protected:
- SALOMEDS::Study_var myStudyDocument;
- };
-
- //===========================================================================
- class View_i : public virtual POA_VISU::View,
- public virtual Storable
- {
- public:
- QAD_Study* myStudy;
- QAD_StudyFrame* myStudyFrame;
-
- public:
- virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
- virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
- virtual void SetViewWidth(CORBA::Long Width);
- virtual void SetViewHeight(CORBA::Long Height);
- virtual CORBA::Long GetViewWidth();
- virtual CORBA::Long GetViewHeight();
- virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor);
- virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer);
-
- virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y );
- virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y );
-
- View_i(SALOMEDS::Study_ptr theStudy);
- virtual ~View_i();
- virtual void SetBackground(const SALOMEDS::Color& theColor);
- virtual SALOMEDS::Color GetBackground();
- virtual void Minimize();
- virtual void Restore();
- virtual void Maximize();
- virtual void EraseAll();
- virtual void DisplayAll();
- virtual void Erase(PrsObject_ptr thePrsObj);
- virtual void Display(PrsObject_ptr thePrsObj);
- virtual void DisplayOnly(PrsObject_ptr thePrsObj);
- virtual void Update();
-
- virtual CORBA::Boolean SavePicture(const char* theFileName);
-
- virtual void Close() = 0;
- virtual void ToStream(std::ostringstream& theStr);
- virtual const char* GetComment() const;
-
- public:
- virtual std::string View_i::GetEntry();
- };
-
- //===========================================================================
- class XYPlot_i : public virtual POA_VISU::XYPlot,
- public virtual View_i
- {
- public:
- typedef VISU::XYPlot TInterface;
- XYPlot_i(SALOMEDS::Study_ptr theStudy);
- virtual ~XYPlot_i();
- virtual VISU::VISUType GetType() { return VISU::TXYPLOT;};
-
- virtual void SetTitle(const char* theTitle);
- virtual char* GetTitle();
-
- virtual void SetSubTitle(const char* theTitle);
- virtual char* GetSubTitle();
-
- virtual void SetCurveType(VISU::XYPlot::CurveType theType);
- virtual VISU::XYPlot::CurveType GetCurveType();
-
- virtual void SetMarkerSize(CORBA::Long theSize);
- virtual CORBA::Long GetMarkerSize();
-
- virtual void EnableXGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor);
- virtual void EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor);
-
- virtual void SetHorScaling(VISU::Scaling theScaling);
- virtual VISU::Scaling GetHorScaling();
- virtual void SetVerScaling(VISU::Scaling theScaling);
- virtual VISU::Scaling GetVerScaling();
-
- virtual void SetXTitle(const char* theTitle);
- virtual char* GetXTitle();
-
- virtual void SetYTitle(const char* theTitle);
- virtual char* GetYTitle();
-
- virtual void ShowLegend(CORBA::Boolean theShowing);
-
- virtual void SetBackground(const SALOMEDS::Color& theColor);
- virtual SALOMEDS::Color GetBackground();
- virtual void Minimize();
- virtual void Restore();
- virtual void Maximize();
- virtual void EraseAll();
- virtual void Erase(PrsObject_ptr thePrsObj);
- virtual void Display(PrsObject_ptr thePrsObj);
- virtual void DisplayOnly(PrsObject_ptr thePrsObj);
- virtual void Update();
-
- virtual CORBA::Boolean SavePicture(const char* theFileName);
-
- virtual void FitAll();
-
- virtual void Close();
- protected:
- Plot2d_ViewFrame* myView;
- public:
- virtual Storable* Create(int theNew);
+ SalomeApp_Application *myApplication;
};
- //===========================================================================
- class TableView_i : public virtual POA_VISU::TableView,
- public virtual View_i
- {
- public:
- typedef VISU::TableView TInterface;
- TableView_i(SALOMEDS::Study_ptr theStudy);
- virtual ~TableView_i();
- virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW;};
-
- virtual void SetTitle(const char* theTitle);
- virtual char* GetTitle();
-
- virtual void Close();
- protected:
- SALOMEGUI_TableDlg* myView;
- public:
- virtual Storable* Create(VISU::Table_ptr theTable);
- };
-
- //===========================================================================
- class View3D_i : public virtual POA_VISU::View3D,
- public virtual View_i
- {
- public:
- typedef VISU::View3D TInterface;
- View3D_i(SALOMEDS::Study_ptr theStudy);
- virtual ~View3D_i();
- virtual VISU::VISUType GetType() { return VISU::TVIEW3D;};
-
- //View interface
- virtual void SetTitle(const char* theTitle);
- virtual char* GetTitle();
-
- static void SetBackground(QAD_StudyFrame* theStudyFrame, const SALOMEDS::Color& theColor);
- virtual void SetBackground(const SALOMEDS::Color& theColor);
-
- static SALOMEDS::Color GetBackground(QAD_StudyFrame* theStudyFrame);
- virtual SALOMEDS::Color GetBackground();
-
- virtual void Minimize();
- virtual void Restore();
- virtual void Maximize();
- virtual void EraseAll();
- virtual void DisplayAll();
- virtual void Erase(PrsObject_ptr thePrsObj);
- virtual void Display(PrsObject_ptr thePrsObj);
- virtual void DisplayOnly(PrsObject_ptr thePrsObj);
- virtual void Update();
+ SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame);
+ vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame);
+ vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame);
- virtual CORBA::Boolean SavePicture(const char* theFileName);
-
- //View3D interface
- virtual void FitAll();
- virtual void SetView(VISU::View3D::ViewType theType);
-
- static void SetPointOfView(QAD_StudyFrame* theStudyFrame, const CORBA::Double thePosition[3]);
- virtual void SetPointOfView(const VISU::View3D::XYZ theCoord);
-
- static void GetPointOfView(QAD_StudyFrame* theStudyFrame, CORBA::Double thePosition[3]);
- virtual VISU::View3D::XYZ_slice* GetPointOfView();
-
- static void SetViewUp(QAD_StudyFrame* theStudyFrame, const CORBA::Double theViewUp[3]);
- virtual void SetViewUp(const VISU::View3D::XYZ theDir);
-
- static void GetViewUp(QAD_StudyFrame* theStudyFrame, CORBA::Double theViewUp[3]);
- virtual VISU::View3D::XYZ_slice* GetViewUp();
-
- static void SetFocalPoint(QAD_StudyFrame* theStudyFrame, const CORBA::Double theFocalPnt[3]);
- virtual void SetFocalPoint(const VISU::View3D::XYZ theCoord);
-
- static void View3D_i::GetFocalPoint(QAD_StudyFrame* theStudyFrame, CORBA::Double theFocalPnt[3]);
- virtual VISU::View3D::XYZ_slice* GetFocalPoint();
-
- static void SetParallelScale(QAD_StudyFrame* theStudyFrame, CORBA::Double theScale);
- virtual void SetParallelScale(CORBA::Double theScale);
-
- static CORBA::Double GetParallelScale(QAD_StudyFrame* theStudyFrame);
- virtual CORBA::Double GetParallelScale();
-
- static void ScaleView(QAD_StudyFrame* theStudyFrame, VISU::View3D::Axis theAxis, CORBA::Double theParam);
- virtual void ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam);
- virtual void RemoveScale();
-
- static std::string ToString(QAD_StudyFrame* theStudyFrame);
- static void ToStream(QAD_StudyFrame* theStudyFrame, std::ostringstream& theStr);
- static bool SaveViewParams(QAD_StudyFrame* theStudyFrame, const char* theName);
- virtual CORBA::Boolean SaveViewParams(const char* theName);
- static QString GenerateViewParamsName();
-
- static void Restore(QAD_StudyFrame* theStudyFrame, const Storable::TRestoringMap& theMap);
- static bool RestoreViewParams(QAD_StudyFrame* theStudyFrame, const char* theName);
- virtual CORBA::Boolean RestoreViewParams(const char* theName);
-
- virtual void Close();
-
- protected:
- static int myNbViewParams;
-
- public:
- virtual Storable* Create(int theNew);
- virtual void ToStream(std::ostringstream& theStr);
- virtual const char* GetComment() const;
- static const std::string myComment;
- QAD_StudyFrame* GetStudyFrame() const { return myStudyFrame;}
- };
-
- VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame);
- vtkRenderer* GetRenderer(QAD_StudyFrame* theStudyFrame);
- vtkCamera* GetCamera(QAD_StudyFrame* theStudyFrame);
-
- void RepaintView(VTKViewer_ViewFrame* theViewFrame);
- void RepaintView(QAD_StudyFrame* theStudyFrame);
+ void RepaintView (SUIT_ViewWindow* theStudyFrame);
enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
- VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs = NULL);
+ VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs = NULL);
+ void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
+
+ VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
}
#endif
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File : VISU_View_i.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "VISU_View_i.hh"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "VISU_Actor.h"
+
+#include "SALOME_Event.hxx"
+
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_Tools.h"
+
+#include "STD_MDIDesktop.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "Plot2d_ViewFrame.h"
+#include "Plot2d_ViewModel.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
+
+#include <qworkspace.h>
+
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU{
+
+ typedef TVoidMemFunEvent<SUIT_ViewWindow> TFrameActionEvent;
+
+ View_i::
+ View_i(SalomeApp_Application *theApplication,
+ SUIT_ViewManager* theViewManager):
+ myApplication(theApplication),
+ myWorkspace(NULL),
+ myViewManager(theViewManager)
+ {
+ if(MYDEBUG) MESSAGE("View_i::View_i - "<<this);
+ if(STD_MDIDesktop* aDesktop = dynamic_cast<STD_MDIDesktop*>(myApplication->desktop())){
+ myWorkspace = aDesktop->workspace();
+ }
+ }
+
+ View_i::
+ ~View_i()
+ {
+ if(MYDEBUG) MESSAGE("View_i::~View_i - "<<this);
+ }
+
+
+ struct TApplicationEvent: public SALOME_Event
+ {
+ SalomeApp_Application* myApplication;
+
+ TApplicationEvent(SalomeApp_Application* theApplication):
+ myApplication(theApplication)
+ {}
+ };
+
+
+ void
+ View_i::
+ ShowPart(VISU::View::ViewRepresentation theViewRepresentation,
+ CORBA::Boolean theState)
+ {
+ struct TEvent: public TApplicationEvent
+ {
+ VISU::View::ViewRepresentation myViewRepresentation;
+ CORBA::Boolean myState;
+
+ TEvent(SalomeApp_Application* theApplication,
+ VISU::View::ViewRepresentation theViewRepresentation,
+ CORBA::Boolean theState):
+ TApplicationEvent(theApplication),
+ myViewRepresentation(theViewRepresentation),
+ myState(theState)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ switch(myViewRepresentation){
+ case VISU::View::OBJECTBROWSER:
+ myApplication->setWindowShown(SalomeApp_Application::WT_ObjectBrowser,myState);
+ break;
+ case VISU::View::PYTHON:
+ myApplication->setWindowShown(SalomeApp_Application::WT_PyConsole,myState);
+ break;
+ case VISU::View::MESSAGES:
+ myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState);
+ break;
+ case VISU::View::VIEWER:{
+ ViewManagerList aViewManagerList = myApplication->viewManagers();
+ // to do something
+ // ...
+ break;
+ }}
+ }
+ };
+
+ ProcessVoidEvent(new TEvent(myApplication,theViewRepresentation,theState));
+ }
+
+
+ struct TPartShownEvent: public TApplicationEvent
+ {
+ VISU::View::ViewRepresentation myViewRepresentation;
+ typedef bool TResult;
+ TResult myResult;
+
+ TPartShownEvent(SalomeApp_Application* theApplication,
+ VISU::View::ViewRepresentation theViewRepresentation):
+ TApplicationEvent(theApplication),
+ myViewRepresentation(theViewRepresentation),
+ myResult(false)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ switch(myViewRepresentation){
+ case VISU::View::OBJECTBROWSER:
+ myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_ObjectBrowser);
+ break;
+ case VISU::View::PYTHON:
+ myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_PyConsole);
+ break;
+ case VISU::View::MESSAGES:
+ myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_LogWindow);
+ break;
+ case VISU::View::VIEWER:{
+ ViewManagerList aViewManagerList = myApplication->viewManagers();
+ // to do something
+ // ...
+ break;
+ }}
+ }
+ };
+
+
+ CORBA::Boolean
+ View_i::
+ IsPartShown(VISU::View::ViewRepresentation theViewRepresentation)
+ {
+ return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation));
+ }
+
+
+ struct TSetViewSize: public SALOME_Event
+ {
+ SUIT_ViewWindow* myViewWindow;
+ typedef void (QRect::* TAction)(int);
+ TAction myAction;
+ CORBA::Long mySize;
+
+ public:
+ TSetViewSize(SUIT_ViewWindow* theViewWindow,
+ TAction theAction,
+ CORBA::Long theSize):
+ myViewWindow(theViewWindow),
+ myAction(theAction),
+ mySize(theSize)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if (QWidget* aParent = myViewWindow->parentWidget(true)) {
+ QRect aQRect = aParent->frameGeometry();
+ (aQRect.*myAction)(mySize);
+ aParent->setGeometry(aQRect);
+ }
+ }
+ };
+
+
+ void
+ View_i::
+ SetViewWidth(CORBA::Long theWidth)
+ {
+ ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setWidth,theWidth));
+ }
+
+
+ void
+ View_i::
+ SetViewHeight(CORBA::Long theHeight)
+ {
+ ProcessVoidEvent(new TSetViewSize(myViewWindow,&QRect::setHeight,theHeight));
+ }
+
+
+ struct TGetViewSize: public SALOME_Event
+ {
+ SUIT_ViewWindow* myViewWindow;
+
+ typedef int (QRect::* TAction)() const;
+ TAction myAction;
+
+ typedef CORBA::Long TResult;
+ TResult myResult;
+
+ public:
+ TGetViewSize(SUIT_ViewWindow* theViewWindow,
+ TAction theAction):
+ myViewWindow(theViewWindow),
+ myAction(theAction)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if(QWidget* aParent = myViewWindow->parentWidget(true)){
+ QRect aQRect = aParent->frameGeometry();
+ myResult = (aQRect.*myAction)();
+ }
+ }
+ };
+
+
+ CORBA::Long
+ View_i::
+ GetViewWidth()
+ {
+ return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::width));
+ }
+
+ CORBA::Long
+ View_i::
+ GetViewHeight()
+ {
+ return ProcessEvent(new TGetViewSize(myViewWindow,&QRect::height));
+ }
+
+
+ class TWorkspaceEvent: public SALOME_Event
+ {
+ protected:
+ QWidget* myViewWindow;
+ QWidget* myWorkspace;
+
+ public:
+ TWorkspaceEvent(QWidget* theViewWindow,
+ QWidget* theWorkspace):
+ myViewWindow(theViewWindow),
+ myWorkspace(theWorkspace)
+ {}
+ };
+
+
+ class TAlignEvent: public TWorkspaceEvent
+ {
+ protected:
+ Qt::AlignmentFlags myAligment;
+
+ public:
+ TAlignEvent(QWidget* theViewWindow,
+ QWidget* theWorkspace,
+ Qt::AlignmentFlags theAligment):
+ TWorkspaceEvent(theViewWindow,theWorkspace),
+ myAligment(theAligment)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
+ SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
+ }
+ };
+
+
+ void
+ View_i::
+ SetViewPositionHorizontal(VISU::View::ViewPosition theViewPosition)
+ {
+ if(myWorkspace){
+ switch(theViewPosition){
+ case VISU::View::LEFT:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignLeft));
+ break;
+ case VISU::View::CENTER:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignHCenter));
+ break;
+ case VISU::View::RIGHT:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignRight));
+ break;
+ }
+ }
+ }
+
+
+ void
+ View_i::
+ SetViewPositionVertical(VISU::View::ViewPosition theViewPosition)
+ {
+ if(myWorkspace){
+ switch(theViewPosition){
+ case VISU::View::TOP:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignTop));
+ break;
+ case VISU::View::CENTER:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignVCenter));
+ break;
+ case VISU::View::BOTTOM:
+ ProcessVoidEvent(new TAlignEvent(myViewWindow,myWorkspace,Qt::AlignBottom));
+ break;
+ }
+ }
+ }
+
+
+ class TXYEvent: public TWorkspaceEvent
+ {
+ protected:
+ CORBA::Double myX, myY;
+
+ public:
+ TXYEvent(QWidget* theViewWindow,
+ QWidget* theWorkspace,
+ CORBA::Double theX,
+ CORBA::Double theY):
+ TWorkspaceEvent(theViewWindow,theWorkspace),
+ myX(theX),
+ myY(theY)
+ {}
+ };
+
+
+ void
+ View_i::
+ SetRelativePosition(CORBA::Double theX, CORBA::Double theY)
+ {
+ struct TEvent: public TXYEvent
+ {
+ public:
+ TEvent(QWidget* theViewWindow,
+ QWidget* theWorkspace,
+ CORBA::Double theX,
+ CORBA::Double theY):
+ TXYEvent(theViewWindow,theWorkspace,theX,theY)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
+ aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
+ }
+ };
+
+ if(myWorkspace)
+ ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
+ }
+
+ void
+ View_i::
+ SetRelativeSize(CORBA::Double theX, CORBA::Double theY)
+ {
+ struct TEvent: public TXYEvent
+ {
+ public:
+ TEvent(QWidget* theViewWindow,
+ QWidget* theWorkspace,
+ CORBA::Double theX,
+ CORBA::Double theY):
+ TXYEvent(theViewWindow,theWorkspace,theX,theY)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
+ aParent->setGeometry(aParent->x(),
+ aParent->y(),
+ int(myX*myWorkspace->width()),
+ int(myY*myWorkspace->height()));
+ }
+ };
+
+ if(myWorkspace)
+ ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY));
+ }
+
+ void
+ View_i::
+ SetBackground(const SALOMEDS::Color& theColor)
+ {
+ struct TEvent: public SALOME_Event
+ {
+ QWidget* myWidget;
+ SALOMEDS::Color myColor;
+ public:
+ TEvent(QWidget* theWidget,
+ const SALOMEDS::Color& theColor):
+ myWidget(theWidget),
+ myColor(theColor)
+ {}
+ virtual void Execute(){
+ int aColor[3];
+ aColor[0] = int(255.0*myColor.R);
+ aColor[1] = int(255.0*myColor.G);
+ aColor[2] = int(255.0*myColor.B);
+ myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2]));
+ }
+ };
+
+ ProcessVoidEvent(new TEvent(myViewWindow,theColor));
+ }
+
+
+ struct TBackgroundEvent: public SALOME_Event
+ {
+ QWidget* myWidget;
+ typedef SALOMEDS::Color TResult;
+ TResult myResult;
+
+ TBackgroundEvent(QWidget* theWidget):
+ myWidget(theWidget)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ const QColor& aColor = myWidget->backgroundColor();
+ myResult.R = aColor.red()/255.0;
+ myResult.G = aColor.green()/255.0;
+ myResult.B = aColor.blue()/255.0;
+ }
+ };
+
+ SALOMEDS::Color
+ View_i::
+ GetBackground()
+ {
+ return ProcessEvent(new TBackgroundEvent(myViewWindow));
+ }
+
+ void
+ View_i::
+ Minimize()
+ {
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMinimized));
+ }
+
+ void
+ View_i::
+ Restore()
+ {
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showNormal));
+ }
+
+ void
+ View_i::
+ Maximize()
+ {
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMaximized));
+ }
+
+ void
+ View_i::
+ EraseAll()
+ {}
+
+ void
+ View_i::
+ DisplayAll()
+ {}
+
+ void
+ View_i::
+ Erase(PrsObject_ptr thePrsObj)
+ {}
+
+ void
+ View_i::
+ Display(PrsObject_ptr thePrsObj)
+ {}
+
+ void
+ View_i::
+ DisplayOnly(PrsObject_ptr thePrsObj)
+ {}
+
+ void
+ View_i::
+ Update()
+ {}
+
+ CORBA::Boolean
+ View_i::SavePicture(const char* theFileName)
+ {
+ return false;
+ }
+
+ const char*
+ View_i::
+ GetComment() const
+ {
+ return "";
+ }
+ void
+ View_i::
+ ToStream(std::ostringstream& theStr)
+ {}
+
+
+ //================= OLD CODE ===================
+
+ //QAD_Study* CheckStudy (SALOMEDS::Study_ptr theStudy)
+ //{
+ // //QAD_Desktop* aDesktop = QAD_Application::getDesktop();
+ // //QAD_Study* aStudy = aDesktop->findStudy(theStudy);
+ // if (!aStudy) {
+ // CORBA::String_var aName = theStudy->Name();
+ // aFileInfo.setFile(aName.in());
+ // if (aFileInfo.exists())
+ // aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ // else
+ // aStudy = aDesktop->loadStudy(aName.in());
+ // if (!aStudy) {
+ // MESSAGE("CheckStudy()::ERROR: Can't load study");
+ // }
+ // }
+ // return aStudy;
+ //}
+
+ class TSavePictureEvent: public SALOME_Event
+ {
+ QWidget* myWidget;
+ const char* myFileName;
+ public:
+ typedef CORBA::Boolean TResult;
+ TResult myResult;
+ TSavePictureEvent (QWidget* theWidget, const char* theFileName)
+ : myWidget(theWidget),
+ myFileName(theFileName),
+ myResult(false)
+ {
+ }
+
+ virtual void Execute()
+ {
+ if (myWidget) {
+ QPixmap px = QPixmap::grabWindow(myWidget->winId());
+ if (!QString(myFileName).isNull()) {
+ QString fmt = SUIT_Tools::extension(myFileName).upper();
+ if (fmt.isEmpty())
+ fmt = QString("BMP"); // default format
+ if (fmt == "JPG")
+ fmt = "JPEG";
+ myResult = px.save(myFileName, fmt.latin1());
+ }
+ }
+ }
+ };
+
+
+ //===========================================================================
+ XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
+ : View_i(theApplication, theApplication->getViewManager(Plot2d_Viewer::Type(), true))
+ {
+ if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
+ }
+
+ Storable* XYPlot_i::Create (int theNew)
+ {
+ if (theNew) {
+ myViewWindow = myViewManager->createViewWindow();
+ } else {
+ myViewWindow = myViewManager->getActiveView();
+ }
+ //jfa tmp:myView = dynamic_cast<Plot2d_ViewFrame*>(myViewWindow->getRightFrame()->getViewFrame());
+ //jfa tmp:myView->Repaint();
+ return this;
+ }
+
+ void XYPlot_i::Update()
+ {
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
+ }
+
+ void XYPlot_i::Close()
+ {
+ myViewWindow->close();
+ }
+
+ XYPlot_i::~XYPlot_i() {
+ if(MYDEBUG) MESSAGE("XYPlot_i::~XYPlot_i");
+ }
+
+ void XYPlot_i::SetTitle (const char* theTitle)
+ {
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (myViewWindow, &SUIT_ViewWindow::setCaption, QString(theTitle)));
+ }
+ char* XYPlot_i::GetTitle()
+ {
+ return CORBA::string_dup(myViewWindow->caption().latin1());
+ }
+
+ void XYPlot_i::SetSubTitle (const char* theTitle)
+ {
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
+ (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
+ }
+
+ char* XYPlot_i::GetSubTitle()
+ {
+ return CORBA::string_dup(myView->getTitle());
+ }
+
+ void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
+ {
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
+ }
+
+ VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
+ {
+ return (VISU::XYPlot::CurveType)myView->getCurveType();
+ }
+
+ void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
+ {
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
+ }
+
+ CORBA::Long XYPlot_i::GetMarkerSize()
+ {
+ return myView->getMarkerSize();
+ }
+
+ class TEnableGridEvent: public SALOME_Event
+ {
+ public:
+ typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool = true);
+ TEnableGridEvent (Plot2d_ViewFrame* theView, TFun theFun,
+ CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor):
+ myView(theView), myFun(theFun),
+ myMajor(theMajor), myNumMajor(theNumMajor),
+ myMinor(theMinor), myNumMinor(theNumMinor)
+ {}
+
+ virtual void Execute()
+ {
+ (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor);
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ TFun myFun;
+ CORBA::Boolean myMajor, myNumMajor;
+ CORBA::Boolean myMinor, myNumMinor;
+ };
+
+ void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+ {
+ ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
+ theMajor,theNumMajor,theMinor,theNumMinor));
+ }
+ void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+ {
+ //jfa tmp:ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
+ //jfa tmp: theMajor,theNumMajor,theMinor,theNumMinor));
+ }
+
+ class TSetScaleModeEvent: public SALOME_Event
+ {
+ public:
+ typedef void (Plot2d_ViewFrame::* TFun)(const int, bool = true);
+ TSetScaleModeEvent (Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
+ myView(theView), myFun(theFun), myScaling(theScaling)
+ {}
+
+ virtual void Execute()
+ {
+ (myView->*myFun)(myScaling);
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ TFun myFun;
+ int myScaling;
+ };
+
+ void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
+ {
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
+ theScaling == VISU::LOGARITHMIC));
+ }
+
+ VISU::Scaling XYPlot_i::GetHorScaling()
+ {
+ return (VISU::Scaling)myView->getHorScaleMode();
+ }
+
+ void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
+ {
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
+ theScaling == VISU::LOGARITHMIC));
+ }
+
+ VISU::Scaling XYPlot_i::GetVerScaling()
+ {
+ return (VISU::Scaling)myView->getVerScaleMode();
+ }
+
+ class TSetTitleEvent: public SALOME_Event
+ {
+ public:
+ //typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, bool = true);
+ typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, Plot2d_ViewFrame::ObjectType, bool = true);
+ //TSetTitleEvent (Plot2d_ViewFrame* theView, TFun theFun, const char* theTitle):
+ TSetTitleEvent (Plot2d_ViewFrame* theView, Plot2d_ViewFrame::ObjectType theType, const char* theTitle):
+ //myView(theView), myFun(theFun), myTitle(theTitle)
+ myView(theView), myType(theType), myTitle(theTitle)
+ {}
+ virtual void Execute()
+ {
+ //(myView->*myFun)(true,myTitle,myType);
+ myView->setTitle(true,myTitle,myType);
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ //TFun myFun;
+ Plot2d_ViewFrame::ObjectType myType;
+ const char* myTitle;
+ };
+
+ void XYPlot_i::SetXTitle (const char* theTitle)
+ {
+ //ProcessVoidEvent(new TSetTitleEvent(myView, &Plot2d_ViewFrame::setXTitle, theTitle));
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
+ }
+ char* XYPlot_i::GetXTitle()
+ {
+ //return CORBA::string_dup(myView->getXTitle());
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
+ }
+
+ void XYPlot_i::SetYTitle (const char* theTitle)
+ {
+ //ProcessVoidEvent(new TSetTitleEvent(myView, &Plot2d_ViewFrame::setYTitle, theTitle));
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
+ }
+ char* XYPlot_i::GetYTitle()
+ {
+ //return CORBA::string_dup(myView->getYTitle());
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
+ }
+
+ void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
+ {
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
+ (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
+ }
+
+ class TXYPlotViewEvent: public SALOME_Event
+ {
+ _PTR(Study) myStudy;
+ Plot2d_ViewFrame* myView;
+ PrsObject_ptr myPrsObj;
+ int myDisplaing;
+
+ public:
+ TXYPlotViewEvent(_PTR(Study) theStudy,
+ Plot2d_ViewFrame* theView,
+ PrsObject_ptr thePrsObj,
+ int theDisplaing)
+ : myStudy(theStudy),
+ myView(theView),
+ myPrsObj(thePrsObj),
+ myDisplaing(theDisplaing)
+ {
+ }
+
+ virtual void Execute()
+ {
+ // is it Curve ?
+ if (Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
+ UpdatePlot2d(myView,myDisplaing,aCurve);
+ }
+ // is it Container ?
+ if (Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(myPrsObj).in())) {
+ int nbCurves = aContainer->GetNbCurves();
+ for ( int i = 1; i <= nbCurves; i++ ) {
+ VISU::Curve_i* aCurve = aContainer->GetCurve( i );
+ if ( aCurve && aCurve->IsValid() ) {
+ UpdatePlot2d(myView,myDisplaing,aCurve);
+ }
+ }
+ myView->Repaint();
+ }
+ // is it Table ?
+ if (Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(myPrsObj).in())) {
+ _PTR(SObject) TableSO = myStudy->FindObjectID(aTable->GetEntry());
+ if (TableSO) {
+ _PTR(ChildIterator) Iter = myStudy->NewChildIterator(TableSO);
+ for (; Iter->More(); Iter->Next()) {
+ CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value());
+ if (!CORBA::is_nil(childObject)) {
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject);
+ if (!CORBA::is_nil(aCurve))
+ UpdatePlot2d(myView, myDisplaing,
+ dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in()));
+ }
+ }
+ myView->Repaint();
+ }
+ }
+ }
+ };
+
+ void XYPlot_i::Display (PrsObject_ptr thePrsObj)
+ {
+ //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eDisplay));
+ }
+
+ void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
+ {
+ //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eErase));
+ }
+
+ void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
+ {
+ //jfa tmp:ProcessVoidEvent(new TXYPlotViewEvent (myStudy,myView,thePrsObj,eDisplayOnly));
+ }
+
+ void XYPlot_i::EraseAll()
+ {
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
+ }
+
+ void XYPlot_i::FitAll()
+ {
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
+ }
+
+ CORBA::Boolean XYPlot_i::SavePicture (const char* theFileName)
+ {
+ return ProcessEvent(new TSavePictureEvent (myView->getViewWidget(),theFileName));
+ }
+
+
+ //===========================================================================
+ TableView_i::TableView_i (SalomeApp_Application* theApplication)
+ : View_i(theApplication, theApplication->getViewManager("???"/*jfa tmp*/, true))
+ {
+ }
+
+ Storable* TableView_i::Create (VISU::Table_ptr theTable)
+ {
+ if (MYDEBUG) MESSAGE("TableView_i::Create - " << (!theTable->_is_nil()));
+ if (!theTable->_is_nil()) {
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable).in());
+ if (MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = " << table);
+ if (table != NULL) {
+
+ if (SUIT_Study* aSStudy = myViewManager->study()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(table->GetObjectEntry());
+ if (aSObject) {
+ //jfa tmp:myView = new SALOMEGUI_TableDlg (QAD_Application::getDesktop(),
+ //jfa tmp: aSObject,
+ //jfa tmp: false,
+ //jfa tmp: SALOMEGUI_TableDlg::ttAuto,
+ //jfa tmp: Qt::Vertical);
+ //jfa tmp:myView->show();
+ return this;
+ }
+ }
+ }
+ }
+ }
+ }
+ return NULL;
+ }
+
+ TableView_i::~TableView_i()
+ {
+ if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
+ //jfa tmp:delete myView;
+ }
+
+ void TableView_i::SetTitle (const char* theTitle)
+ {
+ //jfa tmp:ProcessVoidEvent(new TVoidMemFun1ArgEvent<SALOMEGUI_TableDlg,const QString&,QString>
+ //jfa tmp: (myView, &SALOMEGUI_TableDlg::setCaption, QString(theTitle)));
+ }
+
+ char* TableView_i::GetTitle()
+ {
+ //jfa tmp:return CORBA::string_dup(myView->caption().latin1());
+ return "";
+ }
+
+ void TableView_i::Close()
+ {
+ //jfa tmp:myView->close();
+ }
+
+
+ //===========================================================================
+ int View3D_i::myNbViewParams = 0;
+ const string View3D_i::myComment = "VIEW3D";
+ const char* View3D_i::GetComment() const { return myComment.c_str();}
+
+ QString View3D_i::GenerateViewParamsName()
+ {
+ return VISU::GenerateName("ViewParams", ++myNbViewParams);
+ }
+
+ View3D_i::View3D_i (SalomeApp_Application* theApplication)
+ : View_i(theApplication, theApplication->getViewManager(SVTK_Viewer::Type(), true))
+ {
+ if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
+ }
+
+ Storable* View3D_i::Create (int theNew)
+ {
+ if (MYDEBUG) MESSAGE("View3D_i::Create");
+ if (theNew) {
+ myViewWindow = myViewManager->createViewWindow();
+ } else {
+ myViewWindow = myViewManager->getActiveView();
+ }
+ return this;
+ }
+
+ void View3D_i::Update()
+ {
+ class TEvent: public SALOME_Event
+ {
+ SUIT_ViewWindow* myViewWindow;
+ public:
+ TEvent(SUIT_ViewWindow* theStudyFrame):
+ myViewWindow(theStudyFrame)
+ {}
+ virtual void Execute()
+ {
+ SVTK_ViewWindow* vf = GetViewWindow(myViewWindow);
+ vtkRenderer* Renderer = vf->getRenderer();
+ vtkActorCollection* theActors = Renderer->GetActors();
+ theActors->InitTraversal();
+ while (vtkActor *anAct = theActors->GetNextActor()) {
+ if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
+ VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d();
+ if (anActor->GetVisibility() && aPrs3d) {
+ aPrs3d->Update();
+ aPrs3d->UpdateActor(anActor);
+ }
+ }
+ }
+ RepaintView(myViewWindow);
+ }
+ };
+ ProcessVoidEvent(new TEvent(myViewWindow));
+ }
+
+ CORBA::Boolean View3D_i::SavePicture (const char* theFileName)
+ {
+ //jfa tmp:return ProcessEvent(new TSavePictureEvent
+ //jfa tmp: (myView->getViewWidget(), theFileName));
+ return false;
+ }
+
+ bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+ {
+ _PTR(Study) aCStudy;
+ if (SUIT_Study* aSStudy = theViewManager->study()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ aCStudy = aStudy->studyDS();
+ }
+ }
+ if (!aCStudy)
+ return false;
+
+ if (theName) {
+ std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
+ _PTR(GenericAttribute) anAttr;
+ int iEnd = aList.size();
+ for (int i = 0; i < iEnd; i++) {
+ _PTR(SObject) anObj = aList[i];
+ string anEntry = anObj->GetID();
+ if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry);
+ if (anObj->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aCmnt (anAttr);
+ string aComm (aCmnt->Value());
+ if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm);
+ if (aComm.compare(View3D_i::myComment) >= 0) {
+ aCmnt->SetValue(ToString(theViewManager->getActiveView()).c_str());
+ return true;
+ }
+ }
+ }
+ }
+ _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
+ string aSComponentEntry = aSComponent->GetID();
+ string anEntry = CreateAttributes(aCStudy, aSComponentEntry.c_str(), "", "", theName, "",
+ ToString(theViewManager->getActiveView()).c_str());
+ return true;
+ }
+
+ CORBA::Boolean View3D_i::SaveViewParams (const char* theName)
+ {
+ return SaveViewParams(myViewManager, theName);
+ }
+
+ bool View3D_i::RestoreViewParams (SUIT_ViewManager* theViewManager, const char* theName)
+ {
+ _PTR(Study) aCStudy;
+ if (SUIT_Study* aSStudy = theViewManager->study()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ aCStudy = aStudy->studyDS();
+ }
+ }
+ if (!aCStudy)
+ return false;
+
+ std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
+ _PTR(GenericAttribute) anAttr;
+ int iEnd = aList.size();
+ if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - iEnd = " << iEnd);
+ for (int i = 0; i < iEnd; i++) {
+ _PTR(SObject) anObj = aList[i];
+ string anEntry = anObj->GetID();
+ if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
+ if (anObj->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aCmnt (anAttr);
+ QString strIn (aCmnt->Value());
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(strIn, aMap);
+ if (Storable::FindValue(aMap, "myComment").compare
+ (View3D_i::myComment.c_str()) >= 0) {
+ if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
+ Restore(theViewManager->getActiveView(), aMap);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ class TRestoreViewParamsEvent: public SALOME_Event
+ {
+ SUIT_ViewManager* myViewManager;
+ const char* myName;
+ public:
+ TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
+ const char* theName):
+ myViewManager(theViewManager),
+ myName(theName)
+ {}
+
+ virtual void Execute()
+ {
+ myResult = View3D_i::RestoreViewParams(myViewManager, myName);
+ }
+ typedef CORBA::Boolean TResult;
+ TResult myResult;
+ };
+
+ CORBA::Boolean View3D_i::RestoreViewParams (const char* theName)
+ {
+ return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
+ }
+
+ void View3D_i::Restore (SUIT_ViewWindow* theStudyFrame,
+ const Storable::TRestoringMap& theMap)
+ {
+ SALOMEDS::Color aColor;
+ aColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
+ aColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
+ aColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
+
+ double aPosition[3];
+ aPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
+ aPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
+ aPosition[2] = VISU::Storable::FindValue(theMap,"myPosition[2]").toDouble();
+
+ double aFocalPnt[3];
+ aFocalPnt[0] = VISU::Storable::FindValue(theMap,"myFocalPnt[0]").toDouble();
+ aFocalPnt[1] = VISU::Storable::FindValue(theMap,"myFocalPnt[1]").toDouble();
+ aFocalPnt[2] = VISU::Storable::FindValue(theMap,"myFocalPnt[2]").toDouble();
+
+ double aViewUp[3];
+ aViewUp[0] = VISU::Storable::FindValue(theMap,"myViewUp[0]").toDouble();
+ aViewUp[1] = VISU::Storable::FindValue(theMap,"myViewUp[1]").toDouble();
+ aViewUp[2] = VISU::Storable::FindValue(theMap,"myViewUp[2]").toDouble();
+
+ double aParallelScale = VISU::Storable::FindValue(theMap,"myParallelScale").toDouble();
+
+ double aScaleFactor[3];
+ aScaleFactor[0] = VISU::Storable::FindValue(theMap,"myScaleFactor[0]").toDouble();
+ aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
+ aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
+
+ SetBackground(theStudyFrame,aColor);
+ SetPointOfView(theStudyFrame,aPosition);
+ SetViewUp(theStudyFrame,aViewUp);
+ SetFocalPoint(theStudyFrame,aFocalPnt);
+ SetParallelScale(theStudyFrame,aParallelScale);
+ ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
+ ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
+ ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
+ }
+
+
+ string View3D_i::ToString (SUIT_ViewWindow* theStudyFrame)
+ {
+ ostringstream strOut;
+ Storable::DataToStream( strOut, "myComment", myComment.c_str() );
+ ToStream(theStudyFrame,strOut);
+ strOut<<ends;
+ if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
+ return strOut.str();
+ }
+
+ void View3D_i::ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr)
+ {
+ Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
+
+ float backint[3];
+ GetRenderer(theStudyFrame)->GetBackground(backint);
+ Storable::DataToStream(theStr,"myColor.R",backint[0]);
+ Storable::DataToStream(theStr,"myColor.G",backint[1]);
+ Storable::DataToStream(theStr,"myColor.B",backint[2]);
+
+ double aPosition[3];
+ GetPointOfView(theStudyFrame,aPosition);
+ Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
+ Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
+ Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
+
+ double aFocalPnt[3];
+ GetFocalPoint(theStudyFrame,aFocalPnt);
+ Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
+ Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
+ Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
+
+ double aViewUp[3];
+ GetCamera(theStudyFrame)->GetViewUp(aViewUp);
+ Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
+ Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
+ Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
+
+ Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
+
+ double aScaleFactor[3];
+ GetViewWindow(theStudyFrame)->GetScale(aScaleFactor);
+ Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
+ Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
+ Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
+ }
+
+ void View3D_i::ToStream(std::ostringstream& theStr)
+ {
+ ToStream(myViewWindow,theStr);
+ }
+
+ void View3D_i::Close()
+ {
+ myViewWindow->close();
+ }
+
+ View3D_i::~View3D_i()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::~View3D_i");
+ }
+
+ void View3D_i::SetTitle (const char* theTitle)
+ {
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (myViewWindow,&SUIT_ViewWindow::setCaption,QString(theTitle)));
+ }
+
+ char* View3D_i::GetTitle()
+ {
+ return CORBA::string_dup(myViewWindow->caption().latin1());
+ }
+
+ void View3D_i::SetBackground (SUIT_ViewWindow* theStudyFrame,
+ const SALOMEDS::Color& theColor)
+ {
+ int aColor[3];
+ aColor[0] = int(255.0*theColor.R);
+ aColor[1] = int(255.0*theColor.G);
+ aColor[2] = int(255.0*theColor.B);
+ QColor aNewColor(aColor[0],aColor[1],aColor[2]);
+ GetViewWindow(theStudyFrame)->setBackgroundColor(aNewColor);
+ }
+
+ SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theStudyFrame)
+ {
+ SALOMEDS::Color aColor;
+ float backint[3];
+ GetRenderer(theStudyFrame)->GetBackground(backint);
+ aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
+ return aColor;
+ }
+
+ class TUpdateViewerEvent: public SALOME_Event
+ {
+ SUIT_ViewWindow* myViewWindow;
+ Prs3d_i* myPrs3d;
+ int myDisplaing;
+ public:
+ TUpdateViewerEvent(SUIT_ViewWindow* theStudyFrame,
+ Prs3d_i* thePrs3d,
+ int theDisplaing):
+ myViewWindow(theStudyFrame),
+ myPrs3d(thePrs3d),
+ myDisplaing(theDisplaing)
+ {}
+ virtual void Execute(){
+ UpdateViewer(myViewWindow,myDisplaing,myPrs3d);
+ }
+ };
+
+ void View3D_i::EraseAll()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eEraseAll));
+ }
+
+ void View3D_i::DisplayAll()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eDisplayAll));
+ }
+
+ void View3D_i::Erase (PrsObject_ptr thePrsObj)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::Erase");
+ CORBA::Object_ptr anObj = thePrsObj;
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eErase));
+ }
+ }
+
+ void View3D_i::Display (PrsObject_ptr thePrsObj)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::Display");
+ CORBA::Object_ptr anObj = thePrsObj;
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplay));
+ }
+ }
+
+ void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
+ CORBA::Object_ptr anObj = thePrsObj;
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly));
+ }
+ }
+
+ void View3D_i::FitAll()
+ {
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFitAll));
+ Update();
+ }
+
+ void View3D_i::SetView (VISU::View3D::ViewType theType)
+ {
+ switch (theType) {
+ case VISU::View3D::FRONT :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView));
+ break;
+ case VISU::View3D::BACK :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView));
+ break;
+ case VISU::View3D::LEFT :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView));
+ break;
+ case VISU::View3D::RIGHT :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView));
+ break;
+ case VISU::View3D::TOP :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView));
+ break;
+ case VISU::View3D::BOTTOM :
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView));
+ break;
+ }
+ Update();
+ }
+
+ class TSet3DViewParamEvent: public SALOME_Event
+ {
+ public:
+ typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, const CORBA::Double theParam[3]);
+ TSet3DViewParamEvent (TFun theFun,
+ SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double theParam[3]):
+ myFun(theFun),
+ myViewWindow(theStudyFrame),
+ myParam(theParam)
+ {}
+ virtual void Execute(){
+ myFun(myViewWindow,myParam);
+ }
+ private:
+ TFun myFun;
+ SUIT_ViewWindow* myViewWindow;
+ const CORBA::Double* myParam;
+ };
+
+ void View3D_i::SetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double thePosition[3])
+ {
+ GetCamera(theStudyFrame)->SetPosition(thePosition);
+ }
+
+ void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myViewWindow,thePosition));
+ }
+
+ void View3D_i::GetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double thePosition[3])
+ {
+ GetCamera(theStudyFrame)->GetPosition(thePosition);
+ }
+
+ VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
+ CORBA::Double aPosition[3];
+ GetPointOfView(myViewWindow,aPosition);
+ return VISU::View3D::XYZ_dup(aPosition);
+ }
+
+ void View3D_i::SetViewUp (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double theViewUp[3])
+ {
+ GetCamera(theStudyFrame)->SetViewUp(theViewUp);
+ }
+
+ void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myViewWindow,theViewUp));
+ }
+
+ void View3D_i::GetViewUp (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double theViewUp[3])
+ {
+ GetCamera(theStudyFrame)->GetViewUp(theViewUp);
+ }
+
+ VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
+ CORBA::Double aViewUp[3];
+ GetCamera(myViewWindow)->GetViewUp(aViewUp);
+ return VISU::View3D::XYZ_dup(aViewUp);
+ }
+
+ void View3D_i::SetFocalPoint (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double theFocalPnt[3])
+ {
+ GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
+ }
+
+ void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myViewWindow,theCoord));
+ }
+
+
+ void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double theFocalPnt[3])
+ {
+ GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
+ }
+
+ VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
+ CORBA::Double aFocalPnt[3];
+ GetFocalPoint(myViewWindow,aFocalPnt);
+ return VISU::View3D::XYZ_dup(aFocalPnt);
+ }
+
+ class TSetViewParamEvent: public SALOME_Event
+ {
+ public:
+ typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, CORBA::Double theParam);
+ TSetViewParamEvent (TFun theFun,
+ SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double theParam):
+ myFun(theFun),
+ myViewWindow(theStudyFrame),
+ myParam(theParam)
+ {}
+ virtual void Execute()
+ {
+ myFun(myViewWindow,myParam);
+ }
+ private:
+ TFun myFun;
+ SUIT_ViewWindow* myViewWindow;
+ CORBA::Double myParam;
+ };
+
+ void View3D_i::SetParallelScale (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double theScale)
+ {
+ GetCamera(theStudyFrame)->SetParallelScale(theScale);
+ }
+
+ void View3D_i::SetParallelScale (CORBA::Double theScale)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
+ ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myViewWindow,theScale));
+ }
+
+ CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theStudyFrame)
+ {
+ return GetCamera(theStudyFrame)->GetParallelScale();
+ }
+
+ CORBA::Double View3D_i::GetParallelScale()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
+ return GetParallelScale(myViewWindow);
+ }
+
+ void View3D_i::ScaleView (SUIT_ViewWindow* theStudyFrame,
+ VISU::View3D::Axis theAxis, CORBA::Double theParam)
+ {
+ SVTK_ViewWindow* aViewFrame = GetViewWindow(theStudyFrame);
+ double aScaleFactor[3];
+ aViewFrame->GetScale(aScaleFactor);
+ aScaleFactor[theAxis] = theParam;
+ aViewFrame->SetScale(aScaleFactor);
+ }
+
+ void SetScaleView (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theScale[3])
+ {
+ double aScale[3] = {theScale[0], theScale[1], theScale[2]};
+ GetViewWindow(theStudyFrame)->SetScale(aScale);
+ }
+
+ void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
+ double aScale[3];
+ GetViewWindow(myViewWindow)->GetScale(aScale);
+ aScale[theAxis] = theParam;
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
+ }
+
+ void View3D_i::RemoveScale()
+ {
+ if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
+ double aScale[3] = {1.0, 1.0, 1.0};
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
+ }
+}
--- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File : VISU_View_i.hh
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_View_i_HeaderFile
+#define VISU_View_i_HeaderFile
+
+#include "VISUConfig.hh"
+
+class QWidget;
+
+class SalomeApp_Application;
+
+class SUIT_ViewManager;
+class SUIT_ViewWindow;
+
+class Plot2d_ViewFrame;
+
+namespace VISU
+{
+ class Prs3d_i;
+ class Curve_i;
+
+ class View_i : public virtual POA_VISU::View,
+ public virtual Storable
+ {
+ SalomeApp_Application *myApplication;
+
+ public:
+ QWidget* myWorkspace;
+ SUIT_ViewWindow* myViewWindow;
+
+ protected:
+ SUIT_ViewManager* myViewManager;
+
+ View_i (SalomeApp_Application *theApplication,
+ SUIT_ViewManager* theViewManager);
+ virtual ~View_i();
+
+ public:
+ virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
+ virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
+ virtual void SetViewWidth(CORBA::Long Width);
+ virtual void SetViewHeight(CORBA::Long Height);
+ virtual CORBA::Long GetViewWidth();
+ virtual CORBA::Long GetViewHeight();
+ virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor);
+ virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer);
+
+ virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y );
+ virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y );
+
+ virtual void SetBackground(const SALOMEDS::Color& theColor);
+ virtual SALOMEDS::Color GetBackground();
+ virtual void Minimize();
+ virtual void Restore();
+ virtual void Maximize();
+ virtual void EraseAll();
+ virtual void DisplayAll();
+ virtual void Erase(PrsObject_ptr thePrsObj);
+ virtual void Display(PrsObject_ptr thePrsObj);
+ virtual void DisplayOnly(PrsObject_ptr thePrsObj);
+ virtual void Update();
+
+ virtual CORBA::Boolean SavePicture(const char* theFileName);
+
+ virtual void Close() = 0;
+ virtual void ToStream(std::ostringstream& theStr);
+ virtual const char* GetComment() const;
+ };
+
+
+ //===========================================================================
+ class XYPlot_i : public virtual POA_VISU::XYPlot,
+ public virtual View_i
+ {
+ public:
+ typedef VISU::XYPlot TInterface;
+
+ XYPlot_i (SalomeApp_Application *theApplication);
+ virtual ~XYPlot_i();
+
+ virtual VISU::VISUType GetType() { return VISU::TXYPLOT; };
+
+ virtual void SetTitle (const char* theTitle);
+ virtual char* GetTitle();
+
+ virtual void SetSubTitle (const char* theTitle);
+ virtual char* GetSubTitle();
+
+ virtual void SetCurveType (VISU::XYPlot::CurveType theType);
+ virtual VISU::XYPlot::CurveType GetCurveType();
+
+ virtual void SetMarkerSize (CORBA::Long theSize);
+ virtual CORBA::Long GetMarkerSize();
+
+ virtual void EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+ virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+
+ virtual void SetHorScaling (VISU::Scaling theScaling);
+ virtual VISU::Scaling GetHorScaling();
+ virtual void SetVerScaling (VISU::Scaling theScaling);
+ virtual VISU::Scaling GetVerScaling();
+
+ virtual void SetXTitle (const char* theTitle);
+ virtual char* GetXTitle();
+
+ virtual void SetYTitle (const char* theTitle);
+ virtual char* GetYTitle();
+
+ virtual void ShowLegend (CORBA::Boolean theShowing);
+
+ virtual void EraseAll();
+ virtual void Erase (PrsObject_ptr thePrsObj);
+ virtual void Display (PrsObject_ptr thePrsObj);
+ virtual void DisplayOnly (PrsObject_ptr thePrsObj);
+ virtual void Update();
+
+ virtual CORBA::Boolean SavePicture (const char* theFileName);
+
+ virtual void FitAll();
+
+ virtual void Close();
+ protected:
+ Plot2d_ViewFrame* myView;
+ public:
+ virtual Storable* Create (int theNew);
+ };
+
+
+ //===========================================================================
+ class TableView_i : public virtual POA_VISU::TableView,
+ public virtual View_i
+ {
+ public:
+ typedef VISU::TableView TInterface;
+
+ TableView_i (SalomeApp_Application *theApplication);
+ virtual ~TableView_i();
+
+ virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW; };
+
+ virtual void SetTitle (const char* theTitle);
+ virtual char* GetTitle();
+
+ virtual void Close();
+ protected:
+ //SALOMEGUI_TableDlg* myView;
+ public:
+ virtual Storable* Create (VISU::Table_ptr theTable);
+ };
+
+
+ //===========================================================================
+ class View3D_i : public virtual POA_VISU::View3D,
+ public virtual View_i
+ {
+ public:
+ typedef VISU::View3D TInterface;
+
+ View3D_i (SalomeApp_Application *theApplication);
+ virtual ~View3D_i();
+
+ virtual VISU::VISUType GetType() { return VISU::TVIEW3D; };
+
+ //View interface
+ virtual void SetTitle (const char* theTitle);
+ virtual char* GetTitle();
+
+ static void SetBackground (SUIT_ViewWindow* theStudyFrame,
+ const SALOMEDS::Color& theColor);
+
+ static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theStudyFrame);
+
+ virtual void EraseAll();
+ virtual void DisplayAll();
+ virtual void Erase (PrsObject_ptr thePrsObj);
+ virtual void Display (PrsObject_ptr thePrsObj);
+ virtual void DisplayOnly (PrsObject_ptr thePrsObj);
+ virtual void Update();
+
+ virtual CORBA::Boolean SavePicture (const char* theFileName);
+
+ //View3D interface
+ virtual void FitAll();
+ virtual void SetView (VISU::View3D::ViewType theType);
+
+ static void SetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double thePosition[3]);
+ virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
+
+ static void GetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double thePosition[3]);
+ virtual VISU::View3D::XYZ_slice* GetPointOfView();
+
+ static void SetViewUp (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double theViewUp[3]);
+ virtual void SetViewUp (const VISU::View3D::XYZ theDir);
+
+ static void GetViewUp (SUIT_ViewWindow* theStudyFrame, CORBA::Double theViewUp[3]);
+ virtual VISU::View3D::XYZ_slice* GetViewUp();
+
+ static void SetFocalPoint (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theFocalPnt[3]);
+ virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
+
+ static void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame, CORBA::Double theFocalPnt[3]);
+ virtual VISU::View3D::XYZ_slice* GetFocalPoint();
+
+ static void SetParallelScale (SUIT_ViewWindow* theStudyFrame, CORBA::Double theScale);
+ virtual void SetParallelScale (CORBA::Double theScale);
+
+ static CORBA::Double GetParallelScale (SUIT_ViewWindow* theStudyFrame);
+ virtual CORBA::Double GetParallelScale ();
+
+ static void ScaleView (SUIT_ViewWindow* theStudyFrame,
+ VISU::View3D::Axis theAxis, CORBA::Double theParam);
+ virtual void ScaleView (VISU::View3D::Axis theAxis, CORBA::Double theParam);
+ virtual void RemoveScale();
+
+ static std::string ToString (SUIT_ViewWindow* theStudyFrame);
+
+ static void ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr);
+
+ static bool SaveViewParams (SUIT_ViewManager* theViewManager,
+ const char* theName);
+ virtual CORBA::Boolean SaveViewParams (const char* theName);
+
+ static bool RestoreViewParams (SUIT_ViewManager* theViewManager,
+ const char* theName);
+ virtual CORBA::Boolean RestoreViewParams (const char* theName);
+
+ static QString GenerateViewParamsName();
+
+ static void Restore (SUIT_ViewWindow* theStudyFrame,
+ const Storable::TRestoringMap& theMap);
+
+ virtual void Close();
+
+ protected:
+ static int myNbViewParams;
+
+ public:
+ virtual Storable* Create (int theNew);
+ virtual void ToStream (std::ostringstream& theStr);
+ virtual const char* GetComment() const;
+ static const std::string myComment;
+ };
+}
+
+#endif
myLocalStudy = theStudy
myLocalVisu.SetCurrentStudy(myLocalStudy)
return myLocalVisu
+
+def PublishComponent(theStudyDocument):
+ aComponentDataType = myLocalVisu.ComponentDataType()
+ aSComponent = theStudyDocument.FindComponent(aComponentDataType)
+ if aSComponent == None:
+ aStudyBuilder = theStudyDocument.NewBuilder()
+ aStudyBuilder.NewCommand()
+ aLocked = theStudyDocument.GetProperties().IsLocked()
+ if aLocked:
+ theStudyDocument.GetProperties().SetLocked(0)
+ pass
+
+ aSComponent = aStudyBuilder.NewComponent(aComponentDataType);
+ aName = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributeName")
+ aModuleCatalog = myNamingService.Resolve("/Kernel/ModulCatalog");
+ aComponent = aModuleCatalog.GetComponent(aComponentDataType);
+ if aComponent != None:
+ aComponentUserName = aComponent._get_componentusername()
+ aName.SetValue(aComponentUserName)
+ pass
+
+ aPixMap = aStudyBuilder.FindOrCreateAttribute(aSComponent,"AttributePixMap")
+ aPixMap.SetPixMap("ICON_OBJBROWSER_Visu")
+
+ aStudyBuilder.DefineComponentInstance(aSComponent,myLocalVisu);
+ if aLocked:
+ theStudyDocument.GetProperties().SetLocked(1);
+ pass
+
+ aStudyBuilder.CommitCommand();
+ pass
+ return aSComponent;
+
def StrToMap(theString) :
aPairList = split(theString,";")
aMap = {}
dump_scalarmap_parameters(theObject)
print "GetNbSurfaces() = "+ str(theObject.GetNbSurfaces())
+
+
+# ----------------------
+# TABLES AND CURVES
+# ----------------------
+
+def FillTable( theTable, theValues, theRows, theColumns, theRowTitles, theRowUnits, theColumnTitles ):
+ if theTable is None: return
+ if len(theRows) != len(theColumns): return
+ if len(theRows) != len(theValues): return
+ i = 0
+ for value in theValues:
+ theTable.PutValue( value, theRows[ i ], theColumns[ i ])
+ i = i + 1
+ pass
+ i = 1
+ for title in theRowTitles:
+ theTable.SetRowTitle( i, title )
+ theTable.SetRowUnit( i, theRowUnits[ i - 1 ])
+ i = i + 1
+ pass
+ i = 1
+ for title in theColumnTitles:
+ theTable.SetColumnTitle( i, title )
+ i = i + 1
+ pass
+ pass
+
+def CreateCurve( theTable, theHRow, theVRow, theTitle, theColor, theMarker, theLineType, theLineWidth ):
+ if theTitle is None: return
+ curve = myLocalVisu.CreateCurve( theTable, theHRow, theVRow );
+ if curve:
+ curve.SetTitle( theTitle )
+ curve.SetColor( theColor )
+ curve.SetMarker( theMarker )
+ curve.SetLine( theLineType, theLineWidth )
+ pass
+ return curve