DCQ:prepare 2.0.0

This commit is contained in:
yfr 2004-07-20 07:56:05 +00:00
parent baa66acb33
commit 51569f091c
53 changed files with 503 additions and 5951 deletions

View File

@ -1,36 +0,0 @@
// 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
#include "Driver_Document.h"
Driver_Document::Driver_Document():
myDocument(NULL)
{}
void Driver_Document::SetFile(const std::string& theFileName)
{
myFile = theFileName;
}
void Driver_Document::SetDocument(SMESHDS_Document * theDocument)
{
myDocument = theDocument;
}

View File

@ -1,44 +0,0 @@
// 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
#ifndef _INCLUDE_DRIVER_DOCUMENT
#define _INCLUDE_DRIVER_DOCUMENT
#include <string>
class SMESHDS_Document;
class Driver_Document
{
public:
Driver_Document();
virtual ~Driver_Document(){}
virtual void Perform() = 0;
void SetFile(const std::string& theFileName);
void SetDocument(SMESHDS_Document *theDocument);
protected:
SMESHDS_Document * myDocument;
std::string myFile;
};
#endif

View File

@ -1,46 +0,0 @@
// SMESH Driver : implementaion of driver for reading and writing
//
// 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 : Mesh_Reader.cxx
// Module : SMESH
#include "Driver_Mesh.h"
using namespace std;
Driver_Mesh::Driver_Mesh():
myFile(""),
myMeshId(-1)
{}
void Driver_Mesh::SetMeshId(int theMeshId)
{
myMeshId = theMeshId;
}
void Driver_Mesh::SetFile(const std::string& theFileName)
{
myFile = theFileName;
}

View File

@ -1,57 +0,0 @@
// SMESH Driver : implementaion of driver for reading and writing
//
// 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 : Mesh_Reader.h
// Module : SMESH
#ifndef _INCLUDE_DRIVER_MESH
#define _INCLUDE_DRIVER_MESH
#include <string>
class Driver_Mesh
{
public:
Driver_Mesh();
virtual ~Driver_Mesh(){}
enum Status {
DRS_OK,
DRS_EMPTY, // a file contains no mesh with the given name
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
// so the numbers from the file are ignored
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
DRS_FAIL // general failure (exception etc.)
};
virtual Status Perform() = 0;
void SetMeshId(int theMeshId);
void SetFile(const std::string& theFileName);
protected:
std::string myFile;
int myMeshId;
};
#endif

View File

@ -1,31 +0,0 @@
// 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
#include "Driver_SMDS_Mesh.h"
using namespace std;
Driver_SMDS_Mesh::Driver_SMDS_Mesh():
myMesh(NULL)
{}
void Driver_SMDS_Mesh::SetMesh(SMDS_Mesh *theMesh)
{
myMesh = theMesh;
}

View File

@ -1,38 +0,0 @@
// 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
#ifndef _INCLUDE_DRIVER_SMDS_MESH
#define _INCLUDE_DRIVER_SMDS_MESH
#include "Driver_Mesh.h"
class SMDS_Mesh;
class Driver_SMDS_Mesh: public Driver_Mesh
{
public:
Driver_SMDS_Mesh();
void SetMesh(SMDS_Mesh *theMesh);
protected:
SMDS_Mesh *myMesh;
};
#endif

View File

@ -1,31 +0,0 @@
// 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
#include "Driver_SMESHDS_Mesh.h"
using namespace std;
Driver_SMESHDS_Mesh::Driver_SMESHDS_Mesh():
myMesh(NULL)
{}
void Driver_SMESHDS_Mesh::SetMesh(SMESHDS_Mesh *theMesh)
{
myMesh = theMesh;
}

View File

@ -1,38 +0,0 @@
// 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
#ifndef _INCLUDE_DRIVER_SMESHDS_MESH
#define _INCLUDE_DRIVER_SMESHDS_MESH
#include "Driver_Mesh.h"
class SMESHDS_Mesh;
class Driver_SMESHDS_Mesh: public Driver_Mesh
{
public:
Driver_SMESHDS_Mesh();
void SetMesh(SMESHDS_Mesh *theMesh);
protected:
SMESHDS_Mesh *myMesh;
};
#endif

View File

@ -1,28 +0,0 @@
// 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
#include "DriverDAT_R_SMDS_Mesh.h"
#include "DriverDAT_W_SMDS_Mesh.h"
int main(int argc, char** argv)
{
DriverDAT_R_SMDS_Mesh aR;
DriverDAT_W_SMDS_Mesh aW;
return 1;
}

View File

@ -37,6 +37,8 @@
#include <stdlib.h>
#define _EDF_NODE_IDS_
DriverMED_R_SMESHDS_Mesh::DriverMED_R_SMESHDS_Mesh()
:
myMesh (NULL),
@ -121,6 +123,82 @@ FindNode(const SMDS_Mesh* theMesh, med_int theId){
}
enum ECoordName{eX, eY, eZ, eNone};
typedef med_float (*TGetCoord)(MEDA::PNodeInfo&, med_int);
template<ECoordName TheCoordId>
med_float GetCoord(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId);
}
template<>
med_float GetCoord<eNone>(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
return 0.0;
}
static TGetCoord aXYZGetCoord[3] = {
&GetCoord<eX>,
&GetCoord<eY>,
&GetCoord<eZ>
};
static TGetCoord aXYGetCoord[3] = {
&GetCoord<eX>,
&GetCoord<eY>,
&GetCoord<eNone>
};
static TGetCoord aYZGetCoord[3] = {
&GetCoord<eNone>,
&GetCoord<eX>,
&GetCoord<eY>
};
static TGetCoord aXZGetCoord[3] = {
&GetCoord<eX>,
&GetCoord<eNone>,
&GetCoord<eY>
};
static TGetCoord aXGetCoord[3] = {
&GetCoord<eX>,
&GetCoord<eNone>,
&GetCoord<eNone>
};
static TGetCoord aYGetCoord[3] = {
&GetCoord<eNone>,
&GetCoord<eX>,
&GetCoord<eNone>
};
static TGetCoord aZGetCoord[3] = {
&GetCoord<eNone>,
&GetCoord<eNone>,
&GetCoord<eX>
};
class TCoordHelper{
MEDA::PNodeInfo myPNodeInfo;
TGetCoord* myGetCoord;
public:
TCoordHelper(const MEDA::PNodeInfo& thePNodeInfo,
TGetCoord* theGetCoord):
myPNodeInfo(thePNodeInfo),
myGetCoord(theGetCoord)
{}
virtual ~TCoordHelper(){}
med_float GetCoord(med_int theElemId, med_int theCoodId){
return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId);
}
};
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
{
ReadStatus result = DRS_FAIL;
@ -148,8 +226,7 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
MESSAGE("ReadMySelf - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue;
result = DRS_OK;
med_int aMeshDim = aMeshInfo->GetDim();
// Reading MED families to the temporary structure
//------------------------------------------------
med_int aNbFams = aMed.GetNbFamilies(aMeshInfo);
@ -159,7 +236,6 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
med_int aFamId = aFamilyInfo->GetId();
MESSAGE("Family " << aFamId << " :");
//if (aFamId >= FIRST_VALID_FAMILY) {
DriverMED_FamilyPtr aFamily (new DriverMED_Family);
med_int aNbGrp = aFamilyInfo->GetNbGroup();
@ -169,21 +245,56 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName);
}
// aFamily->SetId(aFamId);
myFamilies[aFamId] = aFamily;
// }
}
// Reading MED nodes to the corresponding SMDS structure
//------------------------------------------------------
PNodeInfo aNodeInfo = aMed.GetNodeInfo(aMeshInfo);
TCoordHelperPtr aCoordHelperPtr;
{
med_int aMeshDimension = aMeshInfo->GetDim();
bool anIsDimPresent[3] = {false, false, false};
for(med_int iDim = 0; iDim < aMeshDimension; iDim++){
string aDimName = aNodeInfo->GetCoordName(iDim);
if(aDimName == "x" || aDimName == "X")
anIsDimPresent[eX] = true;
else if(aDimName == "y" || aDimName == "Y")
anIsDimPresent[eY] = true;
else if(aDimName == "z" || aDimName == "Z")
anIsDimPresent[eZ] = true;
}
switch(aMeshDimension){
case 3:
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aXYZGetCoord));
break;
case 2:
if(anIsDimPresent[eY] && anIsDimPresent[eZ])
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aYZGetCoord));
else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aXZGetCoord));
else
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aXYGetCoord));
break;
case 1:
if(anIsDimPresent[eY])
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aYGetCoord));
else if(anIsDimPresent[eZ])
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aZGetCoord));
else
aCoordHelperPtr.reset(new TCoordHelper(aNodeInfo,aXGetCoord));
break;
}
}
med_booleen anIsNodeNum = aNodeInfo->IsElemNum();
med_int aNbElems = aNodeInfo->GetNbElem();
MESSAGE("ReadMySelf - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
for(med_int iElem = 0; iElem < aNbElems; iElem++){
double aCoords[3] = {0.0, 0.0, 0.0};
for(med_int iDim = 0; iDim < aMeshDim; iDim++)
aCoords[iDim] = aNodeInfo->GetNodeCoord(iElem,iDim);
for(med_int iDim = 0; iDim < 3; iDim++)
aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim);
const SMDS_MeshNode* aNode;
if(anIsNodeNum) {
aNode = myMesh->AddNodeWithID
@ -258,22 +369,21 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
break;
}
vector<med_int> aNodeIds(aNbNodes);
#ifdef _EDF_NODE_IDS_
if(anIsNodeNum) {
for(int i = 0; i < aNbNodes; i++){
aNodeIds.at(i) = aNodeInfo->GetElemNum(aCellInfo->GetConn(iElem,i)-1);
aNodeIds[i] = aNodeInfo->GetElemNum(aCellInfo->GetConn(iElem,i)-1);
}
}else{
for(int i = 0; i < aNbNodes; i++){
aNodeIds.at(i) = aCellInfo->GetConn(iElem,i);
aNodeIds[i] = aCellInfo->GetConn(iElem,i);
}
}
//if(anIsElemNum)
// cout<<aCellInfo->GetElemNum(iElem)<<": ";
//else
// cout<<iElem<<": ";
//for(int i = 0; i < aNbNodes; i++){
// cout<<aNodeIds.at(i)<<", ";
//}
#else
for(int i = 0; i < aNbNodes; i++){
aNodeIds[i] = aCellInfo->GetConn(iElem,i);
}
#endif
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
@ -283,12 +393,12 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
case MED_SEG2:
case MED_SEG3:
if(anIsElemNum)
anElement = myMesh->AddEdgeWithID(aNodeIds.at(0),
aNodeIds.at(1),
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
aNodeIds[1],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddEdge(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)));
anElement = myMesh->AddEdge(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]));
isRenum = anIsElemNum;
}
break;
@ -296,14 +406,14 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
case MED_TRIA6:
aNbNodes = 3;
if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
anElement = myMesh->AddFaceWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)));
anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]));
isRenum = anIsElemNum;
}
break;
@ -312,16 +422,16 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
aNbNodes = 4;
// There is some differnce between SMDS and MED
if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
aNodeIds.at(3),
anElement = myMesh->AddFaceWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aNodeIds[3],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)),
FindNode(myMesh,aNodeIds.at(3)));
anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]));
isRenum = anIsElemNum;
}
break;
@ -329,16 +439,16 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
case MED_TETRA10:
aNbNodes = 4;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
aNodeIds.at(3),
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aNodeIds[3],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)),
FindNode(myMesh,aNodeIds.at(3)));
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]));
isRenum = anIsElemNum;
}
break;
@ -347,18 +457,18 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
aNbNodes = 5;
// There is some differnce between SMDS and MED
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
aNodeIds.at(3),
aNodeIds.at(4),
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aNodeIds[3],
aNodeIds[4],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)),
FindNode(myMesh,aNodeIds.at(3)),
FindNode(myMesh,aNodeIds.at(4)));
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]),
FindNode(myMesh,aNodeIds[4]));
isRenum = anIsElemNum;
}
break;
@ -366,20 +476,20 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
case MED_PENTA15:
aNbNodes = 6;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
aNodeIds.at(3),
aNodeIds.at(4),
aNodeIds.at(5),
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aNodeIds[3],
aNodeIds[4],
aNodeIds[5],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)),
FindNode(myMesh,aNodeIds.at(3)),
FindNode(myMesh,aNodeIds.at(4)),
FindNode(myMesh,aNodeIds.at(5)));
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]),
FindNode(myMesh,aNodeIds[4]),
FindNode(myMesh,aNodeIds[5]));
isRenum = anIsElemNum;
}
break;
@ -387,24 +497,24 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
case MED_HEXA20:
aNbNodes = 8;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds.at(0),
aNodeIds.at(1),
aNodeIds.at(2),
aNodeIds.at(3),
aNodeIds.at(4),
aNodeIds.at(5),
aNodeIds.at(6),
aNodeIds.at(7),
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
aNodeIds[1],
aNodeIds[2],
aNodeIds[3],
aNodeIds[4],
aNodeIds[5],
aNodeIds[6],
aNodeIds[7],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds.at(0)),
FindNode(myMesh,aNodeIds.at(1)),
FindNode(myMesh,aNodeIds.at(2)),
FindNode(myMesh,aNodeIds.at(3)),
FindNode(myMesh,aNodeIds.at(4)),
FindNode(myMesh,aNodeIds.at(5)),
FindNode(myMesh,aNodeIds.at(6)),
FindNode(myMesh,aNodeIds.at(7)));
anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]),
FindNode(myMesh,aNodeIds[4]),
FindNode(myMesh,aNodeIds[5]),
FindNode(myMesh,aNodeIds[6]),
FindNode(myMesh,aNodeIds[7]));
isRenum = anIsElemNum;
}
break;

View File

