mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
SMH: Preparation version 3.0.0 - merge (HEAD+POLYWORK)
This commit is contained in:
parent
e90b1a5ede
commit
c38c10811a
9
INSTALL
9
INSTALL
@ -1,5 +1,6 @@
|
||||
This is the version 2.2.0 of SMESH
|
||||
This is the version 3.0.0 of SMESH
|
||||
Compatible with :
|
||||
- KERNEL 2.2.0
|
||||
- GEOM 2.2.0
|
||||
- MED 2.2.0
|
||||
- KERNEL 3.0.0
|
||||
- GUI 3.0.0
|
||||
- GEOM 3.0.0
|
||||
- MED 3.0.0
|
||||
|
@ -53,6 +53,8 @@ mesh_line.png \
|
||||
mesh_move_node.png \
|
||||
mesh_orientation.png \
|
||||
mesh.png \
|
||||
mesh_polygon.png \
|
||||
mesh_polyhedron.png \
|
||||
mesh_pyramid_n.png \
|
||||
mesh_pyramid.png \
|
||||
mesh_quad_n.png \
|
||||
|
@ -67,7 +67,7 @@ QT_MT_LIBS = @QT_MT_LIBS@
|
||||
|
||||
MOC = @MOC@
|
||||
UIC = @UIC@
|
||||
|
||||
MSG2QM = @MSG2QM@
|
||||
|
||||
#QWT
|
||||
|
||||
|
@ -327,11 +327,7 @@ distclean: clean
|
||||
$(SWIG) $(SWIG_FLAGS) -o $@ $<
|
||||
|
||||
$(top_builddir)/share/salome/resources/%.qm: %.po
|
||||
if test -e ${KERNEL_ROOT_DIR}/bin/salome/msg2qm ; then \
|
||||
${KERNEL_ROOT_DIR}/bin/salome/msg2qm $< $@ ; \
|
||||
else \
|
||||
$(top_builddir)/bin/salome/msg2qm $< $@ ; \
|
||||
fi
|
||||
$(MSG2QM) $< $@ ; \
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# The following section of this makefile contains dependencies between the
|
||||
|
@ -1,2 +1,2 @@
|
||||
THIS IS SALOME - SMESH VERSION: 2.2.0
|
||||
THIS IS SALOME - SMESH VERSION: 3.0.0
|
||||
|
||||
|
@ -217,6 +217,14 @@ echo
|
||||
|
||||
CHECK_QT
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing MSG2QM
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_MSG2QM
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing VTK
|
||||
|
@ -278,7 +278,7 @@ module SMESH
|
||||
/*!
|
||||
* Filter
|
||||
*/
|
||||
interface Filter: SALOME::GenericObj
|
||||
interface Filter: SALOME::GenericObj, SMESH_IDSource
|
||||
{
|
||||
/*!
|
||||
* Structure containing information about one criterion
|
||||
@ -312,6 +312,8 @@ module SMESH
|
||||
typedef sequence<Criterion> Criteria;
|
||||
|
||||
void SetPredicate( in Predicate thePredicate );
|
||||
void SetMesh( in SMESH_Mesh theMesh );
|
||||
|
||||
long_array GetElementsId( in SMESH_Mesh theMesh );
|
||||
ElementType GetElementType();
|
||||
Predicate GetPredicate();
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
module SMESH
|
||||
{
|
||||
interface Predicate;
|
||||
|
||||
/*!
|
||||
* SMESH_Group: base interface of group object
|
||||
*/
|
||||
@ -98,11 +100,13 @@ module SMESH
|
||||
* Adds elements to the group
|
||||
*/
|
||||
long Add( in long_array elem_ids );
|
||||
long AddByPredicate( in Predicate thePredicate );
|
||||
|
||||
/*!
|
||||
* Removes elements from the group
|
||||
*/
|
||||
long Remove( in long_array elem_ids );
|
||||
long RemoveByPredicate( in Predicate thePredicate );
|
||||
|
||||
};
|
||||
/*!
|
||||
|
@ -58,14 +58,17 @@ module SMESH
|
||||
ADD_EDGE,
|
||||
ADD_TRIANGLE,
|
||||
ADD_QUADRANGLE,
|
||||
ADD_POLYGON,
|
||||
ADD_TETRAHEDRON,
|
||||
ADD_PYRAMID,
|
||||
ADD_PRISM,
|
||||
ADD_HEXAHEDRON,
|
||||
ADD_POLYHEDRON,
|
||||
REMOVE_NODE,
|
||||
REMOVE_ELEMENT,
|
||||
MOVE_NODE,
|
||||
CHANGE_ELEMENT_NODES,
|
||||
CHANGE_POLYHEDRON_NODES,
|
||||
RENUMBER
|
||||
};
|
||||
|
||||
@ -375,6 +378,9 @@ module SMESH
|
||||
long NbQuadrangles()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
long NbPolygons()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
long NbVolumes()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
@ -390,6 +396,9 @@ module SMESH
|
||||
long NbPrisms()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
long NbPolyhedrons()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
long NbSubMesh()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
@ -461,7 +470,7 @@ module SMESH
|
||||
raises (SALOME::SALOME_Exception);
|
||||
};
|
||||
|
||||
/*
|
||||
/*!
|
||||
* This interface makes modifications on the Mesh - removing elements and nodes etc.
|
||||
*/
|
||||
interface NumericalFunctor;
|
||||
@ -480,6 +489,25 @@ module SMESH
|
||||
|
||||
boolean AddVolume(in long_array IDsOfNodes);
|
||||
|
||||
//boolean AddPolygonalFace (in long_array IdsOfNodes);
|
||||
|
||||
/*!
|
||||
* Create volume of many faces, giving nodes for each face.
|
||||
* \param IdsOfNodes List of node IDs for volume creation face by face.
|
||||
* \param Quantities List of integer values, Quantities[i]
|
||||
* gives quantity of nodes in face number i.
|
||||
*/
|
||||
boolean AddPolyhedralVolume (in long_array IdsOfNodes,
|
||||
in long_array Quantities);
|
||||
|
||||
/*!
|
||||
* Create volume of many faces, giving IDs of existing faces.
|
||||
* \param IdsOfFaces List of face IDs for volume creation.
|
||||
* \note The created volume will refer only to nodes
|
||||
* of the given faces, not to the faces itself.
|
||||
*/
|
||||
boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
|
||||
|
||||
boolean MoveNode(in long NodeID, in double x, in double y, in double z);
|
||||
|
||||
boolean InverseDiag(in long NodeID1, in long NodeID2);
|
||||
@ -521,6 +549,18 @@ module SMESH
|
||||
in double MaxAspectRatio,
|
||||
in Smooth_Method Method);
|
||||
|
||||
boolean SmoothParametric(in long_array IDsOfElements,
|
||||
in long_array IDsOfFixedNodes,
|
||||
in long MaxNbOfIterations,
|
||||
in double MaxAspectRatio,
|
||||
in Smooth_Method Method);
|
||||
|
||||
boolean SmoothParametricObject(in SMESH_IDSource theObject,
|
||||
in long_array IDsOfFixedNodes,
|
||||
in long MaxNbOfIterations,
|
||||
in double MaxAspectRatio,
|
||||
in Smooth_Method Method);
|
||||
|
||||
void RenumberNodes();
|
||||
|
||||
void RenumberElements();
|
||||
@ -637,7 +677,9 @@ module SMESH
|
||||
in long LastNodeID1,
|
||||
in long FirstNodeID2,
|
||||
in long SecondNodeID2,
|
||||
in long LastNodeID2);
|
||||
in long LastNodeID2,
|
||||
in boolean CreatePolygons,
|
||||
in boolean CreatePolyedrs);
|
||||
|
||||
Sew_Error SewConformFreeBorders (in long FirstNodeID1,
|
||||
in long SecondNodeID1,
|
||||
@ -649,7 +691,9 @@ module SMESH
|
||||
in long SecondNodeIDOnFreeBorder,
|
||||
in long LastNodeIDOnFreeBorder,
|
||||
in long FirstNodeIDOnSide,
|
||||
in long LastNodeIDOnSide);
|
||||
in long LastNodeIDOnSide,
|
||||
in boolean CreatePolygons,
|
||||
in boolean CreatePolyedrs);
|
||||
|
||||
Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
|
||||
in long_array IDsOfSide2Elements,
|
||||
|
@ -103,9 +103,15 @@ module SMESH
|
||||
|
||||
/*!
|
||||
* Create nodes and elements in <theMesh> using nodes
|
||||
* coordinates computed by either of Apply...() methods
|
||||
* coordinates computed by either of Apply...() methods.
|
||||
* If CreatePolygons is TRUE, replace adjacent faces by polygons
|
||||
* to keep mesh conformity.
|
||||
* If CreatePolyedrs is TRUE, replace adjacent volumes by polyedrs
|
||||
* to keep mesh conformity.
|
||||
*/
|
||||
boolean MakeMesh(in SMESH_Mesh theMesh);
|
||||
boolean MakeMesh (in SMESH_Mesh theMesh,
|
||||
in boolean CreatePolygons,
|
||||
in boolean CreatePolyedrs);
|
||||
|
||||
/*!
|
||||
* Return the loaded pattern in the string form to be saved in file
|
||||
|
@ -16,7 +16,7 @@
|
||||
<component-username>Mesh</component-username>
|
||||
<component-type>MESH</component-type>
|
||||
<component-author>NRI</component-author>
|
||||
<component-version>2.2.0</component-version>
|
||||
<component-version>3.0.0</component-version>
|
||||
<component-comment>Mesh component</component-comment>
|
||||
<component-multistudy>1</component-multistudy>
|
||||
<component-icone>ModuleMesh.png</component-icone>
|
||||
|
@ -97,8 +97,10 @@
|
||||
<popup-item item-id="401" pos-id="" label-id="Edge" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4021" pos-id="" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4022" pos-id="" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4023" pos-id="" label-id="Polygon" icon-id="mesh_polygon.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4031" pos-id="" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4032" pos-id="" label-id="Hexahedron" icon-id="mesh_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
<popup-item item-id="4033" pos-id="" label-id="Polyhedron" icon-id="mesh_polyhedron.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
|
||||
</submenu>
|
||||
<endsubmenu />
|
||||
<submenu label-id="Remove" item-id="403" pos-id="">
|
||||
@ -440,8 +442,10 @@
|
||||
<toolbutton-item item-id="401" label-id="Edge" icon-id="mesh_line.png" tooltip-id="Add Edge" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4021" label-id="Triangle" icon-id="mesh_triangle.png" tooltip-id="Add Triangle" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4022" label-id="Quadrangle" icon-id="mesh_quad.png" tooltip-id="Add Quadrangle" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4023" label-id="Polygon" icon-id="mesh_polygon.png" tooltip-id="Add Polygon" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4031" label-id="Tetrahedron" icon-id="mesh_tetra.png" tooltip-id="Add Tetrahedron" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4032" label-id="Hexahedron" icon-id="mesh_hexa.png" tooltip-id="Add Hexahedron" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4033" label-id="Polyhedron" icon-id="mesh_polyhedron.png" tooltip-id="Add Polyhedron" accel-id="" toggle-id="" execute-action=""/>
|
||||
<separatorTB/>
|
||||
<toolbutton-item item-id="4041" label-id="Nodes" icon-id="mesh_rem_node.png" tooltip-id="Remove Nodes" accel-id="" toggle-id="" execute-action=""/>
|
||||
<toolbutton-item item-id="4042" label-id="Elements" icon-id="mesh_rem_element.png" tooltip-id="Remove Elements" accel-id="" toggle-id="" execute-action=""/>
|
||||
|
BIN
resources/mesh_polygon.png
Normal file
BIN
resources/mesh_polygon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
BIN
resources/mesh_polyhedron.png
Normal file
BIN
resources/mesh_polyhedron.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 400 B |
@ -81,7 +81,7 @@ namespace{
|
||||
return aDist;
|
||||
}
|
||||
|
||||
int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
|
||||
int getNbMultiConnection( const SMDS_Mesh* theMesh, const int theId )
|
||||
{
|
||||
if ( theMesh == 0 )
|
||||
return 0;
|
||||
@ -137,7 +137,7 @@ NumericalFunctor::NumericalFunctor():
|
||||
myPrecision = -1;
|
||||
}
|
||||
|
||||
void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
|
||||
void NumericalFunctor::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -213,26 +213,17 @@ double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
|
||||
{
|
||||
double aMin;
|
||||
|
||||
if ( P.size() == 3 )
|
||||
{
|
||||
double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
|
||||
double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
|
||||
double A2 = getAngle( P( 2 ), P( 3 ), P( 1 ) );
|
||||
|
||||
aMin = Min( A0, Min( A1, A2 ) );
|
||||
}
|
||||
else if ( P.size() == 4 )
|
||||
{
|
||||
double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
|
||||
double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
|
||||
double A2 = getAngle( P( 2 ), P( 3 ), P( 4 ) );
|
||||
double A3 = getAngle( P( 3 ), P( 4 ), P( 1 ) );
|
||||
|
||||
aMin = Min( Min( A0, A1 ), Min( A2, A3 ) );
|
||||
}
|
||||
else
|
||||
if (P.size() <3)
|
||||
return 0.;
|
||||
|
||||
aMin = getAngle(P( P.size() ), P( 1 ), P( 2 ));
|
||||
aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 )));
|
||||
|
||||
for (int i=2; i<P.size();i++){
|
||||
double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) );
|
||||
aMin = Min(aMin,A0);
|
||||
}
|
||||
|
||||
return aMin * 180 / PI;
|
||||
}
|
||||
|
||||
@ -354,7 +345,7 @@ namespace{
|
||||
gp_Vec aVec2( P( 3 ) - P( 1 ) );
|
||||
gp_Vec aVec3( P( 4 ) - P( 1 ) );
|
||||
gp_Vec anAreaVec( aVec1 ^ aVec2 );
|
||||
return abs(aVec3 * anAreaVec) / 6.0;
|
||||
return fabs(aVec3 * anAreaVec) / 6.0;
|
||||
}
|
||||
|
||||
inline double getMaxHeight(double theLen[6])
|
||||
@ -638,8 +629,8 @@ double Warping::ComputeA( const gp_XYZ& thePnt1,
|
||||
if ( L < Precision::Confusion())
|
||||
return 0.;
|
||||
|
||||
gp_XYZ GI = ( thePnt2 - thePnt1 ) / 2. - theG;
|
||||
gp_XYZ GJ = ( thePnt3 - thePnt2 ) / 2. - theG;
|
||||
gp_XYZ GI = ( thePnt2 + thePnt1 ) / 2. - theG;
|
||||
gp_XYZ GJ = ( thePnt3 + thePnt2 ) / 2. - theG;
|
||||
gp_XYZ N = GI.Crossed( GJ );
|
||||
|
||||
if ( N.Modulus() < gp::Resolution() )
|
||||
@ -771,12 +762,17 @@ SMDSAbs_ElementType Skew::GetType() const
|
||||
*/
|
||||
double Area::GetValue( const TSequenceOfXYZ& P )
|
||||
{
|
||||
double aArea = 0;
|
||||
if ( P.size() == 3 )
|
||||
return getArea( P( 1 ), P( 2 ), P( 3 ) );
|
||||
else if ( P.size() == 4 )
|
||||
return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
|
||||
else if (P.size() > 3)
|
||||
aArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
|
||||
else
|
||||
return 0;
|
||||
|
||||
for (int i=4; i<=P.size(); i++)
|
||||
aArea += getArea(P(1),P(i-1),P(i));
|
||||
return aArea;
|
||||
}
|
||||
|
||||
double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
|
||||
@ -1034,7 +1030,6 @@ double MultiConnection2D::GetValue( long theElementId )
|
||||
int aResult = 0;
|
||||
|
||||
if (GetPoints(theElementId,P)){
|
||||
double aVal;
|
||||
const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
|
||||
SMDSAbs_ElementType aType = anFaceElem->GetType();
|
||||
|
||||
@ -1116,7 +1111,6 @@ void MultiConnection2D::GetValues(MValues& theValues){
|
||||
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
|
||||
for(; anIter->more(); ){
|
||||
const SMDS_MeshFace* anElem = anIter->next();
|
||||
long anElemId = anElem->GetID();
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
long aNodeId[3];
|
||||
|
||||
@ -1176,7 +1170,7 @@ BadOrientedVolume::BadOrientedVolume()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void BadOrientedVolume::SetMesh( SMDS_Mesh* theMesh )
|
||||
void BadOrientedVolume::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1207,7 +1201,7 @@ FreeBorders::FreeBorders()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void FreeBorders::SetMesh( SMDS_Mesh* theMesh )
|
||||
void FreeBorders::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1232,7 +1226,7 @@ FreeEdges::FreeEdges()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void FreeEdges::SetMesh( SMDS_Mesh* theMesh )
|
||||
void FreeEdges::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1379,7 +1373,7 @@ RangeOfIds::RangeOfIds()
|
||||
// name : SetMesh
|
||||
// Purpose : Set mesh
|
||||
//=======================================================================
|
||||
void RangeOfIds::SetMesh( SMDS_Mesh* theMesh )
|
||||
void RangeOfIds::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
}
|
||||
@ -1581,7 +1575,7 @@ Comparator::Comparator():
|
||||
Comparator::~Comparator()
|
||||
{}
|
||||
|
||||
void Comparator::SetMesh( SMDS_Mesh* theMesh )
|
||||
void Comparator::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myFunctor )
|
||||
myFunctor->SetMesh( theMesh );
|
||||
@ -1666,7 +1660,7 @@ bool LogicalNOT::IsSatisfy( long theId )
|
||||
return myPredicate && !myPredicate->IsSatisfy( theId );
|
||||
}
|
||||
|
||||
void LogicalNOT::SetMesh( SMDS_Mesh* theMesh )
|
||||
void LogicalNOT::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myPredicate )
|
||||
myPredicate->SetMesh( theMesh );
|
||||
@ -1693,7 +1687,7 @@ LogicalBinary::LogicalBinary()
|
||||
LogicalBinary::~LogicalBinary()
|
||||
{}
|
||||
|
||||
void LogicalBinary::SetMesh( SMDS_Mesh* theMesh )
|
||||
void LogicalBinary::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myPredicate1 )
|
||||
myPredicate1->SetMesh( theMesh );
|
||||
@ -1767,11 +1761,10 @@ void Filter::SetPredicate( PredicatePtr thePredicate )
|
||||
myPredicate = thePredicate;
|
||||
}
|
||||
|
||||
|
||||
template<class TElement, class TIterator, class TPredicate>
|
||||
void FillSequence(const TIterator& theIterator,
|
||||
TPredicate& thePredicate,
|
||||
Filter::TIdSequence& theSequence)
|
||||
inline void FillSequence(const TIterator& theIterator,
|
||||
TPredicate& thePredicate,
|
||||
Filter::TIdSequence& theSequence)
|
||||
{
|
||||
if ( theIterator ) {
|
||||
while( theIterator->more() ) {
|
||||
@ -1783,40 +1776,46 @@ void FillSequence(const TIterator& theIterator,
|
||||
}
|
||||
}
|
||||
|
||||
Filter::TIdSequence
|
||||
Filter::GetElementsId( SMDS_Mesh* theMesh )
|
||||
void
|
||||
Filter::
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
PredicatePtr thePredicate,
|
||||
TIdSequence& theSequence )
|
||||
{
|
||||
TIdSequence aSequence;
|
||||
if ( !theMesh || !myPredicate ) return aSequence;
|
||||
theSequence.clear();
|
||||
|
||||
myPredicate->SetMesh( theMesh );
|
||||
if ( !theMesh || !thePredicate )
|
||||
return;
|
||||
|
||||
SMDSAbs_ElementType aType = myPredicate->GetType();
|
||||
thePredicate->SetMesh( theMesh );
|
||||
|
||||
SMDSAbs_ElementType aType = thePredicate->GetType();
|
||||
switch(aType){
|
||||
case SMDSAbs_Node:{
|
||||
FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),myPredicate,aSequence);
|
||||
case SMDSAbs_Node:
|
||||
FillSequence<const SMDS_MeshNode*>(theMesh->nodesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Edge:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Face:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_Volume:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
case SMDSAbs_All:
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),thePredicate,theSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),thePredicate,theSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),thePredicate,theSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Edge:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Face:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_Volume:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
case SMDSAbs_All:{
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->edgesIterator(),myPredicate,aSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->facesIterator(),myPredicate,aSequence);
|
||||
FillSequence<const SMDS_MeshElement*>(theMesh->volumesIterator(),myPredicate,aSequence);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return aSequence;
|
||||
}
|
||||
|
||||
void
|
||||
Filter::GetElementsId( const SMDS_Mesh* theMesh,
|
||||
Filter::TIdSequence& theSequence )
|
||||
{
|
||||
GetElementsId(theMesh,myPredicate,theSequence);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1880,7 +1879,7 @@ ManifoldPart::~ManifoldPart()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void ManifoldPart::SetMesh( SMDS_Mesh* theMesh )
|
||||
void ManifoldPart::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
myMesh = theMesh;
|
||||
process();
|
||||
@ -2209,7 +2208,7 @@ ElementsOnSurface::~ElementsOnSurface()
|
||||
myMesh = 0;
|
||||
}
|
||||
|
||||
void ElementsOnSurface::SetMesh( SMDS_Mesh* theMesh )
|
||||
void ElementsOnSurface::SetMesh( const SMDS_Mesh* theMesh )
|
||||
{
|
||||
if ( myMesh == theMesh )
|
||||
return;
|
||||
|
@ -97,14 +97,14 @@ namespace SMESH{
|
||||
{
|
||||
public:
|
||||
~Functor(){}
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
};
|
||||
|
||||
class NumericalFunctor: public virtual Functor{
|
||||
public:
|
||||
NumericalFunctor();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual double GetValue( long theElementId );
|
||||
virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
@ -117,7 +117,7 @@ namespace SMESH{
|
||||
static bool GetPoints(const SMDS_MeshElement* theElem,
|
||||
TSequenceOfXYZ& theRes);
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
long myPrecision;
|
||||
};
|
||||
|
||||
@ -295,12 +295,12 @@ namespace SMESH{
|
||||
class FreeBorders: public virtual Predicate{
|
||||
public:
|
||||
FreeBorders();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
@ -311,12 +311,12 @@ namespace SMESH{
|
||||
class BadOrientedVolume: public virtual Predicate{
|
||||
public:
|
||||
BadOrientedVolume();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
@ -327,7 +327,7 @@ namespace SMESH{
|
||||
class FreeEdges: public virtual Predicate{
|
||||
public:
|
||||
FreeEdges();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
|
||||
@ -342,7 +342,7 @@ namespace SMESH{
|
||||
void GetBoreders(TBorders& theBorders);
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
|
||||
|
||||
@ -359,7 +359,7 @@ namespace SMESH{
|
||||
{
|
||||
public:
|
||||
RangeOfIds();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theNodeId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
virtual void SetType( SMDSAbs_ElementType theType );
|
||||
@ -369,7 +369,7 @@ namespace SMESH{
|
||||
bool SetRangeStr( const TCollection_AsciiString& );
|
||||
|
||||
protected:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
|
||||
TColStd_SequenceOfInteger myMin;
|
||||
TColStd_SequenceOfInteger myMax;
|
||||
@ -389,7 +389,7 @@ namespace SMESH{
|
||||
public:
|
||||
Comparator();
|
||||
virtual ~Comparator();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetMargin(double theValue);
|
||||
virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
|
||||
virtual bool IsSatisfy( long theElementId ) = 0;
|
||||
@ -449,7 +449,7 @@ namespace SMESH{
|
||||
LogicalNOT();
|
||||
virtual ~LogicalNOT();
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetPredicate(PredicatePtr thePred);
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
@ -467,7 +467,7 @@ namespace SMESH{
|
||||
public:
|
||||
LogicalBinary();
|
||||
virtual ~LogicalBinary();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual void SetPredicate1(PredicatePtr thePred);
|
||||
virtual void SetPredicate2(PredicatePtr thePred);
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
@ -532,7 +532,7 @@ namespace SMESH{
|
||||
|
||||
ManifoldPart();
|
||||
~ManifoldPart();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
// inoke when all parameters already set
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
@ -560,7 +560,7 @@ namespace SMESH{
|
||||
TVectorOfFacePtr& theFaces ) const;
|
||||
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
TColStd_MapOfInteger myMapIds;
|
||||
TColStd_MapOfInteger myMapBadGeomIds;
|
||||
TVectorOfFacePtr myAllFacePtr;
|
||||
@ -582,7 +582,7 @@ namespace SMESH{
|
||||
public:
|
||||
ElementsOnSurface();
|
||||
~ElementsOnSurface();
|
||||
virtual void SetMesh( SMDS_Mesh* theMesh );
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
|
||||
@ -597,7 +597,7 @@ namespace SMESH{
|
||||
bool isOnSurface( const SMDS_MeshNode* theNode ) const;
|
||||
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
TColStd_MapOfInteger myIds;
|
||||
SMDSAbs_ElementType myType;
|
||||
Handle(Geom_Surface) mySurf;
|
||||
@ -615,8 +615,19 @@ namespace SMESH{
|
||||
Filter();
|
||||
virtual ~Filter();
|
||||
virtual void SetPredicate(PredicatePtr thePred);
|
||||
|
||||
typedef std::vector<long> TIdSequence;
|
||||
virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
|
||||
|
||||
virtual
|
||||
void
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
TIdSequence& theSequence );
|
||||
|
||||
static
|
||||
void
|
||||
GetElementsId( const SMDS_Mesh* theMesh,
|
||||
PredicatePtr thePredicate,
|
||||
TIdSequence& theSequence );
|
||||
|
||||
protected:
|
||||
PredicatePtr myPredicate;
|
||||
|
@ -268,7 +268,175 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
|
||||
MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
|
||||
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
|
||||
const EGeometrieElement& aGeom = anTGeomIter->first;
|
||||
if(aGeom == ePOINT1) continue;
|
||||
|
||||
if (aGeom == ePOINT1) {
|
||||
continue;
|
||||
|
||||
} else if (aGeom == ePOLYGONE) {
|
||||
PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
|
||||
EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX;
|
||||
|
||||
TElemNum aConn = aPolygoneInfo->GetConnectivite();
|
||||
TElemNum aIndex = aPolygoneInfo->GetIndex();
|
||||
|
||||
TInt nbPolygons = aPolygoneInfo->GetNbElem();
|
||||
|
||||
for (TInt iPG = 0; iPG < nbPolygons; iPG++) {
|
||||
// get nodes
|
||||
TInt aCurrPG_FirstNodeIndex = aIndex[iPG] - 1;
|
||||
int nbNodes = aPolygoneInfo->GetNbConn(iPG);
|
||||
std::vector<int> nodes_ids (nbNodes);
|
||||
//for (TInt inode = 0; inode < nbNodes; inode++) {
|
||||
// nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
|
||||
//}
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
if (anIsNodeNum) {
|
||||
for (TInt inode = 0; inode < nbNodes; inode++) {
|
||||
nodes_ids[inode] = aNodeInfo->GetElemNum(aConn[aCurrPG_FirstNodeIndex + inode] - 1);
|
||||
}
|
||||
} else {
|
||||
for (TInt inode = 0; inode < nbNodes; inode++) {
|
||||
nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (TInt inode = 0; inode < nbNodes; inode++) {
|
||||
nodes_ids[inode] = aConn[aCurrPG_FirstNodeIndex + inode];
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isRenum = false;
|
||||
SMDS_MeshElement* anElement = NULL;
|
||||
TInt aFamNum = aPolygoneInfo->GetFamNum(iPG);
|
||||
|
||||
try {
|
||||
if (anIsElemNum) {
|
||||
anElement = myMesh->AddPolygonalFaceWithID
|
||||
(nodes_ids, aPolygoneInfo->GetElemNum(iPG));
|
||||
}
|
||||
if (!anElement) {
|
||||
std::vector<const SMDS_MeshNode*> nodes (nbNodes);
|
||||
for (int inode = 0; inode < nbNodes; inode++) {
|
||||
nodes[inode] = FindNode(myMesh, nodes_ids[inode]);
|
||||
}
|
||||
anElement = myMesh->AddPolygonalFace(nodes);
|
||||
isRenum = anIsElemNum;
|
||||
}
|
||||
} catch (const std::exception& exc) {
|
||||
aResult = DRS_FAIL;
|
||||
} catch (...) {
|
||||
aResult = DRS_FAIL;
|
||||
}
|
||||
|
||||
if (!anElement) {
|
||||
aResult = DRS_WARN_SKIP_ELEM;
|
||||
} else {
|
||||
if (isRenum) {
|
||||
anIsElemNum = eFAUX;
|
||||
takeNumbers = false;
|
||||
if (aResult < DRS_WARN_RENUMBER)
|
||||
aResult = DRS_WARN_RENUMBER;
|
||||
}
|
||||
if (myFamilies.find(aFamNum) != myFamilies.end()) {
|
||||
// Save reference to this element from its family
|
||||
myFamilies[aFamNum]->AddElement(anElement);
|
||||
myFamilies[aFamNum]->SetType(anElement->GetType());
|
||||
}
|
||||
}
|
||||
} // for (TInt iPG = 0; iPG < nbPolygons; iPG++)
|
||||
continue;
|
||||
|
||||
} else if (aGeom == ePOLYEDRE) {
|
||||
PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
|
||||
EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX;
|
||||
|
||||
TElemNum aConn = aPolyedreInfo->GetConnectivite();
|
||||
TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
|
||||
TElemNum aIndex = aPolyedreInfo->GetIndex();
|
||||
|
||||
TInt nbPolyedres = aPolyedreInfo->GetNbElem();
|
||||
|
||||
for (int iPE = 0; iPE < nbPolyedres; iPE++) {
|
||||
// get faces
|
||||
int aCurrPE_FirstFaceIndex = aIndex[iPE] - 1;
|
||||
int aNextPE_FirstFaceIndex = aIndex[iPE + 1] - 1;
|
||||
int nbFaces = aNextPE_FirstFaceIndex - aCurrPE_FirstFaceIndex;
|
||||
std::vector<int> quantities (nbFaces);
|
||||
for (int iFa = 0; iFa < nbFaces; iFa++) {
|
||||
int aCurrFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa] - 1;
|
||||
int aNextFace_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex + iFa + 1] - 1;
|
||||
|
||||
int nbNodes = aNextFace_FirstNodeIndex - aCurrFace_FirstNodeIndex;
|
||||
quantities[iFa] = nbNodes;
|
||||
}
|
||||
|
||||
// get nodes
|
||||
int aCurrPE_FirstNodeIndex = aFacesIndex[aCurrPE_FirstFaceIndex] - 1;
|
||||
int nbPENodes = aPolyedreInfo->GetNbConn(iPE);
|
||||
std::vector<int> nodes_ids (nbPENodes);
|
||||
//for (int inode = 0; inode < nbPENodes; inode++) {
|
||||
// nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
|
||||
//}
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
if (anIsNodeNum) {
|
||||
for (int inode = 0; inode < nbPENodes; inode++) {
|
||||
nodes_ids[inode] = aNodeInfo->GetElemNum(aConn[aCurrPE_FirstNodeIndex + inode] - 1);
|
||||
}
|
||||
} else {
|
||||
for (int inode = 0; inode < nbPENodes; inode++) {
|
||||
nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int inode = 0; inode < nbPENodes; inode++) {
|
||||
nodes_ids[inode] = aConn[aCurrPE_FirstNodeIndex + inode];
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isRenum = false;
|
||||
SMDS_MeshElement* anElement = NULL;
|
||||
TInt aFamNum = aPolyedreInfo->GetFamNum(iPE);
|
||||
|
||||
try {
|
||||
if (anIsElemNum) {
|
||||
anElement = myMesh->AddPolyhedralVolumeWithID
|
||||
(nodes_ids, quantities, aPolyedreInfo->GetElemNum(iPE));
|
||||
}
|
||||
if (!anElement) {
|
||||
std::vector<const SMDS_MeshNode*> nodes (nbPENodes);
|
||||
for (int inode = 0; inode < nbPENodes; inode++) {
|
||||
nodes[inode] = FindNode(myMesh, nodes_ids[inode]);
|
||||
}
|
||||
anElement = myMesh->AddPolyhedralVolume(nodes, quantities);
|
||||
isRenum = anIsElemNum;
|
||||
}
|
||||
} catch (const std::exception& exc) {
|
||||
aResult = DRS_FAIL;
|
||||
} catch (...) {
|
||||
aResult = DRS_FAIL;
|
||||
}
|
||||
|
||||
if (!anElement) {
|
||||
aResult = DRS_WARN_SKIP_ELEM;
|
||||
} else {
|
||||
if (isRenum) {
|
||||
anIsElemNum = eFAUX;
|
||||
takeNumbers = false;
|
||||
if (aResult < DRS_WARN_RENUMBER)
|
||||
aResult = DRS_WARN_RENUMBER;
|
||||
}
|
||||
if (myFamilies.find(aFamNum) != myFamilies.end()) {
|
||||
// Save reference to this element from its family
|
||||
myFamilies[aFamNum]->AddElement(anElement);
|
||||
myFamilies[aFamNum]->SetType(anElement->GetType());
|
||||
}
|
||||
}
|
||||
} // for (int iPE = 0; iPE < nbPolyedres; iPE++)
|
||||
continue;
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
|
||||
EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
|
||||
TInt aNbElems = aCellInfo->GetNbElem();
|
||||
@ -343,6 +511,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
|
||||
SMDS_MeshElement* anElement = NULL;
|
||||
TInt aFamNum = aCellInfo->GetFamNum(iElem);
|
||||
try{
|
||||
//MESSAGE("Try to create element # " << iElem << " with id = "
|
||||
// << aCellInfo->GetElemNum(iElem));
|
||||
switch(aGeom){
|
||||
case eSEG2:
|
||||
case eSEG3:
|
||||
@ -586,7 +756,7 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
|
||||
for (; anElemsIter != anElements.end(); anElemsIter++)
|
||||
{
|
||||
element = *anElemsIter;
|
||||
theGroup->SMDSGroup().Add(element);
|
||||
theGroup->SMDSGroup().Add(element);
|
||||
}
|
||||
if ( element )
|
||||
theGroup->SetType( element->GetType() );
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "MED_Utilities.hxx"
|
||||
@ -61,7 +63,7 @@ void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName,
|
||||
|
||||
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
|
||||
{
|
||||
return SetFile(theFileName,MED::eV2_1);
|
||||
return SetFile(theFileName,MED::eV2_2);
|
||||
}
|
||||
|
||||
void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
|
||||
@ -440,6 +442,16 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
MED::TIntVector aQuadConn;
|
||||
aQuadConn.reserve(aNbElems*aNbQuadConn);
|
||||
|
||||
MED::TIntVector aPolygoneElemNums;
|
||||
aPolygoneElemNums.reserve(aNbElems);
|
||||
MED::TIntVector aPolygoneInds;
|
||||
aPolygoneInds.reserve(aNbElems + 1);
|
||||
aPolygoneInds.push_back(1); // reference on the first element in the connectivities
|
||||
MED::TIntVector aPolygoneFamilyNums;
|
||||
aPolygoneFamilyNums.reserve(aNbElems);
|
||||
MED::TIntVector aPolygoneConn;
|
||||
aPolygoneConn.reserve(aNbElems*aNbQuadConn);
|
||||
|
||||
for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
|
||||
const SMDS_MeshFace* anElem = anIter->next();
|
||||
TInt aNbNodes = anElem->NbNodes();
|
||||
@ -448,41 +460,42 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
MED::TIntVector* anElemNums;
|
||||
MED::TIntVector* aFamilyNums;
|
||||
MED::TIntVector* aConnectivity;
|
||||
switch(aNbNodes){
|
||||
case 3:
|
||||
aNbConnectivity = aNbTriaConn;
|
||||
anElemNums = &anTriaElemNums;
|
||||
aFamilyNums = &aTriaFamilyNums;
|
||||
aConnectivity = &aTriaConn;
|
||||
break;
|
||||
case 4:
|
||||
aNbConnectivity = aNbQuadConn;
|
||||
anElemNums = &aQuadElemNums;
|
||||
aFamilyNums = &aQuadFamilyNums;
|
||||
aConnectivity = &aQuadConn;
|
||||
break;
|
||||
}
|
||||
if (anElem->IsPoly()) {
|
||||
aNbConnectivity = aNbNodes;
|
||||
anElemNums = &aPolygoneElemNums;
|
||||
aFamilyNums = &aPolygoneFamilyNums;
|
||||
aConnectivity = &aPolygoneConn;
|
||||
} else {
|
||||
switch(aNbNodes){
|
||||
case 3:
|
||||
aNbConnectivity = aNbTriaConn;
|
||||
anElemNums = &anTriaElemNums;
|
||||
aFamilyNums = &aTriaFamilyNums;
|
||||
aConnectivity = &aTriaConn;
|
||||
break;
|
||||
case 4:
|
||||
aNbConnectivity = aNbQuadConn;
|
||||
anElemNums = &aQuadElemNums;
|
||||
aFamilyNums = &aQuadFamilyNums;
|
||||
aConnectivity = &aQuadConn;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
MED::TIntVector aVector(aNbNodes);
|
||||
for(TInt iNode = 0; aNodesIter->more(); iNode++){
|
||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
aVector[iNode] = aNodeIdMap[aNode->GetID()];
|
||||
#else
|
||||
aVector[iNode] = aNode->GetID();
|
||||
#endif
|
||||
}
|
||||
|
||||
TInt 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]];
|
||||
(*aConnectivity)[aSize+1] = aNodeIdMap[aVector[1]];
|
||||
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];
|
||||
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];
|
||||
default:
|
||||
for(TInt iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
|
||||
}
|
||||
#else
|
||||
// There is some differences between SMDS and MED in cells mapping
|
||||
switch(aNbNodes){
|
||||
case 4:
|
||||
(*aConnectivity)[aSize+0] = aVector[0];
|
||||
@ -493,7 +506,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
for(TInt iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aVector[iNode];
|
||||
}
|
||||
#endif
|
||||
|
||||
if (anElem->IsPoly()) {
|
||||
// fill indices for polygonal element
|
||||
TInt aPrevPos = aPolygoneInds.back();
|
||||
aPolygoneInds.push_back(aPrevPos + aNbNodes);
|
||||
}
|
||||
|
||||
anElemNums->push_back(anElem->GetID());
|
||||
|
||||
if (anElemFamMap.find(anElem) != anElemFamMap.end())
|
||||
@ -523,6 +542,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
|
||||
myMed->SetCellInfo(aCellInfo);
|
||||
}
|
||||
if(TInt aNbElems = aPolygoneElemNums.size()){
|
||||
// add one element in connectivities,
|
||||
// referenced by the last element in indices
|
||||
aPolygoneConn.push_back(0);
|
||||
|
||||
PPolygoneInfo aCellInfo = myMed->CrPolygoneInfo(aMeshInfo,
|
||||
SMDS_MED_ENTITY,
|
||||
ePOLYGONE,
|
||||
SMDS_MED_CONNECTIVITY,
|
||||
aPolygoneConn,
|
||||
aPolygoneInds,
|
||||
aPolygoneFamilyNums,
|
||||
aPolygoneElemNums);
|
||||
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYGONE<<"; aNbElems = "<<aNbElems);
|
||||
myMed->SetPolygoneInfo(aCellInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Storing SMDS Volumes
|
||||
@ -563,74 +598,111 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
MED::TIntVector aHexaConn;
|
||||
aHexaConn.reserve(aNbElems*aNbHexaConn);
|
||||
|
||||
MED::TIntVector aPolyedreElemNums;
|
||||
aPolyedreElemNums.reserve(aNbElems);
|
||||
MED::TIntVector aPolyedreInds;
|
||||
aPolyedreInds.reserve(aNbElems + 1);
|
||||
aPolyedreInds.push_back(1); // reference on the first element in the faces
|
||||
MED::TIntVector aPolyedreFaces;
|
||||
aPolyedreFaces.reserve(aNbElems + 1);
|
||||
aPolyedreFaces.push_back(1); // reference on the first element in the connectivities
|
||||
MED::TIntVector aPolyedreFamilyNums;
|
||||
aPolyedreFamilyNums.reserve(aNbElems);
|
||||
MED::TIntVector aPolyedreConn;
|
||||
aPolyedreConn.reserve(aNbElems*aNbHexaConn);
|
||||
|
||||
for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
|
||||
const SMDS_MeshVolume* anElem = anIter->next();
|
||||
TInt aNbNodes = anElem->NbNodes();
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
TInt aNbConnectivity;
|
||||
MED::TIntVector* anElemNums;
|
||||
MED::TIntVector* aFamilyNums;
|
||||
MED::TIntVector* aConnectivity;
|
||||
switch(aNbNodes){
|
||||
case 4:
|
||||
aNbConnectivity = aNbTetraConn;
|
||||
anElemNums = &anTetraElemNums;
|
||||
aFamilyNums = &aTetraFamilyNums;
|
||||
aConnectivity = &aTetraConn;
|
||||
break;
|
||||
case 5:
|
||||
aNbConnectivity = aNbPyraConn;
|
||||
anElemNums = &anPyraElemNums;
|
||||
aFamilyNums = &aPyraFamilyNums;
|
||||
aConnectivity = &aPyraConn;
|
||||
break;
|
||||
case 6:
|
||||
aNbConnectivity = aNbPentaConn;
|
||||
anElemNums = &anPentaElemNums;
|
||||
aFamilyNums = &aPentaFamilyNums;
|
||||
aConnectivity = &aPentaConn;
|
||||
break;
|
||||
case 8:
|
||||
aNbConnectivity = aNbHexaConn;
|
||||
anElemNums = &aHexaElemNums;
|
||||
aFamilyNums = &aHexaFamilyNums;
|
||||
aConnectivity = &aHexaConn;
|
||||
}
|
||||
|
||||
MED::TIntVector aVector(aNbNodes);
|
||||
for(TInt iNode = 0; aNodesIter->more(); iNode++){
|
||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
||||
aVector[iNode] = aNode->GetID();
|
||||
}
|
||||
TInt aSize = aConnectivity->size();
|
||||
aConnectivity->resize(aSize+aNbConnectivity);
|
||||
// There is some difference between SMDS and MED in cells mapping
|
||||
MED::TIntVector* anElemNums;
|
||||
MED::TIntVector* aFamilyNums;
|
||||
|
||||
if (anElem->IsPoly()) {
|
||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
||||
(const SMDS_PolyhedralVolumeOfNodes*) anElem;
|
||||
if (!aPolyedre) {
|
||||
MESSAGE("Warning: bad volumic element");
|
||||
continue;
|
||||
}
|
||||
|
||||
anElemNums = &aPolyedreElemNums;
|
||||
aFamilyNums = &aPolyedreFamilyNums;
|
||||
|
||||
TInt aNodeId, aNbFaces = aPolyedre->NbFaces();
|
||||
for (int iface = 1; iface <= aNbFaces; iface++) {
|
||||
int aNbFaceNodes = aPolyedre->NbFaceNodes(iface);
|
||||
for (int inode = 1; inode <= aNbFaceNodes; inode++) {
|
||||
aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID();
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
switch(aNbNodes){
|
||||
case 5:
|
||||
(*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
|
||||
(*aConnectivity)[aSize+1] = aNodeIdMap[aVector[3]];
|
||||
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[2]];
|
||||
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];
|
||||
(*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];
|
||||
default:
|
||||
for(TInt iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
|
||||
}
|
||||
aPolyedreConn.push_back(aNodeIdMap[aNodeId]);
|
||||
#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(TInt iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aVector[iNode];
|
||||
}
|
||||
aPolyedreConn.push_back(aNodeId);
|
||||
#endif
|
||||
anElemNums->push_back(anElem->GetID());
|
||||
}
|
||||
TInt aPrevPos = aPolyedreFaces.back();
|
||||
aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes);
|
||||
}
|
||||
TInt aPrevPos = aPolyedreInds.back();
|
||||
aPolyedreInds.push_back(aPrevPos + aNbFaces);
|
||||
|
||||
} else {
|
||||
TInt aNbNodes = anElem->NbNodes();
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
TInt aNbConnectivity;
|
||||
MED::TIntVector* aConnectivity;
|
||||
switch(aNbNodes){
|
||||
case 4:
|
||||
aNbConnectivity = aNbTetraConn;
|
||||
anElemNums = &anTetraElemNums;
|
||||
aFamilyNums = &aTetraFamilyNums;
|
||||
aConnectivity = &aTetraConn;
|
||||
break;
|
||||
case 5:
|
||||
aNbConnectivity = aNbPyraConn;
|
||||
anElemNums = &anPyraElemNums;
|
||||
aFamilyNums = &aPyraFamilyNums;
|
||||
aConnectivity = &aPyraConn;
|
||||
break;
|
||||
case 6:
|
||||
aNbConnectivity = aNbPentaConn;
|
||||
anElemNums = &anPentaElemNums;
|
||||
aFamilyNums = &aPentaFamilyNums;
|
||||
aConnectivity = &aPentaConn;
|
||||
break;
|
||||
case 8:
|
||||
aNbConnectivity = aNbHexaConn;
|
||||
anElemNums = &aHexaElemNums;
|
||||
aFamilyNums = &aHexaFamilyNums;
|
||||
aConnectivity = &aHexaConn;
|
||||
}
|
||||
|
||||
TInt aSize = aConnectivity->size();
|
||||
aConnectivity->resize(aSize + aNbConnectivity);
|
||||
|
||||
MED::TIntVector aVector(aNbNodes);
|
||||
for(TInt iNode = 0; aNodesIter->more(); iNode++){
|
||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
aVector[iNode] = aNodeIdMap[aNode->GetID()];
|
||||
#else
|
||||
aVector[iNode] = aNode->GetID();
|
||||
#endif
|
||||
}
|
||||
// There is some difference between SMDS and MED in cells mapping
|
||||
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(TInt iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aVector[iNode];
|
||||
}
|
||||
}
|
||||
|
||||
anElemNums->push_back(anElem->GetID());
|
||||
|
||||
if (anElemFamMap.find(anElem) != anElemFamMap.end())
|
||||
aFamilyNums->push_back(anElemFamMap[anElem]);
|
||||
@ -682,6 +754,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
|
||||
myMed->SetCellInfo(aCellInfo);
|
||||
}
|
||||
if(TInt aNbElems = aPolyedreElemNums.size()){
|
||||
// add one element in connectivities,
|
||||
// referenced by the last element in faces
|
||||
aPolyedreConn.push_back(0);
|
||||
|
||||
PPolyedreInfo aCellInfo = myMed->CrPolyedreInfo(aMeshInfo,
|
||||
SMDS_MED_ENTITY,
|
||||
ePOLYEDRE,
|
||||
SMDS_MED_CONNECTIVITY,
|
||||
aPolyedreConn,
|
||||
aPolyedreFaces,
|
||||
aPolyedreInds,
|
||||
aPolyedreFamilyNums,
|
||||
aPolyedreElemNums);
|
||||
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYEDRE<<"; aNbElems = "<<aNbElems);
|
||||
myMed->SetPolyedreInfo(aCellInfo);
|
||||
}
|
||||
}
|
||||
}catch(const std::exception& exc){
|
||||
INFOS("Follow exception was cought:\n\t"<<exc.what());
|
||||
|
@ -18,40 +18,13 @@
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "DriverSTL_R_SMDS_Mesh.h"
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FromWhere.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_SingleProtection.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Standard_NoMoreObject.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
static const int HEADER_SIZE = 84;
|
||||
static const int SIZEOF_STL_FACET = 50;
|
||||
//static const int STL_MIN_FILE_SIZE = 284;
|
||||
static const int ASCII_LINES_PER_FACET = 7;
|
||||
|
||||
static Standard_Real tab1[3];
|
||||
static Standard_Real tab2[3];
|
||||
|
||||
typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr;
|
||||
//typedef NCollection_BaseCollection<SMDS_MeshNodePtr> DriverSTL_ColOfNodePtr;
|
||||
|
||||
//=======================================================================
|
||||
//function : HashCode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer HashCode
|
||||
(const gp_Pnt& point, const Standard_Integer Upper)
|
||||
(const gp_Pnt& point, Standard_Integer Upper)
|
||||
{
|
||||
union
|
||||
{
|
||||
@ -63,7 +36,8 @@ inline Standard_Integer HashCode
|
||||
|
||||
return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
|
||||
}
|
||||
|
||||
static Standard_Real tab1[3];
|
||||
static Standard_Real tab2[3];
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
@ -75,7 +49,32 @@ inline Standard_Boolean IsEqual
|
||||
point2.Coord(tab2[0],tab2[1],tab2[2]);
|
||||
return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
|
||||
}
|
||||
#include "DriverSTL_R_SMDS_Mesh.h"
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_FromWhere.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <OSD_SingleProtection.hxx>
|
||||
#include <Standard_NoMoreObject.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
static const int HEADER_SIZE = 84;
|
||||
static const int SIZEOF_STL_FACET = 50;
|
||||
//static const int STL_MIN_FILE_SIZE = 284;
|
||||
static const int ASCII_LINES_PER_FACET = 7;
|
||||
|
||||
|
||||
//typedef NCollection_BaseCollection<SMDS_MeshNodePtr> DriverSTL_ColOfNodePtr;
|
||||
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
typedef NCollection_DataMap<gp_Pnt,SMDS_MeshNode*> DriverSTL_DataMapOfPntNodePtr;
|
||||
//=======================================================================
|
||||
//function : DriverSTL_R_SMDS_Mesh
|
||||
//purpose :
|
||||
|
@ -50,9 +50,9 @@ LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
BIN =
|
||||
BIN_SRC =
|
||||
|
||||
CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
|
||||
CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
$(BOOST_CPPFLAGS) $(QT_INCLUDES)
|
||||
LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSMDS \
|
||||
-lSalomeGUI -lSalomeObject -lSMESHControls
|
||||
LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lSMDS \
|
||||
-lSalomeApp -lSalomeObject -lSMESHControls
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "SMESH_ActorUtils.h"
|
||||
#include "SMESH_DeviceActor.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SALOME_ExtractUnstructuredGrid.h"
|
||||
#include <VTKViewer_ExtractUnstructuredGrid.h>
|
||||
|
||||
#include "QAD_Config.h"
|
||||
//#include "QAD_Config.h"
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <vtkTimeStamp.h>
|
||||
@ -73,7 +73,7 @@
|
||||
#include "utilities.h"
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
static int MYDEBUG = 1;
|
||||
#else
|
||||
static int MYDEBUG = 0;
|
||||
#endif
|
||||
@ -118,7 +118,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
float aLineWidth = SMESH::GetFloat("SMESH:SettingsWidth",1);
|
||||
|
||||
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
|
||||
SALOME_ExtractUnstructuredGrid* aFilter = NULL;
|
||||
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
|
||||
|
||||
//Definition 2D and 3D divices of the actor
|
||||
//-----------------------------------------
|
||||
@ -142,7 +142,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
my2DActor->SetBackfaceProperty(myBackSurfaceProp);
|
||||
my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||
aFilter = my2DActor->GetExtractUnstructuredGrid();
|
||||
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
|
||||
aFilter->RegisterCellsWithType(VTK_POLYGON);
|
||||
aFilter->RegisterCellsWithType(VTK_QUAD);
|
||||
@ -154,13 +154,13 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
my3DActor->SetBackfaceProperty(myBackSurfaceProp);
|
||||
my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||
aFilter = my3DActor->GetExtractUnstructuredGrid();
|
||||
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->RegisterCellsWithType(VTK_TETRA);
|
||||
aFilter->RegisterCellsWithType(VTK_VOXEL);
|
||||
aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
|
||||
aFilter->RegisterCellsWithType(VTK_WEDGE);
|
||||
aFilter->RegisterCellsWithType(VTK_PYRAMID);
|
||||
|
||||
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
|
||||
|
||||
//Definition 1D divice of the actor
|
||||
//---------------------------------
|
||||
@ -181,7 +181,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
my1DActor->SetProperty(myEdgeProp);
|
||||
my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||
aFilter = my1DActor->GetExtractUnstructuredGrid();
|
||||
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->RegisterCellsWithType(VTK_LINE);
|
||||
|
||||
my1DProp = vtkProperty::New();
|
||||
@ -206,7 +206,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
my1DExtActor->SetProperty(my1DExtProp);
|
||||
my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
|
||||
aFilter = my1DExtActor->GetExtractUnstructuredGrid();
|
||||
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->RegisterCellsWithType(VTK_LINE);
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
myNodeActor->SetProperty(myNodeProp);
|
||||
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
||||
aFilter = myNodeActor->GetExtractUnstructuredGrid();
|
||||
aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
|
||||
aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
|
||||
|
||||
|
||||
//Definition of Pickable and Highlitable engines
|
||||
@ -288,38 +288,38 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
|
||||
vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
|
||||
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
|
||||
/* if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
|
||||
QStringList aTColor = QStringList::split( ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleColor" ), false );
|
||||
aScalarBarTitleProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
|
||||
( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
|
||||
( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
|
||||
}
|
||||
else
|
||||
else*/
|
||||
aScalarBarTitleProp->SetColor( 1.0, 1.0, 1.0 );
|
||||
|
||||
aScalarBarTitleProp->SetFontFamilyToArial();
|
||||
if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
|
||||
/*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Arial" )
|
||||
aScalarBarTitleProp->SetFontFamilyToArial();
|
||||
else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Courier" )
|
||||
aScalarBarTitleProp->SetFontFamilyToCourier();
|
||||
else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Times" )
|
||||
aScalarBarTitleProp->SetFontFamilyToTimes();
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
|
||||
aScalarBarTitleProp->BoldOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarTitleProp->BoldOff();
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
|
||||
aScalarBarTitleProp->ItalicOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarTitleProp->ItalicOff();
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
|
||||
aScalarBarTitleProp->ShadowOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarTitleProp->ShadowOff();
|
||||
|
||||
myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
|
||||
@ -327,74 +327,74 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
|
||||
vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
|
||||
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
|
||||
/*if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
|
||||
QStringList aTColor = QStringList::split( ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelColor" ), false );
|
||||
aScalarBarLabelProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
|
||||
( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
|
||||
( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
|
||||
}
|
||||
else
|
||||
else*/
|
||||
aScalarBarLabelProp->SetColor( 1.0, 1.0, 1.0 );
|
||||
|
||||
aScalarBarLabelProp->SetFontFamilyToArial();
|
||||
if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
|
||||
/*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Arial" )
|
||||
aScalarBarLabelProp->SetFontFamilyToArial();
|
||||
else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Courier" )
|
||||
aScalarBarLabelProp->SetFontFamilyToCourier();
|
||||
else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Times" )
|
||||
aScalarBarLabelProp->SetFontFamilyToTimes();
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
|
||||
aScalarBarLabelProp->BoldOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarLabelProp->BoldOff();
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
|
||||
aScalarBarLabelProp->ItalicOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarLabelProp->ItalicOff();
|
||||
|
||||
if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
|
||||
/*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
|
||||
aScalarBarLabelProp->ShadowOn();
|
||||
else
|
||||
else*/
|
||||
aScalarBarLabelProp->ShadowOff();
|
||||
|
||||
myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
|
||||
aScalarBarLabelProp->Delete();
|
||||
|
||||
if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
|
||||
/*if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
|
||||
myScalarBarActor->SetOrientationToHorizontal();
|
||||
else
|
||||
else*/
|
||||
myScalarBarActor->SetOrientationToVertical();
|
||||
|
||||
float aXVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
|
||||
aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
|
||||
float aYVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
|
||||
aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
|
||||
float aXVal = 0.01; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
|
||||
// aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
|
||||
float aYVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
|
||||
// aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
|
||||
myScalarBarActor->SetPosition( aXVal, aYVal );
|
||||
|
||||
float aWVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
|
||||
aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
|
||||
float aWVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
|
||||
// aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
|
||||
myScalarBarActor->SetWidth( aWVal );
|
||||
|
||||
float aHVal = QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
|
||||
aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
|
||||
float aHVal = 0.8; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
|
||||
// aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
|
||||
myScalarBarActor->SetHeight( aHVal );
|
||||
|
||||
int anIntVal = 5;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
|
||||
anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
|
||||
// anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
|
||||
myScalarBarActor->SetNumberOfLabels(anIntVal == 0? 5: anIntVal);
|
||||
|
||||
anIntVal = 64;
|
||||
if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
|
||||
anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
|
||||
//if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
|
||||
// anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
|
||||
myScalarBarActor->SetMaximumNumberOfColors(anIntVal == 0? 64: anIntVal);
|
||||
|
||||
|
||||
@ -623,7 +623,7 @@ SetControlMode(eControl theMode,
|
||||
bool theCheckEntityMode)
|
||||
{
|
||||
myControlMode = eNone;
|
||||
theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
|
||||
//theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
|
||||
|
||||
my1DActor->GetMapper()->SetScalarVisibility(false);
|
||||
my2DActor->GetMapper()->SetScalarVisibility(false);
|
||||
@ -851,8 +851,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
|
||||
//SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
|
||||
SetIsShrunkable(true);
|
||||
|
||||
QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
|
||||
//QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
|
||||
SetRepresentation(-1);
|
||||
/*
|
||||
if(aMode.compare("Wireframe") == 0){
|
||||
SetRepresentation(eEdge);
|
||||
}else if(aMode.compare("Shading") == 0){
|
||||
@ -860,11 +861,11 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
|
||||
}else if(aMode.compare("Nodes") == 0){
|
||||
SetRepresentation(ePoint);
|
||||
}
|
||||
|
||||
aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
|
||||
*/
|
||||
/*aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
|
||||
if(aMode == "yes"){
|
||||
SetShrink();
|
||||
}
|
||||
}*/
|
||||
|
||||
myTimeStamp->Modified();
|
||||
Modified();
|
||||
@ -882,7 +883,7 @@ vtkDataSet* SMESH_ActorDef::GetInput(){
|
||||
}
|
||||
|
||||
|
||||
void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
|
||||
void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
|
||||
myNodeActor->SetTransform(theTransform);
|
||||
myBaseActor->SetTransform(theTransform);
|
||||
|
||||
@ -1101,10 +1102,10 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
|
||||
myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
|
||||
|
||||
myEntityMode = theMode;
|
||||
SALOME_ExtractUnstructuredGrid* aFilter = NULL;
|
||||
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
|
||||
aFilter = myBaseActor->GetExtractUnstructuredGrid();
|
||||
aFilter->ClearRegisteredCellsWithType();
|
||||
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
|
||||
if(myEntityMode & eEdges){
|
||||
if (MYDEBUG) MESSAGE("EDGES");
|
||||
@ -1255,13 +1256,13 @@ void SMESH_ActorDef::UpdateHighlight(){
|
||||
myHighlitableActor->SetHighlited(anIsVisible);
|
||||
myHighlitableActor->SetVisibility(anIsVisible);
|
||||
myHighlitableActor->GetExtractUnstructuredGrid()->
|
||||
SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::eCells);
|
||||
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
|
||||
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
|
||||
}else if(myRepresentation == ePoint || GetPointRepresentation()){
|
||||
myHighlitableActor->SetHighlited(anIsVisible);
|
||||
myHighlitableActor->SetVisibility(anIsVisible);
|
||||
myHighlitableActor->GetExtractUnstructuredGrid()->
|
||||
SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
|
||||
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
|
||||
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef SMESH_ACTOR_H
|
||||
#define SMESH_ACTOR_H
|
||||
|
||||
#include "SALOME_Actor.h"
|
||||
#include <SALOME_Actor.h>
|
||||
#include "SMESH_Object.h"
|
||||
|
||||
class vtkUnstructuredGrid;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
TVTKSmartPtr& operator=(T* r){ vtkSmartPointer<T>::operator=(r); return *this;}
|
||||
T* Get() const { return GetPointer();}
|
||||
T* Get() const { return this->GetPointer();}
|
||||
};
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ class SMESH_ActorDef : public SMESH_Actor{
|
||||
virtual bool GetPointRepresentation();
|
||||
|
||||
virtual float* GetBounds();
|
||||
virtual void SetTransform(SALOME_Transform* theTransform);
|
||||
virtual void SetTransform(VTKViewer_Transform* theTransform);
|
||||
|
||||
virtual vtkUnstructuredGrid* GetUnstructuredGrid();
|
||||
virtual vtkDataSet* GetInput();
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "SMESH_ActorUtils.h"
|
||||
|
||||
#include "QAD_Config.h"
|
||||
//#include "QAD_Config.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
@ -36,9 +36,10 @@ namespace SMESH{
|
||||
|
||||
float GetFloat(const QString& theValue, float theDefault){
|
||||
if(theValue.isEmpty()) return theDefault;
|
||||
QString aValue = QAD_CONFIG->getSetting(theValue);
|
||||
if(aValue.isEmpty()) return theDefault;
|
||||
return aValue.toFloat();
|
||||
//QString aValue = QAD_CONFIG->getSetting(theValue);
|
||||
//if(aValue.isEmpty())
|
||||
return theDefault;
|
||||
//return aValue.toFloat();
|
||||
}
|
||||
|
||||
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
|
||||
|
@ -32,10 +32,10 @@
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
|
||||
#include "SALOME_Transform.h"
|
||||
#include "SALOME_TransformFilter.h"
|
||||
#include "SALOME_PassThroughFilter.h"
|
||||
#include "SALOME_ExtractUnstructuredGrid.h"
|
||||
#include <VTKViewer_Transform.h>
|
||||
#include <VTKViewer_TransformFilter.h>
|
||||
#include <VTKViewer_PassThroughFilter.h>
|
||||
#include <VTKViewer_ExtractUnstructuredGrid.h>
|
||||
|
||||
// VTK Includes
|
||||
#include <vtkObjectFactory.h>
|
||||
@ -100,16 +100,16 @@ SMESH_DeviceActor::SMESH_DeviceActor()
|
||||
myExtractGeometry->SetReleaseDataFlag(true);
|
||||
myIsImplicitFunctionUsed = false;
|
||||
|
||||
myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
|
||||
myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New();
|
||||
|
||||
myMergeFilter = vtkMergeFilter::New();
|
||||
|
||||
myGeomFilter = SALOME_GeometryFilter::New();
|
||||
myGeomFilter = VTKViewer_GeometryFilter::New();
|
||||
|
||||
myTransformFilter = SALOME_TransformFilter::New();
|
||||
myTransformFilter = VTKViewer_TransformFilter::New();
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
myPassFilter.push_back(SALOME_PassThroughFilter::New());
|
||||
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
|
||||
}
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
|
||||
}
|
||||
|
||||
|
||||
SALOME_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
|
||||
VTKViewer_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
|
||||
return myExtractUnstructuredGrid;
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
|
||||
bool anIsInitialized = theFunctor;
|
||||
myExtractUnstructuredGrid->ClearRegisteredCells();
|
||||
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
|
||||
myVisualObj->UpdateFunctor(theFunctor);
|
||||
|
||||
using namespace SMESH::Controls;
|
||||
@ -436,12 +436,12 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
|
||||
{
|
||||
myExtractUnstructuredGrid->ClearRegisteredCells();
|
||||
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
|
||||
myVisualObj->UpdateFunctor(theFunctor);
|
||||
|
||||
using namespace SMESH::Controls;
|
||||
if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
|
||||
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
|
||||
vtkIdType aNbCells = aGrid->GetNumberOfCells();
|
||||
for( vtkIdType i = 0; i < aNbCells; i++ ){
|
||||
@ -516,7 +516,7 @@ unsigned long int SMESH_DeviceActor::GetMTime(){
|
||||
}
|
||||
|
||||
|
||||
void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){
|
||||
void SMESH_DeviceActor::SetTransform(VTKViewer_Transform* theTransform){
|
||||
myTransformFilter->SetTransform(theTransform);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef SMESH_DEVICE_ACTOR_H
|
||||
#define SMESH_DEVICE_ACTOR_H
|
||||
|
||||
#include "SALOME_GeometryFilter.h"
|
||||
#include <VTKViewer_GeometryFilter.h>
|
||||
#include "SMESH_Controls.hxx"
|
||||
#include "SMESH_Object.h"
|
||||
|
||||
@ -46,10 +46,10 @@ class vtkScalarBarActor;
|
||||
class vtkLookupTable;
|
||||
class vtkImplicitBoolean;
|
||||
|
||||
class SALOME_Transform;
|
||||
class SALOME_TransformFilter;
|
||||
class SALOME_PassThroughFilter;
|
||||
class SALOME_ExtractUnstructuredGrid;
|
||||
class VTKViewer_Transform;
|
||||
class VTKViewer_TransformFilter;
|
||||
class VTKViewer_PassThroughFilter;
|
||||
class VTKViewer_ExtractUnstructuredGrid;
|
||||
|
||||
class SMESH_ExtractGeometry;
|
||||
|
||||
@ -71,7 +71,7 @@ class SMESH_DeviceActor: public vtkLODActor{
|
||||
virtual int GetElemObjId(int theVtkID);
|
||||
virtual vtkCell* GetElemCell(int theObjID);
|
||||
|
||||
virtual void SetTransform(SALOME_Transform* theTransform);
|
||||
virtual void SetTransform(VTKViewer_Transform* theTransform);
|
||||
virtual unsigned long int GetMTime();
|
||||
|
||||
float GetShrinkFactor();
|
||||
@ -89,7 +89,7 @@ class SMESH_DeviceActor: public vtkLODActor{
|
||||
virtual void SetVisibility(int theMode);
|
||||
virtual int GetVisibility();
|
||||
|
||||
SALOME_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
|
||||
VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
|
||||
vtkUnstructuredGrid* GetUnstructuredGrid();
|
||||
|
||||
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
|
||||
@ -122,12 +122,12 @@ class SMESH_DeviceActor: public vtkLODActor{
|
||||
bool myIsImplicitFunctionUsed;
|
||||
|
||||
vtkMergeFilter* myMergeFilter;
|
||||
SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
|
||||
VTKViewer_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
|
||||
|
||||
bool myStoreClippingMapping;
|
||||
SALOME_GeometryFilter *myGeomFilter;
|
||||
SALOME_TransformFilter *myTransformFilter;
|
||||
std::vector<SALOME_PassThroughFilter*> myPassFilter;
|
||||
VTKViewer_GeometryFilter *myGeomFilter;
|
||||
VTKViewer_TransformFilter *myTransformFilter;
|
||||
std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
|
||||
|
||||
vtkShrinkFilter* myShrinkFilter;
|
||||
bool myIsShrinkable;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SALOME_ExtractUnstructuredGrid.h"
|
||||
#include <VTKViewer_ExtractUnstructuredGrid.h>
|
||||
|
||||
#include CORBA_SERVER_HEADER(SALOME_Exception)
|
||||
|
||||
@ -160,6 +160,30 @@ namespace{
|
||||
}
|
||||
|
||||
|
||||
inline void AddPolygonsWithID(SMDS_Mesh* theMesh,
|
||||
SMESH::log_array_var& theSeq,
|
||||
CORBA::Long theId)
|
||||
{
|
||||
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
|
||||
CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
|
||||
|
||||
for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
|
||||
int aFaceId = anIndexes[anIndexId++];
|
||||
|
||||
int aNbNodes = anIndexes[anIndexId++];
|
||||
std::vector<int> nodes_ids (aNbNodes);
|
||||
for (int i = 0; i < aNbNodes; i++) {
|
||||
nodes_ids[i] = anIndexes[anIndexId++];
|
||||
}
|
||||
|
||||
SMDS_MeshElement* anElem = theMesh->AddPolygonalFaceWithID(nodes_ids, aFaceId);
|
||||
if (!anElem)
|
||||
EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolygonalFaceWithID for ID = "
|
||||
<< anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void AddTetrasWithID(SMDS_Mesh* theMesh,
|
||||
SMESH::log_array_var& theSeq,
|
||||
CORBA::Long theId)
|
||||
@ -175,7 +199,7 @@ namespace{
|
||||
anIndexes[anIndexId+4],
|
||||
anIndexes[anIndexId]);
|
||||
if(!anElem)
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +220,7 @@ namespace{
|
||||
anIndexes[anIndexId+5],
|
||||
anIndexes[anIndexId]);
|
||||
if(!anElem)
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +242,7 @@ namespace{
|
||||
anIndexes[anIndexId+6],
|
||||
anIndexes[anIndexId]);
|
||||
if(!anElem)
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +266,69 @@ namespace{
|
||||
anIndexes[anIndexId+8],
|
||||
anIndexes[anIndexId]);
|
||||
if(!anElem)
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
|
||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh,
|
||||
SMESH::log_array_var& theSeq,
|
||||
CORBA::Long theId)
|
||||
{
|
||||
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
|
||||
CORBA::Long anIndexId = 0, aNbElems = theSeq[theId].number;
|
||||
|
||||
for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++) {
|
||||
int aFaceId = anIndexes[anIndexId++];
|
||||
|
||||
int aNbNodes = anIndexes[anIndexId++];
|
||||
std::vector<int> nodes_ids (aNbNodes);
|
||||
for (int i = 0; i < aNbNodes; i++) {
|
||||
nodes_ids[i] = anIndexes[anIndexId++];
|
||||
}
|
||||
|
||||
int aNbFaces = anIndexes[anIndexId++];
|
||||
std::vector<int> quantities (aNbFaces);
|
||||
for (int i = 0; i < aNbFaces; i++) {
|
||||
quantities[i] = anIndexes[anIndexId++];
|
||||
}
|
||||
|
||||
SMDS_MeshElement* anElem =
|
||||
theMesh->AddPolyhedralVolumeWithID(nodes_ids, quantities, aFaceId);
|
||||
if (!anElem)
|
||||
EXCEPTION(runtime_error, "SMDS_Mesh::FindElement - cannot AddPolyhedralVolumeWithID for ID = "
|
||||
<< anElemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh,
|
||||
SMESH::log_array_var& theSeq,
|
||||
CORBA::Long theId)
|
||||
{
|
||||
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
|
||||
CORBA::Long iind = 0, aNbElems = theSeq[theId].number;
|
||||
|
||||
for (CORBA::Long anElemId = 0; anElemId < aNbElems; anElemId++)
|
||||
{
|
||||
// find element
|
||||
const SMDS_MeshElement* elem = FindElement(theMesh, anIndexes[iind++]);
|
||||
// nb nodes
|
||||
int nbNodes = anIndexes[iind++];
|
||||
// nodes
|
||||
std::vector<const SMDS_MeshNode*> aNodes (nbNodes);
|
||||
for (int iNode = 0; iNode < nbNodes; iNode++) {
|
||||
aNodes[iNode] = FindNode(theMesh, anIndexes[iind++]);
|
||||
}
|
||||
// nb faces
|
||||
int nbFaces = anIndexes[iind++];
|
||||
// quantities
|
||||
std::vector<int> quantities (nbFaces);
|
||||
for (int iFace = 0; iFace < nbFaces; iFace++) {
|
||||
quantities[iFace] = anIndexes[iind++];
|
||||
}
|
||||
// change
|
||||
theMesh->ChangePolyhedronNodes(elem, aNodes, quantities);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,6 +344,7 @@ namespace{
|
||||
// purpose : Get type of VTK cell
|
||||
//=================================================================================
|
||||
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
|
||||
const bool thePoly,
|
||||
const int theNbNodes )
|
||||
{
|
||||
switch( theType )
|
||||
@ -266,16 +353,18 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
|
||||
return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
|
||||
|
||||
case SMDSAbs_Face :
|
||||
if ( theNbNodes == 3 ) return VTK_TRIANGLE;
|
||||
else if ( theNbNodes == 4 ) return VTK_QUAD;
|
||||
else return VTK_EMPTY_CELL;
|
||||
if (thePoly && theNbNodes>2 ) return VTK_POLYGON;
|
||||
else if ( theNbNodes == 3 ) return VTK_TRIANGLE;
|
||||
else if ( theNbNodes == 4 ) return VTK_QUAD;
|
||||
else return VTK_EMPTY_CELL;
|
||||
|
||||
case SMDSAbs_Volume:
|
||||
if ( theNbNodes == 4 ) return VTK_TETRA;
|
||||
else if ( theNbNodes == 5 ) return VTK_PYRAMID;
|
||||
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
||||
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
||||
else return VTK_EMPTY_CELL;
|
||||
if (thePoly && theNbNodes>3 ) return VTK_CONVEX_POINT_SET;
|
||||
else if ( theNbNodes == 4 ) return VTK_TETRA;
|
||||
else if ( theNbNodes == 5 ) return VTK_PYRAMID;
|
||||
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
||||
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
||||
else return VTK_EMPTY_CELL;
|
||||
|
||||
default: return VTK_EMPTY_CELL;
|
||||
}
|
||||
@ -287,15 +376,12 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
|
||||
//=================================================================================
|
||||
SMESH_VisualObjDef::SMESH_VisualObjDef()
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("SMESH_MeshObj - "<<this);
|
||||
myGrid = vtkUnstructuredGrid::New();
|
||||
}
|
||||
SMESH_VisualObjDef::~SMESH_VisualObjDef()
|
||||
{
|
||||
if(MYDEBUG) {
|
||||
MESSAGE("~SMESH_MeshObj - "<<this);
|
||||
myGrid->DebugOn();
|
||||
}
|
||||
if ( MYDEBUG )
|
||||
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
|
||||
myGrid->Delete();
|
||||
}
|
||||
|
||||
@ -545,35 +631,37 @@ void SMESH_VisualObjDef::buildElemPrs()
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
switch(aType){
|
||||
case SMDSAbs_Volume:{
|
||||
int* aConnectivities = NULL;
|
||||
std::vector<int> aConnectivities;
|
||||
GetConnect(aNodesIter,aConnect);
|
||||
// Convertions connectivities from SMDS to VTK
|
||||
switch(aNbNodes){
|
||||
case 4:{
|
||||
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
|
||||
for (int k = 0; k < aNbNodes; k++) {
|
||||
aConnectivities.push_back(k);
|
||||
}
|
||||
|
||||
} else if (aNbNodes == 4) {
|
||||
static int anIds[] = {0,2,1,3};
|
||||
aConnectivities = anIds;
|
||||
break;
|
||||
}
|
||||
case 5:{
|
||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||
|
||||
} else if (aNbNodes == 5) {
|
||||
static int anIds[] = {0,3,2,1,4};
|
||||
aConnectivities = anIds;
|
||||
break;
|
||||
}
|
||||
case 6:{
|
||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||
|
||||
} else if (aNbNodes == 6) {
|
||||
static int anIds[] = {0,1,2,3,4,5};
|
||||
aConnectivities = anIds;
|
||||
break;
|
||||
}
|
||||
case 8:{
|
||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||
|
||||
} else if (aNbNodes == 8) {
|
||||
static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||
aConnectivities = anIds;
|
||||
break;
|
||||
}}
|
||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||
|
||||
if(aConnectivities)
|
||||
for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
|
||||
} else {
|
||||
}
|
||||
|
||||
if (aConnectivities.size() > 0) {
|
||||
for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
|
||||
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -584,7 +672,7 @@ void SMESH_VisualObjDef::buildElemPrs()
|
||||
}
|
||||
|
||||
aConnectivity->InsertNextCell( anIdList );
|
||||
aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
|
||||
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
|
||||
|
||||
iElem++;
|
||||
}
|
||||
@ -628,7 +716,7 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
|
||||
|
||||
int nbNodes = anElem->NbNodes();
|
||||
|
||||
if ( theEdgeNum < 1 || theEdgeNum > 4 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
|
||||
if ( theEdgeNum < 0 || theEdgeNum > 3 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
|
||||
return false;
|
||||
|
||||
int anIds[ nbNodes ];
|
||||
@ -637,10 +725,10 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
|
||||
while( anIter->more() )
|
||||
anIds[ i++ ] = anIter->next()->GetID();
|
||||
|
||||
if ( nbNodes != theEdgeNum )
|
||||
if ( theEdgeNum < nbNodes - 1 )
|
||||
{
|
||||
theNodeId1 = anIds[ theEdgeNum - 1 ];
|
||||
theNodeId2 = anIds[ theEdgeNum ];
|
||||
theNodeId1 = anIds[ theEdgeNum ];
|
||||
theNodeId2 = anIds[ theEdgeNum + 1 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -707,14 +795,16 @@ void SMESH_MeshObj::Update( int theIsClear )
|
||||
|
||||
switch(aCommand)
|
||||
{
|
||||
case SMESH::ADD_NODE : AddNodesWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_EDGE : AddEdgesWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_TRIANGLE : AddTriasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_TETRAHEDRON: AddTetrasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_PYRAMID : AddPiramidsWithID( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_PRISM : AddPrismsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_HEXAHEDRON : AddHexasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_NODE : AddNodesWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_EDGE : AddEdgesWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_TRIANGLE : AddTriasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_POLYGON : AddPolygonsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_TETRAHEDRON: AddTetrasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_PYRAMID : AddPiramidsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_PRISM : AddPrismsWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_HEXAHEDRON : AddHexasWithID ( myMesh, aSeq, anId ); break;
|
||||
case SMESH::ADD_POLYHEDRON : AddPolyhedronsWithID( myMesh, aSeq, anId ); break;
|
||||
|
||||
case SMESH::REMOVE_NODE:
|
||||
for( ; anElemId < aNbElems; anElemId++ )
|
||||
@ -743,8 +833,8 @@ void SMESH_MeshObj::Update( int theIsClear )
|
||||
// nb nodes
|
||||
int nbNodes = anIndexes[i++];
|
||||
// nodes
|
||||
ASSERT( nbNodes < 9 );
|
||||
const SMDS_MeshNode* aNodes[ 8 ];
|
||||
//ASSERT( nbNodes < 9 );
|
||||
const SMDS_MeshNode* aNodes[ nbNodes ];
|
||||
for ( int iNode = 0; iNode < nbNodes; iNode++ )
|
||||
aNodes[ iNode ] = FindNode( myMesh, anIndexes[i++] );
|
||||
// change
|
||||
@ -752,6 +842,9 @@ void SMESH_MeshObj::Update( int theIsClear )
|
||||
}
|
||||
break;
|
||||
|
||||
case SMESH::CHANGE_POLYHEDRON_NODES:
|
||||
ChangePolyhedronNodes(myMesh, aSeq, anId);
|
||||
break;
|
||||
case SMESH::RENUMBER:
|
||||
for(CORBA::Long i=0; anElemId < aNbElems; anElemId++, i+=3)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define SMESH_OBJECTDEF_H
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
|
@ -55,8 +55,10 @@ LIB_SRC = \
|
||||
SMDS_IteratorOfElements.cxx \
|
||||
SMDS_VolumeOfFaces.cxx \
|
||||
SMDS_VolumeOfNodes.cxx \
|
||||
SMDS_PolyhedralVolumeOfNodes.cxx \
|
||||
SMDS_FaceOfEdges.cxx \
|
||||
SMDS_FaceOfNodes.cxx \
|
||||
SMDS_PolygonalFaceOfNodes.cxx \
|
||||
SMDS_VolumeTool.cxx
|
||||
# SMDS_Tria3OfNodes.cxx \
|
||||
# SMDS_HexahedronOfNodes.cxx
|
||||
@ -107,8 +109,10 @@ EXPORT_HEADERS= \
|
||||
SMDS_IteratorOfElements.hxx \
|
||||
SMDS_VolumeOfFaces.hxx \
|
||||
SMDS_VolumeOfNodes.hxx \
|
||||
SMDS_PolyhedralVolumeOfNodes.hxx \
|
||||
SMDS_FaceOfEdges.hxx \
|
||||
SMDS_FaceOfNodes.hxx \
|
||||
SMDS_PolygonalFaceOfNodes.hxx \
|
||||
SMDS_VolumeTool.hxx
|
||||
# SMDS_Tria3OfNodes.hxx \
|
||||
# SMDS_HexahedronOfNodes.hxx
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "SMDS_VolumeOfFaces.hxx"
|
||||
#include "SMDS_FaceOfNodes.hxx"
|
||||
#include "SMDS_FaceOfEdges.hxx"
|
||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||
#include "SMDS_PolygonalFaceOfNodes.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@ -786,6 +788,126 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
|
||||
return volume;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Add a polygon defined by its nodes IDs
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
|
||||
const int ID)
|
||||
{
|
||||
int nbNodes = nodes_ids.size();
|
||||
std::vector<const SMDS_MeshNode*> nodes (nbNodes);
|
||||
for (int i = 0; i < nbNodes; i++) {
|
||||
nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
|
||||
if (!nodes[i]) return NULL;
|
||||
}
|
||||
return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Add a polygon defined by its nodes
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshFace * face;
|
||||
|
||||
if (hasConstructionEdges())
|
||||
{
|
||||
MESSAGE("Error : Not implemented");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
face = new SMDS_PolygonalFaceOfNodes(nodes);
|
||||
myFaces.Add(face);
|
||||
}
|
||||
|
||||
if (!registerElement(ID, face)) {
|
||||
RemoveElement(face, false);
|
||||
face = NULL;
|
||||
}
|
||||
return face;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Add a polygon defined by its nodes.
|
||||
/// An ID is automatically affected to the created face.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes)
|
||||
{
|
||||
return SMDS_Mesh::AddPolygonalFaceWithID(nodes, myElementIDFactory->GetFreeID());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create a new polyhedral volume and add it to the mesh.
|
||||
/// @param ID The ID of the new volume
|
||||
/// @return The created volume or NULL if an element with this ID already exists
|
||||
/// or if input nodes are not found.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID
|
||||
(std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities,
|
||||
const int ID)
|
||||
{
|
||||
int nbNodes = nodes_ids.size();
|
||||
std::vector<const SMDS_MeshNode*> nodes (nbNodes);
|
||||
for (int i = 0; i < nbNodes; i++) {
|
||||
nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
|
||||
if (!nodes[i]) return NULL;
|
||||
}
|
||||
return SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create a new polyhedral volume and add it to the mesh.
|
||||
/// @param ID The ID of the new volume
|
||||
/// @return The created volume
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshVolume* volume;
|
||||
if (hasConstructionFaces()) {
|
||||
MESSAGE("Error : Not implemented");
|
||||
return NULL;
|
||||
} else if (hasConstructionEdges()) {
|
||||
MESSAGE("Error : Not implemented");
|
||||
return NULL;
|
||||
} else {
|
||||
volume = new SMDS_PolyhedralVolumeOfNodes(nodes, quantities);
|
||||
myVolumes.Add(volume);
|
||||
}
|
||||
|
||||
if (!registerElement(ID, volume)) {
|
||||
RemoveElement(volume, false);
|
||||
volume = NULL;
|
||||
}
|
||||
return volume;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Create a new polyhedral volume and add it to the mesh.
|
||||
/// @return The created volume
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
int ID = myElementIDFactory->GetFreeID();
|
||||
SMDS_MeshVolume * v = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
|
||||
if (v == NULL) myElementIDFactory->ReleaseID(ID);
|
||||
return v;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Registers element with the given ID, maintains inverse connections
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -966,10 +1088,25 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
}
|
||||
case SMDSAbs_Face: {
|
||||
const SMDS_FaceOfNodes* face = dynamic_cast<const SMDS_FaceOfNodes*>( elem );
|
||||
if ( face )
|
||||
if ( face ) {
|
||||
Ok = const_cast<SMDS_FaceOfNodes*>( face )->ChangeNodes( nodes, nbnodes );
|
||||
} else {
|
||||
/// ??? begin
|
||||
const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
|
||||
if (face) {
|
||||
Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
|
||||
}
|
||||
/// ??? end
|
||||
}
|
||||
break;
|
||||
}
|
||||
//case SMDSAbs_PolygonalFace: {
|
||||
// const SMDS_PolygonalFaceOfNodes* face = dynamic_cast<const SMDS_PolygonalFaceOfNodes*>(elem);
|
||||
// if (face) {
|
||||
// Ok = const_cast<SMDS_PolygonalFaceOfNodes*>(face)->ChangeNodes(nodes, nbnodes);
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
case SMDSAbs_Volume: {
|
||||
const SMDS_VolumeOfNodes* vol = dynamic_cast<const SMDS_VolumeOfNodes*>( elem );
|
||||
if ( vol )
|
||||
@ -1007,6 +1144,62 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
return Ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePolyhedronNodes
|
||||
//purpose : to change nodes of polyhedral volume
|
||||
//=======================================================================
|
||||
bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
if (elem->GetType() != SMDSAbs_Volume) {
|
||||
MESSAGE("WRONG ELEM TYPE");
|
||||
return false;
|
||||
}
|
||||
|
||||
const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(elem);
|
||||
if (!vol) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// keep current nodes of elem
|
||||
set<const SMDS_MeshElement*> oldNodes;
|
||||
SMDS_ElemIteratorPtr itn = elem->nodesIterator();
|
||||
while (itn->more()) {
|
||||
oldNodes.insert(itn->next());
|
||||
}
|
||||
|
||||
// change nodes
|
||||
bool Ok = const_cast<SMDS_PolyhedralVolumeOfNodes*>(vol)->ChangeNodes(nodes, quantities);
|
||||
if (!Ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// update InverseElements
|
||||
|
||||
// AddInverseElement to new nodes
|
||||
int nbnodes = nodes.size();
|
||||
for (int i = 0; i < nbnodes; i++) {
|
||||
if (oldNodes.find(nodes[i]) == oldNodes.end()) {
|
||||
// new node
|
||||
const_cast<SMDS_MeshNode*>(nodes[i])->AddInverseElement(elem);
|
||||
} else {
|
||||
// remove from oldNodes a node that remains in elem
|
||||
oldNodes.erase(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveInverseElement from the nodes removed from elem
|
||||
set<const SMDS_MeshElement*>::iterator it;
|
||||
for (it = oldNodes.begin(); it != oldNodes.end(); it++) {
|
||||
SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
|
||||
(const_cast<SMDS_MeshElement *>( *it ));
|
||||
n->RemoveInverseElement(elem);
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindEdge
|
||||
//purpose :
|
||||
@ -1192,6 +1385,55 @@ const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
|
||||
return myElementIDFactory->MeshElement(IDelem);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindFace
|
||||
//purpose : find polygon
|
||||
//=======================================================================
|
||||
|
||||
const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<int> nodes_ids) const
|
||||
{
|
||||
int nbnodes = nodes_ids.size();
|
||||
std::vector<const SMDS_MeshNode *> poly_nodes (nbnodes);
|
||||
for (int inode = 0; inode < nbnodes; inode++) {
|
||||
const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
|
||||
if (node == NULL) return NULL;
|
||||
}
|
||||
return FindFace(poly_nodes);
|
||||
}
|
||||
|
||||
const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<const SMDS_MeshNode *> nodes)
|
||||
{
|
||||
int nbNodes = nodes.size();
|
||||
if (nbNodes < 1) return NULL;
|
||||
|
||||
bool isFound = true;
|
||||
const SMDS_MeshFace * face;
|
||||
set<const SMDS_MeshFace *> faces;
|
||||
|
||||
for (int inode = 0; inode < nbNodes && isFound; inode++) {
|
||||
set<const SMDS_MeshFace *> new_faces;
|
||||
|
||||
SMDS_ElemIteratorPtr itF = nodes[inode]->facesIterator();
|
||||
while (itF->more()) {
|
||||
face = static_cast<const SMDS_MeshFace *>(itF->next());
|
||||
if (face->NbNodes() == nbNodes) {
|
||||
if (inode == 0 || faces.find(face) != faces.end()) {
|
||||
new_faces.insert(face);
|
||||
}
|
||||
}
|
||||
}
|
||||
faces = new_faces;
|
||||
if (new_faces.size() == 0) {
|
||||
isFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFound)
|
||||
return face;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpNodes
|
||||
//purpose :
|
||||
@ -1743,7 +1985,8 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||
// get finite elements built on elem
|
||||
set<const SMDS_MeshElement*> * s1;
|
||||
if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
|
||||
!hasConstructionFaces() && elem->GetType() == SMDSAbs_Face)
|
||||
!hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
|
||||
elem->GetType() == SMDSAbs_Volume)
|
||||
{
|
||||
s1 = new set<const SMDS_MeshElement*>();
|
||||
s1->insert(elem);
|
||||
@ -1936,4 +2179,3 @@ void SMDS_Mesh::Renumber (const bool isNodes, const int startID, const int del
|
||||
ID += deltaID;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,28 @@ public:
|
||||
const SMDS_MeshFace * f5,
|
||||
const SMDS_MeshFace * f6);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolume
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
virtual void RemoveElement(const SMDS_MeshElement * elem,
|
||||
std::list<const SMDS_MeshElement *>& removedElems,
|
||||
std::list<const SMDS_MeshElement *>& removedNodes,
|
||||
@ -217,6 +239,9 @@ public:
|
||||
static bool ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const int nbnodes);
|
||||
static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
|
||||
// Renumber all nodes or elements.
|
||||
@ -235,6 +260,10 @@ public:
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3,
|
||||
const SMDS_MeshNode *n4);
|
||||
|
||||
const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
|
||||
static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
|
||||
|
||||
int MaxNodeID() const;
|
||||
int MinNodeID() const;
|
||||
int MaxElementID() const;
|
||||
|
@ -59,6 +59,8 @@ class SMDS_MeshElement:public SMDS_MeshObject
|
||||
|
||||
///Return the type of the current element
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
virtual bool IsPoly() const { return false; };
|
||||
|
||||
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
||||
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
||||
|
||||
|
@ -125,7 +125,7 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
|
||||
// the type of the group is determined by the first element added
|
||||
if (myElements.empty()) myType = theElem->GetType();
|
||||
else if (theElem->GetType() != myType)
|
||||
MESSAGE("SMDS_MeshGroup::Add : Type Mismatch");
|
||||
MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
|
||||
|
||||
myElements.insert(theElem);
|
||||
}
|
||||
|
@ -44,8 +44,9 @@ int SMDS_MeshIDFactory::GetFreeID()
|
||||
if (myPoolOfID.empty()) return ++myMaxID;
|
||||
else
|
||||
{
|
||||
int ID = myPoolOfID.top();
|
||||
myPoolOfID.pop();
|
||||
set<int>::iterator i = myPoolOfID.begin();
|
||||
int ID = *i;//myPoolOfID.top();
|
||||
myPoolOfID.erase( i );//myPoolOfID.pop();
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
@ -56,5 +57,27 @@ int SMDS_MeshIDFactory::GetFreeID()
|
||||
//=======================================================================
|
||||
void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
||||
{
|
||||
if (ID > 0 && ID < myMaxID) myPoolOfID.push(ID);
|
||||
if ( ID > 0 )
|
||||
{
|
||||
if ( ID < myMaxID )
|
||||
{
|
||||
myPoolOfID.insert(ID);
|
||||
}
|
||||
else if ( ID == myMaxID )
|
||||
{
|
||||
--myMaxID;
|
||||
if ( !myPoolOfID.empty() ) // assure that myMaxID is not in myPoolOfID
|
||||
{
|
||||
set<int>::iterator i = --myPoolOfID.end();
|
||||
while ( i != myPoolOfID.begin() && myMaxID == *i ) {
|
||||
--myMaxID; --i;
|
||||
}
|
||||
if ( myMaxID == *i )
|
||||
--myMaxID; // begin of myPoolOfID reached
|
||||
else
|
||||
++i;
|
||||
myPoolOfID.erase( i, myPoolOfID.end() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define _SMDS_MeshIDFactory_HeaderFile
|
||||
|
||||
#include "SMDS_MeshObject.hxx"
|
||||
#include <stack>
|
||||
#include <set>
|
||||
|
||||
|
||||
class SMDS_MeshIDFactory:public SMDS_MeshObject
|
||||
@ -40,7 +40,7 @@ class SMDS_MeshIDFactory:public SMDS_MeshObject
|
||||
protected:
|
||||
SMDS_MeshIDFactory();
|
||||
int myMaxID;
|
||||
std::stack<int> myPoolOfID;
|
||||
std::set<int> myPoolOfID;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
174
src/SMDS/SMDS_PolygonalFaceOfNodes.cxx
Normal file
174
src/SMDS/SMDS_PolygonalFaceOfNodes.cxx
Normal file
@ -0,0 +1,174 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// 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
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#include "SMDS_PolygonalFaceOfNodes.hxx"
|
||||
|
||||
#include "SMDS_IteratorOfElements.hxx"
|
||||
//#include "SMDS_MeshNode.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
|
||||
(std::vector<const SMDS_MeshNode *> nodes)
|
||||
{
|
||||
myNodes = nodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const
|
||||
{
|
||||
return SMDSAbs_Face;
|
||||
//return SMDSAbs_PolygonalFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes)
|
||||
{
|
||||
if (nodes.size() < 3)
|
||||
return false;
|
||||
|
||||
myNodes = nodes;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose : to support the same interface, as SMDS_FaceOfNodes
|
||||
//=======================================================================
|
||||
bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes)
|
||||
{
|
||||
if (nbNodes < 3)
|
||||
return false;
|
||||
|
||||
myNodes.resize(nbNodes);
|
||||
int i = 0;
|
||||
for (; i < nbNodes; i++) {
|
||||
myNodes[i] = nodes[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolygonalFaceOfNodes::NbNodes() const
|
||||
{
|
||||
return myNodes.size();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolygonalFaceOfNodes::NbEdges() const
|
||||
{
|
||||
return NbNodes();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolygonalFaceOfNodes::NbFaces() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
|
||||
{
|
||||
OS << "polygonal face <" << GetID() << " > : ";
|
||||
int i, nbNodes = myNodes.size();
|
||||
for (i = 0; i < nbNodes - 1; i++)
|
||||
OS << myNodes[i] << ",";
|
||||
OS << myNodes[i] << ") " << endl;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : elementsIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
|
||||
{
|
||||
//const SMDS_MeshNode* const *mySet;
|
||||
const std::vector<const SMDS_MeshNode *> mySet;
|
||||
//int myLength;
|
||||
int index;
|
||||
public:
|
||||
//SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
|
||||
// mySet(s),myLength(l),index(0) {}
|
||||
SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
|
||||
mySet(s),index(0) {}
|
||||
|
||||
bool more()
|
||||
{
|
||||
return index < mySet.size();
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
index++;
|
||||
return mySet[index-1];
|
||||
}
|
||||
};
|
||||
|
||||
SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
|
||||
(SMDSAbs_ElementType type) const
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SMDSAbs_Face:
|
||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
|
||||
case SMDSAbs_Node:
|
||||
return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes));
|
||||
case SMDSAbs_Edge:
|
||||
MESSAGE("Error : edge iterator for SMDS_PolygonalFaceOfNodes not implemented");
|
||||
break;
|
||||
default:
|
||||
return SMDS_ElemIteratorPtr
|
||||
(new SMDS_IteratorOfElements
|
||||
(this,type,SMDS_ElemIteratorPtr
|
||||
(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes))));
|
||||
}
|
||||
return SMDS_ElemIteratorPtr();
|
||||
}
|
60
src/SMDS/SMDS_PolygonalFaceOfNodes.hxx
Normal file
60
src/SMDS/SMDS_PolygonalFaceOfNodes.hxx
Normal file
@ -0,0 +1,60 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// 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 _SMDS_PolygonalFaceOfNodes_HeaderFile
|
||||
#define _SMDS_PolygonalFaceOfNodes_HeaderFile
|
||||
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
//#include "SMDS_FaceOfNodes.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_Iterator.hxx"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//class SMDS_PolygonalFaceOfNodes:public SMDS_FaceOfNodes
|
||||
class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
|
||||
{
|
||||
public:
|
||||
SMDS_PolygonalFaceOfNodes (std::vector<const SMDS_MeshNode *> nodes);
|
||||
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
virtual bool IsPoly() const { return true; };
|
||||
|
||||
bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes);
|
||||
|
||||
bool ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes);
|
||||
// to support the same interface, as SMDS_FaceOfNodes
|
||||
|
||||
virtual int NbNodes() const;
|
||||
virtual int NbEdges() const;
|
||||
virtual int NbFaces() const;
|
||||
|
||||
virtual void Print (std::ostream & OS) const;
|
||||
|
||||
protected:
|
||||
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
std::vector<const SMDS_MeshNode *> myNodes;
|
||||
};
|
||||
|
||||
#endif
|
182
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
Normal file
182
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
Normal file
@ -0,0 +1,182 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// 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
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose : Create a volume of many faces
|
||||
//=======================================================================
|
||||
SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes
|
||||
(std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities)
|
||||
: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
|
||||
{
|
||||
ChangeNodes(nodes, quantities);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDSAbs_ElementType SMDS_PolyhedralVolumeOfNodes::GetType() const
|
||||
{
|
||||
// return SMDSAbs_PolyhedralVolume;
|
||||
return SMDSAbs_Volume;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
myNodesByFaces = nodes;
|
||||
myQuantities = quantities;
|
||||
|
||||
// Init fields of parent class
|
||||
int aNbNodes = 0;
|
||||
std::set<const SMDS_MeshNode *> aSet;
|
||||
int nodes_len = nodes.size();
|
||||
for (int j = 0; j < nodes_len; j++) {
|
||||
if (aSet.find(nodes[j]) == aSet.end()) {
|
||||
aSet.insert(nodes[j]);
|
||||
aNbNodes++;
|
||||
}
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
const SMDS_MeshNode* aNodes [aNbNodes];
|
||||
std::set<const SMDS_MeshNode *>::iterator anIter = aSet.begin();
|
||||
for (; anIter != aSet.end(); anIter++, k++) {
|
||||
aNodes[k] = *anIter;
|
||||
}
|
||||
|
||||
//SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes);
|
||||
delete [] myNodes;
|
||||
//myNbNodes = nodes.size();
|
||||
myNbNodes = aNbNodes;
|
||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||
for (int i = 0; i < myNbNodes; i++) {
|
||||
//myNodes[i] = nodes[i];
|
||||
myNodes[i] = aNodes[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbEdges() const
|
||||
{
|
||||
int nbEdges = 0;
|
||||
|
||||
for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
|
||||
nbEdges += myQuantities[ifa];
|
||||
}
|
||||
nbEdges /= 2;
|
||||
|
||||
return nbEdges;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbFaces() const
|
||||
{
|
||||
return myQuantities.size();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaceNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
|
||||
{
|
||||
if (face_ind < 1 || myQuantities.size() < face_ind)
|
||||
return 0;
|
||||
return myQuantities[face_ind - 1];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetFaceNode (const int face_ind,
|
||||
const int node_ind) const
|
||||
{
|
||||
if (node_ind < 1 || NbFaceNodes(face_ind) < node_ind)
|
||||
return NULL;
|
||||
|
||||
int i, first_node = 0;
|
||||
for (i = 0; i < face_ind - 1; i++) {
|
||||
first_node += myQuantities[i];
|
||||
}
|
||||
|
||||
return myNodesByFaces[first_node + node_ind - 1];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_PolyhedralVolumeOfNodes::Print (ostream & OS) const
|
||||
{
|
||||
OS << "polyhedral volume <" << GetID() << "> : ";
|
||||
|
||||
int faces_len = myQuantities.size();
|
||||
//int nodes_len = myNodesByFaces.size();
|
||||
int cur_first_node = 0;
|
||||
|
||||
int i, j;
|
||||
for (i = 0; i < faces_len; i++) {
|
||||
OS << "face_" << i << " (";
|
||||
for (j = 0; j < myQuantities[i] - 1; j++) {
|
||||
OS << myNodesByFaces[cur_first_node + j] << ",";
|
||||
}
|
||||
OS << myNodesByFaces[cur_first_node + j] << ") ";
|
||||
cur_first_node += myQuantities[i];
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose : usage disabled
|
||||
//=======================================================================
|
||||
bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes)
|
||||
{
|
||||
return false;
|
||||
}
|
72
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
Normal file
72
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
Normal file
@ -0,0 +1,72 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// 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 : SMDS_PolyhedralVolumeOfNodes.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_PolyhedralVolumeOfNodes_HeaderFile
|
||||
#define _SMDS_PolyhedralVolumeOfNodes_HeaderFile
|
||||
|
||||
#include "SMDS_VolumeOfNodes.hxx"
|
||||
|
||||
class SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes
|
||||
{
|
||||
public:
|
||||
SMDS_PolyhedralVolumeOfNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
//virtual ~SMDS_PolyhedralVolumeOfNodes();
|
||||
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
virtual bool IsPoly() const { return true; };
|
||||
|
||||
bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
//virtual int NbNodes() const;
|
||||
virtual int NbEdges() const;
|
||||
virtual int NbFaces() const;
|
||||
|
||||
int NbFaceNodes (const int face_ind) const;
|
||||
// 1 <= face_ind <= NbFaces()
|
||||
|
||||
const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
|
||||
// 1 <= face_ind <= NbFaces()
|
||||
// 1 <= node_ind <= NbFaceNodes()
|
||||
|
||||
virtual void Print (std::ostream & OS) const;
|
||||
|
||||
protected:
|
||||
//virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
// usage disabled
|
||||
bool ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes);
|
||||
|
||||
private:
|
||||
std::vector<const SMDS_MeshNode *> myNodesByFaces;
|
||||
std::vector<int> myQuantities;
|
||||
};
|
||||
|
||||
#endif
|
@ -11,6 +11,10 @@
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <map>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
@ -200,19 +204,36 @@ double XYZ::Magnitude() {
|
||||
|
||||
SMDS_VolumeTool::SMDS_VolumeTool ()
|
||||
: myVolume( 0 ),
|
||||
myPolyedre( 0 ),
|
||||
myVolForward( true ),
|
||||
myNbFaces( 0 ),
|
||||
myVolumeNbNodes( 0 ),
|
||||
myExternalFaces( false )
|
||||
myVolumeNodes( NULL ),
|
||||
myExternalFaces( false ),
|
||||
myFaceNbNodes( 0 ),
|
||||
myCurFace( -1 ),
|
||||
myFaceNodeIndices( NULL ),
|
||||
myFaceNodes( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SMDS_VolumeTool
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
|
||||
: myExternalFaces( false )
|
||||
: myVolume( 0 ),
|
||||
myPolyedre( 0 ),
|
||||
myVolForward( true ),
|
||||
myNbFaces( 0 ),
|
||||
myVolumeNbNodes( 0 ),
|
||||
myVolumeNodes( NULL ),
|
||||
myExternalFaces( false ),
|
||||
myFaceNbNodes( 0 ),
|
||||
myCurFace( -1 ),
|
||||
myFaceNodeIndices( NULL ),
|
||||
myFaceNodes( NULL )
|
||||
{
|
||||
Set( theVolume );
|
||||
}
|
||||
@ -224,6 +245,14 @@ SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
|
||||
|
||||
SMDS_VolumeTool::~SMDS_VolumeTool()
|
||||
{
|
||||
if (myVolumeNodes != NULL) {
|
||||
delete [] myVolumeNodes;
|
||||
myVolumeNodes = NULL;
|
||||
}
|
||||
if (myFaceNodes != NULL) {
|
||||
delete [] myFaceNodes;
|
||||
myFaceNodes = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -234,58 +263,75 @@ SMDS_VolumeTool::~SMDS_VolumeTool()
|
||||
bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
|
||||
{
|
||||
myVolume = 0;
|
||||
myPolyedre = 0;
|
||||
|
||||
myVolForward = true;
|
||||
myCurFace = -1;
|
||||
myVolumeNbNodes = 0;
|
||||
myNbFaces = 0;
|
||||
myVolumeNbNodes = 0;
|
||||
if (myVolumeNodes != NULL) {
|
||||
delete [] myVolumeNodes;
|
||||
myVolumeNodes = NULL;
|
||||
}
|
||||
|
||||
myExternalFaces = false;
|
||||
myFaceNbNodes = 0;
|
||||
|
||||
myCurFace = -1;
|
||||
myFaceNodeIndices = NULL;
|
||||
if (myFaceNodes != NULL) {
|
||||
delete [] myFaceNodes;
|
||||
myFaceNodes = NULL;
|
||||
}
|
||||
|
||||
if ( theVolume && theVolume->GetType() == SMDSAbs_Volume )
|
||||
{
|
||||
myVolume = theVolume;
|
||||
|
||||
myNbFaces = theVolume->NbFaces();
|
||||
myVolumeNbNodes = theVolume->NbNodes();
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
{
|
||||
myVolume = theVolume;
|
||||
myNbFaces = theVolume->NbFaces();
|
||||
|
||||
// set volume nodes
|
||||
int iNode = 0;
|
||||
SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
|
||||
while ( nodeIt->more() )
|
||||
myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||
|
||||
// nb nodes in each face
|
||||
if ( myVolumeNbNodes == 4 )
|
||||
myFaceNbNodes = Tetra_nbN;
|
||||
else if ( myVolumeNbNodes == 5 )
|
||||
myFaceNbNodes = Pyramid_nbN;
|
||||
else if ( myVolumeNbNodes == 6 )
|
||||
myFaceNbNodes = Penta_nbN;
|
||||
else
|
||||
myFaceNbNodes = Hexa_nbN;
|
||||
|
||||
// define volume orientation
|
||||
XYZ botNormal;
|
||||
GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
|
||||
const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
|
||||
const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
|
||||
XYZ upDir (topNode->X() - botNode->X(),
|
||||
topNode->Y() - botNode->Y(),
|
||||
topNode->Z() - botNode->Z() );
|
||||
myVolForward = ( botNormal.Dot( upDir ) < 0 );
|
||||
break;
|
||||
// set volume nodes
|
||||
int iNode = 0;
|
||||
myVolumeNodes = new const SMDS_MeshNode* [myVolumeNbNodes];
|
||||
SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
|
||||
while ( nodeIt->more() ) {
|
||||
myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||
}
|
||||
default: myVolume = 0;
|
||||
|
||||
if (myVolume->IsPoly()) {
|
||||
myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
|
||||
if (!myPolyedre) {
|
||||
MESSAGE("Warning: bad volumic element");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8: {
|
||||
// define volume orientation
|
||||
XYZ botNormal;
|
||||
GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
|
||||
const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
|
||||
const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
|
||||
XYZ upDir (topNode->X() - botNode->X(),
|
||||
topNode->Y() - botNode->Y(),
|
||||
topNode->Z() - botNode->Z() );
|
||||
myVolForward = ( botNormal.Dot( upDir ) < 0 );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ( myVolume != 0 );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetInverseNodes
|
||||
//purpose : Return nodes vector of an inverse volume
|
||||
//function : Inverse
|
||||
//purpose : Inverse volume
|
||||
//=======================================================================
|
||||
|
||||
#define SWAP_NODES(nodes,i1,i2) \
|
||||
@ -298,6 +344,11 @@ void SMDS_VolumeTool::Inverse ()
|
||||
{
|
||||
if ( !myVolume ) return;
|
||||
|
||||
if (myVolume->IsPoly()) {
|
||||
MESSAGE("Warning: attempt to inverse polyhedral volume");
|
||||
return;
|
||||
}
|
||||
|
||||
myVolForward = !myVolForward;
|
||||
myCurFace = -1;
|
||||
|
||||
@ -372,9 +423,9 @@ void SMDS_VolumeTool::SetExternalNormal ()
|
||||
|
||||
int SMDS_VolumeTool::NbFaceNodes( int faceIndex )
|
||||
{
|
||||
if ( !setFace( faceIndex ))
|
||||
return 0;
|
||||
return myFaceNbNodes[ faceIndex ];
|
||||
if ( !setFace( faceIndex ))
|
||||
return 0;
|
||||
return myFaceNbNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -402,6 +453,10 @@ const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
|
||||
|
||||
const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
|
||||
{
|
||||
if (myVolume->IsPoly()) {
|
||||
MESSAGE("Warning: attempt to obtain FaceNodesIndices of polyhedral volume");
|
||||
return NULL;
|
||||
}
|
||||
if ( !setFace( faceIndex ))
|
||||
return 0;
|
||||
return myFaceNodeIndices;
|
||||
@ -419,7 +474,7 @@ bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
|
||||
return false;
|
||||
|
||||
theFaceNodes.clear();
|
||||
int iNode, nbNode = myFaceNbNodes[ faceIndex ];
|
||||
int iNode, nbNode = myFaceNbNodes;
|
||||
for ( iNode = 0; iNode < nbNode; iNode++ )
|
||||
theFaceNodes.insert( myFaceNodes[ iNode ]);
|
||||
|
||||
@ -436,6 +491,16 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
|
||||
if ( myExternalFaces || !myVolume )
|
||||
return true;
|
||||
|
||||
if (myVolume->IsPoly()) {
|
||||
XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
|
||||
GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
|
||||
GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
|
||||
XYZ insideVec (baryCenter - p0);
|
||||
if (insideVec.Dot(aNormal) > 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 4:
|
||||
case 5:
|
||||
@ -482,7 +547,6 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceArea
|
||||
//purpose : Return face area
|
||||
@ -490,6 +554,11 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
|
||||
|
||||
double SMDS_VolumeTool::GetFaceArea( int faceIndex )
|
||||
{
|
||||
if (myVolume->IsPoly()) {
|
||||
MESSAGE("Warning: attempt to obtain area of a face of polyhedral volume");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !setFace( faceIndex ))
|
||||
return 0;
|
||||
|
||||
@ -500,7 +569,7 @@ double SMDS_VolumeTool::GetFaceArea( int faceIndex )
|
||||
XYZ aVec13( p3 - p1 );
|
||||
double area = aVec12.Crossed( aVec13 ).Magnitude() * 0.5;
|
||||
|
||||
if ( myFaceNbNodes[ faceIndex ] == 4 ) {
|
||||
if ( myFaceNbNodes == 4 ) {
|
||||
XYZ p4 ( myFaceNodes[3] );
|
||||
XYZ aVec14( p4 - p1 );
|
||||
area += aVec14.Crossed( aVec13 ).Magnitude() * 0.5;
|
||||
@ -516,12 +585,17 @@ double SMDS_VolumeTool::GetFaceArea( int faceIndex )
|
||||
int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const
|
||||
{
|
||||
int ind = -1;
|
||||
if (myVolume->IsPoly()) {
|
||||
MESSAGE("Warning: attempt to obtain opposite face on polyhedral volume");
|
||||
return ind;
|
||||
}
|
||||
|
||||
if ( faceIndex >= 0 && faceIndex < NbFaces() ) {
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 6:
|
||||
if ( faceIndex == 0 || faceIndex == 1 )
|
||||
ind = 1 - faceIndex;
|
||||
break;
|
||||
break;
|
||||
case 8:
|
||||
ind = faceIndex + ( faceIndex % 2 ? -1 : 1 );
|
||||
break;
|
||||
@ -542,6 +616,33 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
|
||||
if ( !myVolume )
|
||||
return false;
|
||||
|
||||
if (myVolume->IsPoly()) {
|
||||
if (!myPolyedre) {
|
||||
MESSAGE("Warning: bad volumic element");
|
||||
return false;
|
||||
}
|
||||
bool isLinked = false;
|
||||
int iface;
|
||||
for (iface = 1; iface <= myNbFaces && !isLinked; iface++) {
|
||||
int inode, nbFaceNodes = myPolyedre->NbFaceNodes(iface);
|
||||
|
||||
for (inode = 1; inode <= nbFaceNodes && !isLinked; inode++) {
|
||||
const SMDS_MeshNode* curNode = myPolyedre->GetFaceNode(iface, inode);
|
||||
|
||||
if (curNode == theNode1 || curNode == theNode2) {
|
||||
int inextnode = (inode == nbFaceNodes) ? 1 : inode + 1;
|
||||
const SMDS_MeshNode* nextNode = myPolyedre->GetFaceNode(iface, inextnode);
|
||||
|
||||
if ((curNode == theNode1 && nextNode == theNode2) ||
|
||||
(curNode == theNode2 && nextNode == theNode1)) {
|
||||
isLinked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isLinked;
|
||||
}
|
||||
|
||||
// find nodes indices
|
||||
int i1 = -1, i2 = -1;
|
||||
for ( int i = 0; i < myVolumeNbNodes; i++ ) {
|
||||
@ -562,6 +663,10 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
|
||||
bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
|
||||
const int theNode2Index) const
|
||||
{
|
||||
if (myVolume->IsPoly()) {
|
||||
return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
|
||||
}
|
||||
|
||||
int minInd = theNode1Index < theNode2Index ? theNode1Index : theNode2Index;
|
||||
int maxInd = theNode1Index < theNode2Index ? theNode2Index : theNode1Index;
|
||||
|
||||
@ -617,7 +722,6 @@ int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsFreeFace
|
||||
//purpose : check that only one volume is build on the face nodes
|
||||
@ -626,11 +730,12 @@ int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
|
||||
bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
||||
{
|
||||
const int free = true;
|
||||
if ( !setFace( faceIndex ))
|
||||
|
||||
if (!setFace( faceIndex ))
|
||||
return !free;
|
||||
|
||||
const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
|
||||
int nbFaceNodes = NbFaceNodes( faceIndex );
|
||||
int nbFaceNodes = myFaceNbNodes;
|
||||
|
||||
// evaluate nb of face nodes shared by other volume
|
||||
int maxNbShared = -1;
|
||||
@ -706,7 +811,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
|
||||
// check traingle parts 1 & 3
|
||||
if ( isShared[1] && isShared[3] )
|
||||
return !free; // is not free
|
||||
// check traingle parts 0 & 2;
|
||||
// check triangle parts 0 & 2;
|
||||
// 0 part could not be checked in the loop; check it here
|
||||
if ( isShared[2] && prevLinkShared &&
|
||||
volume.IsLinked( nodes[ 0 ], nodes[ 1 ] ) &&
|
||||
@ -741,7 +846,7 @@ int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes
|
||||
//purpose : Return index of a face formed by theFaceNodes
|
||||
//=======================================================================
|
||||
|
||||
int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
|
||||
/*int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
|
||||
{
|
||||
for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
|
||||
const int* nodes = GetFaceNodesIndices( iFace );
|
||||
@ -753,7 +858,7 @@ int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
|
||||
return iFace;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
//=======================================================================
|
||||
//function : setFace
|
||||
@ -768,44 +873,163 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
|
||||
if ( myCurFace == faceIndex )
|
||||
return true;
|
||||
|
||||
myCurFace = -1;
|
||||
|
||||
if ( faceIndex < 0 || faceIndex >= NbFaces() )
|
||||
return false;
|
||||
|
||||
// choose face node indices
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 4:
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
|
||||
break;
|
||||
case 5:
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
|
||||
break;
|
||||
case 6:
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
|
||||
break;
|
||||
case 8:
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = Hexa_F[ faceIndex ];
|
||||
break;
|
||||
default: return false;
|
||||
if (myFaceNodes != NULL) {
|
||||
delete [] myFaceNodes;
|
||||
myFaceNodes = NULL;
|
||||
}
|
||||
|
||||
// set face nodes
|
||||
int iNode, nbNode = myFaceNbNodes[ faceIndex ];
|
||||
for ( iNode = 0; iNode <= nbNode; iNode++ )
|
||||
myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
|
||||
if (myVolume->IsPoly()) {
|
||||
if (!myPolyedre) {
|
||||
MESSAGE("Warning: bad volumic element");
|
||||
return false;
|
||||
}
|
||||
|
||||
// check orientation
|
||||
bool isGoodOri = true;
|
||||
if (myExternalFaces) {
|
||||
// get natural orientation
|
||||
XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
|
||||
SMDS_VolumeTool vTool (myPolyedre);
|
||||
vTool.GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
|
||||
vTool.GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
|
||||
XYZ insideVec (baryCenter - p0);
|
||||
if (insideVec.Dot(aNormal) > 0)
|
||||
isGoodOri = false;
|
||||
}
|
||||
|
||||
// set face nodes
|
||||
int iNode;
|
||||
myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1);
|
||||
myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
|
||||
if (isGoodOri) {
|
||||
for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
|
||||
myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1);
|
||||
} else {
|
||||
for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
|
||||
myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, myFaceNbNodes - iNode);
|
||||
}
|
||||
myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
|
||||
|
||||
} else {
|
||||
// choose face node indices
|
||||
switch ( myVolumeNbNodes ) {
|
||||
case 4:
|
||||
myFaceNbNodes = Tetra_nbN[ faceIndex ];
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
|
||||
break;
|
||||
case 5:
|
||||
myFaceNbNodes = Pyramid_nbN[ faceIndex ];
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
|
||||
break;
|
||||
case 6:
|
||||
myFaceNbNodes = Penta_nbN[ faceIndex ];
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
|
||||
break;
|
||||
case 8:
|
||||
myFaceNbNodes = Hexa_nbN[ faceIndex ];
|
||||
if ( myExternalFaces )
|
||||
myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
|
||||
else
|
||||
myFaceNodeIndices = Hexa_F[ faceIndex ];
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// set face nodes
|
||||
myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
|
||||
for ( int iNode = 0; iNode <= myFaceNbNodes; iNode++ )
|
||||
myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
|
||||
}
|
||||
|
||||
myCurFace = faceIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetType
|
||||
//purpose : return VolumeType by nb of nodes in a volume
|
||||
//=======================================================================
|
||||
|
||||
SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
|
||||
{
|
||||
switch ( nbNodes ) {
|
||||
case 4: return TETRA;
|
||||
case 5: return PYRAM;
|
||||
case 6: return PENTA;
|
||||
case 8: return HEXA;
|
||||
default:return UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaces
|
||||
//purpose : return nb of faces by volume type
|
||||
//=======================================================================
|
||||
|
||||
int SMDS_VolumeTool::NbFaces( VolumeType type )
|
||||
{
|
||||
switch ( type ) {
|
||||
case TETRA: return 4;
|
||||
case PYRAM: return 5;
|
||||
case PENTA: return 5;
|
||||
case HEXA : return 6;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceNodesIndices
|
||||
//purpose : Return the array of face nodes indices
|
||||
// To comfort link iteration, the array
|
||||
// length == NbFaceNodes( faceIndex ) + 1 and
|
||||
// the last node index == the first one.
|
||||
//=======================================================================
|
||||
|
||||
const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
|
||||
int faceIndex,
|
||||
bool external)
|
||||
{
|
||||
switch ( type ) {
|
||||
case TETRA: return Tetra_F[ faceIndex ];
|
||||
case PYRAM: return Pyramid_F[ faceIndex ];
|
||||
case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
|
||||
case HEXA: return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
|
||||
default:;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaceNodes
|
||||
//purpose : Return number of nodes in the array of face nodes
|
||||
//=======================================================================
|
||||
|
||||
int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
|
||||
int faceIndex )
|
||||
{
|
||||
switch ( type ) {
|
||||
case TETRA: return Tetra_nbN[ faceIndex ];
|
||||
case PYRAM: return Pyramid_nbN[ faceIndex ];
|
||||
case PENTA: return Penta_nbN[ faceIndex ];
|
||||
case HEXA: return Hexa_nbN[ faceIndex ];
|
||||
default:;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
class SMDS_MeshElement;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_PolyhedralVolumeOfNodes;
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
@ -149,26 +150,52 @@ class SMDS_VolumeTool
|
||||
// Return index of a face formed by theFaceNodes.
|
||||
// Return -1 if a face not found
|
||||
|
||||
int GetFaceIndex( const std::set<int>& theFaceNodesIndices );
|
||||
//int GetFaceIndex( const std::set<int>& theFaceNodesIndices );
|
||||
// Return index of a face formed by theFaceNodesIndices
|
||||
// Return -1 if a face not found
|
||||
|
||||
// ------------------------
|
||||
// static methods for faces
|
||||
// ------------------------
|
||||
|
||||
enum VolumeType { UNKNOWN, TETRA, PYRAM, PENTA, HEXA };
|
||||
|
||||
static VolumeType GetType(int nbNodes);
|
||||
// return VolumeType by nb of nodes in a volume
|
||||
|
||||
static int NbFaces( VolumeType type );
|
||||
// return nb of faces by volume type
|
||||
|
||||
static const int* GetFaceNodesIndices(VolumeType type,
|
||||
int faceIndex,
|
||||
bool external);
|
||||
// Return the array of face nodes indices
|
||||
// To comfort link iteration, the array
|
||||
// length == NbFaceNodes( faceIndex ) + 1 and
|
||||
// the last node index == the first one.
|
||||
|
||||
static int NbFaceNodes(VolumeType type,
|
||||
int faceIndex );
|
||||
// Return number of nodes in the array of face nodes
|
||||
|
||||
private:
|
||||
|
||||
bool setFace( int faceIndex );
|
||||
|
||||
const SMDS_MeshElement* myVolume;
|
||||
const SMDS_PolyhedralVolumeOfNodes* myPolyedre;
|
||||
|
||||
bool myVolForward;
|
||||
int myNbFaces;
|
||||
int myVolumeNbNodes;
|
||||
const SMDS_MeshNode* myVolumeNodes[ 8 ];
|
||||
const SMDS_MeshNode** myVolumeNodes;
|
||||
|
||||
bool myExternalFaces;
|
||||
int* myFaceNodeIndices;
|
||||
int* myFaceNbNodes;
|
||||
const SMDS_MeshNode* myFaceNodes[ 5 ];
|
||||
|
||||
int myCurFace;
|
||||
int myFaceNbNodes;
|
||||
int* myFaceNodeIndices;
|
||||
const SMDS_MeshNode** myFaceNodes;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -79,7 +79,7 @@ static int MYDEBUG = 0;
|
||||
SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Document * myDocument)
|
||||
: _groupId( 0 )
|
||||
{
|
||||
INFOS("SMESH_Mesh::SMESH_Mesh; this = "<<this);
|
||||
INFOS("SMESH_Mesh::SMESH_Mesh(int localId)");
|
||||
_id = localId;
|
||||
_studyId = studyId;
|
||||
_gen = gen;
|
||||
@ -97,7 +97,7 @@ SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Docume
|
||||
|
||||
SMESH_Mesh::~SMESH_Mesh()
|
||||
{
|
||||
INFOS("SMESH_Mesh::~SMESH_Mesh; this = "<<this);
|
||||
INFOS("SMESH_Mesh::~SMESH_Mesh");
|
||||
|
||||
// delete groups
|
||||
map < int, SMESH_Group * >::iterator itg;
|
||||
@ -660,6 +660,24 @@ throw(SALOME_Exception)
|
||||
return aSubMesh;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Get the SMESH_subMesh object implementation. Dont create it, return null
|
||||
* if it does not exist.
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
|
||||
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.find(aShapeID);
|
||||
if (i_sm == _mapSubMesh.end())
|
||||
return NULL;
|
||||
return i_sm->second;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUsedHypothesis
|
||||
//purpose : Return True if anHyp is used to mesh aSubShape
|
||||
@ -833,7 +851,12 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
|
||||
int Nb = 0;
|
||||
|
||||
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
|
||||
while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
|
||||
//while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
|
||||
const SMDS_MeshFace * curFace;
|
||||
while (itFaces->more()) {
|
||||
curFace = itFaces->next();
|
||||
if (!curFace->IsPoly() && curFace->NbNodes() == 3) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -846,7 +869,25 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
|
||||
int Nb = 0;
|
||||
|
||||
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
|
||||
while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
|
||||
//while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
|
||||
const SMDS_MeshFace * curFace;
|
||||
while (itFaces->more()) {
|
||||
curFace = itFaces->next();
|
||||
if (!curFace->IsPoly() && curFace->NbNodes() == 4) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Return the number of polygonal faces in the mesh. This method run in O(n)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMESH_Mesh::NbPolygons() throw(SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_FaceIteratorPtr itFaces = _myMeshDS->facesIterator();
|
||||
while (itFaces->more())
|
||||
if (itFaces->next()->IsPoly()) Nb++;
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -866,7 +907,12 @@ int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
|
||||
//while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
|
||||
const SMDS_MeshVolume * curVolume;
|
||||
while (itVolumes->more()) {
|
||||
curVolume = itVolumes->next();
|
||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 4) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -875,7 +921,12 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
|
||||
//while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
|
||||
const SMDS_MeshVolume * curVolume;
|
||||
while (itVolumes->more()) {
|
||||
curVolume = itVolumes->next();
|
||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 8) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -884,7 +935,12 @@ int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
|
||||
//while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
|
||||
const SMDS_MeshVolume * curVolume;
|
||||
while (itVolumes->more()) {
|
||||
curVolume = itVolumes->next();
|
||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 5) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -893,7 +949,22 @@ int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
|
||||
//while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
|
||||
const SMDS_MeshVolume * curVolume;
|
||||
while (itVolumes->more()) {
|
||||
curVolume = itVolumes->next();
|
||||
if (!curVolume->IsPoly() && curVolume->NbNodes() == 6) Nb++;
|
||||
}
|
||||
return Nb;
|
||||
}
|
||||
|
||||
int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
int Nb = 0;
|
||||
SMDS_VolumeIteratorPtr itVolumes = _myMeshDS->volumesIterator();
|
||||
while (itVolumes->more())
|
||||
if (itVolumes->next()->IsPoly()) Nb++;
|
||||
return Nb;
|
||||
}
|
||||
|
||||
@ -992,8 +1063,8 @@ void SMESH_Mesh::RemoveGroup (const int theGroupID)
|
||||
if (_mapGroup.find(theGroupID) == _mapGroup.end())
|
||||
return;
|
||||
GetMeshDS()->RemoveGroup( _mapGroup[theGroupID]->GetGroupDS() );
|
||||
delete _mapGroup[theGroupID];
|
||||
_mapGroup.erase (theGroupID);
|
||||
delete _mapGroup[theGroupID];
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -129,6 +129,9 @@ public:
|
||||
SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
SMESH_subMesh *GetSubMeshContaining(const int aShapeID)
|
||||
throw(SALOME_Exception);
|
||||
|
||||
const list < SMESH_subMesh * >&
|
||||
GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
|
||||
throw(SALOME_Exception);
|
||||
@ -166,6 +169,8 @@ public:
|
||||
|
||||
int NbQuadrangles() throw(SALOME_Exception);
|
||||
|
||||
int NbPolygons() throw(SALOME_Exception);
|
||||
|
||||
int NbVolumes() throw(SALOME_Exception);
|
||||
|
||||
int NbTetras() throw(SALOME_Exception);
|
||||
@ -176,6 +181,8 @@ public:
|
||||
|
||||
int NbPrisms() throw(SALOME_Exception);
|
||||
|
||||
int NbPolyhedrons() throw(SALOME_Exception);
|
||||
|
||||
int NbSubMesh() throw(SALOME_Exception);
|
||||
|
||||
int NbGroup() const { return _mapGroup.size(); }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -98,13 +98,16 @@ class SMESH_MeshEditor {
|
||||
std::set<const SMDS_MeshNode*> & theFixedNodes,
|
||||
const SmoothMethod theSmoothMethod,
|
||||
const int theNbIterations,
|
||||
double theTgtAspectRatio = 1.0);
|
||||
double theTgtAspectRatio = 1.0,
|
||||
const bool the2D = true);
|
||||
// Smooth theElements using theSmoothMethod during theNbIterations
|
||||
// or until a worst element has aspect ratio <= theTgtAspectRatio.
|
||||
// Aspect Ratio varies in range [1.0, inf].
|
||||
// If theElements is empty, the whole mesh is smoothed.
|
||||
// theFixedNodes contains additionally fixed nodes. Nodes built
|
||||
// on edges and boundary nodes are always fixed.
|
||||
// If the2D, smoothing is performed using UV parameters of nodes
|
||||
// on geometrical faces
|
||||
|
||||
|
||||
void RotationSweep (std::set<const SMDS_MeshElement*> & theElements,
|
||||
@ -154,6 +157,12 @@ class SMESH_MeshEditor {
|
||||
// Return list of group of nodes close to each other within theTolerance.
|
||||
// Search among theNodes or in the whole mesh if theNodes is empty.
|
||||
|
||||
int SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
|
||||
vector<const SMDS_MeshNode *>& poly_nodes,
|
||||
vector<int>& quantities) const;
|
||||
// Split face, defined by <faceNodes>, into several faces by repeating nodes.
|
||||
// Is used by MergeNodes()
|
||||
|
||||
void MergeNodes (TListOfListOfNodes & theNodeGroups);
|
||||
// In each group, the cdr of nodes are substituted by the first one
|
||||
// in all elements.
|
||||
@ -189,7 +198,9 @@ class SMESH_MeshEditor {
|
||||
const SMDS_MeshNode* theSide2FirstNode,
|
||||
const SMDS_MeshNode* theSide2SecondNode,
|
||||
const SMDS_MeshNode* theSide2ThirdNode = 0,
|
||||
bool theSide2IsFreeBorder = true);
|
||||
const bool theSide2IsFreeBorder = true,
|
||||
const bool toCreatePolygons = false,
|
||||
const bool toCreatePolyedrs = false);
|
||||
// Sew the free border to the side2 by replacing nodes in
|
||||
// elements on the free border with nodes of the elements
|
||||
// of the side 2. If nb of links in the free border and
|
||||
@ -226,20 +237,27 @@ class SMESH_MeshEditor {
|
||||
void InsertNodesIntoLink(const SMDS_MeshElement* theFace,
|
||||
const SMDS_MeshNode* theBetweenNode1,
|
||||
const SMDS_MeshNode* theBetweenNode2,
|
||||
std::list<const SMDS_MeshNode*>& theNodesToInsert);
|
||||
// insert theNodesToInsert into theFace between theBetweenNode1
|
||||
// and theBetweenNode2 and split theElement.
|
||||
std::list<const SMDS_MeshNode*>& theNodesToInsert,
|
||||
const bool toCreatePoly = false);
|
||||
// insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
|
||||
// If toCreatePoly is true, replace theFace by polygon, else split theFace.
|
||||
|
||||
static int SortQuadNodes (const SMDS_Mesh * theMesh,
|
||||
int theNodeIds[] );
|
||||
// Set 4 nodes of a quadrangle face in a good order.
|
||||
// Swap 1<->2 or 2<->3 nodes and correspondingly return
|
||||
// 1 or 2 else 0.
|
||||
void UpdateVolumes (const SMDS_MeshNode* theBetweenNode1,
|
||||
const SMDS_MeshNode* theBetweenNode2,
|
||||
std::list<const SMDS_MeshNode*>& theNodesToInsert);
|
||||
// insert theNodesToInsert into all volumes, containing link
|
||||
// theBetweenNode1 - theBetweenNode2, between theBetweenNode1 and theBetweenNode2.
|
||||
|
||||
static bool SortHexaNodes (const SMDS_Mesh * theMesh,
|
||||
int theNodeIds[] );
|
||||
// Set 8 nodes of a hexahedron in a good order.
|
||||
// Return success status
|
||||
// static int SortQuadNodes (const SMDS_Mesh * theMesh,
|
||||
// int theNodeIds[] );
|
||||
// // Set 4 nodes of a quadrangle face in a good order.
|
||||
// // Swap 1<->2 or 2<->3 nodes and correspondingly return
|
||||
// // 1 or 2 else 0.
|
||||
//
|
||||
// static bool SortHexaNodes (const SMDS_Mesh * theMesh,
|
||||
// int theNodeIds[] );
|
||||
// // Set 8 nodes of a hexahedron in a good order.
|
||||
// // Return success status
|
||||
|
||||
static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
|
||||
const SMDS_MeshElement* elemInGroups,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -100,9 +100,9 @@ class SMESH_Pattern {
|
||||
// the loaded pattern to <theFace>. The first key-point
|
||||
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
|
||||
|
||||
bool Apply (std::set<const SMDS_MeshFace*> theFaces,
|
||||
const int theNodeIndexOnKeyPoint1,
|
||||
const bool theReverse);
|
||||
bool Apply (std::set<const SMDS_MeshFace*>& theFaces,
|
||||
const int theNodeIndexOnKeyPoint1,
|
||||
const bool theReverse);
|
||||
// Compute nodes coordinates applying
|
||||
// the loaded pattern to <theFaces>. The first key-point
|
||||
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
|
||||
@ -116,9 +116,9 @@ class SMESH_Pattern {
|
||||
// (0,0,1) key-point will be mapped into <theNode000Index>-th
|
||||
// node.
|
||||
|
||||
bool Apply (std::set<const SMDS_MeshVolume*> theVolumes,
|
||||
const int theNode000Index,
|
||||
const int theNode001Index);
|
||||
bool Apply (std::set<const SMDS_MeshVolume*>& theVolumes,
|
||||
const int theNode000Index,
|
||||
const int theNode001Index);
|
||||
// Compute nodes coordinates applying
|
||||
// the loaded pattern to <theVolumes>. The (0,0,0) key-point
|
||||
// will be mapped into <theNode000Index>-th node. The
|
||||
@ -128,7 +128,9 @@ class SMESH_Pattern {
|
||||
bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
|
||||
// Return nodes coordinates computed by Apply() method
|
||||
|
||||
bool MakeMesh(SMESH_Mesh* theMesh);
|
||||
bool MakeMesh(SMESH_Mesh* theMesh,
|
||||
const bool toCreatePolygons = false,
|
||||
const bool toCreatePolyedrs = false);
|
||||
// Create nodes and elements in <theMesh> using nodes
|
||||
// coordinates computed by either of Apply...() methods
|
||||
|
||||
@ -271,41 +273,80 @@ class SMESH_Pattern {
|
||||
// are appended to theEdgesPointsList
|
||||
|
||||
typedef std::set<const SMDS_MeshNode*> TNodeSet;
|
||||
void mergePoints (std::map<TNodeSet,std::list<std::list<int> > >& xyzIndGroups,
|
||||
std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
|
||||
// Look for coincident points between myXYZs indexed with
|
||||
// list<int> of each element of xyzIndGroups. Coincident indices
|
||||
// are merged in myElemXYZIDs using reverseConnectivity.
|
||||
|
||||
void mergePoints (const bool uniteGroups);
|
||||
// Merge XYZ on edges and/or faces.
|
||||
|
||||
void makePolyElements(const std::vector< const SMDS_MeshNode* >& theNodes,
|
||||
const bool toCreatePolygons,
|
||||
const bool toCreatePolyedrs);
|
||||
// prepare intermediate data to create Polygons and Polyhedrons
|
||||
|
||||
void createElements(SMESH_Mesh* theMesh,
|
||||
const std::vector<const SMDS_MeshNode* >& theNodesVector,
|
||||
const std::list< std::list< int > > & theElemNodeIDs,
|
||||
const std::vector<const SMDS_MeshElement*>& theElements);
|
||||
// add elements to the mesh
|
||||
|
||||
bool getFacesDefinition(const SMDS_MeshNode** theBndNodes,
|
||||
const int theNbBndNodes,
|
||||
const std::vector< const SMDS_MeshNode* >& theNodes,
|
||||
std::list< int >& theFaceDefs,
|
||||
std::vector<int>& theQuantity);
|
||||
// fill faces definition for a volume face defined by theBndNodes
|
||||
// return true if a face definition changes
|
||||
|
||||
|
||||
bool isReversed(const SMDS_MeshNode* theFirstNode,
|
||||
const std::list< int >& theIdsList) const;
|
||||
// check xyz ids order in theIdsList taking into account
|
||||
// theFirstNode on a link
|
||||
|
||||
private:
|
||||
// fields
|
||||
|
||||
bool myIs2D;
|
||||
std::vector< TPoint > myPoints;
|
||||
std::list< int > myKeyPointIDs;
|
||||
std::list< std::list< int > > myElemPointIDs;
|
||||
typedef std::list< int > TElemDef; // element definition is its nodes ids
|
||||
|
||||
ErrorCode myErrorCode;
|
||||
bool myIsComputed;
|
||||
bool myIsBoundaryPointsFound;
|
||||
bool myIs2D;
|
||||
std::vector< TPoint > myPoints;
|
||||
std::list< int > myKeyPointIDs;
|
||||
std::list< TElemDef > myElemPointIDs;
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
ErrorCode myErrorCode;
|
||||
bool myIsComputed;
|
||||
bool myIsBoundaryPointsFound;
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
// all functions assure that shapes are indexed so that first go
|
||||
// ordered vertices, then ordered edge, then faces and maybe a shell
|
||||
TopTools_IndexedMapOfOrientedShape myShapeIDMap;
|
||||
//TopTools_IndexedMapOfShape myShapeIDMap;
|
||||
std::map< int, list< TPoint* > > myShapeIDToPointsMap;
|
||||
TopTools_IndexedMapOfOrientedShape myShapeIDMap;
|
||||
std::map< int, list< TPoint* > > myShapeIDToPointsMap;
|
||||
|
||||
// for the 2d case:
|
||||
// nb of key-points in each of pattern boundaries
|
||||
std::list< int > myNbKeyPntInBoundary;
|
||||
std::list< int > myNbKeyPntInBoundary;
|
||||
|
||||
|
||||
// to compute while applying to mesh elements, not to shapes
|
||||
std::vector<gp_XYZ> myXYZ;
|
||||
std::list< std::list< int > > myElemXYZIDs;
|
||||
std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map id to node of a refined element
|
||||
std::vector<const SMDS_MeshElement*> myElements; // refined elements
|
||||
std::vector<const SMDS_MeshNode*> myOrderedNodes;
|
||||
|
||||
std::vector<gp_XYZ> myXYZ; // XYZ of nodes to create
|
||||
std::list< TElemDef > myElemXYZIDs; // new elements definitions
|
||||
std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map XYZ id to node of a refined element
|
||||
std::vector<const SMDS_MeshElement*> myElements; // refined elements
|
||||
std::vector<const SMDS_MeshNode*> myOrderedNodes;
|
||||
|
||||
// elements to replace with polygon or polyhedron
|
||||
std::vector<const SMDS_MeshElement*> myPolyElems;
|
||||
// definitions of new poly elements
|
||||
std::list< TElemDef > myPolyElemXYZIDs;
|
||||
std::list< std::vector<int> > myPolyhedronQuantities;
|
||||
|
||||
// map a boundary to XYZs on it;
|
||||
// a boundary (edge or face) is defined as a set of its nodes,
|
||||
// XYZs on a boundary are indices of myXYZ s
|
||||
std::map<TNodeSet,std::list<std::list<int> > > myIdsOnBoundary;
|
||||
// map XYZ id to element it is in
|
||||
std::map< int, std::list< TElemDef* > > myReverseConnectivity;
|
||||
};
|
||||
|
||||
|
||||
|
@ -792,18 +792,21 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
ASSERT(algo);
|
||||
if (!algo->CheckHypothesis((*_father),_subShape, ret ))
|
||||
{
|
||||
//two applying algo on the same shape not allowed
|
||||
_meshDS->RemoveHypothesis(_subShape, anHyp);
|
||||
if ( !SMESH_Hypothesis::IsStatusFatal( ret ))
|
||||
// ret should be fatal: anHyp was not added
|
||||
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
|
||||
}
|
||||
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
|
||||
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
|
||||
|
||||
if (SMESH_Hypothesis::IsStatusFatal( ret ))
|
||||
else if (SMESH_Hypothesis::IsStatusFatal( ret ))
|
||||
{
|
||||
MESSAGE("do not add extra hypothesis");
|
||||
_meshDS->RemoveHypothesis(_subShape, anHyp);
|
||||
}
|
||||
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
|
||||
{
|
||||
_meshDS->RemoveHypothesis(_subShape, anHyp);
|
||||
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
modifiedHyp = true;
|
||||
@ -812,19 +815,11 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
}
|
||||
case ADD_ALGO: { //already existing algo : on father ?
|
||||
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
|
||||
// check if algo changes
|
||||
SMESH_HypoFilter f;
|
||||
f.Init( SMESH_HypoFilter::IsAlgo() );
|
||||
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
||||
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
||||
const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true );
|
||||
if (prevAlgo &&
|
||||
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
SetAlgoState(HYP_OK);
|
||||
else
|
||||
SetAlgoState(MISSING_HYP);
|
||||
modifiedHyp = true;
|
||||
break;
|
||||
}
|
||||
case REMOVE_HYP: {
|
||||
@ -845,13 +840,13 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
|
||||
// check if algo remains
|
||||
if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
SetAlgoState(HYP_OK);
|
||||
else
|
||||
SetAlgoState(MISSING_HYP);
|
||||
// check if same algo remains
|
||||
if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -860,6 +855,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
ASSERT(algo);
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
{
|
||||
SetAlgoState(HYP_OK);
|
||||
if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp
|
||||
modifiedHyp = true;
|
||||
}
|
||||
@ -867,35 +863,27 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
SetAlgoState(MISSING_HYP);
|
||||
break;
|
||||
}
|
||||
case ADD_FATHER_ALGO: {
|
||||
case ADD_FATHER_ALGO: { // a new algo on father
|
||||
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
|
||||
if ( algo == anHyp ) { // a new algo on father
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
|
||||
// check if algo changes
|
||||
SMESH_HypoFilter f;
|
||||
f.Init( SMESH_HypoFilter::IsAlgo() );
|
||||
f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
|
||||
f.AndNot( SMESH_HypoFilter::Is( algo ));
|
||||
const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true );
|
||||
if (prevAlgo &&
|
||||
string(algo->GetName()) != string(prevAlgo->GetName()) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
if ( algo == anHyp ) {
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
SetAlgoState(HYP_OK);
|
||||
else
|
||||
SetAlgoState(MISSING_HYP);
|
||||
modifiedHyp = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case REMOVE_FATHER_HYP: {
|
||||
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
|
||||
ASSERT(algo);
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
|
||||
// is there the same local hyp or maybe a new father algo applied?
|
||||
if ( !GetSimilarAttached( _subShape, anHyp ) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
SetAlgoState(HYP_OK);
|
||||
else
|
||||
SetAlgoState(MISSING_HYP);
|
||||
// is there the same local hyp or maybe a new father algo applied?
|
||||
if ( !GetSimilarAttached( _subShape, anHyp ) )
|
||||
modifiedHyp = true;
|
||||
break;
|
||||
}
|
||||
case REMOVE_FATHER_ALGO: {
|
||||
@ -906,13 +894,13 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
|
||||
// check if algo changes
|
||||
if ( string(algo->GetName()) != string( anHyp->GetName()) )
|
||||
modifiedHyp = true;
|
||||
}
|
||||
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
|
||||
SetAlgoState(HYP_OK);
|
||||
else
|
||||
SetAlgoState(MISSING_HYP);
|
||||
// is there the same local algo or maybe a new father algo applied?
|
||||
if ( !GetSimilarAttached( _subShape, anHyp ))
|
||||
modifiedHyp = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1047,7 +1035,7 @@ void SMESH_subMesh::CleanDependsOn()
|
||||
for (its = dependson.begin(); its != dependson.end(); its++)
|
||||
{
|
||||
SMESH_subMesh *sm = (*its).second;
|
||||
//SCRUTE((*its).first);
|
||||
// SCRUTE((*its).first);
|
||||
sm->ComputeStateEngine(CLEAN);
|
||||
}
|
||||
}
|
||||
@ -1497,21 +1485,21 @@ void SMESH_subMesh::UpdateDependantsState(const compute_event theEvent)
|
||||
|
||||
void SMESH_subMesh::CleanDependants()
|
||||
{
|
||||
//MESSAGE("SMESH_subMesh::CleanDependants: shape type " << _subShape.ShapeType() );
|
||||
|
||||
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
|
||||
for (; it.More(); it.Next())
|
||||
{
|
||||
const TopoDS_Shape& ancestor = it.Value();
|
||||
// PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEANDEP)
|
||||
// will erase mesh on other shapes in a compound
|
||||
if ( ancestor.ShapeType() >= TopAbs_SOLID ) {
|
||||
SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
|
||||
if (aSubMesh)
|
||||
aSubMesh->ComputeStateEngine(CLEANDEP);
|
||||
}
|
||||
//MESSAGE("ancestor shape type " << ancestor.ShapeType() );
|
||||
SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
|
||||
if (aSubMesh)
|
||||
aSubMesh->ComputeStateEngine(CLEANDEP);
|
||||
}
|
||||
ComputeStateEngine(CLEAN);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
|
@ -224,6 +224,57 @@ void SMESHDS_Command::AddVolume(int NewVolID,
|
||||
myNumber++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolygonalFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Command::AddPolygonalFace (const int ElementID,
|
||||
std::vector<int> nodes_ids)
|
||||
{
|
||||
if (!myType == SMESHDS_AddPolygon) {
|
||||
MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type");
|
||||
return;
|
||||
}
|
||||
myIntegers.push_back(ElementID);
|
||||
|
||||
int i, nbNodes = nodes_ids.size();
|
||||
myIntegers.push_back(nbNodes);
|
||||
for (i = 0; i < nbNodes; i++) {
|
||||
myIntegers.push_back(nodes_ids[i]);
|
||||
}
|
||||
|
||||
myNumber++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolyhedralVolume
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Command::AddPolyhedralVolume (const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
if (!myType == SMESHDS_AddPolyhedron) {
|
||||
MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type");
|
||||
return;
|
||||
}
|
||||
myIntegers.push_back(ElementID);
|
||||
|
||||
int i, nbNodes = nodes_ids.size();
|
||||
myIntegers.push_back(nbNodes);
|
||||
for (i = 0; i < nbNodes; i++) {
|
||||
myIntegers.push_back(nodes_ids[i]);
|
||||
}
|
||||
|
||||
int nbFaces = quantities.size();
|
||||
myIntegers.push_back(nbFaces);
|
||||
for (i = 0; i < nbFaces; i++) {
|
||||
myIntegers.push_back(quantities[i]);
|
||||
}
|
||||
|
||||
myNumber++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@ -263,7 +314,7 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
|
||||
{
|
||||
if (!myType == SMESHDS_ChangeElementNodes)
|
||||
{
|
||||
MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
|
||||
MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type");
|
||||
return;
|
||||
}
|
||||
myIntegers.push_back(ElementID);
|
||||
@ -274,6 +325,36 @@ void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes
|
||||
myNumber++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePolyhedronNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Command::ChangePolyhedronNodes (const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
if (myType != SMESHDS_ChangePolyhedronNodes)
|
||||
{
|
||||
MESSAGE("SMESHDS_Command::ChangePolyhedronNodes : Bad Type");
|
||||
return;
|
||||
}
|
||||
myIntegers.push_back(ElementID);
|
||||
|
||||
int i, nbNodes = nodes_ids.size();
|
||||
myIntegers.push_back(nbNodes);
|
||||
for (i = 0; i < nbNodes; i++) {
|
||||
myIntegers.push_back(nodes_ids[i]);
|
||||
}
|
||||
|
||||
int nbFaces = quantities.size();
|
||||
myIntegers.push_back(nbFaces);
|
||||
for (i = 0; i < nbFaces; i++) {
|
||||
myIntegers.push_back(quantities[i]);
|
||||
}
|
||||
|
||||
myNumber++;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Renumber
|
||||
//purpose :
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "SMESHDS_CommandType.hxx"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class SMESHDS_Command
|
||||
{
|
||||
@ -48,10 +49,18 @@ class SMESHDS_Command
|
||||
int idnode4, int idnode5, int idnode6);
|
||||
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
|
||||
void AddPolygonalFace (const int ElementID,
|
||||
std::vector<int> nodes_ids);
|
||||
void AddPolyhedralVolume (const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities);
|
||||
void MoveNode(int NewNodeID, double x, double y, double z);
|
||||
void RemoveNode(int NodeID);
|
||||
void RemoveElement(int ElementID);
|
||||
void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
|
||||
void ChangePolyhedronNodes(const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities);
|
||||
void Renumber (const bool isNodes, const int startID, const int deltaID);
|
||||
SMESHDS_CommandType GetType();
|
||||
int GetNumber();
|
||||
|
@ -34,14 +34,17 @@ enum SMESHDS_CommandType {
|
||||
SMESHDS_AddEdge,
|
||||
SMESHDS_AddTriangle,
|
||||
SMESHDS_AddQuadrangle,
|
||||
SMESHDS_AddPolygon,
|
||||
SMESHDS_AddTetrahedron,
|
||||
SMESHDS_AddPyramid,
|
||||
SMESHDS_AddPrism,
|
||||
SMESHDS_AddHexahedron,
|
||||
SMESHDS_AddPolyhedron,
|
||||
SMESHDS_RemoveNode,
|
||||
SMESHDS_RemoveElement,
|
||||
SMESHDS_MoveNode,
|
||||
SMESHDS_ChangeElementNodes,
|
||||
SMESHDS_ChangePolyhedronNodes,
|
||||
SMESHDS_Renumber
|
||||
};
|
||||
|
||||
|
@ -171,8 +171,9 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
|
||||
return false;
|
||||
|
||||
ASSERT( nbnodes < 9 );
|
||||
int i, IDs[ 8 ];
|
||||
//ASSERT( nbnodes < 9 );
|
||||
//int i, IDs[ 8 ];
|
||||
int i, IDs[ nbnodes ];
|
||||
for ( i = 0; i < nbnodes; i++ )
|
||||
IDs [ i ] = nodes[ i ]->GetID();
|
||||
myScript->ChangeElementNodes( elem->GetID(), IDs, nbnodes);
|
||||
@ -180,6 +181,49 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePolygonNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMESHDS_Mesh::ChangePolygonNodes
|
||||
(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes)
|
||||
{
|
||||
ASSERT(nodes.size() > 3);
|
||||
|
||||
int nb = nodes.size();
|
||||
const SMDS_MeshNode* nodes_array [nb];
|
||||
for (int inode = 0; inode < nb; inode++) {
|
||||
nodes_array[inode] = nodes[inode];
|
||||
}
|
||||
|
||||
return ChangeElementNodes(elem, nodes_array, nb);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePolyhedronNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMESHDS_Mesh::ChangePolyhedronNodes
|
||||
(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
ASSERT(nodes.size() > 3);
|
||||
|
||||
if (!SMDS_Mesh::ChangePolyhedronNodes(elem, nodes, quantities))
|
||||
return false;
|
||||
|
||||
int i, len = nodes.size();
|
||||
std::vector<int> nodes_ids (len);
|
||||
for (i = 0; i < len; i++) {
|
||||
nodes_ids[i] = nodes[i]->GetID();
|
||||
}
|
||||
myScript->ChangePolyhedronNodes(elem->GetID(), nodes_ids, quantities);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Renumber
|
||||
//purpose :
|
||||
@ -472,6 +516,100 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
n8->GetID());
|
||||
return anElem;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolygonalFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID);
|
||||
if (anElem) {
|
||||
myScript->AddPolygonalFace(ID, nodes_ids);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
|
||||
if (anElem) {
|
||||
int i, len = nodes.size();
|
||||
std::vector<int> nodes_ids (len);
|
||||
for (i = 0; i < len; i++) {
|
||||
nodes_ids[i] = nodes[i]->GetID();
|
||||
}
|
||||
myScript->AddPolygonalFace(ID, nodes_ids);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace
|
||||
(std::vector<const SMDS_MeshNode*> nodes)
|
||||
{
|
||||
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes);
|
||||
if (anElem) {
|
||||
int i, len = nodes.size();
|
||||
std::vector<int> nodes_ids (len);
|
||||
for (i = 0; i < len; i++) {
|
||||
nodes_ids[i] = nodes[i]->GetID();
|
||||
}
|
||||
myScript->AddPolygonalFace(anElem->GetID(), nodes_ids);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolyhedralVolume
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID);
|
||||
if (anElem) {
|
||||
myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities,
|
||||
const int ID)
|
||||
{
|
||||
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
|
||||
if (anElem) {
|
||||
int i, len = nodes.size();
|
||||
std::vector<int> nodes_ids (len);
|
||||
for (i = 0; i < len; i++) {
|
||||
nodes_ids[i] = nodes[i]->GetID();
|
||||
}
|
||||
myScript->AddPolyhedralVolume(ID, nodes_ids, quantities);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities);
|
||||
if (anElem) {
|
||||
int i, len = nodes.size();
|
||||
std::vector<int> nodes_ids (len);
|
||||
for (i = 0; i < len; i++) {
|
||||
nodes_ids[i] = nodes[i]->GetID();
|
||||
}
|
||||
myScript->AddPolyhedralVolume(anElem->GetID(), nodes_ids, quantities);
|
||||
}
|
||||
return anElem;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : removeFromContainers
|
||||
//purpose :
|
||||
@ -738,13 +876,14 @@ bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
|
||||
/// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given
|
||||
/// TopoDS_Shape is unknown
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
|
||||
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const
|
||||
{
|
||||
if (myShape.IsNull()) MESSAGE("myShape is NULL");
|
||||
|
||||
int Index = ShapeToIndex(S);
|
||||
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
|
||||
return myShapeIndexToSubMesh[Index];
|
||||
TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);
|
||||
if (anIter != myShapeIndexToSubMesh.end())
|
||||
return anIter->second;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -895,7 +1034,7 @@ TopoDS_Shape SMESHDS_Mesh::IndexToShape(int ShapeIndex)
|
||||
//function : ShapeToIndex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S)
|
||||
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
|
||||
{
|
||||
if (myShape.IsNull())
|
||||
MESSAGE("myShape is NULL");
|
||||
|
@ -158,12 +158,39 @@ public:
|
||||
const SMDS_MeshNode * n7,
|
||||
const SMDS_MeshNode * n8);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolume
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
|
||||
virtual void RemoveNode(const SMDS_MeshNode *);
|
||||
void RemoveElement(const SMDS_MeshElement *);
|
||||
bool ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const int nbnodes);
|
||||
bool ChangePolygonNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes);
|
||||
bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
|
||||
|
||||
void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
|
||||
@ -177,7 +204,7 @@ public:
|
||||
const TopoDS_Shape & S);
|
||||
TopoDS_Shape ShapeToMesh() const;
|
||||
bool HasMeshElements(const TopoDS_Shape & S);
|
||||
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
|
||||
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
|
||||
SMESHDS_SubMesh * MeshElements(const int Index);
|
||||
std::list<int> SubMeshIndices();
|
||||
const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
|
||||
@ -187,7 +214,7 @@ public:
|
||||
const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
|
||||
SMESHDS_Script * GetScript();
|
||||
void ClearScript();
|
||||
int ShapeToIndex(const TopoDS_Shape & aShape);
|
||||
int ShapeToIndex(const TopoDS_Shape & aShape) const;
|
||||
TopoDS_Shape IndexToShape(int ShapeIndex);
|
||||
|
||||
SMESHDS_SubMesh * NewSubMesh(int Index);
|
||||
@ -219,9 +246,15 @@ private:
|
||||
|
||||
int myMeshID;
|
||||
TopoDS_Shape myShape;
|
||||
|
||||
typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
|
||||
TShapeIndexToSubMesh myShapeIndexToSubMesh;
|
||||
|
||||
TopTools_IndexedMapOfShape myIndexToShape;
|
||||
std::map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
|
||||
std::set<SMESHDS_GroupBase*> myGroups;
|
||||
|
||||
typedef std::set<SMESHDS_GroupBase*> TGroups;
|
||||
TGroups myGroups;
|
||||
|
||||
SMESHDS_Script* myScript;
|
||||
};
|
||||
|
||||
|
@ -148,6 +148,27 @@ void SMESHDS_Script::AddVolume(int NewID,
|
||||
idnode5, idnode6, idnode7, idnode8);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolygonalFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Script::AddPolygonalFace (int NewFaceID, std::vector<int> nodes_ids)
|
||||
{
|
||||
getCommand(SMESHDS_AddPolygon)->AddPolygonalFace(NewFaceID, nodes_ids);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddPolyhedralVolume
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Script::AddPolyhedralVolume (int NewID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
getCommand(SMESHDS_AddPolyhedron)->AddPolyhedralVolume
|
||||
(NewID, nodes_ids, quantities);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
@ -185,6 +206,18 @@ void SMESHDS_Script::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
|
||||
getCommand(SMESHDS_ChangeElementNodes)->ChangeElementNodes( ElementID, nodes, nbnodes );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePolyhedronNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_Script::ChangePolyhedronNodes (const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
getCommand(SMESHDS_ChangePolyhedronNodes)->ChangePolyhedronNodes
|
||||
(ElementID, nodes_ids, quantities);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Renumber
|
||||
//purpose :
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "SMESHDS_Command.hxx"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class SMESHDS_Script
|
||||
@ -48,10 +49,20 @@ class SMESHDS_Script
|
||||
int idnode4, int idnode5, int idnode6);
|
||||
void AddVolume(int NewVolID, int idnode1, int idnode2, int idnode3,
|
||||
int idnode4, int idnode5, int idnode6, int idnode7, int idnode8);
|
||||
void MoveNode(int NewNodeID, double x, double y, double z);
|
||||
|
||||
void AddPolygonalFace (const int NewFaceID,
|
||||
std::vector<int> nodes_ids);
|
||||
void AddPolyhedralVolume (const int NewVolID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities);
|
||||
|
||||
void MoveNode(int NewNodeID, double x, double y, double z);
|
||||
void RemoveNode(int NodeID);
|
||||
void RemoveElement(int ElementID);
|
||||
void ChangeElementNodes(int ElementID, int nodes[], int nbnodes);
|
||||
void ChangePolyhedronNodes(const int ElementID,
|
||||
std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities);
|
||||
void Renumber (const bool isNodes, const int startID, const int deltaID);
|
||||
void Clear();
|
||||
const std::list<SMESHDS_Command*> & GetCommands();
|
||||
|
@ -58,14 +58,16 @@ LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
# header files
|
||||
EXPORT_HEADERS= SMESH_Type.h \
|
||||
SMESH_TypeFilter.hxx \
|
||||
Handle_SMESH_TypeFilter.hxx \
|
||||
SMESH_NumberFilter.hxx \
|
||||
SMESH_LogicalFilter.hxx
|
||||
|
||||
# additionnal information to compil and link file
|
||||
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
|
||||
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
|
||||
LDFLAGS += $(OCC_KERNEL_LIBS) -L${GEOM_ROOT_DIR}/lib/salome
|
||||
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \
|
||||
-I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
|
||||
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome -I${BOOSTDIR}
|
||||
LDFLAGS += $(OCC_KERNEL_LIBS) -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeApp -lsuit
|
||||
|
||||
# additional file to be cleaned
|
||||
MOSTLYCLEAN =
|
||||
@ -73,4 +75,3 @@ CLEAN =
|
||||
DISTCLEAN =
|
||||
|
||||
@CONCLUDE@
|
||||
|
||||
|
@ -1,49 +1,17 @@
|
||||
// SALOME SALOMEGUI : implementation of desktop and GUI kernel
|
||||
//
|
||||
// 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_LogicalFilter.cxx
|
||||
// Author : Sergey LITONIN
|
||||
// Module : SMESH
|
||||
|
||||
#include "SMESH_LogicalFilter.hxx"
|
||||
|
||||
/*
|
||||
Class : SMESH_LogicalFilter
|
||||
Description : Filter for combaining several filters with logical operation (OR or AND)
|
||||
*/
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE( SMESH_LogicalFilter, SALOME_Filter )
|
||||
IMPLEMENT_STANDARD_RTTIEXT( SMESH_LogicalFilter, SALOME_Filter )
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_LogicalFilter::SMESH_LogicalFilter
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESH_LogicalFilter::SMESH_LogicalFilter( const SMESH_ListOfFilter& theFilters,
|
||||
const int theLogOp )
|
||||
SMESH_LogicalFilter::SMESH_LogicalFilter (const QPtrList<SUIT_SelectionFilter>& theFilters,
|
||||
const int theLogOp)
|
||||
{
|
||||
myFilters = theFilters;
|
||||
myLogOp = theLogOp;
|
||||
setFilters(theFilters);
|
||||
setOperation(theLogOp);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -58,91 +26,56 @@ SMESH_LogicalFilter::~SMESH_LogicalFilter()
|
||||
// name : SMESH_LogicalFilter::IsOk
|
||||
// Purpose : Verify validity of entry object
|
||||
//=======================================================================
|
||||
Standard_Boolean SMESH_LogicalFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const
|
||||
bool SMESH_LogicalFilter::isOk (const SUIT_DataOwner* owner) const
|
||||
{
|
||||
SMESH_ListOfFilter::Iterator anIter( myFilters );
|
||||
for ( ; anIter.More(); anIter.Next() )
|
||||
bool res = true;
|
||||
QPtrListIterator<SUIT_SelectionFilter> it (myFilters);
|
||||
SUIT_SelectionFilter* filter;
|
||||
for (; ((filter = it.current()) != 0) && res; ++it)
|
||||
{
|
||||
Handle(SALOME_Filter) aFilter = anIter.Value();
|
||||
if ( !aFilter.IsNull() )
|
||||
{
|
||||
if ( myLogOp == LO_OR && anIter.Value()->IsOk( theIO ) )
|
||||
return true;
|
||||
if ( myLogOp == LO_AND && !anIter.Value()->IsOk( theIO ) )
|
||||
return false;
|
||||
}
|
||||
if (myOperation == LO_OR && filter->isOk(owner))
|
||||
return true;
|
||||
if (myOperation == LO_AND && !filter->isOk(owner))
|
||||
return false;
|
||||
if (myOperation == LO_NOT)
|
||||
return !filter->isOk(owner);
|
||||
}
|
||||
|
||||
return myLogOp == LO_OR ? false : true;
|
||||
return (myOperation != LO_OR);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_LogicalFilter::SetFilters
|
||||
// name : SMESH_LogicalFilter::setFilters
|
||||
// Purpose : Set new list of filters. Old wilters are removed
|
||||
//=======================================================================
|
||||
void SMESH_LogicalFilter::SetFilters( const SMESH_ListOfFilter& theFilters )
|
||||
void SMESH_LogicalFilter::setFilters (const QPtrList<SUIT_SelectionFilter>& theFilters)
|
||||
{
|
||||
myFilters = theFilters;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_LogicalFilter::SetLogOp
|
||||
// name : SMESH_LogicalFilter::setOperation
|
||||
// Purpose : Set logical operation
|
||||
//=======================================================================
|
||||
void SMESH_LogicalFilter::SetLogOp( const int theLogOp )
|
||||
void SMESH_LogicalFilter::setOperation (const int theLogOp)
|
||||
{
|
||||
myLogOp = theLogOp;
|
||||
myOperation = theLogOp;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_LogicalFilter::GetFilters
|
||||
// name : SMESH_LogicalFilter::getFilters
|
||||
// Purpose : Get list of filters
|
||||
//=======================================================================
|
||||
const SMESH_ListOfFilter& SMESH_LogicalFilter::GetFilters() const
|
||||
const QPtrList<SUIT_SelectionFilter> SMESH_LogicalFilter::getFilters() const
|
||||
{
|
||||
return myFilters;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_LogicalFilter::GetLogOp
|
||||
// name : SMESH_LogicalFilter::getOperation
|
||||
// Purpose : Get logical operation
|
||||
//=======================================================================
|
||||
int SMESH_LogicalFilter::GetLogOp() const
|
||||
int SMESH_LogicalFilter::getOperation() const
|
||||
{
|
||||
return myLogOp;
|
||||
return myOperation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,102 +1,33 @@
|
||||
// SALOME SALOMEGUI : implementation of desktop and GUI kernel
|
||||
//
|
||||
// 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_LogicalFilter.hxx
|
||||
// Author : Sergey LITONIN
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESH_LogicalFilter_HeaderFile
|
||||
#define _SMESH_LogicalFilter_HeaderFile
|
||||
|
||||
#include "SALOME_Filter.hxx"
|
||||
#include <SUIT_SelectionFilter.h>
|
||||
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <NCollection_StdBase.hxx>
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <qptrlist.h>
|
||||
|
||||
DEFINE_STANDARD_HANDLE( SMESH_LogicalFilter, SALOME_Filter )
|
||||
|
||||
DEFINE_BASECOLLECTION( SMESH_FilterColl, Handle(SALOME_Filter) )
|
||||
DEFINE_LIST( SMESH_ListOfFilter, SMESH_FilterColl, Handle(SALOME_Filter) )
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_LogicalFilter
|
||||
Description : Filter for combaining several filters with logical operation (OR or AND)
|
||||
*/
|
||||
|
||||
class SMESH_LogicalFilter : public SALOME_Filter
|
||||
class SMESH_LogicalFilter : public SUIT_SelectionFilter
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED };
|
||||
|
||||
enum { LO_OR, LO_AND, LO_UNDEFINED };
|
||||
public:
|
||||
SMESH_LogicalFilter (const QPtrList<SUIT_SelectionFilter>&,
|
||||
const int);
|
||||
virtual ~SMESH_LogicalFilter();
|
||||
|
||||
public:
|
||||
virtual bool isOk (const SUIT_DataOwner*) const;
|
||||
|
||||
SMESH_LogicalFilter( const SMESH_ListOfFilter&, const int );
|
||||
|
||||
|
||||
virtual ~SMESH_LogicalFilter();
|
||||
virtual Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
|
||||
|
||||
void SetFilters( const SMESH_ListOfFilter& );
|
||||
void SetLogOp( const int );
|
||||
const SMESH_ListOfFilter& GetFilters() const;
|
||||
int GetLogOp() const;
|
||||
void setFilters (const QPtrList<SUIT_SelectionFilter>&);
|
||||
void setOperation (const int);
|
||||
const QPtrList<SUIT_SelectionFilter> getFilters() const;
|
||||
int getOperation() const;
|
||||
|
||||
private:
|
||||
|
||||
SMESH_ListOfFilter myFilters;
|
||||
int myLogOp;
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI( SMESH_LogicalFilter )
|
||||
QPtrList<SUIT_SelectionFilter> myFilters;
|
||||
int myOperation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,84 +1,65 @@
|
||||
// SALOME SALOMEGUI : implementation of desktop and GUI kernel
|
||||
//
|
||||
// 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_NumberFilter.cxx
|
||||
// Author : Sergey LITONIN
|
||||
// Module : SMESH
|
||||
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
#include "TopTools_MapOfShape.hxx"
|
||||
#include "TopExp_Explorer.hxx"
|
||||
|
||||
#include "SUIT_Application.h"
|
||||
#include "SUIT_Session.h"
|
||||
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "SalomeApp_DataOwner.h"
|
||||
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "SALOMEDSClient_SObject.hxx"
|
||||
#include "SALOMEDS_SObject.hxx"
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
/*
|
||||
Class : SMESH_NumberFilter
|
||||
Description : Filter for geom objects.
|
||||
Filter geom objects by number of subshapes of the given type
|
||||
*/
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
|
||||
IMPLEMENT_STANDARD_RTTIEXT( SMESH_NumberFilter, SALOME_TypeFilter )
|
||||
/*!
|
||||
* Class : SMESH_NumberFilter
|
||||
* Description : Filter for geom objects.
|
||||
* Filter geom objects by number of subshapes of the given type
|
||||
*/
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_NumberFilter::SMESH_NumberFilter
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESH_NumberFilter::SMESH_NumberFilter( const char* theKind,
|
||||
SMESH_NumberFilter::SMESH_NumberFilter (const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TopAbs_ShapeEnum theShapeType,
|
||||
GEOM::GEOM_Object_ptr theMainObj,
|
||||
const bool theIsClosedOnly )
|
||||
: SALOME_TypeFilter( (char*)theKind )
|
||||
const bool theIsClosedOnly)
|
||||
{
|
||||
myKind = (char*)theKind;
|
||||
mySubShapeType = theSubShapeType;
|
||||
myNumber = theNumber;
|
||||
myIsClosedOnly = theIsClosedOnly;
|
||||
myShapeTypes.Add( theShapeType );
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
|
||||
myShapeTypes.Add(theShapeType);
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESH_NumberFilter::SMESH_NumberFilter
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESH_NumberFilter::SMESH_NumberFilter( const char* theKind,
|
||||
SMESH_NumberFilter::SMESH_NumberFilter (const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TColStd_MapOfInteger& theShapeTypes,
|
||||
GEOM::GEOM_Object_ptr theMainObj,
|
||||
const bool theIsClosedOnly )
|
||||
: SALOME_TypeFilter( (char*)theKind )
|
||||
{
|
||||
myKind = (char*)theKind;
|
||||
mySubShapeType = theSubShapeType;
|
||||
myNumber = theNumber;
|
||||
myIsClosedOnly = theIsClosedOnly;
|
||||
myShapeTypes = theShapeTypes;
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
|
||||
}
|
||||
|
||||
SMESH_NumberFilter::~SMESH_NumberFilter()
|
||||
@ -89,52 +70,53 @@ SMESH_NumberFilter::~SMESH_NumberFilter()
|
||||
// name : SMESH_NumberFilter::SMESH_NumberFilter
|
||||
// Purpose : Verify validity of entry object
|
||||
//=======================================================================
|
||||
Standard_Boolean SMESH_NumberFilter::IsOk( const Handle(SALOME_InteractiveObject)& theObj ) const
|
||||
bool SMESH_NumberFilter::isOk (const SUIT_DataOwner* theDataOwner) const
|
||||
{
|
||||
if ( theObj.IsNull() || !SALOME_TypeFilter::IsOk( theObj ) )
|
||||
if (!theDataOwner)
|
||||
return false;
|
||||
|
||||
// Get geom object from IO
|
||||
GEOM::GEOM_Object_var aGeomObj = getGeom( theObj );
|
||||
if ( aGeomObj->_is_nil() )
|
||||
GEOM::GEOM_Object_var aGeomObj = getGeom(theDataOwner);
|
||||
if (aGeomObj->_is_nil())
|
||||
return false;
|
||||
|
||||
// Get shape from geom object and verify its parameters
|
||||
TopoDS_Shape aShape;
|
||||
if ( !GEOMBase::GetShape( aGeomObj, aShape ) ||
|
||||
aShape.IsNull() ||
|
||||
!myShapeTypes.Contains( aShape.ShapeType() ) ||
|
||||
myIsClosedOnly && aShape.ShapeType() == TopAbs_SHELL && !aShape.Closed() )
|
||||
if (!GEOMBase::GetShape(aGeomObj, aShape) ||
|
||||
aShape.IsNull() ||
|
||||
!myShapeTypes.Contains(aShape.ShapeType()))
|
||||
return false;
|
||||
|
||||
if (myIsClosedOnly && aShape.ShapeType() == TopAbs_SHELL && !aShape.Closed())
|
||||
return false;
|
||||
|
||||
// Verify whether shape of entry object is sub-shape of myMainObj
|
||||
if ( !myMainObj->_is_nil() )
|
||||
{
|
||||
if (!myMainObj->_is_nil()) {
|
||||
TopoDS_Shape aMainShape;
|
||||
if ( !GEOMBase::GetShape( myMainObj, aMainShape ) )
|
||||
if (!GEOMBase::GetShape(myMainObj, aMainShape))
|
||||
return false;
|
||||
|
||||
bool isFound = false;
|
||||
TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
|
||||
TopExp_Explorer anExp( aMainShape, aShapeType );
|
||||
for ( ; anExp.More(); anExp.Next() )
|
||||
if ( anExp.Current() == aShape )
|
||||
{
|
||||
TopExp_Explorer anExp (aMainShape, aShapeType);
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
if (anExp.Current() == aShape) {
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
if ( !isFound )
|
||||
}
|
||||
if (!isFound)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify number of sub-shapes
|
||||
if ( mySubShapeType == TopAbs_SHAPE );
|
||||
if (mySubShapeType == TopAbs_SHAPE);
|
||||
return true;
|
||||
|
||||
int nbShapes = 0;
|
||||
TopExp_Explorer anExp2( aShape, mySubShapeType );
|
||||
TopExp_Explorer anExp2 (aShape, mySubShapeType);
|
||||
TopTools_MapOfShape aMap;
|
||||
for ( ; anExp2.More(); anExp2.Next() )
|
||||
aMap.Add( anExp2.Current() );
|
||||
for (; anExp2.More(); anExp2.Next())
|
||||
aMap.Add(anExp2.Current());
|
||||
|
||||
return myNumber == aMap.Extent();
|
||||
}
|
||||
@ -143,83 +125,76 @@ Standard_Boolean SMESH_NumberFilter::IsOk( const Handle(SALOME_InteractiveObject
|
||||
// name : SMESH_NumberFilter::getGeom
|
||||
// Purpose : Retrieve geom object from SALOME_InteractiveObject
|
||||
//=======================================================================
|
||||
GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom(
|
||||
const Handle(SALOME_InteractiveObject)& theObj ) const
|
||||
GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom
|
||||
(const SUIT_DataOwner* theDataOwner) const
|
||||
{
|
||||
if ( theObj->isComponentType( "GEOM" ) )
|
||||
{
|
||||
Standard_Boolean aRes = Standard_False;
|
||||
GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( theObj, aRes );
|
||||
return aRes ? aGeomObj._retn() : GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get geom object corresponding to the mesh
|
||||
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::SObject_var aSO = aStudy->FindObjectID( theObj->getEntry() );
|
||||
if ( aSO->_is_nil() )
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
const SalomeApp_DataOwner* owner =
|
||||
dynamic_cast<const SalomeApp_DataOwner*>(theDataOwner);
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
|
||||
(SUIT_Session::session()->activeApplication()->activeStudy());
|
||||
|
||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aSO );
|
||||
for( ; anIter->More(); anIter->Next() )
|
||||
{
|
||||
SALOMEDS::SObject_var aSO = anIter->Value();
|
||||
SALOMEDS::SObject_var aRefSO;
|
||||
|
||||
GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(
|
||||
aSO->ReferencedObject( aRefSO )? aRefSO->GetObject() : aSO->GetObject() );
|
||||
|
||||
if ( !aMeshShape->_is_nil() )
|
||||
return aMeshShape._retn();
|
||||
}
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
if (!owner || !appStudy)
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
||||
_PTR(Study) study = appStudy->studyDS();
|
||||
QString entry = owner->entry();
|
||||
|
||||
_PTR(SObject) aSO(study->FindObjectID(entry.latin1()));
|
||||
if (!aSO)
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
||||
CORBA::Object_var anObject = _CAST(SObject,aSO)->GetObject();
|
||||
anObj = GEOM::GEOM_Object::_narrow(anObject);
|
||||
if (!CORBA::is_nil(anObj))
|
||||
return anObj._retn();
|
||||
|
||||
// Get geom object corresponding to the mesh
|
||||
_PTR(ChildIterator) anIter = study->NewChildIterator(aSO);
|
||||
for (; anIter->More(); anIter->Next()) {
|
||||
_PTR(SObject) aSO = anIter->Value();
|
||||
if (!aSO)
|
||||
continue;
|
||||
_PTR(SObject) aRefSO;
|
||||
_PTR(SObject) anObj;
|
||||
if (aSO->ReferencedObject(aRefSO))
|
||||
anObj = aRefSO;
|
||||
|
||||
if (!anObj)
|
||||
anObj = aSO;
|
||||
|
||||
anObject = _CAST(SObject,anObj)->GetObject();
|
||||
GEOM::GEOM_Object_var aMeshShape = GEOM::GEOM_Object::_narrow(anObject);
|
||||
|
||||
if (!aMeshShape->_is_nil())
|
||||
return aMeshShape._retn();
|
||||
}
|
||||
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
|
||||
|
||||
void SMESH_NumberFilter::SetSubShapeType( const TopAbs_ShapeEnum theSubShapeType )
|
||||
void SMESH_NumberFilter::SetSubShapeType (const TopAbs_ShapeEnum theSubShapeType)
|
||||
{
|
||||
mySubShapeType = theSubShapeType;
|
||||
}
|
||||
|
||||
void SMESH_NumberFilter::SetNumber( const int theNumber )
|
||||
void SMESH_NumberFilter::SetNumber (const int theNumber)
|
||||
{
|
||||
myNumber = theNumber;
|
||||
}
|
||||
|
||||
void SMESH_NumberFilter::SetClosedOnly( const bool theIsClosedOnly )
|
||||
void SMESH_NumberFilter::SetClosedOnly (const bool theIsClosedOnly)
|
||||
{
|
||||
myIsClosedOnly = theIsClosedOnly;
|
||||
}
|
||||
|
||||
void SMESH_NumberFilter::SetShapeType( const TopAbs_ShapeEnum theShapeType )
|
||||
void SMESH_NumberFilter::SetShapeType (const TopAbs_ShapeEnum theShapeType)
|
||||
{
|
||||
myShapeTypes.Add( theShapeType );
|
||||
}
|
||||
|
||||
void SMESH_NumberFilter::SetMainShape( GEOM::GEOM_Object_ptr theMainObj )
|
||||
void SMESH_NumberFilter::SetMainShape (GEOM::GEOM_Object_ptr theMainObj)
|
||||
{
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate( theMainObj );
|
||||
myMainObj = GEOM::GEOM_Object::_duplicate(theMainObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,124 +1,69 @@
|
||||
// SALOME SALOMEGUI : implementation of desktop and GUI kernel
|
||||
//
|
||||
// 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_NumberFilter.hxx
|
||||
// Author : Sergey LITONIN
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESH_NumberFilter_HeaderFile
|
||||
#define _SMESH_NumberFilter_HeaderFile
|
||||
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include "SALOME_TypeFilter.hxx"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
|
||||
DEFINE_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
|
||||
class SUIT_DataOwner;
|
||||
|
||||
/*
|
||||
Class : SMESH_NumberFilter
|
||||
Description : Filter for geom or smesh objects.
|
||||
Filter geom objects by number of subshapes of the given type
|
||||
Parameters of constructor:
|
||||
* theSubShapeType - Type of subshape
|
||||
* theNumber - Number of subshapes. Object is selected if it contains theNumber of
|
||||
theSubShapeType sub-shapes
|
||||
* theShapeType - This map specifies types of object to be selected
|
||||
* theMainObject - Sub-shapes of this object is selected only
|
||||
* theIsClosedOnly - Closed shapes is selected if this parameter is true
|
||||
*/
|
||||
class SMESH_NumberFilter : public SALOME_TypeFilter
|
||||
/*!
|
||||
* Class : SMESH_NumberFilter
|
||||
* Description : Filter for geom or smesh objects.
|
||||
* Filter geom objects by number of subshapes of the given type
|
||||
* Parameters of constructor:
|
||||
* * theSubShapeType - Type of subshape
|
||||
* * theNumber - Number of subshapes. Object is selected if it contains theNumber of
|
||||
* theSubShapeType sub-shapes
|
||||
* * theShapeType - This map specifies types of object to be selected
|
||||
* * theMainObject - Sub-shapes of this object is selected only
|
||||
* * theIsClosedOnly - Closed shapes is selected if this parameter is true
|
||||
*/
|
||||
class SMESH_NumberFilter : public SUIT_SelectionFilter
|
||||
{
|
||||
public:
|
||||
SMESH_NumberFilter (const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
|
||||
GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
|
||||
const bool theIsClosedOnly = false );
|
||||
|
||||
public:
|
||||
SMESH_NumberFilter (const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TColStd_MapOfInteger& theShapeTypes,
|
||||
GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
|
||||
const bool theIsClosedOnly = false );
|
||||
|
||||
SMESH_NumberFilter( const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
|
||||
GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
|
||||
const bool theIsClosedOnly = false );
|
||||
virtual ~SMESH_NumberFilter();
|
||||
|
||||
SMESH_NumberFilter( const char* theKind,
|
||||
const TopAbs_ShapeEnum theSubShapeType,
|
||||
const int theNumber,
|
||||
const TColStd_MapOfInteger& theShapeTypes,
|
||||
GEOM::GEOM_Object_ptr theMainObj = GEOM::GEOM_Object::_nil(),
|
||||
const bool theIsClosedOnly = false );
|
||||
virtual bool isOk (const SUIT_DataOwner*) const;
|
||||
|
||||
virtual ~SMESH_NumberFilter();
|
||||
virtual Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
|
||||
void SetSubShapeType (const TopAbs_ShapeEnum);
|
||||
void SetNumber (const int);
|
||||
void SetClosedOnly (const bool);
|
||||
void SetShapeType (const TopAbs_ShapeEnum);
|
||||
void SetShapeTypes (const TColStd_MapOfInteger&);
|
||||
void SetMainShape (GEOM::GEOM_Object_ptr);
|
||||
|
||||
void SetSubShapeType( const TopAbs_ShapeEnum );
|
||||
void SetNumber( const int );
|
||||
void SetClosedOnly( const bool );
|
||||
void SetShapeType( const TopAbs_ShapeEnum );
|
||||
void SetShapeTypes( const TColStd_MapOfInteger& );
|
||||
void SetMainShape( GEOM::GEOM_Object_ptr );
|
||||
private:
|
||||
GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*) const;
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_ptr getGeom( const Handle(SALOME_InteractiveObject)& theObj ) const;
|
||||
|
||||
|
||||
private:
|
||||
private:
|
||||
char* myKind;
|
||||
TopAbs_ShapeEnum mySubShapeType;
|
||||
int myNumber;
|
||||
bool myIsClosedOnly;
|
||||
TColStd_MapOfInteger myShapeTypes;
|
||||
GEOM::GEOM_Object_var myMainObj;
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI( SMESH_NumberFilter )
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
// Copyright : Open CASCADE 2002
|
||||
// $Header$
|
||||
|
||||
#ifndef SMESH_TYPE_HEADER
|
||||
#define SMESH_TYPE_HEADER
|
||||
|
||||
enum MeshObjectType {
|
||||
HYPOTHESIS,
|
||||
ALGORITHM,
|
||||
@ -20,3 +23,5 @@ enum MeshObjectType {
|
||||
SUBMESH_COMPOUND,
|
||||
GROUP
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,43 +1,37 @@
|
||||
// File : SMESH_TypeFilter.cxx
|
||||
// Created : Fri Dec 07 09:57:24 2001
|
||||
// Author : Nicolas REJNERI
|
||||
// Project : SALOME
|
||||
// Module : SMESH
|
||||
// Copyright : Open CASCADE
|
||||
// $Header$
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SMESH_TypeFilter.ixx"
|
||||
#include <SUIT_Session.h>
|
||||
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SALOME_TypeFilter.hxx"
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <SalomeApp_DataOwner.h>
|
||||
|
||||
#include "utilities.h"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Study.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType)
|
||||
SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
|
||||
{
|
||||
myKind = aType;
|
||||
myType = theType;
|
||||
}
|
||||
|
||||
Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
|
||||
SMESH_TypeFilter::~SMESH_TypeFilter()
|
||||
{
|
||||
Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "SMESH" );
|
||||
if ( !meshFilter->IsOk(anObj) )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
|
||||
{
|
||||
bool Ok = false;
|
||||
|
||||
if ( anObj->hasEntry() ) {
|
||||
QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
|
||||
SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
|
||||
const SalomeApp_DataOwner* owner =
|
||||
dynamic_cast<const SalomeApp_DataOwner*>(theDataOwner);
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
|
||||
(SUIT_Session::session()->activeApplication()->activeStudy());
|
||||
|
||||
SALOMEDS::SObject_var objFather = obj->GetFather();
|
||||
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
|
||||
if (owner && appStudy) {
|
||||
_PTR(Study) study = appStudy->studyDS();
|
||||
QString entry = owner->entry();
|
||||
|
||||
_PTR(SObject) obj (study->FindObjectID(entry.latin1()));
|
||||
if (!obj) return false;
|
||||
|
||||
_PTR(SObject) objFather = obj->GetFather();
|
||||
_PTR(SComponent) objComponent = obj->GetFatherComponent();
|
||||
|
||||
int aLevel = obj->Depth() - objComponent->Depth();
|
||||
|
||||
@ -55,10 +49,10 @@ Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)&
|
||||
// 4 | |- Applied algorithms ( selectable in Use Case Browser )
|
||||
// |- Group Of Nodes
|
||||
|
||||
if ( aLevel <= 0 )
|
||||
if (aLevel <= 0)
|
||||
return false;
|
||||
|
||||
switch ( myKind )
|
||||
switch (myType)
|
||||
{
|
||||
case HYPOTHESIS:
|
||||
{
|
||||
@ -133,3 +127,8 @@ Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)&
|
||||
}
|
||||
return Ok;
|
||||
}
|
||||
|
||||
MeshObjectType SMESH_TypeFilter::type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
@ -1,95 +1,25 @@
|
||||
// File generated by CPPExt (Transient)
|
||||
//
|
||||
// Copyright (C) 1991,1995 by
|
||||
//
|
||||
// MATRA DATAVISION, FRANCE
|
||||
//
|
||||
// This software is furnished in accordance with the terms and conditions
|
||||
// of the contract and with the inclusion of the above copyright notice.
|
||||
// This software or any other copy thereof may not be provided or otherwise
|
||||
// be made available to any other person. No title to an ownership of the
|
||||
// software is hereby transferred.
|
||||
//
|
||||
// At the termination of the contract, the software and all copies of this
|
||||
// software must be deleted.
|
||||
//
|
||||
// File : SMESH_TypeFilter.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESH_TypeFilter_HeaderFile
|
||||
#define _SMESH_TypeFilter_HeaderFile
|
||||
|
||||
#ifndef _Handle_SMESH_TypeFilter_HeaderFile
|
||||
#include "Handle_SMESH_TypeFilter.hxx"
|
||||
#endif
|
||||
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SALOME_Filter.hxx"
|
||||
#include "SMESH_Type.h"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
|
||||
// Open CASCADE Includes
|
||||
#include <Standard.hxx>
|
||||
|
||||
class SMESH_TypeFilter : public SALOME_Filter {
|
||||
class SUIT_DataOwner;
|
||||
|
||||
class SMESH_TypeFilter : public SUIT_SelectionFilter
|
||||
{
|
||||
public:
|
||||
SMESH_TypeFilter (MeshObjectType theType);
|
||||
~SMESH_TypeFilter();
|
||||
|
||||
inline void* operator new(size_t,void* anAddress)
|
||||
{
|
||||
return anAddress;
|
||||
}
|
||||
inline void* operator new(size_t size)
|
||||
{
|
||||
return Standard::Allocate(size);
|
||||
}
|
||||
inline void operator delete(void *anAddress)
|
||||
{
|
||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||
}
|
||||
// inline void operator delete(void *anAddress, size_t size)
|
||||
// {
|
||||
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
|
||||
// }
|
||||
// Methods PUBLIC
|
||||
//
|
||||
Standard_EXPORT SMESH_TypeFilter(MeshObjectType aType);
|
||||
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const;
|
||||
Standard_EXPORT ~SMESH_TypeFilter();
|
||||
|
||||
|
||||
|
||||
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& SMESH_TypeFilter_Type_();
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||
virtual bool isOk (const SUIT_DataOwner*) const;
|
||||
MeshObjectType type() const;
|
||||
|
||||
protected:
|
||||
|
||||
// Methods PROTECTED
|
||||
//
|
||||
|
||||
|
||||
// Fields PROTECTED
|
||||
//
|
||||
MeshObjectType myKind;
|
||||
|
||||
private:
|
||||
|
||||
// Methods PRIVATE
|
||||
//
|
||||
|
||||
|
||||
// Fields PRIVATE
|
||||
//
|
||||
|
||||
|
||||
MeshObjectType myType;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// other inline functions and methods (like "C++: function call" methods)
|
||||
//
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -43,15 +43,16 @@ EXPORT_HEADERS= SMESHGUI_Swig.hxx \
|
||||
SMESHGUI_HypothesesUtils.h \
|
||||
SMESHGUI_SpinBox.h \
|
||||
SMESHGUI_aParameter.h \
|
||||
SMESHGUI_aParameterDlg.h
|
||||
SMESHGUI_aParameterDlg.h \
|
||||
SMESHGUI_Selection.h
|
||||
|
||||
# .po files to transform in .qm
|
||||
PO_FILES = \
|
||||
SMESH_icons.po \
|
||||
SMESH_images.po \
|
||||
SMESH_msg_en.po
|
||||
|
||||
# Libraries targets
|
||||
LIB = libSMESHGUI.la
|
||||
LIB = libSMESH.la
|
||||
LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_PatternWidget.cxx \
|
||||
SMESHGUI_CreatePatternDlg.cxx \
|
||||
@ -96,7 +97,6 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_SewingDlg.cxx \
|
||||
SMESHGUI_MergeNodesDlg.cxx \
|
||||
SMESHGUI_Utils.cxx \
|
||||
SMESHGUI_SMESHGenUtils.cxx \
|
||||
SMESHGUI_GEOMGenUtils.cxx \
|
||||
SMESHGUI_MeshUtils.cxx \
|
||||
SMESHGUI_GroupUtils.cxx \
|
||||
@ -104,7 +104,9 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_PatternUtils.cxx \
|
||||
SMESHGUI_HypothesesUtils.cxx \
|
||||
SMESHGUI_PrecisionDlg.cxx \
|
||||
SMESHGUI_VTKUtils.cxx
|
||||
SMESHGUI_VTKUtils.cxx \
|
||||
SMESHGUI_Selection.cxx \
|
||||
SMESHGUI_CreatePolyhedralVolumeDlg.cxx
|
||||
|
||||
LIB_MOC = \
|
||||
SMESHGUI.h \
|
||||
@ -146,7 +148,8 @@ LIB_MOC = \
|
||||
SMESHGUI_SymmetryDlg.h \
|
||||
SMESHGUI_SewingDlg.h \
|
||||
SMESHGUI_PrecisionDlg.h \
|
||||
SMESHGUI_MergeNodesDlg.h
|
||||
SMESHGUI_MergeNodesDlg.h \
|
||||
SMESHGUI_CreatePolyhedralVolumeDlg.h
|
||||
|
||||
LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
GEOM_Gen.idl \
|
||||
@ -171,13 +174,14 @@ LIB_SERVER_IDL =
|
||||
#BIN = SMESHBin
|
||||
|
||||
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
|
||||
-I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
|
||||
$(BOOST_CPPFLAGS)
|
||||
-I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
|
||||
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \
|
||||
-I${GEOM_ROOT_DIR}/include/salome
|
||||
|
||||
|
||||
LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -lVTKViewer -lSalomeGUI -lSalomePrs -lSalomeNS -lqsplitterP -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSALOMELocalTrace -lSalomeVTKFilter -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOMGUI -lGEOMClient -lGEOMFiltersSelection -lGEOMBase -lGEOMObject
|
||||
LDFLAGS += -lSMESHObject -lSMESHFiltersSelection -lSMDS -lSMESHControls -lDlgRef $(OCC_KERNEL_LIBS) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lVTKViewer -lSalomeApp -lSalomePrs -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSalomeObject -lEvent -lSALOMELocalTrace -lSVTK -lOCCViewer -L${GEOM_ROOT_DIR}/lib/salome -lGEOM -lGEOMClient -lGEOMBase -lGEOMObject
|
||||
|
||||
LDFLAGSFORBIN += $(LDFLAGS)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -30,39 +30,48 @@
|
||||
#define SMESHGUI_HeaderFile
|
||||
|
||||
// SALOME Includes
|
||||
#include "SALOMEGUI.h"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include <SalomeApp_Module.h>
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
|
||||
class QAD_Desktop;
|
||||
class QAD_Study;
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Gen)
|
||||
|
||||
class QDialog;
|
||||
|
||||
class SUIT_Desktop;
|
||||
class SUIT_Study;
|
||||
class SUIT_ViewWindow;
|
||||
class SUIT_ResourceMgr;
|
||||
class SUIT_ViewManager;
|
||||
|
||||
class SalomeApp_Study;
|
||||
class SalomeApp_SelectionMgr;
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI : public SALOMEGUI
|
||||
class SMESHGUI : public SalomeApp_Module
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
private :
|
||||
QAD_Desktop* myDesktop;
|
||||
QAD_Study* myActiveStudy;
|
||||
QDialog* myActiveDialogBox;
|
||||
|
||||
int myState;
|
||||
bool myAutomaticUpdate;
|
||||
|
||||
public :
|
||||
SMESHGUI( const QString& name = "", QObject* parent = 0 );
|
||||
static SMESHGUI* GetSMESHGUI() ;
|
||||
SMESHGUI();
|
||||
~SMESHGUI();
|
||||
|
||||
QAD_Desktop* GetDesktop() ;
|
||||
QAD_Study* GetActiveStudy() ;
|
||||
bool ActiveStudyLocked();
|
||||
static SMESH::SMESH_Gen_var GetSMESHGen();
|
||||
static SMESHGUI* GetSMESHGUI();
|
||||
static SalomeApp_SelectionMgr* selectionMgr();
|
||||
static SUIT_ResourceMgr* resourceMgr();
|
||||
static SUIT_Desktop* desktop() ;
|
||||
static SalomeApp_Study* activeStudy();
|
||||
bool isActiveStudyLocked();
|
||||
|
||||
virtual QString engineIOR() const;
|
||||
virtual void initialize( CAM_Application* );
|
||||
virtual void windows( QMap<int, int>& ) const;
|
||||
virtual void viewManagers( QStringList& ) const;
|
||||
|
||||
QDialog* GetActiveDialogBox() ;
|
||||
void SetActiveDialogBox(QDialog* aDlg) ;
|
||||
@ -71,30 +80,46 @@ public :
|
||||
void SetState(int aState) ;
|
||||
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
|
||||
|
||||
virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent);
|
||||
virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
|
||||
virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
|
||||
virtual bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
|
||||
virtual bool ActiveStudyChanged( QAD_Desktop* parent );
|
||||
virtual bool SetSettings ( QAD_Desktop* parent );
|
||||
virtual void DefinePopup ( QString & theContext, QString & theParent, QString & theObject );
|
||||
virtual bool CustomPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
|
||||
const QString & theParent, const QString & theObject );
|
||||
virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO,
|
||||
QAD_ViewFrame* = 0 );
|
||||
virtual void SupportedViewType (int* buffer, int bufferSize);
|
||||
virtual void Deactivate ();
|
||||
virtual bool OnGUIEvent ( int id );
|
||||
virtual bool OnMousePress ( QMouseEvent*, SUIT_ViewWindow* );
|
||||
virtual bool OnMouseMove ( QMouseEvent*, SUIT_ViewWindow* );
|
||||
virtual bool OnKeyPress ( QKeyEvent*, SUIT_ViewWindow* );
|
||||
|
||||
/* Non modal dialog boxes magement */
|
||||
virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
|
||||
|
||||
virtual bool SetSettings ( SUIT_Desktop* );
|
||||
virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
|
||||
SUIT_ViewWindow* = 0 );
|
||||
|
||||
/* Non modal dialog boxes management */
|
||||
void EmitSignalDeactivateDialog() ;
|
||||
void EmitSignalStudyFrameChanged() ;
|
||||
void EmitSignalCloseAllDialogs() ;
|
||||
|
||||
public slots:
|
||||
virtual void deactivateModule( SUIT_Study* );
|
||||
virtual void activateModule( SUIT_Study* );
|
||||
|
||||
private slots:
|
||||
void OnGUIEvent();
|
||||
|
||||
signals:
|
||||
void SignalDeactivateActiveDialog() ;
|
||||
void SignalStudyFrameChanged() ;
|
||||
void SignalCloseAllDialogs() ;
|
||||
|
||||
protected:
|
||||
void createSMESHAction( const int, const QString&, const QString& = QString(""),
|
||||
const int = 0, const bool = false );
|
||||
void createPopupItem( const int, const QString&, const QString&,
|
||||
const QString& = QString::null, const int = -1 );
|
||||
|
||||
private :
|
||||
static SMESH::SMESH_Gen_var myComponentSMESH;
|
||||
QDialog* myActiveDialogBox;
|
||||
int myState;
|
||||
bool myAutomaticUpdate;
|
||||
QMap<int,QString> myRules;
|
||||
};
|
||||
|
||||
|
||||
|
@ -35,16 +35,29 @@
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_MessageBox.h"
|
||||
#include "SUIT_Session.h"
|
||||
|
||||
#include "SVTK_Selection.h"
|
||||
#include "SVTK_Selector.h"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "SalomeApp_Application.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
// VTK Includes
|
||||
#include <vtkCell.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkIntArray.h>
|
||||
@ -69,39 +82,41 @@
|
||||
#include <qcheckbox.h>
|
||||
#include <qregexp.h>
|
||||
|
||||
// STL includes
|
||||
#include <list>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace SMESH{
|
||||
namespace SMESH {
|
||||
|
||||
class TElementSimulation{
|
||||
QAD_Study* myStudy;
|
||||
QAD_StudyFrame* myStudyFrame;
|
||||
VTKViewer_ViewFrame* myViewFrame;
|
||||
class TElementSimulation {
|
||||
SalomeApp_Application* myApplication;
|
||||
SUIT_ViewWindow* myViewWindow;
|
||||
SVTK_ViewWindow* myVTKViewWindow;
|
||||
|
||||
SALOME_Actor *myPreviewActor;
|
||||
SALOME_Actor* myPreviewActor;
|
||||
vtkDataSetMapper* myMapper;
|
||||
vtkUnstructuredGrid* myGrid;
|
||||
|
||||
public:
|
||||
|
||||
TElementSimulation(QAD_Study* theStudy):
|
||||
myStudy(theStudy),
|
||||
myStudyFrame(theStudy->getActiveStudyFrame()),
|
||||
myViewFrame(GetVtkViewFrame(theStudy->getActiveStudyFrame()))
|
||||
TElementSimulation (SalomeApp_Application* theApplication)
|
||||
{
|
||||
myApplication = theApplication;
|
||||
SUIT_ViewManager* mgr = theApplication->activeViewManager();
|
||||
if (!mgr) return;
|
||||
myViewWindow = mgr->getActiveView();
|
||||
myVTKViewWindow = GetVtkViewWindow(myViewWindow);
|
||||
|
||||
myGrid = vtkUnstructuredGrid::New();
|
||||
|
||||
// Create and display actor
|
||||
myMapper = vtkDataSetMapper::New();
|
||||
myMapper->SetInput( myGrid );
|
||||
myMapper->SetInput(myGrid);
|
||||
|
||||
myPreviewActor = SALOME_Actor::New();
|
||||
myPreviewActor->PickableOff();
|
||||
myPreviewActor->VisibilityOff();
|
||||
myPreviewActor->SetMapper( myMapper );
|
||||
myPreviewActor->SetMapper(myMapper);
|
||||
|
||||
vtkProperty* aProp = vtkProperty::New();
|
||||
float anRGB[3];
|
||||
@ -109,7 +124,7 @@ namespace SMESH{
|
||||
anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
|
||||
anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
|
||||
aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
myPreviewActor->SetProperty( aProp );
|
||||
myPreviewActor->SetProperty(aProp);
|
||||
aProp->Delete();
|
||||
|
||||
vtkProperty* aBackProp = vtkProperty::New();
|
||||
@ -117,39 +132,41 @@ namespace SMESH{
|
||||
anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
|
||||
anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
|
||||
aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
myPreviewActor->SetBackfaceProperty( aBackProp );
|
||||
myPreviewActor->SetBackfaceProperty(aBackProp);
|
||||
aBackProp->Delete();
|
||||
|
||||
myViewFrame->AddActor( myPreviewActor );
|
||||
|
||||
myVTKViewWindow->AddActor(myPreviewActor);
|
||||
}
|
||||
|
||||
|
||||
typedef std::vector<vtkIdType> TVTKIds;
|
||||
void SetPosition(SMESH_Actor* theActor,
|
||||
vtkIdType theType,
|
||||
const TVTKIds& theIds)
|
||||
void SetPosition (SMESH_Actor* theActor,
|
||||
vtkIdType theType,
|
||||
const TVTKIds& theIds)
|
||||
{
|
||||
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
|
||||
myGrid->SetPoints(aGrid->GetPoints());
|
||||
|
||||
const int* aConn = NULL;
|
||||
switch(theType){
|
||||
case VTK_TETRA:{
|
||||
static int anIds[] = {0,2,1,3};
|
||||
aConn = anIds;
|
||||
break;
|
||||
switch (theType) {
|
||||
case VTK_TETRA:
|
||||
{
|
||||
static int anIds[] = {0,2,1,3};
|
||||
aConn = anIds;
|
||||
break;
|
||||
}
|
||||
case VTK_PYRAMID:
|
||||
{
|
||||
static int anIds[] = {0,3,2,1,4};
|
||||
aConn = anIds;
|
||||
break;
|
||||
}
|
||||
case VTK_HEXAHEDRON:
|
||||
{
|
||||
static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||
aConn = anIds;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case VTK_PYRAMID:{
|
||||
static int anIds[] = {0,3,2,1,4};
|
||||
aConn = anIds;
|
||||
break;
|
||||
}
|
||||
case VTK_HEXAHEDRON:{
|
||||
static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||
aConn = anIds;
|
||||
break;
|
||||
}}
|
||||
|
||||
myGrid->Reset();
|
||||
vtkIdList *anIds = vtkIdList::New();
|
||||
@ -170,15 +187,17 @@ namespace SMESH{
|
||||
}
|
||||
|
||||
|
||||
void SetVisibility(bool theVisibility){
|
||||
void SetVisibility (bool theVisibility)
|
||||
{
|
||||
myPreviewActor->SetVisibility(theVisibility);
|
||||
RepaintCurrentView();
|
||||
}
|
||||
|
||||
|
||||
~TElementSimulation(){
|
||||
if(FindVtkViewFrame(myStudy,myStudyFrame)){
|
||||
myViewFrame->RemoveActor(myPreviewActor);
|
||||
~TElementSimulation()
|
||||
{
|
||||
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
||||
myVTKViewWindow->RemoveActor(myPreviewActor);
|
||||
}
|
||||
myPreviewActor->Delete();
|
||||
|
||||
@ -187,35 +206,40 @@ namespace SMESH{
|
||||
|
||||
myGrid->Delete();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_AddMeshElementDlg()
|
||||
// purpose :
|
||||
// function : SMESHGUI_AddMeshElementDlg()
|
||||
// purpose : constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const char* name,
|
||||
SALOME_Selection* Sel,
|
||||
SMDSAbs_ElementType ElementType, int nbNodes,
|
||||
bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
|
||||
Qt::WDestructiveClose)
|
||||
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
|
||||
const char* name,
|
||||
SMDSAbs_ElementType ElementType, int nbNodes,
|
||||
bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myViewWindow( SMESH::GetViewWindow( theModule ) ),
|
||||
mySelector( myViewWindow->GetSelector() )
|
||||
{
|
||||
mySimulation = new SMESH::TElementSimulation(SMESH::GetActiveStudy());
|
||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
|
||||
(SUIT_Session::session()->activeApplication());
|
||||
myIsPoly = false;
|
||||
mySimulation = new SMESH::TElementSimulation (anApp);
|
||||
|
||||
// verify nb nodes and type
|
||||
myNbNodes = nbNodes;
|
||||
myElementType = ElementType;
|
||||
switch ( ElementType ) {
|
||||
switch (ElementType) {
|
||||
case SMDSAbs_Face:
|
||||
if ( myNbNodes != 3 && myNbNodes != 4 )
|
||||
myNbNodes = 3;
|
||||
break;
|
||||
// if (myNbNodes != 3 && myNbNodes != 4)
|
||||
// myNbNodes = 3;
|
||||
// break;
|
||||
case SMDSAbs_Volume:
|
||||
if ( myNbNodes != 4 && myNbNodes != 8 ) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
|
||||
myNbNodes = 4;
|
||||
// if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
|
||||
// myNbNodes = 4;
|
||||
break;
|
||||
default:
|
||||
myElementType = SMDSAbs_Edge;
|
||||
@ -223,126 +247,133 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
|
||||
}
|
||||
|
||||
QString elemName;
|
||||
switch ( myNbNodes ) {
|
||||
case 2: elemName = "EDGE"; break;
|
||||
case 3: elemName = "TRIANGLE"; break;
|
||||
case 4: elemName =
|
||||
myElementType == SMDSAbs_Face ? elemName = "QUADRANGLE" : elemName = "TETRAS"; break;
|
||||
// case 5:
|
||||
// case 6:
|
||||
default: // 8
|
||||
if (myNbNodes == 2)
|
||||
elemName = "EDGE";
|
||||
else if (myNbNodes == 3)
|
||||
elemName = "TRIANGLE";
|
||||
else if (myNbNodes == 4)
|
||||
if (myElementType == SMDSAbs_Face)
|
||||
elemName = "QUADRANGLE";
|
||||
else
|
||||
elemName = "TETRAS";
|
||||
else if (myNbNodes == 8)
|
||||
elemName = "HEXAS";
|
||||
else if (myElementType == SMDSAbs_Face){
|
||||
elemName = "POLYGON";
|
||||
myIsPoly = true;
|
||||
}
|
||||
QString iconName = tr( QString("ICON_DLG_%1").arg(elemName) );
|
||||
QString buttonGrTitle = tr( QString("SMESH_%1").arg(elemName) );
|
||||
QString caption = tr( QString("SMESH_ADD_%1_TITLE").arg(elemName) );
|
||||
QString grBoxTitle = tr( QString("SMESH_ADD_%1").arg(elemName) );
|
||||
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", iconName ));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH", tr("ICON_SELECT")));
|
||||
QString iconName = tr(QString("ICON_DLG_%1").arg(elemName));
|
||||
QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
|
||||
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
|
||||
QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
|
||||
|
||||
if ( !name )
|
||||
setName( "SMESHGUI_AddMeshElementDlg" );
|
||||
resize( 303, 185 );
|
||||
setCaption( caption );
|
||||
QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", iconName));
|
||||
QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
|
||||
setSizeGripEnabled( TRUE );
|
||||
SMESHGUI_AddMeshElementDlgLayout = new QGridLayout( this );
|
||||
SMESHGUI_AddMeshElementDlgLayout->setSpacing( 6 );
|
||||
SMESHGUI_AddMeshElementDlgLayout->setMargin( 11 );
|
||||
if (!name)
|
||||
setName("SMESHGUI_AddMeshElementDlg");
|
||||
resize(303, 185);
|
||||
setCaption(caption);
|
||||
|
||||
setSizeGripEnabled(TRUE);
|
||||
SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_AddMeshElementDlgLayout->setSpacing(6);
|
||||
SMESHGUI_AddMeshElementDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( buttonGrTitle );
|
||||
GroupConstructors = new QButtonGroup(this, "GroupConstructors");
|
||||
GroupConstructors->setTitle(buttonGrTitle);
|
||||
|
||||
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_AddMeshElementDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
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_AddMeshElementDlgLayout->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_AddMeshElementDlgLayout->addWidget( GroupButtons, 2, 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_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( grBoxTitle );
|
||||
GroupC1 = new QGroupBox(this, "GroupC1");
|
||||
GroupC1->setTitle(grBoxTitle);
|
||||
|
||||
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_ID_NODES" ) );
|
||||
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" );
|
||||
// LineEditC1A1->setReadOnly( TRUE );
|
||||
LineEditC1A1->setValidator( new SMESHGUI_IdValidator( this, "validator", myNbNodes ));
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
||||
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_ID_NODES" ));
|
||||
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");
|
||||
// LineEditC1A1->setReadOnly(TRUE);
|
||||
if (!myIsPoly)
|
||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes));
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
|
||||
|
||||
if ( myElementType == SMDSAbs_Face ) {
|
||||
Reverse = new QCheckBox( GroupC1, "Reverse" );
|
||||
Reverse->setText( tr( "SMESH_REVERSE" ) );
|
||||
GroupC1Layout->addWidget( Reverse, 1, 0 );
|
||||
if (myElementType == SMDSAbs_Face) {
|
||||
Reverse = new QCheckBox(GroupC1, "Reverse");
|
||||
Reverse->setText(tr("SMESH_REVERSE" ));
|
||||
GroupC1Layout->addWidget(Reverse, 1, 0);
|
||||
}
|
||||
else
|
||||
Reverse = 0;
|
||||
|
||||
SMESHGUI_AddMeshElementDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0);
|
||||
|
||||
Init(Sel) ; /* Initialisations */
|
||||
Init(); /* Initialisations */
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -351,52 +382,49 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( QWidget* parent, const c
|
||||
//=================================================================================
|
||||
SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
delete mySimulation;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::Init( SALOME_Selection* Sel )
|
||||
void SMESHGUI_AddMeshElementDlg::Init()
|
||||
{
|
||||
|
||||
GroupC1->show();
|
||||
Constructor1->setChecked( TRUE );
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
|
||||
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
Constructor1->setChecked(TRUE);
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
myOkNodes = false ;
|
||||
myNbOkNodes = 0;
|
||||
myActor = 0;
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) );
|
||||
connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ;
|
||||
connect(buttonApply, SIGNAL( clicked() ), SLOT(ClickOnApply() ) );
|
||||
connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel()));
|
||||
connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply()));
|
||||
|
||||
connect(SelectButtonC1A1, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(LineEditC1A1, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&)));
|
||||
connect(mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog()));
|
||||
connect(mySelection, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) );
|
||||
connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument()));
|
||||
connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
||||
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
|
||||
/* to close dialog if study frame change */
|
||||
connect( mySMESHGUI, SIGNAL ( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ) ;
|
||||
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
|
||||
|
||||
if ( Reverse )
|
||||
connect( Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) );
|
||||
if (Reverse)
|
||||
connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)));
|
||||
|
||||
/* 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 */
|
||||
// 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
|
||||
|
||||
// set selection mode
|
||||
SMESH::SetPointRepresentation(true);
|
||||
QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
|
||||
|
||||
myViewWindow->SetSelectionMode( NodeSelection );
|
||||
|
||||
myBusy = false;
|
||||
|
||||
@ -409,21 +437,20 @@ void SMESHGUI_AddMeshElementDlg::Init( SALOME_Selection* Sel )
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::ClickOnApply()
|
||||
{
|
||||
if ( myOkNodes && !mySMESHGUI->ActiveStudyLocked() ) {
|
||||
|
||||
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
|
||||
myBusy = true;
|
||||
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
|
||||
anArrayOfIdeces->length( myNbNodes );
|
||||
bool reverse = ( Reverse && Reverse->isChecked() );
|
||||
QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
|
||||
for ( int i = 0; i < aListId.count(); i++ )
|
||||
if ( reverse )
|
||||
anArrayOfIdeces->length(myNbNodes);
|
||||
bool reverse = (Reverse && Reverse->isChecked());
|
||||
QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
|
||||
for (int i = 0; i < aListId.count(); i++)
|
||||
if (reverse)
|
||||
anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
|
||||
else
|
||||
anArrayOfIdeces[i] = aListId[ i ].toInt();
|
||||
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
switch ( myElementType ) {
|
||||
switch (myElementType) {
|
||||
case SMDSAbs_Edge:
|
||||
aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
|
||||
case SMDSAbs_Face:
|
||||
@ -433,14 +460,14 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
|
||||
default:;
|
||||
}
|
||||
|
||||
mySelection->ClearIObjects();
|
||||
mySelection->AddIObject( myActor->getIO(), false );
|
||||
SALOME_ListIO aList; aList.Append( myActor->getIO() );
|
||||
mySelectionMgr->setSelectedObjects( aList, false );
|
||||
|
||||
SMESH::UpdateView();
|
||||
mySimulation->SetVisibility(false);
|
||||
|
||||
buttonOk->setEnabled( false );
|
||||
buttonApply->setEnabled( false );
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
@ -454,9 +481,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
this->ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -465,62 +492,71 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk()
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
|
||||
{
|
||||
mySelection->ClearIObjects();
|
||||
mySelectionMgr->clearSelected();
|
||||
mySimulation->SetVisibility(false);
|
||||
SMESH::SetPointRepresentation(false);
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
mySMESHGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
myViewWindow->SetSelectionMode( ActorSelection );
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : onTextChange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
|
||||
//=================================================================================
|
||||
// function : onTextChange()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
|
||||
{
|
||||
if ( myBusy ) return;
|
||||
if (myBusy) return;
|
||||
myBusy = true;
|
||||
|
||||
myOkNodes = false;
|
||||
myNbOkNodes = 0;
|
||||
|
||||
buttonOk->setEnabled( false );
|
||||
buttonApply->setEnabled( false );
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
mySimulation->SetVisibility(false);
|
||||
|
||||
// hilight entered nodes
|
||||
SMDS_Mesh* aMesh = 0;
|
||||
if ( myActor )
|
||||
if (myActor)
|
||||
aMesh = myActor->GetObject()->GetMesh();
|
||||
if ( aMesh ) {
|
||||
|
||||
mySelection->ClearIObjects();
|
||||
mySelection->AddIObject( myActor->getIO() );
|
||||
if (aMesh) {
|
||||
SALOME_ListIO aList; aList.Append( myActor->getIO() );
|
||||
mySelectionMgr->setSelectedObjects( aList, false );
|
||||
|
||||
QStringList aListId = QStringList::split( " ", theNewText, false);
|
||||
bool allOk = true;
|
||||
for ( int i = 0; i < aListId.count(); i++ ) {
|
||||
const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
|
||||
if ( n ) {
|
||||
if ( mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
|
||||
allOk = false;
|
||||
else
|
||||
mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
|
||||
TColStd_IndexedMapOfInteger selectedIndices;
|
||||
TColStd_MapOfInteger newIndices;
|
||||
mySelector->GetIndex(myActor->getIO(), selectedIndices);
|
||||
|
||||
QStringList aListId = QStringList::split(" ", theNewText, false);
|
||||
for (int i = 0; i < aListId.count(); i++) {
|
||||
if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
|
||||
{
|
||||
if( selectedIndices.Add( n->GetID() ) )
|
||||
newIndices.Add( n->GetID() );
|
||||
myNbOkNodes++;
|
||||
}
|
||||
else
|
||||
allOk = false;
|
||||
}
|
||||
myOkNodes = (allOk && myNbNodes == aListId.count() );
|
||||
|
||||
if ( myOkNodes ) {
|
||||
buttonOk->setEnabled( true );
|
||||
buttonApply->setEnabled( true );
|
||||
displaySimulation();
|
||||
if( newIndices.Extent()>0 )
|
||||
{
|
||||
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true );
|
||||
myViewWindow->highlight( myActor->getIO(), true, true );
|
||||
}
|
||||
bool aNodesOK = false;
|
||||
if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){
|
||||
myNbOkNodes = aListId.count();
|
||||
aNodesOK = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(myNbOkNodes) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
displaySimulation();
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
@ -532,91 +568,97 @@ void SMESHGUI_AddMeshElementDlg::onTextChange(const QString& theNewText)
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument()
|
||||
{
|
||||
if ( myBusy ) return;
|
||||
if (myBusy) return;
|
||||
|
||||
// clear
|
||||
|
||||
myOkNodes = false;
|
||||
myNbOkNodes = 0;
|
||||
myActor = 0;
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText( "" );
|
||||
myEditCurrentArgument->setText("");
|
||||
myBusy = false;
|
||||
|
||||
if ( !GroupButtons->isEnabled() ) // inactive
|
||||
if (!GroupButtons->isEnabled()) // inactive
|
||||
return;
|
||||
|
||||
buttonOk->setEnabled( false );
|
||||
buttonApply->setEnabled( false );
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
mySimulation->SetVisibility(false);
|
||||
// SMESH::SetPointRepresentation(true);
|
||||
|
||||
// get selected mesh
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = mySelection->IObjectCount();
|
||||
if(nbSel != 1)
|
||||
if (aList.Extent() != 1)
|
||||
return;
|
||||
|
||||
myMesh = SMESH::GetMeshByIO( mySelection->firstIObject() );
|
||||
if ( myMesh->_is_nil() )
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
myActor = SMESH::FindActorByEntry( mySelection->firstIObject()->getEntry() );
|
||||
if ( !myActor )
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (!myActor)
|
||||
return;
|
||||
|
||||
// get selected nodes
|
||||
|
||||
QString aString = "";
|
||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
|
||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText( aString );
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
if ( myNbNodes != nbNodes )
|
||||
if (myIsPoly && myElementType == SMDSAbs_Face && nbNodes >= 3 ) {
|
||||
myNbNodes = nbNodes;
|
||||
} else if (myNbNodes != nbNodes) {
|
||||
return;
|
||||
}
|
||||
|
||||
// OK
|
||||
myNbOkNodes = nbNodes;
|
||||
|
||||
myOkNodes = true;
|
||||
|
||||
buttonOk->setEnabled( true );
|
||||
buttonApply->setEnabled( true );
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
|
||||
displaySimulation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : displaySimulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//=================================================================================
|
||||
// function : displaySimulation()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::displaySimulation()
|
||||
{
|
||||
if ( myOkNodes && GroupButtons->isEnabled() )
|
||||
{
|
||||
if (myNbOkNodes && GroupButtons->isEnabled()) {
|
||||
SMESH::TElementSimulation::TVTKIds anIds;
|
||||
QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false);
|
||||
for ( int i = 0; i < aListId.count(); i++ )
|
||||
anIds.push_back( myActor->GetObject()->GetNodeVTKId( aListId[ i ].toInt() ));
|
||||
QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
|
||||
for (int i = 0; i < aListId.count(); i++)
|
||||
anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
|
||||
|
||||
if ( Reverse && Reverse->isChecked() )
|
||||
if (Reverse && Reverse->isChecked())
|
||||
reverse(anIds.begin(),anIds.end());
|
||||
|
||||
vtkIdType aType = 0;
|
||||
switch ( myNbNodes ) {
|
||||
case 2: aType = VTK_LINE; break;
|
||||
case 3: aType = VTK_TRIANGLE; break;
|
||||
case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
|
||||
case 8: aType = VTK_HEXAHEDRON; break;
|
||||
default: return;
|
||||
if (myIsPoly)
|
||||
switch ( myElementType ) {
|
||||
case SMDSAbs_Face : aType = VTK_POLYGON; break;
|
||||
default: return;
|
||||
}
|
||||
else {
|
||||
switch (myNbNodes) {
|
||||
case 2: aType = VTK_LINE; break;
|
||||
case 3: aType = VTK_TRIANGLE; break;
|
||||
case 4: aType = myElementType == SMDSAbs_Face ? VTK_QUAD : VTK_TETRA; break;
|
||||
case 8: aType = VTK_HEXAHEDRON; break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
mySimulation->SetPosition(myActor,aType,anIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -624,11 +666,11 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation()
|
||||
void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
if (send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
}
|
||||
SelectionIntoArgument() ;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -637,18 +679,16 @@ void SMESHGUI_AddMeshElementDlg::SetEditCurrentArgument()
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
if (GroupConstructors->isEnabled()) {
|
||||
GroupConstructors->setEnabled(false);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
mySimulation->SetVisibility(false);
|
||||
mySMESHGUI->ResetState() ;
|
||||
mySMESHGUI->SetActiveDialogBox(0) ;
|
||||
mySMESHGUI->ResetState();
|
||||
mySMESHGUI->SetActiveDialogBox(0);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -656,15 +696,15 @@ void SMESHGUI_AddMeshElementDlg::DeactivateActiveDialog()
|
||||
void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
mySMESHGUI->EmitSignalDeactivateDialog() ;
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
GroupConstructors->setEnabled(true);
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
|
||||
SMESH::SetPointRepresentation(true);
|
||||
QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
|
||||
|
||||
myViewWindow->SetSelectionMode( NodeSelection );
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
@ -672,47 +712,45 @@ void SMESHGUI_AddMeshElementDlg::ActivateThisDialog()
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::enterEvent(QEvent* e)
|
||||
void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::closeEvent( QCloseEvent* e )
|
||||
void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : hideEvent
|
||||
//purpose : caused by ESC key
|
||||
//=======================================================================
|
||||
|
||||
void SMESHGUI_AddMeshElementDlg::hideEvent ( QHideEvent * e )
|
||||
{
|
||||
if ( !isMinimized() )
|
||||
ClickOnCancel() ;
|
||||
this->ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESHGUI_AddMeshElementDlg::CheckBox( int state )
|
||||
//=================================================================================
|
||||
// function : hideEvent()
|
||||
// purpose : caused by ESC key
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::hideEvent (QHideEvent*)
|
||||
{
|
||||
if ( !myOkNodes )
|
||||
if (!isMinimized())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : CheckBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddMeshElementDlg::CheckBox (int state)
|
||||
{
|
||||
if (!myNbOkNodes)
|
||||
return;
|
||||
|
||||
if ( state >= 0 ) {
|
||||
if (state >= 0) {
|
||||
mySimulation->SetVisibility(false);
|
||||
displaySimulation();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef DIALOGBOX_ADD_FACE_H
|
||||
#define DIALOGBOX_ADD_FACE_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
|
||||
@ -51,6 +51,8 @@ class QCheckBox;
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SMDS_Mesh;
|
||||
class SVTK_ViewWindow;
|
||||
class SVTK_Selector;
|
||||
|
||||
namespace SMESH{
|
||||
struct TElementSimulation;
|
||||
@ -69,33 +71,35 @@ class SMESHGUI_AddMeshElementDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_AddMeshElementDlg( QWidget* parent = 0, const char* name = 0,
|
||||
SALOME_Selection* Sel = 0,
|
||||
SMESHGUI_AddMeshElementDlg( SMESHGUI*,
|
||||
const char* = 0,
|
||||
SMDSAbs_ElementType ElementType = SMDSAbs_Edge,
|
||||
int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 );
|
||||
~SMESHGUI_AddMeshElementDlg();
|
||||
|
||||
private:
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void hideEvent ( QHideEvent * ); /* ESC key */
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void Init ();
|
||||
void closeEvent (QCloseEvent*);
|
||||
void hideEvent (QHideEvent*); /* ESC key */
|
||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
||||
void displaySimulation();
|
||||
|
||||
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
bool myOkNodes ; /* to check when arguments is defined */
|
||||
bool myBusy;
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
int myNbOkNodes; /* to check when arguments is defined */
|
||||
bool myBusy;
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
|
||||
int myElementType ;
|
||||
int myNbNodes;
|
||||
int myElementType;
|
||||
int myNbNodes;
|
||||
bool myIsPoly;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH::TElementSimulation* mySimulation;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH::TElementSimulation* mySimulation;
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
|
@ -33,16 +33,24 @@
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_MessageBox.h"
|
||||
#include "QAD_WaitCursor.h"
|
||||
#include "QAD_Operation.h"
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_Operation.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOMEDS_SObject.hxx"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
#include "SalomeApp_Tools.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
@ -56,178 +64,181 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace SMESH{
|
||||
SMESH::SMESH_subMesh_var AddSubMesh(SMESH::SMESH_Mesh_ptr theMesh,
|
||||
GEOM::GEOM_Object_ptr theShapeObject,
|
||||
const char* theMeshName )
|
||||
namespace SMESH {
|
||||
SMESH::SMESH_subMesh_var AddSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
||||
GEOM::GEOM_Object_ptr theShapeObject,
|
||||
const char* theMeshName)
|
||||
{
|
||||
SMESH::SMESH_subMesh_var aSubMesh;
|
||||
try {
|
||||
if ( !theMesh->_is_nil() && !theShapeObject->_is_nil() )
|
||||
aSubMesh = theMesh->GetSubMesh( theShapeObject, theMeshName );
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
QtCatchCorbaException( S_ex );
|
||||
if (!theMesh->_is_nil() && !theShapeObject->_is_nil())
|
||||
aSubMesh = theMesh->GetSubMesh(theShapeObject, theMeshName);
|
||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
return aSubMesh._retn();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_AddSubMeshDlg()
|
||||
// function : SMESHGUI_AddSubMeshDlg()
|
||||
// purpose : Constructs a SMESHGUI_AddSubMeshDlg 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_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
|
||||
SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( SMESHGUI* theModule, const char* name,
|
||||
bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
|
||||
if ( !name )
|
||||
setName( "SMESHGUI_AddSubMeshDlg" );
|
||||
setCaption( tr( "SMESH_ADD_SUBMESH" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this );
|
||||
SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
|
||||
SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
|
||||
QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
if (!name)
|
||||
setName("SMESHGUI_AddSubMeshDlg");
|
||||
setCaption(tr("SMESH_ADD_SUBMESH"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_AddSubMeshDlgLayout->setSpacing(6);
|
||||
SMESHGUI_AddSubMeshDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
||||
GroupC1Layout->setSpacing( 6 );
|
||||
GroupC1Layout->setMargin( 11 );
|
||||
GroupC1 = new QGroupBox (tr("SMESH_ARGUMENTS"), this, "GroupC1");
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
||||
GroupC1->layout()->setSpacing(0);
|
||||
GroupC1->layout()->setMargin(0);
|
||||
QGridLayout* GroupC1Layout = new QGridLayout (GroupC1->layout());
|
||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
||||
GroupC1Layout->setSpacing(6);
|
||||
GroupC1Layout->setMargin(11);
|
||||
|
||||
TextLabel_NameMesh = new QLabel( tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
|
||||
GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
|
||||
LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
|
||||
GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
|
||||
TextLabel_NameMesh = new QLabel (tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
|
||||
GroupC1Layout->addWidget(TextLabel_NameMesh, 0, 0);
|
||||
LineEdit_NameMesh = new QLineEdit (GroupC1, "LineEdit_NameMesh");
|
||||
GroupC1Layout->addWidget(LineEdit_NameMesh, 0, 2);
|
||||
|
||||
TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESH" ), GroupC1, "TextLabelC1A1" );
|
||||
GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
|
||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
||||
SelectButtonC1A1->setPixmap( image0 );
|
||||
SelectButtonC1A1->setToggleButton( FALSE );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
LineEditC1A1->setReadOnly( true );
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
|
||||
TextLabelC1A1 = new QLabel (tr("SMESH_OBJECT_MESH"), GroupC1, "TextLabelC1A1");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1, 1, 0);
|
||||
SelectButtonC1A1 = new QPushButton (GroupC1, "SelectButtonC1A1");
|
||||
SelectButtonC1A1->setPixmap(image0);
|
||||
SelectButtonC1A1->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1, 1, 1);
|
||||
LineEditC1A1 = new QLineEdit (GroupC1, "LineEditC1A1");
|
||||
LineEditC1A1->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 1, 2);
|
||||
|
||||
TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
|
||||
GroupC1Layout->addWidget( TextLabelC1A2, 2, 0 );
|
||||
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
|
||||
SelectButtonC1A2->setPixmap( image0 );
|
||||
SelectButtonC1A2->setToggleButton( FALSE );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
|
||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
||||
LineEditC1A2->setReadOnly( true );
|
||||
GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
|
||||
TextLabelC1A2 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A2");
|
||||
GroupC1Layout->addWidget(TextLabelC1A2, 2, 0);
|
||||
SelectButtonC1A2 = new QPushButton(GroupC1, "SelectButtonC1A2");
|
||||
SelectButtonC1A2->setPixmap(image0);
|
||||
SelectButtonC1A2->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A2, 2, 1);
|
||||
LineEditC1A2 = new QLineEdit(GroupC1, "LineEditC1A2");
|
||||
LineEditC1A2->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A2, 2, 2);
|
||||
|
||||
TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
|
||||
GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
|
||||
SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
|
||||
SelectButtonC1A1Hyp->setPixmap( image0 );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
|
||||
LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
|
||||
LineEditC1A1Hyp->setReadOnly( true );
|
||||
GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
|
||||
TextLabelC1A1Hyp = new QLabel(tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, "TextLabelC1A1Hyp");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Hyp, 3, 0);
|
||||
SelectButtonC1A1Hyp = new QPushButton(GroupC1, "SelectButtonC1A1Hyp");
|
||||
SelectButtonC1A1Hyp->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Hyp, 3, 1);
|
||||
LineEditC1A1Hyp = new QLineEdit(GroupC1, "LineEditC1A1Hyp");
|
||||
LineEditC1A1Hyp->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Hyp, 3, 2);
|
||||
|
||||
TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
|
||||
GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
|
||||
SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
|
||||
SelectButtonC1A1Algo->setPixmap( image0 );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
|
||||
LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
|
||||
LineEditC1A1Algo->setReadOnly( true );
|
||||
GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
|
||||
TextLabelC1A1Algo = new QLabel(tr("SMESH_OBJECT_ALGORITHM"), GroupC1, "TextLabelC1A1Algo");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1Algo, 4, 0);
|
||||
SelectButtonC1A1Algo = new QPushButton(GroupC1, "SelectButtonC1A1Algo");
|
||||
SelectButtonC1A1Algo->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1Algo, 4, 1);
|
||||
LineEditC1A1Algo = new QLineEdit(GroupC1, "LineEditC1A1Algo");
|
||||
LineEditC1A1Algo->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1Algo, 4, 2);
|
||||
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupC1, 1, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
|
||||
buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
|
||||
buttonOk->setAutoDefault( TRUE );
|
||||
buttonOk->setDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
||||
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
|
||||
buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
|
||||
buttonApply->setAutoDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
||||
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
|
||||
buttonApply->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
||||
|
||||
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
|
||||
GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
|
||||
buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
||||
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
SMESHGUI_AddSubMeshDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
Init( Sel ) ;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_AddSubMeshDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
|
||||
void SMESHGUI_AddSubMeshDlg::Init ()
|
||||
{
|
||||
mySelection = Sel;
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
|
||||
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
myGeomFilter = new SALOME_TypeFilter( "GEOM" );
|
||||
myMeshFilter = new SMESH_TypeFilter( MESH );
|
||||
myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM );
|
||||
myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
|
||||
//myGeomFilter = new SALOME_TypeFilter("GEOM");
|
||||
TColStd_MapOfInteger allTypesMap;
|
||||
for (int i = 0; i < 10; i++)
|
||||
allTypesMap.Add(i);
|
||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
||||
myMeshFilter = new SMESH_TypeFilter (MESH);
|
||||
myAlgorithmFilter = new SMESH_TypeFilter (ALGORITHM);
|
||||
myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A1Algo, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(SelectButtonC1A1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Hyp, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A1Algo, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
||||
connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
int x, y ;
|
||||
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
|
||||
this->move( x, y ) ;
|
||||
this->show() ;
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
LineEdit_NameMesh->setText( tr( "SMESH_SUBMESH" ) );
|
||||
LineEdit_NameMesh->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter( myMeshFilter ) ;
|
||||
LineEdit_NameMesh->setText(tr("SMESH_SUBMESH"));
|
||||
LineEdit_NameMesh->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
@ -238,8 +249,8 @@ void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::ClickOnOk()
|
||||
{
|
||||
if ( this->ClickOnApply() )
|
||||
this->ClickOnCancel() ;
|
||||
if (this->ClickOnApply())
|
||||
this->ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -248,68 +259,69 @@ void SMESHGUI_AddSubMeshDlg::ClickOnOk()
|
||||
//=================================================================================
|
||||
bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->ActiveStudyLocked())
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
|
||||
if ( myNameSubMesh.isEmpty() ) {
|
||||
QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
|
||||
if (myNameSubMesh.isEmpty()) {
|
||||
SUIT_MessageBox::warn1(this, tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_EMPTY_NAME"), tr("SMESH_BUT_OK"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
|
||||
if (myMesh->_is_nil() || myGeomShape->_is_nil() ||
|
||||
(!HypoList.count() && !AlgoList.count()))
|
||||
return false;
|
||||
|
||||
SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
|
||||
GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
|
||||
if ( myMainShape->_is_nil() )
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
if (myMainShape->_is_nil())
|
||||
return false;
|
||||
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
|
||||
SUIT_Operation* op =
|
||||
new SUIT_Operation (SUIT_Session::session()->activeApplication());
|
||||
|
||||
// start transaction
|
||||
op->start();
|
||||
|
||||
// create submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh(myMesh, myGeomShape, myNameSubMesh);
|
||||
int nbSuccess = 0;
|
||||
|
||||
if ( !aSubMesh->_is_nil() ) {
|
||||
if (!aSubMesh->_is_nil()) {
|
||||
// assign hypotheses
|
||||
int nbAlgo = AlgoList.count();
|
||||
int nbHyps = HypoList.count() + nbAlgo;
|
||||
for( int i = 0; i < nbHyps; i++ ) {
|
||||
SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID
|
||||
( i < nbAlgo ? AlgoList[i] : HypoList[i-nbAlgo] );
|
||||
if ( !aHypSO->_is_nil() ) {
|
||||
CORBA::Object_var anObject = aHypSO->GetObject();
|
||||
if ( !CORBA::is_nil( anObject ) ) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
|
||||
if ( !aHyp->_is_nil() )
|
||||
if ( SMESH::AddHypothesisOnSubMesh( aSubMesh, aHyp ) )
|
||||
for (int i = 0; i < nbHyps; i++) {
|
||||
_PTR(SObject) aHypSOClient =
|
||||
SMESH::GetActiveStudyDocument()->FindObjectID
|
||||
(i < nbAlgo ? AlgoList[i].latin1() : HypoList[i-nbAlgo].latin1());
|
||||
if (aHypSOClient) {
|
||||
CORBA::Object_var anObject = _CAST(SObject,aHypSOClient)->GetObject();
|
||||
if (!CORBA::is_nil(anObject)) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
|
||||
if (!aHyp->_is_nil())
|
||||
if (SMESH::AddHypothesisOnSubMesh(aSubMesh, aHyp))
|
||||
nbSuccess++;
|
||||
}
|
||||
else {
|
||||
SCRUTE( CORBA::is_nil( anObject ));
|
||||
} else {
|
||||
SCRUTE(CORBA::is_nil(anObject));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SCRUTE( aHypSO->_is_nil() );
|
||||
} else {
|
||||
SCRUTE(!aHypSOClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
SCRUTE( aSubMesh->_is_nil() );
|
||||
} else {
|
||||
SCRUTE(aSubMesh->_is_nil());
|
||||
}
|
||||
|
||||
// commit transaction
|
||||
op->finish();
|
||||
return ( nbSuccess > 0 );
|
||||
op->commit();
|
||||
mySMESHGUI->updateObjBrowser();
|
||||
return (nbSuccess > 0);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
@ -319,16 +331,18 @@ void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
|
||||
close();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsFatherOf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
|
||||
if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
|
||||
SALOMEDS::SObject_var aSO = SO->GetFather();
|
||||
while( strlen( aSO->GetID() ) >= strlen( fatherSO->GetID() ) ) {
|
||||
if ( QString( aSO->GetID() ) == QString( fatherSO->GetID() ) )
|
||||
//=================================================================================
|
||||
// function : IsFatherOf()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
static bool IsFatherOf (_PTR(SObject) SO, _PTR(SObject) fatherSO)
|
||||
{
|
||||
if (SO && fatherSO) {
|
||||
_PTR(SObject) aSO = SO->GetFather();
|
||||
//while (strlen(aSO->GetID()) >= strlen(fatherSO->GetID())) {
|
||||
while (aSO->GetID().length() >= fatherSO->GetID().length()) {
|
||||
//if (QString(aSO->GetID()) == QString(fatherSO->GetID()))
|
||||
if (aSO->GetID() == fatherSO->GetID())
|
||||
return true;
|
||||
aSO = aSO->GetFather();
|
||||
}
|
||||
@ -343,86 +357,85 @@ static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO
|
||||
void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
|
||||
{
|
||||
QString aString = "";
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (myEditCurrentArgument == LineEditC1A1) {
|
||||
// mesh
|
||||
if ( nbSel != 1 ) {
|
||||
if (nbSel != 1) {
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
aString = "";
|
||||
}
|
||||
else {
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
|
||||
if( myMesh->_is_nil() ) {
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
if (myMesh->_is_nil()) {
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
LineEditC1A2->setText( "" );
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
||||
LineEditC1A2->setText("");
|
||||
|
||||
} else if (myEditCurrentArgument == LineEditC1A2) {
|
||||
// geom shape
|
||||
if ( nbSel != 1 ) {
|
||||
if (nbSel != 1) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
else {
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
|
||||
if( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) )
|
||||
{
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
|
||||
if (myGeomShape->_is_nil() || !GEOMBase::IsShape(myGeomShape)) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
if ( !myMesh->_is_nil() ) {
|
||||
SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
|
||||
GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
|
||||
SALOMEDS::SObject_var aMainGeomShapeSO = SMESH::FindSObject( aMainGeomShape );
|
||||
if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( SMESH::GetActiveStudyDocument()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
|
||||
if (!myMesh->_is_nil()) {
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
_PTR(SObject) aMainGeomShapeSO = SMESH::FindSObject(aMainGeomShape);
|
||||
if (!aMainGeomShapeSO ||
|
||||
!IsFatherOf(SMESH::GetActiveStudyDocument()->FindObjectID
|
||||
(IO->getEntry()), aMainGeomShapeSO)) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Hyp) {
|
||||
// hypotheses
|
||||
HypoList.clear();
|
||||
if ( nbSel >= 1 ) {
|
||||
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
|
||||
for ( ; Itinit.More(); Itinit.Next() ) {
|
||||
HypoList.append( Itinit.Value()->getEntry() );
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
HypoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if ( nbSel > 1 )
|
||||
aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
|
||||
}
|
||||
else {
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Hypothesis").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
|
||||
} else if (myEditCurrentArgument == LineEditC1A1Algo) {
|
||||
// algorithms
|
||||
AlgoList.clear();
|
||||
if ( nbSel >= 1 ) {
|
||||
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
|
||||
for ( ; Itinit.More(); Itinit.Next() ) {
|
||||
AlgoList.append( Itinit.Value()->getEntry() );
|
||||
if (nbSel >= 1) {
|
||||
SALOME_ListIteratorOfListIO Itinit (aList);
|
||||
for (; Itinit.More(); Itinit.Next()) {
|
||||
AlgoList.append(Itinit.Value()->getEntry());
|
||||
}
|
||||
if ( nbSel > 1 )
|
||||
aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
|
||||
}
|
||||
else {
|
||||
if (nbSel > 1)
|
||||
aString = tr("%1 Algorithms").arg(nbSel);
|
||||
} else {
|
||||
aString = "";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myEditCurrentArgument->setCursorPosition( 0 );
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -431,27 +444,27 @@ void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
LineEditC1A1->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter(myMeshFilter) ;
|
||||
} else if (send == SelectButtonC1A2) {
|
||||
LineEditC1A2->setFocus() ;
|
||||
LineEditC1A2->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
myEditCurrentArgument = LineEditC1A2;
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter(myGeomFilter) ;
|
||||
} else if( send == SelectButtonC1A1Hyp ) {
|
||||
LineEditC1A1Hyp->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1Hyp ;
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter(myHypothesisFilter) ;
|
||||
} else if( send == SelectButtonC1A1Algo ) {
|
||||
LineEditC1A1Algo->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1Algo ;
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter(myAlgorithmFilter) ;
|
||||
} else if(send == SelectButtonC1A1Hyp) {
|
||||
LineEditC1A1Hyp->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myHypothesisFilter);
|
||||
myEditCurrentArgument = LineEditC1A1Hyp;
|
||||
} else if(send == SelectButtonC1A1Algo) {
|
||||
LineEditC1A1Algo->setFocus();
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myAlgorithmFilter);
|
||||
myEditCurrentArgument = LineEditC1A1Algo;
|
||||
}
|
||||
SelectionIntoArgument() ;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -460,48 +473,45 @@ void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupC1->isEnabled() ) {
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
if (GroupC1->isEnabled()) {
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
|
||||
{
|
||||
mySMESHGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
|
||||
void SMESHGUI_AddSubMeshDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !GroupC1->isEnabled() )
|
||||
ActivateThisDialog() ;
|
||||
if (!GroupC1->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
|
||||
void SMESHGUI_AddSubMeshDlg::closeEvent (QCloseEvent* e)
|
||||
{
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
mySMESHGUI->ResetState() ;
|
||||
mySelection->ClearFilters() ;
|
||||
QDialog::closeEvent( e );
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
mySelectionMgr->clearFilters();
|
||||
QDialog::closeEvent(e);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -510,14 +520,16 @@ void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
|
||||
//=================================================================================
|
||||
void SMESHGUI_AddSubMeshDlg::UpdateControlState()
|
||||
{
|
||||
bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
|
||||
bool isEnabled = (!myMesh->_is_nil() &&
|
||||
!myGeomShape->_is_nil() &&
|
||||
(HypoList.count() || AlgoList.count()));
|
||||
bool isImportedMesh = false;
|
||||
if ( !myMesh->_is_nil() ) {
|
||||
SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
|
||||
GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
|
||||
if (!myMesh->_is_nil()) {
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
isImportedMesh = myGeomShape->_is_nil();
|
||||
}
|
||||
|
||||
buttonOk ->setEnabled( isEnabled && !isImportedMesh );
|
||||
buttonApply->setEnabled( isEnabled && !isImportedMesh );
|
||||
buttonOk ->setEnabled(isEnabled && !isImportedMesh);
|
||||
buttonApply->setEnabled(isEnabled && !isImportedMesh);
|
||||
}
|
||||
|
@ -29,9 +29,10 @@
|
||||
#ifndef DIALOGBOX_ADD_SUBMESH_H
|
||||
#define DIALOGBOX_ADD_SUBMESH_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SALOME_TypeFilter.hxx"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
//#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
@ -57,33 +58,40 @@ class SMESHGUI_AddSubMeshDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_AddSubMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
SMESHGUI_AddSubMeshDlg( SMESHGUI*,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~SMESHGUI_AddSubMeshDlg();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ;
|
||||
void closeEvent (QCloseEvent* e);
|
||||
void enterEvent (QEvent *) ;
|
||||
|
||||
private:
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void Init ();
|
||||
|
||||
void UpdateControlState();
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI ;
|
||||
SALOME_Selection* mySelection ;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
GEOM::GEOM_Object_var myGeomShape ;
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
GEOM::GEOM_Object_var myGeomShape;
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
|
||||
Handle(SALOME_TypeFilter) myGeomFilter;
|
||||
Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
Handle(SMESH_TypeFilter) myHypothesisFilter;
|
||||
Handle(SMESH_TypeFilter) myAlgorithmFilter;
|
||||
//Handle(SALOME_TypeFilter) myMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) myHypothesisFilter;
|
||||
//Handle(SMESH_TypeFilter) myAlgorithmFilter;
|
||||
SUIT_SelectionFilter* myGeomFilter;
|
||||
SUIT_SelectionFilter* myMeshFilter;
|
||||
SUIT_SelectionFilter* myHypothesisFilter;
|
||||
SUIT_SelectionFilter* myAlgorithmFilter;
|
||||
|
||||
QStringList HypoList;
|
||||
QStringList AlgoList;
|
||||
QStringList HypoList;
|
||||
QStringList AlgoList;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
@ -91,8 +99,8 @@ private:
|
||||
QPushButton* buttonCancel;
|
||||
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabel_NameMesh ;
|
||||
QLineEdit* LineEdit_NameMesh ;
|
||||
QLabel* TextLabel_NameMesh;
|
||||
QLineEdit* LineEdit_NameMesh;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
@ -112,10 +120,10 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_ADD_SUBMESH_H
|
||||
|
@ -32,7 +32,21 @@
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include "SalomeApp_Application.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
#include "SVTK_Selector.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qlabel.h>
|
||||
@ -42,6 +56,7 @@
|
||||
#include <qlayout.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
// VTK Includes
|
||||
#include <vtkMath.h>
|
||||
#include <vtkCamera.h>
|
||||
#include <vtkRenderer.h>
|
||||
@ -53,42 +68,30 @@
|
||||
#include <vtkDataSetMapper.h>
|
||||
#include <vtkPlaneSource.h>
|
||||
#include <vtkPolyData.h>
|
||||
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "QAD_WaitCursor.h"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "VTKViewer_RenderWindow.h"
|
||||
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
// STL includes
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class OrientedPlane: public vtkPlane
|
||||
{
|
||||
QAD_Study* myStudy;
|
||||
QAD_StudyFrame* myStudyFrame;
|
||||
VTKViewer_ViewFrame* myViewFrame;
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
|
||||
vtkDataSetMapper* myMapper;
|
||||
|
||||
|
||||
public:
|
||||
static OrientedPlane *New(){
|
||||
static OrientedPlane *New()
|
||||
{
|
||||
return new OrientedPlane();
|
||||
}
|
||||
static OrientedPlane *New(QAD_Study* theStudy){
|
||||
return new OrientedPlane(theStudy);
|
||||
static OrientedPlane *New(SVTK_ViewWindow* theViewWindow)
|
||||
{
|
||||
return new OrientedPlane(theViewWindow);
|
||||
}
|
||||
vtkTypeMacro(OrientedPlane, vtkPlane);
|
||||
|
||||
vtkTypeMacro (OrientedPlane, vtkPlane);
|
||||
|
||||
SMESH::Orientation myOrientation;
|
||||
float myDistance;
|
||||
@ -97,13 +100,14 @@ public:
|
||||
vtkPlaneSource* myPlaneSource;
|
||||
SALOME_Actor *myActor;
|
||||
|
||||
void SetOrientation(SMESH::Orientation theOrientation) {myOrientation = theOrientation;}
|
||||
SMESH::Orientation GetOrientation() {return myOrientation;}
|
||||
void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
|
||||
SMESH::Orientation GetOrientation() { return myOrientation; }
|
||||
|
||||
void SetDistance(float theDistance) {myDistance = theDistance;}
|
||||
float GetDistance() {return myDistance;}
|
||||
void SetDistance (float theDistance) { myDistance = theDistance; }
|
||||
float GetDistance() { return myDistance; }
|
||||
|
||||
void ShallowCopy(OrientedPlane* theOrientedPlane){
|
||||
void ShallowCopy (OrientedPlane* theOrientedPlane)
|
||||
{
|
||||
SetNormal(theOrientedPlane->GetNormal());
|
||||
SetOrigin(theOrientedPlane->GetOrigin());
|
||||
|
||||
@ -120,41 +124,38 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
OrientedPlane(QAD_Study* theStudy):
|
||||
OrientedPlane(SVTK_ViewWindow* theViewWindow):
|
||||
myViewWindow(theViewWindow),
|
||||
myOrientation(SMESH::XY),
|
||||
myDistance(0.5),
|
||||
myStudy(theStudy),
|
||||
myStudyFrame(theStudy->getActiveStudyFrame()),
|
||||
myViewFrame(SMESH::GetVtkViewFrame(theStudy->getActiveStudyFrame()))
|
||||
myDistance(0.5)
|
||||
{
|
||||
Init();
|
||||
myViewFrame->AddActor( myActor );
|
||||
myViewWindow->AddActor(myActor);
|
||||
}
|
||||
|
||||
OrientedPlane():
|
||||
myOrientation(SMESH::XY),
|
||||
myDistance(0.5),
|
||||
myStudy(NULL),
|
||||
myStudyFrame(NULL),
|
||||
myViewFrame(NULL)
|
||||
myViewWindow(NULL),
|
||||
myDistance(0.5)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init(){
|
||||
void Init()
|
||||
{
|
||||
myPlaneSource = vtkPlaneSource::New();
|
||||
|
||||
myAngle[0] = myAngle[1] = 0.0;
|
||||
|
||||
// Create and display actor
|
||||
myMapper = vtkDataSetMapper::New();
|
||||
myMapper->SetInput( myPlaneSource->GetOutput() );
|
||||
myMapper->SetInput(myPlaneSource->GetOutput());
|
||||
|
||||
myActor = SALOME_Actor::New();
|
||||
myActor->VisibilityOff();
|
||||
myActor->PickableOff();
|
||||
myActor->SetInfinitive(true);
|
||||
myActor->SetMapper( myMapper );
|
||||
myActor->SetMapper(myMapper);
|
||||
|
||||
vtkProperty* aProp = vtkProperty::New();
|
||||
float anRGB[3];
|
||||
@ -163,7 +164,7 @@ protected:
|
||||
anRGB[2] = SMESH::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
|
||||
aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
aProp->SetOpacity(0.75);
|
||||
myActor->SetProperty( aProp );
|
||||
myActor->SetProperty(aProp);
|
||||
aProp->Delete();
|
||||
|
||||
vtkProperty* aBackProp = vtkProperty::New();
|
||||
@ -172,14 +173,12 @@ protected:
|
||||
anRGB[2] = SMESH::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
|
||||
aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
aBackProp->SetOpacity(0.75);
|
||||
myActor->SetBackfaceProperty( aBackProp );
|
||||
myActor->SetBackfaceProperty(aBackProp);
|
||||
aBackProp->Delete();
|
||||
}
|
||||
|
||||
~OrientedPlane(){
|
||||
if(myStudy && SMESH::FindVtkViewFrame(myStudy,myStudyFrame)){
|
||||
myViewFrame->RemoveActor(myActor);
|
||||
}
|
||||
myViewWindow->RemoveActor(myActor);
|
||||
myActor->Delete();
|
||||
|
||||
myMapper->RemoveAllInputs();
|
||||
@ -191,12 +190,12 @@ protected:
|
||||
|
||||
private:
|
||||
// Not implemented.
|
||||
OrientedPlane(const OrientedPlane&);
|
||||
void operator=(const OrientedPlane&);
|
||||
OrientedPlane (const OrientedPlane&);
|
||||
void operator= (const OrientedPlane&);
|
||||
|
||||
};
|
||||
|
||||
struct TSetVisiblity{
|
||||
struct TSetVisiblity {
|
||||
TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){}
|
||||
void operator()(SMESH::TVTKPlane& theOrientedPlane){
|
||||
theOrientedPlane->myActor->SetVisibility(myIsVisible);
|
||||
@ -204,140 +203,143 @@ struct TSetVisiblity{
|
||||
int myIsVisible;
|
||||
};
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ClippingDlg()
|
||||
// purpose :
|
||||
//
|
||||
//=================================================================================
|
||||
SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
|
||||
SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg (SMESHGUI* theModule,
|
||||
const char* name,
|
||||
bool modal,
|
||||
WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
|
||||
WFlags fl):
|
||||
QDialog(SMESH::GetDesktop(theModule),
|
||||
name,
|
||||
modal,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
|
||||
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
|
||||
mySMESHGUI(theModule)
|
||||
{
|
||||
if ( !name )
|
||||
setName( "SMESHGUI_ClippingDlg" );
|
||||
setCaption( tr( "SMESH_CLIPPING_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout( this );
|
||||
SMESHGUI_ClippingDlgLayout->setSpacing( 6 );
|
||||
SMESHGUI_ClippingDlgLayout->setMargin( 11 );
|
||||
if (!name)
|
||||
setName("SMESHGUI_ClippingDlg");
|
||||
setCaption(tr("SMESH_CLIPPING_TITLE"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_ClippingDlgLayout->setSpacing(6);
|
||||
SMESHGUI_ClippingDlgLayout->setMargin(11);
|
||||
|
||||
// Controls for selecting, creating, deleting planes
|
||||
QGroupBox* GroupPlanes = new QGroupBox( this, "GroupPlanes" );
|
||||
GroupPlanes->setTitle( tr("Clipping planes") );
|
||||
QGroupBox* GroupPlanes = new QGroupBox (this, "GroupPlanes");
|
||||
GroupPlanes->setTitle(tr("Clipping planes"));
|
||||
GroupPlanes->setColumnLayout(0, Qt::Vertical);
|
||||
GroupPlanes->layout()->setSpacing( 0 );
|
||||
GroupPlanes->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupPlanesLayout = new QGridLayout( GroupPlanes->layout() );
|
||||
GroupPlanesLayout->setAlignment( Qt::AlignTop );
|
||||
GroupPlanesLayout->setSpacing( 6 );
|
||||
GroupPlanesLayout->setMargin( 11 );
|
||||
GroupPlanes->layout()->setSpacing(0);
|
||||
GroupPlanes->layout()->setMargin(0);
|
||||
QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes->layout());
|
||||
GroupPlanesLayout->setAlignment(Qt::AlignTop);
|
||||
GroupPlanesLayout->setSpacing(6);
|
||||
GroupPlanesLayout->setMargin(11);
|
||||
|
||||
ComboBoxPlanes = new QComboBox(GroupPlanes, "ComboBoxPlanes");
|
||||
GroupPlanesLayout->addWidget( ComboBoxPlanes, 0, 0 );
|
||||
GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
|
||||
|
||||
QSpacerItem* spacerGP = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
GroupPlanesLayout->addItem( spacerGP, 0, 1 );
|
||||
QSpacerItem* spacerGP = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
GroupPlanesLayout->addItem(spacerGP, 0, 1);
|
||||
|
||||
buttonNew = new QPushButton( GroupPlanes, "buttonNew" );
|
||||
buttonNew->setText( tr( "SMESH_BUT_NEW" ) );
|
||||
GroupPlanesLayout->addWidget( buttonNew, 0, 2 );
|
||||
buttonNew = new QPushButton (GroupPlanes, "buttonNew");
|
||||
buttonNew->setText(tr("SMESH_BUT_NEW"));
|
||||
GroupPlanesLayout->addWidget(buttonNew, 0, 2);
|
||||
|
||||
buttonDelete = new QPushButton( GroupPlanes, "buttonDelete" );
|
||||
buttonDelete->setText( tr( "SMESH_BUT_DELETE" ) );
|
||||
GroupPlanesLayout->addWidget( buttonDelete, 0, 3 );
|
||||
buttonDelete = new QPushButton (GroupPlanes, "buttonDelete");
|
||||
buttonDelete->setText(tr("SMESH_BUT_DELETE"));
|
||||
GroupPlanesLayout->addWidget(buttonDelete, 0, 3);
|
||||
|
||||
// Controls for defining plane parameters
|
||||
QGroupBox* GroupParameters = new QGroupBox( this, "GroupParameters" );
|
||||
GroupParameters->setTitle( tr("SMESH_PARAMETERS") );
|
||||
QGroupBox* GroupParameters = new QGroupBox (this, "GroupParameters");
|
||||
GroupParameters->setTitle(tr("SMESH_PARAMETERS"));
|
||||
GroupParameters->setColumnLayout(0, Qt::Vertical);
|
||||
GroupParameters->layout()->setSpacing( 0 );
|
||||
GroupParameters->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupParametersLayout = new QGridLayout( GroupParameters->layout() );
|
||||
GroupParametersLayout->setAlignment( Qt::AlignTop );
|
||||
GroupParametersLayout->setSpacing( 6 );
|
||||
GroupParametersLayout->setMargin( 11 );
|
||||
GroupParameters->layout()->setSpacing(0);
|
||||
GroupParameters->layout()->setMargin(0);
|
||||
QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters->layout());
|
||||
GroupParametersLayout->setAlignment(Qt::AlignTop);
|
||||
GroupParametersLayout->setSpacing(6);
|
||||
GroupParametersLayout->setMargin(11);
|
||||
|
||||
TextLabelOrientation = new QLabel( GroupParameters, "TextLabelOrientation" );
|
||||
TextLabelOrientation->setText( tr("SMESH_ORIENTATION") );
|
||||
GroupParametersLayout->addWidget( TextLabelOrientation, 0, 0 );
|
||||
TextLabelOrientation = new QLabel(GroupParameters, "TextLabelOrientation");
|
||||
TextLabelOrientation->setText(tr("SMESH_ORIENTATION"));
|
||||
GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
|
||||
|
||||
ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation");
|
||||
GroupParametersLayout->addWidget( ComboBoxOrientation, 0, 1 );
|
||||
GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1);
|
||||
|
||||
TextLabelDistance = new QLabel( GroupParameters, "TextLabelDistance" );
|
||||
TextLabelDistance->setText( tr("SMESH_DISTANCE") );
|
||||
GroupParametersLayout->addWidget( TextLabelDistance, 1, 0 );
|
||||
TextLabelDistance = new QLabel(GroupParameters, "TextLabelDistance");
|
||||
TextLabelDistance->setText(tr("SMESH_DISTANCE"));
|
||||
GroupParametersLayout->addWidget(TextLabelDistance, 1, 0);
|
||||
|
||||
SpinBoxDistance = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxDistance" );
|
||||
GroupParametersLayout->addWidget( SpinBoxDistance, 1, 1 );
|
||||
SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxDistance");
|
||||
GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1);
|
||||
|
||||
TextLabelRot1 = new QLabel( GroupParameters, "TextLabelRot1" );
|
||||
TextLabelRot1->setText( tr("Rotation around X (Y to Z):") );
|
||||
GroupParametersLayout->addWidget( TextLabelRot1, 2, 0 );
|
||||
TextLabelRot1 = new QLabel(GroupParameters, "TextLabelRot1");
|
||||
TextLabelRot1->setText(tr("Rotation around X (Y to Z):"));
|
||||
GroupParametersLayout->addWidget(TextLabelRot1, 2, 0);
|
||||
|
||||
SpinBoxRot1 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot1" );
|
||||
GroupParametersLayout->addWidget( SpinBoxRot1, 2, 1 );
|
||||
SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot1");
|
||||
GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1);
|
||||
|
||||
TextLabelRot2 = new QLabel( GroupParameters, "TextLabelRot2" );
|
||||
TextLabelRot2->setText( tr("Rotation around Y (X to Z):") );
|
||||
GroupParametersLayout->addWidget( TextLabelRot2, 3, 0 );
|
||||
TextLabelRot2 = new QLabel(GroupParameters, "TextLabelRot2");
|
||||
TextLabelRot2->setText(tr("Rotation around Y (X to Z):"));
|
||||
GroupParametersLayout->addWidget(TextLabelRot2, 3, 0);
|
||||
|
||||
SpinBoxRot2 = new SMESHGUI_SpinBox( GroupParameters, "SpinBoxRot2" );
|
||||
GroupParametersLayout->addWidget( SpinBoxRot2, 3, 1 );
|
||||
SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot2");
|
||||
GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1);
|
||||
|
||||
PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters);
|
||||
PreviewCheckBox->setChecked(true);
|
||||
GroupParametersLayout->addWidget( PreviewCheckBox, 4, 0 );
|
||||
GroupParametersLayout->addWidget(PreviewCheckBox, 4, 0);
|
||||
|
||||
AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters);
|
||||
AutoApplyCheckBox->setChecked(false);
|
||||
GroupParametersLayout->addWidget( AutoApplyCheckBox, 4, 1 );
|
||||
GroupParametersLayout->addWidget(AutoApplyCheckBox, 4, 1);
|
||||
|
||||
// Controls for "Ok", "Apply" and "Close" button
|
||||
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
|
||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
||||
GroupButtons->setTitle( tr( "" ) );
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
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 );
|
||||
QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth()));
|
||||
GroupButtons->setGeometry(QRect(10, 10, 281, 48));
|
||||
GroupButtons->setTitle(tr("" ));
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
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_ClippingDlgLayout->addWidget( GroupPlanes, 0, 0 );
|
||||
SMESHGUI_ClippingDlgLayout->addWidget( GroupParameters, 1, 0 );
|
||||
SMESHGUI_ClippingDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
|
||||
mySelection = SALOME_Selection::Selection( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getSelection());
|
||||
SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes, 0, 0);
|
||||
SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters, 1, 0);
|
||||
SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
// Initial state
|
||||
SpinBoxDistance->RangeStepAndValidator( 0.0, 1.0, 0.01, 3 );
|
||||
SpinBoxRot1->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
|
||||
SpinBoxRot2->RangeStepAndValidator( -180.0, 180.0, 1, 3 );
|
||||
SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, 3);
|
||||
SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, 3);
|
||||
SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, 3);
|
||||
|
||||
ComboBoxOrientation->insertItem( tr("|| X-Y") );
|
||||
ComboBoxOrientation->insertItem( tr("|| Y-Z") );
|
||||
ComboBoxOrientation->insertItem( tr("|| Z-X") );
|
||||
ComboBoxOrientation->insertItem(tr("|| X-Y"));
|
||||
ComboBoxOrientation->insertItem(tr("|| Y-Z"));
|
||||
ComboBoxOrientation->insertItem(tr("|| Z-X"));
|
||||
|
||||
SpinBoxDistance->SetValue(0.5);
|
||||
|
||||
@ -346,31 +348,30 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
|
||||
onSelectionChanged();
|
||||
|
||||
// signals and slots connections :
|
||||
connect( ComboBoxPlanes, SIGNAL( activated( int )), this, SLOT( onSelectPlane( int ) ) );
|
||||
connect( buttonNew, SIGNAL( clicked() ), this, SLOT( ClickOnNew() ) );
|
||||
connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( ClickOnDelete() ) );
|
||||
connect( ComboBoxOrientation, SIGNAL( activated( int )), this, SLOT( onSelectOrientation( int ) ) );
|
||||
connect( SpinBoxDistance, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
|
||||
connect( SpinBoxRot1, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
|
||||
connect( SpinBoxRot2, SIGNAL( valueChanged( double )), this, SLOT( SetCurrentPlaneParam() ) );
|
||||
connect( PreviewCheckBox, SIGNAL( toggled( bool )), this, SLOT( OnPreviewToggle( bool ) ) );
|
||||
connect( AutoApplyCheckBox, SIGNAL( toggled( bool )), this, SLOT( ClickOnApply() ) );
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ) ;
|
||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
|
||||
connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
|
||||
connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
|
||||
connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
|
||||
connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
|
||||
connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
|
||||
connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
|
||||
connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
|
||||
connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
|
||||
connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
|
||||
/* to close dialog if study frame change */
|
||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL ( SignalStudyFrameChanged() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
int x, y ;
|
||||
SMESHGUI::GetSMESHGUI()->DefineDlgPosition( this, x, y ) ;
|
||||
this->move( x, y ) ;
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_ClippingDlg()
|
||||
// purpose :
|
||||
@ -379,44 +380,45 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
SMESH::RenderViewWindow(SMESH::GetViewWindow(mySMESHGUI));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::ClickOnApply()
|
||||
{
|
||||
if (!myActor)
|
||||
return;
|
||||
|
||||
if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
|
||||
QAD_WaitCursor wc;
|
||||
if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)) {
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
myActor->RemoveAllClippingPlanes();
|
||||
|
||||
SMESH::TPlanes::iterator anIter = myPlanes.begin();
|
||||
for (;anIter != myPlanes.end();anIter++){
|
||||
OrientedPlane* anOrientedPlane = OrientedPlane::New();
|
||||
for (; anIter != myPlanes.end(); anIter++) {
|
||||
OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
|
||||
anOrientedPlane->ShallowCopy(anIter->GetPointer());
|
||||
myActor->AddClippingPlane(anOrientedPlane);
|
||||
anOrientedPlane->Delete();
|
||||
}
|
||||
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
SMESH::RenderViewWindow(aViewWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply() ;
|
||||
ClickOnCancel() ;
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
@ -426,26 +428,26 @@ void SMESHGUI_ClippingDlg::ClickOnCancel()
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onSelectionChanged()
|
||||
// purpose : Called when selection is changed
|
||||
//=================================================================================
|
||||
void SMESHGUI_ClippingDlg::onSelectionChanged()
|
||||
{
|
||||
if ( SMESHGUI::GetSMESHGUI()->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
|
||||
if ( mySelection->IObjectCount() ) {
|
||||
Handle(SALOME_InteractiveObject) IOS = mySelection->firstIObject();
|
||||
if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)) {
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
if (aList.Extent() > 0) {
|
||||
Handle(SALOME_InteractiveObject) IOS = aList.First();
|
||||
myActor = SMESH::FindActorByEntry(IOS->getEntry());
|
||||
if ( myActor ){
|
||||
if (myActor) {
|
||||
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
|
||||
myPlanes.clear();
|
||||
|
||||
vtkIdType anId = 0, anEnd = myActor->GetNumberOfClippingPlanes();
|
||||
for(; anId < anEnd; anId++){
|
||||
if(vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)){
|
||||
for (; anId < anEnd; anId++) {
|
||||
if (vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)) {
|
||||
if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){
|
||||
OrientedPlane* anOrientedPlane = OrientedPlane::New(SMESH::GetActiveStudy());
|
||||
OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
|
||||
SMESH::TVTKPlane aTVTKPlane(anOrientedPlane);
|
||||
anOrientedPlane->Delete();
|
||||
aTVTKPlane->ShallowCopy(aPlane);
|
||||
@ -458,17 +460,16 @@ void SMESHGUI_ClippingDlg::onSelectionChanged()
|
||||
TSetVisiblity(PreviewCheckBox->isChecked()));
|
||||
}
|
||||
}
|
||||
SMESH::RenderViewWindow(aViewWindow);
|
||||
}
|
||||
Sinchronize();
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : onSelectPlane()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
|
||||
void SMESHGUI_ClippingDlg::onSelectPlane (int theIndex)
|
||||
{
|
||||
if (!myActor || myPlanes.empty())
|
||||
return;
|
||||
@ -502,7 +503,6 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
|
||||
myIsSelectPlane = false;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnNew()
|
||||
// purpose :
|
||||
@ -512,18 +512,19 @@ void SMESHGUI_ClippingDlg::ClickOnNew()
|
||||
if (!myActor)
|
||||
return;
|
||||
|
||||
OrientedPlane* aPlane = OrientedPlane::New(SMESH::GetActiveStudy());
|
||||
SMESH::TVTKPlane aTVTKPlane(aPlane);
|
||||
myPlanes.push_back(aTVTKPlane);
|
||||
if(SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)){
|
||||
OrientedPlane* aPlane = OrientedPlane::New(aViewWindow);
|
||||
SMESH::TVTKPlane aTVTKPlane(aPlane);
|
||||
myPlanes.push_back(aTVTKPlane);
|
||||
|
||||
if(PreviewCheckBox->isChecked())
|
||||
aTVTKPlane->myActor->VisibilityOn();
|
||||
if (PreviewCheckBox->isChecked())
|
||||
aTVTKPlane->myActor->VisibilityOn();
|
||||
|
||||
Sinchronize();
|
||||
SetCurrentPlaneParam();
|
||||
Sinchronize();
|
||||
SetCurrentPlaneParam();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnDelete()
|
||||
// purpose :
|
||||
@ -543,37 +544,35 @@ void SMESHGUI_ClippingDlg::ClickOnDelete()
|
||||
ClickOnApply();
|
||||
|
||||
Sinchronize();
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : onSelectOrientation()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::onSelectOrientation(int theItem)
|
||||
void SMESHGUI_ClippingDlg::onSelectOrientation (int theItem)
|
||||
{
|
||||
if (myPlanes.empty())
|
||||
return;
|
||||
|
||||
if (theItem == 0) {
|
||||
TextLabelRot1->setText( tr( "Rotation around X (Y to Z):") );
|
||||
TextLabelRot2->setText( tr( "Rotation around Y (X to Z):" ) );
|
||||
TextLabelRot1->setText(tr("Rotation around X (Y to Z):"));
|
||||
TextLabelRot2->setText(tr("Rotation around Y (X to Z):"));
|
||||
}
|
||||
else if (theItem == 1) {
|
||||
TextLabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
|
||||
TextLabelRot2->setText( tr( "Rotation around Z (Y to X):" ) );
|
||||
TextLabelRot1->setText(tr("Rotation around Y (Z to X):"));
|
||||
TextLabelRot2->setText(tr("Rotation around Z (Y to X):"));
|
||||
}
|
||||
else if (theItem == 2) {
|
||||
TextLabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
|
||||
TextLabelRot2->setText( tr( "Rotation around X (Z to Y):" ) );
|
||||
TextLabelRot1->setText(tr("Rotation around Z (X to Y):"));
|
||||
TextLabelRot2->setText(tr("Rotation around X (Z to Y):"));
|
||||
}
|
||||
|
||||
if((QComboBox*)sender() == ComboBoxOrientation)
|
||||
SetCurrentPlaneParam();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : Sinchronize()
|
||||
// purpose :
|
||||
@ -584,7 +583,7 @@ void SMESHGUI_ClippingDlg::Sinchronize()
|
||||
ComboBoxPlanes->clear();
|
||||
|
||||
QString aName;
|
||||
for(int i = 1; i<=aNbPlanes ; i++){
|
||||
for(int i = 1; i<=aNbPlanes; i++) {
|
||||
aName = QString(tr("Plane# %1")).arg(i);
|
||||
ComboBoxPlanes->insertItem(aName);
|
||||
}
|
||||
@ -593,10 +592,10 @@ void SMESHGUI_ClippingDlg::Sinchronize()
|
||||
ComboBoxPlanes->setCurrentItem(aPos);
|
||||
|
||||
bool anIsControlsEnable = (aPos >= 0);
|
||||
if(anIsControlsEnable){
|
||||
if (anIsControlsEnable) {
|
||||
onSelectPlane(aPos);
|
||||
}else{
|
||||
ComboBoxPlanes->insertItem( tr("No planes") );
|
||||
} else {
|
||||
ComboBoxPlanes->insertItem(tr("No planes"));
|
||||
SpinBoxRot1->SetValue(0.0);
|
||||
SpinBoxRot2->SetValue(0.0);
|
||||
SpinBoxDistance->SetValue(0.5);
|
||||
@ -612,27 +611,23 @@ void SMESHGUI_ClippingDlg::Sinchronize()
|
||||
SpinBoxRot2->setEnabled(anIsControlsEnable);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : setRotation()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::setRotation( const double theRot1, const double theRot2 )
|
||||
void SMESHGUI_ClippingDlg::setRotation (const double theRot1, const double theRot2)
|
||||
{
|
||||
SpinBoxRot1->SetValue(theRot1);
|
||||
SpinBoxRot2->SetValue(theRot2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : SetCurrentPlaneParam
|
||||
// function : SetCurrentPlaneParam()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void
|
||||
SMESHGUI_ClippingDlg::
|
||||
SetCurrentPlaneParam()
|
||||
void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
|
||||
{
|
||||
if(myPlanes.empty() || myIsSelectPlane)
|
||||
if (myPlanes.empty() || myIsSelectPlane)
|
||||
return;
|
||||
|
||||
int aCurPlaneIndex = ComboBoxPlanes->currentItem();
|
||||
@ -740,11 +735,15 @@ SetCurrentPlaneParam()
|
||||
if(AutoApplyCheckBox->isChecked())
|
||||
ClickOnApply();
|
||||
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
|
||||
}
|
||||
|
||||
|
||||
void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
|
||||
//=======================================================================
|
||||
// function : OnPreviewToggle()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
|
||||
{
|
||||
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
|
||||
SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
|
||||
SMESH::RenderViewWindow(SMESH::GetCurrentVtkView());
|
||||
}
|
||||
|
@ -45,13 +45,17 @@ class QPushButton;
|
||||
class QTable;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class SALOME_Selection;
|
||||
|
||||
class SalomeApp_SelectionMgr;
|
||||
class SVTK_Selector;
|
||||
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
|
||||
class OrientedPlane;
|
||||
|
||||
|
||||
namespace SMESH{
|
||||
namespace SMESH {
|
||||
|
||||
typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
|
||||
typedef std::vector<TVTKPlane> TPlanes;
|
||||
@ -69,25 +73,27 @@ class SMESHGUI_ClippingDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ClippingDlg( QWidget* parent = 0,
|
||||
SMESHGUI_ClippingDlg (SMESHGUI* theModule,
|
||||
const char* name = 0,
|
||||
bool modal = false,
|
||||
WFlags fl = 0 );
|
||||
WFlags fl = 0);
|
||||
|
||||
float getDistance() {return (float)SpinBoxDistance->GetValue();}
|
||||
void setDistance( const float theDistance) {SpinBoxDistance->SetValue(theDistance);}
|
||||
double getRotation1() {return SpinBoxRot1->GetValue();}
|
||||
double getRotation2() {return SpinBoxRot2->GetValue();}
|
||||
void setRotation( const double theRot1, const double theRot2 );
|
||||
void Sinchronize();
|
||||
float getDistance() { return (float)SpinBoxDistance->GetValue(); }
|
||||
void setDistance (const float theDistance) { SpinBoxDistance->SetValue(theDistance); }
|
||||
double getRotation1() { return SpinBoxRot1->GetValue(); }
|
||||
double getRotation2() { return SpinBoxRot2->GetValue(); }
|
||||
void setRotation (const double theRot1, const double theRot2);
|
||||
void Sinchronize();
|
||||
|
||||
~SMESHGUI_ClippingDlg();
|
||||
|
||||
private:
|
||||
|
||||
SALOME_Selection* mySelection;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH::TPlanes myPlanes;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
SVTK_Selector* mySelector;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH::TPlanes myPlanes;
|
||||
|
||||
QComboBox* ComboBoxPlanes;
|
||||
QPushButton* buttonNew;
|
||||
@ -110,17 +116,16 @@ private:
|
||||
|
||||
public slots:
|
||||
|
||||
void onSelectPlane(int theIndex);
|
||||
void onSelectPlane (int theIndex);
|
||||
void ClickOnNew();
|
||||
void ClickOnDelete();
|
||||
void onSelectOrientation(int theItem);
|
||||
void onSelectOrientation (int theItem);
|
||||
void SetCurrentPlaneParam();
|
||||
void onSelectionChanged();
|
||||
void OnPreviewToggle(bool theIsToggled);
|
||||
void OnPreviewToggle (bool theIsToggled);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_TRANSPARENCYDLG_H
|
||||
|
||||
|
@ -25,6 +25,20 @@
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_CreateHypothesesDlg.h"
|
||||
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qbuttongroup.h>
|
||||
#include <qgroupbox.h>
|
||||
@ -33,98 +47,85 @@
|
||||
#include <qlistview.h>
|
||||
#include <qheader.h>
|
||||
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include "SMESHGUI_CreateHypothesesDlg.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_CreateHypothesesDlg()
|
||||
// function : SMESHGUI_CreateHypothesesDlg()
|
||||
// purpose : Constructs a SMESHGUI_CreateHypothesesDlg 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_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (QWidget* parent,
|
||||
SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (SMESHGUI* theModule,
|
||||
const char* name,
|
||||
bool modal,
|
||||
bool isAlgo)
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
|
||||
myIsAlgo( isAlgo )
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
myIsAlgo(isAlgo),
|
||||
mySMESHGUI( theModule )
|
||||
{
|
||||
MESSAGE("SMESHGUI_CreateHypothesesDlg");
|
||||
if (!name)
|
||||
setName("SMESHGUI_CreateHypothesesDlg");
|
||||
setCaption(isAlgo ? tr("SMESH_CREATE_ALGORITHMS" ) : tr("SMESH_CREATE_HYPOTHESES" ));
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
if ( !name )
|
||||
setName( "SMESHGUI_CreateHypothesesDlg" );
|
||||
setCaption( isAlgo ? tr( "SMESH_CREATE_ALGORITHMS" ) : tr( "SMESH_CREATE_HYPOTHESES" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
|
||||
QGridLayout* SMESHGUI_CreateHypothesesDlgLayout = new QGridLayout( this );
|
||||
SMESHGUI_CreateHypothesesDlgLayout->setSpacing( 6 );
|
||||
SMESHGUI_CreateHypothesesDlgLayout->setMargin( 11 );
|
||||
QGridLayout* SMESHGUI_CreateHypothesesDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_CreateHypothesesDlgLayout->setSpacing(6);
|
||||
SMESHGUI_CreateHypothesesDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupAlgorithms = new QGroupBox( this, "GroupAlgorithms" );
|
||||
GroupAlgorithms->setTitle( isAlgo ? tr("SMESH_AVAILABLE_ALGORITHMS") : tr("SMESH_AVAILABLE_HYPOTHESES") );
|
||||
GroupAlgorithms->setColumnLayout(0, Qt::Vertical );
|
||||
GroupAlgorithms->layout()->setSpacing( 0 );
|
||||
GroupAlgorithms->layout()->setMargin( 0 );
|
||||
GroupAlgorithms = new QGroupBox(this, "GroupAlgorithms");
|
||||
GroupAlgorithms->setTitle(isAlgo ? tr("SMESH_AVAILABLE_ALGORITHMS") : tr("SMESH_AVAILABLE_HYPOTHESES"));
|
||||
GroupAlgorithms->setColumnLayout(0, Qt::Vertical);
|
||||
GroupAlgorithms->layout()->setSpacing(0);
|
||||
GroupAlgorithms->layout()->setMargin(0);
|
||||
|
||||
QGridLayout* hypLayout = new QGridLayout( GroupAlgorithms->layout() );
|
||||
hypLayout->setGeometry( QRect( 12, 18, 139, 250 ) );
|
||||
hypLayout->setAlignment( Qt::AlignTop );
|
||||
hypLayout->setSpacing( 6 );
|
||||
hypLayout->setMargin( 11 );
|
||||
QGridLayout* hypLayout = new QGridLayout(GroupAlgorithms->layout());
|
||||
hypLayout->setGeometry(QRect(12, 18, 139, 250));
|
||||
hypLayout->setAlignment(Qt::AlignTop);
|
||||
hypLayout->setSpacing(6);
|
||||
hypLayout->setMargin(11);
|
||||
|
||||
ListAlgoDefinition = new QListView( GroupAlgorithms, "ListAlgoDefinition" );
|
||||
ListAlgoDefinition->setMinimumSize( 400, 200 );
|
||||
ListAlgoDefinition = new QListView(GroupAlgorithms, "ListAlgoDefinition");
|
||||
ListAlgoDefinition->setMinimumSize(400, 200);
|
||||
ListAlgoDefinition->addColumn("");
|
||||
ListAlgoDefinition->header()->hide();
|
||||
ListAlgoDefinition->setSelectionMode(QListView::Single);
|
||||
ListAlgoDefinition->setResizeMode(QListView::AllColumns);
|
||||
ListAlgoDefinition->setRootIsDecorated( true );
|
||||
ListAlgoDefinition->setRootIsDecorated(true);
|
||||
|
||||
hypLayout->addWidget( ListAlgoDefinition, 0, 0 );
|
||||
SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupAlgorithms, 0, 0 );
|
||||
hypLayout->addWidget(ListAlgoDefinition, 0, 0);
|
||||
SMESHGUI_CreateHypothesesDlgLayout->addWidget(GroupAlgorithms, 0, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setColumnLayout( 0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
|
||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
||||
buttonApply->setText( tr( "SMESH_BUT_CREATE" ) );
|
||||
buttonApply->setAutoDefault( TRUE );
|
||||
buttonApply->setDefault( FALSE );
|
||||
buttonApply->setEnabled( FALSE ) ;
|
||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
||||
buttonApply = new QPushButton(GroupButtons, "buttonApply");
|
||||
buttonApply->setText(tr("SMESH_BUT_CREATE" ));
|
||||
buttonApply->setAutoDefault(TRUE);
|
||||
buttonApply->setDefault(FALSE);
|
||||
buttonApply->setEnabled(FALSE);
|
||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
||||
|
||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
||||
QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
GroupButtonsLayout->addItem(spacer_9, 0, 2);
|
||||
|
||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
||||
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
buttonCancel->setDefault( TRUE );
|
||||
buttonCancel->setEnabled( TRUE ) ;
|
||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
||||
buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
|
||||
buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
buttonCancel->setDefault(TRUE);
|
||||
buttonCancel->setEnabled(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
|
||||
SMESHGUI_CreateHypothesesDlgLayout->addWidget( GroupButtons, 1, 0 );
|
||||
SMESHGUI_CreateHypothesesDlgLayout->addWidget(GroupButtons, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
Init();
|
||||
@ -136,7 +137,7 @@ SMESHGUI_CreateHypothesesDlg::SMESHGUI_CreateHypothesesDlg (QWidget* parent,
|
||||
//=================================================================================
|
||||
SMESHGUI_CreateHypothesesDlg::~SMESHGUI_CreateHypothesesDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -145,25 +146,24 @@ SMESHGUI_CreateHypothesesDlg::~SMESHGUI_CreateHypothesesDlg()
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::Init()
|
||||
{
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
|
||||
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
InitAlgoDefinition();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( buttonApply , SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ) ;
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
connect(buttonApply , SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
// connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
||||
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
// connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect( ListAlgoDefinition, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
|
||||
connect( ListAlgoDefinition, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( onDoubleClicked(QListViewItem*) ) );
|
||||
connect(ListAlgoDefinition, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
|
||||
connect(ListAlgoDefinition, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(onDoubleClicked(QListViewItem*)));
|
||||
|
||||
int x, y ;
|
||||
mySMESHGUI->DefineDlgPosition( this, x, y ) ;
|
||||
this->move( x, y ) ;
|
||||
this->show() ;
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -172,7 +172,7 @@ void SMESHGUI_CreateHypothesesDlg::Init()
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::ClickOnCancel()
|
||||
{
|
||||
close() ;
|
||||
close();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -181,29 +181,26 @@ void SMESHGUI_CreateHypothesesDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->ActiveStudyLocked())
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
QListViewItem* item = ListAlgoDefinition->selectedItem();
|
||||
if ( !item )
|
||||
if (!item)
|
||||
return;
|
||||
QString aHypType = item->text( 1 );
|
||||
QString aHypType = item->text(1);
|
||||
MESSAGE("Apply " << aHypType);
|
||||
char* sHypType = (char*)aHypType.latin1();
|
||||
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType);
|
||||
if ( !aHypData )
|
||||
if (!aHypData)
|
||||
return;
|
||||
QString aClientLibName = aHypData->ClientLibName;
|
||||
MESSAGE("Client lib name = " << aClientLibName);
|
||||
|
||||
if (aClientLibName == "")
|
||||
{
|
||||
if (aClientLibName == "") {
|
||||
// Call hypothesis creation server method (without GUI)
|
||||
QString aHypName = aHypData->Label;
|
||||
SMESH::CreateHypothesis(sHypType, aHypName, myIsAlgo);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Get hypotheses creator client (GUI)
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator =
|
||||
SMESH::GetHypothesisCreator(sHypType);
|
||||
@ -222,29 +219,29 @@ void SMESHGUI_CreateHypothesesDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::ActivateThisDialog()
|
||||
{
|
||||
mySMESHGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
return ;
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupButtons->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::enterEvent(QEvent* e)
|
||||
void SMESHGUI_CreateHypothesesDlg::enterEvent (QEvent*)
|
||||
{
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::closeEvent( QCloseEvent* e )
|
||||
void SMESHGUI_CreateHypothesesDlg::closeEvent (QCloseEvent* e)
|
||||
{
|
||||
mySMESHGUI->ResetState();
|
||||
QDialog::closeEvent( e );
|
||||
QDialog::closeEvent(e);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -254,16 +251,16 @@ void SMESHGUI_CreateHypothesesDlg::closeEvent( QCloseEvent* e )
|
||||
void SMESHGUI_CreateHypothesesDlg::onSelectionChanged()
|
||||
{
|
||||
QListViewItem* item = ListAlgoDefinition->selectedItem();
|
||||
buttonApply->setEnabled( item && item->depth() > 0 ) ;
|
||||
buttonApply->setEnabled(item && item->depth() > 0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onDoubleClicked()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_CreateHypothesesDlg::onDoubleClicked(QListViewItem* i)
|
||||
void SMESHGUI_CreateHypothesesDlg::onDoubleClicked (QListViewItem* i)
|
||||
{
|
||||
if ( i && i->depth() > 0 )
|
||||
if (i && i->depth() > 0)
|
||||
this->ClickOnApply();
|
||||
}
|
||||
|
||||
@ -275,24 +272,23 @@ void SMESHGUI_CreateHypothesesDlg::InitAlgoDefinition()
|
||||
{
|
||||
ListAlgoDefinition->clear();
|
||||
QStringList HypList = SMESH::GetAvailableHypotheses(myIsAlgo);
|
||||
for ( int i = 0; i < HypList.count(); ++i ) {
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData( HypList[i] );
|
||||
for (int i = 0; i < HypList.count(); ++i) {
|
||||
HypothesisData* aHypData = SMESH::GetHypothesisData(HypList[i]);
|
||||
QListViewItem* parentItem = 0;
|
||||
QListViewItem* childItem = ListAlgoDefinition->firstChild();
|
||||
while ( childItem ) {
|
||||
if ( childItem->text(0) == aHypData->PluginName ) {
|
||||
while (childItem) {
|
||||
if (childItem->text(0) == aHypData->PluginName) {
|
||||
parentItem = childItem;
|
||||
break;
|
||||
}
|
||||
childItem = childItem->nextSibling();
|
||||
}
|
||||
if ( !parentItem )
|
||||
parentItem = new QListViewItem( ListAlgoDefinition, aHypData->PluginName );
|
||||
parentItem->setOpen( true );
|
||||
QListViewItem* aItem = new QListViewItem( parentItem, aHypData->Label, HypList[i] );
|
||||
QPixmap aPixMap (QAD_Desktop::getResourceManager()->loadPixmap
|
||||
("SMESH", tr(aHypData->IconId)));
|
||||
if ( !aPixMap.isNull() )
|
||||
aItem->setPixmap( 0, aPixMap );
|
||||
if (!parentItem)
|
||||
parentItem = new QListViewItem(ListAlgoDefinition, aHypData->PluginName);
|
||||
parentItem->setOpen(true);
|
||||
QListViewItem* aItem = new QListViewItem(parentItem, aHypData->Label, HypList[i]);
|
||||
QPixmap aPixMap (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aHypData->IconId)));
|
||||
if (!aPixMap.isNull())
|
||||
aItem->setPixmap(0, aPixMap);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class SMESHGUI_CreateHypothesesDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_CreateHypothesesDlg (QWidget* parent = 0,
|
||||
SMESHGUI_CreateHypothesesDlg (SMESHGUI*,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
bool isAlgo = FALSE);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,123 +36,112 @@
|
||||
#include CORBA_SERVER_HEADER(SMESH_Pattern)
|
||||
|
||||
class SMESHGUI_PatternWidget;
|
||||
class SALOMEDSClient_SObject;
|
||||
|
||||
class QCloseEvent;
|
||||
class QFrame;
|
||||
class QLineEdit;
|
||||
class SMESHGUI_SpinBox;
|
||||
class QPushButton;
|
||||
class SALOME_Selection;
|
||||
class SalomeApp_SelectionMgr;
|
||||
class QRadioButton;
|
||||
class QCheckBox;
|
||||
class QButtonGroup;
|
||||
class QLabel;
|
||||
class SVTK_ViewWindow;
|
||||
class SVTK_Selector;
|
||||
class SMESHGUI;
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_CreatePatternDlg
|
||||
Description : Dialog to specify filters for VTK viewer
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_CreatePatternDlg
|
||||
* Description : Dialog to specify filters for VTK viewer
|
||||
*/
|
||||
|
||||
class SMESHGUI_CreatePatternDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
enum { Type_2d, Type_3d };
|
||||
|
||||
public:
|
||||
SMESHGUI_CreatePatternDlg( QWidget*,
|
||||
SALOME_Selection*,
|
||||
const int,
|
||||
const char* = 0 );
|
||||
virtual ~SMESHGUI_CreatePatternDlg();
|
||||
SMESHGUI_CreatePatternDlg( SMESHGUI*,
|
||||
const int,
|
||||
const char* = 0);
|
||||
virtual ~SMESHGUI_CreatePatternDlg();
|
||||
|
||||
void Init( SALOME_Selection*, const int );
|
||||
QString GetPatternName() const;
|
||||
SMESH::SMESH_Pattern_ptr GetPattern();
|
||||
void SetMesh( SMESH::SMESH_Mesh_ptr );
|
||||
void Init(const int);
|
||||
QString GetPatternName() const;
|
||||
SMESH::SMESH_Pattern_ptr GetPattern();
|
||||
void SetMesh (SMESH::SMESH_Mesh_ptr);
|
||||
|
||||
signals:
|
||||
|
||||
void NewPattern();
|
||||
void Close();
|
||||
void NewPattern();
|
||||
void Close();
|
||||
|
||||
private:
|
||||
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ;
|
||||
void closeEvent (QCloseEvent* e);
|
||||
void enterEvent (QEvent*);
|
||||
|
||||
private slots:
|
||||
|
||||
void onOk();
|
||||
void onSave();
|
||||
void onClose();
|
||||
void onOk();
|
||||
void onSave();
|
||||
void onClose();
|
||||
|
||||
void onDeactivate();
|
||||
void onDeactivate();
|
||||
|
||||
void onSelectionDone();
|
||||
void onTypeChanged( int );
|
||||
void onProject( bool );
|
||||
void onSelBtnClicked();
|
||||
void onSelectionDone();
|
||||
void onTypeChanged (int);
|
||||
void onProject (bool);
|
||||
void onSelBtnClicked();
|
||||
|
||||
private:
|
||||
|
||||
QFrame* createButtonFrame( QWidget* );
|
||||
QFrame* createMainFrame ( QWidget* );
|
||||
void displayPreview();
|
||||
void erasePreview();
|
||||
void activateSelection();
|
||||
QString autoExtension( const QString& theFileName ) const;
|
||||
bool isValid();
|
||||
bool loadFromObject( const bool = true );
|
||||
QString getDefaultName() const;
|
||||
GEOM::GEOM_Object_ptr getGeom( SALOMEDS::SObject_ptr );
|
||||
QFrame* createButtonFrame (QWidget*);
|
||||
QFrame* createMainFrame (QWidget*);
|
||||
void displayPreview();
|
||||
void erasePreview();
|
||||
void activateSelection();
|
||||
QString autoExtension (const QString& theFileName) const;
|
||||
bool isValid();
|
||||
bool loadFromObject (const bool = true);
|
||||
QString getDefaultName() const;
|
||||
GEOM::GEOM_Object_ptr getGeom (SALOMEDSClient_SObject*) const;
|
||||
|
||||
private:
|
||||
|
||||
QPushButton* myOkBtn;
|
||||
QPushButton* mySaveBtn;
|
||||
QPushButton* myCloseBtn;
|
||||
QPushButton* myOkBtn;
|
||||
QPushButton* mySaveBtn;
|
||||
QPushButton* myCloseBtn;
|
||||
|
||||
QButtonGroup* myTypeGrp;
|
||||
QRadioButton* mySwitch2d;
|
||||
QRadioButton* mySwitch3d;
|
||||
QRadioButton* mySwitchSMESH_Pattern3d;
|
||||
QButtonGroup* myTypeGrp;
|
||||
QRadioButton* mySwitch2d;
|
||||
QRadioButton* mySwitch3d;
|
||||
QRadioButton* mySwitchSMESH_Pattern3d;
|
||||
|
||||
QLineEdit* myMeshEdit;
|
||||
QLineEdit* myName;
|
||||
QLineEdit* myMeshEdit;
|
||||
QLineEdit* myName;
|
||||
|
||||
SMESHGUI_PatternWidget* myPicture2d;
|
||||
SMESHGUI_PatternWidget* myPicture2d;
|
||||
|
||||
QCheckBox* myProjectChk;
|
||||
QCheckBox* myProjectChk;
|
||||
|
||||
SALOME_Selection* mySelection;
|
||||
int myNbPoints;
|
||||
int myType;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
int myNbPoints;
|
||||
int myType;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH::SMESH_subMesh_var mySubMesh;
|
||||
GEOM::GEOM_Object_var myGeomObj;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH::SMESH_subMesh_var mySubMesh;
|
||||
GEOM::GEOM_Object_var myGeomObj;
|
||||
|
||||
SMESH::SMESH_Pattern_var myPattern;
|
||||
bool myIsLoaded;
|
||||
SMESH::SMESH_Pattern_var myPattern;
|
||||
bool myIsLoaded;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1003
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx
Normal file
1003
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx
Normal file
File diff suppressed because it is too large
Load Diff
135
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h
Normal file
135
src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h
Normal file
@ -0,0 +1,135 @@
|
||||
// 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_CreatePolyhedralVolumeDlg.h
|
||||
// Author : Michael ZORIN
|
||||
// Module : SMESH
|
||||
// $Header:
|
||||
|
||||
#ifndef DIALOGBOX_CREATEPOLYHEDRAL_H
|
||||
#define DIALOGBOX_CREATEPOLYHEDRAL_H
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
class QGroupBox;
|
||||
class QListBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QCheckBox;
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SVTK_Selector;
|
||||
class SVTK_ViewWindow;
|
||||
class SalomeApp_SelectionMgr;
|
||||
|
||||
namespace SMESH{
|
||||
struct TPolySimulation;
|
||||
}
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_CreatePolyhedralVolumeDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_CreatePolyhedralVolumeDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
~SMESHGUI_CreatePolyhedralVolumeDlg();
|
||||
|
||||
private:
|
||||
|
||||
void Init() ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void hideEvent ( QHideEvent * ); /* ESC key */
|
||||
int GetConstructorId();
|
||||
void displaySimulation();
|
||||
|
||||
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr ; /* User shape selection */
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
QString myIDs;
|
||||
int myNbOkElements ; /* to check when elements are defined */
|
||||
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH::TPolySimulation* mySimulation;
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
QRadioButton* RadioButton2;
|
||||
QCheckBox* Preview;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupContent;
|
||||
QLabel* TextLabelIds;
|
||||
QPushButton* SelectElementsButton;
|
||||
QLineEdit* LineEditElements;
|
||||
QListBox* myFacesByNodes;
|
||||
QLabel* myFacesByNodesLabel;
|
||||
QPushButton* AddButton;
|
||||
QPushButton* RemoveButton;
|
||||
|
||||
public slots:
|
||||
|
||||
void onAdd();
|
||||
void onRemove();
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnPreview(bool theToggled);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void onTextChange(const QString&);
|
||||
void onListSelectionChanged();
|
||||
|
||||
protected:
|
||||
QGridLayout* SMESHGUI_CreatePolyhedralVolumeDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupContentLayout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_CREATEPOLYHEDRAL_H
|
@ -28,14 +28,21 @@
|
||||
#include "SMESHGUI_DeleteGroupDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
|
||||
#include "QAD_Desktop.h"
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
#include "SVTK_Selection.h"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
// QT Includes
|
||||
#include <qframe.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpushbutton.h>
|
||||
@ -45,251 +52,256 @@
|
||||
#include <qlist.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
#define SPACING 5
|
||||
#define MARGIN 10
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_DeleteGroupDlg
|
||||
Description : Delete groups and their contents
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_DeleteGroupDlg
|
||||
* Description : Delete groups and their contents
|
||||
*/
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg( QWidget* theParent,
|
||||
SALOME_Selection* theSelection )
|
||||
: QDialog( theParent, "SMESHGUI_DeleteGroupDlg", false,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_DeleteGroupDlg()
|
||||
// purpose : Constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget* theParent,
|
||||
SalomeApp_SelectionMgr* theSelection)
|
||||
: QDialog(theParent, "SMESHGUI_DeleteGroupDlg", false,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||
{
|
||||
setCaption( tr( "CAPTION" ) );
|
||||
setCaption(tr("CAPTION"));
|
||||
|
||||
QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
|
||||
QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
|
||||
|
||||
QFrame* aMainFrame = createMainFrame ( this );
|
||||
QFrame* aBtnFrame = createButtonFrame( this );
|
||||
QFrame* aMainFrame = createMainFrame (this);
|
||||
QFrame* aBtnFrame = createButtonFrame(this);
|
||||
|
||||
aDlgLay->addWidget( aMainFrame );
|
||||
aDlgLay->addWidget( aBtnFrame );
|
||||
aDlgLay->addWidget(aMainFrame);
|
||||
aDlgLay->addWidget(aBtnFrame);
|
||||
|
||||
aDlgLay->setStretchFactor( aMainFrame, 1 );
|
||||
aDlgLay->setStretchFactor(aMainFrame, 1);
|
||||
|
||||
Init( theSelection ) ;
|
||||
Init(theSelection);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::createMainFrame
|
||||
// Purpose : Create frame containing dialog's input fields
|
||||
//=======================================================================
|
||||
QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame( QWidget* theParent )
|
||||
//=================================================================================
|
||||
// function : createMainFrame()
|
||||
// purpose : Create frame containing dialog's input fields
|
||||
//=================================================================================
|
||||
QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame (QWidget* theParent)
|
||||
{
|
||||
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "SELECTED_GROUPS" ), theParent );
|
||||
QGroupBox* aMainGrp =
|
||||
new QGroupBox(1, Qt::Horizontal, tr("SELECTED_GROUPS"), theParent);
|
||||
|
||||
myListBox = new QListBox( aMainGrp );
|
||||
myListBox->setMinimumHeight( 100 );
|
||||
myListBox->setSelectionMode( QListBox::NoSelection );
|
||||
myListBox->setRowMode( QListBox::FitToWidth );
|
||||
myListBox = new QListBox(aMainGrp);
|
||||
myListBox->setMinimumHeight(100);
|
||||
myListBox->setSelectionMode(QListBox::NoSelection);
|
||||
myListBox->setRowMode(QListBox::FitToWidth);
|
||||
|
||||
return aMainGrp;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::createButtonFrame
|
||||
// Purpose : Create frame containing buttons
|
||||
//=======================================================================
|
||||
QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame( QWidget* theParent )
|
||||
//=================================================================================
|
||||
// function : createButtonFrame()
|
||||
// purpose : Create frame containing buttons
|
||||
//=================================================================================
|
||||
QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent)
|
||||
{
|
||||
QFrame* aFrame = new QFrame( theParent );
|
||||
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
|
||||
QFrame* aFrame = new QFrame(theParent);
|
||||
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
|
||||
myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
|
||||
myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
|
||||
myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
|
||||
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
|
||||
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
|
||||
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
|
||||
|
||||
QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
|
||||
QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
|
||||
|
||||
aLay->addWidget( myOkBtn );
|
||||
aLay->addWidget( myApplyBtn );
|
||||
aLay->addItem( aSpacer);
|
||||
aLay->addWidget( myCloseBtn );
|
||||
aLay->addWidget(myOkBtn);
|
||||
aLay->addWidget(myApplyBtn);
|
||||
aLay->addItem(aSpacer);
|
||||
aLay->addWidget(myCloseBtn);
|
||||
|
||||
// connect signals and slots
|
||||
connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
|
||||
connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
|
||||
connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
|
||||
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
|
||||
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
|
||||
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
|
||||
|
||||
return aFrame;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg
|
||||
//=================================================================================
|
||||
// name : ~SMESHGUI_DeleteGroupDlg()
|
||||
// Purpose : Destructor
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::Init
|
||||
// Purpose : Init dialog fields, connect signals and slots, show dialog
|
||||
//=======================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::Init( SALOME_Selection* theSelection )
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose : Init dialog fields, connect signals and slots, show dialog
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::Init (SalomeApp_SelectionMgr* theSelection)
|
||||
{
|
||||
myBlockSelection = false;
|
||||
mySelection = theSelection;
|
||||
mySelectionMgr = theSelection;
|
||||
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
|
||||
aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
|
||||
aSMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
// selection and SMESHGUI
|
||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
|
||||
connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
|
||||
connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( onClose() ) );
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
|
||||
connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
|
||||
connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
|
||||
|
||||
int x, y ;
|
||||
aSMESHGUI->DefineDlgPosition( this, x, y );
|
||||
this->move( x, y );
|
||||
int x, y;
|
||||
aSMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
// set selection mode
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
|
||||
mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
|
||||
#ifdef NEW_GUI
|
||||
mySelectionMgr->setSelectionModes(ActorSelection, true);
|
||||
#else
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
#endif
|
||||
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
|
||||
onSelectionDone();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::isValid
|
||||
// Purpose : Verify validity of input data
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : isValid()
|
||||
// purpose : Verify validity of input data
|
||||
//=================================================================================
|
||||
bool SMESHGUI_DeleteGroupDlg::isValid()
|
||||
{
|
||||
if ( myListBox->count() == 0 )
|
||||
{
|
||||
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_INSUFFICIENT_DATA" ), tr( "NO_SELECTED_GROUPS" ), QMessageBox::Ok );
|
||||
if (myListBox->count() == 0) {
|
||||
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
||||
tr("NO_SELECTED_GROUPS"), QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
return !SMESHGUI::GetSMESHGUI()->ActiveStudyLocked();
|
||||
return !SMESHGUI::GetSMESHGUI()->isActiveStudyLocked();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::onApply
|
||||
// Purpose : SLOT called when "Apply" button pressed.
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : onApply()
|
||||
// purpose : SLOT called when "Apply" button pressed.
|
||||
//=================================================================================
|
||||
bool SMESHGUI_DeleteGroupDlg::onApply()
|
||||
{
|
||||
if ( !isValid() )
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
myBlockSelection = true;
|
||||
|
||||
QValueList<SMESH::SMESH_GroupBase_var>::iterator anIter;
|
||||
for ( anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter )
|
||||
{
|
||||
for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) {
|
||||
SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh();
|
||||
if ( !aMesh->_is_nil() )
|
||||
aMesh->RemoveGroupWithContents( *anIter );
|
||||
if (!aMesh->_is_nil())
|
||||
aMesh->RemoveGroupWithContents(*anIter);
|
||||
}
|
||||
|
||||
myListBox->clear();
|
||||
myListGrp.clear();
|
||||
mySelection->ClearIObjects();
|
||||
mySelectionMgr->clearSelected();
|
||||
SMESH::UpdateView();
|
||||
SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
|
||||
|
||||
myBlockSelection = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::onOk
|
||||
// Purpose : SLOT called when "Ok" button pressed.
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : onOk()
|
||||
// purpose : SLOT called when "Ok" button pressed.
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::onOk()
|
||||
{
|
||||
if ( onApply() )
|
||||
if (onApply())
|
||||
onClose();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::onClose
|
||||
// Purpose : SLOT called when "Close" button pressed. Close dialog
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : onClose()
|
||||
// purpose : SLOT called when "Close" button pressed. Close dialog
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::onClose()
|
||||
{
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
|
||||
SMESHGUI::GetSMESHGUI()->ResetState() ;
|
||||
mySelection->ClearFilters();
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
|
||||
SMESHGUI::GetSMESHGUI()->ResetState();
|
||||
mySelectionMgr->clearFilters();
|
||||
reject();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::onSelectionDone
|
||||
// Purpose : SLOT called when selection changed
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : onSelectionDone()
|
||||
// purpose : SLOT called when selection changed
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::onSelectionDone()
|
||||
{
|
||||
if ( myBlockSelection )
|
||||
if (myBlockSelection)
|
||||
return;
|
||||
|
||||
myListGrp.clear();
|
||||
QStringList aNames;
|
||||
|
||||
const SALOME_ListIO& aListIO = mySelection->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO anIter( aListIO );
|
||||
for( ; anIter.More(); anIter.Next() )
|
||||
{
|
||||
SALOME_ListIO aListIO;
|
||||
mySelectionMgr->selectedObjects(aListIO);
|
||||
SALOME_ListIteratorOfListIO anIter (aListIO);
|
||||
for (; anIter.More(); anIter.Next()) {
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
|
||||
if ( !aGroup->_is_nil() )
|
||||
{
|
||||
aNames.append( aGroup->GetName() );
|
||||
myListGrp.append( aGroup );
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIter.Value());
|
||||
if (!aGroup->_is_nil()) {
|
||||
aNames.append(aGroup->GetName());
|
||||
myListGrp.append(aGroup);
|
||||
}
|
||||
}
|
||||
|
||||
myListBox->clear();
|
||||
myListBox->insertStringList( aNames );
|
||||
myListBox->insertStringList(aNames);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::onDeactivate
|
||||
// Purpose : SLOT called when dialog must be deativated
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : onDeactivate()
|
||||
// purpose : SLOT called when dialog must be deativated
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::onDeactivate()
|
||||
{
|
||||
mySelection->ClearFilters();
|
||||
setEnabled( false );
|
||||
mySelectionMgr->clearFilters();
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_DeleteGroupDlg::enterEvent
|
||||
// Purpose : Event filter
|
||||
//=======================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::enterEvent( QEvent* )
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : Event filter
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*)
|
||||
{
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
|
||||
setEnabled( true );
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
|
||||
mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
||||
setEnabled(true);
|
||||
#ifdef NEW_GUI
|
||||
mySelectionMgr->setSelectionModes(ActorSelection, true);
|
||||
#else
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
#endif
|
||||
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_DeleteGroupDlg::closeEvent( QCloseEvent* )
|
||||
void SMESHGUI_DeleteGroupDlg::closeEvent (QCloseEvent*)
|
||||
{
|
||||
onClose() ;
|
||||
onClose();
|
||||
}
|
||||
|
||||
|
@ -36,61 +36,56 @@
|
||||
class QCloseEvent;
|
||||
class QFrame;
|
||||
class QPushButton;
|
||||
class SALOME_Selection;
|
||||
class SalomeApp_SelectionMgr;
|
||||
class QListBox;
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_DeleteGroupDlg
|
||||
Description : Delete groups and their contents
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_DeleteGroupDlg
|
||||
* Description : Delete groups and their contents
|
||||
*/
|
||||
|
||||
class SMESHGUI_DeleteGroupDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_DeleteGroupDlg( QWidget*, SALOME_Selection* );
|
||||
virtual ~SMESHGUI_DeleteGroupDlg();
|
||||
SMESHGUI_DeleteGroupDlg (QWidget*,
|
||||
SalomeApp_SelectionMgr*);
|
||||
virtual ~SMESHGUI_DeleteGroupDlg();
|
||||
|
||||
void Init( SALOME_Selection* ) ;
|
||||
void Init (SalomeApp_SelectionMgr*);
|
||||
|
||||
private:
|
||||
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ;
|
||||
void closeEvent (QCloseEvent*);
|
||||
void enterEvent (QEvent*);
|
||||
|
||||
private slots:
|
||||
|
||||
void onOk();
|
||||
bool onApply();
|
||||
void onClose();
|
||||
void onOk();
|
||||
bool onApply();
|
||||
void onClose();
|
||||
|
||||
void onDeactivate();
|
||||
void onDeactivate();
|
||||
|
||||
void onSelectionDone();
|
||||
void onSelectionDone();
|
||||
|
||||
private:
|
||||
|
||||
QFrame* createButtonFrame( QWidget* );
|
||||
QFrame* createMainFrame ( QWidget* );
|
||||
bool isValid();
|
||||
QFrame* createButtonFrame (QWidget*);
|
||||
QFrame* createMainFrame (QWidget*);
|
||||
bool isValid();
|
||||
|
||||
private:
|
||||
|
||||
QPushButton* myOkBtn;
|
||||
QPushButton* myApplyBtn;
|
||||
QPushButton* myCloseBtn;
|
||||
QListBox* myListBox;
|
||||
SALOME_Selection* mySelection;
|
||||
QPushButton* myOkBtn;
|
||||
QPushButton* myApplyBtn;
|
||||
QPushButton* myCloseBtn;
|
||||
QListBox* myListBox;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
|
||||
QValueList<SMESH::SMESH_GroupBase_var> myListGrp;
|
||||
bool myBlockSelection;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,9 +29,9 @@
|
||||
#ifndef DIALOGBOX_EDIT_HYPOTHESES_H
|
||||
#define DIALOGBOX_EDIT_HYPOTHESES_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SALOME_TypeFilter.hxx"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
//#include "SMESH_TypeFilter.hxx"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
@ -52,7 +52,7 @@ class QListBox;
|
||||
class QListBoxItem;
|
||||
class SMESHGUI;
|
||||
|
||||
typedef map<string, int> MapIOR;
|
||||
typedef map<std::string, int> MapIOR;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_EditHypothesesDlg
|
||||
@ -63,15 +63,18 @@ class SMESHGUI_EditHypothesesDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_EditHypothesesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
SMESHGUI_EditHypothesesDlg (SMESHGUI*,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~SMESHGUI_EditHypothesesDlg();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent* e );
|
||||
virtual void enterEvent ( QEvent* );
|
||||
virtual void closeEvent (QCloseEvent*);
|
||||
virtual void enterEvent (QEvent*);
|
||||
|
||||
private:
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void Init();
|
||||
|
||||
void InitHypDefinition();
|
||||
void InitAlgoDefinition();
|
||||
@ -88,17 +91,19 @@ private:
|
||||
bool IsOld(QListBoxItem* hypItem);
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI ;
|
||||
SALOME_Selection* mySelection ;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
|
||||
GEOM::GEOM_Object_var myGeomShape ;
|
||||
GEOM::GEOM_Object_var myGeomShape;
|
||||
QLineEdit* myEditCurrentArgument;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH::SMESH_subMesh_var mySubMesh;
|
||||
|
||||
Handle(SALOME_TypeFilter) myGeomFilter;
|
||||
Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
|
||||
//Handle(SALOME_TypeFilter) myGeomFilter;
|
||||
//Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter;
|
||||
SUIT_SelectionFilter* myGeomFilter;
|
||||
SUIT_SelectionFilter* myMeshOrSubMeshFilter;
|
||||
|
||||
MapIOR myMapOldHypos, myMapOldAlgos;
|
||||
int myNbModification;
|
||||
@ -134,10 +139,10 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
|
||||
void removeItem(QListBoxItem*);
|
||||
void addItem(QListBoxItem*);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,9 +29,9 @@
|
||||
#ifndef DIALOGBOX_EXTRUSION_PATH_H
|
||||
#define DIALOGBOX_EXTRUSION_PATH_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SMESH_LogicalFilter.hxx"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
|
||||
@ -44,9 +44,13 @@ class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QListBox;
|
||||
class QPushButton;
|
||||
class SMESHGUI_SpinBox;
|
||||
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SVTK_ViewWindow;
|
||||
class SVTK_Selector;
|
||||
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
@ -62,7 +66,7 @@ class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
|
||||
|
||||
class SetBusy {
|
||||
public:
|
||||
SetBusy( SMESHGUI_ExtrusionAlongPathDlg* _dlg ) { myDlg = _dlg; myDlg->myBusy = true; }
|
||||
SetBusy (SMESHGUI_ExtrusionAlongPathDlg* _dlg) { myDlg = _dlg; myDlg->myBusy = true; }
|
||||
~SetBusy() { myDlg->myBusy = false; }
|
||||
private:
|
||||
SMESHGUI_ExtrusionAlongPathDlg* myDlg;
|
||||
@ -70,39 +74,41 @@ class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
|
||||
friend class SetBusy;
|
||||
|
||||
public:
|
||||
SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent = 0, SALOME_Selection* Sel = 0, bool modal = FALSE );
|
||||
SMESHGUI_ExtrusionAlongPathDlg (SMESHGUI*,
|
||||
bool modal = FALSE);
|
||||
~SMESHGUI_ExtrusionAlongPathDlg();
|
||||
|
||||
bool eventFilter( QObject* object, QEvent* event );
|
||||
|
||||
protected slots:
|
||||
void reject();
|
||||
bool eventFilter (QObject* object, QEvent* event);
|
||||
|
||||
private:
|
||||
void Init( bool ResetControls = true ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void Init (bool ResetControls = true);
|
||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
||||
int GetConstructorId();
|
||||
void SetEditCurrentArgument( QToolButton* button );
|
||||
void SetEditCurrentArgument (QToolButton* button);
|
||||
|
||||
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
QWidget* myEditCurrentArgument; /* Current argument */
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
QWidget* myEditCurrentArgument; /* Current argument */
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_IDSource_var myIDSource;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myMeshActor;
|
||||
SMESH::SMESH_IDSource_var myIDSource;
|
||||
SMESH::SMESH_Mesh_var myPathMesh;
|
||||
GEOM::GEOM_Object_var myPathShape;
|
||||
Handle(SMESH_LogicalFilter) myElementsFilter;
|
||||
Handle(SMESH_TypeFilter) myPathMeshFilter;
|
||||
SUIT_SelectionFilter* myElementsFilter;
|
||||
SUIT_SelectionFilter* myPathMeshFilter;
|
||||
int myType;
|
||||
|
||||
// widgets
|
||||
QButtonGroup* ElementsTypeGrp;
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Elements1dRB;
|
||||
QRadioButton* Elements2dRB;
|
||||
QGroupBox* ArgumentsGrp;
|
||||
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* ElementsLab;
|
||||
QToolButton* SelectElementsButton;
|
||||
QLineEdit* ElementsLineEdit;
|
||||
@ -132,20 +138,24 @@ private:
|
||||
SMESHGUI_SpinBox* YSpin;
|
||||
QLabel* ZLab;
|
||||
SMESHGUI_SpinBox* ZSpin;
|
||||
QGroupBox* ButtonsGrp;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* OkButton;
|
||||
QPushButton* ApplyButton;
|
||||
QPushButton* CloseButton;
|
||||
|
||||
protected slots:
|
||||
void reject();
|
||||
|
||||
private slots:
|
||||
void TypeChanged( int type );
|
||||
void ConstructorsClicked (int);
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onTextChange(const QString&);
|
||||
void onTextChange (const QString&);
|
||||
void onSelectMesh();
|
||||
void onAnglesCheck();
|
||||
void onBasePointCheck();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,102 +29,101 @@
|
||||
#ifndef DIALOGBOX_EXTRUSION_H
|
||||
#define DIALOGBOX_EXTRUSION_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SMESH_LogicalFilter.hxx"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
class QRadioButton;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class SMESHGUI_SpinBox;
|
||||
class QPushButton;
|
||||
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SVTK_ViewWindow;
|
||||
class SVTK_Selector;
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ExtrusionDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_ExtrusionDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ExtrusionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
~SMESHGUI_ExtrusionDlg();
|
||||
SMESHGUI_ExtrusionDlg (SMESHGUI*,
|
||||
bool modal = FALSE);
|
||||
~SMESHGUI_ExtrusionDlg();
|
||||
|
||||
private:
|
||||
void Init (bool ResetControls = true);
|
||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
||||
int GetConstructorId();
|
||||
//void closeEvent (QCloseEvent*);
|
||||
//void hideEvent (QHideEvent*); /* ESC key */
|
||||
|
||||
void Init( bool ResetControls = true ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void hideEvent ( QHideEvent * ); /* ESC key */
|
||||
int GetConstructorId();
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
QString myElementsId;
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
QString myElementsId;
|
||||
int myNbOkElements ; /* to check when elements are defined */
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter;
|
||||
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
// widgets
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
QRadioButton* RadioButton2;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
Handle(SMESH_LogicalFilter) myMeshOrSubMeshOrGroupFilter;
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* TextLabelElements;
|
||||
QPushButton* SelectElementsButton;
|
||||
QLineEdit* LineEditElements;
|
||||
QCheckBox* CheckBoxMesh;
|
||||
QLabel* TextLabelVector;
|
||||
QLabel* TextLabelDx;
|
||||
SMESHGUI_SpinBox* SpinBox_Dx;
|
||||
QLabel* TextLabelDy;
|
||||
SMESHGUI_SpinBox* SpinBox_Dy;
|
||||
QLabel* TextLabelDz;
|
||||
SMESHGUI_SpinBox* SpinBox_Dz;
|
||||
QLabel* TextLabelNbSteps;
|
||||
QSpinBox* SpinBox_NbSteps;
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
QRadioButton* RadioButton2;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* TextLabelElements;
|
||||
QPushButton* SelectElementsButton;
|
||||
QLineEdit* LineEditElements;
|
||||
QCheckBox* CheckBoxMesh;
|
||||
QLabel* TextLabelVector;
|
||||
QLabel* TextLabelDx;
|
||||
SMESHGUI_SpinBox* SpinBox_Dx;
|
||||
QLabel* TextLabelDy;
|
||||
SMESHGUI_SpinBox* SpinBox_Dy;
|
||||
QLabel* TextLabelDz;
|
||||
SMESHGUI_SpinBox* SpinBox_Dz;
|
||||
QLabel* TextLabelNbSteps;
|
||||
QSpinBox* SpinBox_NbSteps;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void onTextChange(const QString&);
|
||||
void onSelectMesh(bool toSelectMesh);
|
||||
|
||||
protected:
|
||||
QGridLayout* SMESHGUI_ExtrusionDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupArgumentsLayout;
|
||||
private slots:
|
||||
void ConstructorsClicked (int);
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onTextChange (const QString&);
|
||||
void onSelectMesh (bool toSelectMesh);
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_EXTRUSION_H
|
||||
|
@ -26,17 +26,21 @@
|
||||
// Module : SMESH
|
||||
|
||||
#include "SMESHGUI_Filter.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
|
||||
#include <vtkCell.h>
|
||||
|
||||
// OCCT Includes
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
// VTK Includes
|
||||
#include <vtkCell.h>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
|
||||
@ -158,7 +162,10 @@ void SMESHGUI_PredicateFilter::SetActor( SALOME_Actor* theActor )
|
||||
|
||||
if ( myActor != 0 && !myPred->_is_nil() )
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
|
||||
SALOME_Actor* sActor = dynamic_cast<SALOME_Actor*>( myActor );
|
||||
Handle(SALOME_InteractiveObject) anIO;
|
||||
if( sActor )
|
||||
anIO = sActor->getIO();
|
||||
if ( !anIO.IsNull() )
|
||||
{
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
|
||||
@ -488,14 +495,3 @@ bool SMESHGUI_VolumesFilter::IsNodeFilter() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,9 +34,10 @@
|
||||
#include <qmap.h>
|
||||
#include <qvaluelist.h>
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SALOME_DataMapOfIOMapOfInteger.hxx"
|
||||
#include "SVTK_Selection.h"
|
||||
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
@ -55,17 +56,19 @@ class QStringList;
|
||||
class QTable;
|
||||
class QTableItem;
|
||||
class QWidgetStack;
|
||||
class SALOME_Selection;
|
||||
class SalomeApp_SelectionMgr;
|
||||
class SMESHGUI;
|
||||
class SMESHGUI_FilterLibraryDlg;
|
||||
class SVTK_Selector;
|
||||
class SVTK_ViewWindow;
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_FilterTable
|
||||
Description : Frame containig
|
||||
- Button group for switching entity type
|
||||
- Table for displaying filter criterions
|
||||
- Buttons for editing table
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_FilterTable
|
||||
* Description : Frame containig
|
||||
* - Button group for switching entity type
|
||||
* - Table for displaying filter criterions
|
||||
* - Buttons for editing table
|
||||
*/
|
||||
|
||||
class SMESHGUI_FilterTable : public QFrame
|
||||
{
|
||||
@ -78,65 +81,63 @@ class SMESHGUI_FilterTable : public QFrame
|
||||
typedef QMap<int, Table*> TableMap;
|
||||
|
||||
public:
|
||||
|
||||
SMESHGUI_FilterTable( QWidget* parent,
|
||||
const int type );
|
||||
SMESHGUI_FilterTable( QWidget* parent,
|
||||
const QValueList<int>& type );
|
||||
SMESHGUI_FilterTable (QWidget* parent,
|
||||
const int type);
|
||||
SMESHGUI_FilterTable (QWidget* parent,
|
||||
const QValueList<int>& type);
|
||||
virtual ~SMESHGUI_FilterTable();
|
||||
|
||||
void Init( const int type );
|
||||
void Init( const QValueList<int>& types );
|
||||
void Init (const int type);
|
||||
void Init (const QValueList<int>& types);
|
||||
|
||||
QGroupBox* GetTableGrp();
|
||||
|
||||
bool IsValid( const bool = true, const int theEntityType = -1 ) const;
|
||||
bool IsValid (const bool = true, const int theEntityType = -1) const;
|
||||
int GetType() const;
|
||||
void SetType( const int );
|
||||
void SetType (const int);
|
||||
void RestorePreviousEntityType();
|
||||
int NumRows( const int theEntityType = -1 ) const;
|
||||
void Clear( const int theEntityType = -1 );
|
||||
void SetEditable( const bool );
|
||||
void SetEnabled( const bool );
|
||||
void SetLibsEnabled( const bool );
|
||||
int NumRows (const int theEntityType = -1) const;
|
||||
void Clear (const int theEntityType = -1);
|
||||
void SetEditable (const bool);
|
||||
void SetEnabled (const bool);
|
||||
void SetLibsEnabled (const bool);
|
||||
bool IsEditable() const;
|
||||
|
||||
int GetCriterionType( const int theRow, const int theType = -1 ) const;
|
||||
int GetCriterionType (const int theRow, const int theType = -1) const;
|
||||
|
||||
void GetCriterion( const int theRow,
|
||||
void GetCriterion (const int theRow,
|
||||
SMESH::Filter::Criterion& theCriterion,
|
||||
const int theEntityType = -1 ) const;
|
||||
const int theEntityType = -1) const;
|
||||
|
||||
void SetCriterion( const int theRow,
|
||||
void SetCriterion (const int theRow,
|
||||
const SMESH::Filter::Criterion& theCriterion,
|
||||
const int theEntityType = -1 );
|
||||
const int theEntityType = -1);
|
||||
|
||||
void AddCriterion( const SMESH::Filter::Criterion& theCriterion,
|
||||
const int theEntityType = -1 );
|
||||
void AddCriterion (const SMESH::Filter::Criterion& theCriterion,
|
||||
const int theEntityType = -1);
|
||||
|
||||
void Copy( const SMESHGUI_FilterTable* );
|
||||
void SetValidity( const bool );
|
||||
void Copy (const SMESHGUI_FilterTable*);
|
||||
void SetValidity (const bool);
|
||||
|
||||
bool CurrentCell( int& theRow, int& theCol ) const;
|
||||
void SetThreshold( const int theRow,
|
||||
bool CurrentCell (int& theRow, int& theCol) const;
|
||||
void SetThreshold (const int theRow,
|
||||
const QString& theText,
|
||||
const int theEntityType = -1 );
|
||||
const int theEntityType = -1);
|
||||
|
||||
bool GetThreshold( const int theRow,
|
||||
bool GetThreshold (const int theRow,
|
||||
QString& theText,
|
||||
const int theEntityType = -1 );
|
||||
const int theEntityType = -1);
|
||||
|
||||
void Update();
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
void CopyFromClicked();
|
||||
void AddToClicked();
|
||||
void EntityTypeChanged( const int );
|
||||
void EntityTypeChanged (const int);
|
||||
void NeedValidation();
|
||||
void CretarionChanged( const int theRow, const int theEntityType );
|
||||
void CurrentChanged( int, int );
|
||||
void CretarionChanged (const int theRow, const int theEntityType);
|
||||
void CurrentChanged (int, int);
|
||||
|
||||
private slots:
|
||||
|
||||
@ -146,26 +147,26 @@ private slots:
|
||||
void onClearBtn();
|
||||
void onCopyFromBtn();
|
||||
void onAddToBtn();
|
||||
void onCriterionChanged( int, int );
|
||||
void onEntityType( int );
|
||||
void onCurrentChanged( int, int );
|
||||
void onCriterionChanged (int, int);
|
||||
void onEntityType (int);
|
||||
void onCurrentChanged (int, int);
|
||||
|
||||
private:
|
||||
|
||||
void addRow( Table*, const int, const bool toTheEnd = true );
|
||||
QTableItem* getCriterionItem( QTable*, const int );
|
||||
QTableItem* getCompareItem( QTable* );
|
||||
QTableItem* getUnaryItem( QTable* );
|
||||
QTableItem* getBinaryItem( QTable* );
|
||||
const QMap<int, QString>& getCriteria( const int theType ) const;
|
||||
void addRow (Table*, const int, const bool toTheEnd = true);
|
||||
QTableItem* getCriterionItem (QTable*, const int);
|
||||
QTableItem* getCompareItem (QTable*);
|
||||
QTableItem* getUnaryItem (QTable*);
|
||||
QTableItem* getBinaryItem (QTable*);
|
||||
const QMap<int, QString>& getCriteria (const int theType) const;
|
||||
const QMap<int, QString>& getCompare() const;
|
||||
Table* createTable( QWidget*, const int );
|
||||
QWidget* createAdditionalFrame( QWidget* theParent );
|
||||
Table* createTable (QWidget*, const int);
|
||||
QWidget* createAdditionalFrame (QWidget* theParent);
|
||||
int getFirstSelectedRow() const;
|
||||
void onCriterionChanged( const int, const int, const int );
|
||||
void onCriterionChanged (const int, const int, const int);
|
||||
|
||||
void updateBtnState();
|
||||
void removeAdditionalWidget( QTable* theTable, const int theRow );
|
||||
void removeAdditionalWidget (QTable* theTable, const int theRow);
|
||||
void updateAdditionalWidget();
|
||||
|
||||
const QMap<int, QString>& getSupportedTypes() const;
|
||||
@ -189,15 +190,16 @@ private:
|
||||
|
||||
SMESHGUI_FilterLibraryDlg* myLibDlg;
|
||||
|
||||
QWidgetStack* myWgStack;
|
||||
QWidgetStack* myWgStack;
|
||||
|
||||
QMap<QTableItem*, AdditionalWidget*> myAddWidgets;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_FilterDlg
|
||||
Description : Dialog to specify filters for VTK viewer
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_FilterDlg
|
||||
* Description : Dialog to specify filters for VTK viewer
|
||||
*/
|
||||
|
||||
class SMESHGUI_FilterDlg : public QDialog
|
||||
{
|
||||
@ -210,21 +212,21 @@ class SMESHGUI_FilterDlg : public QDialog
|
||||
enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
|
||||
|
||||
public:
|
||||
SMESHGUI_FilterDlg( QWidget* parent,
|
||||
SMESHGUI_FilterDlg( SMESHGUI*,
|
||||
const QValueList<int>& types,
|
||||
const char* name = 0 );
|
||||
const char* name = 0);
|
||||
|
||||
SMESHGUI_FilterDlg( QWidget* parent,
|
||||
SMESHGUI_FilterDlg( SMESHGUI*,
|
||||
const int type,
|
||||
const char* name = 0 );
|
||||
const char* name = 0);
|
||||
virtual ~SMESHGUI_FilterDlg();
|
||||
|
||||
void Init( const QValueList<int>& types );
|
||||
void Init( const int type );
|
||||
void Init (const QValueList<int>& types);
|
||||
void Init (const int type);
|
||||
|
||||
void SetSelection( SALOME_Selection* );
|
||||
void SetMesh( SMESH::SMESH_Mesh_ptr );
|
||||
void SetSourceWg( QWidget* );
|
||||
void SetSelection();
|
||||
void SetMesh (SMESH::SMESH_Mesh_ptr);
|
||||
void SetSourceWg (QWidget*);
|
||||
|
||||
static SMESH::Filter::Criterion createCriterion();
|
||||
|
||||
@ -239,35 +241,35 @@ private slots:
|
||||
void onClose();
|
||||
void onDeactivate();
|
||||
void onSelectionDone();
|
||||
void onCriterionChanged( const int, const int );
|
||||
void onCurrentChanged( int, int );
|
||||
void onCriterionChanged (const int, const int);
|
||||
void onCurrentChanged (int, int);
|
||||
|
||||
private:
|
||||
|
||||
void construct( const QValueList<int>& types );
|
||||
void construct (const QValueList<int>& types);
|
||||
|
||||
void closeEvent( QCloseEvent* e );
|
||||
void enterEvent ( QEvent * );
|
||||
void closeEvent (QCloseEvent*);
|
||||
void enterEvent (QEvent*);
|
||||
|
||||
// dialog creation
|
||||
QFrame* createButtonFrame( QWidget* );
|
||||
QFrame* createMainFrame( QWidget* );
|
||||
QButtonGroup* createSourceGroup( QWidget* );
|
||||
QFrame* createButtonFrame (QWidget*);
|
||||
QFrame* createMainFrame (QWidget*);
|
||||
QButtonGroup* createSourceGroup (QWidget*);
|
||||
void updateMainButtons();
|
||||
|
||||
// execution
|
||||
bool isValid() const;
|
||||
bool createFilter( const int theType );
|
||||
bool createFilter (const int theType);
|
||||
void insertFilterInViewer();
|
||||
void selectInViewer( const int theType,
|
||||
const QValueList<int>& theIds );
|
||||
void filterSource( const int theType,
|
||||
QValueList<int>& theResIds );
|
||||
void filterSelectionSource( const int theType,
|
||||
QValueList<int>& theResIds );
|
||||
void getIdsFromWg( const QWidget*, QValueList<int>& ) const;
|
||||
void setIdsToWg( QWidget*, const QValueList<int>& );
|
||||
Selection_Mode getSelMode( const int ) const;
|
||||
void selectInViewer (const int theType,
|
||||
const QValueList<int>& theIds);
|
||||
void filterSource (const int theType,
|
||||
QValueList<int>& theResIds);
|
||||
void filterSelectionSource (const int theType,
|
||||
QValueList<int>& theResIds);
|
||||
void getIdsFromWg (const QWidget*, QValueList<int>&) const;
|
||||
void setIdsToWg (QWidget*, const QValueList<int>&);
|
||||
Selection_Mode getSelMode (const int) const;
|
||||
void updateSelection();
|
||||
|
||||
private:
|
||||
@ -285,7 +287,9 @@ private:
|
||||
// initial fields
|
||||
QValueList<int> myTypes;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
SALOME_Selection* mySelection;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
SVTK_Selector* mySelector;
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SMESH::SMESH_Mesh_ptr myMesh;
|
||||
QWidget* mySourceWg;
|
||||
|
||||
@ -297,23 +301,3 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,19 +19,13 @@
|
||||
|
||||
|
||||
#include "SMESHGUI_FilterUtils.h"
|
||||
#include "SMESHGUI_SMESHGenUtils.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
|
||||
SMESH::FilterManager_var GetFilterManager()
|
||||
{
|
||||
static SMESH::FilterManager_var aFilterManager;
|
||||
if(CORBA::is_nil(aFilterManager)){
|
||||
aFilterManager = GetSMESHGen()->CreateFilterManager();
|
||||
}
|
||||
return aFilterManager;
|
||||
return SMESHGUI::GetSMESHGen()->CreateFilterManager(); // DumpPython
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,32 +17,36 @@
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
|
||||
#include "QAD_Desktop.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
|
||||
#include <GeometryGUI.h>
|
||||
|
||||
#include <SALOMEDSClient_SObject.hxx>
|
||||
#include <SALOMEDSClient_ChildIterator.hxx>
|
||||
#include <SALOMEDS_SObject.hxx>
|
||||
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||
|
||||
namespace SMESH{
|
||||
|
||||
namespace SMESH {
|
||||
|
||||
GEOM::GEOM_Gen_var GetGEOMGen()
|
||||
{
|
||||
static GEOM::GEOM_Gen_var aGEOMGen;
|
||||
if(CORBA::is_nil(aGEOMGen)){
|
||||
if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
|
||||
Engines::Component_var aComponent = aDesktop->getEngine("FactoryServer","GEOM");
|
||||
aGEOMGen = GEOM::GEOM_Gen::_narrow(aComponent);
|
||||
}
|
||||
}
|
||||
|
||||
if(CORBA::is_nil(aGEOMGen))
|
||||
aGEOMGen = GeometryGUI::GetGeomGen();
|
||||
return aGEOMGen;
|
||||
}
|
||||
|
||||
|
||||
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theMeshOrSubmesh)
|
||||
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh)
|
||||
{
|
||||
if(!theMeshOrSubmesh->_is_nil()) {
|
||||
CORBA::Object_var Obj = theMeshOrSubmesh->GetObject();
|
||||
SALOMEDS_SObject* aMeshOrSubmesh = _CAST(SObject,theMeshOrSubmesh);
|
||||
if(aMeshOrSubmesh) {
|
||||
CORBA::Object_var Obj = aMeshOrSubmesh->GetObject();
|
||||
if ( !CORBA::is_nil( Obj ) ) {
|
||||
SMESH::SMESH_Mesh_var aMesh =
|
||||
SObjectToInterface<SMESH::SMESH_Mesh>( theMeshOrSubmesh );
|
||||
@ -57,4 +61,32 @@ namespace SMESH{
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO)
|
||||
{
|
||||
if (!theSO)
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
if (!aStudy)
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
||||
_PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO));
|
||||
for (; anIter->More(); anIter->Next()) {
|
||||
_PTR(SObject) aSObject = anIter->Value();
|
||||
_PTR(SObject) aRefSOClient;
|
||||
GEOM::GEOM_Object_var aMeshShape;
|
||||
|
||||
if (aSObject->ReferencedObject(aRefSOClient)) {
|
||||
SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient);
|
||||
aMeshShape = GEOM::GEOM_Object::_narrow(aRefSO->GetObject());
|
||||
} else {
|
||||
SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
|
||||
aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject());
|
||||
}
|
||||
|
||||
if (!aMeshShape->_is_nil())
|
||||
return aMeshShape._retn();
|
||||
}
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
}
|
||||
|
@ -22,17 +22,18 @@
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
||||
|
||||
#include "SALOMEDSClient_definitions.hxx"
|
||||
|
||||
class SALOMEDSClient_SObject;
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
|
||||
GEOM::GEOM_Gen_var GetGEOMGen();
|
||||
|
||||
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr theSObject);
|
||||
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh (_PTR(SObject) theSObject);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include "SMESHGUI_GroupDlg.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_Filter.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
@ -38,18 +37,25 @@
|
||||
#include "SMESHGUI_FilterUtils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "GEOMBase.h"
|
||||
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
|
||||
#include "SalomeApp_Tools.h"
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_MessageBox.h"
|
||||
#include "QAD_RightFrame.h"
|
||||
|
||||
#include "SVTK_ViewWindow.h"
|
||||
#include "SVTK_Selector.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
// QT Includes
|
||||
#include <qbuttongroup.h>
|
||||
@ -74,15 +80,20 @@
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_GroupDlg()
|
||||
// function : SMESHGUI_GroupDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
|
||||
SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
|
||||
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
|
||||
SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myViewWindow( SMESH::GetViewWindow( theModule ) ),
|
||||
mySelector( myViewWindow->GetSelector() )
|
||||
{
|
||||
if ( !name ) setName( "SMESHGUI_GroupDlg" );
|
||||
initDialog(theSel, true);
|
||||
if (!name) setName("SMESHGUI_GroupDlg");
|
||||
initDialog(true);
|
||||
if (!theMesh->_is_nil())
|
||||
init(theMesh);
|
||||
else {
|
||||
@ -98,12 +109,21 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_
|
||||
this->move(x, y);
|
||||
}
|
||||
|
||||
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
|
||||
SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_GroupDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
|
||||
SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myViewWindow( SMESH::GetViewWindow( theModule ) ),
|
||||
mySelector( myViewWindow->GetSelector() )
|
||||
{
|
||||
if ( !name ) setName( "SMESHGUI_GroupDlg" );
|
||||
initDialog(theSel, false);
|
||||
if (!name) setName("SMESHGUI_GroupDlg");
|
||||
initDialog(false);
|
||||
if (!theGroup->_is_nil())
|
||||
init(theGroup);
|
||||
else {
|
||||
@ -117,20 +137,24 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_
|
||||
this->move(x, y);
|
||||
}
|
||||
|
||||
void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_GroupDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::initDialog(bool create)
|
||||
{
|
||||
myFilterDlg = 0;
|
||||
myCreate = create;
|
||||
myCurrentLineEdit = 0;
|
||||
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
|
||||
QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
|
||||
if (create)
|
||||
setCaption( tr( "SMESH_CREATE_GROUP_TITLE" ) );
|
||||
setCaption(tr("SMESH_CREATE_GROUP_TITLE"));
|
||||
else
|
||||
setCaption( tr( "SMESH_EDIT_GROUP_TITLE" ) );
|
||||
setCaption(tr("SMESH_EDIT_GROUP_TITLE"));
|
||||
|
||||
setSizeGripEnabled( TRUE );
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
QGridLayout* aMainLayout = new QGridLayout(this, 7, 3, 11, 6);
|
||||
|
||||
@ -331,8 +355,6 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
|
||||
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
|
||||
/* Init selection */
|
||||
mySelection = theSel;
|
||||
mySMESHGUI = SMESHGUI::GetSMESHGUI();
|
||||
mySMESHGUI->SetActiveDialogBox(this);
|
||||
mySMESHGUI->SetState(800);
|
||||
|
||||
@ -343,7 +365,7 @@ void SMESHGUI_GroupDlg::initDialog(SALOME_Selection* theSel, bool create)
|
||||
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
|
||||
|
||||
myGrpTypeGroup->setButton(myGrpTypeGroup->id(rb1)); // VSR !!!
|
||||
onGrpTypeChanged(myGrpTypeGroup->id(rb1)); // VSR!!!
|
||||
@ -368,12 +390,11 @@ SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
|
||||
void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
|
||||
{
|
||||
/* init data from current selection */
|
||||
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
|
||||
@ -382,7 +403,9 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
SMESH::SetPickable(myActor);
|
||||
|
||||
QString aName = mySelection->firstIObject()->getName();
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
|
||||
QString aName = aList.First()->getName();
|
||||
myMeshGroupLine->setText(aName) ;
|
||||
myMeshGroupLine->home( false );
|
||||
|
||||
@ -396,7 +419,7 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Mesh_ptr theMesh)
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
|
||||
void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
|
||||
{
|
||||
myMesh = theGroup->GetMesh();
|
||||
myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
|
||||
@ -436,7 +459,6 @@ void SMESHGUI_GroupDlg::init(SMESH::SMESH_Group_ptr theGroup)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : updateButtons()
|
||||
// purpose :
|
||||
@ -460,7 +482,7 @@ void SMESHGUI_GroupDlg::updateButtons()
|
||||
// function : onNameChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onNameChanged(const QString& text)
|
||||
void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
|
||||
{
|
||||
updateButtons();
|
||||
}
|
||||
@ -469,7 +491,7 @@ void SMESHGUI_GroupDlg::onNameChanged(const QString& text)
|
||||
// function : onTypeChanged()
|
||||
// purpose : Group elements type radio button management
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onTypeChanged(int id)
|
||||
void SMESHGUI_GroupDlg::onTypeChanged (int id)
|
||||
{
|
||||
if (myTypeId != id) {
|
||||
myElements->clear();
|
||||
@ -483,7 +505,7 @@ void SMESHGUI_GroupDlg::onTypeChanged(int id)
|
||||
// function : onGrpTypeChanged()
|
||||
// purpose : Group type radio button management
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
|
||||
void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
|
||||
{
|
||||
if (myGrpTypeId != id) {
|
||||
myWGStack->raiseWidget( id );
|
||||
@ -496,43 +518,42 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
|
||||
// function : setSelectionMode()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
|
||||
void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
|
||||
{
|
||||
// PAL7314
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
if (mySelectionMode != theMode) {
|
||||
mySelection->ClearIObjects();
|
||||
mySelection->ClearFilters();
|
||||
mySelectionMgr->clearSelected();
|
||||
mySelectionMgr->clearFilters();
|
||||
SMESH::SetPointRepresentation(false);
|
||||
if (theMode < 4) {
|
||||
switch(theMode){
|
||||
switch (theMode) {
|
||||
case 0:
|
||||
if ( myActor )
|
||||
if (myActor)
|
||||
myActor->SetPointRepresentation(true);
|
||||
else
|
||||
SMESH::SetPointRepresentation(true);
|
||||
QAD_Application::getDesktop()->SetSelectionMode(NodeSelection, true);
|
||||
myViewWindow->SetSelectionMode(NodeSelection);
|
||||
break;
|
||||
case 1:
|
||||
QAD_Application::getDesktop()->SetSelectionMode(EdgeSelection, true);
|
||||
myViewWindow->SetSelectionMode(EdgeSelection);
|
||||
break;
|
||||
case 2:
|
||||
QAD_Application::getDesktop()->SetSelectionMode(FaceSelection, true);
|
||||
myViewWindow->SetSelectionMode(FaceSelection);
|
||||
break;
|
||||
default:
|
||||
QAD_Application::getDesktop()->SetSelectionMode(VolumeSelection, true);
|
||||
myViewWindow->SetSelectionMode(VolumeSelection);
|
||||
}
|
||||
}
|
||||
else {
|
||||
QAD_Application::getDesktop()->SetSelectionMode(ActorSelection, true);
|
||||
} else {
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
if (theMode == 4)
|
||||
mySelection->AddFilter(mySubMeshFilter);
|
||||
mySelectionMgr->installFilter(mySubMeshFilter);
|
||||
else if (theMode == 5)
|
||||
mySelection->AddFilter(myGroupFilter);
|
||||
mySelectionMgr->installFilter(myGroupFilter);
|
||||
else if (theMode == 6)
|
||||
mySelection->AddFilter(myMeshFilter);
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
}
|
||||
mySelectionMode = theMode;
|
||||
}
|
||||
@ -544,11 +565,13 @@ void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
|
||||
//=================================================================================
|
||||
bool SMESHGUI_GroupDlg::onApply()
|
||||
{
|
||||
if (mySMESHGUI->ActiveStudyLocked())
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
if ( myGrpTypeId == 0 && !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0) {
|
||||
mySelection->ClearIObjects();
|
||||
if (myGrpTypeId == 0 &&
|
||||
!myName->text().stripWhiteSpace().isEmpty() &&
|
||||
myElements->count() > 0) {
|
||||
mySelectionMgr->clearSelected();
|
||||
if (myGroup->_is_nil()) {
|
||||
SMESH::ElementType aType = SMESH::ALL;
|
||||
switch(myTypeId) {
|
||||
@ -572,8 +595,8 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
myName->setText("");
|
||||
myElements->clear();
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
myGroup->SetName(myName->text());
|
||||
|
||||
QValueList<int> aAddList;
|
||||
@ -609,32 +632,35 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
myIdList.append(anItem->text().toInt());
|
||||
}
|
||||
|
||||
mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
|
||||
mySMESHGUI->updateObjBrowser(true);
|
||||
SMESH::UpdateView(); // asv: fix of BUG PAL5515
|
||||
mySelection->ClearIObjects();
|
||||
mySelectionMgr->clearSelected();
|
||||
return true;
|
||||
} else if (myGrpTypeId == 1 &&
|
||||
!myName->text().stripWhiteSpace().isEmpty() &&
|
||||
!CORBA::is_nil(myGeomGroup))
|
||||
{
|
||||
SMESH::ElementType aType = SMESH::ALL;
|
||||
switch (myTypeId) {
|
||||
case 0: aType = SMESH::NODE; break;
|
||||
case 1: aType = SMESH::EDGE; break;
|
||||
case 2: aType = SMESH::FACE; break;
|
||||
case 3: aType = SMESH::VOLUME; break;
|
||||
}
|
||||
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
|
||||
myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
||||
|
||||
mySMESHGUI->updateObjBrowser(true);
|
||||
mySelectionMgr->clearSelected();
|
||||
/* init for next operation */
|
||||
myName->setText("");
|
||||
return true;
|
||||
}
|
||||
else if (myGrpTypeId == 1 && !myName->text().stripWhiteSpace().isEmpty() && !CORBA::is_nil( myGeomGroup ))
|
||||
{
|
||||
SMESH::ElementType aType = SMESH::ALL;
|
||||
switch(myTypeId) {
|
||||
case 0: aType = SMESH::NODE; break;
|
||||
case 1: aType = SMESH::EDGE; break;
|
||||
case 2: aType = SMESH::FACE; break;
|
||||
case 3: aType = SMESH::VOLUME; break;
|
||||
}
|
||||
|
||||
SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
||||
|
||||
mySMESHGUI->GetActiveStudy()->updateObjBrowser(true);
|
||||
mySelection->ClearIObjects();
|
||||
/* init for next operation */
|
||||
myName->setText("");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -661,7 +687,7 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
|
||||
busy = true;
|
||||
|
||||
if (myCurrentLineEdit == 0) {
|
||||
mySelection->ClearIObjects();
|
||||
mySelectionMgr->clearSelected();
|
||||
TColStd_MapOfInteger aIndexes;
|
||||
QListBoxItem* anItem;
|
||||
for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) {
|
||||
@ -670,8 +696,11 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
|
||||
aIndexes.Add(anId);
|
||||
}
|
||||
}
|
||||
mySelection->AddOrRemoveIndex(myActor->getIO(), aIndexes, false, false);
|
||||
mySelection->AddIObject(myActor->getIO());
|
||||
mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false);
|
||||
SALOME_ListIO aList;
|
||||
aList.Append(myActor->getIO());
|
||||
mySelectionMgr->setSelectedObjects(aList,false);
|
||||
myViewWindow->highlight( myActor->getIO(), true, true );
|
||||
}
|
||||
busy = false;
|
||||
}
|
||||
@ -685,148 +714,155 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
if (busy || !isEnabled()) return;
|
||||
busy = true;
|
||||
|
||||
int aNbSel = mySelection->IObjectCount();
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
|
||||
int aNbSel = aList.Extent();
|
||||
myElements->clearSelection();
|
||||
|
||||
if (myCurrentLineEdit) {
|
||||
myCurrentLineEdit->setText("") ;
|
||||
myCurrentLineEdit->setText("");
|
||||
QString aString = "";
|
||||
|
||||
if (myCurrentLineEdit == myMeshGroupLine)
|
||||
{
|
||||
mySelectSubMesh->setEnabled(false);
|
||||
mySelectGroup->setEnabled(false);
|
||||
myGroupLine->setText("");
|
||||
mySubMeshLine->setText("");
|
||||
if (myCurrentLineEdit == myMeshGroupLine) {
|
||||
mySelectSubMesh->setEnabled(false);
|
||||
mySelectGroup->setEnabled(false);
|
||||
myGroupLine->setText("");
|
||||
mySubMeshLine->setText("");
|
||||
|
||||
myGeomGroupBtn->setEnabled(false);
|
||||
myGeomGroupLine->setEnabled(false);
|
||||
myGeomGroupLine->setText("");
|
||||
if (!myCreate)
|
||||
myName->setText("");
|
||||
myGeomGroupBtn->setEnabled(false);
|
||||
myGeomGroupLine->setEnabled(false);
|
||||
myGeomGroupLine->setText("");
|
||||
if (!myCreate)
|
||||
myName->setText("");
|
||||
|
||||
myElements->clear();
|
||||
myElements->clear();
|
||||
|
||||
if(aNbSel != 1)
|
||||
{
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if (myCreate)
|
||||
{
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
if(myMesh->_is_nil())
|
||||
return;
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
SMESH::SetPickable(myActor);
|
||||
|
||||
aString = mySelection->firstIObject()->getName();
|
||||
myMeshGroupLine->setText(aString) ;
|
||||
myMeshGroupLine->home( false );
|
||||
|
||||
mySelectSubMesh->setEnabled(true);
|
||||
mySelectGroup->setEnabled(true);
|
||||
myGeomGroupBtn->setEnabled(true);
|
||||
myGeomGroupLine->setEnabled(true);
|
||||
updateButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
|
||||
if(aGroup->_is_nil())
|
||||
return;
|
||||
busy = false;
|
||||
myCurrentLineEdit = 0;
|
||||
init(aGroup);
|
||||
busy = true;
|
||||
mySelectSubMesh->setEnabled(true);
|
||||
mySelectGroup->setEnabled(true);
|
||||
myGeomGroupBtn->setEnabled(true);
|
||||
myGeomGroupLine->setEnabled(true);
|
||||
}
|
||||
myCurrentLineEdit = 0;
|
||||
busy = false;
|
||||
if (!myCreate)
|
||||
return;
|
||||
|
||||
if (myTypeId == -1)
|
||||
onTypeChanged(0);
|
||||
else
|
||||
{
|
||||
myElements->clear();
|
||||
setSelectionMode(myTypeId);
|
||||
}
|
||||
|
||||
return;
|
||||
if (aNbSel != 1) {
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
else if (myCurrentLineEdit == myGeomGroupLine)
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
|
||||
if(aNbSel != 1)
|
||||
{
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
myGeomGroup = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult );
|
||||
|
||||
// Check if the object is a geometry group
|
||||
if(!testResult || CORBA::is_nil( myGeomGroup ))
|
||||
{
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
// Check if group constructed on the same shape as a mesh or on its child
|
||||
SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var anOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
// The main shape of the group
|
||||
GEOM::GEOM_Object_var aGroupMainShape;
|
||||
if( myGeomGroup->GetType() == 37 )
|
||||
aGroupMainShape = anOp->GetMainShape( myGeomGroup );
|
||||
else
|
||||
aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
|
||||
SALOMEDS::SObject_var aGroupMainShapeSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(aGroupMainShape) );
|
||||
// The mesh SObject
|
||||
SALOMEDS::SObject_var aMeshSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myMesh) );
|
||||
if ( aMeshSO->_is_nil() ) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
if (myCreate) {
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
if (myMesh->_is_nil())
|
||||
{
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
SALOMEDS::SObject_var anObj, aRef;
|
||||
bool isRefOrSubShape = false;
|
||||
if ( aMeshSO->FindSubObject( 1, anObj ) && anObj->ReferencedObject( aRef )) {
|
||||
if ( strcmp( aRef->GetID(), aGroupMainShapeSO->GetID() ) == 0 )
|
||||
isRefOrSubShape = true;
|
||||
else
|
||||
{
|
||||
SALOMEDS::SObject_var aFather = aGroupMainShapeSO->GetFather();
|
||||
SALOMEDS::SComponent_var aComponent = aGroupMainShapeSO->GetFatherComponent();
|
||||
while ( !isRefOrSubShape && strcmp( aFather->GetID(), aComponent->GetID() ) != 0 )
|
||||
{
|
||||
if (strcmp( aRef->GetID(), aFather->GetID() ) == 0)
|
||||
isRefOrSubShape = true;
|
||||
else
|
||||
aFather = aFather->GetFather();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !isRefOrSubShape )
|
||||
{
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
SMESH::SetPickable(myActor);
|
||||
|
||||
aString = aList.First()->getName();
|
||||
myMeshGroupLine->setText(aString) ;
|
||||
myMeshGroupLine->home( false );
|
||||
|
||||
mySelectSubMesh->setEnabled(true);
|
||||
mySelectGroup->setEnabled(true);
|
||||
myGeomGroupBtn->setEnabled(true);
|
||||
myGeomGroupLine->setEnabled(true);
|
||||
updateButtons();
|
||||
} else {
|
||||
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
|
||||
if (aGroup->_is_nil())
|
||||
{
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
busy = false;
|
||||
myCurrentLineEdit = 0;
|
||||
init(aGroup);
|
||||
busy = true;
|
||||
mySelectSubMesh->setEnabled(true);
|
||||
mySelectGroup->setEnabled(true);
|
||||
myGeomGroupBtn->setEnabled(true);
|
||||
myGeomGroupLine->setEnabled(true);
|
||||
}
|
||||
myCurrentLineEdit = 0;
|
||||
busy = false;
|
||||
if (!myCreate)
|
||||
{
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (myTypeId == -1)
|
||||
onTypeChanged(0);
|
||||
else {
|
||||
myElements->clear();
|
||||
setSelectionMode(myTypeId);
|
||||
}
|
||||
|
||||
busy = false;
|
||||
return;
|
||||
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine) {
|
||||
if (aNbSel != 1) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
myGeomGroup = GEOMBase::ConvertIOinGEOMObject(aList.First(), testResult);
|
||||
|
||||
// Check if the object is a geometry group
|
||||
if (!testResult || CORBA::is_nil(myGeomGroup)) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
// Check if group constructed on the same shape as a mesh or on its child
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var anOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
// The main shape of the group
|
||||
GEOM::GEOM_Object_var aGroupMainShape;
|
||||
if (myGeomGroup->GetType() == 37)
|
||||
aGroupMainShape = anOp->GetMainShape(myGeomGroup);
|
||||
else
|
||||
aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
|
||||
_PTR(SObject) aGroupMainShapeSO =
|
||||
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
|
||||
aStudy->FindObjectIOR(aGroupMainShape->GetStudyEntry());
|
||||
|
||||
// The mesh SObject
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
if (!aMeshSO) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
_PTR(SObject) anObj, aRef;
|
||||
bool isRefOrSubShape = false;
|
||||
if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
|
||||
//if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
|
||||
if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
|
||||
isRefOrSubShape = true;
|
||||
} else {
|
||||
_PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
|
||||
_PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
|
||||
//while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
|
||||
while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
|
||||
//if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
|
||||
if (aRef->GetID() == aFather->GetID())
|
||||
isRefOrSubShape = true;
|
||||
else
|
||||
aFather = aFather->GetFather();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isRefOrSubShape) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
busy = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNbSel >= 1) {
|
||||
if (aNbSel > 1) {
|
||||
@ -834,26 +870,24 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
|
||||
else if (myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
|
||||
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
|
||||
}
|
||||
else {
|
||||
aString = mySelection->firstIObject()->getName();
|
||||
} else {
|
||||
aString = aList.First()->getName();
|
||||
}
|
||||
}
|
||||
|
||||
myCurrentLineEdit->setText(aString) ;
|
||||
myCurrentLineEdit->home( false );
|
||||
myCurrentLineEdit->setText(aString);
|
||||
myCurrentLineEdit->home(false);
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
if (aNbSel == 1) {
|
||||
QString aListStr = "";
|
||||
int aNbItems = 0;
|
||||
if (myTypeId == 0) {
|
||||
aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, aListStr);
|
||||
}
|
||||
else {
|
||||
aNbItems = SMESH::GetNameOfSelectedElements(mySelection, aListStr);
|
||||
aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
|
||||
} else {
|
||||
aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
|
||||
}
|
||||
if (aNbItems > 0) {
|
||||
QStringList anElements = QStringList::split(" ", aListStr);
|
||||
@ -866,8 +900,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
}
|
||||
}
|
||||
|
||||
if ( !myActor ) {
|
||||
if ( !myGroup->_is_nil() )
|
||||
if (!myActor) {
|
||||
if (!myGroup->_is_nil())
|
||||
myActor = SMESH::FindActorByObject(myGroup);
|
||||
else
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
@ -876,7 +910,6 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
busy = false;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onSelectSubMesh()
|
||||
// purpose : Called when selection in 3D view or ObjectBrowser is changed
|
||||
@ -1003,13 +1036,13 @@ void SMESHGUI_GroupDlg::setFilters()
|
||||
|
||||
if ( myFilterDlg == 0 )
|
||||
{
|
||||
myFilterDlg = new SMESHGUI_FilterDlg( (QWidget*)parent(), aType );
|
||||
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, aType );
|
||||
connect( myFilterDlg, SIGNAL( Accepted() ), SLOT( onFilterAccepted() ) );
|
||||
}
|
||||
else
|
||||
myFilterDlg->Init( aType );
|
||||
|
||||
myFilterDlg->SetSelection( mySelection );
|
||||
myFilterDlg->SetSelection();
|
||||
myFilterDlg->SetMesh( myMesh );
|
||||
myFilterDlg->SetSourceWg( myElements );
|
||||
|
||||
@ -1037,7 +1070,9 @@ void SMESHGUI_GroupDlg::onFilterAccepted()
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onAdd()
|
||||
{
|
||||
int aNbSel = mySelection->IObjectCount();
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
int aNbSel = aList.Extent();
|
||||
|
||||
if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
|
||||
|
||||
busy = true;
|
||||
@ -1055,10 +1090,10 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
QString aListStr = "";
|
||||
int aNbItems = 0;
|
||||
if (myTypeId == 0) {
|
||||
aNbItems = SMESH::GetNameOfSelectedNodes(mySelection, myActor->getIO(), aListStr);
|
||||
aNbItems = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr);
|
||||
}
|
||||
else {
|
||||
aNbItems = SMESH::GetNameOfSelectedElements(mySelection, myActor->getIO(), aListStr);
|
||||
aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
|
||||
}
|
||||
if (aNbItems > 0) {
|
||||
QStringList anElements = QStringList::split(" ", aListStr);
|
||||
@ -1072,16 +1107,18 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
myElements->setSelected(anItem, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (myCurrentLineEdit == mySubMeshLine) {
|
||||
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
|
||||
} else if (myCurrentLineEdit == mySubMeshLine) {
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
|
||||
SMESH::SMESH_subMesh_var aSubMesh =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
|
||||
if (!aSubMesh->_is_nil()) {
|
||||
// check if mesh is the same
|
||||
if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
|
||||
try {
|
||||
SMESH::long_array_var anElements = aSubMesh->GetElementsByType ( aType );
|
||||
SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType);
|
||||
int k = anElements->length();
|
||||
QListBoxItem* anItem = 0;
|
||||
for (int i = 0; i < k; i++) {
|
||||
@ -1095,7 +1132,7 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& ex) {
|
||||
QtCatchCorbaException(ex);
|
||||
SalomeApp_Tools::QtCatchCorbaException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1103,11 +1140,14 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
mySelectSubMesh->setChecked(false);
|
||||
busy = false;
|
||||
onListSelectionChanged();
|
||||
}
|
||||
else if (myCurrentLineEdit == myGroupLine) {
|
||||
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
|
||||
|
||||
} else if (myCurrentLineEdit == myGroupLine) {
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
|
||||
SMESH::SMESH_Group_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
|
||||
if (!aGroup->_is_nil()) {
|
||||
// check if mesh is the same
|
||||
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
|
||||
@ -1129,11 +1169,11 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
mySelectGroup->setChecked(false);
|
||||
busy = false;
|
||||
onListSelectionChanged();
|
||||
}
|
||||
else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
|
||||
|
||||
SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp = SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
SMESH::ElementType aGroupType = SMESH::ALL;
|
||||
switch(aGroupOp->GetType(myGeomGroup)) {
|
||||
@ -1141,21 +1181,23 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
case 6: aGroupType = SMESH::EDGE; break;
|
||||
case 4: aGroupType = SMESH::FACE; break;
|
||||
case 2: aGroupType = SMESH::VOLUME; break;
|
||||
default: return;
|
||||
default: busy = false; return;
|
||||
}
|
||||
|
||||
if (aGroupType == aType) {
|
||||
SALOMEDS::SObject_var aGroupSO = aStudy->FindObjectIOR( aStudy->ConvertObjectToIOR(myGeomGroup) );
|
||||
_PTR(SObject) aGroupSO =
|
||||
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
|
||||
aStudy->FindObjectIOR(myGeomGroup->GetStudyEntry());
|
||||
// Construct filter
|
||||
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
|
||||
SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
|
||||
SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();;
|
||||
aBelongToGeom->SetGeom(myGeomGroup);
|
||||
aBelongToGeom->SetShapeName(aGroupSO->GetName());
|
||||
aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
|
||||
aBelongToGeom->SetElementType(aType);
|
||||
aFilter->SetPredicate( aBelongToGeom );
|
||||
aFilter->SetPredicate(aBelongToGeom);
|
||||
|
||||
SMESH::long_array_var anElements = aFilter->GetElementsId( myMesh );
|
||||
SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh);
|
||||
|
||||
int k = anElements->length();
|
||||
QListBoxItem* anItem = 0;
|
||||
@ -1175,7 +1217,7 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
onListSelectionChanged();
|
||||
}
|
||||
busy = false;
|
||||
// mySelection->ClearIObjects();
|
||||
// mySelectionMgr->clearSelected();
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@ -1192,9 +1234,10 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
myElements->removeItem(i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
int aNbSel = mySelection->IObjectCount();
|
||||
} else {
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
int aNbSel = aList.Extent();
|
||||
|
||||
if (aNbSel == 0) { busy = false; return; }
|
||||
|
||||
SMESH::ElementType aType = SMESH::ALL;
|
||||
@ -1206,7 +1249,9 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
}
|
||||
|
||||
if (myCurrentLineEdit == mySubMeshLine) {
|
||||
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
|
||||
if (!aSubMesh->_is_nil()) {
|
||||
@ -1223,7 +1268,7 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& ex) {
|
||||
QtCatchCorbaException(ex);
|
||||
SalomeApp_Tools::QtCatchCorbaException(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1237,7 +1282,7 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& ex) {
|
||||
QtCatchCorbaException(ex);
|
||||
SalomeApp_Tools::QtCatchCorbaException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1246,7 +1291,9 @@ void SMESHGUI_GroupDlg::onRemove()
|
||||
}
|
||||
else if (myCurrentLineEdit == myGroupLine) {
|
||||
Standard_Boolean aRes;
|
||||
SALOME_ListIteratorOfListIO anIt(mySelection->StoredIObjects());
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
const SALOME_ListIO& aList = mySelector->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
|
||||
if (aRes && !aGroup->_is_nil()) {
|
||||
@ -1309,65 +1356,64 @@ void SMESHGUI_GroupDlg::onSort()
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::closeEvent( QCloseEvent* e )
|
||||
void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
|
||||
{
|
||||
onClose();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupDlg::onClose
|
||||
// Purpose : SLOT called when "Close" button pressed. Close dialog
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_GroupDlg::onClose
|
||||
// purpose : SLOT called when "Close" button pressed. Close dialog
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onClose()
|
||||
{
|
||||
QAD_StudyFrame* aStudyFrame = mySMESHGUI->GetActiveStudy()->getActiveStudyFrame();
|
||||
if (aStudyFrame->getTypeView() == VIEW_VTK) {
|
||||
if (SMESH::GetCurrentVtkView()) {
|
||||
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
|
||||
SMESH::SetPointRepresentation(false);
|
||||
SMESH::SetPickable();
|
||||
}
|
||||
|
||||
mySelection->ClearIObjects();
|
||||
QAD_Application::getDesktop()->SetSelectionMode(ActorSelection);
|
||||
mySelection->ClearFilters();
|
||||
mySelectionMgr->clearSelected();
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
mySelectionMgr->clearFilters();
|
||||
mySMESHGUI->ResetState();
|
||||
|
||||
reject();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupDlg::onDeactivate
|
||||
// Purpose : SLOT called when dialog must be deativated
|
||||
//=======================================================================
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_GroupDlg::onDeactivate
|
||||
// purpose : SLOT called when dialog must be deativated
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onDeactivate()
|
||||
{
|
||||
mySMESHGUI->ResetState();
|
||||
setEnabled( false );
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupDlg::enterEvent
|
||||
// Purpose : Event filter
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupDlg::enterEvent( QEvent* )
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_GroupDlg::enterEvent
|
||||
// purpose : Event filter
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if ( !isEnabled() ) {
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
||||
setEnabled( true );
|
||||
if (!isEnabled()) {
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
setEnabled(true);
|
||||
mySelectionMode = -1;
|
||||
setSelectionMode( myTypeId );
|
||||
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
setSelectionMode(myTypeId);
|
||||
//mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
mySMESHGUI->SetActiveDialogBox(this);
|
||||
mySMESHGUI->SetState(800);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : hideEvent
|
||||
//purpose : caused by ESC key
|
||||
//=======================================================================
|
||||
|
||||
void SMESHGUI_GroupDlg::hideEvent ( QHideEvent * e )
|
||||
//=================================================================================
|
||||
// function : hideEvent
|
||||
// purpose : caused by ESC key
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)
|
||||
{
|
||||
if ( !isMinimized() )
|
||||
if (!isMinimized())
|
||||
onClose();
|
||||
}
|
||||
|
@ -28,8 +28,9 @@
|
||||
#ifndef DIALOGBOX_GROUP_H
|
||||
#define DIALOGBOX_GROUP_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
//#include "SMESH_TypeFilter.hxx"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
@ -50,6 +51,8 @@ class QWidgetStack;
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SMESHGUI_FilterDlg;
|
||||
class SVTK_Selector;
|
||||
class SVTK_ViewWindow;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_GroupDlg
|
||||
@ -60,11 +63,14 @@ class SMESHGUI_GroupDlg : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_GroupDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* theSel = 0,
|
||||
SMESHGUI_GroupDlg( SMESHGUI*,
|
||||
const char* name = 0,
|
||||
SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(),
|
||||
bool modal = FALSE, WFlags fl = 0 );
|
||||
SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel,
|
||||
SMESH::SMESH_Group_ptr theGroup, bool modal = FALSE, WFlags fl = 0 );
|
||||
SMESHGUI_GroupDlg( SMESHGUI*,
|
||||
const char* name,
|
||||
SMESH::SMESH_Group_ptr theGroup,
|
||||
bool modal = FALSE, WFlags fl = 0 );
|
||||
~SMESHGUI_GroupDlg();
|
||||
|
||||
public slots:
|
||||
@ -98,21 +104,23 @@ private slots:
|
||||
void onFilterAccepted();
|
||||
|
||||
private:
|
||||
void initDialog(SALOME_Selection* theSel, bool create);
|
||||
void initDialog(bool create);
|
||||
void init(SMESH::SMESH_Mesh_ptr theMesh);
|
||||
void init(SMESH::SMESH_Group_ptr theGroup);
|
||||
void closeEvent(QCloseEvent* e);
|
||||
void enterEvent ( QEvent * ) ;
|
||||
void hideEvent ( QHideEvent * ); /* ESC key */
|
||||
void enterEvent (QEvent*);
|
||||
void hideEvent (QHideEvent*); /* ESC key */
|
||||
void setSelectionMode(int theMode);
|
||||
void updateButtons();
|
||||
|
||||
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
SMESH_Actor* myActor; /* Current mesh actor */
|
||||
int myGrpTypeId ; /* Current group type id : standalone or group on geometry */
|
||||
int myTypeId ; /* Current type id = radio button id */
|
||||
QLineEdit* myCurrentLineEdit; /* Current LineEdit */
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
SMESH_Actor* myActor; /* Current mesh actor */
|
||||
int myGrpTypeId; /* Current group type id : standalone or group on geometry */
|
||||
int myTypeId; /* Current type id = radio button id */
|
||||
QLineEdit* myCurrentLineEdit; /* Current LineEdit */
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
QPushButton* myMeshGroupBtn;
|
||||
QLineEdit* myMeshGroupLine;
|
||||
@ -144,9 +152,12 @@ private:
|
||||
GEOM::GEOM_Object_var myGeomGroup;
|
||||
|
||||
int mySelectionMode;
|
||||
Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
Handle(SMESH_TypeFilter) mySubMeshFilter;
|
||||
Handle(SMESH_TypeFilter) myGroupFilter;
|
||||
//Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) mySubMeshFilter;
|
||||
//Handle(SMESH_TypeFilter) myGroupFilter;
|
||||
SUIT_SelectionFilter* myMeshFilter;
|
||||
SUIT_SelectionFilter* mySubMeshFilter;
|
||||
SUIT_SelectionFilter* myGroupFilter;
|
||||
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
|
@ -27,13 +27,19 @@
|
||||
|
||||
#include "SMESHGUI_GroupOpDlg.h"
|
||||
|
||||
#include "QAD_Desktop.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SALOME_Selection.h"
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SVTK_Selection.h"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
|
||||
// QT Includes
|
||||
#include <qframe.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpushbutton.h>
|
||||
@ -46,70 +52,72 @@
|
||||
#define SPACING 5
|
||||
#define MARGIN 10
|
||||
|
||||
/*
|
||||
Class : SMESHGUI_GroupOpDlg
|
||||
Description : Perform boolean operations on groups
|
||||
*/
|
||||
/*!
|
||||
* Class : SMESHGUI_GroupOpDlg
|
||||
* Description : Perform boolean operations on groups
|
||||
*/
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
|
||||
// Purpose : Constructor
|
||||
//=======================================================================
|
||||
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( QWidget* theParent,
|
||||
SALOME_Selection* theSelection,
|
||||
const int theMode )
|
||||
: QDialog( theParent, "SMESHGUI_GroupOpDlg", false,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg (QWidget* theParent,
|
||||
SalomeApp_SelectionMgr* theSelection,
|
||||
const int theMode)
|
||||
: QDialog(theParent, "SMESHGUI_GroupOpDlg", false,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||
{
|
||||
myMode = theMode;
|
||||
|
||||
if ( myMode == UNION ) setCaption( tr( "UNION_OF_TWO_GROUPS" ) );
|
||||
else if ( myMode == INTERSECT ) setCaption( tr( "INTERSECTION_OF_TWO_GROUPS" ) );
|
||||
else setCaption( tr( "CUT_OF_TWO_GROUPS" ) );
|
||||
if (myMode == UNION) setCaption(tr("UNION_OF_TWO_GROUPS"));
|
||||
else if (myMode == INTERSECT) setCaption(tr("INTERSECTION_OF_TWO_GROUPS"));
|
||||
else setCaption(tr("CUT_OF_TWO_GROUPS"));
|
||||
|
||||
QVBoxLayout* aDlgLay = new QVBoxLayout( this, MARGIN, SPACING );
|
||||
QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
|
||||
|
||||
QFrame* aMainFrame = createMainFrame ( this );
|
||||
QFrame* aBtnFrame = createButtonFrame( this );
|
||||
QFrame* aMainFrame = createMainFrame (this);
|
||||
QFrame* aBtnFrame = createButtonFrame(this);
|
||||
|
||||
aDlgLay->addWidget( aMainFrame );
|
||||
aDlgLay->addWidget( aBtnFrame );
|
||||
aDlgLay->addWidget(aMainFrame);
|
||||
aDlgLay->addWidget(aBtnFrame);
|
||||
|
||||
aDlgLay->setStretchFactor( aMainFrame, 1 );
|
||||
aDlgLay->setStretchFactor(aMainFrame, 1);
|
||||
|
||||
Init( theSelection );
|
||||
Init(theSelection);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupOpDlg::createMainFrame
|
||||
// Purpose : Create frame containing dialog's input fields
|
||||
//=======================================================================
|
||||
QFrame* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent )
|
||||
QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent)
|
||||
{
|
||||
QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, theParent );
|
||||
aMainGrp->setFrameStyle( QFrame::NoFrame );
|
||||
aMainGrp->setInsideMargin( 0 );
|
||||
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
|
||||
aMainGrp->setFrameStyle(QFrame::NoFrame);
|
||||
aMainGrp->setInsideMargin(0);
|
||||
|
||||
QGroupBox* aNameGrp = new QGroupBox( 1, Qt::Vertical, tr( "NAME" ), aMainGrp );
|
||||
new QLabel( tr( "RESULT_NAME" ), aNameGrp );
|
||||
myNameEdit = new QLineEdit( aNameGrp );
|
||||
QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, tr("NAME"), aMainGrp);
|
||||
new QLabel(tr("RESULT_NAME"), aNameGrp);
|
||||
myNameEdit = new QLineEdit(aNameGrp);
|
||||
|
||||
QGroupBox* anArgGrp = new QGroupBox( 3, Qt::Horizontal, tr( "ARGUMENTS" ), aMainGrp );
|
||||
QGroupBox* anArgGrp = new QGroupBox(3, Qt::Horizontal, tr("ARGUMENTS"), aMainGrp);
|
||||
|
||||
new QLabel( myMode == CUT ? tr( "MAIN_OBJECT" ) :tr( "OBJECT_1" ), anArgGrp );
|
||||
myBtn1 = new QPushButton( anArgGrp );
|
||||
myEdit1 = new QLineEdit( anArgGrp );
|
||||
new QLabel(myMode == CUT ? tr("MAIN_OBJECT") :tr("OBJECT_1"), anArgGrp);
|
||||
myBtn1 = new QPushButton(anArgGrp);
|
||||
myEdit1 = new QLineEdit(anArgGrp);
|
||||
myEdit1->setAlignment( Qt::AlignLeft );
|
||||
|
||||
new QLabel( myMode == CUT ? tr( "TOOL_OBJECT" ) :tr( "OBJECT_2" ), anArgGrp );
|
||||
myBtn2 = new QPushButton( anArgGrp );
|
||||
myEdit2 = new QLineEdit( anArgGrp );
|
||||
new QLabel(myMode == CUT ? tr("TOOL_OBJECT") :tr("OBJECT_2"), anArgGrp);
|
||||
myBtn2 = new QPushButton(anArgGrp);
|
||||
myEdit2 = new QLineEdit(anArgGrp);
|
||||
myEdit2->setAlignment( Qt::AlignLeft );
|
||||
|
||||
myEdit1->setReadOnly( true );
|
||||
myEdit2->setReadOnly( true );
|
||||
myEdit1->setReadOnly(true);
|
||||
myEdit2->setReadOnly(true);
|
||||
|
||||
QPixmap aPix( QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr( "ICON_SELECT" ) ) );
|
||||
myBtn1->setPixmap( aPix );
|
||||
myBtn2->setPixmap( aPix );
|
||||
QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
myBtn1->setPixmap(aPix);
|
||||
myBtn2->setPixmap(aPix);
|
||||
|
||||
return aMainGrp;
|
||||
}
|
||||
@ -118,28 +126,28 @@ QFrame* SMESHGUI_GroupOpDlg::createMainFrame( QWidget* theParent )
|
||||
// name : SMESHGUI_GroupOpDlg::createButtonFrame
|
||||
// Purpose : Create frame containing buttons
|
||||
//=======================================================================
|
||||
QFrame* SMESHGUI_GroupOpDlg::createButtonFrame( QWidget* theParent )
|
||||
QFrame* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent)
|
||||
{
|
||||
QFrame* aFrame = new QFrame( theParent );
|
||||
aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
|
||||
QFrame* aFrame = new QFrame(theParent);
|
||||
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
|
||||
myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame );
|
||||
myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), aFrame );
|
||||
myCloseBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), aFrame );
|
||||
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
|
||||
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
|
||||
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
|
||||
|
||||
QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
QHBoxLayout* aLay = new QHBoxLayout( aFrame, MARGIN, SPACING );
|
||||
QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
|
||||
|
||||
aLay->addWidget( myOkBtn );
|
||||
aLay->addWidget( myApplyBtn );
|
||||
aLay->addItem( aSpacer);
|
||||
aLay->addWidget( myCloseBtn );
|
||||
aLay->addWidget(myOkBtn);
|
||||
aLay->addWidget(myApplyBtn);
|
||||
aLay->addItem(aSpacer);
|
||||
aLay->addWidget(myCloseBtn);
|
||||
|
||||
// connect signals and slots
|
||||
connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );
|
||||
connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;
|
||||
connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );
|
||||
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
|
||||
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
|
||||
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
|
||||
|
||||
return aFrame;
|
||||
}
|
||||
@ -156,32 +164,36 @@ SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
|
||||
// name : SMESHGUI_GroupOpDlg::Init
|
||||
// Purpose : Init dialog fields, connect signals and slots, show dialog
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::Init( SALOME_Selection* theSelection )
|
||||
void SMESHGUI_GroupOpDlg::Init (SalomeApp_SelectionMgr* theSelection)
|
||||
{
|
||||
mySelection = theSelection;
|
||||
mySelectionMgr = theSelection;
|
||||
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
|
||||
aSMESHGUI->SetActiveDialogBox( ( QDialog* )this ) ;
|
||||
aSMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
myFocusWg = myEdit1;
|
||||
|
||||
myGroup1 = SMESH::SMESH_GroupBase::_nil();
|
||||
myGroup2 = SMESH::SMESH_GroupBase::_nil();
|
||||
|
||||
// selection and SMESHGUI
|
||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
|
||||
connect( aSMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( onDeactivate() ) );
|
||||
connect( aSMESHGUI, SIGNAL( SignalCloseAllDialogs() ), SLOT( ClickOnClose() ) );
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
|
||||
connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
|
||||
connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
|
||||
|
||||
connect( myBtn1, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
|
||||
connect( myBtn2, SIGNAL( clicked() ), this, SLOT( onFocusChanged() ) );
|
||||
connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
|
||||
connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
|
||||
|
||||
int x, y ;
|
||||
aSMESHGUI->DefineDlgPosition( this, x, y );
|
||||
this->move( x, y );
|
||||
int x, y;
|
||||
aSMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
// set selection mode
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
|
||||
mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
|
||||
#ifdef NEW_GUI
|
||||
mySelectionMgr->setSelectionModes(ActorSelection, true);
|
||||
#else
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
#endif
|
||||
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -193,18 +205,16 @@ void SMESHGUI_GroupOpDlg::Init( SALOME_Selection* theSelection )
|
||||
bool SMESHGUI_GroupOpDlg::isValid()
|
||||
{
|
||||
// Verify validity of group name
|
||||
if ( myNameEdit->text() == "" )
|
||||
{
|
||||
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_INSUFFICIENT_DATA" ), tr( "EMPTY_NAME" ), QMessageBox::Ok );
|
||||
if (myNameEdit->text() == "") {
|
||||
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
||||
tr("EMPTY_NAME"), QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verufy wheter arguments speciffiyed
|
||||
if ( myGroup1->_is_nil() || myGroup2->_is_nil() )
|
||||
{
|
||||
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_INSUFFICIENT_DATA" ), tr( "INCORRECT_ARGUMENTS" ), QMessageBox::Ok );
|
||||
if (myGroup1->_is_nil() || myGroup2->_is_nil()) {
|
||||
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
||||
tr("INCORRECT_ARGUMENTS"), QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -215,22 +225,19 @@ bool SMESHGUI_GroupOpDlg::isValid()
|
||||
int aMeshId1 = !aMesh1->_is_nil() ? aMesh1->GetId() : -1;
|
||||
int aMeshId2 = !aMesh2->_is_nil() ? aMesh2->GetId() : -1;
|
||||
|
||||
if ( aMeshId1 != aMeshId2 || aMeshId1 == -1 )
|
||||
{
|
||||
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_MESHES" ), QMessageBox::Ok );
|
||||
if (aMeshId1 != aMeshId2 || aMeshId1 == -1) {
|
||||
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
||||
tr("DIFF_MESHES"), QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify whether groups have same types of entities
|
||||
if ( myGroup1->GetType() != myGroup2->GetType() )
|
||||
{
|
||||
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_INSUFFICIENT_DATA" ), tr( "DIFF_TYPES" ), QMessageBox::Ok );
|
||||
if (myGroup1->GetType() != myGroup2->GetType()) {
|
||||
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
||||
tr("DIFF_TYPES"), QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -240,27 +247,24 @@ bool SMESHGUI_GroupOpDlg::isValid()
|
||||
//=======================================================================
|
||||
bool SMESHGUI_GroupOpDlg::onApply()
|
||||
{
|
||||
if ( !isValid() || SMESHGUI::GetSMESHGUI()->ActiveStudyLocked() )
|
||||
if (!isValid() || SMESHGUI::GetSMESHGUI()->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
|
||||
QString aName = myNameEdit->text();
|
||||
SMESH::SMESH_Group_ptr aNewGrp = SMESH::SMESH_Group::_nil();
|
||||
|
||||
if ( myMode == UNION ) aNewGrp = aMesh->UnionGroups( myGroup1, myGroup2, aName.latin1() );
|
||||
else if ( myMode == INTERSECT ) aNewGrp = aMesh->IntersectGroups( myGroup1, myGroup2, aName.latin1() );
|
||||
else aNewGrp = aMesh->CutGroups( myGroup1, myGroup2, aName.latin1() );
|
||||
if (myMode == UNION) aNewGrp = aMesh->UnionGroups(myGroup1, myGroup2, aName.latin1());
|
||||
else if (myMode == INTERSECT) aNewGrp = aMesh->IntersectGroups(myGroup1, myGroup2, aName.latin1());
|
||||
else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1());
|
||||
|
||||
if ( !aNewGrp->_is_nil() )
|
||||
{
|
||||
SMESHGUI::GetSMESHGUI()->GetActiveStudy()->updateObjBrowser( true );
|
||||
if (!aNewGrp->_is_nil()) {
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical( SMESHGUI::GetSMESHGUI()->GetDesktop(),
|
||||
tr( "SMESH_ERROR" ), tr( "SMESH_OPERATION_FAILED" ), "OK" );
|
||||
} else {
|
||||
QMessageBox::critical(SMESHGUI::desktop(), tr("SMESH_ERROR"),
|
||||
tr("SMESH_OPERATION_FAILED"), "OK");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -271,7 +275,7 @@ bool SMESHGUI_GroupOpDlg::onApply()
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::onOk()
|
||||
{
|
||||
if ( onApply() )
|
||||
if (onApply())
|
||||
onClose();
|
||||
}
|
||||
|
||||
@ -281,11 +285,11 @@ void SMESHGUI_GroupOpDlg::onOk()
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::onClose()
|
||||
{
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
|
||||
SMESHGUI::GetSMESHGUI()->ResetState();
|
||||
mySelection->ClearFilters();
|
||||
mySelectionMgr->clearFilters();
|
||||
reject();
|
||||
}
|
||||
|
||||
@ -295,23 +299,26 @@ void SMESHGUI_GroupOpDlg::onClose()
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::onSelectionDone()
|
||||
{
|
||||
if ( myFocusWg == myEdit1 )
|
||||
if (myFocusWg == myEdit1)
|
||||
myGroup1 = SMESH::SMESH_GroupBase::_nil();
|
||||
else
|
||||
myGroup2 = SMESH::SMESH_GroupBase::_nil();
|
||||
|
||||
myFocusWg->setText( "" );
|
||||
myFocusWg->setText("");
|
||||
|
||||
if ( mySelection->IObjectCount() == 1 )
|
||||
{
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList);
|
||||
|
||||
if (aList.Extent() == 1) {
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( mySelection->firstIObject() );
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First());
|
||||
|
||||
if ( !aGroup->_is_nil() )
|
||||
if (!aGroup->_is_nil())
|
||||
{
|
||||
myFocusWg->setText( aGroup->GetName() );
|
||||
myFocusWg->setText(aGroup->GetName());
|
||||
myFocusWg->setCursorPosition( 0 );
|
||||
|
||||
if ( myFocusWg == myEdit1 )
|
||||
if (myFocusWg == myEdit1)
|
||||
myGroup1 = aGroup;
|
||||
else
|
||||
myGroup2 = aGroup;
|
||||
@ -325,30 +332,33 @@ void SMESHGUI_GroupOpDlg::onSelectionDone()
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::onDeactivate()
|
||||
{
|
||||
setEnabled( false );
|
||||
mySelection->ClearFilters();
|
||||
setEnabled(false);
|
||||
mySelectionMgr->clearFilters();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupOpDlg::enterEvent
|
||||
// Purpose : Event filter
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::enterEvent( QEvent* )
|
||||
void SMESHGUI_GroupOpDlg::enterEvent (QEvent*)
|
||||
{
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog() ;
|
||||
setEnabled( true );
|
||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
|
||||
mySelection->AddFilter( new SMESH_TypeFilter( GROUP ) );
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
||||
setEnabled(true);
|
||||
#ifdef NEW_GUI
|
||||
mySelectionMgr->setSelectionModes(ActorSelection, true);
|
||||
#else
|
||||
mySelectionMgr->setSelectionModes(ActorSelection);
|
||||
#endif
|
||||
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupOpDlg::closeEvent( QCloseEvent* )
|
||||
//=======================================================================
|
||||
// name : SMESHGUI_GroupOpDlg::closeEvent
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::closeEvent (QCloseEvent*)
|
||||
{
|
||||
onClose() ;
|
||||
onClose();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -368,34 +378,9 @@ void SMESHGUI_GroupOpDlg::onFocusChanged()
|
||||
//=======================================================================
|
||||
void SMESHGUI_GroupOpDlg::reset()
|
||||
{
|
||||
myNameEdit->setText( "" );
|
||||
myEdit1->setText( "" );
|
||||
myEdit2->setText( "" );
|
||||
myNameEdit->setText("");
|
||||
myEdit1->setText("");
|
||||
myEdit2->setText("");
|
||||
myFocusWg = myEdit1;
|
||||
myNameEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ class QCloseEvent;
|
||||
class QLabel;
|
||||
class QFrame;
|
||||
class QPushButton;
|
||||
class SALOME_Selection;
|
||||
class SalomeApp_SelectionMgr;
|
||||
class QLineEdit;
|
||||
|
||||
/*
|
||||
@ -52,10 +52,10 @@ public:
|
||||
enum { UNION, INTERSECT, CUT };
|
||||
|
||||
public:
|
||||
SMESHGUI_GroupOpDlg( QWidget*, SALOME_Selection*, const int );
|
||||
SMESHGUI_GroupOpDlg( QWidget*, SalomeApp_SelectionMgr*, const int );
|
||||
virtual ~SMESHGUI_GroupOpDlg();
|
||||
|
||||
void Init( SALOME_Selection* ) ;
|
||||
void Init( SalomeApp_SelectionMgr* ) ;
|
||||
|
||||
private:
|
||||
|
||||
@ -91,7 +91,7 @@ private:
|
||||
QPushButton* myBtn1;
|
||||
QPushButton* myBtn2;
|
||||
|
||||
SALOME_Selection* mySelection;
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
int myMode;
|
||||
|
||||
QLineEdit* myFocusWg;
|
||||
@ -102,8 +102,3 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -18,12 +18,17 @@
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
|
||||
#include "QAD_Study.h"
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include "SMESHGUI_GroupUtils.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
#include "SalomeApp_Application.h"
|
||||
#include "SalomeApp_Tools.h"
|
||||
|
||||
#include "OB_Browser.h"
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
|
||||
@ -37,10 +42,12 @@ namespace SMESH
|
||||
aGroup = theMesh->CreateGroup( theType, theGroupName );
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
QtCatchCorbaException( S_ex );
|
||||
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||
}
|
||||
GetActiveStudy()->updateObjBrowser( true );
|
||||
//SalomeApp_Application* app =
|
||||
// dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
|
||||
//if (app) app->objectBrowser()->updateTree();
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
return aGroup._retn();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,33 +17,38 @@
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_XmlHandler.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
|
||||
#include "SUIT_Tools.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
#include "SUIT_Session.h"
|
||||
|
||||
#include "OB_Browser.h"
|
||||
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "SalomeApp_Tools.h"
|
||||
#include "SalomeApp_Application.h"
|
||||
|
||||
#include <SALOMEDSClient_Study.hxx>
|
||||
#include <SALOMEDSClient_SObject.hxx>
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "QAD.h"
|
||||
#include "QAD_Tools.h"
|
||||
#include "QAD_Config.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_MessageBox.h"
|
||||
#include "QAD_WaitCursor.h"
|
||||
#include "QAD_ResourceMgr.h"
|
||||
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
#include "SMESHGUI_Hypotheses.h"
|
||||
#include "SMESHGUI_XmlHandler.h"
|
||||
#include "SMESHGUI.h"
|
||||
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_SMESHGenUtils.h"
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
#else
|
||||
@ -61,12 +66,12 @@ namespace SMESH{
|
||||
typedef map<string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
|
||||
THypCreatorMap myHypCreatorMap;
|
||||
|
||||
void addMap( const THypothesisDataMap& theMap,
|
||||
void addMap(const THypothesisDataMap& theMap,
|
||||
THypothesisDataMap& toMap)
|
||||
{
|
||||
THypothesisDataMap::const_iterator it;
|
||||
for ( it = theMap.begin(); it != theMap.end(); it++ )
|
||||
toMap.insert( *it );
|
||||
for (it = theMap.begin(); it != theMap.end(); it++)
|
||||
toMap.insert(*it);
|
||||
}
|
||||
|
||||
|
||||
@ -74,45 +79,45 @@ namespace SMESH{
|
||||
SMESH::SMESH_Hypothesis_ptr theHyp,
|
||||
const bool theIsAddition)
|
||||
{
|
||||
if ( theHypStatus > SMESH::HYP_OK ) {
|
||||
if (theHypStatus > SMESH::HYP_OK) {
|
||||
|
||||
// get Hyp name
|
||||
QString aHypName ("NULL Hypothesis");
|
||||
if ( !CORBA::is_nil( theHyp )) {
|
||||
SALOMEDS::SObject_var Shyp = SMESH::FindSObject( theHyp );
|
||||
if ( !CORBA::is_nil( Shyp ))
|
||||
if (!CORBA::is_nil(theHyp)) {
|
||||
_PTR(SObject) Shyp = SMESH::FindSObject(theHyp);
|
||||
if (Shyp)
|
||||
// name in study
|
||||
aHypName = Shyp->GetName();
|
||||
aHypName = Shyp->GetName().c_str();
|
||||
else
|
||||
// label in xml file
|
||||
aHypName = GetHypothesisData( theHyp->GetName() )->Label;
|
||||
aHypName = GetHypothesisData(theHyp->GetName())->Label;
|
||||
}
|
||||
|
||||
// message
|
||||
bool isFatal = ( theHypStatus >= SMESH::HYP_UNKNOWN_FATAL );
|
||||
bool isFatal = (theHypStatus >= SMESH::HYP_UNKNOWN_FATAL);
|
||||
QString aMsg;
|
||||
if ( theIsAddition )
|
||||
aMsg = ( isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
|
||||
if (theIsAddition)
|
||||
aMsg = (isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
|
||||
else
|
||||
aMsg = ( isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
|
||||
aMsg = (isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
|
||||
|
||||
aMsg = QObject::tr( aMsg ).arg( aHypName ) +
|
||||
QObject::tr( QString( "SMESH_HYP_%1" ).arg( theHypStatus ));
|
||||
aMsg = QObject::tr(aMsg).arg(aHypName) +
|
||||
QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus));
|
||||
|
||||
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
|
||||
QObject::tr( "SMESH_WRN_WARNING" ),
|
||||
SUIT_MessageBox::warn1(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
aMsg,
|
||||
QObject::tr( "SMESH_BUT_OK" ));
|
||||
QObject::tr("SMESH_BUT_OK"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InitAvailableHypotheses()
|
||||
{
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) {
|
||||
// Resource manager
|
||||
QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager();
|
||||
SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
|
||||
if (!resMgr) return;
|
||||
|
||||
// Find name of a resource XML file ("SMESH_Meshers.xml");
|
||||
@ -121,10 +126,10 @@ namespace SMESH{
|
||||
if (cenv)
|
||||
HypsXml.sprintf("%s", cenv);
|
||||
|
||||
QStringList HypsXmlList = QStringList::split( ":", HypsXml, false );
|
||||
QStringList HypsXmlList = QStringList::split(":", HypsXml, false);
|
||||
if (HypsXmlList.count() == 0)
|
||||
{
|
||||
QAD_MessageBox::error1(QAD_Application::getDesktop(),
|
||||
SUIT_MessageBox::error1(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("MESHERS_FILE_NO_VARIABLE"),
|
||||
QObject::tr("SMESH_BUT_OK"));
|
||||
@ -133,14 +138,14 @@ namespace SMESH{
|
||||
|
||||
// loop on files in HypsXml
|
||||
QString aNoAccessFiles;
|
||||
for ( int i = 0; i < HypsXmlList.count(); i++ ) {
|
||||
for (int i = 0; i < HypsXmlList.count(); i++) {
|
||||
QString HypsXml = HypsXmlList[ i ];
|
||||
|
||||
// Find full path to the resource XML file
|
||||
QString xmlFile = HypsXml + ".xml";
|
||||
xmlFile = QAD_Tools::addSlash(resMgr->findFile(xmlFile, HypsXml)) + xmlFile;
|
||||
xmlFile = resMgr->path("resources", "SMESH", xmlFile);
|
||||
|
||||
QFile file (QAD_Tools::unix2win(xmlFile));
|
||||
QFile file (xmlFile);
|
||||
if (file.exists() && file.open(IO_ReadOnly)) {
|
||||
file.close();
|
||||
|
||||
@ -154,11 +159,11 @@ namespace SMESH{
|
||||
bool ok = reader.parse(source);
|
||||
file.close();
|
||||
if (ok) {
|
||||
addMap( aXmlHandler->myHypothesesMap, myHypothesesMap );
|
||||
addMap( aXmlHandler->myAlgorithmsMap, myAlgorithmsMap );
|
||||
addMap(aXmlHandler->myHypothesesMap, myHypothesesMap);
|
||||
addMap(aXmlHandler->myAlgorithmsMap, myAlgorithmsMap);
|
||||
}
|
||||
else {
|
||||
QAD_MessageBox::error1(QAD_Application::getDesktop(),
|
||||
SUIT_MessageBox::error1(SMESHGUI::desktop(),
|
||||
QObject::tr("INF_PARSE_ERROR"),
|
||||
QObject::tr(aXmlHandler->errorProtocol()),
|
||||
QObject::tr("SMESH_BUT_OK"));
|
||||
@ -176,12 +181,12 @@ namespace SMESH{
|
||||
if (!aNoAccessFiles.isEmpty()) {
|
||||
QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
|
||||
aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
|
||||
wc.stop();
|
||||
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
|
||||
wc.suspend();
|
||||
SUIT_MessageBox::warn1(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
aMess,
|
||||
QObject::tr("SMESH_BUT_OK"));
|
||||
wc.start();
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,7 +275,7 @@ namespace SMESH{
|
||||
typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
|
||||
(QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
|
||||
GetHypothesisCreator procHandle =
|
||||
(GetHypothesisCreator)dlsym( libHandle, "GetHypothesisCreator" );
|
||||
(GetHypothesisCreator)dlsym(libHandle, "GetHypothesisCreator");
|
||||
if (!procHandle) {
|
||||
if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
|
||||
dlclose(libHandle);
|
||||
@ -290,7 +295,7 @@ namespace SMESH{
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,19 +315,24 @@ namespace SMESH{
|
||||
QString aServLib = aHypData->ServerLibName;
|
||||
|
||||
try {
|
||||
Hyp = SMESH::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
|
||||
Hyp = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType, aServLib);
|
||||
if (!Hyp->_is_nil()) {
|
||||
SALOMEDS::SObject_var SHyp = SMESH::FindSObject(Hyp.in());
|
||||
if (!SHyp->_is_nil()) {
|
||||
if ( strcmp(aHypName,"") != 0 )
|
||||
SMESH::SetName( SHyp, aHypName );
|
||||
GetActiveStudy()->updateObjBrowser(true);
|
||||
_PTR(SObject) SHyp = SMESH::FindSObject(Hyp.in());
|
||||
if (SHyp) {
|
||||
//if (strcmp(aHypName,"") != 0)
|
||||
if (strlen(aHypName) > 0)
|
||||
SMESH::SetName(SHyp, aHypName);
|
||||
//SalomeApp_Application* app =
|
||||
// dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
|
||||
//if (app)
|
||||
// app->objectBrowser()->updateTree();
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
return Hyp._retn();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception & S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
}
|
||||
|
||||
return SMESH::SMESH_Hypothesis::_nil();
|
||||
@ -333,28 +343,28 @@ namespace SMESH{
|
||||
{
|
||||
if(MYDEBUG) MESSAGE ("SMESHGUI::AddHypothesisOnMesh");
|
||||
int res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
if ( !aMesh->_is_nil() ) {
|
||||
SALOMEDS::SObject_var SM = SMESH::FindSObject( aMesh );
|
||||
if (!aMesh->_is_nil()) {
|
||||
_PTR(SObject) SM = SMESH::FindSObject(aMesh);
|
||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
|
||||
try {
|
||||
res = aMesh->AddHypothesis( aShapeObject, aHyp );
|
||||
if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
|
||||
SALOMEDS::SObject_var SH = SMESH::FindSObject(aHyp);
|
||||
if ( !SM->_is_nil() && !SH->_is_nil() ) {
|
||||
res = aMesh->AddHypothesis(aShapeObject, aHyp);
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) SH = SMESH::FindSObject(aHyp);
|
||||
if (SM && SH) {
|
||||
SMESH::ModifiedMesh(SM, false);
|
||||
}
|
||||
}
|
||||
if ( res > SMESH::HYP_OK ) {
|
||||
wc.stop();
|
||||
processHypothesisStatus( res, aHyp, true );
|
||||
wc.start();
|
||||
if (res > SMESH::HYP_OK) {
|
||||
wc.suspend();
|
||||
processHypothesisStatus(res, aHyp, true);
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
wc.stop();
|
||||
QtCatchCorbaException( S_ex );
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
wc.suspend();
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
}
|
||||
@ -364,44 +374,44 @@ namespace SMESH{
|
||||
|
||||
bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
|
||||
{
|
||||
if(MYDEBUG) MESSAGE( "SMESHGUI::AddHypothesisOnSubMesh() ");
|
||||
if(MYDEBUG) MESSAGE("SMESHGUI::AddHypothesisOnSubMesh() ");
|
||||
int res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
if ( !aSubMesh->_is_nil() && ! aHyp->_is_nil() ) {
|
||||
if (!aSubMesh->_is_nil() && ! aHyp->_is_nil()) {
|
||||
try {
|
||||
SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
|
||||
SALOMEDS::SObject_var SsubM = SMESH::FindSObject( aSubMesh );
|
||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SsubM );
|
||||
if ( !aMesh->_is_nil() && !SsubM->_is_nil() && !aShapeObject->_is_nil() ) {
|
||||
res = aMesh->AddHypothesis( aShapeObject, aHyp );
|
||||
if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
|
||||
SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
|
||||
if ( !meshSO->_is_nil() )
|
||||
SMESH::ModifiedMesh( meshSO, false );
|
||||
_PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
|
||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SsubM);
|
||||
if (!aMesh->_is_nil() && SsubM && !aShapeObject->_is_nil()) {
|
||||
res = aMesh->AddHypothesis(aShapeObject, aHyp);
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
|
||||
if (meshSO)
|
||||
SMESH::ModifiedMesh(meshSO, false);
|
||||
}
|
||||
if ( res > SMESH::HYP_OK ) {
|
||||
wc.stop();
|
||||
processHypothesisStatus( res, aHyp, true );
|
||||
wc.start();
|
||||
if (res > SMESH::HYP_OK) {
|
||||
wc.suspend();
|
||||
processHypothesisStatus(res, aHyp, true);
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
else {
|
||||
SCRUTE( aHyp->_is_nil() );
|
||||
SCRUTE( aMesh->_is_nil() );
|
||||
SCRUTE( SsubM->_is_nil() );
|
||||
SCRUTE( aShapeObject->_is_nil() );
|
||||
SCRUTE(aHyp->_is_nil());
|
||||
SCRUTE(aMesh->_is_nil());
|
||||
SCRUTE(!SsubM);
|
||||
SCRUTE(aShapeObject->_is_nil());
|
||||
}
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
wc.stop();
|
||||
QtCatchCorbaException( S_ex );
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
wc.suspend();
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SCRUTE( aSubMesh->_is_nil() );
|
||||
SCRUTE( aHyp->_is_nil() );
|
||||
SCRUTE(aSubMesh->_is_nil());
|
||||
SCRUTE(aHyp->_is_nil());
|
||||
}
|
||||
return res < SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
@ -409,16 +419,16 @@ namespace SMESH{
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject)
|
||||
{
|
||||
int res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
if (IObject->hasReference()) {
|
||||
try {
|
||||
SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
|
||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||
SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(IObject);
|
||||
SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
|
||||
if (!aHypSObj->_is_nil()) {
|
||||
SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
|
||||
if (!MorSM->_is_nil()) {
|
||||
_PTR(SObject) aHypSObj = aStudy->FindObjectID(IObject->getReference());
|
||||
if (aHypSObj) {
|
||||
_PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
|
||||
if (MorSM) {
|
||||
GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
|
||||
if (!aShape->_is_nil()){
|
||||
SMESH::SMESH_Mesh_var aMesh =
|
||||
@ -431,24 +441,24 @@ namespace SMESH{
|
||||
|
||||
if (!aMesh->_is_nil()) {
|
||||
res = aMesh->RemoveHypothesis(aShape, anHyp);
|
||||
if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
|
||||
SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
|
||||
if ( !meshSO->_is_nil() )
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
|
||||
if (meshSO)
|
||||
SMESH::ModifiedMesh(meshSO, false);
|
||||
}
|
||||
if ( res > SMESH::HYP_OK ) {
|
||||
wc.stop();
|
||||
processHypothesisStatus( res, anHyp, false );
|
||||
wc.start();
|
||||
if (res > SMESH::HYP_OK) {
|
||||
wc.suspend();
|
||||
processHypothesisStatus(res, anHyp, false);
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
wc.stop();
|
||||
QtCatchCorbaException( S_ex );
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
wc.suspend();
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
}
|
||||
@ -458,70 +468,70 @@ namespace SMESH{
|
||||
return res < SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp)
|
||||
{
|
||||
SALOMEDS::SObject_var AHR, aRef;
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
int res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
QAD_WaitCursor wc;
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
if (!MorSM->_is_nil()) {
|
||||
if (MorSM) {
|
||||
try {
|
||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
|
||||
if (!aShapeObject->_is_nil()) {
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
|
||||
|
||||
if ( !aSubMesh->_is_nil() )
|
||||
if (!aSubMesh->_is_nil())
|
||||
aMesh = aSubMesh->GetFather();
|
||||
|
||||
if (!aMesh->_is_nil()) {
|
||||
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
|
||||
if ( res < SMESH::HYP_UNKNOWN_FATAL ) {
|
||||
SALOMEDS::SObject_var meshSO = SMESH::FindSObject( aMesh );
|
||||
if ( !meshSO->_is_nil() )
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
|
||||
if (meshSO)
|
||||
SMESH::ModifiedMesh(meshSO, false);
|
||||
}
|
||||
if ( res > SMESH::HYP_OK ) {
|
||||
wc.stop();
|
||||
processHypothesisStatus( res, anHyp, false );
|
||||
wc.start();
|
||||
if (res > SMESH::HYP_OK) {
|
||||
wc.suspend();
|
||||
processHypothesisStatus(res, anHyp, false);
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch( const SALOME::SALOME_Exception& S_ex ) {
|
||||
wc.stop();
|
||||
QtCatchCorbaException( S_ex );
|
||||
} catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
wc.suspend();
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
res = SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
}
|
||||
return res < SMESH::HYP_UNKNOWN_FATAL;
|
||||
}
|
||||
|
||||
SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp )
|
||||
SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp)
|
||||
{
|
||||
SALOMEDS::Study::ListOfSObject_var listSOmesh =
|
||||
new SALOMEDS::Study::ListOfSObject;
|
||||
listSOmesh->length(0);
|
||||
SObjectList listSOmesh;
|
||||
listSOmesh.resize(0);
|
||||
|
||||
unsigned int index = 0;
|
||||
if (!AlgoOrHyp->_is_nil()) {
|
||||
SALOMEDS::SObject_var SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
|
||||
if (!SO_Hypothesis->_is_nil()) {
|
||||
SALOMEDS::Study::ListOfSObject_var listSO =
|
||||
GetActiveStudyDocument()->FindDependances(SO_Hypothesis);
|
||||
if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO->length());
|
||||
for (unsigned int i = 0; i < listSO->length(); i++) {
|
||||
SALOMEDS::SObject_ptr SO = listSO[i];
|
||||
if (!SO->_is_nil()) {
|
||||
SALOMEDS::SObject_var aFather = SO->GetFather();
|
||||
if (!aFather->_is_nil()) {
|
||||
SALOMEDS::SObject_var SOfatherFather = aFather->GetFather();
|
||||
if (!SOfatherFather->_is_nil()) {
|
||||
_PTR(SObject) SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
|
||||
if (SO_Hypothesis) {
|
||||
SObjectList listSO =
|
||||
SMESHGUI::activeStudy()->studyDS()->FindDependances(SO_Hypothesis);
|
||||
|
||||
if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
|
||||
for (unsigned int i = 0; i < listSO.size(); i++) {
|
||||
_PTR(SObject) SO = listSO[i];
|
||||
if (!SO) {
|
||||
_PTR(SObject) aFather = SO->GetFather();
|
||||
if (aFather) {
|
||||
_PTR(SObject) SOfatherFather = aFather->GetFather();
|
||||
if (SOfatherFather) {
|
||||
if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
|
||||
index++;
|
||||
listSOmesh->length(index);
|
||||
listSOmesh.resize(index);
|
||||
listSOmesh[index - 1] = SOfatherFather;
|
||||
}
|
||||
}
|
||||
@ -529,8 +539,7 @@ namespace SMESH{
|
||||
}
|
||||
}
|
||||
}
|
||||
if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
|
||||
return listSOmesh._retn();
|
||||
if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
|
||||
return listSOmesh;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,14 +32,18 @@
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "SALOMEDSClient_definitions.hxx"
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
#include <vector>
|
||||
|
||||
class HypothesisData;
|
||||
class SMESHGUI_GenericHypothesisCreator;
|
||||
class SALOMEDSClient_SObject;
|
||||
|
||||
namespace SMESH{
|
||||
|
||||
@ -61,10 +65,11 @@ namespace SMESH{
|
||||
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh(const Handle(SALOME_InteractiveObject)& IObject);
|
||||
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh(SALOMEDS::SObject_ptr MorSM,
|
||||
bool RemoveHypothesisOrAlgorithmOnMesh(_PTR(SObject) MorSM,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp);
|
||||
|
||||
SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
|
||||
typedef std::vector<_PTR(SObject)> SObjectList;
|
||||
SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
|
||||
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user