Merge from BR_V5_IMP_P8

This commit is contained in:
eap 2009-01-22 13:43:10 +00:00
parent 8e93201bcf
commit e7e45ad8cb
187 changed files with 9634 additions and 1101 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -6,6 +6,7 @@
<ul>
<li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
<li>\ref average_length_anchor "Average Length"</li>
<li>\ref max_length_anchor "Max Size"</li>
<li>\ref deflection_1d_anchor "Deflection 1D"</li>
<li>\ref number_of_segments_anchor "Number of segments"</li>
<li>\ref start_and_end_length_anchor "Start and end length"</li>
@ -77,6 +78,21 @@ integer. Default value is 1e-07.
\ref tui_average_length "Defining Average Length" hypothesis
operation.
<br>\anchor max_length_anchor
<h2>Max Size</h2>
<b>Max Size</b> hypothesis allows splitting geometrical edges into
segments not longer than the given length. Definition of this hypothesis
consists of setting the maximal allowed \b length of segments.
<b>Use preestimated length</b> check box lets you specify \b length
automatically calculated basing on size of your geometrical object,
namely as diagonal of bounding box divided by ten. The divider can be
changed via "Segmentation of diagonal of boundary box of geometry"
preference parameter.
<b>Use preestimated length</b> check box is enabled only if the
geometrical object has been selected before hypothesis definition.
\image html a-maxsize1d.png
<br>
\anchor number_of_segments_anchor
<h2>Number of segments hypothesis</h2>

View File

@ -18,6 +18,7 @@ them, you operate numerical values):
<ul>
<li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
<li>\ref average_length_anchor "Average Length"</li>
<li>\ref max_length_anchor "Max Size"</li>
<li>\ref deflection_1d_anchor "Deflection 1D"</li>
<li>\ref number_of_segments_anchor "Number of segments"</li>
<li>\ref start_and_end_length_anchor "Start and end length"</li>

View File

@ -13,7 +13,12 @@ the meshing elements and these calculated values is shown with the
help of a scalar bar, which is displayed near the presentation of your
mesh.
There are 1D, 2D and 3D quality controls.
There are 0D, 1D, 2D and 3D quality controls.
0D mesh quality controls:
<ul>
<li>\ref free_nodes_page "Free nodes"</li>
</ul>
1D mesh quality controls:
<ul>
@ -39,6 +44,7 @@ There are 1D, 2D and 3D quality controls.
<ul>
<li>\subpage aspect_ratio_3d_page "Aspect ratio 3D"</li>
<li>\subpage volume_page "Volume"</li>
<li>\subpage free_faces_page "Free faces"</li>
</ul>
*/
*/

View File

@ -92,4 +92,58 @@ selected in green.</center>
\ref tui_create_group_on_geometry "Create a Group on Geometry"
operation.
<br><h2>Creation of groups using existing groups and sub-meshes.</h2>
Application provides possibility to create new <b>standalone</b> groups using existing standalone groups, groups on geometry and sub-meshes. This functionality is implemented using "Select from" group box of "Create group" dialog box described above.
This functionality is described on the example of creating new group from existing standalone groups and groups on geometry.
Imagine there are group G1. It can be standalone group or group on geometry.
To create group G2 containing all entities of group G1 and a faces graphically selected in 3D view following steps can be performed:
<ul>
<li>User opens "Create group" dialog box.</li>
<li>The user specifies "Face" type of entities and "G2" name of group.</li>
<li>The user checks "Group" check-box of "Select From" group box.</li>
<li>The user selects G1 group in object browser or 3D view.</li>
<li>The user presses "Add" push button of "Content" group box. "Id Elements" list-box is filled with identifiers of faces belonging to group G1.</li>
<li>The user selects other faces in 3D view.</li>
<li>The user presses "Apply" button. System creates group G2.</li>
</ul>
Please note that group G2 does not have a references to source group G1. It contains list of faces identifiers only. So if G1 group will be changed group G2 will remain unmodified.
<br>
\anchor gui_create_dim_group
<h2>Creating groups of entities from existing groups of superior dimensions</h2>
Application provides possibility for creating groups of entities from existing groups of superior dimensions. For example, it is possible to create group of nodes using list of existing groups of faces.
To create groups of entities from existing groups of superior dimensions, in the \b Mesh menu select <b>Group of underlying entities</b>.<br>
The following dialog box will appear:
\image html dimgroup_dlg.png
In this dialog box you should specify the name of the resulting group, types of entities and set of source groups.
For example, we have two source Volume groups illustrated on the figure below
\image html dimgroup_src.png
<center>Source groups</center>
In this case we obtain following results for Faces, Edges and Nodes.
\image html dimgroup_2d.png
<center>Faces</center>
\image html dimgroup_1d.png
<center>Edges</center>
\image html dimgroup_0d.png
<center>Nodes</center>
<b>See Also</b> a sample TUI Script of a
\ref tui_create_dim_group "Creating groups of entities from existing groups of superior dimensions"
operation.
*/

View File

@ -21,7 +21,21 @@ remove the elements forming it. For more information see
group.</li>
</ol>
\n <em>To convert an existing group on geometry into standalone group
of elements and modify:</em>
<ol>
<li>Select your group on geometry in the Object Browser and in the \b Mesh menu click
the <b>Edit Group as Standalone</b> item.</li>
\image html image74.gif
<center><em>"Edit Group as Standalone" button</em></center>
The group on geometry will be converted into standalone group and can
be modified as group of elements
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
<br><b>See Also</b> a sample TUI Script of an
\ref tui_edit_group "Edit Group" operation.
*/
*/

View File

@ -29,6 +29,7 @@ The following dialog box will appear:
<li>specify the IDs of the elements which will be extruded by
selecting them in the 3D viewer or select the whole mesh or
submesh,</li>
<li>specify the distance at which the elements will be extruded,</li>
<li>specify the vector along which the elements will be extruded,</li>
<li>number of steps.</li>
</ul>

View File

@ -0,0 +1,17 @@
/*!
\page free_faces_page Free faces
\n This mesh quality control highlights faces which are connected
less than to two mesh volume elements. Free faces are shown with a color differs from
the color of shared faces.
\image html free_faces.png
<center>In this picture some volume mesh element are removed as
a result some faces become connected only to one
volume. i.e. become free.
<br><b>See Also</b> a sample TUI Script of a
\ref tui_free_faces "Free Faces quality control" operation.
*/

View File

@ -0,0 +1,16 @@
/*!
\page free_nodes_page Free nodes
\n This mesh quality control highlights nodes which are not connected
to any mesh element. Free nodes are shown with a color differs from
the color of nodes.
\image html free_nodes.png
<center>In this picture some nodes don't connected to a mesh element as
a result of deleting elements and adding several isolated nodes.
<br><b>See Also</b> a sample TUI Script of a
\ref tui_free_nodes "Free Nodes quality control" operation.
*/

View File

@ -23,4 +23,4 @@ Almost all mesh module functionalities are accessible via
\image html image7.jpg "Example of MESH module usage for engineering tasks"
*/
*/

View File

@ -0,0 +1,36 @@
/*!
\page preview_meshes_page Preview and Compute meshes
Before whole mesh computation it is allowed to see the mesh preview.
When mesh object is already created and all hypotheses assigned,
select your mesh in the <b>Object Browser</b>. From the
\b Mesh menu select \b Preview or click "Preview" button of the
toolbar or activate "Preview" item from pop-up menu.
\image html mesh_precompute.png
<center><em>"Preview" button</em></center>
The Mesh Preview dialog box appears. In this dialog box you can select
preview mode <b>1D mesh</b> or <b>2D mesh</b> depending on assigned
hypotheses to mesh.
The 1D mesh preview shows as nodes computed on geometry edges
\image html preview_mesh_1D.png
The 2D mesh preview shows edge mesh elements, computed on geometry faces
\image html preview_mesh_2D.png
Pressing <b>Compute</b> button leads to whole mesh computation
process.
During exit from Preview dialog box, the question about storage temporary
created mesh elements appers:
\image html preview_tmp_data.png
Note, that computed temporary mesh elements can be reused during next
mesh computation process.
*/

View File

@ -123,8 +123,8 @@ salome.sg.updateObjBrowser(1)
\image html editing_groups2.png
<br>
\anchor tui_union_of_two_groups
<h2>Union of two groups</h2>
\anchor tui_union_of_groups
<h2>Union of groups</h2>
\code
import SMESH_mechanic
@ -141,7 +141,7 @@ anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len( anIds )
# create a group by adding elements with area > 20
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
aGroup1.Add(anIds)
# Criterion : AREA = 20
@ -157,8 +157,9 @@ aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
aGroup2.Add(anIds)
# create union group : area >= 20
aGroup3 = mesh.UnionGroups(aGroup1, aGroup2, "Area >= 20")
aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
# Please note that also there is UnionGroups() method which works with two groups only
# Criterion : AREA < 20
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
@ -172,7 +173,7 @@ aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
aGroup4.Add(anIds)
# create union group : area >= 20 and area < 20
aGroup5 = mesh.UnionGroups(aGroup3, aGroup4, "Any Area")
aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
salome.sg.updateObjBrowser(1)
@ -185,8 +186,8 @@ salome.sg.updateObjBrowser(1)
\image html union_groups3.png
<br>
\anchor tui_intersection_of_two_groups
<h2>Intersection of two groups</h2>
\anchor tui_intersection_of_groups
<h2>Intersection of groups</h2>
\code
import SMESH_mechanic
@ -203,7 +204,7 @@ anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds)
# create a group by adding elements with area > 20
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
aGroup1.Add(anIds)
# Criterion : AREA < 60
@ -214,12 +215,13 @@ anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds)
# create a group by adding elements with area < 60
aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
aGroup2.Add(anIds)
# create an intersection of groups : 20 < area < 60
aGroup3 = mesh.IntersectGroups(aGroup1, aGroup2, "20 < Area < 60")
aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
# Please note that also there is IntersectGroups() method which works with two groups only
salome.sg.updateObjBrowser(1)
\endcode
@ -231,8 +233,8 @@ salome.sg.updateObjBrowser(1)
\image html intersect_groups3.png
<br>
\anchor tui_cut_of_two_groups
<h2>Cut of two groups</h2>
\anchor tui_cut_of_groups
<h2>Cut of groups</h2>
\code
import SMESH_mechanic
@ -264,6 +266,7 @@ aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
# create a cut of groups : area >= 60
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
salome.sg.updateObjBrowser(1)
\endcode
@ -274,4 +277,54 @@ salome.sg.updateObjBrowser(1)
\image html cut_groups3.png
<br>
\anchor tui_create_dim_group
<h2>Creating groups of entities from existing groups of superior dimensions</h2>
\code
import SMESH_mechanic
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 100
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 100, Nb = ", len(anIds)
# create a group by adding elements with area > 100
aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
# Criterion : AREA < 30
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 30, Nb = ", len(anIds)
# create a group by adding elements with area < 30
aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
# Create group of edges using source groups of faces
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
# Create group of nodes using source groups of faces
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
salome.sg.updateObjBrowser(1)
\endcode
\image html dimgroup_tui1.png
<center>Source groups of faces<\center>
\image html dimgroup_tui2.png
<center>Result groups of edges and nodes<\center>
*/

View File

@ -189,6 +189,140 @@ for i in range(len(aBorders)):
salome.sg.updateObjBrowser(1)
\endcode
<br>
\anchor tui_free_nodes
<h2>Free Nodes</h2>
\code
import salome
import geompy
import smesh
# create box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
idbox = geompy.addToStudy(box, "box")
# create a mesh
mesh = smesh.Mesh(box, "Mesh_free_nodes")
algo = mesh.Segment()
algo.NumberOfSegments(10)
algo = mesh.Triangle(smesh.MEFISTO)
algo.MaxElementArea(150.)
mesh.Compute()
# Remove some elements to obtain free nodes
# Criterion : AREA < 80.
area_margin = 80.
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
mesh.RemoveElements(anIds)
# criterion : free nodes
aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
anNodeIds = mesh.GetIdsFromFilter(aFilter)
# create a group
aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
aGroup.Add(anNodeIds)
# print the result
print "Criterion: Free nodes Nb = ", len(anNodeIds)
j = 1
for i in range(len(anNodeIds)):
if j > 20: j = 1; print ""
print anNodeIds[i],
j = j + 1
pass
print ""
salome.sg.updateObjBrowser(1)
\endcode
<br>
\anchor tui_free_faces
<h2>Free Faces</h2>
\code
import salome
import geompy
####### GEOM part ########
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
Box_1 = geompy.GetMainShape(Box_1_vertex_6)
Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
Box_1 = geompy.GetMainShape(Box_1_vertex_16)
Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
Box_1 = geompy.GetMainShape(Box_1_vertex_11)
Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
geompy.addToStudy( Box_1, "Box_1" )
geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
geompy.addToStudy( Plane_1, "Plane_1" )
geompy.addToStudy( Partition_1, "Partition_1" )
geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
geompy.addToStudy( Plane_2, "Plane_2" )
###### SMESH part ######
import smesh
import StdMeshers
import NETGENPlugin
Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment()
Max_Size_1 = Regular_1D.MaxSize(34.641)
MEFISTO_2D = Mesh_1.Triangle()
Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN)
isDone = Mesh_1.Compute()
# create a group of free faces
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
aGroup.Add(aFaceIds)
# print the result
print "Criterion: Free nodes Nb = ", len(anNodeIds)
j = 1
for i in range(len(aFaceIds)):
if j > 20: j = 1; print ""
print anNodeIds[i],
j = j + 1
pass
print ""
#filter faces from plane 2
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup.Remove(aFaceIds)
# create a group of shared faces (located on partition boundary inside box)
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
aGroup.Add(aFaceIds)
salome.sg.updateObjBrowser(1)
\endcode
<br>
\anchor tui_length_2d
<h2>Length 2D</h2>
@ -572,4 +706,4 @@ aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
\endcode
*/
*/

View File

@ -13,13 +13,13 @@ belong to one and the same mesh.
<br>
\anchor union_anchor
<h2>Union of two groups</h2>
<h2>Union of groups</h2>
This operation allows to create a new group in such a way that all
mesh elements that are present in the initial groups will be added to
the new one.
<em>To union two groups:</em>
<em>To union groups:</em>
<ol>
<li>In the \b Mesh menu select the <b>Union Groups</b> item. The following
dialog box will appear:
@ -27,7 +27,7 @@ dialog box will appear:
\image html uniongroups.png
In this dialog box you should specify the name of the resulting group
and two groups which will be united.
and set of groups which will be united.
For example, we have two groups Group1 and Group2.
\n The result of their \b Union will be Group12:
@ -45,17 +45,17 @@ For example, we have two groups Group1 and Group2.
</ol>
<b>See Also</b> a sample TUI Script of a
\ref tui_union_of_two_groups "Union of two Groups" operation.
\ref tui_union_of_groups "Union of Groups" operation.
<br>
\anchor intersection_anchor
<h2>Intersection of two groups</h2>
<h2>Intersection of groups</h2>
This operation allows to create a new group in such a way that all
mesh elements that are present in both initial groups are added to the
mesh elements that are present in all initial groups together are added to the
new one.
<em>To intersect two groups:</em>
<em>To intersect groups:</em>
<ol>
<li>In the \b Mesh menu select the <b>Intersect Groups</b> item. The
following dialog box will appear:
@ -63,7 +63,7 @@ following dialog box will appear:
\image html intersectgroups.png
In this dialog box you should specify the name of the resulting group
and two groups which will be intersected.
and set of groups which will be intersected.
For example, we have two groups Group1 and Group2.
\n The result of their \b Intersection will be Group12a:
@ -81,17 +81,17 @@ For example, we have two groups Group1 and Group2.
</ol>
<b>See Also</b> a sample TUI Script of an
\ref tui_intersection_of_two_groups "Intersection of two Groups" operation.
\ref tui_intersection_of_groups "Intersection of Groups" operation.
<br>
\anchor cut_anchor
<h2>Cut of two groups</h2>
<h2>Cut of groups</h2>
This operation allows to create a new group in such a way that all
mesh elements that are present in the main group but are absent in the
tool group are added to the new one.
mesh elements that are present in the main groups but are absent in the
tool groups are added to the new one.
<em>To cut two groups:</em>
<em>To cut groups:</em>
<ol>
<li>In the \b Mesh menu select the <b>Cut Groups</b> item. The
following dialog box will appear:
@ -99,7 +99,7 @@ following dialog box will appear:
\image html cutgroups.png
In this dialog box you should specify the name of the resulting group
and two groups which will be cut.
and groups which will be cut.
For example, we have two groups Group1 and Group2.
\n The result of their \b Cut will be Group12b:
@ -118,6 +118,6 @@ group.</li>
</ol>
<b>See Also</b> a sample TUI Script of a
\ref tui_cut_of_two_groups "Cut of two Groups" operation.
\ref tui_cut_of_groups "Cut of Groups" operation.
*/

View File

@ -66,7 +66,8 @@ libSalomeIDLSMESH_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeIDLSMESH_la_LIBADD = \
@CORBA_LIBS@ \
$(MED_LDFLAGS) -lSalomeIDLMED \
$(GEOM_LDFLAGS) -lSalomeIDLGEOM
$(GEOM_LDFLAGS) -lSalomeIDLGEOM \
$(KERNEL_LDFLAGS) -lSalomeIDLKernel
# These variables defines the building process of CORBA files
OMNIORB_IDL = @OMNIORB_IDL@

View File

@ -72,6 +72,44 @@ module StdMeshers
double GetPrecision();
};
/*!
* StdMeshers_MaxLength: interface of "Max length" hypothesis
*/
interface StdMeshers_MaxLength : SMESH::SMESH_Hypothesis
{
/*!
* Sets <length> parameter value
*/
void SetLength(in double length)
raises (SALOME::SALOME_Exception);
/*!
* Returns <length> parameter value
*/
double GetLength();
/*!
* Returns true if preestemated length is defined
*/
boolean HavePreestimatedLength();
/*!
* Returns preestemated length
*/
double GetPreestimatedLength();
/*!
* Sets preestemated length
*/
void SetPreestimatedLength(in double length);
/*!
* Sets boolean parameter enabling/desabling usage of length computed
* basing on size of bounding box of shape to mesh
*/
void SetUsePreestimatedLength(in boolean toUse);
/*!
* Returns value of boolean parameter enabling/desabling usage of length computed
* basing on size of bounding box of shape to mesh
*/
boolean GetUsePreestimatedLength();
};
/*!
* StdMeshers_AutomaticLength: interface of "Automatic length" hypothesis
*/

View File