@ -37,6 +37,9 @@
#include "MED_Utilities.hxx"
#define _EDF_NODE_IDS_
#define _ELEMENTS_BY_DIM_
DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh()
:
myMesh (NULL),
@ -130,6 +133,96 @@ void DriverMED_W_SMESHDS_Mesh::Write()
myWriter->Write();
}
typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TName;
typedef const char* TUnit;
static TUnit aUnit[3] = {"m","m","m"};
static TGetCoord aXYZGetCoord[3] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
static TName aXYZName[3] = {"x","y","z"};
static TGetCoord aXYGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y
};
static TName aXYName[2] = {"x","y"};
static TGetCoord aYZGetCoord[2] = {
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
static TName aYZName[2] = {"y","z"};
static TGetCoord aXZGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Z
};
static TName aXZName[2] = {"x","z"};
static TGetCoord aXGetCoord[1] = {
&SMDS_MeshNode::X
};
static TName aXName[1] = {"x"};
static TGetCoord aYGetCoord[1] = {
&SMDS_MeshNode::Y
};
static TName aYName[1] = {"y"};
static TGetCoord aZGetCoord[1] = {
&SMDS_MeshNode::Z
};
static TName aZName[1] = {"z"};
class TCoordHelper{
SMDS_NodeIteratorPtr myNodeIter;
const SMDS_MeshNode* myCurrentNode;
TGetCoord* myGetCoord;
TName* myName;
TUnit* myUnit;
public:
TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
TGetCoord* theGetCoord,
TName* theName,
TUnit* theUnit = aUnit):
myNodeIter(theNodeIter),
myGetCoord(theGetCoord),
myName(theName),
myUnit(theUnit)
{}
virtual ~TCoordHelper(){}
bool Next(){
return myNodeIter->more() &&
(myCurrentNode = myNodeIter->next());
}
const SMDS_MeshNode* GetNode(){
return myCurrentNode;
}
MED::TIntVector::value_type GetID(){
myCurrentNode->GetID();
}
MED::TFloatVector::value_type GetCoord(med_int theCoodId){
return (myCurrentNode->*myGetCoord[theCoodId])();
}
MED::TStringVector::value_type GetName(med_int theDimId){
return myName[theDimId];
}
MED::TStringVector::value_type GetUnit(med_int theDimId){
return myUnit[theDimId];
}
};
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
void DriverMED_W_SMESHDS_Mesh::Add()
{
if (myMesh->hasConstructionEdges() || myMesh->hasConstructionFaces()) {
@ -153,8 +246,71 @@ void DriverMED_W_SMESHDS_Mesh::Add()
} else {
aMeshName = myMeshName;
}
const int SMDS_MESH_DIM = 3;
PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(SMDS_MESH_DIM,aMeshName);
// Mesh dimension definition
med_int aMeshDimension;
TCoordHelperPtr aCoordHelperPtr;
{
bool anIsXDimension = false;
bool anIsYDimension = false;
bool anIsZDimension = false;
{
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
double aBounds[6];
if(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = aBounds[1] = aNode->X();
aBounds[2] = aBounds[3] = aNode->Y();
aBounds[4] = aBounds[5] = aNode->Z();
}
while(aNodesIter->more()){
const SMDS_MeshNode* aNode = aNodesIter->next();
aBounds[0] = min(aBounds[0],aNode->X());
aBounds[1] = max(aBounds[1],aNode->X());
aBounds[2] = min(aBounds[2],aNode->Y());
aBounds[3] = max(aBounds[3],aNode->Y());
aBounds[4] = min(aBounds[4],aNode->Z());
aBounds[5] = max(aBounds[5],aNode->Z());
}
double EPS = 1.0E-7;
anIsXDimension = (aBounds[1] - aBounds[0]) > EPS;
anIsYDimension = (aBounds[3] - aBounds[2]) > EPS;
anIsZDimension = (aBounds[5] - aBounds[4]) > EPS;
aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
if(!aMeshDimension)
aMeshDimension = 3;
}
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
switch(aMeshDimension){
case 3:
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYZGetCoord,aXYZName));
break;
case 2:
if(anIsXDimension && anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXYGetCoord,aXYName));
if(anIsYDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYZGetCoord,aYZName));
if(anIsXDimension && anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXZGetCoord,aXZName));
break;
case 1:
if(anIsXDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aXGetCoord,aXName));
if(anIsYDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aYGetCoord,aYName));
if(anIsZDimension)
aCoordHelperPtr.reset(new TCoordHelper(aNodesIter,aZGetCoord,aZName));
break;
}
}
PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(aMeshDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
aMed.SetMeshInfo(aMeshInfo);
@ -208,35 +364,36 @@ void DriverMED_W_SMESHDS_Mesh::Add()
// Storing SMDS nodes to the MED file for the MED mesh
//----------------------------------------------------
#ifdef _EDF_NODE_IDS_
typedef map<med_int,med_int> TNodeIdMap;
TNodeIdMap aNodeIdMap;
#endif
med_int aNbElems = myMesh->NbNodes();
MED::TIntVector anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems);
MED::TFloatVector aCoordinates(aNbElems*SMDS_MESH_DIM);
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator();
for(med_int iNode = 0, iCoord = 0; aNodesIter->more(); iNode++, iCoord+=SMDS_MESH_DIM){
const SMDS_MeshNode* aNode = aNodesIter->next();
aCoordinates[iCoord] = aNode->X();
aCoordinates[iCoord+1] = aNode->Y();
aCoordinates[iCoord+2] = aNode->Z();
TNodeIdMap::key_type aNodeId = aNode->GetID();
anElemNums[iNode] = aNodeId;
aNodeIdMap[aNodeId] = iNode+1;
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
for(med_int iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){
aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
}
int aNodeID = aCoordHelperPtr->GetID();
anElemNums[iNode] = aNodeID;
#ifdef _EDF_NODE_IDS_
aNodeIdMap[aNodeID] = iNode+1;
#endif
const SMDS_MeshNode* aNode = aCoordHelperPtr->GetNode();
if (anElemFamMap.find(aNode) != anElemFamMap.end())
aFamilyNums[iNode] = anElemFamMap[aNode];
aFamilyNums[iNode] = anElemFamMap[aNode];
else
aFamilyNums[iNode] = myNodesDefaultFamilyId;
aFamilyNums[iNode] = myNodesDefaultFamilyId;
}
MED::TStringVector aCoordNames(3);
aCoordNames[0] = "x"; aCoordNames[1] = "y"; aCoordNames[2] = "z";
MED::TStringVector aCoordUnits(3);
aCoordUnits[0] = "m"; aCoordUnits[1] = "m"; aCoordUnits[2] = "m";
MED::TStringVector aCoordNames(aMeshDimension);
MED::TStringVector aCoordUnits(aMeshDimension);
for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){
aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord);
aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
}
const med_repere SMDS_COORDINATE_SYSTEM = MED_CART;
@ -253,13 +410,16 @@ void DriverMED_W_SMESHDS_Mesh::Add()
// Storing others SMDS elements to the MED file for the MED mesh
//--------------------------------------------------------------
const med_entite_maillage SMDS_MED_ENTITY = MED_MAILLE;
med_entite_maillage SMDS_MED_ENTITY = MED_MAILLE;
const med_connectivite SMDS_MED_CONNECTIVITY = MED_NOD;
// Storing SMDS Edges
if(med_int aNbElems = myMesh->NbEdges()){
#ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_ARETE;
#endif
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
med_int aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,MED_SEG2,SMDS_MESH_DIM);
med_int aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,MED_SEG2,aMeshDimension);
MED::TIntVector anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems);
MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
@ -269,7 +429,11 @@ void DriverMED_W_SMESHDS_Mesh::Add()
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
for(med_int iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
const SMDS_MeshElement* aNode = aNodesIter->next();
#ifdef _EDF_NODE_IDS_
aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
#else
aConnectivity[iConn+iNode] = aNode->GetID();
#endif
}
anElemNums[iElem] = anElem->GetID();
@ -292,8 +456,10 @@ void DriverMED_W_SMESHDS_Mesh::Add()
// Storing SMDS Faces
if(med_int aNbElems = myMesh->NbFaces()){
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,SMDS_MESH_DIM);
#ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_FACE;
#endif
med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,aMeshDimension);
MED::TIntVector anTriaElemNums;
anTriaElemNums.reserve(aNbElems);
MED::TIntVector aTriaFamilyNums;
@ -301,7 +467,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
MED::TIntVector aTriaConn;
aTriaConn.reserve(aNbElems*aNbTriaConn);
med_int aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_QUAD4,SMDS_MESH_DIM);
med_int aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_QUAD4,aMeshDimension);
MED::TIntVector aQuadElemNums;
aQuadElemNums.reserve(aNbElems);
MED::TIntVector aQuadFamilyNums;
@ -340,6 +506,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
med_int aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity);
// There is some differnce between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_
switch(aNbNodes){
case 4:
(*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
@ -350,6 +517,18 @@ void DriverMED_W_SMESHDS_Mesh::Add()
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
}
#else
switch(aNbNodes){
case 4:
(*aConnectivity)[aSize+0] = aVector[0];
(*aConnectivity)[aSize+1] = aVector[1];
(*aConnectivity)[aSize+2] = aVector[3];
(*aConnectivity)[aSize+3] = aVector[2];
default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode];
}
#endif
anElemNums->push_back(anElem->GetID());
if (anElemFamMap.find(anElem) != anElemFamMap.end())
@ -384,8 +563,10 @@ void DriverMED_W_SMESHDS_Mesh::Add()
// Storing SMDS Volumes
if(med_int aNbElems = myMesh->NbVolumes()){
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
med_int aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TETRA4,SMDS_MESH_DIM);
#ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_MAILLE;
#endif
med_int aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TETRA4,aMeshDimension);
MED::TIntVector anTetraElemNums;
anTetraElemNums.reserve(aNbElems);
MED::TIntVector aTetraFamilyNums;
@ -393,7 +574,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
MED::TIntVector aTetraConn;
aTetraConn.reserve(aNbElems*aNbTetraConn);
med_int aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PYRA5,SMDS_MESH_DIM);
med_int aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PYRA5,aMeshDimension);
MED::TIntVector anPyraElemNums;
anPyraElemNums.reserve(aNbElems);
MED::TIntVector aPyraFamilyNums;
@ -401,7 +582,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
MED::TIntVector aPyraConn;
aPyraConn.reserve(aNbElems*aNbPyraConn);
med_int aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PENTA6,SMDS_MESH_DIM);
med_int aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PENTA6,aMeshDimension);
MED::TIntVector anPentaElemNums;
anPentaElemNums.reserve(aNbElems);
MED::TIntVector aPentaFamilyNums;
@ -409,7 +590,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
MED::TIntVector aPentaConn;
aPentaConn.reserve(aNbElems*aNbPentaConn);
med_int aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_HEXA8,SMDS_MESH_DIM);
med_int aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_HEXA8,aMeshDimension);
MED::TIntVector aHexaElemNums;
aHexaElemNums.reserve(aNbElems);
MED::TIntVector aHexaFamilyNums;
@ -459,6 +640,7 @@ void DriverMED_W_SMESHDS_Mesh::Add()
med_int aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity);
// There is some difference between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_
switch(aNbNodes){
case 5:
(*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
@ -470,6 +652,19 @@ void DriverMED_W_SMESHDS_Mesh::Add()
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
}
#else
switch(aNbNodes){
case 5:
(*aConnectivity)[aSize+0] = aVector[0];
(*aConnectivity)[aSize+1] = aVector[3];
(*aConnectivity)[aSize+2] = aVector[2];
(*aConnectivity)[aSize+3] = aVector[1];
(*aConnectivity)[aSize+4] = aVector[4];
default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode];
}
#endif
anElemNums->push_back(anElem->GetID());
if (anElemFamMap.find(anElem) != anElemFamMap.end())

View File

@ -1,28 +0,0 @@
// 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
#include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
int main(int argc, char** argv)
{
DriverMED_R_SMESHDS_Mesh aR;
DriverMED_W_SMESHDS_Mesh aW;
return 1;
}

View File

@ -1,123 +0,0 @@
// 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
#include <fstream>
#include "UNV2411_Structure.hxx"
#include "UNV_Utilities.hxx"
using namespace std;
using namespace UNV;
using namespace UNV2411;
#ifdef _DEBUG_
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
static string _label_dataset = "2411";
UNV2411::TRecord::TRecord():
exp_coord_sys_num(0),
disp_coord_sys_num(0),
color(0)
{}
void UNV2411::Read(std::ifstream& in_stream, TDataSet& theDataSet)
{
if(!in_stream.good())
EXCEPTION(runtime_error,"ERROR: Input file not good.");
/*
* adjust the \p istream to our
* position
*/
if(!beginning_of_dataset(in_stream,_label_dataset))
EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
/**
* always 3 coordinates in the UNV file, no matter
* which dimensionality libMesh is in
*/
TNodeLab aLabel;
std::string num_buf;
for(; !in_stream.eof();){
in_stream >> aLabel ;
if(aLabel == -1){
// end of dataset is reached
break;
}
TRecord aRec;
in_stream>>aRec.exp_coord_sys_num;
in_stream>>aRec.disp_coord_sys_num;
in_stream>>aRec.color;
/*
* take care of the
* floating-point data
*/
for(int d = 0; d < 3; d++){
in_stream>>num_buf;
aRec.coord[d] = D_to_e(num_buf);
}
theDataSet.insert(TDataSet::value_type(aLabel,aRec));
}
}
void UNV2411::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
{
if(!out_stream.good())
EXCEPTION(runtime_error,"ERROR: Output file not good.");
/*
* Write beginning of dataset
*/
out_stream<<" -1\n";
out_stream<<" "<<_label_dataset<<"\n";
TDataSet::const_iterator anIter = theDataSet.begin();
for(; anIter != theDataSet.end(); anIter++){
const TNodeLab& aLabel = anIter->first;
const TRecord& aRec = anIter->second;
char buf[78];
sprintf(buf, "%10d%10d%10d%10d\n",
aLabel,
aRec.exp_coord_sys_num,
aRec.disp_coord_sys_num,
aRec.color);
out_stream<<buf;
// the coordinates
sprintf(buf, "%25.16E%25.16E%25.16E\n",
aRec.coord[0],
aRec.coord[1],
aRec.coord[2]);
out_stream<<buf;
}
/*
* Write end of dataset
*/
out_stream<<" -1\n";
}

View File

@ -1,46 +0,0 @@
// 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
#ifndef UNV2411_Structure_HeaderFile
#define UNV2411_Structure_HeaderFile
#include <map>
#include <fstream>
namespace UNV2411{
struct TRecord{
TRecord();
int exp_coord_sys_num; // export coordinate system number
int disp_coord_sys_num; // displacement coordinate system number
int color; // color
double coord[3]; // node coordinates in the part coordinate system
};
typedef int TNodeLab; // type of node label
typedef std::map<TNodeLab,TRecord> TDataSet;
void Read(std::ifstream& in_stream, TDataSet& theDataSet);
void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
};
#endif

View File