@ -48,6 +48,8 @@ module SMESH
FT_Volume3D,
FT_FreeBorders,
FT_FreeEdges,
FT_FreeNodes,
FT_FreeFaces,
FT_MultiConnection,
FT_MultiConnection2D,
FT_Length,
@ -59,6 +61,9 @@ module SMESH
FT_LyingOnGeom,
FT_RangeOfIds,
FT_BadOrientedVolume,
FT_LinearOrQuadratic,
FT_GroupColor,
FT_ElemGeomType,
FT_LessThan,
FT_MoreThan,
FT_EqualTo,
@ -125,7 +130,7 @@ module SMESH
typedef sequence<Value> Values;
Values GetValues();
};
/*!
* Predicates are intended for verification of criteria,
* must return bool value by mesh id
@ -241,7 +246,6 @@ module SMESH
* Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
*/
interface FreeEdges: Predicate
{
struct Border
{
@ -252,6 +256,17 @@ module SMESH
Borders GetBorders();
};
/*!
* Logical functor (predicate) "Free nodes".
* Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
*/
interface FreeNodes: Predicate{};
/*!
* Logical functor (predicate) "Free faces".
* Verify whether 2D mesh element is free ( i.e. connected to one volume only )
*/
interface FreeFaces: Predicate{};
/*!
* Abstract logical functor (predicate) "RangeOfIds".
@ -303,6 +318,33 @@ module SMESH
interface LogicalAND: LogicalBinary{};
interface LogicalOR : LogicalBinary{};
/*!
* Logical functor (predicate) "Is element Linear or Quadratic".
* Verify whether a mesh element is linear
*/
interface LinearOrQuadratic: Predicate {
void SetElementType( in ElementType theType );
};
/*!
* Functor "Group Color"
* Returns color of group to which mesh element belongs to
*/
interface GroupColor : Predicate{
void SetElementType( in ElementType theType );
void SetColorStr( in string theColor );
string GetColorStr();
};
/*!
* Functor "Element geometry type"
* Returns is element has indicated geometry type
*/
interface ElemGeomType : Predicate{
void SetElementType ( in ElementType theType );
void SetGeometryType( in GeometryType theType );
};
/*!
* Filter
*/
@ -319,6 +361,7 @@ module SMESH
* ThresholdStr - Threshold value defined as string. Used for:
* 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
* 2. BelongToGeom predicate for storing name of shape
* 3. GroupColor predicate for storing group color "0.2;0;0.5"
* ThresholdID - One more threshold value defined as string. Used for:
* 1. BelongToGeom predicate for storing id of shape
* Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
@ -423,10 +466,16 @@ module SMESH
FreeBorders CreateFreeBorders();
FreeEdges CreateFreeEdges();
FreeNodes CreateFreeNodes();
FreeFaces CreateFreeFaces();
RangeOfIds CreateRangeOfIds();
BadOrientedVolume CreateBadOrientedVolume();
LinearOrQuadratic CreateLinearOrQuadratic();
GroupColor CreateGroupColor();
ElemGeomType CreateElemGeomType();
/*!
* Create comparators ( predicates )

View File

@ -21,8 +21,7 @@
//
// File : SMESH_Gen.idl
// Author : Paul RASCLE, EDF
// $Header$
//
#ifndef _SMESH_GEN_IDL_
#define _SMESH_GEN_IDL_
@ -151,16 +150,30 @@ module SMESH
raises ( SALOME::SALOME_Exception );
/*!
* Return a hypothesis holding parameter values corresponding to the mesh
* existing on the given geometry.
* Return a hypothesis holding parameter values corresponding either to the mesh
* existing on the given geometry or to size of the geometry.
* The returned hypothesis may be the one existing in a study and used
* to compute the mesh, or a temporary one created just to pass parameter
* values
* values.
*/
SMESH_Hypothesis GetHypothesisParameterValues( in string theHypName,
in string theLibName,
in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theGeom)
in GEOM::GEOM_Object theGeom,
in boolean byMesh)
raises ( SALOME::SALOME_Exception );
/*!
* Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
void SetBoundaryBoxSegmentation( in long theNbSegments );
/*!
* Set the object name
*/
void SetName( in string theObjectIOR,
in string theObjectName )
raises ( SALOME::SALOME_Exception );
/*!
@ -174,7 +187,7 @@ module SMESH
raises ( SALOME::SALOME_Exception );
/*!
* Create a empty mesh object
* Create an empty mesh object
*/
SMESH_Mesh CreateEmptyMesh()
raises ( SALOME::SALOME_Exception );
@ -221,6 +234,17 @@ module SMESH
in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
/*!
* Calculate Mesh as preview till indicated dimension
* First, verify list of hypothesis associated with the subShape.
* Return mesh preview structure
*/
MeshPreviewStruct Precompute( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject,
in Dimension theDimension,
inout long_array theShapesId )
raises ( SALOME::SALOME_Exception );
/*!
* Return errors of hypotheses definintion
* algo_error_array is empty if everything is OK

View File

@ -21,8 +21,8 @@
//
// File : SMESH_Mesh.idl
// Author : Paul RASCLE, EDF
// $Header$
//
#ifndef _SMESH_MESH_IDL_
#define _SMESH_MESH_IDL_
@ -114,6 +114,23 @@ module SMESH
FACE,
VOLUME
};
/*!
* Enumeration for element geometry type, like in SMDS
*/
enum GeometryType
{
Geom_POINT,
Geom_EDGE,
Geom_TRIANGLE,
Geom_QUADRANGLE,
Geom_POLYGON,
Geom_TETRA,
Geom_PYRAMID,
Geom_HEXA,
Geom_PENTA,
Geom_POLYHEDRA
};
/*!
* ElementOrder points out entities of what order are requested
@ -228,6 +245,12 @@ module SMESH
void Clear()
raises (SALOME::SALOME_Exception);
/*!
* Remove all nodes and elements of submesh
*/
void ClearSubMesh(in long ShapeID)
raises (SALOME::SALOME_Exception);
/*!
* Get the subMesh object associated to a subShape. The subMesh object
* gives access to nodes and elements IDs.
@ -292,6 +315,15 @@ module SMESH
in SMESH_GroupBase aGroup2,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Union of list of groups
* New group is created. All mesh elements that are
* present in initial groups are added to the new one
*/
SMESH_Group UnionListOfGroups (in ListOfGroups aListOfGroups,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Intersection of two groups
@ -302,6 +334,15 @@ module SMESH
in SMESH_GroupBase aGroup2,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Intersection of list of groups
* New group is created. All mesh elements that are
* present in all initial groups simultaneously are added to the new one.
*/
SMESH_Group IntersectListOfGroups (in ListOfGroups aListOfGroups,
in string name)
raises (SALOME::SALOME_Exception);
/*!
* Cut of two groups
@ -309,8 +350,35 @@ module SMESH
* main group but do not present in tool group are added to the new one
*/
SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
in SMESH_GroupBase aToolGroup,
in string name )
in SMESH_GroupBase aToolGroup,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Cut of lists of groups
* New group is created. All mesh elements that are present in
* main groups but do not present in tool groups are added to the new one
*/
SMESH_Group CutListOfGroups (in ListOfGroups aMainGroups,
in ListOfGroups aToolGroups,
in string name)
raises (SALOME::SALOME_Exception);
/*!
* Create groups of entities from existing groups of superior dimensions
* New group is created. System
* 1) extracts all nodes from each group,
* 2) combines all elements of specified dimension laying on these nodes.
*/
SMESH_Group CreateDimGroup( in ListOfGroups aListOfGroups,
in ElementType anElemType,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Convert group on geometry into standalone group
*/
SMESH_Group ConvertToStandalone( in SMESH_GroupOnGeom theGeomGroup )
raises (SALOME::SALOME_Exception);
/*!

View File

@ -20,8 +20,8 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESH_MeshEditor.idl
// $Header$
//
#ifndef _SMESH_MESHEDITOR_IDL_
#define _SMESH_MESHEDITOR_IDL_
@ -576,6 +576,49 @@ module SMESH
* not creared - returns empty list
*/
long_array GetLastCreatedElems();
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theNodes - identifiers of nodes to be doubled
* \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
* nodes. If list of element identifiers is empty then nodes are doubled but
* they not assigned to elements
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above.
* \param theNodeId - identifier of node to be doubled.
* \param theModifiedElems - identifiers of elements to be updated.
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
*/
boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above.
* \param theNodes - group of nodes to be doubled.
* \param theModifiedElems - group of elements to be updated.
* \return TRUE if operation has been completed successfully, FALSE otherwise
* \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups()
*/
boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
in SMESH_GroupBase theModifiedElems );
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
This method provided for convenience works as DoubleNodes() described above.
\param theNodes - list of groups of nodes to be doubled
\param theModifiedElems - list of groups of elements to be updated.
\return TRUE if operation has been completed successfully, FALSE otherwise
\sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
*/
boolean DoubleNodeGroups( in ListOfGroups theNodes,
in ListOfGroups theModifiedElems );
};
};

View File

@ -23,7 +23,6 @@
# Author : Patrick GOLDBRONN (CEA)
# Date : 28/06/2001
# Modified by : Alexander BORODIN (OCN) - autotools usage
# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -58,6 +57,7 @@ dist_salomeres_DATA = \
mesh_length_2d.png \
mesh_free_edges.png \
mesh_free_edges_2d.png \
mesh_free_nodes.png \
mesh_multi_edges.png \
mesh_multi_edges_2d.png \
mesh_line_n.png \
@ -162,7 +162,10 @@ dist_salomeres_DATA = \
mesh_tree_hypo_projection_2d.png \
mesh_build_compound.png \
mesh_node_to_point.png \
mesh_tree_mesh_partial.png
mesh_tree_mesh_partial.png \
mesh_extractGroup.png \
mesh_precompute.png \
mesh_free_faces.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive
nodist_salomeres_SCRIPTS = SMESHCatalog.xml

View File

@ -46,9 +46,9 @@
<parameter name="selection_width" value="5"/>
<parameter name="highlight_width" value="5"/>
<parameter name="controls_precision" value="0"/>
<parameter name="scalar_bar_horizontal_height" value="0.05"/>
<parameter name="scalar_bar_horizontal_width" value="0.5" />
<parameter name="scalar_bar_horizontal_x" value="0.01"/>
<parameter name="scalar_bar_horizontal_height" value="0.08"/>
<parameter name="scalar_bar_horizontal_width" value="0.8" />
<parameter name="scalar_bar_horizontal_x" value="0.1"/>
<parameter name="scalar_bar_horizontal_y" value="0.01"/>
<parameter name="scalar_bar_label_color" value="255, 255, 255"/>
<parameter name="scalar_bar_label_font" value="Arial,12" />
@ -57,15 +57,16 @@
<parameter name="scalar_bar_orientation" value="0" />
<parameter name="scalar_bar_title_color" value="255, 255, 255"/>
<parameter name="scalar_bar_title_font" value="Arial,12" />
<parameter name="scalar_bar_vertical_height" value="0.5" />
<parameter name="scalar_bar_vertical_width" value="0.05" />
<parameter name="scalar_bar_vertical_height" value="0.8" />
<parameter name="scalar_bar_vertical_width" value="0.08" />
<parameter name="scalar_bar_vertical_x" value="0.01" />
<parameter name="scalar_bar_vertical_y" value="0.01" />
<parameter name="scalar_bar_vertical_y" value="0.1" />
<parameter name="DisplayMode" value="true" />
<parameter name="auto_update" value="true" />
<parameter name="display_mode" value="1" />
<parameter name="auto_groups" value="false"/>
<parameter name="show_result_notification" value="2"/>
<parameter name="segmentation" value="10"/>
</section>
<section name="resources">
<!-- Module resources -->

View File

@ -44,6 +44,11 @@
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type="MaxLength"
label-id="Max Size"
icon-id="mesh_hypo_length.png"
dim="1"/>
<hypothesis type="Arithmetic1D"
label-id="Arithmetic 1D"
icon-id="mesh_hypo_length.png"
@ -153,7 +158,7 @@
<algorithm type="Regular_1D"
label-id="Wire discretisation"
icon-id="mesh_algo_regular.png"
hypos="LocalLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
@ -162,7 +167,7 @@
<algorithm type="CompositeSegment_1D"
label-id="Composite side discretisation"
icon-id="mesh_algo_regular.png"
hypos="LocalLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
@ -265,11 +270,11 @@
<hypotheses-set-group>
<hypotheses-set name="Automatic Tetrahedralization"
hypos="AutomaticLength"
hypos="MaxLength"
algos="Regular_1D, MEFISTO_2D, NETGEN_3D"/>
<hypotheses-set name="Automatic Hexahedralization"
hypos="AutomaticLength"
hypos="NumberOfSegments"
algos="Regular_1D, Quadrangle_2D, Hexa_3D"/>
</hypotheses-set-group>

BIN
resources/mesh_extractGroup.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -47,11 +47,12 @@ libSMESHControls_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
-I$(srcdir)/../SMDS
-I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS
libSMESHControls_la_LDFLAGS = \
../SMDS/libSMDS.la \
$(KERNEL_LDFLAGS) -lOpUtil\
../SMESHDS/libSMESHDS.la \
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d
SMESHControls_CPPFLAGS = \
@ -60,6 +61,7 @@ SMESHControls_CPPFLAGS = \
SMESHControls_LDADD = \
../SMDS/libSMDS.la \
../SMESHDS/libSMESHDS.la \
libSMESHControls.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \
$(GEOM_LDFLAGS) -lGEOMAlgo \

View File

@ -61,6 +61,9 @@
#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_QuadraticEdge.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_GroupBase.hxx"
/*
AUXILIARY METHODS
*/
@ -1693,6 +1696,306 @@ void FreeEdges::GetBoreders(TBorders& theBorders)
//std::cout<<"theBorders.size() = "<<theBorders.size()<<endl;
}
/*
Class : FreeNodes
Description : Predicate for free nodes
*/
FreeNodes::FreeNodes()
{
myMesh = 0;
}
void FreeNodes::SetMesh( const SMDS_Mesh* theMesh )
{
myMesh = theMesh;
}
bool FreeNodes::IsSatisfy( long theNodeId )
{
const SMDS_MeshNode* aNode = myMesh->FindNode( theNodeId );
if (!aNode)
return false;
return (aNode->NbInverseElements() < 1);
}
SMDSAbs_ElementType FreeNodes::GetType() const
{
return SMDSAbs_Node;
}
/*
Class : FreeFaces
Description : Predicate for free faces
*/
FreeFaces::FreeFaces()
{
myMesh = 0;
}
void FreeFaces::SetMesh( const SMDS_Mesh* theMesh )
{
myMesh = theMesh;
}
bool FreeFaces::IsSatisfy( long theId )
{
if (!myMesh) return false;
// check that faces nodes refers to less than two common volumes
const SMDS_MeshElement* aFace = myMesh->FindElement( theId );
if ( !aFace || aFace->GetType() != SMDSAbs_Face )
return false;
int nbNode = aFace->NbNodes();
// collect volumes check that number of volumss with count equal nbNode not less than 2
typedef map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
typedef map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
TMapOfVolume mapOfVol;
SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator();
while ( nodeItr->more() ) {
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
if ( !aNode ) continue;
SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume);
while ( volItr->more() ) {
SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next();
TItrMapOfVolume itr = mapOfVol.insert(make_pair(aVol, 0)).first;
(*itr).second++;
}
}
int nbVol = 0;
TItrMapOfVolume volItr = mapOfVol.begin();
TItrMapOfVolume volEnd = mapOfVol.end();
for ( ; volItr != volEnd; ++volItr )
if ( (*volItr).second >= nbNode )
nbVol++;
// face is not free if number of volumes constructed on thier nodes more than one
return (nbVol < 2);
}
SMDSAbs_ElementType FreeFaces::GetType() const
{
return SMDSAbs_Face;
}
/*
Class : LinearOrQuadratic
Description : Predicate to verify whether a mesh element is linear
*/
LinearOrQuadratic::LinearOrQuadratic()
{
myMesh = 0;
}
void LinearOrQuadratic::SetMesh( const SMDS_Mesh* theMesh )
{
myMesh = theMesh;
}
bool LinearOrQuadratic::IsSatisfy( long theId )
{
if (!myMesh) return false;
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( !anElem || (myType != SMDSAbs_All && anElem->GetType() != myType) )
return false;
return (!anElem->IsQuadratic());
}
void LinearOrQuadratic::SetType( SMDSAbs_ElementType theType )
{
myType = theType;
}
SMDSAbs_ElementType LinearOrQuadratic::GetType() const
{
return myType;
}
/*
Class : GroupColor
Description : Functor for check color of group to whic mesh element belongs to
*/
GroupColor::GroupColor()
{
}
bool GroupColor::IsSatisfy( long theId )
{
return (myIDs.find( theId ) != myIDs.end());
}
void GroupColor::SetType( SMDSAbs_ElementType theType )
{
myType = theType;
}
SMDSAbs_ElementType GroupColor::GetType() const
{
return myType;
}
static bool isEqual( const Quantity_Color& theColor1,
const Quantity_Color& theColor2 )
{
// tolerance to compare colors
const double tol = 5*1e-3;
return ( fabs( theColor1.Red() - theColor2.Red() ) < tol &&
fabs( theColor1.Green() - theColor2.Green() ) < tol &&
fabs( theColor1.Blue() - theColor2.Blue() ) < tol );
}
void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
{
myIDs.clear();
const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
if ( !aMesh )
return;
int nbGrp = aMesh->GetNbGroups();
if ( !nbGrp )
return;
// iterates on groups and find necessary elements ids
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
for (; GrIt != aGroups.end(); GrIt++) {
SMESHDS_GroupBase* aGrp = (*GrIt);
if ( !aGrp )
continue;
// check type and color of group
if ( !isEqual( myColor, aGrp->GetColor() ) )
continue;
if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
continue;
// add elements IDS into control
int aSize = aGrp->Extent();
for (int i = 0; i < aSize; i++)
myIDs.insert( aGrp->GetID(i+1) );
}
}
void GroupColor::SetColorStr( const TCollection_AsciiString& theStr )
{
TCollection_AsciiString aStr = theStr;
aStr.RemoveAll( ' ' );
aStr.RemoveAll( '\t' );
for ( int aPos = aStr.Search( ";;" ); aPos != -1; aPos = aStr.Search( ";;" ) )
aStr.Remove( aPos, 2 );
Standard_Real clr[3];
clr[0] = clr[1] = clr[2] = 0.;
for ( int i = 0; i < 3; i++ ) {
TCollection_AsciiString tmpStr = aStr.Token( ";", i+1 );
if ( !tmpStr.IsEmpty() && tmpStr.IsRealValue() )
clr[i] = tmpStr.RealValue();
}
myColor = Quantity_Color( clr[0], clr[1], clr[2], Quantity_TOC_RGB );
}
//=======================================================================
// name : GetRangeStr
// Purpose : Get range as a string.
// Example: "1,2,3,50-60,63,67,70-"
//=======================================================================
void GroupColor::GetColorStr( TCollection_AsciiString& theResStr ) const
{
theResStr.Clear();
theResStr += TCollection_AsciiString( myColor.Red() );
theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Green() );
theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Blue() );
}
/*
Class : ElemGeomType
Description : Predicate to check element geometry type
*/
ElemGeomType::ElemGeomType()
{
myMesh = 0;
myType = SMDSAbs_All;
myGeomType = SMDSGeom_TRIANGLE;
}
void ElemGeomType::SetMesh( const SMDS_Mesh* theMesh )
{
myMesh = theMesh;
}
bool ElemGeomType::IsSatisfy( long theId )
{
if (!myMesh) return false;
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
const SMDSAbs_ElementType anElemType = anElem->GetType();
if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) )
return false;
const int aNbNode = anElem->NbNodes();
bool isOk = false;
switch( anElemType )
{
case SMDSAbs_Node:
isOk = (myGeomType == SMDSGeom_POINT);
break;
case SMDSAbs_Edge:
isOk = (myGeomType == SMDSGeom_EDGE);
break;
case SMDSAbs_Face:
if ( myGeomType == SMDSGeom_TRIANGLE )
isOk = (!anElem->IsPoly() && aNbNode == 3);
else if ( myGeomType == SMDSGeom_QUADRANGLE )
isOk = (!anElem->IsPoly() && aNbNode == 4);
else if ( myGeomType == SMDSGeom_POLYGON )
isOk = anElem->IsPoly();
break;
case SMDSAbs_Volume:
if ( myGeomType == SMDSGeom_TETRA )
isOk = (!anElem->IsPoly() && aNbNode == 4);
else if ( myGeomType == SMDSGeom_PYRAMID )
isOk = (!anElem->IsPoly() && aNbNode == 5);
else if ( myGeomType == SMDSGeom_PENTA )
isOk = (!anElem->IsPoly() && aNbNode == 6);
else if ( myGeomType == SMDSGeom_HEXA )
isOk = (!anElem->IsPoly() && aNbNode == 8);
else if ( myGeomType == SMDSGeom_POLYHEDRA )
isOk = anElem->IsPoly();
break;
default: break;
}
return isOk;
}
void ElemGeomType::SetType( SMDSAbs_ElementType theType )
{
myType = theType;
}
SMDSAbs_ElementType ElemGeomType::GetType() const
{
return myType;
}
void ElemGeomType::SetGeomType( SMDSAbs_GeometryType theType )
{
myGeomType = theType;
}
SMDSAbs_GeometryType ElemGeomType::GetGeomType() const
{
return myGeomType;
}
/*
Class : RangeOfIds
Description : Predicate for Range of Ids.

View File

@ -38,6 +38,7 @@
#include <TopoDS_Face.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <Quantity_Color.hxx>
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshNode.hxx"
@ -382,7 +383,23 @@ namespace SMESH{
const SMDS_Mesh* myMesh;
};
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
/*
Class : FreeNodes
Description : Predicate for free nodes
*/
class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
public:
FreeNodes();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theNodeId );
virtual SMDSAbs_ElementType GetType() const;
protected:
const SMDS_Mesh* myMesh;
};
/*
Class : RangeOfIds
@ -696,6 +713,83 @@ namespace SMESH{
typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
/*
Class : FreeFaces
Description : Predicate for free faces
*/
class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
public:
FreeFaces();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
private:
const SMDS_Mesh* myMesh;
};
/*
Class : LinearOrQuadratic
Description : Predicate for free faces
*/
class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
public:
LinearOrQuadratic();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
void SetType( SMDSAbs_ElementType theType );
virtual SMDSAbs_ElementType GetType() const;
private:
const SMDS_Mesh* myMesh;
SMDSAbs_ElementType myType;
};
typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
/*
Class : GroupColor
Description : Functor for check color of group to whic mesh element belongs to
*/
class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
public:
GroupColor();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
void SetType( SMDSAbs_ElementType theType );
virtual SMDSAbs_ElementType GetType() const;
void SetColorStr( const TCollection_AsciiString& );
void GetColorStr( TCollection_AsciiString& ) const;
private:
typedef std::set< long > TIDs;
Quantity_Color myColor;
SMDSAbs_ElementType myType;
TIDs myIDs;
};
typedef boost::shared_ptr<GroupColor> GroupColorPtr;
/*
Class : ElemGeomType
Description : Predicate to check element geometry type
*/
class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
public:
ElemGeomType();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
void SetType( SMDSAbs_ElementType theType );
virtual SMDSAbs_ElementType GetType() const;
void SetGeomType( SMDSAbs_GeometryType theType );
virtual SMDSAbs_GeometryType GetGeomType() const;
private:
const SMDS_Mesh* myMesh;
SMDSAbs_ElementType myType;
SMDSAbs_GeometryType myGeomType;
};
typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
/*
FILTER
*/

View File

@ -23,8 +23,8 @@
// File : SMESH_Actor.cxx
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
//
#include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
@ -153,6 +153,27 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
my2DExtProp = vtkProperty::New();
my2DExtProp->DeepCopy(mySurfaceProp);
SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
anRGB[0] = 1 - anRGB[0];
anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2];
my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my2DExtActor = SMESH_DeviceActor::New();
my2DExtActor->SetUserMatrix(aMatrix);
my2DExtActor->PickableOff();
my2DExtActor->SetProperty(my2DExtProp);
my2DExtActor->SetBackfaceProperty(my2DExtProp);
my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
aFilter = my2DExtActor->GetExtractUnstructuredGrid();
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
aFilter->RegisterCellsWithType(VTK_QUAD);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
my3DActor = SMESH_DeviceActor::New();
my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff();
@ -196,7 +217,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my1DProp->DeepCopy(myEdgeProp);
my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
my1DProp->SetPointSize(aPointSize);
my1DExtProp = vtkProperty::New();
my1DExtProp->DeepCopy(myEdgeProp);
anRGB[0] = 1 - anRGB[0];
@ -235,7 +256,26 @@ SMESH_ActorDef::SMESH_ActorDef()
myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
aFilter = myNodeActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myNodeExtProp = vtkProperty::New();
myNodeExtProp->DeepCopy(myNodeProp);
anRGB[0] = 1 - anRGB[0];
anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2];
myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myNodeExtProp->SetPointSize(aPointSize);
myNodeExtActor = SMESH_DeviceActor::New();
myNodeExtActor->SetUserMatrix(aMatrix);
myNodeExtActor->SetStoreClippingMapping(true);
myNodeExtActor->PickableOff();
myNodeExtActor->SetHighlited(true);
myNodeExtActor->SetVisibility(false);
myNodeExtActor->SetProperty(myNodeExtProp);
myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->RegisterCellsWithType(VTK_VERTEX);
//Definition of Pickable and Highlitable engines
//----------------------------------------------
@ -393,7 +433,8 @@ SMESH_ActorDef::~SMESH_ActorDef()
myPreselectProp->Delete();
myNodeProp->Delete();
myNodeExtProp->Delete();
my1DProp->Delete();
my1DActor->Delete();
@ -401,11 +442,15 @@ SMESH_ActorDef::~SMESH_ActorDef()
my1DExtActor->Delete();
my2DActor->Delete();
my2DExtProp->Delete();
my2DExtActor->Delete();
my3DActor->Delete();
myNodeActor->Delete();
myBaseActor->Delete();
myNodeExtActor->Delete();
myHighlitableActor->Delete();
//Deleting of pints numbering pipeline
@ -581,6 +626,14 @@ SetControlMode(eControl theMode,
aFunctor.reset(new SMESH::Controls::FreeEdges());
myControlActor = my2DActor;
break;
case eFreeNodes:
aFunctor.reset(new SMESH::Controls::FreeNodes());
myControlActor = myNodeActor;
break;
case eFreeFaces:
aFunctor.reset(new SMESH::Controls::FreeFaces());
myControlActor = my2DActor;
break;
case eMultiConnection:
aFunctor.reset(new SMESH::Controls::MultiConnection());
myControlActor = my1DActor;
@ -662,10 +715,16 @@ SetControlMode(eControl theMode,
if(aNbCells){
myControlMode = theMode;
switch(myControlMode){
case eFreeNodes:
myNodeExtActor->SetExtControlMode(aFunctor);
break;
case eFreeEdges:
case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor);
break;
case eFreeFaces:
my2DExtActor->SetExtControlMode(aFunctor);
break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
@ -682,6 +741,7 @@ SetControlMode(eControl theMode,
switch(myControlMode){
case eLength2D:
case eFreeEdges:
case eFreeFaces:
case eMultiConnection2D:
//SetEntityMode(eEdges);
SetEntityMode(eFaces);
@ -709,15 +769,18 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(myNodeActor);
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
my3DActor->AddToRender(theRenderer);
my2DActor->AddToRender(theRenderer);
my2DExtActor->AddToRender(theRenderer);
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
myPtsSelectVisiblePoints->SetRenderer(theRenderer);
@ -733,12 +796,15 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
theRenderer->RemoveActor(myNodeActor);
theRenderer->RemoveActor(myBaseActor);
theRenderer->RemoveActor(myNodeExtActor);
theRenderer->RemoveActor(myHighlitableActor);
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
my2DActor->RemoveFromRender(theRenderer);
my2DExtActor->RemoveFromRender(theRenderer);
my3DActor->RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myScalarBarActor);
@ -761,24 +827,29 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myNodeActor->Init(myVisualObj,myImplicitBoolean);
myBaseActor->Init(myVisualObj,myImplicitBoolean);
myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
my2DActor->Init(myVisualObj,myImplicitBoolean);
my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my2DActor->GetMapper()->SetLookupTable(myLookupTable);
my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable);
vtkFloatingPointType aFactor, aUnits;
my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
@ -825,13 +896,16 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
myNodeActor->SetTransform(theTransform);
myBaseActor->SetTransform(theTransform);
myHighlitableActor->SetTransform(theTransform);
myNodeExtActor->SetTransform(theTransform);
my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform);
my2DActor->SetTransform(theTransform);
my2DExtActor->SetTransform(theTransform);
my3DActor->SetTransform(theTransform);
Modified();
@ -886,6 +960,7 @@ void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
my1DExtActor->SetShrinkFactor(theValue);
my2DActor->SetShrinkFactor(theValue);
my2DExtActor->SetShrinkFactor(theValue);
my3DActor->SetShrinkFactor(theValue);
Modified();
@ -900,6 +975,7 @@ void SMESH_ActorDef::SetShrink(){
my1DExtActor->SetShrink();
my2DActor->SetShrink();
my2DExtActor->SetShrink();
my3DActor->SetShrink();
myIsShrunk = true;
@ -915,6 +991,7 @@ void SMESH_ActorDef::UnShrink(){
my1DExtActor->UnShrink();
my2DActor->UnShrink();
my2DExtActor->UnShrink();
my3DActor->UnShrink();
myIsShrunk = false;
@ -951,10 +1028,13 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff();
myNodeExtActor->VisibilityOff();
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
my2DActor->VisibilityOff();
my2DExtActor->VisibilityOff();
my3DActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
@ -964,13 +1044,19 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(GetVisibility()){
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
if(myControlMode != eNone){
switch(myControlMode){
case eFreeNodes:
myNodeExtActor->VisibilityOn();
break;
case eFreeEdges:
case eFreeBorders:
my1DExtActor->VisibilityOn();
break;
case eFreeFaces:
my2DExtActor->VisibilityOn();
break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
@ -1117,6 +1203,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
myPickableActor = myBaseActor;
myNodeActor->SetVisibility(false);
myNodeExtActor->SetVisibility(false);
vtkProperty *aProp = NULL, *aBackProp = NULL;
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
switch(myRepresentation){
@ -1141,12 +1228,15 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
my2DActor->SetProperty(aProp);
my2DActor->SetBackfaceProperty(aBackProp);
my2DActor->SetRepresentation(aReperesent);
my2DExtActor->SetRepresentation(aReperesent);
my3DActor->SetProperty(aProp);
my3DActor->SetBackfaceProperty(aBackProp);
my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false);
my2DExtActor->SetVisibility(false);
switch(myControlMode){
case eLength:
@ -1331,6 +1421,7 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType
void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(mySurfaceProp,r,g,b);
my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
}
void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
@ -1355,6 +1446,7 @@ void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType&
void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myNodeProp->SetColor(r,g,b);
myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
Modified();
}
@ -1398,6 +1490,7 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){
myNodeProp->SetPointSize(theVal);
myNodeExtProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal);
@ -1431,11 +1524,14 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
}
@ -1597,7 +1693,7 @@ void SMESH_ActorDef::UpdateScalarBar()
else
aScalarBarTitleProp->ItalicOff();
if ( f.underline() )
if ( f.overline() )
aScalarBarTitleProp->ShadowOn();
else
aScalarBarTitleProp->ShadowOff();
@ -1632,7 +1728,7 @@ void SMESH_ActorDef::UpdateScalarBar()
else
aScalarBarLabelProp->ItalicOff();
if( f.underline() )
if( f.overline() )
aScalarBarLabelProp->ShadowOn();
else
aScalarBarLabelProp->ShadowOff();

View File

@ -23,8 +23,7 @@
// File : SMESH_Actor.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
//
#ifndef SMESH_ACTOR_H
#define SMESH_ACTOR_H
@ -95,9 +94,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetFacesOriented(bool theIsFacesOriented) = 0;
virtual bool GetFacesOriented() = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
eAspectRatio3D, eMultiConnection2D, eVolume3D};
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;

View File

@ -23,8 +23,8 @@
// File : SMESH_ActorDef.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
//
#ifndef SMESH_ACTORDEF_H
#define SMESH_ACTORDEF_H
@ -215,10 +215,15 @@ class SMESH_ActorDef : public SMESH_Actor
SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode;
vtkProperty* my2DExtProp;
SMESH_DeviceActor* my2DActor;
SMESH_DeviceActor* my2DExtActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
vtkProperty* myNodeExtProp;
SMESH_DeviceActor* myNodeExtActor;
vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor;
vtkProperty* my1DExtProp;

View File

@ -23,8 +23,8 @@
// File : SMESH_DeviceActor.cxx
// Author :
// Module : SMESH
// $Header$
//
#include "SMESH_DeviceActor.h"
#include "SMESH_ExtractGeometry.h"
#include "SMESH_ControlsDef.hxx"
@ -483,13 +483,15 @@ SMESH_DeviceActor
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
if ( dynamic_cast<FreeBorders*>(theFunctor.get()) ||
dynamic_cast<FreeFaces*>(theFunctor.get()) ) {
Predicate* aFreePredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreeBorders->IsSatisfy(anObjId))
if(aFreePredicate->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
@ -542,6 +544,18 @@ SMESH_DeviceActor
SetUnstructuredGrid(aDataSet);
aDataSet->Delete();
}else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
if(aFreeNodes->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
}
}

View File

@ -39,6 +39,26 @@ enum SMDSAbs_ElementType
SMDSAbs_NbElementTypes
};
/*! enumeration for element geometry type */
enum SMDSAbs_GeometryType
{
// 0D element
SMDSGeom_POINT,
// 1D element
SMDSGeom_EDGE,
// 2D element
SMDSGeom_TRIANGLE,
SMDSGeom_QUADRANGLE,
SMDSGeom_POLYGON,
// 3D element
SMDSGeom_TETRA,
SMDSGeom_PYRAMID,
SMDSGeom_PENTA,
SMDSGeom_HEXA,
SMDSGeom_POLYHEDRA,
};
enum SMDSAbs_ElementOrder {
ORDER_ANY, /*! entities of any order */
ORDER_LINEAR, /*! entities of 1st order */

View File

@ -23,8 +23,8 @@
// File : SMESH_Algo.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_Algo.hxx"
#include "SMESH_Comment.hxx"
#include "SMESH_Gen.hxx"
@ -285,12 +285,7 @@ bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace,
//================================================================================
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*
* Just return false as the algorithm does not hold parameters values
* \brief Just return false as the algorithm does not hold parameters values
*/
//================================================================================
@ -299,7 +294,10 @@ bool SMESH_Algo::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
{
return false;
}
bool SMESH_Algo::SetParametersByElementSize(double, const SMESH_Mesh*)
{
return false;
}
//================================================================================
/*!
* \brief Fill vector of node parameters on geometrical edge, including vertex nodes
@ -359,6 +357,70 @@ bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
return theParams.size() > 1;
}
//================================================================================
/*!
* \brief Fill vector of node parameters on geometrical edge, including vertex nodes
* \param theMesh - The mesh containing nodes
* \param theEdge - The geometrical edge of interest
* \param theParams - The resulting vector of sorted node parameters
* \retval bool - false if not all parameters are OK
*/
//================================================================================
bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theMesh,
const TopoDS_Edge& theEdge,
const bool ignoreMediumNodes,
map< double, const SMDS_MeshNode* > & theNodes)
{
theNodes.clear();
if ( !theMesh || theEdge.IsNull() )
return false;
SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
if ( !eSubMesh || !eSubMesh->GetElements()->more() )
return false; // edge is not meshed
int nbNodes = 0;
set < double > paramSet;
if ( eSubMesh )
{
// loop on nodes of an edge: sort them by param on edge
SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
while ( nIt->more() )
{
const SMDS_MeshNode* node = nIt->next();
if ( ignoreMediumNodes ) {
SMDS_ElemIteratorPtr elemIt = node->GetInverseElementIterator();
if ( elemIt->more() && elemIt->next()->IsMediumNode( node ))
continue;
}
const SMDS_PositionPtr& pos = node->GetPosition();
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
return false;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
theNodes.insert( make_pair( epos->GetUParameter(), node ));
++nbNodes;
}
}
// add vertex nodes
TopoDS_Vertex v1, v2;
TopExp::Vertices(theEdge, v1, v2);
const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
Standard_Real f, l;
BRep_Tool::Range(theEdge, f, l);
if ( v1.Orientation() != TopAbs_FORWARD )
std::swap( f, l );
if ( n1 && ++nbNodes )
theNodes.insert( make_pair( f, n1 ));
if ( n2 && ++nbNodes )
theNodes.insert( make_pair( l, n2 ));
return theNodes.size() == nbNodes;
}
//================================================================================
/*!
* \brief Make filter recognize only compatible hypotheses

View File

@ -23,8 +23,8 @@
// File : SMESH_Algo.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_ALGO_HXX_
#define _SMESH_ALGO_HXX_
@ -41,6 +41,7 @@
#include <string>
#include <vector>
#include <list>
#include <map>
class SMESH_Gen;
class SMESH_Mesh;
@ -162,12 +163,10 @@ public:
bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
const bool ignoreAuxiliary) const;
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
*
* Just return false as the algorithm does not hold parameters values
* \brief Just return false as the algorithm does not hold parameters values
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Shape& theShape);
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
virtual bool SetParametersByElementSize(double elemLenght, const SMESH_Mesh* theMesh=0);
/*!
* \brief return compute error
*/
@ -241,6 +240,18 @@ public:
static bool GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
const TopoDS_Edge& theEdge,
std::vector< double > & theParams);
/*!
* \brief Fill map of node parameter on geometrical edge to node it-self
* \param theMesh - The mesh containing nodes
* \param theEdge - The geometrical edge of interest
* \param theNodes - The resulting map
* \param ignoreMediumNodes - to store medium nodes of quadratic elements or not
* \retval bool - false if not all parameters are OK
*/
static bool GetSortedNodesOnEdge(const SMESHDS_Mesh* theMesh,
const TopoDS_Edge& theEdge,
const bool ignoreMediumNodes,
std::map< double, const SMDS_MeshNode* > & theNodes);
/*!
* \brief Find out elements orientation on a geometrical face
* \param theFace - The face correctly oriented in the shape being meshed

View File

@ -23,8 +23,7 @@
// File : SMESH_Gen.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_Gen.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_HypoFilter.hxx"
@ -54,6 +53,7 @@ SMESH_Gen::SMESH_Gen()
MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0;
_hypId = 0;
_segmentation = 10;
}
//=============================================================================
@ -128,9 +128,11 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
*/
//=============================================================================
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward)
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward,
const ::MeshDimension aDim,
TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Compute");
@ -154,16 +156,27 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next();
// do not mesh vertices of a pseudo shape
if ( !aMesh.HasShapeToMesh() &&
smToCompute->GetSubShape().ShapeType() == TopAbs_VERTEX )
const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
continue;
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
{
// clear compute state to not show previous compute errors
// if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue;
}
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
// we check all the submeshes here and detect if any of them failed to compute
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;
else if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
@ -183,7 +196,12 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
continue;
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
if ( GetShapeDim( aSubShape ) < 1 ) break;
const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) break;
// check for preview dimension limitations
if ( aShapesId && aShapeDim > (int)aDim )
continue;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if ( algo && !algo->NeedDescretBoundary() )
@ -191,7 +209,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( algo->SupportSubmeshes() )
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
else
{
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
}
}
// ------------------------------------------------------------
@ -218,8 +240,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
const int aShapeDim = GetShapeDim( aSubShape );
//if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
if ( aShapeDim < 1 ) continue;
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
continue;
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
@ -228,8 +256,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute
Compute( aMesh, aSubShape );
// mesh a lower smToCompute starting from vertices
Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId );
}
}
}
@ -238,12 +266,21 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// ----------------------------------------------------------
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{
const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
continue;
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId )
aShapesId->insert( sm->GetId() );
}
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
ret = Compute( aMesh, aShape, /*anUpward=*/true );
ret = Compute( aMesh, aShape, /*anUpward=*/true, aDim, aShapesId );
}
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
@ -665,35 +702,35 @@ StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
return myStudyContext;
}
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
{
}
// void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
// {
// }
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
{
}
// void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
// {
// }
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Close(int studyId)
{
}
// void SMESH_Gen::Close(int studyId)
// {
// }
//=============================================================================
/*!
@ -707,14 +744,14 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
if ( dim.empty() )
{
dim.resize( TopAbs_SHAPE, -1 );
dim[ TopAbs_COMPOUND ] = 3;
dim[ TopAbs_COMPSOLID ] = 3;
dim[ TopAbs_SOLID ] = 3;
dim[ TopAbs_SHELL ] = 3;
dim[ TopAbs_FACE ] = 2;
dim[ TopAbs_WIRE ] = 1;
dim[ TopAbs_EDGE ] = 1;
dim[ TopAbs_VERTEX ] = 0;
dim[ TopAbs_COMPOUND ] = MeshDim_3D;
dim[ TopAbs_COMPSOLID ] = MeshDim_3D;
dim[ TopAbs_SOLID ] = MeshDim_3D;
dim[ TopAbs_SHELL ] = MeshDim_3D;
dim[ TopAbs_FACE ] = MeshDim_2D;
dim[ TopAbs_WIRE ] = MeshDim_1D;
dim[ TopAbs_EDGE ] = MeshDim_1D;
dim[ TopAbs_VERTEX ] = MeshDim_0D;
}
return dim[ aShapeType ];
}

View File

@ -23,8 +23,8 @@
// File : SMESH_Gen.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_GEN_HXX_
#define _SMESH_GEN_HXX_
@ -44,6 +44,7 @@
#include <TopoDS_Shape.hxx>
#include <map>
#include <list>
class SMESHDS_Document;
@ -56,6 +57,8 @@ typedef struct studyContextStruct
SMESHDS_Document * myDocument;
} StudyContextStruct;
typedef std::set<int> TSetOfInt;
class SMESH_EXPORT SMESH_Gen
{
public:
@ -68,16 +71,26 @@ class SMESH_EXPORT SMESH_Gen
/*!
* \brief Computes aMesh on aShape
* \param anUpward - compute from vertices up to more complex shape (internal usage)
* \param aDim - upper level dimension of the mesh computation
* \param aShapesId - list of shapes with computed mesh entities (elements or nodes)
* \retval bool - true if none submesh failed to compute
*/
bool Compute(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward=false);
bool Compute(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool anUpward=false,
const ::MeshDimension aDim=::MeshDim_3D,
TSetOfInt* aShapesId=0);
bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
// notify on bad state of attached algos, return false
// if Compute() would fail because of some algo bad state
/*!
* \brief Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
int GetBoundaryBoxSegmentation() const { return _segmentation; }
struct TAlgoStateError
{
@ -109,13 +122,13 @@ class SMESH_EXPORT SMESH_Gen
// inherited methods from SALOMEDS::Driver
void Save(int studyId, const char *aUrlOfFile);
void Load(int studyId, const char *aUrlOfFile);
void Close(int studyId);
const char *ComponentDataType();
// void Save(int studyId, const char *aUrlOfFile);
// void Load(int studyId, const char *aUrlOfFile);
// void Close(int studyId);
// const char *ComponentDataType();
const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
int GetANewId();
@ -132,6 +145,10 @@ class SMESH_EXPORT SMESH_Gen
// hypotheses managing
int _hypId;
// number of segments per diagonal of boundary box of geometry by which
// default segment length of appropriate 1D hypotheses is defined
int _segmentation;
};
#endif

View File

@ -23,8 +23,8 @@
// File : SMESH_Hypothesis.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_HYPOTHESIS_HXX_
#define _SMESH_HYPOTHESIS_HXX_
@ -36,6 +36,14 @@ class SMESH_Gen;
class TopoDS_Shape;
class SMESH_Mesh;
enum MeshDimension // dimension of mesh
{
MeshDim_0D = 0,
MeshDim_1D,
MeshDim_2D,
MeshDim_3D
};
class SMESH_EXPORT SMESH_Hypothesis: public SMESHDS_Hypothesis
{
public:
@ -71,12 +79,18 @@ public:
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize(double elemLenght, const SMESH_Mesh* theMesh=0)=0;
/*!
* \brief Return true if me is an auxiliary hypothesis
* \retval bool - auxiliary or not

View File

@ -23,7 +23,6 @@
// File : SMESH_Mesh.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#include "SMESH_Mesh.hxx"
#include "SMESH_subMesh.hxx"
@ -50,7 +49,9 @@
#include "DriverSTL_R_SMDS_Mesh.h"
#undef _Precision_HeaderFile
#include <BRepBndLib.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Bnd_Box.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
@ -95,6 +96,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
_myMeshDS = theDocument->GetMesh(_idDoc);
_isShapeToMesh = false;
_isAutoColor = false;
_shapeDiagonal = 0.0;
_myMeshDS->ShapeToMesh( PseudoShape() );
}
@ -155,6 +157,8 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
// clear SMESHDS
TopoDS_Shape aNullShape;
_myMeshDS->ShapeToMesh( aNullShape );
_shapeDiagonal = 0.0;
}
// set a new geometry
@ -202,6 +206,33 @@ const TopoDS_Solid& SMESH_Mesh::PseudoShape()
return aSolid;
}
//=======================================================================
/*!
* \brief Return diagonal size of bounding box of a shape
*/
//=======================================================================
double SMESH_Mesh::GetShapeDiagonalSize(const TopoDS_Shape & aShape)
{
Bnd_Box Box;
BRepBndLib::Add(aShape, Box);
return sqrt( Box.SquareExtent() );
}
//=======================================================================
/*!
* \brief Return diagonal size of bounding box of shape to mesh
*/
//=======================================================================
double SMESH_Mesh::GetShapeDiagonalSize() const
{
if ( _shapeDiagonal == 0. && _isShapeToMesh )
const_cast<SMESH_Mesh*>(this)->_shapeDiagonal = GetShapeDiagonalSize( GetShapeToMesh() );
return _shapeDiagonal;
}
//=======================================================================
/*!
* \brief Remove all nodes and elements
@ -265,6 +296,32 @@ void SMESH_Mesh::Clear()
// }
}
//=======================================================================
/*!
* \brief Remove all nodes and elements of indicated shape
*/
//=======================================================================
void SMESH_Mesh::ClearSubMesh(const int theShapeId)
{
// clear sub-meshes; get ready to re-compute as a side-effect
if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) )
{
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
/*complexShapeFirst=*/false);
while ( smIt->more() )
{
sm = smIt->next();
TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
// all other shapes depends on vertices so they are already cleaned
sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
// to recompute even if failed
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
}
}
//=======================================================================
//function : UNVToMesh
//purpose :
@ -1453,3 +1510,41 @@ SMDSAbs_ElementType SMESH_Mesh::GetElementType( const int id, const bool iselem
{
return _myMeshDS->GetElementType( id, iselem );
}
//=============================================================================
/*!
* \brief Convert group on geometry into standalone group
*/
//=============================================================================
SMESH_Group* SMESH_Mesh::ConvertToStandalone ( int theGroupID )
{
SMESH_Group* aGroup = 0;
std::map < int, SMESH_Group * >::iterator itg = _mapGroup.find( theGroupID );
if ( itg == _mapGroup.end() )
return aGroup;
SMESH_Group* anOldGrp = (*itg).second;
SMESHDS_GroupBase* anOldGrpDS = anOldGrp->GetGroupDS();
if ( !anOldGrp || !anOldGrpDS )
return aGroup;
// create new standalone group
aGroup = new SMESH_Group (theGroupID, this, anOldGrpDS->GetType(), anOldGrp->GetName() );
_mapGroup[theGroupID] = aGroup;
SMESHDS_Group* aNewGrpDS = dynamic_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
GetMeshDS()->RemoveGroup( anOldGrpDS );
GetMeshDS()->AddGroup( aNewGrpDS );
// add elements (or nodes) into new created group
SMDS_ElemIteratorPtr anItr = anOldGrpDS->GetElements();
while ( anItr->more() )
aNewGrpDS->Add( (anItr->next())->GetID() );
// remove old group
delete anOldGrp;
return aGroup;
}

View File

@ -23,7 +23,6 @@
// File : SMESH_Mesh.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
//
#ifndef _SMESH_MESH_HXX_
#define _SMESH_MESH_HXX_
@ -75,6 +74,14 @@ public:
* \brief Return true if there is a geometry to be meshed, not PseudoShape()
*/
bool HasShapeToMesh() const { return _isShapeToMesh; }
/*!
* \brief Return diagonal size of bounding box of shape to mesh.
*/
double GetShapeDiagonalSize() const;
/*!
* \brief Return diagonal size of bounding box of a shape.
*/
static double GetShapeDiagonalSize(const TopoDS_Shape & aShape);
/*!
* \brief Return a solid which is returned by GetShapeToMesh() if
* a real geometry to be meshed was not set
@ -86,6 +93,11 @@ public:
*/
void Clear();
/*!
* \brief Remove all nodes and elements of indicated shape
*/
void ClearSubMesh(const int theShapeId);
int UNVToMesh(const char* theFileName);
/*!
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
@ -230,6 +242,7 @@ public:
void RemoveGroup (const int theGroupID);
SMESH_Group* ConvertToStandalone ( int theGroupID );
SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
@ -253,6 +266,8 @@ protected:
SMESH_Gen * _gen;
bool _isAutoColor;
double _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;

View File

@ -90,22 +90,6 @@ struct TNodeXYZ : public gp_XYZ {
TNodeXYZ( const SMDS_MeshNode* n ):gp_XYZ( n->X(), n->Y(), n->Z() ) {}
};
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
//=======================================================================
/*!
* \brief A sorted pair of nodes
*/
//=======================================================================
struct TLink: public NLink
{
TLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ):NLink( n1, n2 )
{ if ( n1->GetID() < n2->GetID() ) std::swap( first, second ); }
TLink(const NLink& link ):NLink( link )
{ if ( first->GetID() < second->GetID() ) std::swap( first, second ); }
};
//=======================================================================
//function : SMESH_MeshEditor
//purpose :
@ -1479,10 +1463,10 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
// 1. map of elements with their linkIDs
// 2. map of linkIDs with their elements
map< TLink, list< const SMDS_MeshElement* > > mapLi_listEl;
map< TLink, list< const SMDS_MeshElement* > >::iterator itLE;
map< const SMDS_MeshElement*, set< TLink > > mapEl_setLi;
map< const SMDS_MeshElement*, set< TLink > >::iterator itEL;
map< SMESH_TLink, list< const SMDS_MeshElement* > > mapLi_listEl;
map< SMESH_TLink, list< const SMDS_MeshElement* > >::iterator itLE;
map< const SMDS_MeshElement*, set< SMESH_TLink > > mapEl_setLi;
map< const SMDS_MeshElement*, set< SMESH_TLink > >::iterator itEL;
TIDSortedElemSet::iterator itElem;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) {
@ -1501,7 +1485,7 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
// fill maps
for ( i = 0; i < 3; i++ ) {
TLink link( aNodes[i], aNodes[i+1] );
SMESH_TLink link( aNodes[i], aNodes[i+1] );
// check if elements sharing a link can be fused
itLE = mapLi_listEl.find( link );
if ( itLE != mapLi_listEl.end() ) {
@ -1527,7 +1511,7 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
int nbElems = (*itLE).second.size();
if ( nbElems < 2 ) {
const SMDS_MeshElement* elem = (*itLE).second.front();
TLink link = (*itLE).first;
SMESH_TLink link = (*itLE).first;
mapEl_setLi[ elem ].erase( link );
if ( mapEl_setLi[ elem ].empty() )
mapEl_setLi.erase( elem );
@ -1553,11 +1537,11 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
// search elements to fuse starting from startElem or links of elements
// fused earlyer - startLinks
list< TLink > startLinks;
list< SMESH_TLink > startLinks;
while ( startElem || !startLinks.empty() ) {
while ( !startElem && !startLinks.empty() ) {
// Get an element to start, by a link
TLink linkId = startLinks.front();
SMESH_TLink linkId = startLinks.front();
startLinks.pop_front();
itLE = mapLi_listEl.find( linkId );
if ( itLE != mapLi_listEl.end() ) {
@ -1573,15 +1557,15 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
if ( startElem ) {
// Get candidates to be fused
const SMDS_MeshElement *tr1 = startElem, *tr2 = 0, *tr3 = 0;
const TLink *link12, *link13;
const SMESH_TLink *link12, *link13;
startElem = 0;
ASSERT( mapEl_setLi.find( tr1 ) != mapEl_setLi.end() );
set< TLink >& setLi = mapEl_setLi[ tr1 ];
set< SMESH_TLink >& setLi = mapEl_setLi[ tr1 ];
ASSERT( !setLi.empty() );
set< TLink >::iterator itLi;
set< SMESH_TLink >::iterator itLi;
for ( itLi = setLi.begin(); itLi != setLi.end(); itLi++ )
{
const TLink & link = (*itLi);
const SMESH_TLink & link = (*itLi);
itLE = mapLi_listEl.find( link );
if ( itLE == mapLi_listEl.end() )
continue;
@ -1602,10 +1586,10 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems,
}
// add other links of elem to list of links to re-start from
set< TLink >& links = mapEl_setLi[ elem ];
set< TLink >::iterator it;
set< SMESH_TLink >& links = mapEl_setLi[ elem ];
set< SMESH_TLink >::iterator it;
for ( it = links.begin(); it != links.end(); it++ ) {
const TLink& link2 = (*it);
const SMESH_TLink& link2 = (*it);
if ( link2 != link )
startLinks.push_back( link2 );
}
@ -2462,9 +2446,8 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
// fix nodes on mesh boundary
if ( checkBoundaryNodes ) {
typedef pair<const SMDS_MeshNode*, const SMDS_MeshNode*> TLink;
map< TLink, int > linkNbMap; // how many times a link encounters in elemsOnFace
map< TLink, int >::iterator link_nb;
map< NLink, int > linkNbMap; // how many times a link encounters in elemsOnFace
map< NLink, int >::iterator link_nb;
// put all elements links to linkNbMap
list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
for ( ; elemIt != elemsOnFace.end(); ++elemIt ) {
@ -2476,7 +2459,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
const SMDS_MeshNode* curNode, *prevNode = elem->GetNode( nbn );
for ( int iN = 0; iN < nbn; ++iN ) {
curNode = elem->GetNode( iN );
TLink link;
NLink link;
if ( curNode < prevNode ) link = make_pair( curNode , prevNode );
else link = make_pair( prevNode , curNode );
prevNode = curNode;
@ -7547,8 +7530,8 @@ SMESH_MeshEditor::FindMatchingNodes(set<const SMDS_MeshElement*>& theSide1,
if ( theSecondNode1 != theSecondNode2 )
nReplaceMap.insert( make_pair( theSecondNode1, theSecondNode2 ));
set< TLink > linkSet; // set of nodes where order of nodes is ignored
linkSet.insert( TLink( theFirstNode1, theSecondNode1 ));
set< SMESH_TLink > linkSet; // set of nodes where order of nodes is ignored
linkSet.insert( SMESH_TLink( theFirstNode1, theSecondNode1 ));
list< NLink > linkList[2];
linkList[0].push_back( NLink( theFirstNode1, theSecondNode1 ));
@ -7663,8 +7646,8 @@ SMESH_MeshEditor::FindMatchingNodes(set<const SMDS_MeshElement*>& theSide1,
for ( int i = 0; i < nbN; i++ )
{
const SMDS_MeshNode* n2 = f0->GetNode( i );
pair< set< TLink >::iterator, bool > iter_isnew =
linkSet.insert( TLink( n1, n2 ));
pair< set< SMESH_TLink >::iterator, bool > iter_isnew =
linkSet.insert( SMESH_TLink( n1, n2 ));
if ( !iter_isnew.second ) { // already in a set: no need to process
linkSet.erase( iter_isnew.first );
}
@ -7684,3 +7667,92 @@ SMESH_MeshEditor::FindMatchingNodes(set<const SMDS_MeshElement*>& theSide1,
return SEW_OK;
}
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
\param theNodes - identifiers of nodes to be doubled
\param theModifiedElems - identifiers of elements to be updated by the new (doubled)
nodes. If list of element identifiers is empty then nodes are doubled but
they not assigned to elements
\return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool SMESH_MeshEditor::DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems )
{
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
if ( theListOfNodes.size() == 0 )
return false;
SMESHDS_Mesh* aMeshDS = GetMeshDS();
if ( !aMeshDS )
return false;
// iterate through nodes and duplicate them
std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode;
std::list< int >::const_iterator aNodeIter;
for ( aNodeIter = theListOfNodes.begin(); aNodeIter != theListOfNodes.end(); ++aNodeIter )
{
int aCurr = *aNodeIter;
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aMeshDS->FindNode( aCurr );
if ( !aNode )
continue;
// duplicate node
const SMDS_MeshNode* aNewNode = aMeshDS->AddNode( aNode->X(), aNode->Y(), aNode->Z() );
if ( aNewNode )
{
anOldNodeToNewNode[ aNode ] = aNewNode;
myLastCreatedNodes.Append( aNewNode );
}
}
// Create map of new nodes for modified elements
std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> > anElemToNodes;
std::list< int >::const_iterator anElemIter;
for ( anElemIter = theListOfModifiedElems.begin();
anElemIter != theListOfModifiedElems.end(); ++anElemIter )
{
int aCurr = *anElemIter;
SMDS_MeshElement* anElem = (SMDS_MeshElement*)aMeshDS->FindElement( aCurr );
if ( !anElem )
continue;
vector<const SMDS_MeshNode*> aNodeArr( anElem->NbNodes() );
SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
int ind = 0;
while ( anIter->more() )
{
SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next();
if ( aCurr && anOldNodeToNewNode.find( aCurrNode ) != anOldNodeToNewNode.end() )
{
const SMDS_MeshNode* aNewNode = anOldNodeToNewNode[ aCurrNode ];
aNodeArr[ ind++ ] = aNewNode;
}
else
aNodeArr[ ind++ ] = aCurrNode;
}
anElemToNodes[ anElem ] = aNodeArr;
}
// Change nodes of elements
std::map< SMDS_MeshElement*, vector<const SMDS_MeshNode*> >::iterator
anElemToNodesIter = anElemToNodes.begin();
for ( ; anElemToNodesIter != anElemToNodes.end(); ++anElemToNodesIter )
{
const SMDS_MeshElement* anElem = anElemToNodesIter->first;
vector<const SMDS_MeshNode*> aNodeArr = anElemToNodesIter->second;
if ( anElem )
aMeshDS->ChangeElementNodes( anElem, &aNodeArr[ 0 ], anElem->NbNodes() );
}
return true;
}

View File

@ -47,6 +47,24 @@ typedef std::map<const SMDS_MeshElement*,
std::list<const SMDS_MeshElement*> > TElemOfElemListMap;
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
//=======================================================================
/*!
* \brief A sorted pair of nodes
*/
//=======================================================================
struct SMESH_TLink: public NLink
{
SMESH_TLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2 ):NLink( n1, n2 )
{ if ( n1->GetID() < n2->GetID() ) std::swap( first, second ); }
SMESH_TLink(const NLink& link ):NLink( link )
{ if ( first->GetID() < second->GetID() ) std::swap( first, second ); }
};
class SMDS_MeshFace;
class SMDS_MeshNode;
class gp_Ax1;
@ -509,6 +527,9 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
bool DoubleNodes( const std::list< int >& theListOfNodes,
const std::list< int >& theListOfModifiedElems );
private:

View File

@ -771,6 +771,10 @@
aTitle = QObject::tr( "MULTI_BORDERS" );
aControl = SMESH_Actor::eMultiConnection;
break;
case 6005:
aTitle = QObject::tr( "FREE_NODES" );
aControl = SMESH_Actor::eFreeNodes;
break;
case 6019:
aTitle = QObject::tr( "MULTI2D_BORDERS" );
aControl = SMESH_Actor::eMultiConnection2D;
@ -807,6 +811,10 @@
aTitle = QObject::tr( "SMESH_VOLUME" );
aControl = SMESH_Actor::eVolume3D;
break;
case 6021:
aTitle = QObject::tr( "FREE_FACES" );
aControl = SMESH_Actor::eFreeFaces;
break;
}
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
@ -1061,6 +1069,11 @@ SalomeApp_Module( "SMESH" )
{
CORBA::Boolean anIsEmbeddedMode;
myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
// 0019923: EDF 765 SMESH : default values of hypothesis
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation" );
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
}
myActiveDialogBox = 0;
@ -1564,21 +1577,17 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
case 701: // COMPUTE MESH
case 711: // PRECOMPUTE MESH
{
if (checkLock(aStudy)) break;
startOperation( 701 );
startOperation( theCommandID );
}
break;
case 702: // Create mesh
startOperation( 702 );
break;
case 703: // Create sub-mesh
startOperation( 703 );
break;
case 702: // Create mesh
case 703: // Create sub-mesh
case 704: // Edit mesh/sub-mesh
startOperation( 704 );
startOperation( theCommandID );
break;
case 710: // Build compound mesh
{
@ -1880,6 +1889,36 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case 815: // Edit GEOM GROUP as standalone
{
if ( !vtkwnd )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
tr( "NOT_A_VTK_VIEWER" ) );
break;
}
if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
SALOME_ListIteratorOfListIO It (selected);
for ( ; It.More(); It.Next() )
{
SMESH::SMESH_GroupOnGeom_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupOnGeom>(It.Value());
if (!aGroup->_is_nil()) {
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup, true );
aDlg->show();
}
}
break;
}
case 810: // Union Groups
case 811: // Intersect groups
case 812: // Cut groups
@ -1896,12 +1935,28 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
EmitSignalDeactivateDialog();
int aMode;
if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
else aMode = SMESHGUI_GroupOpDlg::CUT;
SMESHGUI_GroupOpDlg* aDlg = 0;
if ( theCommandID == 810 )
aDlg = new SMESHGUI_UnionGroupsDlg( this );
else if ( theCommandID == 811 )
aDlg = new SMESHGUI_IntersectGroupsDlg( this );
else
aDlg = new SMESHGUI_CutGroupsDlg( this );
aDlg->show();
break;
}
case 814: // Create groups of entities from existing groups of superior dimensions
{
if ( checkLock( aStudy ) )
break;
EmitSignalDeactivateDialog();
SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
aDlg->show();
( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
break;
}
@ -2022,7 +2077,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if( aSel )
aSel->selectedObjects( selected );
bool isAny = false; // iss there any appropriate object selected
bool isAny = false; // is there any appropriate object selected
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() )
@ -2050,14 +2105,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
newName = LightApp_NameDlg::getName(desktop(), newName);
if ( !newName.isEmpty() )
{
//old source: aStudy->renameIObject( IObject, newName );
aName->SetValue( newName.toLatin1().constData() );
// if current object is group update group's name
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if (!aGroup->_is_nil() )
aGroup->SetName( newName.toLatin1().constData() );
SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data());
updateObjBrowser();
}
@ -2390,7 +2438,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 6002:
case 6003:
case 6004:
case 6005:
case 6009:
case 6021:
if ( vtkwnd ) {
LightApp_SelectionMgr* mgr = selectionMgr();
@ -2596,23 +2646,28 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" );
createSMESHAction( 806, "CREATE_GEO_GROUP","ICON_CREATE_GEO_GROUP" );
createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" );
createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
createSMESHAction( 815, "EDIT_GEOMGROUP_AS_GROUP", "ICON_EDIT_GROUP" );
createSMESHAction( 804, "ADD" );
createSMESHAction( 805, "REMOVE" );
createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
createSMESHAction( 814, "UNDERLYING_ELEMS","ICON_UNDERLYING_ELEMS" );
createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" );
createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true );
createSMESHAction( 6021, "FREE_FACES", "ICON_FREE_FACES", 0, true );
createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true );
createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true );
createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true );
createSMESHAction( 6011, "AREA", "ICON_AREA", 0, true );
createSMESHAction( 6012, "TAPER", "ICON_TAPER", 0, true );
createSMESHAction( 6013, "ASPECT", "ICON_ASPECT", 0, true );
@ -2731,16 +2786,20 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 710, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 701, meshId, -1 );
createMenu( 711, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 801, meshId, -1 );
createMenu( 806, meshId, -1 );
createMenu( 802, meshId, -1 );
createMenu( 803, meshId, -1 );
createMenu( 815, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 810, meshId, -1 );
createMenu( 811, meshId, -1 );
createMenu( 812, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 814, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 813, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 900, meshId, -1 );
@ -2752,6 +2811,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 6001, ctrlId, -1 );
createMenu( 6004, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 6005, ctrlId, -1 );
createMenu( 6002, ctrlId, -1 );
createMenu( 6018, ctrlId, -1 );
createMenu( 6019, ctrlId, -1 );
@ -2764,6 +2824,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( separator(), ctrlId, -1 );
createMenu( 6017, ctrlId, -1 );
createMenu( 6009, ctrlId, -1 );
createMenu( 6021, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 400, addId, -1 );
@ -2826,11 +2887,13 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 710, meshTb );
createTool( separator(), meshTb );
createTool( 701, meshTb );
createTool( 711, meshTb );
createTool( separator(), meshTb );
createTool( 801, meshTb );
createTool( 806, meshTb );
createTool( 802, meshTb );
createTool( 803, meshTb );
//createTool( 815, meshTb );
createTool( separator(), meshTb );
createTool( 900, meshTb );
createTool( 902, meshTb );
@ -2841,6 +2904,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 6003, ctrlTb );
createTool( 6004, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 6005, ctrlTb );
createTool( 6002, ctrlTb );
createTool( 6018, ctrlTb );
createTool( 6019, ctrlTb );
@ -2853,6 +2917,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( separator(), ctrlTb );
createTool( 6017, ctrlTb );
createTool( 6009, ctrlTb );
createTool( 6021, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 400, addRemTb );
@ -2929,12 +2994,15 @@ void SMESHGUI::initialize( CAM_Application* app )
createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH
createPopupItem( 703, OB, subMesh, "&& isComputable" ); // CREATE_SUBMESH
//createPopupItem( 703, OB, subMesh, "&& isComputable" ); // CREATE_SUBMESH
createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH
createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH
createPopupItem( 803, OB, group ); // EDIT_GROUP
createPopupItem( 815, OB, group, "&& groupType = 'GroupOnGeom'" ); // EDIT_GROUP
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
createPopupItem( 711, OB, mesh, "&& isComputable" ); // PRECOMPUTE
createPopupItem( 214, OB, mesh_group ); // UPDATE
createPopupItem( 900, OB, mesh_group ); // ADV_INFO
createPopupItem( 902, OB, mesh ); // STD_INFO
@ -2964,6 +3032,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createPopupItem( 803, View, group ); // EDIT_GROUP
createPopupItem( 804, View, elems ); // ADD
createPopupItem( 805, View, elems ); // REMOVE
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 214, View, mesh_group ); // UPDATE
createPopupItem( 900, View, mesh_group ); // ADV_INFO
@ -3091,6 +3160,7 @@ void SMESHGUI::initialize( CAM_Application* app )
// Controls
//-------------------------------------------------
QString
aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes,
aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
@ -3116,8 +3186,12 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6005 ), anId, -1 ); // FREE_NODE
popupMgr()->setRule( action( 6005 ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6005 ), "controlMode = 'eFreeNodes'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6002 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
@ -3162,6 +3236,11 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6021 ), anId, -1 ); // FREE_FACE
popupMgr()->setRule( action( 6021 ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/,
QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6021 ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
@ -3330,6 +3409,7 @@ void SMESHGUI::onViewManagerActivated( SUIT_ViewManager* mgr )
void SMESHGUI::createPreferences()
{
// General tab ------------------------------------------------------------------------
int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
int updateGroup = addPreference( tr( "PREF_GROUP_UPDATE" ), genTab );
@ -3378,6 +3458,14 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( notifyMode, "strings", modes );
setPreferenceProperty( notifyMode, "indexes", indices );
int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
setPreferenceProperty( segGroup, "columns", 2 );
int segLen = addPreference( tr( "PREF_SEGMENT_LENGTH" ), segGroup, LightApp_Preferences::IntSpin,
"SMESH", "segmentation" );
setPreferenceProperty( segLen, "min", 1 );
setPreferenceProperty( segLen, "max", 10000000 );
// Mesh tab ------------------------------------------------------------------------
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
setPreferenceProperty( nodeGroup, "columns", 2 );
@ -3420,6 +3508,7 @@ void SMESHGUI::createPreferences()
addPreference( tr( "PREF_ORIENTATION_3D_VECTORS" ), orientGroup, LightApp_Preferences::Bool, "SMESH", "orientation_3d_vectors" );
// Selection tab ------------------------------------------------------------------------
int selTab = addPreference( tr( "PREF_TAB_SELECTION" ) );
int selGroup = addPreference( tr( "PREF_GROUP_SELECTION" ), selTab );
@ -3448,28 +3537,17 @@ void SMESHGUI::createPreferences()
addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
// Scalar Bar tab ------------------------------------------------------------------------
int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
setPreferenceProperty( fontGr, "columns", 2 );
int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" );
addVtkFontPref( tr( "SMESH_TITLE" ), fontGr, "scalar_bar_title_font" );
addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" );
addVtkFontPref( tr( "SMESH_LABELS" ), fontGr, "scalar_bar_label_font" );
addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
QStringList fam;
fam.append( tr( "SMESH_FONT_ARIAL" ) );
fam.append( tr( "SMESH_FONT_COURIER" ) );
fam.append( tr( "SMESH_FONT_TIMES" ) );
int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting );
setPreferenceProperty( tfont, "families", fam );
setPreferenceProperty( tfont, "system", false );
setPreferenceProperty( tfont, "widget_flags", wflag );
setPreferenceProperty( lfont, "families", fam );
setPreferenceProperty( lfont, "system", false );
setPreferenceProperty( lfont, "widget_flags", wflag );
int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
setPreferenceProperty( colorsLabelsGr, "columns", 2 );
@ -3535,7 +3613,7 @@ void SMESHGUI::createPreferences()
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
{
if( sect=="SMESH" ){
if( sect=="SMESH" ) {
float sbX1,sbY1,sbW,sbH;
float aTol = 1.00000009999999;
std::string aWarning;
@ -3551,7 +3629,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Vertical: X+Width > 1\n";
sbX1=0.01;
sbW=0.05;
sbW=0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
}
@ -3570,8 +3648,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.01;
sbW=0.05;
sbX1=0.1;
sbW=0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
}
@ -3582,11 +3660,15 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
if(sbY1+sbH > aTol){
aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01;
sbH=0.05;
sbH=0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
}
}
else if ( name == "segmentation" ) {
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation" );
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
}
if(aWarning.size() != 0){
aWarning += "The default values are applied instead.";
@ -3672,6 +3754,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
case 704: // Edit mesh/sub-mesh
op = new SMESHGUI_MeshOp( false );
break;
case 711: // Precompute mesh
op = new SMESHGUI_PrecomputeOp();
break;
case 806: // Create group on geom
op = new SMESHGUI_GroupOnShapeOp();
break;
@ -4175,3 +4260,35 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
}
}
}
/*!
\brief Adds preferences for dfont of VTK viewer
\param label label
\param pIf group identifier
\param param parameter
\return identifier of preferences
*/
int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
{
int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
QStringList fam;
fam.append( tr( "SMESH_FONT_ARIAL" ) );
fam.append( tr( "SMESH_FONT_COURIER" ) );
fam.append( tr( "SMESH_FONT_TIMES" ) );
setPreferenceProperty( tfont, "fonts", fam );
int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
setPreferenceProperty( tfont, "features", f );
return tfont;
}