@ -1,202 +0,0 @@
// 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
#include <fstream>
#include <iomanip>
#include "UNV2412_Structure.hxx"
#include "UNV_Utilities.hxx"
using namespace std;
using namespace UNV;
using namespace UNV2412;
#ifdef _DEBUG_
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
static string _label_dataset = "2412";
UNV2412::TRecord::TRecord():
phys_prop_tab_num(2),
mat_prop_tab_num(1),
color(7),
beam_orientation(0),
beam_fore_end(0),
beam_aft_end(0)
{}
void UNV2412::Read(std::ifstream& in_stream, TDataSet& theDataSet)
{
if(!in_stream.good())
EXCEPTION(runtime_error,"ERROR: Input file not good.");
/*
* adjust the \p istream to our
* position
*/
if(!beginning_of_dataset(in_stream,_label_dataset))
EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
TElementLab aLabel;
for(; !in_stream.eof();){
in_stream >> aLabel ;
if(aLabel == -1){
// end of dataset is reached
break;
}
int n_nodes;
TRecord aRec;
in_stream>>aRec.fe_descriptor_id;
in_stream>>aRec.phys_prop_tab_num;
in_stream>>aRec.mat_prop_tab_num;
in_stream>>aRec.color;
in_stream>>n_nodes;
if(IsBeam(aRec.fe_descriptor_id)){
in_stream>>aRec.beam_orientation;
in_stream>>aRec.beam_fore_end;
in_stream>>aRec.beam_aft_end;
}
aRec.node_labels.resize(n_nodes);
for(int j=0; j < n_nodes; j++){
// read node labels
in_stream>>aRec.node_labels[j];
}
theDataSet.insert(TDataSet::value_type(aLabel,aRec));
}
}
void UNV2412::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
{
if(!out_stream.good())
EXCEPTION(runtime_error,"ERROR: Output file not good.");
/*
* Write beginning of dataset
*/
out_stream<<" -1\n";
out_stream<<" "<<_label_dataset<<"\n";
TDataSet::const_iterator anIter = theDataSet.begin();
for(; anIter != theDataSet.end(); anIter++){
const TElementLab& aLabel = anIter->first;
const TRecord& aRec = anIter->second;
out_stream<<std::setw(10)<<aLabel; /* element ID */
out_stream<<std::setw(10)<<aRec.fe_descriptor_id; /* type of element */
out_stream<<std::setw(10)<<aRec.phys_prop_tab_num;
out_stream<<std::setw(10)<<aRec.mat_prop_tab_num;
out_stream<<std::setw(10)<<aRec.color;
out_stream<<std::setw(10)<<aRec.node_labels.size()<<std::endl; /* No. of nodes per element */
if(IsBeam(aRec.fe_descriptor_id)){
out_stream<<std::setw(10)<<aRec.beam_orientation;
out_stream<<std::setw(10)<<aRec.beam_fore_end;
out_stream<<std::setw(10)<<aRec.beam_aft_end<<std::endl;
}
int n_nodes = aRec.node_labels.size();
int iEnd = (n_nodes-1)/8 + 1;
for(int i = 0, k = 0; i < iEnd; i++){
int jEnd = n_nodes - 8*(i+1);
if(jEnd < 0)
jEnd = 8 + jEnd;
else
jEnd = 8;
for(int j = 0; j < jEnd ; k++, j++){
out_stream<<std::setw(10)<<aRec.node_labels[k];
}
out_stream<<std::endl;
}
}
/*
* Write end of dataset
*/
out_stream<<" -1\n";
}
bool UNV2412::IsBeam(int theFeDescriptorId){
switch (theFeDescriptorId){
case 11:
case 21:
case 22:
case 24:
case 25:
return true;
}
return false;
}
bool UNV2412::IsFace(int theFeDescriptorId){
switch (theFeDescriptorId){
case 71: // TRI3
case 72:
case 74:
case 41: // Plane Stress Linear Triangle - TRI3
case 91: // Thin Shell Linear Triangle - TRI3
case 42: // Plane Stress Quadratic Triangle - TRI6
case 92: // Thin Shell Quadratic Triangle - TRI6
case 43: // Plane Stress Cubic Triangle
case 44: // Plane Stress Linear Quadrilateral - QUAD4
case 94: // Thin Shell Linear Quadrilateral - QUAD4
case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
case 46: // Plane Stress Cubic Quadrilateral
return true;
}
return false;
}
bool UNV2412::IsVolume(int theFeDescriptorId){
//if(!IsBeam(theFeDescriptorId) && !IsFace(theFeDescriptorId))
// return true;
switch (theFeDescriptorId){
case 111: // Solid Linear Tetrahedron - TET4
case 118: // Solid Quadratic Tetrahedron - TET10
case 112: // Solid Linear Prism - PRISM6
case 115: // Solid Linear Brick - HEX8
case 116: // Solid Quadratic Brick - HEX20
case 117: // Solid Cubic Brick
return true;
}
return false;
}

View File

@ -1,59 +0,0 @@
// 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
#ifndef UNV2412_Structure_HeaderFile
#define UNV2412_Structure_HeaderFile
#include <map>
#include <vector>
#include <fstream>
namespace UNV2412{
struct TRecord{
TRecord();
int fe_descriptor_id; // FE descriptor id
int phys_prop_tab_num; // physical property table number
int mat_prop_tab_num; // material property table number
int color; // color
std::vector<int> node_labels; // node labels defining element
//FOR BEAM ELEMENTS ONLY
int beam_orientation; // beam orientation node number
int beam_fore_end; // beam fore-end cross section number
int beam_aft_end; // beam aft-end cross section number
};
typedef int TElementLab; // type of element label
typedef std::map<TElementLab,TRecord> TDataSet;
void Read(std::ifstream& in_stream, TDataSet& theDataSet);
void Write(std::ofstream& out_stream, const TDataSet& theDataSet);
bool IsBeam(int theFeDescriptorId);
bool IsFace(int theFeDescriptorId);
bool IsVolume(int theFeDescriptorId);
};
#endif

View File

@ -1,69 +0,0 @@
// 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
#include "UNV2411_Structure.hxx"
#include "UNV2412_Structure.hxx"
#include "UNV_Utilities.hxx"
#include "DriverUNV_R_SMDS_Mesh.h"
#include "DriverUNV_W_SMDS_Mesh.h"
using namespace std;
#ifdef DEBUG
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
void ReadMed(const char* theFileName){
std::ifstream in_stream(theFileName);
UNV2411::TDataSet aDataSet2411;
UNV2411::Read(in_stream,aDataSet2411);
in_stream.seekg(0);
UNV2412::TDataSet aDataSet2412;
UNV2412::Read(in_stream,aDataSet2412);
string aFileName(theFileName);
aFileName += "-";
std::ofstream out_stream(aFileName.c_str());
UNV2411::Write(out_stream,aDataSet2411);
UNV2412::Write(out_stream,aDataSet2412);
}
int main(int argc, char** argv){
DriverUNV_R_SMDS_Mesh aR;
DriverUNV_W_SMDS_Mesh aW;
try{
if(argc > 1){
ReadMed(argv[1]);
}
return 0;
}catch(std::exception& exc){
cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
}catch(...){
cout<<"Unknown exception was accured !!!"<<endl;
}
return 1;
}

View File

@ -1,37 +0,0 @@
// Copyright (C) 2003 CEA/DEN, EDF R&D
//
//
//
// File : VISU_DatConvertor.cxx
// Author : Alexey PETROV
// Module : VISU
#include "UNV_Utilities.hxx"
using namespace std;
#ifdef _DEBUG_
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
int UNV::PrefixPrinter::myCounter = 0;
UNV::PrefixPrinter::PrefixPrinter()
{
myCounter++;
}
UNV::PrefixPrinter::~PrefixPrinter()
{
myCounter--;
}
string UNV::PrefixPrinter::GetPrefix()
{
if(myCounter)
return string(myCounter*2,' ');
return "";
}

View File

@ -1,104 +0,0 @@
// Copyright (C) 2003 CEA/DEN, EDF R&D
//
//
//
// File : VISU_DatConvertor.hxx
// Author : Alexey PETROV
// Module : VISU
#ifndef MED_Utilities_HeaderFile
#define MED_Utilities_HeaderFile
#include <iostream>
#include <sstream>
#include <string>
#include <stdexcept>
namespace UNV{
using namespace std;
class PrefixPrinter{
static int myCounter;
public:
PrefixPrinter();
~PrefixPrinter();
static string GetPrefix();
};
/**
* @returns \p false when error occured, \p true otherwise.
* Adjusts the \p in_stream to the beginning of the
* dataset \p ds_name.
*/
inline bool beginning_of_dataset(std::istream& in_file, const std::string& ds_name)
{
assert (in_file.good());
assert (!ds_name.empty());
std::string olds, news;
while(true){
in_file >> olds >> news;
/*
* a "-1" followed by a number means the beginning of a dataset
* stop combing at the end of the file
*/
while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ){
olds = news;
in_file >> news;
}
if(in_file.eof())
return false;
if (news == ds_name)
return true;
}
// should never end up here
return false;
}
/**
* Method for converting exponential notation
* from "D" to "e", for example
* \p 3.141592654D+00 \p --> \p 3.141592654e+00
* in order to make it readable for C++.
*/
inline double D_to_e(std::string& number)
{
/* find "D" in string, start looking at
* 6th element, to improve speed.
* We dont expect a "D" earlier
*/
const int position = number.find("D",6);
if(position != std::string::npos){
number.replace(position, 1, "e");
}
return atof (number.c_str());
}
};
#ifndef MESSAGE
#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl;
#define BEGMSG(msg) std::cout<<UNV::PrefixPrinter::GetPrefix()<<msg
#define ADDMSG(msg) std::cout<<msg
#endif
#ifndef EXCEPTION
#define EXCEPTION(TYPE, MSG) {\
std::ostringstream aStream;\
aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
throw TYPE(aStream.str());\
}
#endif
#endif

View File

@ -141,26 +141,30 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
int anId = 0;
myPassFilter.at( anId )->SetInput( theGrid );
myPassFilter.at( anId + 1)->SetInput( myPassFilter.at( anId )->GetOutput() );
myPassFilter[ anId ]->SetInput( theGrid );
myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 1
myGeomFilter->SetStoreMapping( myStoreMapping );
myGeomFilter->SetInput( myPassFilter.at( anId )->GetOutput() );
myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 2
myPassFilter.at( anId )->SetInput( myGeomFilter->GetOutput() );
myPassFilter.at( anId + 1 )->SetInput( myPassFilter.at( anId )->GetOutput() );
myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 3
myTransformFilter->SetInput( myPassFilter.at( anId )->GetPolyDataOutput() );
myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
anId++; // 4
myPassFilter.at( anId )->SetInput( myTransformFilter->GetOutput() );
myPassFilter.at( anId + 1 )->SetInput( myPassFilter.at( anId )->GetOutput() );
myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 5
myMapper->SetInput( myPassFilter.at( anId )->GetPolyDataOutput() );
myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
vtkLODActor::SetMapper( myMapper );
Modified();
@ -207,10 +211,10 @@ void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){
void SMESH_DeviceActor::SetShrink()
{
if ( !myIsShrinkable ) return;
if ( vtkDataSet* aDataSet = myPassFilter.at( 0 )->GetOutput() )
if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
{
myShrinkFilter->SetInput( aDataSet );
myPassFilter.at( 1 )->SetInput( myShrinkFilter->GetOutput() );
myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
myIsShrunk = true;
}
}
@ -218,10 +222,10 @@ void SMESH_DeviceActor::SetShrink()
void SMESH_DeviceActor::UnShrink()
{
if ( !myIsShrunk ) return;
if ( vtkDataSet* aDataSet = myPassFilter.at( 0 )->GetOutput() )
{
myPassFilter.at( 1 )->SetInput( aDataSet );
myPassFilter.at( 1 )->Modified();
if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
{
myPassFilter[ 1 ]->SetInput( aDataSet );
myPassFilter[ 1 ]->Modified();
myIsShrunk = false;
Modified();
}

View File

@ -1,164 +0,0 @@
// SMESH OBJECT : interactive object for SMESH visualization
//
// 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 : SMESH_Grid.cxx
// Author : Nicolas REJNERI
// Module : SMESH
using namespace std;
#include "SMESH_Grid.h"
#include "utilities.h"
// VTK Includes
#include <vtkObjectFactory.h>
SMESH_Grid* SMESH_Grid::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("SMESH_Grid");
if(ret)
{
return (SMESH_Grid*)ret;
}
// If the factory was unable to create the object, then create it here.
return new SMESH_Grid;
}
void SMESH_Grid::AddNode(int idSMESHDSnode,int idVTKnode)
{
myMapNodeSMDStoVTK.Bind(idSMESHDSnode, idVTKnode);
myMapNodeVTKtoSMDS.Bind(idVTKnode, idSMESHDSnode);
}
void SMESH_Grid::AddElement(int idSMESHDSelement, int idVTKelement)
{
myMapElementSMDStoVTK.Bind(idSMESHDSelement, idVTKelement);
myMapElementVTKtoSMDS.Bind(idVTKelement, idSMESHDSelement);
}
void SMESH_Grid::SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK)
{
myMapNodeVTKtoSMDS = mapVTK;
}
void SMESH_Grid::SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS)
{
myMapNodeSMDStoVTK = mapSMESHDS;
}
void SMESH_Grid::SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK)
{
myMapElementVTKtoSMDS = mapVTK;
}
void SMESH_Grid::SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS)
{
myMapElementSMDStoVTK = mapSMESHDS;
}
int SMESH_Grid::GetIdVTKNode(int idSMESHDSnode)
{
if ( myMapNodeSMDStoVTK.IsBound( idSMESHDSnode ) )
return myMapNodeSMDStoVTK.Find(idSMESHDSnode);
else {
MESSAGE("GetIdVTKNode(): SMDS node not found: " << idSMESHDSnode);
return -1;
}
}
int SMESH_Grid::GetIdVTKElement(int idSMESHDSelement)
{
if ( myMapElementSMDStoVTK.IsBound( idSMESHDSelement ) )
return myMapElementSMDStoVTK.Find(idSMESHDSelement);
else {
MESSAGE("GetIdVTKElement(): SMDS element not found: " << idSMESHDSelement);
return -1;
}
}
int SMESH_Grid::GetIdSMESHDSNode(int idVTKnode)
{
if ( myMapNodeVTKtoSMDS.IsBound( idVTKnode ) )
return myMapNodeVTKtoSMDS.Find(idVTKnode);
else {
MESSAGE("GetIdSMESHDSNode(): VTK node not found: " << idVTKnode);
return -1;
}
}
int SMESH_Grid::GetIdSMESHDSElement(int idVTKelement)
{
if ( myMapElementVTKtoSMDS.IsBound( idVTKelement ) )
return myMapElementVTKtoSMDS.Find(idVTKelement);
else {
MESSAGE("GetIdSMESHDSElement(): VTK element not found: " << idVTKelement);
return -1;
}
}
void SMESH_Grid::ClearNode()
{
myMapNodeVTKtoSMDS.Clear();
myMapNodeSMDStoVTK.Clear();
}
void SMESH_Grid::ClearElement()
{
myMapElementVTKtoSMDS.Clear();
myMapElementSMDStoVTK.Clear();
}
void SMESH_Grid::RemoveNode(int id)
{
if ( myMapNodeSMDStoVTK.IsBound( id ) ) {
int idVTK = myMapNodeSMDStoVTK.Find(id);
myMapNodeSMDStoVTK.UnBind(id);
if ( myMapNodeVTKtoSMDS.IsBound( idVTK ) ) {
myMapNodeVTKtoSMDS.UnBind(idVTK);
}
}
}
void SMESH_Grid::RemoveElement(int id)
{
if ( myMapElementSMDStoVTK.IsBound( id ) ) {
int idVTK = myMapElementSMDStoVTK.Find(id);
myMapElementSMDStoVTK.UnBind(id);
if ( myMapElementVTKtoSMDS.IsBound( idVTK ) ) {
myMapElementVTKtoSMDS.UnBind(idVTK);
}
}
}
void SMESH_Grid::DeepCopy(vtkDataObject *src)
{
SMESH_Grid* srcGrid = SMESH_Grid::SafeDownCast(src);
if (srcGrid != NULL) {
CopyMaps(srcGrid);
}
vtkUnstructuredGrid::DeepCopy(src);
}
void SMESH_Grid::CopyMaps(SMESH_Grid *srcGrid)
{
this->myMapNodeVTKtoSMDS = srcGrid->myMapNodeVTKtoSMDS;
this->myMapNodeSMDStoVTK = srcGrid->myMapNodeSMDStoVTK;
this->myMapElementVTKtoSMDS = srcGrid->myMapElementVTKtoSMDS;
this->myMapElementSMDStoVTK = srcGrid->myMapElementSMDStoVTK;
}

View File

@ -1,79 +0,0 @@
// SMESH OBJECT : interactive object for SMESH visualization
//
// 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 : SMESH_Grid.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef SMESH_GRID_H
#define SMESH_GRID_H
// VTK Includes
#include <vtkUnstructuredGrid.h>
// Open CASCADE Includes
#include <TColStd_DataMapOfIntegerInteger.hxx>
class SMESH_Grid : public vtkUnstructuredGrid {
public:
vtkTypeMacro(SMESH_Grid, vtkUnstructuredGrid);
static SMESH_Grid* New();
void ClearNode();
void ClearElement();
void RemoveNode(int idSMESHDSnode);
void RemoveElement(int idSMESHDSelement);
void AddNode(int idSMESHDSnode, int idVTKnode);
void AddElement(int idSMESHDSelement, int idVTKelement);
int GetIdVTKNode(int idSMESHDSnode);
int GetIdVTKElement(int idSMESHDSelement);
int GetIdSMESHDSNode(int idVTKnode);
int GetIdSMESHDSElement(int idVTKelement);
void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK);
void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK);
void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS);
virtual void DeepCopy (vtkDataObject *src);
void CopyMaps(SMESH_Grid *src);
protected:
SMESH_Grid() : vtkUnstructuredGrid() {};
TColStd_DataMapOfIntegerInteger myMapNodeVTKtoSMDS;
TColStd_DataMapOfIntegerInteger myMapNodeSMDStoVTK;
TColStd_DataMapOfIntegerInteger myMapElementVTKtoSMDS;
TColStd_DataMapOfIntegerInteger myMapElementSMDStoVTK;
};
#endif