View File

@ -149,6 +149,9 @@ protected:
private:
void OnEditDelete();
int addVtkFontPref( const QString& label,
const int pId,
const QString& param );
private :
static SMESH::SMESH_Gen_var myComponentSMESH;

View File

@ -51,8 +51,10 @@
#include <SUIT_OverrideCursor.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
#include <QtxComboBox.h>
// SALOME KERNEL includes
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDSClient_SObject.hxx>
// OCCT includes
@ -85,10 +87,6 @@
// VTK includes
#include <vtkProperty.h>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen)
// STL includes
#include <vector>
#include <set>
@ -791,7 +789,8 @@ void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh)
*/
//=======================================================================
SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, Close/* | Help*/ )
SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg( QWidget* parent )
: SMESHGUI_Dialog( parent, false, true, Close/* | Help*/ )
{
QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
aDlgLay->setMargin( 0 );
@ -804,6 +803,16 @@ SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, Clo
aDlgLay->setStretchFactor(aMainFrame, 1);
}
// =========================================================================================
/*!
* \brief Destructor
*/
//=======================================================================
SMESHGUI_ComputeDlg::~SMESHGUI_ComputeDlg()
{
}
//=======================================================================
// function : createMainFrame()
// purpose : Create frame containing dialog's fields
@ -921,37 +930,33 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent)
*/
//================================================================================
SMESHGUI_ComputeOp::SMESHGUI_ComputeOp()
SMESHGUI_BaseComputeOp::SMESHGUI_BaseComputeOp()
: SMESHGUI_Operation(),
myCompDlg( 0 )
{
myDlg = new SMESHGUI_ComputeDlg;
myTShapeDisplayer = new SMESH::TShapeDisplayer();
myBadMeshDisplayer = 0;
//myHelpFileName = "/files/about_meshes.htm"; // V3
myHelpFileName = "about_meshes_page.html"; // V4
// connect signals and slots
connect(myDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape()));
connect(myDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape()));
connect(myDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh()));
connect(table(), SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged()));
connect(table(), SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged()));
}
//=======================================================================
// function : startOperation()
// purpose : Init dialog fields, connect signals and slots, show dialog
//=======================================================================
//================================================================================
/*!
* \brief Start operation
* \purpose Init dialog fields, connect signals and slots, show dialog
*/
//================================================================================
void SMESHGUI_ComputeOp::startOperation()
void SMESHGUI_BaseComputeOp::startOperation()
{
SMESHGUI_Operation::startOperation();
// check selection
// create compute dialog if not created before
computeDlg();
myMesh = SMESH::SMESH_Mesh::_nil();
myMainShape = GEOM::GEOM_Object::_nil();
// check selection
LightApp_SelectionMgr *Sel = selectionMgr();
SALOME_ListIO selected; Sel->selectedObjects( selected );
@ -964,16 +969,28 @@ void SMESHGUI_ComputeOp::startOperation()
return;
}
Handle(SALOME_InteractiveObject) IObject = selected.First();
myMesh = SMESH::GetMeshByIO(IObject);
myIObject = selected.First();
myMesh = SMESH::GetMeshByIO(myIObject);
if (myMesh->_is_nil()) {
SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
onCancel();
return;
}
}
myMainShape = myMesh->GetShapeToMesh();
SMESHGUI_Operation::startOperation();
}
//================================================================================
/*!
* \brief computeMesh()
*/
//================================================================================
void SMESHGUI_BaseComputeOp::computeMesh()
{
// COMPUTE MESH
SMESH::MemoryReserve aMemoryReserve;
@ -984,12 +1001,11 @@ void SMESHGUI_ComputeOp::startOperation()
bool computeFailed = true, memoryLack = false;
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
myMainShape = myMesh->GetShapeToMesh();
bool hasShape = myMesh->HasShapeToMesh();
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
if ( shapeOK && aMeshSObj )
{
myDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
if ( errors->length() > 0 ) {
@ -1032,7 +1048,7 @@ void SMESHGUI_ComputeOp::startOperation()
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
SMESH::Update(IObject, true);
SMESH::Update(myIObject, true);
}
catch (...) {
#ifdef _DEBUG_
@ -1046,77 +1062,119 @@ void SMESHGUI_ComputeOp::startOperation()
}
}
}
Sel->setSelectedObjects( selected );
LightApp_SelectionMgr *Sel = selectionMgr();
if ( Sel )
{
SALOME_ListIO selected;
selected.Append( myIObject );
Sel->setSelectedObjects( selected );
}
}
}
if ( memoryLack )
aMemoryReserve.release();
myDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
myDlg->myMemoryLackGroup->hide();
myCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
// SHOW ERRORS
bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
bool noHypoError = ( aHypErrors.isEmpty() );
if ( memoryLack )
{
myDlg->myMemoryLackGroup->show();
myDlg->myFullInfo->hide();
myDlg->myBriefInfo->hide();
myDlg->myHypErrorGroup->hide();
myDlg->myCompErrorGroup->hide();
SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
int aNotifyMode = resMgr->integerValue( "SMESH", "show_result_notification" );
bool isShowResultDlg = true;
switch( aNotifyMode ) {
case 0: // show the mesh computation result dialog NEVER
isShowResultDlg = false;
commit();
break;
case 1: // show the mesh computation result dialog if there are some errors
if ( memoryLack || !noCompError || !noHypoError )
isShowResultDlg = true;
else
{
isShowResultDlg = false;
commit();
}
break;
default: // show the result dialog after each mesh computation
isShowResultDlg = true;
}
else if ( noCompError && noHypoError )
// SHOW RESULTS
if ( isShowResultDlg )
showComputeResult( memoryLack, noCompError,aCompErrors, noHypoError, aHypErrors );
}
void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
const bool theNoCompError,
SMESH::compute_error_array_var& theCompErrors,
const bool theNoHypoError,
const QString& theHypErrors )
{
bool hasShape = myMesh->HasShapeToMesh();
SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
aCompDlg->myMemoryLackGroup->hide();
if ( theMemoryLack )
{
myDlg->myFullInfo->SetInfoByMesh( myMesh );
myDlg->myFullInfo->show();
myDlg->myBriefInfo->hide();
myDlg->myHypErrorGroup->hide();
myDlg->myCompErrorGroup->hide();
aCompDlg->myMemoryLackGroup->show();
aCompDlg->myFullInfo->hide();
aCompDlg->myBriefInfo->hide();
aCompDlg->myHypErrorGroup->hide();
aCompDlg->myCompErrorGroup->hide();
}
else if ( theNoCompError && theNoHypoError )
{
aCompDlg->myFullInfo->SetInfoByMesh( myMesh );
aCompDlg->myFullInfo->show();
aCompDlg->myBriefInfo->hide();
aCompDlg->myHypErrorGroup->hide();
aCompDlg->myCompErrorGroup->hide();
}
else
{
QTableWidget* tbl = myDlg->myTable;
myDlg->myBriefInfo->SetInfoByMesh( myMesh );
myDlg->myBriefInfo->show();
myDlg->myFullInfo->hide();
QTableWidget* tbl = aCompDlg->myTable;
aCompDlg->myBriefInfo->SetInfoByMesh( myMesh );
aCompDlg->myBriefInfo->show();
aCompDlg->myFullInfo->hide();
if ( noHypoError ) {
myDlg->myHypErrorGroup->hide();
if ( theNoHypoError ) {
aCompDlg->myHypErrorGroup->hide();
}
else {
myDlg->myHypErrorGroup->show();
myDlg->myHypErrorLabel->setText( aHypErrors );
aCompDlg->myHypErrorGroup->show();
aCompDlg->myHypErrorLabel->setText( theHypErrors );
}
if ( noCompError ) {
myDlg->myCompErrorGroup->hide();
if ( theNoCompError ) {
aCompDlg->myCompErrorGroup->hide();
}
else {
myDlg->myCompErrorGroup->show();
aCompDlg->myCompErrorGroup->show();
if ( !hasShape ) {
myDlg->myPublishBtn->hide();
myDlg->myShowBtn->hide();
aCompDlg->myPublishBtn->hide();
aCompDlg->myShowBtn->hide();
}
else {
myDlg->myPublishBtn->show();
myDlg->myShowBtn->show();
aCompDlg->myPublishBtn->show();
aCompDlg->myShowBtn->show();
}
// fill table of errors
tbl->setRowCount( aCompErrors->length() );
tbl->setRowCount( theCompErrors->length() );
if ( !hasShape ) tbl->hideColumn( COL_SHAPE );
else tbl->showColumn( COL_SHAPE );
tbl->setColumnWidth( COL_ERROR, 200 );
bool hasBadMesh = false;
for ( int row = 0; row < aCompErrors->length(); ++row )
for ( int row = 0; row < theCompErrors->length(); ++row )
{
SMESH::ComputeError & err = aCompErrors[ row ];
SMESH::ComputeError & err = theCompErrors[ row ];
QString text = err.algoName.in();
if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
@ -1150,31 +1208,16 @@ void SMESHGUI_ComputeOp::startOperation()
tbl->resizeColumnToContents( COL_SHAPE );
if ( hasBadMesh )
myDlg->myBadMeshBtn->show();
aCompDlg->myBadMeshBtn->show();
else
myDlg->myBadMeshBtn->hide();
aCompDlg->myBadMeshBtn->hide();
tbl->setCurrentCell(0,0);
currentCellChanged(); // to update buttons
}
}
SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
int aNotifyMode = resMgr->integerValue( "SMESH", "show_result_notification" );
switch( aNotifyMode ) {
case 0: // show the mesh computation result dialog NEVER
commit();
break;
case 1: // show the mesh computation result dialog if there are some errors
if ( memoryLack || !noCompError || !noHypoError )
myDlg->show();
else
commit();
break;
default: // show the result dialog after each mesh computation
myDlg->show();
}
// show dialog and wait, becase Compute can be invoked from Preview operation
aCompDlg->exec();
}
//================================================================================
@ -1183,10 +1226,11 @@ void SMESHGUI_ComputeOp::startOperation()
*/
//================================================================================
void SMESHGUI_ComputeOp::stopOperation()
void SMESHGUI_BaseComputeOp::stopOperation()
{
SMESHGUI_Operation::stopOperation();
myTShapeDisplayer->SetVisibility( false );
if ( myTShapeDisplayer )
myTShapeDisplayer->SetVisibility( false );
if ( myBadMeshDisplayer ) {
myBadMeshDisplayer->SetVisibility( false );
// delete it in order not to have problems at its destruction when the viewer
@ -1194,6 +1238,7 @@ void SMESHGUI_ComputeOp::stopOperation()
delete myBadMeshDisplayer;
myBadMeshDisplayer = 0;
}
myIObject.Nullify();
}
//================================================================================
@ -1202,7 +1247,7 @@ void SMESHGUI_ComputeOp::stopOperation()
*/
//================================================================================
void SMESHGUI_ComputeOp::onPublishShape()
void SMESHGUI_BaseComputeOp::onPublishShape()
{
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
@ -1251,7 +1296,7 @@ void SMESHGUI_ComputeOp::onPublishShape()
*/
//================================================================================
void SMESHGUI_ComputeOp::onShowBadMesh()
void SMESHGUI_BaseComputeOp::onShowBadMesh()
{
myTShapeDisplayer->SetVisibility( false );
QList<int> rows;
@ -1284,7 +1329,7 @@ void SMESHGUI_ComputeOp::onShowBadMesh()
*/
//================================================================================
void SMESHGUI_ComputeOp::currentCellChanged()
void SMESHGUI_BaseComputeOp::currentCellChanged()
{
myTShapeDisplayer->SetVisibility( false );
if ( myBadMeshDisplayer )
@ -1314,9 +1359,9 @@ void SMESHGUI_ComputeOp::currentCellChanged()
if ( !table()->item(row, COL_BAD_MESH)->text().isEmpty() )
hasBadMesh = true;
}
myDlg->myPublishBtn->setEnabled( publishEnable );
myDlg->myShowBtn ->setEnabled( showEnable );
myDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 ));
myCompDlg->myPublishBtn->setEnabled( publishEnable );
myCompDlg->myShowBtn ->setEnabled( showEnable );
myCompDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 ));
}
//================================================================================
@ -1325,7 +1370,7 @@ void SMESHGUI_ComputeOp::currentCellChanged()
*/
//================================================================================
void SMESHGUI_ComputeOp::onPreviewShape()
void SMESHGUI_BaseComputeOp::onPreviewShape()
{
if ( myTShapeDisplayer )
{
@ -1353,8 +1398,10 @@ void SMESHGUI_ComputeOp::onPreviewShape()
*/
//================================================================================
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
SMESHGUI_BaseComputeOp::~SMESHGUI_BaseComputeOp()
{
delete myCompDlg;
myCompDlg = 0;
delete myTShapeDisplayer;
if ( myBadMeshDisplayer )
delete myBadMeshDisplayer;
@ -1362,14 +1409,73 @@ SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
//================================================================================
/*!
* \brief Gets dialog of this operation
* \retval LightApp_Dialog* - pointer to dialog of this operation
* \brief Gets dialog of compute operation
* \retval SMESHGUI_ComputeDlg* - pointer to dialog of this operation
*/
//================================================================================
LightApp_Dialog* SMESHGUI_ComputeOp::dlg() const
SMESHGUI_ComputeDlg* SMESHGUI_BaseComputeOp::computeDlg() const
{
return myDlg;
if ( !myCompDlg )
{
SMESHGUI_BaseComputeOp* me = (SMESHGUI_BaseComputeOp*)this;
me->myCompDlg = new SMESHGUI_ComputeDlg( desktop() );
// connect signals and slots
connect(myCompDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape()));
connect(myCompDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape()));
connect(myCompDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh()));
QTableWidget* aTable = me->table();
connect(aTable, SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged()));
connect(aTable, SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged()));
}
return myCompDlg;
}
//================================================================================
/*!
* \brief Return a table
*/
//================================================================================
QTableWidget* SMESHGUI_BaseComputeOp::table()
{
return myCompDlg->myTable;
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
SMESHGUI_ComputeOp::SMESHGUI_ComputeOp()
: SMESHGUI_BaseComputeOp()
{
}
//================================================================================
/*!
* \brief Desctructor
*/
//================================================================================
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
{
}
//================================================================================
/*!
* \brief perform it's intention action: compute mesh
*/
//================================================================================
void SMESHGUI_ComputeOp::startOperation()
{
SMESHGUI_BaseComputeOp::startOperation();
computeMesh();
}
//================================================================================
@ -1385,11 +1491,422 @@ bool SMESHGUI_ComputeOp::onApply()
//================================================================================
/*!
* \brief Return a table
* \brief Gets dialog of this operation
* \retval LightApp_Dialog* - pointer to dialog of this operation
*/
//================================================================================
QTableWidget* SMESHGUI_ComputeOp::table()
LightApp_Dialog* SMESHGUI_ComputeOp::dlg() const
{
return myDlg->myTable;
return computeDlg();
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
SMESHGUI_PrecomputeOp::SMESHGUI_PrecomputeOp()
: SMESHGUI_BaseComputeOp(),
myDlg( 0 ),
myActiveDlg( 0 ),
myPreviewDisplayer( 0 )
{
myHelpFileName = "preview_meshes_page.html"; // V4
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
SMESHGUI_PrecomputeOp::~SMESHGUI_PrecomputeOp()
{
delete myDlg;
myDlg = 0;
myActiveDlg = 0;
if ( myPreviewDisplayer )
delete myPreviewDisplayer;
myPreviewDisplayer = 0;
}
//================================================================================
/*!
* \brief Gets current dialog of this operation
* \retval LightApp_Dialog* - pointer to dialog of this operation
*/
//================================================================================
LightApp_Dialog* SMESHGUI_PrecomputeOp::dlg() const
{
return myActiveDlg;
}
//================================================================================
/*!
* \brief perform it's intention action: prepare data
*/
//================================================================================
void SMESHGUI_PrecomputeOp::startOperation()
{
if ( !myDlg )
{
myDlg = new SMESHGUI_PrecomputeDlg( desktop() );
// connect signals
connect( myDlg, SIGNAL( preview() ), this, SLOT( onPreview() ) );
}
myActiveDlg = myDlg;
// connect signal to compute dialog. which will be shown after Compute mesh operation
SMESHGUI_ComputeDlg* cmpDlg = computeDlg();
if ( cmpDlg )
{
// disconnect signals
disconnect( cmpDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
disconnect( cmpDlg, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
disconnect( cmpDlg, SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );
disconnect( cmpDlg, SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
disconnect( cmpDlg, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
// connect signals
if( cmpDlg->testButtonFlags( QtxDialog::OK ) )
connect( cmpDlg, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
if( cmpDlg->testButtonFlags( QtxDialog::Apply ) )
connect( cmpDlg, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
if( cmpDlg->testButtonFlags( QtxDialog::Help ) )
connect( cmpDlg, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
if( cmpDlg->testButtonFlags( QtxDialog::Cancel ) )
connect( cmpDlg, SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );
if( cmpDlg->testButtonFlags( QtxDialog::Close ) )
connect( cmpDlg, SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
}
SMESHGUI_BaseComputeOp::startOperation();
myDlg->show();
}
//================================================================================
/*!
* \brief Stops operation
*/
//================================================================================
void SMESHGUI_PrecomputeOp::stopOperation()
{
if ( myPreviewDisplayer )
{
myPreviewDisplayer->SetVisibility( false );
delete myPreviewDisplayer;
myPreviewDisplayer = 0;
}
myMapShapeId.clear();
SMESHGUI_BaseComputeOp::stopOperation();
}
//================================================================================
/*!
* \brief perform it's intention action: reinitialise dialog
*/
//================================================================================
void SMESHGUI_PrecomputeOp::resumeOperation()
{
if ( myActiveDlg == myDlg )
initDialog();
SMESHGUI_BaseComputeOp::resumeOperation();
}
void SMESHGUI_PrecomputeOp::initDialog()
{
QList<int> modes;
QMap<int, int> modeMap;
_PTR(SObject) aHypRoot;
_PTR(GenericAttribute) anAttr;
int aPart = SMESH::Tag_RefOnAppliedAlgorithms;
_PTR(SObject) pMesh = studyDS()->FindObjectID( myIObject->getEntry() );
if ( pMesh && pMesh->FindSubObject( aPart, aHypRoot ) )
{
_PTR(ChildIterator) anIter =
SMESH::GetActiveStudyDocument()->NewChildIterator( aHypRoot );
for ( ; anIter->More(); anIter->Next() )
{
_PTR(SObject) anObj = anIter->Value();
_PTR(SObject) aRefObj;
if ( anObj->ReferencedObject( aRefObj ) )
anObj = aRefObj;
else
continue;
if ( anObj->FindAttribute( anAttr, "AttributeName" ) )
{
CORBA::Object_var aVar = _CAST(SObject,anObj)->GetObject();
if ( CORBA::is_nil( aVar ) )
continue;
SMESH::SMESH_Algo_var algo = SMESH::SMESH_3D_Algo::_narrow( aVar );
if ( !algo->_is_nil() )
{
modeMap[ SMESH::DIM_1D ] = 0;
modeMap[ SMESH::DIM_2D ] = 0;
}
else
{
algo = SMESH::SMESH_2D_Algo::_narrow( aVar );
if ( !algo->_is_nil() )
modeMap[ SMESH::DIM_2D ] = 0;
}
}
}
}
if ( modeMap.contains( SMESH::DIM_1D ) )
modes.append( SMESH::DIM_1D );
if ( modeMap.contains( SMESH::DIM_2D ) )
modes.append( SMESH::DIM_2D );
myDlg->setPreviewModes( modes );
}
//================================================================================
/*!
* \brief perform it's intention action:
*/
//================================================================================
bool SMESHGUI_PrecomputeOp::onApply()
{
QObject* obj = sender();
if ( obj != myDlg && myActiveDlg == myDlg )
return true; // just return from error messages
if ( myActiveDlg == myDlg )
{
myDlg->hide();
myMapShapeId.clear();
myActiveDlg = computeDlg();
computeMesh();
}
return true;
}
//================================================================================
/*!
* \brief perform it's intention action: compute mesh
*/
//================================================================================
void SMESHGUI_PrecomputeOp::onCancel()
{
QObject* curDlg = sender();
if ( curDlg == computeDlg() )
{
if ( myActiveDlg == myDlg ) // return from error messages
myDlg->show();
return;
}
if ( myActiveDlg == myDlg && !myMesh->_is_nil() && myMapShapeId.count() )
{
// ask to remove already computed mesh elements
if ( SUIT_MessageBox::question( desktop(), tr( "SMESH_WARNING" ),
tr( "CLEAR_SUBMESH_QUESTION" ),
tr( "SMESH_BUT_DELETE" ), tr( "SMESH_BUT_NO" ), 0, 1 ) == 0 )
{
// remove all submeshes for collected shapes
QMap<int,int>::const_iterator it = myMapShapeId.constBegin();
for ( ; it != myMapShapeId.constEnd(); ++it )
myMesh->ClearSubMesh( *it );
}
}
myMapShapeId.clear();
SMESHGUI_BaseComputeOp::onCancel();
}
//================================================================================
/*!
* \brief perform it's intention action: preview mesh
*/
//================================================================================
void SMESHGUI_PrecomputeOp::onPreview()
{
if ( !myDlg || myMesh->_is_nil() || myMainShape->_is_nil() )
return;
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
if ( !aMeshSObj )
return;
// Compute preview of mesh,
// i.e. compute mesh till indicated dimension
int dim = myDlg->getPreviewMode();
SMESH::MemoryReserve aMemoryReserve;
SMESH::compute_error_array_var aCompErrors;
QString aHypErrors;
bool computeFailed = true, memoryLack = false;
SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
aCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESHGUI* gui = getSMESHGUI();
SMESH::SMESH_Gen_var gen = gui->GetSMESHGen();
SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
if ( errors->length() > 0 ) {
aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() );
}
SUIT_OverrideCursor aWaitCursor;
SVTK_ViewWindow* view = SMESH::GetViewWindow( gui );
if ( myPreviewDisplayer ) delete myPreviewDisplayer;
myPreviewDisplayer = new SMESHGUI_MeshEditPreview( view );
SMESH::long_array_var aShapesId = new SMESH::long_array();
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
SMESH::MeshPreviewStruct_var previewData =
gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId);
SMESH::MeshPreviewStruct* previewRes = previewData._retn();
if ( previewRes && previewRes->nodesXYZ.length() > 0 )
{
computeFailed = false;
myPreviewDisplayer->SetData( previewRes );
// append shape indeces with computed mesh entities
for ( int i = 0, n = aShapesId->length(); i < n; i++ )
myMapShapeId[ aShapesId[ i ] ] = 0;
}
else
myPreviewDisplayer->SetVisibility(false);
}
catch(const SALOME::SALOME_Exception & S_ex){
memoryLack = true;
myPreviewDisplayer->SetVisibility(false);
}
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
catch(const SALOME::SALOME_Exception & S_ex){
memoryLack = true;
}
if ( memoryLack )
aMemoryReserve.release();
bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
bool noHypoError = ( aHypErrors.isEmpty() );
SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( gui );
int aNotifyMode = resMgr->integerValue( "SMESH", "show_result_notification" );
bool isShowError = true;
switch( aNotifyMode ) {
case 0: // show the mesh computation result dialog NEVER
isShowError = false;
break;
case 1: // show the mesh computation result dialog if there are some errors
default: // show the result dialog after each mesh computation
if ( !computeFailed && !memoryLack && noCompError && noHypoError )
isShowError = false;
break;
}
aWaitCursor.suspend();
// SHOW ERRORS
if ( isShowError )
{
myDlg->hide();
aCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
showComputeResult( memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors );
}
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
SMESHGUI_PrecomputeDlg::SMESHGUI_PrecomputeDlg( QWidget* parent )
: SMESHGUI_Dialog( parent, false, false, OK | Cancel | Help )
{
setWindowTitle( tr( "CAPTION" ) );
setButtonText( OK, tr( "COMPUTE" ) );
QFrame* main = mainFrame();
QVBoxLayout* layout = new QVBoxLayout( main );
QFrame* frame = new QFrame( main );
layout->setMargin(0); layout->setSpacing(0);
layout->addWidget( frame );
QHBoxLayout* frameLay = new QHBoxLayout( frame );
frameLay->setMargin(0); frameLay->setSpacing(SPACING);
myPreviewMode = new QtxComboBox( frame );
frameLay->addWidget( myPreviewMode );
myPreviewBtn = new QPushButton( tr( "PREVIEW" ), frame );
frameLay->addWidget( myPreviewBtn );
connect( myPreviewBtn, SIGNAL( clicked( bool ) ), this, SIGNAL( preview() ) );
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
SMESHGUI_PrecomputeDlg::~SMESHGUI_PrecomputeDlg()
{
}
//================================================================================
/*!
* \brief Sets available preview modes
*/
//================================================================================
void SMESHGUI_PrecomputeDlg::setPreviewModes( const QList<int>& theModes )
{
myPreviewMode->clear();
QList<int>::const_iterator it = theModes.constBegin();
for ( int i = 0; it != theModes.constEnd(); ++it, i++ )
{
QString mode = QString( "PREVIEW_%1" ).arg( *it );
myPreviewMode->addItem( tr( mode.toLatin1().data() ) );
myPreviewMode->setId( i, *it );
}
myPreviewBtn->setEnabled( !theModes.isEmpty() );
}
//================================================================================
/*!
* \brief Returns current preview mesh mode
*/
//================================================================================
int SMESHGUI_PrecomputeDlg::getPreviewMode() const
{
return myPreviewMode->currentId();
}

View File

@ -31,29 +31,82 @@
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_Operation.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
// Qt includes
#include <QMap>
#include <QPointer>
#include <QGroupBox>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QFrame;
class QPushButton;
class QTableWidget;
class QLabel;
class QtxComboBox;
class SMESHGUI_ComputeDlg;
class SMESHGUI_PrecomputeDlg;
class SMESHGUI_MeshEditPreview;
class SMESH::compute_error_array;
namespace SMESH
{
class TShapeDisplayer;
}
/*!
* \brief Base operation to compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
{
Q_OBJECT
public:
SMESHGUI_BaseComputeOp();
virtual ~SMESHGUI_BaseComputeOp();
protected:
virtual void startOperation();
virtual void stopOperation();
SMESHGUI_ComputeDlg* computeDlg() const;
void computeMesh();
void showComputeResult( const bool,
const bool,
SMESH::compute_error_array_var&,
const bool,
const QString& );
protected slots:
void onPreviewShape();
void onPublishShape();
void onShowBadMesh();
void currentCellChanged();
private:
QTableWidget* table();
private:
QPointer<SMESHGUI_ComputeDlg> myCompDlg;
protected:
SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMainShape;
SMESH::TShapeDisplayer* myTShapeDisplayer;
SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
Handle(SALOME_InteractiveObject) myIObject;
};
/*!
* \brief Operation to compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_Operation
class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
{
Q_OBJECT
@ -65,26 +118,43 @@ public:
protected:
virtual void startOperation();
virtual void stopOperation();
protected slots:
virtual bool onApply();
};
/*!
* \brief Operation to preview and compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
{
Q_OBJECT
public:
SMESHGUI_PrecomputeOp();
virtual ~SMESHGUI_PrecomputeOp();
virtual LightApp_Dialog* dlg() const;
protected:
virtual void startOperation();
virtual void stopOperation();
virtual void resumeOperation();
virtual void initDialog();
protected slots:
virtual bool onApply();
virtual void onCancel();
private slots:
void onPreviewShape();
void onPublishShape();
void onShowBadMesh();
void currentCellChanged();
void onPreview();
private:
QTableWidget* table();
SMESHGUI_ComputeDlg* myDlg;
SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMainShape;
SMESH::TShapeDisplayer* myTShapeDisplayer;
SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
QMap< int, int > myMapShapeId;
QPointer<LightApp_Dialog> myActiveDlg;
QPointer<SMESHGUI_PrecomputeDlg> myDlg;
SMESHGUI_MeshEditPreview* myPreviewDisplayer;
};
/*!
@ -143,9 +213,10 @@ class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
Q_OBJECT
public:
SMESHGUI_ComputeDlg();
SMESHGUI_ComputeDlg( QWidget* );
virtual ~SMESHGUI_ComputeDlg();
private:
protected:
QFrame* createMainFrame( QWidget* );
QLabel* myMeshName;
@ -161,7 +232,32 @@ private:
SMESHGUI_MeshInfosBox* myBriefInfo;
SMESHGUI_MeshInfosBox* myFullInfo;
friend class SMESHGUI_ComputeOp;
friend class SMESHGUI_BaseComputeOp;
friend class SMESHGUI_PrecomputeOp;
};
/*!
* \brief Dialog to preview and compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_PrecomputeDlg( QWidget* );
virtual ~SMESHGUI_PrecomputeDlg();
void setPreviewModes( const QList<int>& );
int getPreviewMode() const;
signals:
void preview();
private:
QPushButton* myPreviewBtn;
QtxComboBox* myPreviewMode;
};
#endif // SMESHGUI_COMPUTEDLG_H

View File

@ -32,6 +32,7 @@
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
@ -109,7 +110,8 @@ private:
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 )
{
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
@ -164,6 +166,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
ElementsLineEdit = new QLineEdit(GroupArguments);
ElementsLineEdit->setValidator(myIdValidator);
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Controls for the whole mesh selection
MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@ -272,11 +276,12 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(ElementsLineEdit, 0, 2);
GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 3);
GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 3);
GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 3);
GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 3);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 3);
GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4);
GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 4);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4);
/***************************************************************/
// common buttons group box
@ -382,6 +387,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
{
// no need to delete child widgets, Qt does it all for us
if ( myFilterDlg != 0 ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
}
}
//=================================================================================
@ -693,8 +702,11 @@ void SMESHGUI_ExtrusionAlongPathDlg::reject()
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
SMESH::SetPickable(); // ???
SMESH::SetPointRepresentation(false);
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
SMESH::SetPickable();
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
@ -1199,3 +1211,25 @@ void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
ClickOnHelp();
}
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_ExtrusionAlongPathDlg::setFilters()
{
if ( !myFilterDlg )
{
QList<int> types;
types.append( SMESH::EDGE );
types.append( SMESH::FACE );
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
}
myFilterDlg->Init( Elements1dRB->isChecked() ? SMESH::EDGE : SMESH::FACE );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( ElementsLineEdit );
myFilterDlg->show();
}

View File

@ -50,6 +50,7 @@ class SMESHGUI;
class SMESH_Actor;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
@ -134,6 +135,8 @@ private:
QString myHelpFileName;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots:
void reject();
@ -150,6 +153,7 @@ private slots:
void onSelectMesh();
void OnAngleAdded();
void OnAngleRemoved();
void setFilters();
};
#endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H

View File

@ -32,6 +32,7 @@
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
@ -55,6 +56,7 @@
// OCCT includes
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <gp_XYZ.hxx>
// Qt includes
#include <QApplication>
@ -86,7 +88,8 @@
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg( 0 )
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
@ -159,22 +162,39 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
// Controls for vector selection
//Control for the Distance selection
TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments);
TextLabelDx = new QLabel(tr("SMESH_X"), GroupArguments);
SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments);
TextLabelDy = new QLabel(tr("SMESH_Y"), GroupArguments);
SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments);
TextLabelDz = new QLabel(tr("SMESH_Z"), GroupArguments);
SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
// Controls for vector selection
SelectVectorButton = new QPushButton(GroupArguments);
SelectVectorButton->setIcon(image2);
TextLabelVx = new QLabel(tr("SMESH_DX"), GroupArguments);
SpinBox_Vx = new SMESHGUI_SpinBox(GroupArguments);
TextLabelVy = new QLabel(tr("SMESH_DY"), GroupArguments);
SpinBox_Vy = new SMESHGUI_SpinBox(GroupArguments);
TextLabelVz = new QLabel(tr("SMESH_DZ"), GroupArguments);
SpinBox_Vz = new SMESHGUI_SpinBox(GroupArguments);
// Controls for nb. steps defining
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
SpinBox_NbSteps = new QSpinBox(GroupArguments);
@ -184,18 +204,27 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
GroupArgumentsLayout->addWidget(filterBtn, 0, 7);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0);
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0);
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8);
GroupArgumentsLayout->addWidget(TextLabelVector, 3, 0);
GroupArgumentsLayout->addWidget(SelectVectorButton, 3, 1);
GroupArgumentsLayout->addWidget(TextLabelVx, 3, 2);
GroupArgumentsLayout->addWidget(SpinBox_Vx, 3, 3);
GroupArgumentsLayout->addWidget(TextLabelVy, 3, 4);
GroupArgumentsLayout->addWidget(SpinBox_Vy, 3, 5);
GroupArgumentsLayout->addWidget(TextLabelVz, 3, 6);
GroupArgumentsLayout->addWidget(SpinBox_Vz, 3, 7);
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 4, 0);
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2, 1, 6);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 8);
/***************************************************************/
SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
@ -203,10 +232,14 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
/* Initialisations */
SpinBox_Vx->RangeStepAndValidator(-1, 1, 0.01, 3);
SpinBox_Vy->RangeStepAndValidator(-1, 1, 0.01, 3);
SpinBox_Vz->RangeStepAndValidator(-1, 1, 0.01, 3);
SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
SpinBox_NbSteps->setRange(1, 999999);
RadioButton1->setChecked(true);
@ -239,12 +272,16 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
// to update state of the Ok & Apply buttons
connect(SpinBox_Vx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Vy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Vz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* to close dialog if study change */
@ -264,6 +301,10 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
//=================================================================================
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
{
if ( myFilterDlg != 0 ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
}
}
//=================================================================================
@ -285,6 +326,9 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
SpinBox_Dx->SetValue(0);
SpinBox_Dy->SetValue(0);
SpinBox_Dz->SetValue(0);
SpinBox_Vx->SetValue(0);
SpinBox_Vy->SetValue(0);
SpinBox_Vz->SetValue(0);
CheckBoxMesh->setChecked(false);
onSelectMesh(false);
@ -299,9 +343,10 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
//=================================================================================
void SMESHGUI_ExtrusionDlg::CheckIsEnable()
{
double aX = SpinBox_Dx->GetValue();
double aY = SpinBox_Dy->GetValue();
double aZ = SpinBox_Dz->GetValue();
double aX = SpinBox_Vx->GetValue()*SpinBox_Dx->GetValue();
double aY = SpinBox_Vy->GetValue()*SpinBox_Dy->GetValue();
double aZ = SpinBox_Vz->GetValue()*SpinBox_Dz->GetValue();
double aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
@ -341,7 +386,7 @@ void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
}
}
myEditCurrentArgument = LineEditElements;
myEditCurrentArgument = (QWidget*)LineEditElements;
LineEditElements->setFocus();
if (CheckBoxMesh->isChecked())
@ -360,11 +405,17 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
return false;
if (myNbOkElements) {
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
SpinBox_Vy->GetValue(),
SpinBox_Vz->GetValue());
aNormale /= aNormale.Modulus();
SMESH::DirStruct aVector;
aVector.PS.x = SpinBox_Dx->GetValue();
aVector.PS.y = SpinBox_Dy->GetValue();
aVector.PS.z = SpinBox_Dz->GetValue();
aVector.PS.x = SpinBox_Dx->GetValue()*aNormale.X();
aVector.PS.y = SpinBox_Dy->GetValue()*aNormale.Y();
aVector.PS.z = SpinBox_Dz->GetValue()*aNormale.Z();
long aNbSteps = (long)SpinBox_NbSteps->value();
@ -410,8 +461,11 @@ void SMESHGUI_ExtrusionDlg::ClickOnCancel()
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
SMESH::SetPickable(); // ???
SMESH::SetPointRepresentation(false);
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
SMESH::SetPickable();
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
@ -514,15 +568,15 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
// clear
myActor = 0;
myIO.Nullify();
QString aString = "";
// set busy flag
myBusy = true;
myEditCurrentArgument->setText(aString);
myNbOkElements = 0;
myBusy = false;
if(myEditCurrentArgument == (QWidget*)LineEditElements) {
myBusy = true;
LineEditElements->setText(aString);
myNbOkElements = 0;
myBusy = false;
}
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
@ -537,7 +591,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
myIO = IO;
myActor = SMESH::FindActorByObject(myMesh);
if (myEditCurrentArgument == LineEditElements) {
if (myEditCurrentArgument == (QWidget*)LineEditElements) {
int aNbElements = 0;
// MakeGroups is available if there are groups
@ -595,12 +649,32 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
return;
myNbOkElements = true;
myBusy = true;
((QLineEdit*)myEditCurrentArgument)->setText(aString);
myBusy = false;
}
else if(myEditCurrentArgument == (QWidget*)SpinBox_Vx){
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
int aNbElements = aMapIndex.Extent();
SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
myBusy = true;
myEditCurrentArgument->setText(aString);
myBusy = false;
if(aNbElements != 1 || !aMesh)
return;
const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(aNbElements)));
if (!face)
return;
gp_XYZ aNormale = SMESH::getNormale(face);
SpinBox_Vx->SetValue(aNormale.X());
SpinBox_Vy->SetValue(aNormale.Y());
SpinBox_Vz->SetValue(aNormale.Z());
}
// OK
CheckIsEnable();
}
@ -618,7 +692,7 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
mySelectionMgr->clearFilters();
if (send == SelectElementsButton) {
myEditCurrentArgument = LineEditElements;
myEditCurrentArgument = (QWidget*)LineEditElements;
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
@ -637,7 +711,12 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
}
}
}
else if (send == SelectVectorButton){
myEditCurrentArgument = (QWidget*)SpinBox_Vx;
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
}
myEditCurrentArgument->setFocus();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
@ -755,3 +834,25 @@ void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
ClickOnHelp();
}
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_ExtrusionDlg::setFilters()
{
if ( !myFilterDlg )
{
QList<int> types;
types.append( SMESH::EDGE );
types.append( SMESH::FACE );
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
}
myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}

View File

@ -52,6 +52,7 @@ class SMESHGUI;
class SMESH_Actor;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
@ -77,7 +78,7 @@ private:
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QWidget* myEditCurrentArgument; /* Current argument editor */
int myNbOkElements; /* to check when elements are defined */
SVTK_Selector* mySelector;
@ -100,12 +101,20 @@ private:
QLineEdit* LineEditElements;
QCheckBox* CheckBoxMesh;
QLabel* TextLabelVector;
QLabel* TextLabelDistance;
QPushButton* SelectVectorButton;
QLabel* TextLabelDx;
SMESHGUI_SpinBox* SpinBox_Dx;
QLabel* TextLabelDy;
SMESHGUI_SpinBox* SpinBox_Dy;
QLabel* TextLabelDz;
SMESHGUI_SpinBox* SpinBox_Dz;
QLabel* TextLabelVx;
SMESHGUI_SpinBox* SpinBox_Vx;
QLabel* TextLabelVy;
SMESHGUI_SpinBox* SpinBox_Vy;
QLabel* TextLabelVz;
SMESHGUI_SpinBox* SpinBox_Vz;
QLabel* TextLabelNbSteps;
QSpinBox* SpinBox_NbSteps;
QCheckBox* MakeGroupsCheck;
@ -118,6 +127,8 @@ private:
QString myHelpFileName;
SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ConstructorsClicked( int );
void CheckIsEnable();
@ -131,6 +142,7 @@ private slots:
void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh( bool );
void setFilters();
};
#endif // SMESHGUI_EXTRUSIONDLG_H