View File

@ -47,6 +47,8 @@
#ifdef __GNUC__
#if __GNUC__ < 3
#include <hash_map.h>
// _CS_gbo_100504 Do not forget to define the namespace alias gstd
namespace gstd { using ::hash_map; } // inherits globals
#else
#include <ext/hash_map>
namespace gstd = __gnu_cxx;

View File

@ -1,4 +0,0 @@
int main(int argc, char** argv){
return 0;
}

View File

@ -1,447 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_EdgesConnectivityDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_EdgesConnectivityDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_MessageBox.h"
#include "utilities.h"
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qcheckbox.h>
// VTK Include
#include <vtkFeatureEdges.h>
//=================================================================================
// class : SMESHGUI_EdgesConnectivityDlg()
// purpose :
//=================================================================================
SMESHGUI_EdgesConnectivityDlg::SMESHGUI_EdgesConnectivityDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_CONNECTIVITY")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
if ( !name )
setName( "SMESHGUI_EdgesConnectivityDlg" );
resize( 303, 185 );
setCaption( tr( "SMESH_EDGES_CONNECTIVITY_TITLE" ) );
setSizeGripEnabled( TRUE );
SMESHGUI_EdgesConnectivityDlgLayout = new QGridLayout( this );
SMESHGUI_EdgesConnectivityDlgLayout->setSpacing( 6 );
SMESHGUI_EdgesConnectivityDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "SMESH_EDGES_CONNECTIVITY" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
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 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
//buttonOk = new QPushButton( GroupButtons, "buttonOk" );
//buttonOk->setText( tr( "SMESH_BUT_OK" ) );
//buttonOk->setAutoDefault( TRUE );
//buttonOk->setDefault( TRUE );
//GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_EDGES_CONNECTIVITY" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "SMESH_MESH" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
BoundaryEdges = new QCheckBox( GroupC1, "BoundaryEdges" );
BoundaryEdges->setText( tr( "SMESH_BOUNDARYEDGES" ) );
GroupC1Layout->addWidget( BoundaryEdges, 1, 0 );
ManifoldEdges = new QCheckBox( GroupC1, "ManifoldEdges" );
ManifoldEdges->setText( tr( "SMESH_MANIFOLDEDGES" ) );
GroupC1Layout->addWidget( ManifoldEdges, 2, 0 );
NonManifoldEdges = new QCheckBox( GroupC1, "NonManifoldEdges" );
NonManifoldEdges->setText( tr( "SMESH_NONMANIFOLDEDGES" ) );
GroupC1Layout->addWidget( NonManifoldEdges, 1, 2 );
FeatureEdges = new QCheckBox( GroupC1, "FeatureEdges" );
FeatureEdges->setText( tr( "SMESH_FEATUREEDGES" ) );
GroupC1Layout->addWidget( FeatureEdges, 2, 2 );
FeatureAngle= new QLabel( GroupC1, "FeatureAngle" );
FeatureAngle->setText( tr( "SMESH_FEATUREANGLE" ) );
FeatureAngle->setMinimumSize( QSize( 50, 0 ) );
FeatureAngle->setFrameShape( QLabel::NoFrame );
FeatureAngle->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( FeatureAngle, 3, 0 );
SpinBox_FeatureAngle = new SMESHGUI_SpinBox( GroupC1, "SpinBox_FeatureAngle" ) ;
GroupC1Layout->addWidget( SpinBox_FeatureAngle , 3, 2 );
SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupC1, 1, 0 );
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~SMESHGUI_EdgesConnectivityDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_EdgesConnectivityDlg::~SMESHGUI_EdgesConnectivityDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
this->myOkActor = false ;
/* Get setting of step value from file configuration */
double step ;
// QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO
// step = St.toDouble() ; TODO
step = 5.0 ;
/* min, max, step and decimals for spin boxes */
SpinBox_FeatureAngle->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ;
SpinBox_FeatureAngle->SetValue( 30.0 ) ;
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
//connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( BoundaryEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
connect( ManifoldEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
connect( NonManifoldEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
connect( FeatureEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
if(myOkActor) {
Standard_Boolean res;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if ( !IO->hasEntry() )
break;
SMESH_Actor* ac = mySMESHGUI->FindActorByEntry( IO->getEntry(), res, true );
if ( !res )
break;
mySMESHGUI->ChangeRepresentation( ac, 0 );
vtkGeometryFilter *gf = vtkGeometryFilter::New();
gf->SetInput(ac->DataSource);
vtkFeatureEdges *edges = vtkFeatureEdges::New();
edges->SetInput( gf->GetOutput() );
edges->ColoringOn();
if ( BoundaryEdges->isOn() ) edges->BoundaryEdgesOn();
else edges->BoundaryEdgesOff();
if ( ManifoldEdges->isOn() ) edges->ManifoldEdgesOn();
else edges->ManifoldEdgesOff();
if ( NonManifoldEdges->isOn() ) edges->NonManifoldEdgesOn();
else edges->NonManifoldEdgesOff();
if ( FeatureEdges->isOn() ) edges->FeatureEdgesOn();
else edges->FeatureEdgesOff();
double angle = SpinBox_FeatureAngle->GetValue() ;
edges->SetFeatureAngle( angle );
vtkDataSetMapper *EdgeMapper = vtkDataSetMapper::New();
EdgeMapper->SetInput( edges->GetOutput() );
EdgeMapper->SetScalarModeToUseCellData();
ac->SetMapper(EdgeMapper);
mySMESHGUI->DisplayEdgesConnectivityLegendBox(ac);
}
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::ClickOnCancel()
{
mySMESHGUI->ScalarVisibilityOff();
disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ;
mySMESHGUI->EraseSimulationActors();
mySMESHGUI->ScalarVisibilityOff();
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
myOkActor = false;
QString aString = "";
int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if(nbSel != 1) {
mySMESHGUI->ScalarVisibilityOff();
return;
}
myEditCurrentArgument->setText(aString) ;
myOkActor = true ;
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_EdgesConnectivityDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
void SMESHGUI_EdgesConnectivityDlg::CheckBox( int state )
{
QCheckBox* send = (QCheckBox*)sender();
if( send == BoundaryEdges ) {
} else if( send == ManifoldEdges ) {
} else if( send == NonManifoldEdges ) {
} else {
}
}

View File

@ -1,122 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_EdgesConnectivityDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef DIALOGBOX_EDGES_CONNECTIVITY_H
#define DIALOGBOX_EDGES_CONNECTIVITY_H
#include "SALOME_Selection.h"
// QT Includes
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QCheckBox;
class SMESHGUI;
class SMESHGUI_SpinBox;
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
//=================================================================================
// class : SMESHGUI_EdgesConnectivityDlg
// purpose :
//=================================================================================
class SMESHGUI_EdgesConnectivityDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_EdgesConnectivityDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_EdgesConnectivityDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
SMESHGUI* mySMESHGUI ;
SALOME_Selection* mySelection ;
bool myOkActor ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QCheckBox* BoundaryEdges;
QCheckBox* ManifoldEdges;
QCheckBox* NonManifoldEdges;
QCheckBox* FeatureEdges;
QLabel* FeatureAngle;
SMESHGUI_SpinBox* SpinBox_FeatureAngle ;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void CheckBox( int );
protected:
QGridLayout* SMESHGUI_EdgesConnectivityDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
QHBoxLayout* hbox_2;
QVBoxLayout* vbox;
QVBoxLayout* vbox_2;
};
#endif // DIALOGBOX_EDGES_CONNECTIVITY_H

View File

@ -1,146 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_EditScalarBarDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_EditScalarBarDlg.h"
#include "SMESHGUI.h"
// QT Includes
#include <qframe.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a SMESHGUI_EditScalarBarDlg which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
SMESHGUI_EditScalarBarDlg::SMESHGUI_EditScalarBarDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
if ( !name )
setName( "SMESHGUI_EditScalarBarDlg" );
resize( 124, 122 );
setCaption( tr( "SMESH_SCALARBAR" ) );
setSizeGripEnabled( TRUE );
grid = new QGridLayout( this );
grid->setSpacing( 6 );
grid->setMargin( 11 );
grid_2 = new QGridLayout;
grid_2->setSpacing( 6 );
grid_2->setMargin( 0 );
PushButtonUpdateView = new QPushButton( this, "PushButtonUpdateView" );
PushButtonUpdateView->setText( tr( "SMESH_UPDATEVIEW" ) );
grid_2->addWidget( PushButtonUpdateView, 1, 0 );
grid_3 = new QGridLayout;
grid_3->setSpacing( 6 );
grid_3->setMargin( 0 );
grid_4 = new QGridLayout;
grid_4->setSpacing( 6 );
grid_4->setMargin( 0 );
grid_5 = new QGridLayout;
grid_5->setSpacing( 6 );
grid_5->setMargin( 0 );
LineEditMax = new QLineEdit( this, "LineEditMax" );
grid_5->addWidget( LineEditMax, 0, 0 );
LineEditMin = new QLineEdit( this, "LineEditMin" );
grid_5->addWidget( LineEditMin, 1, 0 );
grid_4->addLayout( grid_5, 0, 1 );
grid_6 = new QGridLayout;
grid_6->setSpacing( 6 );
grid_6->setMargin( 0 );
TextLabelMax = new QLabel( this, "TextLabelMax" );
TextLabelMax->setText( tr( "SMESH_MAX" ) );
grid_6->addWidget( TextLabelMax, 0, 0 );
TextLabelMin = new QLabel( this, "TextLabelMin" );
TextLabelMin->setText( tr( "SMESH_MIN" ) );
grid_6->addWidget( TextLabelMin, 1, 0 );
grid_4->addLayout( grid_6, 0, 0 );
grid_3->addLayout( grid_4, 0, 0 );
Line1 = new QFrame( this, "Line1" );
Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
grid_3->addWidget( Line1, 1, 0 );
grid_2->addLayout( grid_3, 0, 0 );
grid->addLayout( grid_2, 0, 0 );
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
if ( mySMESHGUI && mySMESHGUI->GetScalarBar() && mySMESHGUI->GetScalarBar()->GetLookupTable() ) {
float *range = mySMESHGUI->GetScalarBar()->GetLookupTable()->GetRange();
LineEditMin->setText( QString("%1").arg(range[0]) );
LineEditMax->setText( QString("%1").arg(range[1]) );
}
// signals and slots connections
connect( PushButtonUpdateView, SIGNAL( clicked() ), this, SLOT( updateView() ) );
/* to close dialog if study change */
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ) ;
}
/*
* Destroys the object and frees any allocated resources
*/
SMESHGUI_EditScalarBarDlg::~SMESHGUI_EditScalarBarDlg()
{
// no need to delete child widgets, Qt does it all for us
}
void SMESHGUI_EditScalarBarDlg::updateView()
{
float MinRange = LineEditMin->text().toFloat();
float MaxRange = LineEditMax->text().toFloat();
mySMESHGUI->UpdateScalarBar(MinRange,MaxRange);
}

View File

@ -1,73 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_EditScalarBarDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef SMESHGUI_EDITSCALARBARDLG_H
#define SMESHGUI_EDITSCALARBARDLG_H
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QFrame;
class QLabel;
class QLineEdit;
class QPushButton;
class SMESHGUI;
class SMESHGUI_EditScalarBarDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_EditScalarBarDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_EditScalarBarDlg();
QPushButton* PushButtonUpdateView;
QLineEdit* LineEditMax;
QLineEdit* LineEditMin;
QLabel* TextLabelMax;
QLabel* TextLabelMin;
QFrame* Line1;
SMESHGUI *mySMESHGUI;
public slots:
void updateView();
protected:
QGridLayout* grid;
QGridLayout* grid_2;
QGridLayout* grid_3;
QGridLayout* grid_4;
QGridLayout* grid_5;
QGridLayout* grid_6;
};
#endif // SMESHGUI_EDITSCALARBARDLG_H

View File