View File

@ -82,17 +82,18 @@ bool SMESHGUI_PredicateFilter::IsValid( const int theCellId ) const
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMESH::ElementType anElemType = myPred->GetElementType();
int aMeshId = anElemType == SMESH::NODE ? anActor->GetNodeObjId( theCellId )
: anActor->GetElemObjId( theCellId );
SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
int aMeshId = anElemType == SMDSAbs_Node ? anActor->GetNodeObjId( theCellId )
: anActor->GetElemObjId( theCellId );
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( aMeshId )
: aMesh->FindElement( aMeshId );
if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
return true;
const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( aMeshId )
: aMesh->FindElement( aMeshId );
// here we guess that predicate element type can not be All in case of node selection
if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
return false;
return myPred->IsSatisfy( aMeshId );
}
@ -110,14 +111,15 @@ bool SMESHGUI_PredicateFilter::IsObjValid( const int theObjId ) const
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMESH::ElementType anElemType = myPred->GetElementType();
SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( theObjId )
: aMesh->FindElement( theObjId );
if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
return true;
const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( theObjId )
: aMesh->FindElement( theObjId );
// here we guess that predicate element type can not be All in case of node selection
if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
return false;
return myPred->IsSatisfy( theObjId );
}

View File

@ -47,6 +47,8 @@
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <QtxComboBox.h>
#include <QtxColorButton.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
@ -699,8 +701,6 @@ void SMESHGUI_FilterTable::Init (const QList<int>& theTypes)
if (myTables.isEmpty())
{
int aType = theTypes.first();
// create main layout
QVBoxLayout* aMainLay = new QVBoxLayout(this);
aMainLay->setMargin( 0 );
@ -730,8 +730,14 @@ void SMESHGUI_FilterTable::Init (const QList<int>& theTypes)
mySwitchTableGrpLayout->setMargin(0);
mySwitchTableGrpLayout->setSpacing(0);
myTables[ aType ] = createTable(mySwitchTableGrp, aType);
mySwitchTableGrpLayout->addWidget(myTables[ aType ]);
QList<int>::const_iterator typeIt = theTypes.begin();
for ( ; typeIt != theTypes.end(); ++typeIt ) {
Table* aTable = createTable(mySwitchTableGrp, *typeIt);
myTables[ *typeIt ] = aTable;
mySwitchTableGrpLayout->addWidget(aTable);
if ( typeIt != theTypes.begin() )
aTable->hide();
}
// create buttons
myAddBtn = new QPushButton(tr("ADD"), myTableGrp);
@ -899,41 +905,43 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType)
for (int i = 0, n = aTable->rowCount(); i < n; i++)
{
int aCriterion = GetCriterionType(i, aType);
if (aCriterion == SMESH::FT_RangeOfIds ||
QString errMsg;
if (aCriterion == SMESH::FT_GroupColor ) {
QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(i, 2));
if (clrBtn && !clrBtn->color().isValid())
errMsg = tr( "GROUPCOLOR_ERROR" );
} else if (aCriterion == SMESH::FT_ElemGeomType ) {
QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(i, 2));
if (typeBox && typeBox->currentId() == -1)
errMsg = tr( "ERROR" );
} else if (aCriterion == SMESH::FT_RangeOfIds ||
aCriterion == SMESH::FT_BelongToGeom ||
aCriterion == SMESH::FT_BelongToPlane ||
aCriterion == SMESH::FT_BelongToCylinder ||
aCriterion == SMESH::FT_BelongToGenSurface ||
aCriterion == SMESH::FT_LyingOnGeom) {
if (aTable->text(i, 2).isEmpty()) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
tr("ERROR"));
return false;
}
} else {
if (aTable->text(i, 2).isEmpty());
errMsg = tr( "ERROR" );
}
else {
bool aRes = false;
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals(true);
double aThreshold = (int)aTable->text(i, 2).toDouble(&aRes);
aTable->blockSignals(isSignalsBlocked);
if (!aRes && aTable->isEditable(i, 2)) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
tr("ERROR"));
return false;
}
if (!aRes && aTable->isEditable(i, 2))
errMsg = tr( "ERROR" );
else if (aType == SMESH::EDGE &&
GetCriterionType(i, aType) == SMESH::FT_MultiConnection &&
aThreshold == 1)
{
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
tr("MULTIEDGES_ERROR"));
return false;
}
errMsg = tr( "MULTIEDGES_ERROR" );
}
if (!errMsg.isEmpty()) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), errMsg );
return false;
}
QTableWidgetItem* anItem = aTable->item(i, 0);
@ -1012,12 +1020,28 @@ void SMESHGUI_FilterTable::GetCriterion (const int theRow,
int aCriterionType = GetCriterionType(theRow, aType);
if ( aCriterionType != SMESH::FT_RangeOfIds &&
aCriterionType != SMESH::FT_BelongToGeom &&
aCriterionType != SMESH::FT_BelongToPlane &&
aCriterionType != SMESH::FT_BelongToCylinder &&
aCriterionType != SMESH::FT_BelongToGenSurface &&
aCriterionType != SMESH::FT_LyingOnGeom)
if ( aCriterionType == SMESH::FT_GroupColor )
{
QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(theRow, 2));
if ( clrBtn )
{
const QColor qClr = clrBtn->color();
QString clrStr = QString( "%1;%2;%3" ).
arg( qClr.red()/256. ).arg( qClr.green()/256. ).arg( qClr.blue()/256. );
theCriterion.ThresholdStr = clrStr.toLatin1().constData();
}
}
else if ( aCriterionType == SMESH::FT_ElemGeomType ) {
QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(theRow, 2));
if ( typeBox )
theCriterion.Threshold = (double)typeBox->currentId();
}
else if ( aCriterionType != SMESH::FT_RangeOfIds &&
aCriterionType != SMESH::FT_BelongToGeom &&
aCriterionType != SMESH::FT_BelongToPlane &&
aCriterionType != SMESH::FT_BelongToCylinder &&
aCriterionType != SMESH::FT_BelongToGenSurface &&
aCriterionType != SMESH::FT_LyingOnGeom)
{
theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->value();
theCriterion.Threshold = aTable->item(theRow, 2)->text().toDouble();
@ -1063,7 +1087,28 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
else
aTable->setEditable(false, theRow, 4);
if (theCriterion.Type != SMESH::FT_RangeOfIds &&
if (theCriterion.Type == SMESH::FT_GroupColor )
{
QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(theRow, 2));
if ( clrBtn )
{
QColor qClr;
QString clrStr( theCriterion.ThresholdStr );
QStringList clrVals = clrStr.split( ";" );
if ( clrVals.count() > 2 )
qClr.setRgb( (int)256*clrVals[0].toDouble(),
(int)256*clrVals[1].toDouble(),
(int)256*clrVals[2].toDouble() );
clrBtn->setColor( qClr );
}
}
else if (theCriterion.Type == SMESH::FT_ElemGeomType )
{
QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(theRow, 2));
if ( typeBox )
typeBox->setCurrentId( (int)(theCriterion.Threshold + 0.5) );
}
else if (theCriterion.Type != SMESH::FT_RangeOfIds &&
theCriterion.Type != SMESH::FT_BelongToGeom &&
theCriterion.Type != SMESH::FT_BelongToPlane &&
theCriterion.Type != SMESH::FT_BelongToCylinder &&
@ -1071,7 +1116,10 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
theCriterion.Type != SMESH::FT_LyingOnGeom &&
theCriterion.Type != SMESH::FT_FreeBorders &&
theCriterion.Type != SMESH::FT_FreeEdges &&
theCriterion.Type != SMESH::FT_BadOrientedVolume)
theCriterion.Type != SMESH::FT_FreeNodes &&
theCriterion.Type != SMESH::FT_FreeFaces &&
theCriterion.Type != SMESH::FT_BadOrientedVolume &&
theCriterion.Type != SMESH::FT_LinearOrQuadratic)
aTable->item( theRow, 2 )->setText(QString("%1").arg(theCriterion.Threshold, 0, 'g', 15));
else
{
@ -1222,12 +1270,15 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
}
ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0));
int aCriterion = GetCriterionType(aRow);
bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo &&
GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
GetCriterionType(aRow) != SMESH::FT_LyingOnGeom &&
GetCriterionType(aRow) != SMESH::FT_RangeOfIds &&
GetCriterionType(aRow) != SMESH::FT_FreeEdges &&
GetCriterionType(aRow) != SMESH::FT_BadOrientedVolume;
aCriterion != SMESH::FT_BelongToGeom &&
aCriterion != SMESH::FT_LyingOnGeom &&
aCriterion != SMESH::FT_RangeOfIds &&
aCriterion != SMESH::FT_FreeEdges &&
aCriterion != SMESH::FT_FreeFaces &&
aCriterion != SMESH::FT_BadOrientedVolume;
if (!myAddWidgets.contains(anItem))
{
myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack);
@ -1287,6 +1338,34 @@ void SMESHGUI_FilterTable::onCurrentChanged (int theRow, int theCol)
emit CurrentChanged(theRow, theCol);
}
//=======================================================================
// name : geomTypes
// Purpose : returns available geometry types of elements
//=======================================================================
static QList<int> geomTypes( const int theType )
{
QList<int> typeIds;
if ( theType == SMESH::NODE )
typeIds.append( SMESH::Geom_POINT );
if ( theType == SMESH::ALL || theType == SMESH::EDGE )
typeIds.append( SMESH::Geom_EDGE );
if ( theType == SMESH::ALL || theType == SMESH::FACE )
{
typeIds.append( SMESH::Geom_TRIANGLE );
typeIds.append( SMESH::Geom_QUADRANGLE );
typeIds.append( SMESH::Geom_POLYGON );
}
if ( theType == SMESH::ALL || theType == SMESH::VOLUME )
{
typeIds.append( SMESH::Geom_TETRA );
typeIds.append( SMESH::Geom_PYRAMID );
typeIds.append( SMESH::Geom_HEXA );
typeIds.append( SMESH::Geom_PENTA );
typeIds.append( SMESH::Geom_POLYHEDRA );
}
return typeIds;
}
//=======================================================================
// name : SMESHGUI_FilterTable::onCriterionChanged()
// Purpose : Provides reaction on change of criterion
@ -1298,10 +1377,47 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
ComboItem* aCompareItem = (ComboItem*)aTable->item(row, 1);
int aCriterionType = GetCriterionType(row);
QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(row, 2));
QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(row, 2));
if ( (aCriterionType == SMESH::FT_GroupColor && !clrBtn) ||
(aCriterionType == SMESH::FT_ElemGeomType && !typeBox) )
{
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals( true );
if ( aCriterionType == SMESH::FT_GroupColor )
aTable->setCellWidget( row, 2, new QtxColorButton( aTable ) );
else {
QtxComboBox* typeBox = new QtxComboBox( aTable );
aTable->setCellWidget( row, 2, typeBox );
QList<int> typeIds = geomTypes( aType );
QList<int>::const_iterator anIter = typeIds.begin();
for ( int i = 0; anIter != typeIds.end(); ++anIter, ++i) {
QString typeKey = QString( "GEOM_TYPE_%1" ).arg( *anIter );
typeBox->addItem( tr( typeKey.toLatin1().data() ) );
typeBox->setId( i, *anIter );
}
}
aTable->blockSignals( isSignalsBlocked );
}
else if ( (aCriterionType != SMESH::FT_GroupColor && clrBtn) ||
(aCriterionType != SMESH::FT_ElemGeomType && typeBox) )
{
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals( true );
aTable->setCellWidget( row, 2, 0 );
aTable->setItem( row, 2, new QTableWidgetItem() );
aTable->blockSignals( isSignalsBlocked );
}
if (aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges ||
aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume)
if (aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ||
aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
aType == SMESH::FACE && (aCriterionType == SMESH::FT_FreeEdges ||
aCriterionType == SMESH::FT_FreeFaces) ||
aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume ||
aCriterionType == SMESH::FT_LinearOrQuadratic ||
aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType)
{
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals( true );
@ -1309,8 +1425,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
if (aCompareItem->count() > 0)
aCompareItem->clear();
aTable->setEditable(false, row, 1);
aTable->setEditable(false, row, 2);
aTable->setEditable(aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType, row, 2);
aTable->blockSignals( isSignalsBlocked );
}
else if (aCriterionType == SMESH::FT_RangeOfIds ||
@ -1328,6 +1444,12 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2);
}
else if (aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType)
{
if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2);
}
else
{
if (aCompareItem->count() != 3)
@ -1505,6 +1627,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getSupportedTypes() const
aTypes[ SMESH::EDGE ] = tr("EDGES");
aTypes[ SMESH::FACE ] = tr("FACES");
aTypes[ SMESH::VOLUME ] = tr("VOLUMES");
aTypes[ SMESH::ALL ] = tr("ELEMENTS");
}
return aTypes;
@ -1527,6 +1650,8 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
}
return aCriteria;
}
@ -1544,6 +1669,9 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
@ -1567,6 +1695,10 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D");
aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS");
aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
@ -1581,12 +1713,25 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME");
aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
else
else // SMESH::ALL
{
static QMap<int, QString> aCriteria;
if (aCriteria.isEmpty())
{
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
}
@ -2034,15 +2179,15 @@ QWidget* SMESHGUI_FilterDlg::createSourceGroup (QWidget* theParent)
QRadioButton* aMeshBtn = new QRadioButton(tr("MESH"), aBox);
QRadioButton* aSelBtn = new QRadioButton(tr("SELECTION"), aBox);
QRadioButton* aGrpBtn = new QRadioButton(tr("CURRENT_GROUP"), aBox);
QRadioButton* aDlgBtn = new QRadioButton(tr("CURRENT_DIALOG"),aBox);
aLay->addWidget(aMeshBtn);
aLay->addWidget(aSelBtn);
aLay->addWidget(aGrpBtn);
aLay->addWidget(aDlgBtn);
mySourceGrp->addButton(aMeshBtn, Mesh);
mySourceGrp->addButton(aSelBtn, Selection);
mySourceGrp->addButton(aGrpBtn, Dialog);
mySourceGrp->addButton(aDlgBtn, Dialog);
aSelBtn->setChecked(true);
@ -2354,6 +2499,7 @@ Selection_Mode SMESHGUI_FilterDlg::getSelMode (const int theType) const
case SMESH::EDGE : return EdgeSelection;
case SMESH::FACE : return FaceSelection;
case SMESH::VOLUME : return VolumeSelection;
case SMESH::ALL : return CellSelection;
default : return ActorSelection;
}
@ -2483,10 +2629,9 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg)
void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
myMesh = theMesh;
if ( myMesh->_is_nil() ) {
myButtons[BTN_OK]->setEnabled(false);
myButtons[BTN_Apply]->setEnabled(false);
}
const bool isEnable = !(myMesh->_is_nil());
myButtons[BTN_OK]->setEnabled(isEnable);
myButtons[BTN_Apply]->setEnabled(isEnable);
}
//=======================================================================
@ -2829,13 +2974,14 @@ void SMESHGUI_FilterDlg::onSelectionDone()
}
}
int aCriterionType = myTable->GetCriterionType(aRow);
if (aList.Extent() != 1 ||
!myTable->CurrentCell(aRow, aCol) ||
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToPlane &&
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToCylinder &&
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGenSurface &&
myTable->GetCriterionType(aRow) != SMESH::FT_LyingOnGeom)
aCriterionType != SMESH::FT_BelongToGeom &&
aCriterionType != SMESH::FT_BelongToPlane &&
aCriterionType != SMESH::FT_BelongToCylinder &&
aCriterionType != SMESH::FT_BelongToGenSurface &&
aCriterionType != SMESH::FT_LyingOnGeom)
return;
Handle(SALOME_InteractiveObject) anIO = aList.First();
@ -2888,23 +3034,24 @@ void SMESHGUI_FilterDlg::updateSelection()
int aRow, aCol;
int aCriterionType = myTable->GetCriterionType(aRow);
if (myTable->CurrentCell(aRow, aCol) &&
(myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom ||
myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane ||
myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder ||
myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface ||
myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom)) {
(aCriterionType == SMESH::FT_BelongToGeom ||
aCriterionType == SMESH::FT_BelongToPlane ||
aCriterionType == SMESH::FT_BelongToCylinder ||
aCriterionType == SMESH::FT_BelongToGenSurface ||
aCriterionType == SMESH::FT_LyingOnGeom)) {
if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom ||
myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface ||
myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom) {
if (aCriterionType == SMESH::FT_BelongToGeom ||
aCriterionType == SMESH::FT_BelongToGenSurface ||
aCriterionType == SMESH::FT_LyingOnGeom) {
mySelectionMgr->installFilter(new GEOM_SelectionFilter( aStudy, true ));
} else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane) {
} else if (aCriterionType == SMESH::FT_BelongToPlane) {
mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) );
} else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder) {
} else if (aCriterionType == SMESH::FT_BelongToCylinder) {
mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Cylinder ) );
}
myIsSelectionChanged = true;

View File

@ -127,7 +127,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
// purpose :
//=================================================================================
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
SMESH::SMESH_GroupBase_ptr theGroup )
SMESH::SMESH_GroupBase_ptr theGroup,
const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
@ -137,7 +138,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
{
initDialog( false );
if ( !theGroup->_is_nil() )
init( theGroup );
init( theGroup, theIsConvert );
else
{
mySelectSubMesh->setEnabled( false );
@ -511,7 +512,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
// function : Init()
// purpose :
//=================================================================================
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
const bool theIsConvert)
{
restoreShowEntityMode();
myMesh = theGroup->GetMesh();
@ -538,23 +540,27 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
myTypeGroup->button(aType)->setChecked(true);
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
if (!myGroup->_is_nil())
{
// NPAL19389: create a group with a selection in another group
// set actor of myMesh, if it is visible, else set
// actor of myGroup, if it is visible, else try
// any visible actor of group or submesh of myMesh
// commented, because an attempt to set selection on not displayed cells leads to error
//SetAppropriateActor();
myActor = SMESH::FindActorByObject(myMesh);
if ( !myActor )
myActor = SMESH::FindActorByObject(myGroup);
SMESH::SetPickable(myActor);
if (myGroup->_is_nil() && myGroupOnGeom->_is_nil())
return;
myGrpTypeGroup->button(0)->setChecked(true);
onGrpTypeChanged(0);
// NPAL19389: create a group with a selection in another group
// set actor of myMesh, if it is visible, else set
// actor of theGroup, if it is visible, else try
// any visible actor of group or submesh of myMesh
// commented, because an attempt to set selection on not displayed cells leads to error
//SetAppropriateActor();
myActor = SMESH::FindActorByObject(myMesh);
if ( !myActor )
myActor = SMESH::FindActorByObject(theGroup);
SMESH::SetPickable(myActor);
int grpType = (!myGroup->_is_nil() ? 0 : (theIsConvert ? 0 : 1));
myGrpTypeGroup->button(grpType)->setChecked(true);
onGrpTypeChanged(grpType);
if ( grpType == 0 ) {
myCurrentLineEdit = 0;
myElements->clear();
setSelectionMode(aType);
@ -563,8 +569,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
setShowEntityMode(); // depends on myTypeId
myIdList.clear();
if (!myGroup->IsEmpty()) {
SMESH::long_array_var anElements = myGroup->GetListOfID();
if (!theGroup->IsEmpty()) {
SMESH::long_array_var anElements = theGroup->GetListOfID();
int k = anElements->length();
for (int i = 0; i < k; i++) {
myIdList.append(anElements[i]);
@ -575,39 +581,21 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
}
else
{
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
if ( !myGroupOnGeom->_is_nil() )
QString aShapeName( "" );
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
if (!aGroupShape->_is_nil())
{
// NPAL19389: create a group with a selection in another group
// set actor of myMesh, if it is visible, else set
// actor of myGroupOnGeom, if it is visible, else try
// any visible actor of group or submesh of myMesh
// commented, because an attempt to set selection on not displayed cells leads to error
//SetAppropriateActor();
myActor = SMESH::FindActorByObject(myMesh);
if ( !myActor )
myActor = SMESH::FindActorByObject(myGroupOnGeom);
SMESH::SetPickable(myActor);
myGrpTypeGroup->button(1)->setChecked(true);
onGrpTypeChanged(1);
QString aShapeName( "" );
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
if (!aGroupShape->_is_nil())
{
_PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
aShapeName = aGroupShapeSO->GetName().c_str();
}
myGeomGroupLine->setText( aShapeName );
myNameChanged = true;
myName->blockSignals(true);
myName->setText( "Group On " + aShapeName);
myName->blockSignals(false);
_PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
aShapeName = aGroupShapeSO->GetName().c_str();
}
myGeomGroupLine->setText( aShapeName );
myNameChanged = true;
myName->blockSignals(true);
myName->setText( "Group On " + aShapeName);
myName->blockSignals(false);
}
updateButtons();
}
//=================================================================================
@ -756,6 +744,17 @@ bool SMESHGUI_GroupDlg::onApply()
mySelectionMgr->clearSelected();
if (myGroup->_is_nil()) { // creation or conversion
// check if group on geometry is not null
if (!CORBA::is_nil(myGroupOnGeom)) {
if (myMesh->_is_nil())
return false;
myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
// nullify pointer, because object become dead
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
}
}
if (myGroup->_is_nil()) { // creation
if (myMesh->_is_nil())
return false;
@ -1564,8 +1563,8 @@ void SMESHGUI_GroupDlg::onAdd()
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIt.Value());
if (!aGroup->_is_nil()) {
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {

View File

@ -70,7 +70,8 @@ public:
SMESHGUI_GroupDlg( SMESHGUI*,
SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
SMESHGUI_GroupDlg( SMESHGUI*,
SMESH::SMESH_GroupBase_ptr );
SMESH::SMESH_GroupBase_ptr,
const bool theIsConvert = false );
~SMESHGUI_GroupDlg();
static QString GetDefaultName( const QString& );
@ -113,7 +114,8 @@ private slots:
private:
void initDialog( bool );
void init( SMESH::SMESH_Mesh_ptr );
void init( SMESH::SMESH_GroupBase_ptr );
void init( SMESH::SMESH_GroupBase_ptr,
const bool theIsConvert = false );
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* );
void hideEvent( QHideEvent* ); /* ESC key */

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,10 @@
#include CORBA_SERVER_HEADER(SMESH_Group)
class QPushButton;
class QtxColorButton;
class QComboBox;
class QListWidget;
class QGroupBox;
class QLineEdit;
class SMESHGUI;
class LightApp_SelectionMgr;
@ -52,14 +56,37 @@ class SMESHGUI_EXPORT SMESHGUI_GroupOpDlg : public QDialog
Q_OBJECT
public:
enum { UNION, INTERSECT, CUT };
//enum { UNION, INTERSECT, CUT };
public:
SMESHGUI_GroupOpDlg( SMESHGUI*, const int );
SMESHGUI_GroupOpDlg( SMESHGUI* );
virtual ~SMESHGUI_GroupOpDlg();
void Init();
protected slots:
virtual bool onApply();
virtual void onSelectionDone();
virtual void setVisible ( bool visible );
protected:
virtual void reset();
QString getName() const;
void setName( const QString& theName );
QGroupBox* getArgGrp() const;
void setHelpFileName( const QString& theFName );
SMESHGUI* getSMESHGUI() const;
bool isValid( const QList<SMESH::SMESH_GroupBase_var>& theListGrp );
bool getSelectedGroups( QList<SMESH::SMESH_GroupBase_var>& theOutList,
QStringList& theOutNames );
SMESH::ListOfGroups* convert( const QList<SMESH::SMESH_GroupBase_var>& );
SALOMEDS::Color getColor() const;
private:
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* );
@ -67,20 +94,15 @@ private:
private slots:
void onOk();
bool onApply();
void onClose();
void onHelp();
void onDeactivate();
void onSelectionDone();
void onFocusChanged();
private:
QWidget* createButtonFrame( QWidget* );
QWidget* createMainFrame ( QWidget* );
bool isValid();
void reset();
private:
QPushButton* myOkBtn;
QPushButton* myApplyBtn;
@ -88,22 +110,129 @@ private:
QPushButton* myHelpBtn;
QLineEdit* myNameEdit;
QLineEdit* myEdit1;
QLineEdit* myEdit2;
QPushButton* myBtn1;
QPushButton* myBtn2;
QGroupBox* myArgGrp;
QtxColorButton* myColorBtn;
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
int myMode;
SVTK_Selector* mySelector;
QLineEdit* myFocusWg;
SMESH::SMESH_GroupBase_var myGroup1;
SMESH::SMESH_GroupBase_var myGroup2;
QString myHelpFileName;
};
/*
Class : SMESHGUI_UnionGroupsDlg
Description : Perform union of several groups
*/
class SMESHGUI_EXPORT SMESHGUI_UnionGroupsDlg : public SMESHGUI_GroupOpDlg
{
Q_OBJECT
public:
SMESHGUI_UnionGroupsDlg( SMESHGUI* );
virtual ~SMESHGUI_UnionGroupsDlg();
protected slots:
virtual bool onApply();
virtual void onSelectionDone();
protected:
virtual void reset();
private:
QListWidget* myListWg;
QList<SMESH::SMESH_GroupBase_var> myGroups;
};
/*
Class : SMESHGUI_IntersectGroupsDlg
Description : Perform intersection of several groups
*/
class SMESHGUI_EXPORT SMESHGUI_IntersectGroupsDlg : public SMESHGUI_GroupOpDlg
{
Q_OBJECT
public:
SMESHGUI_IntersectGroupsDlg( SMESHGUI* );
virtual ~SMESHGUI_IntersectGroupsDlg();
protected slots:
virtual bool onApply();
virtual void onSelectionDone();
protected:
virtual void reset();
private:
QListWidget* myListWg;
QList<SMESH::SMESH_GroupBase_var> myGroups;
};
/*
Class : SMESHGUI_CutGroupsDlg
Description : Perform cut of several groups
*/
class SMESHGUI_EXPORT SMESHGUI_CutGroupsDlg : public SMESHGUI_GroupOpDlg
{
Q_OBJECT
public:
SMESHGUI_CutGroupsDlg( SMESHGUI* );
virtual ~SMESHGUI_CutGroupsDlg();
protected slots:
virtual bool onApply();
virtual void onSelectionDone();
protected:
virtual void reset();
private:
QPushButton* myBtn1;
QPushButton* myBtn2;
QListWidget* myListWg1;
QListWidget* myListWg2;
QList<SMESH::SMESH_GroupBase_var> myGroups1;
QList<SMESH::SMESH_GroupBase_var> myGroups2;
};
/*
Class : SMESHGUI_DimGroupDlg
Description : Dialog for creating groups of entities from existing
groups of superior dimensions
*/
class SMESHGUI_EXPORT SMESHGUI_DimGroupDlg : public SMESHGUI_GroupOpDlg
{
Q_OBJECT
public:
SMESHGUI_DimGroupDlg( SMESHGUI* );
virtual ~SMESHGUI_DimGroupDlg();
SMESH::ElementType getElementType() const;
void setElementType( const SMESH::ElementType& theElemType );
protected:
virtual void reset();
protected slots:
virtual bool onApply();
virtual void onSelectionDone();
private:
QComboBox* myCombo;
QListWidget* myListWg;
QList<SMESH::SMESH_GroupBase_var> myGroups;
};
#endif // SMESHGUI_GROUPOPDLG_H

View File

@ -62,14 +62,18 @@ SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
{
}
void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
{
if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
}
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
const QString& theHypName,
QWidget* parent)
{
MESSAGE( "Creation of hypothesis with initial params" );
if ( !CORBA::is_nil( initParamsHyp ) && hypType() == initParamsHyp->GetName() )
myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( initParamsHyp );
setInitParamsHypothesis( initParamsHyp );
create( false, theHypName, parent );
}
@ -248,6 +252,11 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
}
void SMESHGUI_GenericHypothesisCreator::onValueChanged()
{
valueChanged( (QWidget*) sender() );
}
void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
{
}
@ -337,13 +346,29 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() cons
return myHypo;
}
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis() const
//================================================================================
/*!
* \brief Return hypothesis containing initial parameters
* \param strictly - if true, always return myInitParamsHypo,
* else, return myInitParamsHypo only in creation mode and if it
* is non-nil
*/
//================================================================================
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
{
if ( CORBA::is_nil( myInitParamsHypo ))
if ( strictly )
return myInitParamsHypo;
if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
return myHypo;
return myInitParamsHypo;
}
bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
{
return !CORBA::is_nil( myInitParamsHypo );
}
QString SMESHGUI_GenericHypothesisCreator::hypType() const
{
return myHypType;

View File

@ -55,6 +55,7 @@ public:
void create( bool, const QString&, QWidget* );
void edit( SMESH::SMESH_Hypothesis_ptr,
const QString&, QWidget* );
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
virtual bool checkParams() const = 0;
virtual void onReject();
@ -76,7 +77,8 @@ protected:
typedef QList<QWidget*> ListOfWidgets;
SMESH::SMESH_Hypothesis_var hypothesis() const;
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
SMESH::SMESH_Hypothesis_var initParamsHypothesis(const bool strict=false) const;
bool hasInitParamsHypothesis() const;
const ListOfWidgets& widgets() const;
ListOfWidgets& changeWidgets();
QtxDialog* dlg() const;
@ -92,6 +94,7 @@ protected:
virtual QWidget* getCustomWidget( const StdParam&,
QWidget*, const int ) const;
virtual bool getParamFromCustomWidget( StdParam&, QWidget* ) const;
virtual void valueChanged( QWidget* );
virtual QString caption() const;
virtual QPixmap icon() const;
virtual QString type() const;

View File

@ -894,13 +894,14 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
!myIsMesh :
myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).count(':') > nbColonsInMeshEntry;
// get mesh and geom object
SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_nil();
GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil();
QString anEntry;
if ( isSubMesh )
{
// get mesh and geom object
SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_nil();
GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil();
QString anEntry = myDlg->selectedObject
anEntry = myDlg->selectedObject
( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
{
@ -921,13 +922,35 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
}
}
}
if ( !aMeshVar->_is_nil() && !aGeomVar->_is_nil() )
return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
aServerLib.toLatin1().data(),
aMeshVar,
aGeomVar );
}
else // mesh
{
if ( !myToCreate ) // mesh to edit can be selected
{
anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
{
aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
if ( !aMeshVar->_is_nil() )
aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pMesh );
}
}
if ( aGeomVar->_is_nil() ) {
anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
{
aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
}
}
}
if ( (!isSubMesh || !aMeshVar->_is_nil()) && !aGeomVar->_is_nil() )
return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
aServerLib.toLatin1().data(),
aMeshVar,
aGeomVar,
/*byMesh = */isSubMesh);
return SMESH::SMESH_Hypothesis::_nil();
}
@ -1039,8 +1062,7 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
// Create hypothesis
if (aCreator) {
// When create or edit a submesh, try to initialize a new hypothesis
// with values used to mesh a subshape
// Get parameters appropriate to initialize a new hypothesis
SMESH::SMESH_Hypothesis_var initParamHyp =
getInitParamsHypothesis(theTypeName, aData->ServerLibName);
myDlg->setEnabled( false );
@ -1089,7 +1111,11 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHyp->GetName() );
if ( aCreator ) {
// Get initial parameters
SMESH::SMESH_Hypothesis_var initParamHyp =
getInitParamsHypothesis( aHyp->GetName(), aHyp->GetLibName());
myDlg->setEnabled( false );
aCreator->setInitParamsHypothesis( initParamHyp );
aCreator->edit( aHyp.in(), aHypItem.second, dlg() );
myDlg->setEnabled( true );
}
@ -1497,6 +1523,9 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
// create sub-mesh
SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.toLatin1().data() );
_PTR(SObject) aSubMeshSO = SMESH::FindSObject( aSubMeshVar.in() );
if ( aSubMeshSO )
SMESH::SetName( aSubMeshSO, aName.toLatin1().data() );
for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ )
{

View File

@ -314,7 +314,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myTitleBoldCheck->setChecked ( f.bold() );
myTitleItalicCheck->setChecked( f.italic() );
myTitleShadowCheck->setChecked( f.underline() );
myTitleShadowCheck->setChecked( f.overline() );
}
QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
@ -332,7 +332,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
myLabelsBoldCheck ->setChecked( f.bold() );
myLabelsItalicCheck->setChecked( f.italic() );
myLabelsShadowCheck->setChecked( f.underline() );
myLabelsShadowCheck->setChecked( f.overline() );
}
int aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors", 64);