@ -1,334 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_LocalLengthDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_LocalLengthDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : SMESHGUI_LocalLengthDlg()
// purpose : Constructs a SMESHGUI_LocalLengthDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
SMESHGUI_LocalLengthDlg::SMESHGUI_LocalLengthDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_LOCAL_LENGTH")));
if ( !name )
setName( "SMESHGUI_LocalLengthDlg" );
resize( 303, 175 );
setCaption( tr( "SMESH_LOCAL_LENGTH_TITLE" ) );
setSizeGripEnabled( TRUE );
SMESHGUI_LocalLengthDlgLayout = new QGridLayout( this );
SMESHGUI_LocalLengthDlgLayout->setSpacing( 6 );
SMESHGUI_LocalLengthDlgLayout->setMargin( 11 );
/***************************************************************/
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 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_LocalLengthDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "SMESH_LOCAL_LENGTH_HYPOTHESIS" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
SMESHGUI_LocalLengthDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabel_Length = new QLabel(GroupC1 , "TextLabel_Length" );
TextLabel_Length->setText( tr( "SMESH_LENGTH" ) );
GroupC1Layout->addWidget( TextLabel_Length, 1, 0 );
TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
SpinBox_Length = new SMESHGUI_SpinBox( GroupC1, "SpinBox_Length" ) ;
GroupC1Layout->addWidget( SpinBox_Length, 1, 1 );
LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC1Layout->addItem( spacer1, 1, 3 );
SMESHGUI_LocalLengthDlgLayout->addWidget(GroupC1 , 1, 0 );
/***************************************************************/
Init() ;
}
//=================================================================================
// function : ~SMESHGUI_LocalLengthDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_LocalLengthDlg::~SMESHGUI_LocalLengthDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::Init()
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEdit_NameHypothesis ;
/* Get setting of step value from file configuration */
double step ;
// QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO
// step = St.toDouble() ; TODO
step = 1.0 ;
/* min, max, step and decimals for spin boxes */
SpinBox_Length->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_Length->SetValue( 1.0 ) ; /* is myLength */
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
LineEdit_NameHypothesis->setText("") ;
myLength = 1.0 ;
myNameHypothesis = "" ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_LocalLengthDlg::ConstructorsClicked(int constructorId)
{
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
myLength = SpinBox_Length->GetValue() ;
mySMESHGUI->CreateLocalLength( "LocalLength", myNameHypothesis, myLength );
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::ClickOnCancel()
{
mySMESHGUI->ResetState() ;
reject() ;
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::TextChangedInLineEdit(const QString& newText)
{
QLineEdit* send = (QLineEdit*)sender();
QString newT = strdup(newText) ;
if (send == LineEdit_NameHypothesis) {
myNameHypothesis = newText ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::ActivateThisDialog()
{
mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_LocalLengthDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ;
return ;
}

View File

@ -1,108 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_LocalLengthDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef DIALOGBOX_LOCAL_LENGTH_H
#define DIALOGBOX_LOCAL_LENGTH_H
// QT Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class SMESHGUI;
class SMESHGUI_SpinBox;
//=================================================================================
// class : SMESHGUI_LocalLengthDlg
// purpose :
//=================================================================================
class SMESHGUI_LocalLengthDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_LocalLengthDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_LocalLengthDlg();
private:
void Init() ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
SMESHGUI* mySMESHGUI ;
QString myNameHypothesis ;
double myLength ;
bool myOkNameHypothesis ;
bool myOkLength ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabel_NameHypothesis ;
QLabel* TextLabel_Length ;
QLineEdit* LineEdit_NameHypothesis ;
SMESHGUI_SpinBox* SpinBox_Length ;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void TextChangedInLineEdit(const QString& newText) ;
protected:
QGridLayout* SMESHGUI_LocalLengthDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_LOCAL_LENGTH_H

View File

@ -1,334 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_MaxElementAreaDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_MaxElementAreaDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : SMESHGUI_MaxElementAreaDlg()
// purpose : Constructs a SMESHGUI_MaxElementAreaDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
SMESHGUI_MaxElementAreaDlg::SMESHGUI_MaxElementAreaDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_AREA")));
if ( !name )
setName( "SMESHGUI_MaxElementAreaDlg" );
resize( 303, 175 );
setCaption( tr( "SMESH_MAX_ELEMENT_AREA_TITLE" ) );
setSizeGripEnabled( TRUE );
SMESHGUI_MaxElementAreaDlgLayout = new QGridLayout( this );
SMESHGUI_MaxElementAreaDlgLayout->setSpacing( 6 );
SMESHGUI_MaxElementAreaDlgLayout->setMargin( 11 );
/***************************************************************/
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 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_MaxElementAreaDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
SMESHGUI_MaxElementAreaDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabel_MaxElementArea = new QLabel(GroupC1 , "TextLabel_MaxElementArea" );
TextLabel_MaxElementArea->setText( tr( "SMESH_MAX_ELEMENT_AREA" ) );
GroupC1Layout->addWidget( TextLabel_MaxElementArea, 1, 0 );
TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
SpinBox_MaxElementArea = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementArea" ) ;
GroupC1Layout->addWidget( SpinBox_MaxElementArea, 1, 1 );
LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC1Layout->addItem( spacer1, 1, 3 );
SMESHGUI_MaxElementAreaDlgLayout->addWidget(GroupC1 , 1, 0 );
/***************************************************************/
Init() ;
}
//=================================================================================
// function : ~SMESHGUI_MaxElementAreaDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_MaxElementAreaDlg::~SMESHGUI_MaxElementAreaDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::Init()
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEdit_NameHypothesis ;
/* Get setting of step value from file configuration */
double step ;
// QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO
// step = St.toDouble() ; TODO
step = 1.0 ;
/* min, max, step and decimals for spin boxes */
SpinBox_MaxElementArea->setPrecision( 10 );
SpinBox_MaxElementArea->RangeStepAndValidator( 0.001, 999999.999, step, 3 ) ;
SpinBox_MaxElementArea->SetValue( 1.0 ) ; /* is myMaxElementArea */
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
LineEdit_NameHypothesis->setText("") ;
myNameHypothesis = "" ;
myMaxElementArea = 1.0 ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::ConstructorsClicked(int constructorId)
{
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
myMaxElementArea = SpinBox_MaxElementArea->GetValue() ;
mySMESHGUI->CreateMaxElementArea( "MaxElementArea", myNameHypothesis, myMaxElementArea );
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::ClickOnCancel()
{
mySMESHGUI->ResetState() ;
reject() ;
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::TextChangedInLineEdit(const QString& newText)
{
QLineEdit* send = (QLineEdit*)sender();
QString newT = strdup(newText) ;
if (send == LineEdit_NameHypothesis) {
myNameHypothesis = newText ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::ActivateThisDialog()
{
mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementAreaDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ;
return ;
}

View File

@ -1,108 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_MaxElementAreaDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef DIALOGBOX_MAX_ELEMENT_AREA_H
#define DIALOGBOX_MAX_ELEMENT_AREA_H
// QT Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class SMESHGUI;
class SMESHGUI_SpinBox;
//=================================================================================
// class : SMESHGUI_MaxElementAreaDlg
// purpose :
//=================================================================================
class SMESHGUI_MaxElementAreaDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_MaxElementAreaDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_MaxElementAreaDlg();
private:
void Init() ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
SMESHGUI* mySMESHGUI ;
QString myNameHypothesis ;
double myMaxElementArea ;
bool myOkNameHypothesis ;
bool myOkMaxElementArea ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabel_NameHypothesis ;
QLabel* TextLabel_MaxElementArea ;
QLineEdit* LineEdit_NameHypothesis ;
SMESHGUI_SpinBox* SpinBox_MaxElementArea ;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void TextChangedInLineEdit(const QString& newText) ;
protected:
QGridLayout* SMESHGUI_MaxElementAreaDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_MAX_ELEMENT_AREA_H

View File

@ -1,338 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_MaxElementVolumeDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_MaxElementVolumeDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : SMESHGUI_MaxElementVolumeDlg()
// purpose : Constructs a SMESHGUI_MaxElementVolumeDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
SMESHGUI_MaxElementVolumeDlg::SMESHGUI_MaxElementVolumeDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_MAX_ELEMENT_VOLUME")));
if ( !name )
setName( "SMESHGUI_MaxElementVolumeDlg" );
resize( 303, 175 );
setCaption( tr( "SMESH_MAX_ELEMENT_VOLUME_TITLE" ) );
setSizeGripEnabled( TRUE );
SMESHGUI_MaxElementVolumeDlgLayout = new QGridLayout( this );
SMESHGUI_MaxElementVolumeDlgLayout->setSpacing( 6 );
SMESHGUI_MaxElementVolumeDlgLayout->setMargin( 11 );
/***************************************************************/
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 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_MaxElementVolumeDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
SMESHGUI_MaxElementVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabel_MaxElementVolume = new QLabel(GroupC1 , "TextLabel_MaxElementVolume" );
TextLabel_MaxElementVolume->setText( tr( "SMESH_MAX_ELEMENT_VOLUME" ) );
GroupC1Layout->addWidget( TextLabel_MaxElementVolume, 1, 0 );
TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
// LineEdit_MaxElementVolume = new QLineEdit(GroupC1 , "LineEdit_MaxElementVolume" );
// GroupC1Layout->addWidget( LineEdit_MaxElementVolume, 1, 1 );
SpinBox_MaxElementVolume = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementVolume" ) ;
GroupC1Layout->addWidget( SpinBox_MaxElementVolume, 1, 1 );
LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC1Layout->addItem( spacer1, 1, 3 );
SMESHGUI_MaxElementVolumeDlgLayout->addWidget(GroupC1 , 1, 0 );
/***************************************************************/
Init() ;
}
//=================================================================================
// function : ~SMESHGUI_MaxElementVolumeDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_MaxElementVolumeDlg::~SMESHGUI_MaxElementVolumeDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::Init()
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEdit_NameHypothesis ;
/* Get setting of step value from file configuration */
double step ;
// QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO
// step = St.toDouble() ; TODO
step = 1.0 ;
/* min, max, step and decimals for spin boxes */
SpinBox_MaxElementVolume->setPrecision( 10 );
SpinBox_MaxElementVolume->RangeStepAndValidator( 0.001, 999999.999, step, 3 ) ;
SpinBox_MaxElementVolume->SetValue( 1.0 ) ; /* is myMaxElementVolume */
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
LineEdit_NameHypothesis->setText("") ;
myNameHypothesis = "" ;
myMaxElementVolume = 1.0 ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::ConstructorsClicked(int constructorId)
{
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
myMaxElementVolume = SpinBox_MaxElementVolume->GetValue() ;
mySMESHGUI->CreateMaxElementVolume( "MaxElementVolume", myNameHypothesis, myMaxElementVolume );
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::ClickOnCancel()
{
mySMESHGUI->ResetState() ;
reject() ;
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::TextChangedInLineEdit(const QString& newText)
{
QLineEdit* send = (QLineEdit*)sender();
QString newT = strdup(newText) ;
if (send == LineEdit_NameHypothesis) {
myNameHypothesis = newText ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::ActivateThisDialog()
{
mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_MaxElementVolumeDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ;
return ;
}

View File

@ -1,108 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_MaxElementVolumeDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef DIALOGBOX_MAX_ELEMENT_VOLUME_H
#define DIALOGBOX_MAX_ELEMENT_VOLUME_H
// QT Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class SMESHGUI;
class SMESHGUI_SpinBox;
//=================================================================================
// class : SMESHGUI_MaxElementVolumeDlg
// purpose :
//=================================================================================
class SMESHGUI_MaxElementVolumeDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_MaxElementVolumeDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_MaxElementVolumeDlg();
private:
void Init() ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
SMESHGUI* mySMESHGUI ;
QString myNameHypothesis ;
double myMaxElementVolume ;
bool myOkNameHypothesis ;
bool myOkMaxElementVolume ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabel_NameHypothesis ;
QLabel* TextLabel_MaxElementVolume ;
QLineEdit* LineEdit_NameHypothesis ;
SMESHGUI_SpinBox* SpinBox_MaxElementVolume ;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void TextChangedInLineEdit(const QString& newText) ;
protected:
QGridLayout* SMESHGUI_MaxElementVolumeDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_MAX_ELEMENT_VOLUME_H

View File

@ -1,330 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_NbSegmentsDlg.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
using namespace std;
#include "SMESHGUI_NbSegmentsDlg.h"
#include "SMESHGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qspinbox.h>
//=================================================================================
// class : SMESHGUI_NbSegmentsDlg()
// purpose : Constructs a SMESHGUI_NbSegmentsDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
SMESHGUI_NbSegmentsDlg::SMESHGUI_NbSegmentsDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_NB_SEGMENTS")));
if ( !name )
setName( "SMESHGUI_NbSegmentsDlg" );
resize( 303, 175 );
setCaption( tr( "SMESH_NB_SEGMENTS_TITLE" ) );
setSizeGripEnabled( TRUE );
SMESHGUI_NbSegmentsDlgLayout = new QGridLayout( this );
SMESHGUI_NbSegmentsDlgLayout->setSpacing( 6 );
SMESHGUI_NbSegmentsDlgLayout->setMargin( 11 );
/***************************************************************/
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 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_NbSegmentsDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "SMESH_NB_SEGMENTS_HYPOTHESIS" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
SMESHGUI_NbSegmentsDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabel_NbSeg = new QLabel(GroupC1 , "TextLabel_NbSeg" );
TextLabel_NbSeg->setText( tr( "SMESH_SEGMENTS" ) );
GroupC1Layout->addWidget( TextLabel_NbSeg, 1, 0 );
TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" );
TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) );
GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 );
SpinBox_NbSeg = new QSpinBox( GroupC1, "SpinBox_NbSeg" );
GroupC1Layout->addWidget( SpinBox_NbSeg, 1, 1 );
LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" );
GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 );
QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC1Layout->addItem( spacer1, 1, 3 );
SMESHGUI_NbSegmentsDlgLayout->addWidget(GroupC1 , 1, 0 );
/***************************************************************/
Init() ;
}
//=================================================================================
// function : ~SMESHGUI_NbSegmentsDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
SMESHGUI_NbSegmentsDlg::~SMESHGUI_NbSegmentsDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::Init()
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEdit_NameHypothesis ;
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
LineEdit_NameHypothesis->setText("") ;
SpinBox_NbSeg->setMinValue( 1 );
SpinBox_NbSeg->setMaxValue( 9999 );
SpinBox_NbSeg->setValue(3) ; /* myNbSeg */
myNbSeg = 3.0 ;
myNameHypothesis = "" ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_NbSegmentsDlg::ConstructorsClicked(int constructorId)
{
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
myNbSeg = SpinBox_NbSeg->value() ;
int nbSegInt = int(myNbSeg);
mySMESHGUI->CreateNbSegments( "NumberOfSegments", myNameHypothesis, nbSegInt );
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::ClickOnCancel()
{
mySMESHGUI->ResetState() ;
reject() ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::TextChangedInLineEdit(const QString& newText)
{
QLineEdit* send = (QLineEdit*)sender();
QString newT = strdup(newText) ;
if (send == LineEdit_NameHypothesis) {
myNameHypothesis = newText ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::ActivateThisDialog()
{
mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void SMESHGUI_NbSegmentsDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ;
return ;
}

View File

@ -1,108 +0,0 @@
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_NbSegmentsDlg.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef DIALOGBOX_NB_SEGMENTS_H
#define DIALOGBOX_NB_SEGMENTS_H
// QT Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QSpinBox;
class QPushButton;
class QRadioButton;
class SMESHGUI;
//=================================================================================
// class : SMESHGUI_NbSegmentsDlg
// purpose :
//=================================================================================
class SMESHGUI_NbSegmentsDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_NbSegmentsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_NbSegmentsDlg();
private:
void Init() ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ;
SMESHGUI* mySMESHGUI ;
QString myNameHypothesis ;
double myNbSeg ;
bool myOkNameHypothesis ;
QDoubleValidator *myVa ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabel_NameHypothesis ;
QLabel* TextLabel_NbSeg ;
QLineEdit* LineEdit_NameHypothesis ;
QSpinBox* SpinBox_NbSeg ;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void DeactivateActiveDialog() ;
void TextChangedInLineEdit(const QString& newText) ;
void ActivateThisDialog() ;
protected:
QGridLayout* SMESHGUI_NbSegmentsDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_NB_SEGMENTS_H

View File

@ -1,197 +0,0 @@
# SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_icons.po
# Module : SMESH
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
"PO-Revision-Date: YYYY-MM-DD\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
#-----------------------------------------------------------
# Divers Mesh
#-----------------------------------------------------------
#ObjectBrowser Icon
msgid "ICON_OBJBROWSER_SMESH"
msgstr "mesh.png"
#Select Icon
msgid "ICON_SELECT"
msgstr "select1.png"
#Mesh Init
msgid "ICON_DLG_INIT_MESH"
msgstr "mesh_init.png"
#
msgid "ICON_DLG_ADD_SUBMESH"
msgstr "mesh_add_sub.png"
#Move Node
msgid "ICON_DLG_MOVE_NODE"
msgstr "mesh_move_node.png"
#Remove Node
msgid "ICON_DLG_REM_NODE"
msgstr "mesh_rem_node.png"
#Remove Element
msgid "ICON_DLG_REM_ELEMENT"
msgstr "mesh_rem_element.png"
#Orientation
msgid "ICON_DLG_MESH_ORIENTATION"
msgstr "mesh_orientation.png"
#
msgid "ICON_DLG_MESH_DIAGONAL"
msgstr "mesh_diagonal.png"
#Connectivity
msgid "ICON_DLG_CONNECTIVITY"
msgstr "mesh_connectivity.png"
#-----------------------------------------------------------
# Hypothesis
#-----------------------------------------------------------
#Hypo Local Length
msgid "ICON_DLG_LOCAL_LENGTH"
msgstr "mesh_hypo_length.png"
#Hypo Nb Segments
msgid "ICON_DLG_NB_SEGMENTS"
msgstr "mesh_hypo_segment.png"
#Hypo Max Area
msgid "ICON_DLG_MAX_ELEMENT_AREA"
msgstr "mesh_hypo_area.png"
#Hypo Max Volume
msgid "ICON_DLG_MAX_ELEMENT_VOLUME"
msgstr "mesh_hypo_volume.png"
#Set Algo
msgid "ICON_DLG_ADD_ALGORITHM"
msgstr "mesh_set_algo.png"
#Set Hypo
msgid "ICON_DLG_ADD_HYPOTHESIS"
msgstr "mesh_set_hypo.png"
#Edit Hypo.
msgid "ICON_DLG_EDIT_MESH"
msgstr "mesh_edit.png"
#-----------------------------------------------------------
# Elements
#-----------------------------------------------------------
#Vertex
msgid "ICON_DLG_NODE"
msgstr "mesh_vertex.png"
#Line
msgid "ICON_DLG_LINE"
msgstr "mesh_line.png"
#Triangle
msgid "ICON_DLG_TRIANGLE"
msgstr "mesh_triangle.png"
#Quadrangle
msgid "ICON_DLG_QUADRANGLE"
msgstr "mesh_quad.png"
#Tetrahedrons
msgid "ICON_DLG_TETRAS"
msgstr "mesh_tetra.png"
#Hexahedrons
msgid "ICON_DLG_HEXAS"
msgstr "mesh_hexa.png"
#-----------------------------------------------------------
# ObjectBrother
#-----------------------------------------------------------
#mesh_tree_mesh
msgid "ICON_SMESH_TREE_MESH"
msgstr "mesh_tree_mesh.png"
#mesh_tree_algo
msgid "ICON_SMESH_TREE_ALGO"
msgstr "mesh_tree_algo.png"
#mesh_tree_algo_regular
msgid "ICON_SMESH_TREE_ALGO_Regular_1D"
msgstr "mesh_tree_algo_regular.png"
#mesh_tree_algo_hexa
msgid "ICON_SMESH_TREE_ALGO_Hexa_3D"
msgstr "mesh_tree_algo_hexa.png"
#mesh_tree_algo_mefisto
msgid "ICON_SMESH_TREE_ALGO_MEFISTO_2D"
msgstr "mesh_tree_algo_mefisto.png"
#mesh_tree_algo_quad
msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
msgstr "mesh_tree_algo_quad.png"
#mesh_tree_algo_netgen
msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D"
msgstr "mesh_tree_algo_netgen.png"
#mesh_tree_hypo
msgid "ICON_SMESH_TREE_HYPO"
msgstr "mesh_tree_hypo.png"
#mesh_tree_hypo_area
msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
msgstr "mesh_tree_hypo_area.png"
#mesh_tree_hypo_length
msgid "ICON_SMESH_TREE_HYPO_LocalLength"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_segment
msgid "ICON_SMESH_TREE_HYPO_NumberOfSegments"
msgstr "mesh_tree_hypo_segment.png"
#mesh_tree_hypo_volume
msgid "ICON_SMESH_TREE_HYPO_MaxElementVolume"
msgstr "mesh_tree_hypo_volume.png"
#mesh_tree_mesh_warn
msgid "ICON_SMESH_TREE_MESH_WARN"
msgstr "mesh_tree_mesh_warn.png"

View File

@ -1,664 +0,0 @@
# SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_msg_en.po
# Module : SMESH
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n"
"PO-Revision-Date: YYYY-MM-DD\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
#-------------------------------------------------------------------------
# BUTTON
#-------------------------------------------------------------------------
#Apply
msgid "SMESH_BUT_APPLY"
msgstr "&Apply"
#Close
msgid "SMESH_BUT_CLOSE"
msgstr "&Close"
#Ok
msgid "SMESH_BUT_OK"
msgstr "&Ok"
#Yes
msgid "SMESH_BUT_YES"
msgstr "&Yes"
#No
msgid "SMESH_BUT_NO"
msgstr "&No"
#Cancel
msgid "SMESH_BUT_CANCEL"
msgstr "&Cancel"
#-------------------------------------------------------------------------
# WARNING
#-------------------------------------------------------------------------
#Warning
msgid "SMESH_WRN_WARNING"
msgstr "Warning"
msgid "WARNING"
msgstr "Warning"
#: SMESHGUI.cxx:465
msgid "SMESH_REALLY_DELETE"
msgstr "Do you really want to delete object(s) ?"
#Hypothesis or Algorithm not exists
msgid "SMESH_WRN_HYPOTHESIS_NOTEXIST"
msgstr "Hypothesis or Algorithm not exists"
#Hypothesis already exists
msgid "SMESH_WRN_HYPOTHESIS_ALREADYEXIST"
msgstr "Hypothesis already exists"
#Algorithm already exists
msgid "SMESH_WRN_ALGORITHM_ALREADYEXIST"
msgstr "Algorithm already exists"
#Missing parameters
msgid "SMESH_WRN_MISSING_PARAMETERS"
msgstr "Missing parameters"
#Study frame with VTK Viewer must be activated
msgid "SMESH_WRN_VIEWER_VTK"
msgstr "Study frame with VTK Viewer must be activated"
#Activate Elements Selection Mode
msgid "SMESH_WRN_SELECTIONMODE_ELEMENTS"
msgstr "Activate Elements Selection Mode"
#Activate Nodes Selection Mode
msgid "SMESH_WRN_SELECTIONMODE_NODES"
msgstr "Activate Nodes Selection Mode"
#Activate Link Selection Mode
msgid "SMESH_WRN_SELECTIONMODE_DIAGONAL"
msgstr "Activate Link Selection Mode"
#-------------------------------------------------------------------------
# MEN
#-------------------------------------------------------------------------
#SMESH
msgid "SMESH_MEN_COMPONENT"
msgstr "SMESH"
#SubMeshes On Vertex
msgid "SMESH_MEN_SubMeshesOnVertex"
msgstr "SubMeshes On Vertex"
#SubMeshes On Edge
msgid "SMESH_MEN_SubMeshesOnEdge"
msgstr "SubMeshes On Edge"
#SubMeshes On Face
msgid "SMESH_MEN_SubMeshesOnFace"
msgstr "SubMeshes On Face"
#SubMeshes On Solid
msgid "SMESH_MEN_SubMeshesOnSolid"
msgstr "SubMeshes On Solid"
#SubMeshes On Compound
msgid "SMESH_MEN_SubMeshesOnCompound"
msgstr "SubMeshes On Compound"
#Applied Algorithm
msgid "SMESH_MEN_APPLIED_ALGORIHTMS"
msgstr "Applied Algorithm"
#Applied Hypothesis
msgid "SMESH_MEN_APPLIED_HYPOTHESIS"
msgstr "Applied Hypothesis"
#Hypothesis Definition
msgid "SMESH_MEN_HYPOTHESIS"
msgstr "Hypothesis Definition"
#Algorithms Definition
msgid "SMESH_MEN_ALGORITHMS"
msgstr "Algorithms Definition"
#-------------------------------------------------------------------------
# DIVERS
#-------------------------------------------------------------------------
#Arguments
msgid "SMESH_ARGUMENTS"
msgstr "Arguments"
#Value
msgid "SMESH_VALUE"
msgstr "Value"
#%1_objects
msgid "SMESH_OBJECTS_SELECTED"
msgstr "%1_objects"
#Name
msgid "SMESH_NAME"
msgstr "Name"
#Geometrical Object
msgid "SMESH_OBJECT_GEOM"
msgstr "Geometrical Object"
#Length
msgid "SMESH_LENGTH"
msgstr "Length"
#Coordinates
msgid "SMESH_COORDINATES"
msgstr "Coordinates"
#X
msgid "SMESH_X"
msgstr "X"
#Y
msgid "SMESH_Y"
msgstr "Y"
#Z
msgid "SMESH_Z"
msgstr "Z"
#-------------------------------------------------------------------------
# DLG
#-------------------------------------------------------------------------
# -------------- Init --------------
#Mesh
msgid "SMESH_INIT"
msgstr "Mesh"
#Mesh or SubMesh
msgid "SMESH_OBJECT_MESHorSUBMESH"
msgstr "Mesh or SubMesh"
#Mesh Construction
msgid "SMESH_INIT_MESH"
msgstr "Mesh Construction"
#SubMesh Construction
msgid "SMESH_ADD_SUBMESH"
msgstr "SubMesh Construction"
#Mesh
msgid "SMESH_OBJECT_MESH"
msgstr "Mesh"
#SubMesh
msgid "SMESH_SUBMESH"
msgstr "SubMesh"
# -------------- Hypothesis / Algorithm --------------
#Hypothesis
msgid "SMESH_ADD_HYPOTHESIS"
msgstr "Hypothesis"
#Hypothesis Construction
msgid "SMESH_ADD_HYPOTHESIS_TITLE"
msgstr "Hypothesis Assignation"
#Hypothesis
msgid "SMESH_OBJECT_HYPOTHESIS"
msgstr "Hypothesis"
#Local Length
msgid "SMESH_LOCAL_LENGTH_HYPOTHESIS"
msgstr "Local Length"
#Hypothesis Construction
msgid "SMESH_LOCAL_LENGTH_TITLE"
msgstr "Hypothesis Construction"
#Algorithms
msgid "SMESH_ADD_ALGORITHM"
msgstr "Algorithms"
#Algorithms Construction
msgid "SMESH_ADD_ALGORITHM_TITLE"
msgstr "Algorithms Assignation"
#Algorithm
msgid "SMESH_OBJECT_ALGORITHM"
msgstr "Algorithm"
#Number of Segments
msgid "SMESH_NB_SEGMENTS_HYPOTHESIS"
msgstr "Number of Segments"
#Hypothesis Construction
msgid "SMESH_NB_SEGMENTS_TITLE"
msgstr "Hypothesis Construction"
#Max. Area
msgid "SMESH_MAX_ELEMENT_AREA"
msgstr "Max. Area"
#Max. Element Area
msgid "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"
msgstr "Max. Element Area"
#Hypothesis Construction
msgid "SMESH_MAX_ELEMENT_AREA_TITLE"
msgstr "Hypothesis Construction"
#Max. Volume
msgid "SMESH_MAX_ELEMENT_VOLUME"
msgstr "Max. Volume"
#Max. Element Volume
msgid "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"
msgstr "Max. Element Volume"
#Hypothesis Construction
msgid "SMESH_MAX_ELEMENT_VOLUME_TITLE"
msgstr "Hypothesis Construction"
# -------------- Nodes / Segments / Elements --------------
#Node
msgid "MESH_NODE"
msgstr "Node"
#Node Construction
msgid "MESH_NODE_TITLE"
msgstr "Node Construction"
#Segments
msgid "SMESH_SEGMENTS"
msgstr "Segments"
#Elements
msgid "SMESH_ELEMENTS"
msgstr "Elements"
#Id Elements
msgid "SMESH_ID_ELEMENTS"
msgstr "Id Elements"
#Remove
msgid "SMESH_REMOVE"
msgstr "Remove"
#Remove Elements
msgid "SMESH_REMOVE_ELEMENTS_TITLE"
msgstr "Remove Elements"
#Id Nodes
msgid "SMESH_ID_NODES"
msgstr "Id Nodes"
#Nodes
msgid "SMESH_NODES"
msgstr "Nodes"
#Remove Nodes
msgid "SMESH_REMOVE_NODES_TITLE"
msgstr "Remove Nodes"
#Move
msgid "SMESH_MOVE"
msgstr "Move"
#Move Node
msgid "SMESH_MOVE_NODES_TITLE"
msgstr "Move Node"
#Add Triangle
msgid "SMESH_ADD_TRIANGLE_TITLE"
msgstr "Add Triangle"
#Add Quadrangle
msgid "SMESH_ADD_QUADRANGLE_TITLE"
msgstr "Add Quadrangle"
#Add Edge
msgid "SMESH_ADD_EDGE_TITLE"
msgstr "Add Edge"
#Add Tetrahedron
msgid "SMESH_ADD_TETRAS_TITLE"
msgstr "Add Tetrahedron"
#Add Hexahedron
msgid "SMESH_ADD_HEXAS_TITLE"
msgstr "Add Hexahedron"
#Reverse
msgid "SMESH_REVERSE"
msgstr "Reverse"
#Triangle
msgid "SMESH_TRIANGLE"
msgstr "Triangle"
#Quadrangle
msgid "SMESH_QUADRANGLE"
msgstr "Quadrangle"
#Edge
msgid "SMESH_EDGE"
msgstr "Edge"
#Tetrahedron
msgid "SMESH_TETRAS"
msgstr "Tetrahedron"
#Hexahedron
msgid "SMESH_HEXAS"
msgstr "Hexahedron"
#Add Triangle
msgid "SMESH_ADD_TRIANGLE"
msgstr "Add Triangle"
#Add Quadrangle
msgid "SMESH_ADD_QUADRANGLE"
msgstr "Add Quadrangle"
#Add Edge
msgid "SMESH_ADD_EDGE"
msgstr "Add Edge"
#Add Tetrahedron
msgid "SMESH_ADD_TETRAS"
msgstr "Add Tetrahedron"
#Add Hexahedron
msgid "SMESH_ADD_HEXAS"
msgstr "Add Hexahedron"
# -------------- Transparency --------------
#Opacity
msgid "SMESH_TRANSPARENCY_OPAQUE"
msgstr "Opacity"
#Transparency
msgid "SMESH_TRANSPARENCY_TITLE"
msgstr "Transparency"
#Fully Transparency
msgid "SMESH_TRANSPARENCY_TRANSPARENT"
msgstr "Fully Transparency"
# -------------- Preferences -----------
#Arial
msgid "SMESH_FONT_ARIAL"
msgstr "Arial"
#Bold
msgid "SMESH_FONT_BOLD"
msgstr "Bold"
#Courier
msgid "SMESH_FONT_COURIER"
msgstr "Courier"
#Dimensions
msgid "SMESH_DIMENSIONS"
msgstr "Dimensions"
#Font
msgid "SMESH_FONT"
msgstr "Font"
#Height
msgid "SMESH_HEIGHT"
msgstr "Height"
#Horizontal
msgid "SMESH_HORIZONTAL"
msgstr "Horizontal"
#Italic
msgid "SMESH_FONT_ITALIC"
msgstr "Italic"
#Scalar Bar Preferences
msgid "SMESH_PREFERENCES_SCALARBAR"
msgstr "Scalar Bar Preferences"
#Number Of Colors
msgid "SMESH_NUMBEROFCOLORS"
msgstr "Number Of Colors"
#Number Of Labels
msgid "SMESH_NUMBEROFLABELS"
msgstr "Number Of Labels"
#Orientation
msgid "SMESH_ORIENTATION"
msgstr "Orientation"
#Properties
msgid "SMESH_PROPERTIES"
msgstr "Properties"
#Shadow
msgid "SMESH_FONT_SHADOW"
msgstr "Shadow"
#Times
msgid "SMESH_FONT_TIMES"
msgstr "Times"
#Vertical
msgid "SMESH_VERTICAL"
msgstr "Vertical"
#Width
msgid "SMESH_WIDTH"
msgstr "Width"
# -------------- ScalarBar --------------
#Max
msgid "SMESH_MAX"
msgstr "Max"
#Min
msgid "SMESH_MIN"
msgstr "Min"
#ScalarBar
msgid "SMESH_SCALARBAR"
msgstr "ScalarBar"
#Update View
msgid "SMESH_UPDATEVIEW"
msgstr "Update View"
# -------------- Connectivity --------------
#Boundary Edges
msgid "SMESH_BOUNDARYEDGES"
msgstr "Boundary Edges"
#Feature Edges
msgid "SMESH_FEATUREEDGES"
msgstr "Feature Edges"
#Manifold Edges
msgid "SMESH_MANIFOLDEDGES"
msgstr "Manifold Edges"
#Non Manifold Edges
msgid "SMESH_NONMANIFOLDEDGES"
msgstr "Non Manifold Edges"
#Edges Connectivity
msgid "SMESH_EDGES_CONNECTIVITY"
msgstr "Edges Connectivity"
#Edges Connectivity
msgid "SMESH_EDGES_CONNECTIVITY_TITLE"
msgstr "Edges Connectivity"
#Mesh
msgid "SMESH_MESH"
msgstr "Mesh"
#Feature Angle
msgid "SMESH_FEATUREANGLE"
msgstr "Feature Angle"
# -------------- Operations --------------
#Change Orientation
msgid "SMESH_ORIENTATION_ELEMENTS_TITLE"
msgstr "Change Orientation"
#Id Diagonal
msgid "SMESH_ID_DIAGONAL"
msgstr "Id Edges"
#Diagonal Inversion
msgid "SMESH_DIAGONAL"
msgstr "Diagonal Inversion"
#Diagonal Inversion
msgid "SMESH_DIAGONAL_INVERSION_TITLE"
msgstr "Diagonal Inversion"
# -------------- Mesh Infos --------------
#Mesh Infos
msgid "SMESH_MESHINFO_TITLE"
msgstr "Mesh Infos"
#Number Of 1D Elements
msgid "SMESH_MESHINFO_NB1D"
msgstr "Number Of 1D Elements"
#Number Of 2D Elements
msgid "SMESH_MESHINFO_NB2D"
msgstr "Number Of 2D Elements"
#Number Of 3D Elements
msgid "SMESH_MESHINFO_NB3D"
msgstr "Number Of 3D Elements"
#Edges :
msgid "SMESH_MESHINFO_EDGES"
msgstr "Edges :"
#Nodes :
msgid "SMESH_MESHINFO_NODES"
msgstr "Nodes :"
#Triangles :
msgid "SMESH_MESHINFO_TRIANGLES"
msgstr "Triangles :"
#Quadrangles :
msgid "SMESH_MESHINFO_QUADRANGLES"
msgstr "Quadrangles :"
#Tetrahedrons :
msgid "SMESH_MESHINFO_TETRAS"
msgstr "Tetrahedrons :"
#Hexahedrons :
msgid "SMESH_MESHINFO_HEXAS"
msgstr "Hexahedrons :"
# -------------- Controls --------------
#Length
msgid "SMESH_CONTROL_LENGTH_EDGES"
msgstr "Length"
#Area
msgid "SMESH_CONTROL_AREA_ELEMENTS"
msgstr "Area"
#Taper
msgid "SMESH_CONTROL_TAPER_ELEMENTS"
msgstr "Taper"
#Aspect Ratio
msgid "SMESH_CONTROL_ASPECTRATIO_ELEMENTS"
msgstr "Aspect Ratio"
#Minimum Angle
msgid "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS"
msgstr "Minimum Angle"
#Warp
msgid "SMESH_CONTROL_WARP_ELEMENTS"
msgstr "Warp"
#Skew
msgid "SMESH_CONTROL_SKEW_ELEMENTS"
msgstr "Skew"
# -------------- Edit --------------
#Hypotheses Assignation
msgid "SMESH_EDIT_HYPOTHESES"
msgstr "Hypotheses Assignation"
#Hypotheses
msgid "SMESH_HYPOTHESES"
msgstr "Hypotheses"
#Available
msgid "SMESH_AVAILABLE"
msgstr "Available"
#Used
msgid "SMESH_EDIT_USED"
msgstr "Used"

View File

@ -1,23 +0,0 @@
// 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
int main(int argc, char** argv)
{
return 1;
}

View File

@ -466,6 +466,8 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
myHypothesis_i =
myHypCreatorMap[string(theHypName)]->Create
(myPoa, myCurrentStudy->StudyId(), &myGen);
// _CS_gbo Explicit activation (no longer made in the constructor).
myHypothesis_i->Activate();
myHypothesis_i->SetLibName(theLibName); // for persistency assurance
}
catch (SALOME_Exception& S_ex)

View File

@ -43,11 +43,27 @@ using namespace std;
SMESH_Hypothesis_i::SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA )
: SALOME::GenericObj_i( thePOA )
{
MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i" );
MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Début" );
myBaseImpl = 0;
thePOA->activate_object( this );
// _CS_gbo This instruction fails
// thePOA->activate_object( this );
// _CS_gbo I keep the POA reference to activate the object in the future.
myPOA = thePOA;
MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Fin" );
};
//=============================================================================
/*!
* SMESH_Hypothesis_i::Activate()
*
* Activation of the object
*/
//=============================================================================
void SMESH_Hypothesis_i::Activate() {
myPOA->activate_object( this );
}
//=============================================================================
/*!
* SMESH_Hypothesis_i::~SMESH_Hypothesis_i

View File

@ -67,12 +67,19 @@ public:
// Get implementation
::SMESH_Hypothesis* GetImpl();
// _CS_gbo_ Activate the object using the POA
void Activate();
// Persistence
virtual char* SaveTo();
virtual void LoadFrom( const char* theStream );
protected:
::SMESH_Hypothesis* myBaseImpl; // base hypothesis implementation
// _CS_gbo_070505 To keep the reference and delayed the activation
// in the methode Activate().
PortableServer::POA_ptr myPOA;
};
// ======================================================

View File

@ -49,6 +49,8 @@ using namespace std;
#include <string>
#include <iostream>
// _CS_gbo_050504 Ajout explicite du sstream pour ostringstream
#include <sstream>
//**** SMESHDS en champ

View File

@ -1,215 +0,0 @@
#
# Hexahedrization of a simple box. Hypothesis and algorithms for
# the mesh generation are not global: the mesh of some edges is thinner
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define a boxe
box = geompy.MakeBox(0., 0., 0., 1., 1., 1.)
idbox = geompy.addToStudy(box,"box")
print "Analysis of the geometry box :"
subShellList=geompy.SubShapeAllSorted(box,ShapeTypeShell)
subFaceList=geompy.SubShapeAllSorted(box,ShapeTypeFace)
subEdgeList=geompy.SubShapeAllSorted(box,ShapeTypeEdge)
print "number of Shells in box : ",len(subShellList)
print "number of Faces in box : ",len(subFaceList)
print "number of Edges in box : ",len(subEdgeList)
idSubEdge = []
for k in range(len(subEdgeList)):
idSubEdge.append(geompy.addToStudyInFather(box,subEdgeList[k],"SubEdge"+str(k)))
edgeX = []
edgeX.append(subEdgeList[4])
edgeX.append(subEdgeList[5])
edgeX.append(subEdgeList[6])
edgeX.append(subEdgeList[7])
edgeY = []
edgeY.append(subEdgeList[1])
edgeY.append(subEdgeList[2])
edgeY.append(subEdgeList[9])
edgeY.append(subEdgeList[10])
edgeZ = []
edgeZ.append(subEdgeList[0])
edgeZ.append(subEdgeList[3])
edgeZ.append(subEdgeList[8])
edgeZ.append(subEdgeList[11])
idEdgeX = []
idEdgeY = []
idEdgeZ = []
for i in range(4):
idEdgeX.append(geompy.addToStudyInFather(box,edgeX[i],"EdgeX"+str(i+1)))
idEdgeY.append(geompy.addToStudyInFather(box,edgeY[i],"EdgeY"+str(i+1)))
idEdgeZ.append(geompy.addToStudyInFather(box,edgeZ[i],"EdgeZ"+str(i+1)))
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments in X, Y, Z direction"
numberOfSegmentsX = 10
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSegX=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegX.SetNumberOfSegments(numberOfSegmentsX)
hypNbSegXID = hypNbSegX.GetId()
print hypNbSegX.GetName()
print hypNbSegXID
print hypNbSegX.GetNumberOfSegments()
idsegX = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegX) )
smeshgui.SetName(idsegX, "NumberOfSegmentsX")
print ""
numberOfSegmentsY = 20
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSegY=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegY.SetNumberOfSegments(numberOfSegmentsY)
hypNbSegYID = hypNbSegY.GetId()
print hypNbSegY.GetName()
print hypNbSegYID
print hypNbSegY.GetNumberOfSegments()
idsegY = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegY) )
smeshgui.SetName(idsegY, "NumberOfSegmentsY")
print ""
numberOfSegmentsZ = 40
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSegZ=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegZ.SetNumberOfSegments(numberOfSegmentsZ)
hypNbSegZID = hypNbSegZ.GetId()
print hypNbSegZ.GetName()
print hypNbSegZID
print hypNbSegZ.GetNumberOfSegments()
idsegZ = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegZ) )
smeshgui.SetName(idsegZ, "NumberOfSegmentsZ")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- Quadrangle_2D"
hypothesis=gen.CreateHypothesis("Quadrangle_2D")
quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
smeshgui.SetName(quadID, "Quadrangle_2D")
print "-------------------------- Hexa_3D"
hypothesis=gen.CreateHypothesis("Hexa_3D")
hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
smeshgui.SetName(hexaID, "Hexa_3D")
# ---- init a Mesh with the boxe
mesh=gen.Init(idbox)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshBox")
smeshgui.SetShape(idbox, idmesh)
# ---- add hypothesis to the boxe
print "-------------------------- add hypothesis to the boxe"
print " the number of segments is globally set to"
print " NumberOfSegmentsX = ", numberOfSegmentsX
ret=mesh.AddHypothesis(box,regular1D)
print ret
ret=mesh.AddHypothesis(box,hypNbSegX)
print ret
ret=mesh.AddHypothesis(box,quad2D)
print ret
ret=mesh.AddHypothesis(box,hexa3D)
print ret
print "-------------------------- set algoritms"
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idsegX )
smeshgui.SetAlgorithms( idmesh, quadID )
smeshgui.SetAlgorithms( idmesh, hexaID )
for i in range(4):
print "-------------------------- add hypothesis to edge in the Y and Z directions", (i+1)
subMeshEdgeY = mesh.GetElementsOnShape(edgeY[i])
subMeshEdgeZ = mesh.GetElementsOnShape(edgeZ[i])
retY = mesh.AddHypothesis(edgeY[i],hypNbSegY)
retZ = mesh.AddHypothesis(edgeZ[i],hypNbSegZ)
print " add hyp Y ", retY, " Z ", retZ
idsmY = smeshgui.AddSubMeshOnShape(
idmesh,idEdgeY[i],salome.orb.object_to_string(subMeshEdgeY),
ShapeTypeEdge)
idsmZ = smeshgui.AddSubMeshOnShape(
idmesh,idEdgeZ[i],salome.orb.object_to_string(subMeshEdgeZ),
ShapeTypeEdge)
smeshgui.SetName(idsmY, "SubMeshEdgeY_"+str(i+1))
smeshgui.SetName(idsmZ, "SubMeshEdgeZ_"+str(i+1))
smeshgui.SetHypothesis(idsmY, idsegY)
smeshgui.SetHypothesis(idsmZ, idsegZ)
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the boxe"
ret=gen.Compute(mesh,idbox)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when Computing the mesh"
sg.updateObjBrowser(1)

View File

@ -1,175 +0,0 @@
#
# Tetrahedrization of a geometry (box minus a inner cylinder).
# Hypothesis and algorithms for the mesh generation are global
#
import math
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
a = math.sqrt(2.)/4.
ma = - a
zero = 0.
un = 1.
mun= - un
demi = 1./2.
Orig = geom.MakePointStruct(zero,zero,zero)
P0 = geom.MakePointStruct(a,a,zero)
P1 = geom.MakePointStruct(zero,demi,zero)
P2 = geom.MakePointStruct(ma,a,zero)
P3 = geom.MakePointStruct(mun,un,zero)
P4 = geom.MakePointStruct(un,un,zero)
P5 = geom.MakePointStruct(zero,zero,un)
arc = geompy.MakeArc(P0,P1,P2)
e1 = geompy.MakeEdge(P2,P3)
e2 = geompy.MakeEdge(P3,P4)
e3 = geompy.MakeEdge(P4,P0)
list = []
list.append(arc._get_Name())
list.append(e1._get_Name())
list.append(e2._get_Name())
list.append(e3._get_Name())
wire = geompy.MakeWire(list)
face = geompy.MakeFace(wire,1)
dir = geompy.MakeVector(Orig,P5)
vol1 = geompy.MakePipe(dir,face)
angle = math.pi/2.
dir = geom.MakeAxisStruct(zero,zero,zero,zero,zero,un)
vol2 = geompy.MakeRotation(vol1,dir,angle)
vol3 = geompy.MakeRotation(vol2,dir,angle)
vol4 = geompy.MakeRotation(vol3,dir,angle)
list = []
list.append(vol1._get_Name())
list.append(vol2._get_Name())
list.append(vol3._get_Name())
list.append(vol4._get_Name())
volComp = geompy.MakeCompound(list)
tol3d = 1.e-3
vol = geom.MakeGlueFaces(volComp,tol3d)
idVol = geompy.addToStudy(vol,"volume")
print "Analysis of the final volume:"
subShellList=geompy.SubShapeAll(vol,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(vol,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(vol,ShapeTypeEdge)
print "number of Shells in the volume : ",len(subShellList)
print "number of Faces in the volume : ",len(subFaceList)
print "number of Edges in the volume : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- Quadrangle_2D"
hypothesis=gen.CreateHypothesis("Quadrangle_2D")
quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
smeshgui.SetName(quadID, "Quadrangle_2D")
print "-------------------------- Hexa_3D"
hypothesis=gen.CreateHypothesis("Hexa_3D")
hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
smeshgui.SetName(hexaID, "Hexa_3D")
# ---- init a Mesh with the volume
mesh=gen.Init(idVol)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "meshVolume")
smeshgui.SetShape(idVol, idmesh)
# ---- add hypothesis to the volume
print "-------------------------- add hypothesis to the volume"
ret=mesh.AddHypothesis(vol,regular1D)
print ret
ret=mesh.AddHypothesis(vol,hypNbSeg)
print ret
ret=mesh.AddHypothesis(vol,quad2D)
print ret
ret=mesh.AddHypothesis(vol,hexa3D)
print ret
print "-------------------------- set algoritms"
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, quadID )
smeshgui.SetAlgorithms( idmesh, hexaID )
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the volume"
ret=gen.Compute(mesh,idVol)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when Computing the mesh"
sg.updateObjBrowser(1)

View File

@ -1,225 +0,0 @@
#
# Tetrahedrization of a geometry (box minus a inner cylinder).
# Hypothesis and algorithms for the mesh generation are not global:
# the mesh of some edges is thinner
#
import math
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
a = math.sqrt(2.)/4.
ma = - a
zero = 0.
un = 1.
mun= - un
demi = 1./2.
Orig = geom.MakePointStruct(zero,zero,zero)
P0 = geom.MakePointStruct(a,a,zero)
P1 = geom.MakePointStruct(zero,demi,zero)
P2 = geom.MakePointStruct(ma,a,zero)
P3 = geom.MakePointStruct(mun,un,zero)
P4 = geom.MakePointStruct(un,un,zero)
P5 = geom.MakePointStruct(zero,zero,un)
arc = geompy.MakeArc(P0,P1,P2)
e1 = geompy.MakeEdge(P2,P3)
e2 = geompy.MakeEdge(P3,P4)
e3 = geompy.MakeEdge(P4,P0)
list = []
list.append(arc._get_Name())
list.append(e1._get_Name())
list.append(e2._get_Name())
list.append(e3._get_Name())
wire = geompy.MakeWire(list)
face = geompy.MakeFace(wire,1)
dir = geompy.MakeVector(Orig,P5)
vol1 = geompy.MakePipe(dir,face)
angle = math.pi/2.
dir = geom.MakeAxisStruct(zero,zero,zero,zero,zero,un)
vol2 = geompy.MakeRotation(vol1,dir,angle)
vol3 = geompy.MakeRotation(vol2,dir,angle)
vol4 = geompy.MakeRotation(vol3,dir,angle)
list = []
list.append(vol1._get_Name())
list.append(vol2._get_Name())
list.append(vol3._get_Name())
list.append(vol4._get_Name())
volComp = geompy.MakeCompound(list)
tol3d = 1.e-3
vol = geom.MakeGlueFaces(volComp,tol3d)
idVol = geompy.addToStudy(vol,"volume")
print "Analysis of the final volume:"
subShellList=geompy.SubShapeAllSorted(vol,ShapeTypeShell)
subFaceList=geompy.SubShapeAllSorted(vol,ShapeTypeFace)
subEdgeList=geompy.SubShapeAllSorted(vol,ShapeTypeEdge)
print "number of Shells in the volume : ",len(subShellList)
print "number of Faces in the volume : ",len(subFaceList)
print "number of Edges in the volume : ",len(subEdgeList)
idSubEdge = []
for k in range(len(subEdgeList)):
idSubEdge.append(geompy.addToStudyInFather(vol,subEdgeList[k],"SubEdge"+str(k)))
edgeZ = []
edgeZ.append(subEdgeList[0])
edgeZ.append(subEdgeList[3])
edgeZ.append(subEdgeList[10])
edgeZ.append(subEdgeList[11])
edgeZ.append(subEdgeList[20])
edgeZ.append(subEdgeList[21])
edgeZ.append(subEdgeList[28])
edgeZ.append(subEdgeList[31])
idEdgeZ = []
for i in range(8):
idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1)))
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments the global one"
numberOfSegments = 10
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- NumberOfSegments in the Z direction"
numberOfSegmentsZ = 40
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSegZ=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegZ.SetNumberOfSegments(numberOfSegmentsZ)
hypNbSegZID = hypNbSegZ.GetId()
print hypNbSegZ.GetName()
print hypNbSegZID
print hypNbSegZ.GetNumberOfSegments()
idsegZ = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegZ) )
smeshgui.SetName(idsegZ, "NumberOfSegmentsZ")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- Quadrangle_2D"
hypothesis=gen.CreateHypothesis("Quadrangle_2D")
quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
smeshgui.SetName(quadID, "Quadrangle_2D")
print "-------------------------- Hexa_3D"
hypothesis=gen.CreateHypothesis("Hexa_3D")
hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
smeshgui.SetName(hexaID, "Hexa_3D")
# ---- init a Mesh with the volume
mesh=gen.Init(idVol)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "meshVolume")
smeshgui.SetShape(idVol, idmesh)
# ---- add hypothesis to the volume
print "-------------------------- add hypothesis to the volume"
ret=mesh.AddHypothesis(vol,regular1D)
print ret
ret=mesh.AddHypothesis(vol,hypNbSeg)
print ret
ret=mesh.AddHypothesis(vol,quad2D)
print ret
ret=mesh.AddHypothesis(vol,hexa3D)
print ret
print "-------------------------- set algoritms"
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, quadID )
smeshgui.SetAlgorithms( idmesh, hexaID )
for i in range(8):
print "-------------------------- add hypothesis to edge in the Z directions", (i+1)
subMeshEdgeZ = mesh.GetElementsOnShape(edgeZ[i])
retZ = mesh.AddHypothesis(edgeZ[i],hypNbSegZ)
print " add hyp Z ", retZ
idsmZ = smeshgui.AddSubMeshOnShape(
idmesh,idEdgeZ[i],salome.orb.object_to_string(subMeshEdgeZ),
ShapeTypeEdge)
smeshgui.SetName(idsmZ, "SubMeshEdgeZ_"+str(i+1))
smeshgui.SetHypothesis(idsmZ, idsegZ)
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the volume"
ret=gen.Compute(mesh,idVol)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when Computing the mesh"
sg.updateObjBrowser(1)

View File

@ -1,176 +0,0 @@
#
# Tetrahedrization of a geometry (box minus a inner cylinder).
# Hypothesis and algorithms for the mesh generation are global
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define a boxe and a cylinder
x0 = -1.
y0 = -1.
z0 = -1.
x1 = 1.
y1 = 1.
z1 = 1.
P0 = geom.MakePointStruct(0.,-1.,0.)
P1 = geom.MakePointStruct(0.,1.,0.)
Vect = geom.MakeDirection(P1)
radius = 0.5
height = 2.
boxe = geompy.MakeBox(x0,y0,z0,x1,y1,z1)
cylinder = geompy.MakeCylinder(P0,Vect,radius,height)
shape = geompy.MakeBoolean(boxe,cylinder,2)
idshape = geompy.addToStudy(shape,"shape")
print ""
print "Analysis of the shape :"
subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
print "number of Shells in the shape : ",len(subShellList)
print "number of Faces in the shape : ",len(subFaceList)
print "number of Edges in the shape : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- LengthFromEdges"
hypothesis=gen.CreateHypothesis("LengthFromEdges")
hypLengthFromEdge=hypothesis._narrow(SMESH.SMESH_LengthFromEdges)
hypLengthFromEdgeID = hypLengthFromEdge.GetId()
print hypLengthFromEdge.GetName()
print hypLengthFromEdgeID
idlenfromedge = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLengthFromEdge) )
smeshgui.SetName(idlenfromedge, "LengthFromEdge")
print "-------------------------- MaxElementVolume"
maxElementVolume = 0.5
hypothesis=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hypothesis._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the shell
mesh=gen.Init(idshape)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshShape")
smeshgui.SetShape(idshape, idmesh)
# ---- add hypothesis to flight
print "-------------------------- add hypothesis to the shape"
ret=mesh.AddHypothesis(shape,regular1D)
print ret
ret=mesh.AddHypothesis(shape,hypNbSeg)
print ret
ret=mesh.AddHypothesis(shape,mefisto2D)
print ret
ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
print ret
ret=mesh.AddHypothesis(shape,netgen3D)
print ret
ret=mesh.AddHypothesis(shape,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idlenfromedge)
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the shape"
ret=gen.Compute(mesh,idshape)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "probleme when computing the mesh"
sg.updateObjBrowser(1)

View File

@ -1,243 +0,0 @@
#
# Tetrahedrization of a geometry (box minus a inner cylinder).
# Hypothesis and algorithms for the mesh generation are not
# global: the mesh of some edges is thinner.
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define a boxe and a cylinder
x0 = -1.
y0 = -1.
z0 = -1.
x1 = 1.
y1 = 1.
z1 = 1.
P0 = geom.MakePointStruct(0.,-1.,0.)
P1 = geom.MakePointStruct(0.,1.,0.)
Vect = geom.MakeDirection(P1)
radius = 0.5
height = 2.
boxe = geompy.MakeBox(x0,y0,z0,x1,y1,z1)
cylinder = geompy.MakeCylinder(P0,Vect,radius,height)
shape = geompy.MakeBoolean(boxe,cylinder,2)
idshape = geompy.addToStudy(shape,"shape")
print "Analysis of the shape :"
subShellList=geompy.SubShapeAllSorted(shape,ShapeTypeShell)
subFaceList=geompy.SubShapeAllSorted(shape,ShapeTypeFace)
subEdgeList=geompy.SubShapeAllSorted(shape,ShapeTypeEdge)
print "number of Shells in the shape : ",len(subShellList)
print "number of Faces in the shape : ",len(subFaceList)
print "number of Edges in the shape : ",len(subEdgeList)
idSubEdge = []
for k in range(len(subEdgeList)):
idSubEdge.append(geompy.addToStudyInFather(shape,subEdgeList[k],"SubEdge"+str(k)))
circle1 = subEdgeList[5]
idCircle1 = geompy.addToStudyInFather(shape,circle1,"circle1")
circle2 = subEdgeList[9]
idCircle2 = geompy.addToStudyInFather(shape,circle2,"circle2")
height = subEdgeList[7]
idHeight = geompy.addToStudyInFather(shape,height,"height")
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments Edge of the boxe"
numberOfSegmentsBoxe = 10
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSegBoxe=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegBoxe.SetNumberOfSegments(numberOfSegmentsBoxe)
hypNbSegID = hypNbSegBoxe.GetId()
print hypNbSegBoxe.GetName()
print hypNbSegID
print hypNbSegBoxe.GetNumberOfSegments()
idSegBoxe = smeshgui.AddNewHypothesis(salome.orb.object_to_string(hypNbSegBoxe))
smeshgui.SetName(idSegBoxe, "NumberOfSegmentsBoxe")
print "-------------------------- NumberOfSegments Edge of the cylinder"
numberOfSegmentsCylinder = 40
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSegCylinder=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSegCylinder.SetNumberOfSegments(numberOfSegmentsCylinder)
hypNbSegID = hypNbSegCylinder.GetId()
print hypNbSegCylinder.GetName()
print hypNbSegID
print hypNbSegCylinder.GetNumberOfSegments()
idSegCylinder = smeshgui.AddNewHypothesis(salome.orb.object_to_string(hypNbSegCylinder))
smeshgui.SetName(idSegCylinder, "NumberOfSegmentsCylinder")
print "-------------------------- LengthFromEdges"
hypothesis=gen.CreateHypothesis("LengthFromEdges")
hypLengthFromEdge=hypothesis._narrow(SMESH.SMESH_LengthFromEdges)
hypLengthFromEdgeID = hypLengthFromEdge.GetId()
print hypLengthFromEdge.GetName()
print hypLengthFromEdgeID
idlenfromedge = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLengthFromEdge) )
smeshgui.SetName(idlenfromedge, "LengthFromEdge")
print "-------------------------- MaxElementVolume"
maxElementVolume = 0.5
hypothesis=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hypothesis._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the shell
mesh=gen.Init(idshape)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshShape")
smeshgui.SetShape(idshape, idmesh)
# ---- add hypothesis to flight
print "-------------------------- add hypothesis to the shape"
ret=mesh.AddHypothesis(shape,regular1D)
print ret
ret=mesh.AddHypothesis(shape,hypNbSegBoxe)
print ret
ret=mesh.AddHypothesis(shape,mefisto2D)
print ret
ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
print ret
ret=mesh.AddHypothesis(shape,netgen3D)
print ret
ret=mesh.AddHypothesis(shape,hypVolume)
print ret
print "-------------------------- set algoritms"
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idSegBoxe )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idlenfromedge)
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
print "-------------------------- add hypothesis to the first circle"
subMeshEdgeCircle1 = mesh.GetElementsOnShape(circle1)
retCircle1 = mesh.AddHypothesis(circle1,hypNbSegCylinder)
print " add hyp to C1 ", retCircle1
idsmCircle1 = smeshgui.AddSubMeshOnShape(
idmesh,idCircle1,salome.orb.object_to_string(subMeshEdgeCircle1),
ShapeTypeEdge)
smeshgui.SetName(idsmCircle1, "SubMeshEdgeCircle1")
smeshgui.SetHypothesis(idsmCircle1, idSegCylinder)
print "-------------------------- add hypothesis to the second circle"
subMeshEdgeCircle2 = mesh.GetElementsOnShape(circle2)
retCircle2 = mesh.AddHypothesis(circle2,hypNbSegCylinder)
print " add hyp to C2 ", retCircle2
idsmCircle2 = smeshgui.AddSubMeshOnShape(
idmesh,idCircle2,salome.orb.object_to_string(subMeshEdgeCircle2),
ShapeTypeEdge)
smeshgui.SetName(idsmCircle2, "SubMeshEdgeCircle2")
smeshgui.SetHypothesis(idsmCircle2, idSegCylinder)
print "-------------------------- add hypothesis to the height of the cylinder"
subMeshEdgeHeight = mesh.GetElementsOnShape(height)
retHeight = mesh.AddHypothesis(height,hypNbSegCylinder)
print " add hyp to H ", retHeight
idsmHeight = smeshgui.AddSubMeshOnShape(
idmesh,idHeight,salome.orb.object_to_string(subMeshEdgeHeight),
ShapeTypeEdge)
smeshgui.SetName(idsmHeight, "SubMeshEdgeHeight")
smeshgui.SetHypothesis(idsmHeight, idSegCylinder)
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the shape"
ret=gen.Compute(mesh,idshape)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "probleme when computing the mesh"
sg.updateObjBrowser(1)

View File

@ -1,79 +0,0 @@
# 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 : SMESH_test1.py
# Module : SMESH
import salome
import SMESH
import SALOMEDS
import CORBA
import os
import os.path
def SetSObjName(theSObj,theName) :
ok, anAttr = theSObj.FindAttribute("AttributeName")
if ok:
aName = anAttr._narrow(SALOMEDS.AttributeName)
#print aName.__dict__
aName.SetValue(theName)
def ConvertMED2UNV(thePath,theFile) :
anInitFileName = thePath + theFile
aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
print aResult, aMeshes
for iMesh in range(len(aMeshes)) :
aMesh = aMeshes[iMesh]
anSObj = salome.ObjectToSObject(aMesh)
print anSObj.GetName(),
aFileName = anInitFileName
aFileName = os.path.basename(aFileName)
SetSObjName(anSObj,aFileName)
print anSObj.GetName()
aFileName = thePath + theFile + "." + str(iMesh) + ".unv"
aMesh.ExportUNV(aFileName)
aMesh = smesh.CreateMeshesFromUNV(aFileName)
anSObj = salome.ObjectToSObject(aMesh)
print anSObj.GetName(),
os.remove(aFileName)
aFileName = os.path.basename(aFileName)
SetSObjName(anSObj,aFileName)
print anSObj.GetName()
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smesh.SetCurrentStudy(salome.myStudy)
aPath = os.getenv('KERNEL_ROOT_DIR') + '/examples/'
aListDir = os.listdir(aPath)
print aListDir
for iFile in range(len(aListDir)) :
aFileName = aListDir[iFile];
aName,anExt = os.path.splitext(aFileName)
if anExt == ".med" :
aFileName = os.path.basename(aFileName)
print aFileName
ConvertMED2UNV(aPath,aFileName)
#break
salome.sg.updateObjBrowser(1);

View File

@ -168,8 +168,15 @@ void StdMeshersGUI_LocalLengthDlg::Init()
char* sHypType = (char*)myHypType.latin1();
HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
//_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
if (aHypData!=0)
{
LineEdit_NameHypothesis->setText(aHypData->Label);
}
else
{
LineEdit_NameHypothesis->setText("");
}
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* signals and slots connections */

View File

@ -169,7 +169,15 @@ void StdMeshersGUI_MaxElementAreaDlg::Init()
char* sHypType = (char*)myHypType.latin1();
HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
//CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
if (aHypData!=0)
{
LineEdit_NameHypothesis->setText(aHypData->Label);
}
else
{
LineEdit_NameHypothesis->setText("");
}
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;

View File

@ -168,7 +168,15 @@ void StdMeshersGUI_MaxElementVolumeDlg::Init()
char* sHypType = (char*)myHypType.latin1();
HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
//_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
if (aHypData!=0)
{
LineEdit_NameHypothesis->setText(aHypData->Label);
}
else
{
LineEdit_NameHypothesis->setText("");
}
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;

View File

@ -168,7 +168,15 @@ void StdMeshersGUI_NbSegmentsDlg::Init()
char* sHypType = (char*)myHypType.latin1();
HypothesisData* aHypData = mySMESHGUI->GetHypothesisData(sHypType);
LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
//_CS_PhB ambiguous overload LineEdit_NameHypothesis->setText( aHypData ? aHypData->Label : "" );
if (aHypData!=0)
{
LineEdit_NameHypothesis->setText(aHypData->Label);
}
else
{
LineEdit_NameHypothesis->setText("");
}
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;