View File

@ -31,6 +31,7 @@
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMDS_Mesh.hxx>
@ -81,7 +82,8 @@ SMESHGUI_RemoveElementsDlg
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule),
myBusy(false)
myBusy(false),
myFilterDlg(0)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
@ -120,10 +122,13 @@ SMESHGUI_RemoveElementsDlg
SelectButtonC1A1->setIcon(image1);
LineEditC1A1 = new QLineEdit(GroupC1);
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
GroupC1Layout->addWidget(TextLabelC1A1);
GroupC1Layout->addWidget(SelectButtonC1A1);
GroupC1Layout->addWidget(LineEditC1A1);
GroupC1Layout->addWidget(filterBtn );
/***************************************************************/
GroupButtons = new QGroupBox(this);
@ -165,6 +170,11 @@ SMESHGUI_RemoveElementsDlg
//=================================================================================
SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg()
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//=================================================================================
@ -253,10 +263,13 @@ void SMESHGUI_RemoveElementsDlg::ClickOnOk()
//=================================================================================
void SMESHGUI_RemoveElementsDlg::ClickOnCancel()
{
if (SMESH::GetCurrentVtkView())
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
//mySelectionMgr->clearSelected();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
reject();
}
@ -487,3 +500,19 @@ void SMESHGUI_RemoveElementsDlg::keyPressEvent( QKeyEvent* e )
ClickOnHelp();
}
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_RemoveElementsDlg::setFilters()
{
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditC1A1 );
myFilterDlg->show();
}

View File

@ -43,6 +43,7 @@ class QPushButton;
class QRadioButton;
class SMESHGUI;
class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
@ -92,6 +93,8 @@ private:
QString myHelpFileName;
SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ClickOnOk();
void ClickOnCancel();
@ -102,6 +105,7 @@ private slots:
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
void setFilters();
};
#endif // SMESHGUI_REMOVEELEMENTSDLG_H

View File

@ -31,6 +31,7 @@
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMDS_Mesh.hxx>
@ -81,7 +82,8 @@ SMESHGUI_RemoveNodesDlg
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule),
myBusy(false)
myBusy(false),
myFilterDlg(0)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
@ -120,10 +122,13 @@ SMESHGUI_RemoveNodesDlg
SelectButtonC1A1->setIcon(image1);
LineEditC1A1 = new QLineEdit(GroupC1);
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
GroupC1Layout->addWidget(TextLabelC1A1);
GroupC1Layout->addWidget(SelectButtonC1A1);
GroupC1Layout->addWidget(LineEditC1A1);
GroupC1Layout->addWidget(filterBtn );
/***************************************************************/
GroupButtons = new QGroupBox(this);
@ -165,6 +170,11 @@ SMESHGUI_RemoveNodesDlg
//=================================================================================
SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg()
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//=================================================================================
@ -258,10 +268,14 @@ void SMESHGUI_RemoveNodesDlg::ClickOnOk()
void SMESHGUI_RemoveNodesDlg::ClickOnCancel()
{
//mySelectionMgr->clearSelected();
SMESH::SetPointRepresentation(false);
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
reject();
}
@ -493,3 +507,19 @@ void SMESHGUI_RemoveNodesDlg::keyPressEvent( QKeyEvent* e )
ClickOnHelp();
}
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_RemoveNodesDlg::setFilters()
{
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::NODE );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditC1A1 );
myFilterDlg->show();
}

View File

@ -43,6 +43,7 @@ class QPushButton;
class QRadioButton;
class SMESHGUI;
class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
@ -91,6 +92,8 @@ private:
QLineEdit* LineEditC1A1;
QString myHelpFileName;
SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ClickOnOk();
@ -102,6 +105,7 @@ private slots:
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
void setFilters();
};
#endif // SMESHGUI_REMOVENODESDLG_H

View File

@ -33,6 +33,7 @@
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
@ -72,6 +73,7 @@
#include <QGridLayout>
#include <QSpinBox>
#include <QKeyEvent>
#include <QMenu>
// IDL includes
#include <SALOMEconfig.h>
@ -88,7 +90,9 @@
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myVectorDefinition(NONE_SELECT),
myFilterDlg( 0 )
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
@ -139,6 +143,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@ -231,13 +237,14 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 3);
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 3);
GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2);
GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 3);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 3);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2);
GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 4);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
/***************************************************************/
GroupButtons = new QGroupBox(this);
@ -305,6 +312,12 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
Init();
/*Create menu to vector selection*/
SelectVectorMenu = new QMenu(this);
myMenuActions[SelectVectorMenu->addAction( tr( "MEN_POINT_SELECT" ) )] = POINT_SELECT;
myMenuActions[SelectVectorMenu->addAction( tr( "MEN_FACE_SELECT" ) )] = FACE_SELECT;
connect( SelectVectorMenu, SIGNAL( triggered( QAction* ) ), SLOT( onSelectVectorMenu( QAction* ) ) );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@ -314,7 +327,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(onSelectVectorButton()));
connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
@ -348,6 +361,11 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
{
delete mySimulation;
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//=================================================================================
@ -515,7 +533,10 @@ void SMESHGUI_RevolutionDlg::ClickOnCancel()
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
SMESH::SetPointRepresentation(false);
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
@ -729,30 +750,57 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
myNbOkElements = true;
} else {
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
if (aNbUnits != 1)
return;
SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
if (!aMesh)
return;
const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
if (!n)
bool isNodeSelected = (myEditCurrentArgument == (QWidget*)SpinBox_X ||
(myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==POINT_SELECT));
bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==FACE_SELECT);
if(isNodeSelected) {
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
}
else if(isFaceSelected){
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
}
if (aNbUnits != 1)
return;
double x = n->X();
double y = n->Y();
double z = n->Z();
if(isNodeSelected) {
const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
if (!n)
return;
if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
SpinBox_X->SetValue(x);
SpinBox_Y->SetValue(y);
SpinBox_Z->SetValue(z);
} else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
double x = n->X();
double y = n->Y();
double z = n->Z();
if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
SpinBox_X->SetValue(x);
SpinBox_Y->SetValue(y);
SpinBox_Z->SetValue(z);
} else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
}
}
else if(isFaceSelected){
const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aString.toInt()));
if (!face)
return;
gp_XYZ aNormale = SMESH::getNormale(face);
SpinBox_DX->SetValue(aNormale.X());
SpinBox_DY->SetValue(aNormale.Y());
SpinBox_DZ->SetValue(aNormale.Z());
}
}
@ -808,12 +856,6 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
} else if (send == SelectVectorButton) {
myEditCurrentArgument = (QWidget*)SpinBox_DX;
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
} else {
}
myEditCurrentArgument->setFocus();
@ -1051,3 +1093,64 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
mySimulation->SetVisibility(false);
}
}
//=================================================================================
// function : onSelectVectorButton()
// purpose : [slot]
//=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
if(SelectVectorMenu) {
SelectVectorMenu->exec( QCursor::pos() );
}
}
//=================================================================================
// function : onSelectVectorMenu()
// purpose : [slot]
//=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
if(!action)
return;
switch(myMenuActions[action]) {
case POINT_SELECT:
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
break;
case FACE_SELECT:
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
break;
}
myVectorDefinition = myMenuActions[action];
myEditCurrentArgument = (QWidget*)SpinBox_DX;
myEditCurrentArgument->setFocus();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_RevolutionDlg::setFilters()
{
if ( !myFilterDlg )
{
QList<int> types;
types.append( SMESH::EDGE );
types.append( SMESH::FACE );
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
}
myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}

View File

@ -31,6 +31,7 @@
// Qt includes
#include <QDialog>
#include <QMap>
// IDL includes
#include <SALOMEconfig.h>
@ -47,12 +48,15 @@ class QSpinBox;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI;
class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESH_LogicalFilter;
class SALOME_Actor;
class SMESHGUI_MeshEditPreview;
class QMenu;
class QAction;
//=================================================================================
// class : SMESHGUI_RevolutionDlg
@ -67,6 +71,8 @@ public:
~SMESHGUI_RevolutionDlg();
private:
enum {NONE_SELECT, POINT_SELECT, FACE_SELECT};
void Init( bool = true);
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* ); /* mouse enter the QWidget */
@ -135,9 +141,16 @@ private:
QSpinBox* SpinBox_NbSteps;
QLabel* TextLabelTolerance;
SMESHGUI_SpinBox* SpinBox_Tolerance;
QMenu* SelectVectorMenu;
QMap<QAction*,int> myMenuActions;
int myVectorDefinition;
QString myHelpFileName;
SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ConstructorsClicked( int );
void ClickOnOk();
@ -153,6 +166,9 @@ private slots:
void onVectorChanged();
void toDisplaySimulation();
void onDisplaySimulation( bool );
void onSelectVectorMenu( QAction* );
void onSelectVectorButton();
void setFilters();
};
#endif // SMESHGUI_REVOLUTIONDLG_H

View File

@ -32,6 +32,7 @@
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
@ -89,7 +90,8 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
@ -130,6 +132,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
SelectElementsButton->setIcon(image1);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@ -209,7 +213,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 2);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2);
@ -310,6 +315,11 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
//=================================================================================
SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//=================================================================================
@ -431,7 +441,10 @@ void SMESHGUI_RotationDlg::ClickOnCancel()
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
SMESH::SetPointRepresentation(false);
if (SMESH::GetCurrentVtkView()) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
@ -909,3 +922,19 @@ void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e )
ClickOnHelp();
}
}
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_RotationDlg::setFilters()
{
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}

Some files were not shown because too many files have changed in this diff Show More