From: admin Date: Wed, 28 Dec 2005 09:13:00 +0000 (+0000) Subject: This commit was generated by cvs2git to create branch 'BR-D5-38-2003'. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b45e8210edee224ee8f783feb422cd2113637be;p=modules%2Fgeom.git This commit was generated by cvs2git to create branch 'BR-D5-38-2003'. Cherrypick from master 2005-12-28 09:12:58 UTC jfa 'Join modifications from branch BR_3_1_0deb': INSTALL adm_local/unix/make_commence.in bin/VERSION build_configure doc/Makefile.in doc/salome/GEOM_index_v3.1.0.html doc/salome/Makefile.in doc/salome/gui/GEOM/add_point_on_edge.htm doc/salome/gui/GEOM/arc.htm doc/salome/gui/GEOM/archimede.htm doc/salome/gui/GEOM/basic_geometrical_objects.htm doc/salome/gui/GEOM/basic_operations.htm doc/salome/gui/GEOM/blocks_operations.htm doc/salome/gui/GEOM/boolean_operations.htm doc/salome/gui/GEOM/box.htm doc/salome/gui/GEOM/building_by_blocks.htm doc/salome/gui/GEOM/chamfer.htm doc/salome/gui/GEOM/changing_display_parameters.htm doc/salome/gui/GEOM/changing_displaying_parameters.htm doc/salome/gui/GEOM/check_free_boundaries.htm doc/salome/gui/GEOM/check_free_faces.htm doc/salome/gui/GEOM/circle.htm doc/salome/gui/GEOM/close_contour.htm doc/salome/gui/GEOM/common.htm doc/salome/gui/GEOM/complex_objects.htm doc/salome/gui/GEOM/compound.htm doc/salome/gui/GEOM/cone.htm doc/salome/gui/GEOM/curve.htm doc/salome/gui/GEOM/cut.htm doc/salome/gui/GEOM/cylinder.htm doc/salome/gui/GEOM/edge.htm doc/salome/gui/GEOM/ellipse.htm doc/salome/gui/GEOM/explode.htm doc/salome/gui/GEOM/explode_on_blocks.htm doc/salome/gui/GEOM/extrusion.htm doc/salome/gui/GEOM/face.htm doc/salome/gui/GEOM/files/salome2_sp3_basicgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_booleangui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_buildgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_generationgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_geomtoolsgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_measuregui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_operationgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_primitivegui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_repairgui_functions.htm doc/salome/gui/GEOM/files/salome2_sp3_transformationgui_functions.htm doc/salome/gui/GEOM/fillet.htm doc/salome/gui/GEOM/filling.htm doc/salome/gui/GEOM/fuse.htm doc/salome/gui/GEOM/geom.log doc/salome/gui/GEOM/geometrical_objects.htm doc/salome/gui/GEOM/geompy_doc/GEOM__TestMeasures_8py.html doc/salome/gui/GEOM/geompy_doc/doxygen.css doc/salome/gui/GEOM/geompy_doc/doxygen.png doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.jpg doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.map doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.md5 doc/salome/gui/GEOM/geompy_doc/namespaceGEOM__TestMeasures.html doc/salome/gui/GEOM/geompy_doc/namespacegeompy.html doc/salome/gui/GEOM/glue_faces.htm doc/salome/gui/GEOM/groups.htm doc/salome/gui/GEOM/image10.gif doc/salome/gui/GEOM/image27.gif doc/salome/gui/GEOM/image3.gif doc/salome/gui/GEOM/line.htm doc/salome/gui/GEOM/local_coordinate_system.htm doc/salome/gui/GEOM/measurement_tools.htm doc/salome/gui/GEOM/mirror_image.htm doc/salome/gui/GEOM/modify_the_location.htm doc/salome/gui/GEOM/multi_rotation.htm doc/salome/gui/GEOM/multi_transformation.htm doc/salome/gui/GEOM/multi_translation.htm doc/salome/gui/GEOM/newentity_blocks.htm doc/salome/gui/GEOM/offset_surface.htm doc/salome/gui/GEOM/partition.htm doc/salome/gui/GEOM/pics/arc.png doc/salome/gui/GEOM/pics/archimede.png doc/salome/gui/GEOM/pics/archimedesn1.png doc/salome/gui/GEOM/pics/archimedesn2.png doc/salome/gui/GEOM/pics/archimedesn3.png doc/salome/gui/GEOM/pics/arcsn.png doc/salome/gui/GEOM/pics/bezier.png doc/salome/gui/GEOM/pics/block1.png doc/salome/gui/GEOM/pics/block2.png doc/salome/gui/GEOM/pics/block3.png doc/salome/gui/GEOM/pics/block4.png doc/salome/gui/GEOM/pics/block5.png doc/salome/gui/GEOM/pics/block_explodesn.png doc/salome/gui/GEOM/pics/bool1.png doc/salome/gui/GEOM/pics/bool2.png doc/salome/gui/GEOM/pics/bool3.png doc/salome/gui/GEOM/pics/box1.png doc/salome/gui/GEOM/pics/box2.png doc/salome/gui/GEOM/pics/boxes.png doc/salome/gui/GEOM/pics/chamfer1.png doc/salome/gui/GEOM/pics/chamfer2.png doc/salome/gui/GEOM/pics/chamfer3.png doc/salome/gui/GEOM/pics/chamfer_all.png doc/salome/gui/GEOM/pics/chamfer_edge.png doc/salome/gui/GEOM/pics/chamfer_faces.png doc/salome/gui/GEOM/pics/circle1.png doc/salome/gui/GEOM/pics/circle2.png doc/salome/gui/GEOM/pics/circles.png doc/salome/gui/GEOM/pics/colorsn.png doc/salome/gui/GEOM/pics/commonsn.png doc/salome/gui/GEOM/pics/compoundsn.png doc/salome/gui/GEOM/pics/cone1.png doc/salome/gui/GEOM/pics/cone2.png doc/salome/gui/GEOM/pics/cones.png doc/salome/gui/GEOM/pics/creategroup.png doc/salome/gui/GEOM/pics/curve.png doc/salome/gui/GEOM/pics/cutsn.png doc/salome/gui/GEOM/pics/cylinder1.png doc/salome/gui/GEOM/pics/cylinder2.png doc/salome/gui/GEOM/pics/cylinders.png doc/salome/gui/GEOM/pics/disp_mode1sn.png doc/salome/gui/GEOM/pics/disp_mode2sn.png doc/salome/gui/GEOM/pics/distance.png doc/salome/gui/GEOM/pics/edgesn.png doc/salome/gui/GEOM/pics/editgroup.png doc/salome/gui/GEOM/pics/ellipse.png doc/salome/gui/GEOM/pics/ellipsesn.png doc/salome/gui/GEOM/pics/export.png doc/salome/gui/GEOM/pics/extrusion.png doc/salome/gui/GEOM/pics/facesn1.png doc/salome/gui/GEOM/pics/facesn2.png doc/salome/gui/GEOM/pics/facesn3.png doc/salome/gui/GEOM/pics/fillet1.png doc/salome/gui/GEOM/pics/fillet2.png doc/salome/gui/GEOM/pics/fillet3.png doc/salome/gui/GEOM/pics/fillet_all.png doc/salome/gui/GEOM/pics/fillet_edge.png doc/salome/gui/GEOM/pics/fillet_prism.png doc/salome/gui/GEOM/pics/filling.png doc/salome/gui/GEOM/pics/filling_compoundsn.png doc/salome/gui/GEOM/pics/fillingsn.png doc/salome/gui/GEOM/pics/free_boudaries1.png doc/salome/gui/GEOM/pics/free_boudaries2.png doc/salome/gui/GEOM/pics/free_faces1.png doc/salome/gui/GEOM/pics/free_faces2.png doc/salome/gui/GEOM/pics/fusesn1.png doc/salome/gui/GEOM/pics/fusesn2.png doc/salome/gui/GEOM/pics/glue_faces1.png doc/salome/gui/GEOM/pics/glue_faces2.png doc/salome/gui/GEOM/pics/import.png doc/salome/gui/GEOM/pics/interpol.png doc/salome/gui/GEOM/pics/isos_u12_v12sn.png doc/salome/gui/GEOM/pics/line.png doc/salome/gui/GEOM/pics/lines.png doc/salome/gui/GEOM/pics/measures1.png doc/salome/gui/GEOM/pics/measures10.png doc/salome/gui/GEOM/pics/measures3.png doc/salome/gui/GEOM/pics/measures4.png doc/salome/gui/GEOM/pics/measures5.png doc/salome/gui/GEOM/pics/measures8.png doc/salome/gui/GEOM/pics/measures9.png doc/salome/gui/GEOM/pics/mirror_axissn1.png doc/salome/gui/GEOM/pics/mirror_axissn2.png doc/salome/gui/GEOM/pics/mirror_planesn1.png doc/salome/gui/GEOM/pics/mirror_planesn2.png doc/salome/gui/GEOM/pics/mirror_pointsn1.png doc/salome/gui/GEOM/pics/mirror_pointsn2.png doc/salome/gui/GEOM/pics/mtrans1.png doc/salome/gui/GEOM/pics/mtrans2.png doc/salome/gui/GEOM/pics/mtransf1.png doc/salome/gui/GEOM/pics/mtransf2.png doc/salome/gui/GEOM/pics/mtransf3.png doc/salome/gui/GEOM/pics/mtransf4.png doc/salome/gui/GEOM/pics/multi_rotation1d1.png doc/salome/gui/GEOM/pics/multi_rotation1d2.png doc/salome/gui/GEOM/pics/multi_rotation2d1.png doc/salome/gui/GEOM/pics/multi_rotation2d2.png doc/salome/gui/GEOM/pics/multi_transformationsn1d.png doc/salome/gui/GEOM/pics/multi_transformationsn2d.png doc/salome/gui/GEOM/pics/multi_translation1dsn.png doc/salome/gui/GEOM/pics/multi_translation2dsn.png doc/salome/gui/GEOM/pics/multi_translation_initialsn.png doc/salome/gui/GEOM/pics/neo-basicprop.png doc/salome/gui/GEOM/pics/neo-detect2.png doc/salome/gui/GEOM/pics/neo-isos.png doc/salome/gui/GEOM/pics/neo-localcs1.png doc/salome/gui/GEOM/pics/neo-localcs2.png doc/salome/gui/GEOM/pics/neo-localcs3.png doc/salome/gui/GEOM/pics/neo-materials.png doc/salome/gui/GEOM/pics/neo-mrot1.png doc/salome/gui/GEOM/pics/neo-mrot2.png doc/salome/gui/GEOM/pics/neo-obj1.png doc/salome/gui/GEOM/pics/neo-obj2.png doc/salome/gui/GEOM/pics/neo-obj3.png doc/salome/gui/GEOM/pics/neo-obj4.png doc/salome/gui/GEOM/pics/neo-obj5.png doc/salome/gui/GEOM/pics/neo-obj6.png doc/salome/gui/GEOM/pics/neo-obj7.png doc/salome/gui/GEOM/pics/neo-point2.png doc/salome/gui/GEOM/pics/neo-scetcher1.png doc/salome/gui/GEOM/pics/neo-scetcher2.png doc/salome/gui/GEOM/pics/neo-section.png doc/salome/gui/GEOM/pics/neo-transparency.png doc/salome/gui/GEOM/pics/new-tolerance.png doc/salome/gui/GEOM/pics/offsetsn.png doc/salome/gui/GEOM/pics/partition1.png doc/salome/gui/GEOM/pics/partition2.png doc/salome/gui/GEOM/pics/partitionsn1.png doc/salome/gui/GEOM/pics/partitionsn2.png doc/salome/gui/GEOM/pics/pipe.png doc/salome/gui/GEOM/pics/pipe_wire_edgesn.png doc/salome/gui/GEOM/pics/pipesn.png doc/salome/gui/GEOM/pics/plane1.png doc/salome/gui/GEOM/pics/plane2.png doc/salome/gui/GEOM/pics/plane3.png doc/salome/gui/GEOM/pics/plane_on_face.png doc/salome/gui/GEOM/pics/planes1.png doc/salome/gui/GEOM/pics/point1.png doc/salome/gui/GEOM/pics/point3.png doc/salome/gui/GEOM/pics/points.png doc/salome/gui/GEOM/pics/polyline.png doc/salome/gui/GEOM/pics/prisms_basessn.png doc/salome/gui/GEOM/pics/prismssn.png doc/salome/gui/GEOM/pics/repair1.png doc/salome/gui/GEOM/pics/repair10.png doc/salome/gui/GEOM/pics/repair2.png doc/salome/gui/GEOM/pics/repair3.png doc/salome/gui/GEOM/pics/repair4.png doc/salome/gui/GEOM/pics/repair5.png doc/salome/gui/GEOM/pics/repair6.png doc/salome/gui/GEOM/pics/repair7.png doc/salome/gui/GEOM/pics/repair8.png doc/salome/gui/GEOM/pics/repair9.png doc/salome/gui/GEOM/pics/revolution.png doc/salome/gui/GEOM/pics/revolutionsn.png doc/salome/gui/GEOM/pics/rotationsn1.png doc/salome/gui/GEOM/pics/rotationsn2.png doc/salome/gui/GEOM/pics/scale_transformsn1.png doc/salome/gui/GEOM/pics/scale_transformsn2.png doc/salome/gui/GEOM/pics/sectionsn.png doc/salome/gui/GEOM/pics/shellsn.png doc/salome/gui/GEOM/pics/solidsn.png doc/salome/gui/GEOM/pics/sphere1.png doc/salome/gui/GEOM/pics/sphere2.png doc/salome/gui/GEOM/pics/spheres.png doc/salome/gui/GEOM/pics/supp_int_wires1.png doc/salome/gui/GEOM/pics/supp_int_wires2.png doc/salome/gui/GEOM/pics/suppress_faces1.png doc/salome/gui/GEOM/pics/suppress_faces2.png doc/salome/gui/GEOM/pics/torus1.png doc/salome/gui/GEOM/pics/torus2.png doc/salome/gui/GEOM/pics/toruses.png doc/salome/gui/GEOM/pics/transformation1.png doc/salome/gui/GEOM/pics/transformation10.png doc/salome/gui/GEOM/pics/transformation11.png doc/salome/gui/GEOM/pics/transformation2.png doc/salome/gui/GEOM/pics/transformation3.png doc/salome/gui/GEOM/pics/transformation4.png doc/salome/gui/GEOM/pics/transformation5.png doc/salome/gui/GEOM/pics/transformation6.png doc/salome/gui/GEOM/pics/transformation7.png doc/salome/gui/GEOM/pics/transformation8.png doc/salome/gui/GEOM/pics/transformation9.png doc/salome/gui/GEOM/pics/translationsn1.png doc/salome/gui/GEOM/pics/translationsn2.png doc/salome/gui/GEOM/pics/transparencysn.png doc/salome/gui/GEOM/pics/vector1.png doc/salome/gui/GEOM/pics/vector2.png doc/salome/gui/GEOM/pics/vectors.png doc/salome/gui/GEOM/pics/wiresn.png doc/salome/gui/GEOM/pics/workplane4.png doc/salome/gui/GEOM/pics/workplane5.png doc/salome/gui/GEOM/pics/workplane6.png doc/salome/gui/GEOM/pipe_creation.htm doc/salome/gui/GEOM/plane.htm doc/salome/gui/GEOM/point.htm doc/salome/gui/GEOM/primitives.htm doc/salome/gui/GEOM/propagate.htm doc/salome/gui/GEOM/repairing_operations.htm doc/salome/gui/GEOM/revolution.htm doc/salome/gui/GEOM/rotation.htm doc/salome/gui/GEOM/scale_transform.htm doc/salome/gui/GEOM/section.htm doc/salome/gui/GEOM/sewing.htm doc/salome/gui/GEOM/shape_processing.htm doc/salome/gui/GEOM/shell.htm doc/salome/gui/GEOM/sketcher.htm doc/salome/gui/GEOM/sketcher_tui.htm doc/salome/gui/GEOM/solid.htm doc/salome/gui/GEOM/sphere.htm doc/salome/gui/GEOM/suppress_faces.htm doc/salome/gui/GEOM/suppress_holes.htm doc/salome/gui/GEOM/suppress_internal_wires.htm doc/salome/gui/GEOM/transformation_operations.htm doc/salome/gui/GEOM/translation.htm doc/salome/gui/GEOM/turus.htm doc/salome/gui/GEOM/vector.htm doc/salome/gui/GEOM/whdata/whftdata0.htm doc/salome/gui/GEOM/whdata/whfts.htm doc/salome/gui/GEOM/whdata/whfwdata0.htm doc/salome/gui/GEOM/whdata/whtdata0.htm doc/salome/gui/GEOM/whgdata/whlstf0.htm doc/salome/gui/GEOM/whgdata/whlstf1.htm doc/salome/gui/GEOM/whgdata/whlstf10.htm doc/salome/gui/GEOM/whgdata/whlstf11.htm doc/salome/gui/GEOM/whgdata/whlstf12.htm doc/salome/gui/GEOM/whgdata/whlstf13.htm doc/salome/gui/GEOM/whgdata/whlstf14.htm doc/salome/gui/GEOM/whgdata/whlstf2.htm doc/salome/gui/GEOM/whgdata/whlstf3.htm doc/salome/gui/GEOM/whgdata/whlstf4.htm doc/salome/gui/GEOM/whgdata/whlstf5.htm doc/salome/gui/GEOM/whgdata/whlstf6.htm doc/salome/gui/GEOM/whgdata/whlstf7.htm doc/salome/gui/GEOM/whgdata/whlstf8.htm doc/salome/gui/GEOM/whgdata/whlstf9.htm doc/salome/gui/GEOM/whgdata/whlstfl0.htm doc/salome/gui/GEOM/whgdata/whlstfl10.htm doc/salome/gui/GEOM/whgdata/whlstfl11.htm doc/salome/gui/GEOM/whgdata/whlstfl12.htm doc/salome/gui/GEOM/whgdata/whlstfl13.htm doc/salome/gui/GEOM/whgdata/whlstfl14.htm doc/salome/gui/GEOM/whgdata/whlstfl15.htm doc/salome/gui/GEOM/whgdata/whlstfl16.htm doc/salome/gui/GEOM/whgdata/whlstfl17.htm doc/salome/gui/GEOM/whgdata/whlstfl18.htm doc/salome/gui/GEOM/whgdata/whlstfl19.htm doc/salome/gui/GEOM/whgdata/whlstfl2.htm doc/salome/gui/GEOM/whgdata/whlstfl20.htm doc/salome/gui/GEOM/whgdata/whlstfl21.htm doc/salome/gui/GEOM/whgdata/whlstfl22.htm doc/salome/gui/GEOM/whgdata/whlstfl23.htm doc/salome/gui/GEOM/whgdata/whlstfl24.htm doc/salome/gui/GEOM/whgdata/whlstfl25.htm doc/salome/gui/GEOM/whgdata/whlstfl3.htm doc/salome/gui/GEOM/whgdata/whlstfl4.htm doc/salome/gui/GEOM/whgdata/whlstfl5.htm doc/salome/gui/GEOM/whgdata/whlstfl6.htm doc/salome/gui/GEOM/whgdata/whlstfl7.htm doc/salome/gui/GEOM/whgdata/whlstfl8.htm doc/salome/gui/GEOM/whgdata/whlstfl9.htm doc/salome/gui/GEOM/whgdata/whlstt1.htm doc/salome/gui/GEOM/whgdata/whlstt10.htm doc/salome/gui/GEOM/whgdata/whlstt11.htm doc/salome/gui/GEOM/whgdata/whlstt12.htm doc/salome/gui/GEOM/whgdata/whlstt13.htm doc/salome/gui/GEOM/whgdata/whlstt14.htm doc/salome/gui/GEOM/whgdata/whlstt15.htm doc/salome/gui/GEOM/whgdata/whlstt16.htm doc/salome/gui/GEOM/whgdata/whlstt2.htm doc/salome/gui/GEOM/whgdata/whlstt3.htm doc/salome/gui/GEOM/whgdata/whlstt4.htm doc/salome/gui/GEOM/whgdata/whlstt5.htm doc/salome/gui/GEOM/whgdata/whlstt6.htm doc/salome/gui/GEOM/whgdata/whlstt7.htm doc/salome/gui/GEOM/whgdata/whlstt8.htm doc/salome/gui/GEOM/whgdata/whlstt9.htm doc/salome/gui/GEOM/whgdata/whnvl32.htm doc/salome/gui/GEOM/whskin_info.htm doc/salome/gui/GEOM/whxdata/whftdata0.xml doc/salome/gui/GEOM/whxdata/whfts.xml doc/salome/gui/GEOM/whxdata/whfwdata0.xml doc/salome/gui/GEOM/whxdata/whtdata0.xml doc/salome/gui/GEOM/wire.htm doc/salome/gui/GEOM/working_plane.htm doc/salome/gui/GEOM/working_with_groups.htm doc/salome/tui/GEOM/doxyfile doc/salome/tui/GEOM/doxyfile_py doc/salome/tui/GEOM/sources/static/tree.js idl/GEOM_Gen.idl resources/GEOMCatalog.xml src/BREPExport/BREPExport.cxx src/BREPImport/BREPImport.cxx src/BasicGUI/BasicGUI_ArcDlg.cxx src/BasicGUI/BasicGUI_CircleDlg.cxx src/BasicGUI/BasicGUI_CurveDlg.cxx src/BasicGUI/BasicGUI_EllipseDlg.cxx src/BasicGUI/BasicGUI_LineDlg.cxx src/BasicGUI/BasicGUI_MarkerDlg.cxx src/BasicGUI/BasicGUI_PlaneDlg.cxx src/BasicGUI/BasicGUI_PointDlg.cxx src/BasicGUI/BasicGUI_VectorDlg.cxx src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx src/BlocksGUI/BlocksGUI_BlockDlg.cxx src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx src/BlocksGUI/BlocksGUI_PropagateDlg.cxx src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx src/BlocksGUI/BlocksGUI_TrsfDlg.cxx src/BooleanGUI/BooleanGUI_Dialog.cxx src/BuildGUI/BuildGUI_CompoundDlg.cxx src/BuildGUI/BuildGUI_EdgeDlg.cxx src/BuildGUI/BuildGUI_FaceDlg.cxx src/BuildGUI/BuildGUI_ShellDlg.cxx src/BuildGUI/BuildGUI_SolidDlg.cxx src/BuildGUI/BuildGUI_WireDlg.cxx src/DlgRef/DlgRef_1List1Spin1Btn_QTD.cxx src/DlgRef/DlgRef_1List1Spin1Btn_QTD.h src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx src/DlgRef/DlgRef_1Sel1Check1List_QTD.h src/DlgRef/DlgRef_1Sel1Check_QTD.cxx src/DlgRef/DlgRef_1Sel1Check_QTD.h src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx src/DlgRef/DlgRef_1Sel1Spin_QTD.h src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx src/DlgRef/DlgRef_1Sel2Spin_QTD.h src/DlgRef/DlgRef_1Sel3Check_QTD.cxx src/DlgRef/DlgRef_1Sel3Check_QTD.h src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx src/DlgRef/DlgRef_1Sel3Spin_QTD.h src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx src/DlgRef/DlgRef_1Sel4Spin_QTD.h src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx src/DlgRef/DlgRef_1Sel5Spin_QTD.h src/DlgRef/DlgRef_1Sel_Ext.h src/DlgRef/DlgRef_1Sel_QTD.cxx src/DlgRef/DlgRef_1Sel_QTD.h src/DlgRef/DlgRef_1Spin_QTD.cxx src/DlgRef/DlgRef_1Spin_QTD.h src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.cxx src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.h src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx src/DlgRef/DlgRef_2Sel1Spin_QTD.h src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx src/DlgRef/DlgRef_2Sel2Spin_QTD.h src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx src/DlgRef/DlgRef_2Sel3Spin_QTD.h src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h src/DlgRef/DlgRef_2Sel_QTD.cxx src/DlgRef/DlgRef_2Sel_QTD.h src/DlgRef/DlgRef_2Spin_QTD.cxx src/DlgRef/DlgRef_2Spin_QTD.h src/DlgRef/DlgRef_3Check_QTD.cxx src/DlgRef/DlgRef_3Check_QTD.h src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.cxx src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.h src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h src/DlgRef/DlgRef_3Sel_QTD.cxx src/DlgRef/DlgRef_3Sel_QTD.h src/DlgRef/DlgRef_3Spin1Check_QTD.cxx src/DlgRef/DlgRef_3Spin1Check_QTD.h src/DlgRef/DlgRef_3Spin_QTD.cxx src/DlgRef/DlgRef_3Spin_QTD.h src/DlgRef/DlgRef_4Sel1List1Check_QTD.cxx src/DlgRef/DlgRef_4Sel1List1Check_QTD.h src/DlgRef/DlgRef_4Sel1List_QTD.cxx src/DlgRef/DlgRef_4Sel1List_QTD.h src/DlgRef/DlgRef_6Sel_QTD.cxx src/DlgRef/DlgRef_6Sel_QTD.h src/DlgRef/DlgRef_Skeleton_QTD.cxx src/DlgRef/DlgRef_Skeleton_QTD.h src/DlgRef/UIFiles/ui_to_cxx src/EntityGUI/EntityGUI.cxx src/EntityGUI/EntityGUI_1Sel_QTD.cxx src/EntityGUI/EntityGUI_1Sel_QTD.h src/EntityGUI/EntityGUI_1Spin_QTD.cxx src/EntityGUI/EntityGUI_1Spin_QTD.h src/EntityGUI/EntityGUI_2Spin_QTD.cxx src/EntityGUI/EntityGUI_2Spin_QTD.h src/EntityGUI/EntityGUI_3Spin_QTD.cxx src/EntityGUI/EntityGUI_3Spin_QTD.h src/EntityGUI/EntityGUI_4Spin_QTD.cxx src/EntityGUI/EntityGUI_4Spin_QTD.h src/EntityGUI/EntityGUI_Dir1_QTD.cxx src/EntityGUI/EntityGUI_Dir1_QTD.h src/EntityGUI/EntityGUI_Dir2_QTD.cxx src/EntityGUI/EntityGUI_Dir2_QTD.h src/EntityGUI/EntityGUI_Point_QTD.cxx src/EntityGUI/EntityGUI_Point_QTD.h src/EntityGUI/EntityGUI_Skeleton_QTD.cxx src/EntityGUI/EntityGUI_Skeleton_QTD.h src/EntityGUI/EntityGUI_SketcherDlg.cxx src/EntityGUI/EntityGUI_SubShapeDlg.cxx src/EntityGUI/UIFiles/ui_to_cxx src/GEOM/GEOM_Application.cxx src/GEOM/GEOM_Application.hxx src/GEOM/GEOM_Application.ixx src/GEOM/GEOM_Application.jxx src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx src/GEOM/GEOM_Engine.cxx src/GEOM/GEOM_Engine.hxx src/GEOM/GEOM_Function.cxx src/GEOM/GEOM_Function.hxx src/GEOM/GEOM_IOperations.cxx src/GEOM/GEOM_IOperations.hxx src/GEOM/GEOM_ISubShape.hxx src/GEOM/GEOM_Object.cxx src/GEOM/GEOM_Object.hxx src/GEOM/GEOM_PythonDump.cxx src/GEOM/GEOM_PythonDump.hxx src/GEOM/GEOM_Solver.cxx src/GEOM/GEOM_Solver.hxx src/GEOM/GEOM_SubShapeDriver.cxx src/GEOM/GEOM_SubShapeDriver.hxx src/GEOM/Handle_GEOM_Application.hxx src/GEOM/Makefile.in src/GEOMAlgo/BlockFix.cdl src/GEOMAlgo/BlockFix.cxx src/GEOMAlgo/BlockFix.jxx src/GEOMAlgo/BlockFix_BlockFixAPI.cdl src/GEOMAlgo/BlockFix_BlockFixAPI.cxx src/GEOMAlgo/BlockFix_BlockFixAPI.jxx src/GEOMAlgo/BlockFix_BlockFixAPI.lxx src/GEOMAlgo/BlockFix_CheckTool.cdl src/GEOMAlgo/BlockFix_CheckTool.cxx src/GEOMAlgo/BlockFix_CheckTool.jxx src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx src/GEOMAlgo/BlockFix_UnionEdges.cdl src/GEOMAlgo/BlockFix_UnionEdges.cxx src/GEOMAlgo/BlockFix_UnionEdges.jxx src/GEOMAlgo/BlockFix_UnionFaces.cdl src/GEOMAlgo/BlockFix_UnionFaces.cxx src/GEOMAlgo/BlockFix_UnionFaces.jxx src/GEOMAlgo/GEOMAlgo.cdl src/GEOMAlgo/GEOMAlgo_Algo.cdl src/GEOMAlgo/GEOMAlgo_Algo.cxx src/GEOMAlgo/GEOMAlgo_Algo.jxx src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx src/GEOMAlgo/GEOMAlgo_Gluer.cdl src/GEOMAlgo/GEOMAlgo_Gluer.cxx src/GEOMAlgo/GEOMAlgo_Gluer.jxx src/GEOMAlgo/GEOMAlgo_PassKey.cdl src/GEOMAlgo/GEOMAlgo_PassKey.cxx src/GEOMAlgo/GEOMAlgo_PassKey.jxx src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx src/GEOMAlgo/GEOMAlgo_SolidSolid.jxx src/GEOMAlgo/GEOMAlgo_StateCollector.cdl src/GEOMAlgo/GEOMAlgo_StateCollector.cxx src/GEOMAlgo/GEOMAlgo_StateCollector.jxx src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx src/GEOMAlgo/GEOMAlgo_Tools.cdl src/GEOMAlgo/GEOMAlgo_Tools.cxx src/GEOMAlgo/GEOMAlgo_Tools.jxx src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx src/GEOMAlgo/GEOMAlgo_WireSolid.cdl src/GEOMAlgo/GEOMAlgo_WireSolid.cxx src/GEOMAlgo/GEOMAlgo_WireSolid.jxx src/GEOMAlgo/Makefile.in src/GEOMBase/GEOMBase.cxx src/GEOMBase/GEOMBase_Helper.cxx src/GEOMBase/GEOMBase_Skeleton.cxx src/GEOMBase/Makefile.in src/GEOMClient/Makefile.in src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx src/GEOMFiltersSelection/GEOM_EdgeFilter.h src/GEOMFiltersSelection/GEOM_FaceFilter.cxx src/GEOMFiltersSelection/GEOM_FaceFilter.h src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx src/GEOMFiltersSelection/GEOM_LogicalFilter.h src/GEOMFiltersSelection/GEOM_OCCFilter.cxx src/GEOMFiltersSelection/GEOM_OCCFilter.h src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx src/GEOMFiltersSelection/GEOM_PreviewFilter.h src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx src/GEOMFiltersSelection/GEOM_SelectionFilter.h src/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx src/GEOMFiltersSelection/GEOM_TypeFilter.cxx src/GEOMFiltersSelection/GEOM_TypeFilter.h src/GEOMGUI/GEOMGUI_OCCSelector.cxx src/GEOMGUI/GEOMGUI_OCCSelector.h src/GEOMGUI/GEOMGUI_Selection.cxx src/GEOMGUI/GEOMGUI_Selection.h src/GEOMGUI/GEOM_Displayer.cxx src/GEOMGUI/GEOM_Displayer.h src/GEOMGUI/GEOM_msg_en.po src/GEOMGUI/GeometryGUI.cxx src/GEOMGUI/GeometryGUI.h src/GEOMImpl/GEOMImpl_ArcDriver.cxx src/GEOMImpl/GEOMImpl_ArcDriver.hxx src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx src/GEOMImpl/GEOMImpl_Block6Explorer.cxx src/GEOMImpl/GEOMImpl_Block6Explorer.hxx src/GEOMImpl/GEOMImpl_BlockDriver.cxx src/GEOMImpl/GEOMImpl_BlockDriver.hxx src/GEOMImpl/GEOMImpl_BooleanDriver.cxx src/GEOMImpl/GEOMImpl_BooleanDriver.hxx src/GEOMImpl/GEOMImpl_BoxDriver.cxx src/GEOMImpl/GEOMImpl_BoxDriver.hxx src/GEOMImpl/GEOMImpl_ChamferDriver.cxx src/GEOMImpl/GEOMImpl_ChamferDriver.hxx src/GEOMImpl/GEOMImpl_CircleDriver.cxx src/GEOMImpl/GEOMImpl_CircleDriver.hxx src/GEOMImpl/GEOMImpl_ConeDriver.cxx src/GEOMImpl/GEOMImpl_ConeDriver.hxx src/GEOMImpl/GEOMImpl_CopyDriver.cxx src/GEOMImpl/GEOMImpl_CopyDriver.hxx src/GEOMImpl/GEOMImpl_CylinderDriver.cxx src/GEOMImpl/GEOMImpl_CylinderDriver.hxx src/GEOMImpl/GEOMImpl_EllipseDriver.cxx src/GEOMImpl/GEOMImpl_EllipseDriver.hxx src/GEOMImpl/GEOMImpl_ExportDriver.cxx src/GEOMImpl/GEOMImpl_ExportDriver.hxx src/GEOMImpl/GEOMImpl_FilletDriver.cxx src/GEOMImpl/GEOMImpl_FilletDriver.hxx src/GEOMImpl/GEOMImpl_FillingDriver.cxx src/GEOMImpl/GEOMImpl_FillingDriver.hxx src/GEOMImpl/GEOMImpl_Gen.cxx src/GEOMImpl/GEOMImpl_Gen.hxx src/GEOMImpl/GEOMImpl_GlueDriver.cxx src/GEOMImpl/GEOMImpl_GlueDriver.hxx src/GEOMImpl/GEOMImpl_HealingDriver.cxx src/GEOMImpl/GEOMImpl_HealingDriver.hxx src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx src/GEOMImpl/GEOMImpl_IArc.hxx src/GEOMImpl/GEOMImpl_IArchimede.hxx src/GEOMImpl/GEOMImpl_IBasicOperations.cxx src/GEOMImpl/GEOMImpl_IBasicOperations.hxx src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx src/GEOMImpl/GEOMImpl_IBlocks.hxx src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx src/GEOMImpl/GEOMImpl_IBoolean.hxx src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx src/GEOMImpl/GEOMImpl_IBox.hxx src/GEOMImpl/GEOMImpl_IChamfer.hxx src/GEOMImpl/GEOMImpl_ICircle.hxx src/GEOMImpl/GEOMImpl_ICone.hxx src/GEOMImpl/GEOMImpl_ICopy.hxx src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx src/GEOMImpl/GEOMImpl_ICylinder.hxx src/GEOMImpl/GEOMImpl_IEllipse.hxx src/GEOMImpl/GEOMImpl_IFillet.hxx src/GEOMImpl/GEOMImpl_IFilling.hxx src/GEOMImpl/GEOMImpl_IGlue.hxx src/GEOMImpl/GEOMImpl_IGroupOperations.cxx src/GEOMImpl/GEOMImpl_IGroupOperations.hxx src/GEOMImpl/GEOMImpl_IHealing.hxx src/GEOMImpl/GEOMImpl_IHealingOperations.cxx src/GEOMImpl/GEOMImpl_IHealingOperations.hxx src/GEOMImpl/GEOMImpl_IImportExport.hxx src/GEOMImpl/GEOMImpl_IInsertOperations.cxx src/GEOMImpl/GEOMImpl_IInsertOperations.hxx src/GEOMImpl/GEOMImpl_ILine.hxx src/GEOMImpl/GEOMImpl_ILocalOperations.cxx src/GEOMImpl/GEOMImpl_ILocalOperations.hxx src/GEOMImpl/GEOMImpl_IMarker.hxx src/GEOMImpl/GEOMImpl_IMeasure.hxx src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx src/GEOMImpl/GEOMImpl_IMirror.hxx src/GEOMImpl/GEOMImpl_IOffset.hxx src/GEOMImpl/GEOMImpl_IPartition.hxx src/GEOMImpl/GEOMImpl_IPipe.hxx src/GEOMImpl/GEOMImpl_IPlane.hxx src/GEOMImpl/GEOMImpl_IPoint.hxx src/GEOMImpl/GEOMImpl_IPolyline.hxx src/GEOMImpl/GEOMImpl_IPosition.hxx src/GEOMImpl/GEOMImpl_IPrism.hxx src/GEOMImpl/GEOMImpl_IRevolution.hxx src/GEOMImpl/GEOMImpl_IRotate.hxx src/GEOMImpl/GEOMImpl_IScale.hxx src/GEOMImpl/GEOMImpl_IShapes.hxx src/GEOMImpl/GEOMImpl_IShapesOperations.cxx src/GEOMImpl/GEOMImpl_IShapesOperations.hxx src/GEOMImpl/GEOMImpl_ISketcher.hxx src/GEOMImpl/GEOMImpl_ISphere.hxx src/GEOMImpl/GEOMImpl_ISpline.hxx src/GEOMImpl/GEOMImpl_ITorus.hxx src/GEOMImpl/GEOMImpl_ITransformOperations.cxx src/GEOMImpl/GEOMImpl_ITransformOperations.hxx src/GEOMImpl/GEOMImpl_ITranslate.hxx src/GEOMImpl/GEOMImpl_IVector.hxx src/GEOMImpl/GEOMImpl_ImportDriver.cxx src/GEOMImpl/GEOMImpl_ImportDriver.hxx src/GEOMImpl/GEOMImpl_LineDriver.cxx src/GEOMImpl/GEOMImpl_LineDriver.hxx src/GEOMImpl/GEOMImpl_MarkerDriver.cxx src/GEOMImpl/GEOMImpl_MarkerDriver.hxx src/GEOMImpl/GEOMImpl_MeasureDriver.cxx src/GEOMImpl/GEOMImpl_MeasureDriver.hxx src/GEOMImpl/GEOMImpl_MirrorDriver.cxx src/GEOMImpl/GEOMImpl_MirrorDriver.hxx src/GEOMImpl/GEOMImpl_OffsetDriver.cxx src/GEOMImpl/GEOMImpl_OffsetDriver.hxx src/GEOMImpl/GEOMImpl_PartitionDriver.cxx src/GEOMImpl/GEOMImpl_PartitionDriver.hxx src/GEOMImpl/GEOMImpl_PipeDriver.cxx src/GEOMImpl/GEOMImpl_PipeDriver.hxx src/GEOMImpl/GEOMImpl_PlaneDriver.cxx src/GEOMImpl/GEOMImpl_PlaneDriver.hxx src/GEOMImpl/GEOMImpl_PointDriver.cxx src/GEOMImpl/GEOMImpl_PointDriver.hxx src/GEOMImpl/GEOMImpl_PolylineDriver.cxx src/GEOMImpl/GEOMImpl_PolylineDriver.hxx src/GEOMImpl/GEOMImpl_PositionDriver.cxx src/GEOMImpl/GEOMImpl_PositionDriver.hxx src/GEOMImpl/GEOMImpl_PrismDriver.cxx src/GEOMImpl/GEOMImpl_PrismDriver.hxx src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx src/GEOMImpl/GEOMImpl_RotateDriver.cxx src/GEOMImpl/GEOMImpl_RotateDriver.hxx src/GEOMImpl/GEOMImpl_ScaleDriver.cxx src/GEOMImpl/GEOMImpl_ScaleDriver.hxx src/GEOMImpl/GEOMImpl_ShapeDriver.cxx src/GEOMImpl/GEOMImpl_ShapeDriver.hxx src/GEOMImpl/GEOMImpl_SketcherDriver.cxx src/GEOMImpl/GEOMImpl_SketcherDriver.hxx src/GEOMImpl/GEOMImpl_SphereDriver.cxx src/GEOMImpl/GEOMImpl_SphereDriver.hxx src/GEOMImpl/GEOMImpl_SplineDriver.cxx src/GEOMImpl/GEOMImpl_SplineDriver.hxx src/GEOMImpl/GEOMImpl_Template.cxx src/GEOMImpl/GEOMImpl_Template.hxx src/GEOMImpl/GEOMImpl_TorusDriver.cxx src/GEOMImpl/GEOMImpl_TorusDriver.hxx src/GEOMImpl/GEOMImpl_TranslateDriver.cxx src/GEOMImpl/GEOMImpl_TranslateDriver.hxx src/GEOMImpl/GEOMImpl_Types.hxx src/GEOMImpl/GEOMImpl_VectorDriver.cxx src/GEOMImpl/GEOMImpl_VectorDriver.hxx src/GEOMToolsGUI/GEOMToolsGUI.cxx src/GEOM_I/GEOM_DumpPython.cc src/GEOM_I/GEOM_Gen_i.cc src/GEOM_I/GEOM_Gen_i.hh src/GEOM_I/GEOM_I3DPrimOperations_i.cc src/GEOM_I/GEOM_I3DPrimOperations_i.hh src/GEOM_I/GEOM_IBasicOperations_i.cc src/GEOM_I/GEOM_IBasicOperations_i.hh src/GEOM_I/GEOM_IBlocksOperations_i.cc src/GEOM_I/GEOM_IBlocksOperations_i.hh src/GEOM_I/GEOM_IBooleanOperations_i.cc src/GEOM_I/GEOM_IBooleanOperations_i.hh src/GEOM_I/GEOM_ICurvesOperations_i.cc src/GEOM_I/GEOM_ICurvesOperations_i.hh src/GEOM_I/GEOM_IGroupOperations_i.cc src/GEOM_I/GEOM_IGroupOperations_i.hh src/GEOM_I/GEOM_IHealingOperations_i.cc src/GEOM_I/GEOM_IHealingOperations_i.hh src/GEOM_I/GEOM_IInsertOperations_i.cc src/GEOM_I/GEOM_IInsertOperations_i.hh src/GEOM_I/GEOM_ILocalOperations_i.cc src/GEOM_I/GEOM_ILocalOperations_i.hh src/GEOM_I/GEOM_IMeasureOperations_i.cc src/GEOM_I/GEOM_IMeasureOperations_i.hh src/GEOM_I/GEOM_IOperations_i.cc src/GEOM_I/GEOM_IOperations_i.hh src/GEOM_I/GEOM_IShapesOperations_i.cc src/GEOM_I/GEOM_IShapesOperations_i.hh src/GEOM_I/GEOM_ITransformOperations_i.cc src/GEOM_I/GEOM_ITransformOperations_i.hh src/GEOM_I/GEOM_Object_i.cc src/GEOM_I/GEOM_Object_i.hh src/GEOM_I/Makefile.in src/GEOM_I_Superv/GEOM_List_i.hh src/GEOM_I_Superv/GEOM_Superv_i.cc src/GEOM_I_Superv/GEOM_Superv_i.hh src/GEOM_SWIG/GEOM_Nut.py src/GEOM_SWIG/GEOM_TestOthers.py src/GEOM_SWIG/batchmode_geompy.py src/GEOM_SWIG/geompy.py src/GEOM_SWIG/libGEOM_Swig.i src/GenerationGUI/GenerationGUI_FillingDlg.cxx src/GenerationGUI/GenerationGUI_PipeDlg.cxx src/GenerationGUI/GenerationGUI_PrismDlg.cxx src/GenerationGUI/GenerationGUI_RevolDlg.cxx src/GroupGUI/GroupGUI.cxx src/GroupGUI/GroupGUI_GroupDlg.cxx src/IGESExport/IGESExport.cxx src/IGESImport/IGESImport.cxx src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx src/MeasureGUI/MeasureGUI_PointDlg.cxx src/MeasureGUI/MeasureGUI_Skeleton.cxx src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx src/MeasureGUI/MeasureGUI_Skeleton_QTD.h src/MeasureGUI/UIFiles/ui_to_cxx src/NMTAlgo/Makefile.in src/NMTAlgo/NMTAlgo.cdl src/NMTAlgo/NMTAlgo_Algo.cdl src/NMTAlgo/NMTAlgo_Algo.cxx src/NMTAlgo/NMTAlgo_Algo.jxx src/NMTAlgo/NMTAlgo_Builder.cdl src/NMTAlgo/NMTAlgo_Builder.cxx src/NMTAlgo/NMTAlgo_Builder.jxx src/NMTAlgo/NMTAlgo_Loop3d.cdl src/NMTAlgo/NMTAlgo_Loop3d.cxx src/NMTAlgo/NMTAlgo_Loop3d.jxx src/NMTAlgo/NMTAlgo_Splitter.cdl src/NMTAlgo/NMTAlgo_Splitter.cxx src/NMTAlgo/NMTAlgo_Splitter.jxx src/NMTAlgo/NMTAlgo_Splitter1.cdl src/NMTAlgo/NMTAlgo_Splitter1.cxx src/NMTAlgo/NMTAlgo_Splitter1.jxx src/NMTAlgo/NMTAlgo_Splitter_1.cxx src/NMTAlgo/NMTAlgo_Splitter_2.cxx src/NMTAlgo/NMTAlgo_Tools.cdl src/NMTAlgo/NMTAlgo_Tools.cxx src/NMTAlgo/NMTAlgo_Tools.jxx src/NMTDS/NMTDS.cdl src/NMTDS/NMTDS_IndexRange.cdl src/NMTDS/NMTDS_IndexRange.cxx src/NMTDS/NMTDS_IndexRange.jxx src/NMTDS/NMTDS_ShapesDataStructure.cdl src/NMTDS/NMTDS_ShapesDataStructure.cxx src/NMTDS/NMTDS_ShapesDataStructure.hxx src/NMTDS/NMTDS_ShapesDataStructure.jxx src/NMTTools/Makefile.in src/NMTTools/NMTTools.cdl src/NMTTools/NMTTools_CommonBlock.cdl src/NMTTools/NMTTools_CommonBlock.cxx src/NMTTools/NMTTools_CommonBlock.jxx src/NMTTools/NMTTools_CommonBlockAPI.cdl src/NMTTools/NMTTools_CommonBlockAPI.cxx src/NMTTools/NMTTools_CommonBlockAPI.jxx src/NMTTools/NMTTools_CoupleOfShape.cdl src/NMTTools/NMTTools_CoupleOfShape.cxx src/NMTTools/NMTTools_CoupleOfShape.jxx src/NMTTools/NMTTools_DEProcessor.cdl src/NMTTools/NMTTools_DEProcessor.cxx src/NMTTools/NMTTools_DEProcessor.jxx src/NMTTools/NMTTools_DSFiller.cdl src/NMTTools/NMTTools_DSFiller.cxx src/NMTTools/NMTTools_DSFiller.jxx src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx src/NMTTools/NMTTools_PCurveMaker.cdl src/NMTTools/NMTTools_PCurveMaker.cxx src/NMTTools/NMTTools_PCurveMaker.jxx src/NMTTools/NMTTools_PaveFiller.cdl src/NMTTools/NMTTools_PaveFiller.cxx src/NMTTools/NMTTools_PaveFiller.jxx src/NMTTools/NMTTools_PaveFiller_0.cxx src/NMTTools/NMTTools_PaveFiller_1.cxx src/NMTTools/NMTTools_PaveFiller_2.cxx src/NMTTools/NMTTools_PaveFiller_3.cxx src/NMTTools/NMTTools_PaveFiller_4.cxx src/NMTTools/NMTTools_PaveFiller_5.cxx src/NMTTools/NMTTools_PaveFiller_6.cxx src/NMTTools/NMTTools_PaveFiller_7.cxx src/NMTTools/NMTTools_PaveFiller_8.cxx src/NMTTools/NMTTools_PaveFiller_9.cxx src/NMTTools/NMTTools_Tools.cdl src/NMTTools/NMTTools_Tools.cxx src/NMTTools/NMTTools_Tools.jxx src/OperationGUI/OperationGUI_ArchimedeDlg.cxx src/OperationGUI/OperationGUI_ChamferDlg.cxx src/OperationGUI/OperationGUI_ClippingDlg.cxx src/OperationGUI/OperationGUI_FilletDlg.cxx src/OperationGUI/OperationGUI_MaterialDlg.cxx src/OperationGUI/OperationGUI_PartitionDlg.cxx src/PARTITION/Partition.cdl src/PARTITION/Partition_Inter2d.cdl src/PARTITION/Partition_Inter3d.cdl src/PARTITION/Partition_Loop.cdl src/PARTITION/Partition_Loop2d.cdl src/PARTITION/Partition_Loop3d.cdl src/PARTITION/Partition_Spliter.cdl src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx src/RepairGUI/RepairGUI.cxx src/RepairGUI/RepairGUI_CloseContourDlg.cxx src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx src/RepairGUI/RepairGUI_DivideEdgeDlg.h src/RepairGUI/RepairGUI_FreeBoundDlg.cxx src/RepairGUI/RepairGUI_FreeFacesDlg.cxx src/RepairGUI/RepairGUI_GlueDlg.cxx src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx src/RepairGUI/RepairGUI_SewingDlg.cxx src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx src/STEPExport/STEPExport.cxx src/STEPImport/STEPImport.cxx src/ShHealOper/Makefile.in src/ShHealOper/ShHealOper_CloseContour.cxx src/TransformationGUI/TransformationGUI_MirrorDlg.cxx src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx src/TransformationGUI/TransformationGUI_OffsetDlg.cxx src/TransformationGUI/TransformationGUI_PositionDlg.cxx src/TransformationGUI/TransformationGUI_RotationDlg.cxx src/TransformationGUI/TransformationGUI_ScaleDlg.cxx src/TransformationGUI/TransformationGUI_TranslationDlg.cxx --- diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..3adf46d88 --- /dev/null +++ b/INSTALL @@ -0,0 +1,4 @@ +This is the version 3.1.0 of GEOM +Compatible with : + - KERNEL 3.1.0 + - GUI 3.1.0 diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in new file mode 100644 index 000000000..8054ab99b --- /dev/null +++ b/adm_local/unix/make_commence.in @@ -0,0 +1,257 @@ +# common directories to put headerfiles +inc_builddir=$(top_builddir)/include/salome + +@SET_MAKE@ +SHELL=/bin/sh + +# header missing + +HAVE_SSTREAM=@HAVE_SSTREAM@ + + +LIBS=@LIBS@ +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome +# add libstdc++ to link c++ library with libtool ! +LDFLAGS+= -lstdc++ + +CP=@CP@ + +# CPP + +CPP=@CPP@ +CXXCPP=@CXXCPP@ +CPPFLAGS=@CPPFLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# C + +CC = @CC@ +CFLAGS = @CFLAGS@ +C_DEPEND_FLAG = @C_DEPEND_FLAG@ + +# C++ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ + +# BOOST Library + +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ + +# JAVA + +JAVA_INCLUDES = @JAVA_INCLUDES@ +JAVA_LIBS = @JAVA_LIBS@ +JAVA_LDPATH = @JAVA_LDPATH@ + +# PYTHON + +PYTHON = @PYTHON@ +PYTHONHOME = @PYTHONHOME@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages +PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome +# QT + +QT_ROOT = @QT_ROOT@ +QT_INCLUDES = @QT_INCLUDES@ +QT_MT_INCLUDES = @QT_INCLUDES@ -DQT_THREAD_SUPPORT +QT_LIBS = @QT_LIBS@ +QT_MT_LIBS = @QT_MT_LIBS@ + +MOC = @MOC@ +UIC = @UIC@ + +MSG2QM = @MSG2QM@ + +#QWT + +QWT_INCLUDES=@QWT_INCLUDES@ +QWT_LIBS=@QWT_LIBS@ + +# SIP +SIP = @SIP@ +SIP_INCLUDES = @SIP_INCLUDES@ +SIP_LIBS = @SIP_LIBS@ + +# PYQT +PYQT_SIPS = @PYQT_SIPS@ +PYQT_LIBS = @PYQT_LIBS@ + +# openGL +OGL_INCLUDES=@OGL_INCLUDES@ +OGL_LIBS=@OGL_LIBS@ + +# VTK +VTK_INCLUDES=@VTK_INCLUDES@ +VTK_LIBS=@VTK_LIBS@ + +# HDF5 + +HDF5_INCLUDES=@HDF5_INCLUDES@ +HDF5_LIBS=@HDF5_LIBS@ +HDF5_MT_LIBS=@HDF5_MT_LIBS@ + +# OpenCasCade + +OCC_INCLUDES=@CAS_CPPFLAGS@ +OCC_CXXFLAGS=@CAS_CXXFLAGS@ + +#OCC_KERNEL_LIBS=@CAS_KERNEL@ +#OCC_OCAF_LIBS=@CAS_OCAF@ +#OCC_VIEWER_LIBS=@CAS_VIEWER@ +#OCC_MODELER_LIBS=@CAS_MODELER@ +#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ +#OCC_LIBS=@CAS_LDFLAGS@ +CAS_KERNEL=@CAS_KERNEL@ +CAS_MATH=@CAS_MATH@ +CAS_OCAF=@CAS_OCAF@ +CAS_OCAFVIS=@CAS_OCAFVIS@ +CAS_TKTopAlgo=@CAS_TKTopAlgo@ +CAS_VIEWER=@CAS_VIEWER@ +CAS_MODELER=@CAS_MODELER@ +CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@ +CAS_LDPATH=@CAS_LDPATH@ +# MPICH + +MPICH_INCLUDES=@MPICH_INCLUDES@ +MPICH_LIBS=@MPICH_LIBS@ + +# Swig C++ Python + +SWIG = @SWIG@ +SWIG_FLAGS = @SWIG_FLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# OMNIORB + +OMNIORB_ROOT = @OMNIORB_ROOT@ +OMNIORB_INCLUDES = @OMNIORB_INCLUDES@ +OMNIORB_LIBS = @OMNIORB_LIBS@ +OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ + +OMNIORB_IDL = @OMNIORB_IDL@ +OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome + +OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ +OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ +OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@ + +OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@ +OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@ +OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@ + +# Default ORB + +CORBA_ROOT = @CORBA_ROOT@ +CORBA_INCLUDES = @CORBA_INCLUDES@ +CORBA_LIBS = @CORBA_LIBS@ +CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ + +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome +IDLPYFLAGS = @IDLPYFLAGS@ + +IDL = @IDL@ + +IDL_CLN_H = @IDL_CLN_H@ +IDL_CLN_CXX = @IDL_CLN_CXX@ +IDL_CLN_OBJ = @IDL_CLN_OBJ@ + +IDL_SRV_H = @IDL_SRV_H@ +IDL_SRV_CXX = @IDL_SRV_CXX@ +IDL_SRV_OBJ = @IDL_SRV_OBJ@ + +CPPFLAGS+= $(CORBA_INCLUDES) +CXXFLAGS+= $(CORBA_CXXFLAGS) + +# add corba libs when link salome application ! +#LDFLAGS+= $(CORBA_LIBS) +LIBS+=$(CORBA_LIBS) + +DOXYGEN = @DOXYGEN@ + +## Shared libraries +LT_STATIC_EXEC=@LT_STATIC_EXEC@ +DYNAMIC_DIRS=@DYNAMIC_DIRS@ +LT_LIB=libtool +LT=$(top_builddir)/libtool +LT_COMPILE=$(LT) --mode=compile $(CC) +LT_LINK_LIB=$(LT_LIB) --mode=link $(CC) -rpath $(libdir) +LT_LINK_EXE=$(LT) --mode=link $(CC) $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS) +LT_RUN=$(LT) --mode=execute +LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM) +LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA) +LT_UNINSTALL=$(LT) --mode=uninstall $(RM) + +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ + +# create a symbolic link (or a copie ?) +LN_S=@LN_S@ + +## Installation points +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@/salome +libdir=@libdir@/salome +# warning : if user give this path in configure we could have salome/salome :-( +includedir=@includedir@/salome +datadir=@datadir@/salome +idldir=${prefix}/idl/salome +sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules +incmakedir=${prefix}/salome_adm/unix + +docdir=${prefix}/doc/salome + +# +# begin of package rules +# + +.PHONY: all lib bin inc resources data docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean + +.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm + +all: + $(MAKE) inc + $(MAKE) depend_idl + $(MAKE) depend + $(MAKE) lib + $(MAKE) bin + $(MAKE) resources + +# +# add target to build administrative files +# + +Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in + cd $(top_builddir) ; ./config.status + +$(top_builddir)/config.status: $(top_srcdir)/configure + cd $(top_builddir) ; ./config.status --recheck + +# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) +ifneq ($(top_srcdir),$(srcdir)) +configure: $(top_srcdir)/configure +endif + +$(top_srcdir)/configure: $(top_srcdir)/configure.in $(top_srcdir)/aclocal.m4 + cd $(top_srcdir) ; autoconf + +$(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base + cd $(top_srcdir) && ./build_configure + + +ACLOCAL_SRC = \ +ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \ +ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \ +ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \ +ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ +ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \ +ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ +ac_cc_warnings.m4 check_qt.m4 check_swig.m4 + +$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) + cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files diff --git a/bin/VERSION b/bin/VERSION new file mode 100755 index 000000000..2d918a5a9 --- /dev/null +++ b/bin/VERSION @@ -0,0 +1 @@ +THIS IS SALOME - GEOM VERSION: 3.1.0 diff --git a/build_configure b/build_configure new file mode 100755 index 000000000..6fdce3389 --- /dev/null +++ b/build_configure @@ -0,0 +1,215 @@ +#!/bin/bash + +# +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# +# Author : Marc Tajchman - CEA +# Date : 10/10/2002 +# $Header$ +# + +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi +######################################################################## +# find_in - utility function +# +# usage : +# find_in directory filename +# +# Finds files following the *.in pattern, recursively in the +# directory (first argument). +# Results are appended into the file (second argument) +# +# Difference from the standard unix find is that files are tested +# before directories +# + +find_in() +{ + local i + local f=$2 + +# if the first argument is not a directory, returns + + if [ ! -d "$1" ] ; then + return + fi + +# dont look in the CVS directories + + case $1 in + */CVS) return ;; + */adm_local/*) return ;; + *) ;; + esac + +# for each regular file contained in the directory +# test if it's a .in file + + for i in "$1"/* + do + if [ -f "$i" ] ; then + case $i in + *.in) echo " "$i" \\" >> $f;; + *) ;; + esac + fi + done + +# for each subdirectory of the first argument, proceeds recursively + + for i in "$1"/* + do + if [ -d "$i" ] ; then + find_in "$i" "$f" + fi + done +} + + +####################################################################### +# Generate list of .in files (Makefile.in, config.h.in, etc) +# appending it in file configure.in + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +# +# Common part of the configure.in file +# +chmod u+w configure.in.base +if ! \cp -f configure.in.base configure.in_tmp1 +then + echo + echo "error : can't create files in" ${CONF_DIR} + echo "aborting ..." + chmod u-w configure.in.base + exit +fi +chmod u-w configure.in.base + +if [ -e "${CONF_DIR}/salome_adm" ] ; then + \rm -f ${CONF_DIR}/salome_adm +fi + +# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files +echo "" >> configure.in_tmp1 +echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1 + +echo "" >> configure.in_tmp1 +echo "AC_OUTPUT([ \\" >> configure.in_tmp1 + +# +# List of .in files in the adm/unix directory +# These files MUST be on top of AC_OUTPUT list so we +# put them "manually" +# + +echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 + +\rm -f configure.in_tmp2 configure.in_tmp3 +touch configure.in_tmp2 +find_in . configure.in_tmp2 +sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 > configure.in_tmp2 +sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 +#sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +#sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +#sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 + +echo "])" >> configure.in_tmp1 + +# delete the link created for AC_OUTPUT +echo "" >> configure.in_tmp1 +#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 +\mv configure.in_tmp1 configure.in_new +\rm -f configure.in_tmp2 configure.in_tmp3 + + +######################################################################## +# Create new (or replace old) configure.in file +# Print a message if the file is write protected +# + +echo +if test ! -f configure.in +then + echo -n "Creating new file 'configure.in' ... " + if \mv configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo "error, check your file permissions" + fi +else + echo -n "Updating 'configure.in' file ... " + if ! \cp configure.in configure.in_old >& /dev/null + then + echo + echo + echo "Can't backup previous configure.in" + echo -n "Continue (you will not be able to revert) - (Y/N) ? " + read R + case "x$R" in + xn*) exit;; + xN*) exit;; + esac + echo + echo -n " " + fi + if \cp configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo + echo "error, can't update previous configure.in" + fi +fi + +######################################################################## +# Use autoconf to rebuild the configure script +# + +if test -f configure +then + echo -n "Updating 'configure' script ... " +else + echo -n "Creating 'configure' script ... " +fi + +aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files +if autoconf +then + echo "done" +else + echo "failed (check file permissions and/or user quotas ...)" +fi + +cd ${ORIG_DIR} + +echo diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 000000000..7295ede75 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,40 @@ + +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 30/11/2001 +# $Header$ +# +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +SUBDIRS= salome + +@COMMENCE@ + +docs: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done +clean: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +distclean: clean + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +install: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done diff --git a/doc/salome/GEOM_index_v3.1.0.html b/doc/salome/GEOM_index_v3.1.0.html new file mode 100644 index 000000000..e4488ebbc --- /dev/null +++ b/doc/salome/GEOM_index_v3.1.0.html @@ -0,0 +1,95 @@ + + + + + + + + Geometry Module Documentation + + + +
  +
+
                   +   
+ + + + + + + + + +
+ + + +
+ +
+
+
+

Geometry MODULE Documentation

+
+
+ + + + + +
+
+ +
+

Application-About.png +     

+
+ +
+ + + + +
+
+
+
+
+ +
+ +
GUI Documentation
+ +
+ +
+ +

+
+ +
+ +
TUI Documentation
+ +
+ +
+ +

+
+
+
+
+
+
+ + diff --git a/doc/salome/Makefile.in b/doc/salome/Makefile.in new file mode 100644 index 000000000..2af65570b --- /dev/null +++ b/doc/salome/Makefile.in @@ -0,0 +1,45 @@ +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : doc +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +SUBDIRS= tui gui + +@COMMENCE@ + +docs: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + cp -f $(srcdir)/GEOM_index_v3.1.0.html GEOM_index_v3.1.0.html + +clean: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +distclean: clean + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +install: + $(MAKE) docs + (cd tui && $(MAKE) install); + (cd gui && $(MAKE) install); + cp -f GEOM_index_v3.1.0.html $(docdir) + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + rm -fr $(docdir)/GEOM_index_v3.1.0.html diff --git a/doc/salome/gui/GEOM/add_point_on_edge.htm b/doc/salome/gui/GEOM/add_point_on_edge.htm new file mode 100755 index 000000000..2134b248d --- /dev/null +++ b/doc/salome/gui/GEOM/add_point_on_edge.htm @@ -0,0 +1,165 @@ + + + + + +Add Point on Edge + + + + + + + + + + + + +

Add Point on Edge

+ +

To Add Point on Edge in the Main Menu select + Repair - > Add Point on Edge.

+ +

 

+ +

This operation splits an edge in two in accordance + with the specified mode (by length or by parameter) and a value specifying + the position of the point on edge (for example val =0.5; mode = Length). + This operation is available in OCC Viewer + only.

+ +

 

+ +

Result: GEOM_Object.

+ +

 

+ +

TUI Command : + geompy.DivideEdge(Shape, EdgeID, + Value, IsByParameter), where Shape is a shape which contains an + edge to be divided, EdgeID is the ID of the edge to be divided, if it + = -1, then Shape is an edge, Value is a paramter on the edge or a length. + IsByParameter if it is True then Value is the edge parameter in the range + [0:1] otherwise it is a length of the edge in the range [0:1]

+ +

 

+ +

Arguments: + Name + 1 Edge + 1 value setting the position of the point according to + one of the selected modes

+ +

 

+ +

Dialog + Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

     

+ +

 

+ +

Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/arc.htm b/doc/salome/gui/GEOM/arc.htm new file mode 100755 index 000000000..7d62f043c --- /dev/null +++ b/doc/salome/gui/GEOM/arc.htm @@ -0,0 +1,135 @@ + + + + + +Arc + + + + + + + + + + + +

Arc

+ +

To create an Arc in the Main + Menu select New Entity - > + Basic - > Arc

+ +

 

+ +

You can define + an Arc by by three + Points that lie on it. Point1 is the starting point of + the arc, Point2 is a middle point of the arc and Point3 is the ending + point of the arc.

+ +

The + Result of the operation will be a + GEOM_Object (edge).

+ +

 

+ +

TUI Command: + geompy.MakeArc(Point1, Point2, Point3)

+ +

Arguments: + Name + 3 vertices.

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Basic Geometric + Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/archimede.htm b/doc/salome/gui/GEOM/archimede.htm new file mode 100755 index 000000000..bc1c43e8b --- /dev/null +++ b/doc/salome/gui/GEOM/archimede.htm @@ -0,0 +1,135 @@ + + + + + +Archimede + + + + + + + + + + + +

Archimede

+ +

To produce + an Archimede operation in the + Main Menu select Operations - > Archimede

+ +

 

+ +

This + operation creates a plane corresponding to the modeled water-line of the + object plunged into the water (in Z direction).

+ +

 

+ +

The + Result will be any GEOM_Object.

+ +

TUI Command: + geompy.Archimede(Shape,Weight,WaterDensity,MeshingDeflection), + where Shape is a shape to put into the water, Weight is a weight of the + shape, WaterDensity  is + density of water, MeshingDeflection is a deflection of the mesh, using + to compute the section.

+ +

Arguments: + Name + 1 shape  + + 3 values (Weight, Water Density & Meshing Deflection).

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

   

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of the use of Basic Operations. +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/basic_geometrical_objects.htm b/doc/salome/gui/GEOM/basic_geometrical_objects.htm new file mode 100755 index 000000000..6e38ea76f --- /dev/null +++ b/doc/salome/gui/GEOM/basic_geometrical_objects.htm @@ -0,0 +1,656 @@ + + + + + +Basic Geometrical Objects + + + + + + + + + + + +

Basic Geometrical Objects

+ +

Creation of a Point

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0 = geompy.MakeVertex(0., + 0., 0.)

+ +

p100 = geompy.MakeVertexWithRef(p0, + 100., 100., 100.)

+ +

px = geompy.MakeVertex(100., + 0., 0.)

+ +

py = geompy.MakeVertex(0., + 100., 0.)

+ +

pz = geompy.MakeVertex(0., + 0., 100.)

+ +

 

+ +

# create a curve and a vertex on it

+ +

Arc = geompy.MakeArc(py, + pz, px)

+ +

p_on_arc = geompy.MakeVertexOnCurve(Arc, + 0.25)

+ +

 

+ +

# add objects in the study

+ +

id_p0       = + geompy.addToStudy(p0,   "Vertex + 0")

+ +

id_p100     = + geompy.addToStudy(p100, "Vertex 100")

+ +

id_px       = + geompy.addToStudy(px,   "Vertex + X")

+ +

id_py       = + geompy.addToStudy(py,   "Vertex + Y")

+ +

id_pz       = + geompy.addToStudy(pz,   "Vertex + Z")

+ +

id_Arc      = + geompy.addToStudy(Arc,  "Arc")

+ +

id_p_on_arc = geompy.addToStudy(p_on_arc, + "Vertex on Arc")

+ +

 

+ +

# display vertices

+ +

gg.createAndDisplayGO(id_p0)

+ +

gg.createAndDisplayGO(id_p100)

+ +

gg.createAndDisplayGO(id_Arc)

+ +

gg.createAndDisplayGO(id_p_on_arc) +

+ +

 

+ +

Creation of a Line

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0 = geompy.MakeVertex(0., + 0., 0.)

+ +

p100 = geompy.MakeVertexWithRef(p0, + 100., 100., 100.)

+ +

px = geompy.MakeVertex(100., + 0.  , 0. +  )

+ +

py = geompy.MakeVertex(0. +  , 100., + 0.  )

+ +

pz = geompy.MakeVertex(0. +  , 0.  , + 100.)

+ +

 

+ +

# create a vector on two points

+ +

vxy  = + geompy.MakeVector(px, py)

+ +

 

+ +

# create a line with a point and a vector

+ +

line1 = geompy.MakeLine(pz, + vxy)

+ +

 

+ +

#create a line on two points

+ +

line2 = geompy.MakeLineTwoPnt(p0, + p100)

+ +

 

+ +

# add objects in the study

+ +

id_vxy      = + geompy.addToStudy(vxy,  "Vector")

+ +

id_line1    = + geompy.addToStudy(line1,"Line1")

+ +

id_line2    = + geompy.addToStudy(line2,"Line2")

+ +

 

+ +

# display lines

+ +

gg.createAndDisplayGO(id_vxy)

+ +

gg.createAndDisplayGO(id_line1)

+ +

gg.createAndDisplayGO(id_line2) +

+ +

 

+ +

Creation of  a + Circle

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0 = geompy.MakeVertex(0., + 0., 0.)

+ +

px = geompy.MakeVertex(100., + 0.  , 0. +  )

+ +

py = geompy.MakeVertex(0. +  , 100., + 0.  )

+ +

pz = geompy.MakeVertex(0. +  , 0.  , + 100.)

+ +

 

+ +

# create vector on two points

+ +

vxy  = + geompy.MakeVector(px, py)

+ +

 

+ +

# create circle with point, vector and radius

+ +

circle1 = geompy.MakeCircle(pz, + vxy, 30)

+ +

 

+ +

#create circle on three points

+ +

circle2 = geompy.MakeCircleThreePnt(p0, + px, py)

+ +

 

+ +

# add objects in study

+ +

id_vxy      = + geompy.addToStudy(vxy,    "Vector")

+ +

id_circle1  = + geompy.addToStudy(circle1,"Circle1")

+ +

id_circle2  = + geompy.addToStudy(circle2,"Circle2")

+ +

 

+ +

# display circles

+ +

gg.createAndDisplayGO(id_vxy)

+ +

gg.createAndDisplayGO(id_circle1)

+ +

gg.createAndDisplayGO(id_circle2) +

+ +

 

+ +

Creation of an Ellipse

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0 = geompy.MakeVertex(0., + 0., 0.)

+ +

p50 = geompy.MakeVertex(50., + 50., 50.)

+ +

 

+ +

# create vector on two points

+ +

vector  = + geompy.MakeVector(p0, p50)

+ +

 

+ +

# create ellipse with point, vector and radiuses

+ +

ellipse = geompy.MakeEllipse(p50, + vector, 50, 25)

+ +

 

+ +

# add objects in study

+ +

id_vector  = + geompy.addToStudy(vector, "Vector")

+ +

id_ellipse = geompy.addToStudy(ellipse,"Ellipse")

+ +

 

+ +

# display normal vector and ellipse

+ +

gg.createAndDisplayGO(id_vector)

+ +

gg.createAndDisplayGO(id_ellipse) +

+ +

 

+ +

Creation of a Curve

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0 = geompy.MakeVertex(0. +  , 0.  , + 0.  )

+ +

p1 = geompy.MakeVertex(50. + , 100., 200.)

+ +

p2 = geompy.MakeVertex(150., +  50., 100.)

+ +

p3 = geompy.MakeVertex(100., + 150., 170.)

+ +

p4 = geompy.MakeVertex(200., + 200., 150.)

+ +

 

+ +

# create polyline on list of points

+ +

polyline = geompy.MakePolyline([p0, + p1, p2, p3, p4])

+ +

 

+ +

# create bezier on list of points

+ +

bezier = geompy.MakeBezier([p0, + p1, p2, p3, p4])

+ +

 

+ +

#create interpolation curve on list of points

+ +

interpol = geompy.MakeInterpol([p0, + p1, p2, p3, p4])

+ +

 

+ +

# add objects in study

+ +

id_p0       = + geompy.addToStudy(p0,       "Point1")

+ +

id_p1       = + geompy.addToStudy(p1,       "Point2")

+ +

id_p2       = + geompy.addToStudy(p2,       "Point3")

+ +

id_p3       = + geompy.addToStudy(p3,       "Point4")

+ +

id_p4       = + geompy.addToStudy(p4,       "Point5")

+ +

id_polyline = geompy.addToStudy(polyline, + "Polyline")

+ +

id_bezier   = + geompy.addToStudy(bezier,   "Bezier")

+ +

id_interpol = geompy.addToStudy(interpol, + "Interpol")

+ +

 

+ +

# display points and curves

+ +

gg.createAndDisplayGO(id_p0)

+ +

gg.createAndDisplayGO(id_p1)

+ +

gg.createAndDisplayGO(id_p2)

+ +

gg.createAndDisplayGO(id_p3)

+ +

gg.createAndDisplayGO(id_p4)

+ +

gg.createAndDisplayGO(id_polyline)

+ +

gg.createAndDisplayGO(id_bezier)

+ +

gg.createAndDisplayGO(id_interpol) +

+ +

 

+ +

Creation of a Vector

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p1 = geompy.MakeVertex(10., + 50., 20.)

+ +

p2 = geompy.MakeVertex(70., + 70., 70.)

+ +

 

+ +

# create vector on two points

+ +

vector1 = geompy.MakeVector(p1, + p2)

+ +

 

+ +

# create vector with the given components

+ +

vector2 = geompy.MakeVectorDXDYDZ(30, + 30, 100)

+ +

 

+ +

# add objects in study

+ +

id_p1      = + geompy.addToStudy(p1,     "Point1")

+ +

id_p2      = + geompy.addToStudy(p2,     "Point2")

+ +

id_vector1 = geompy.addToStudy(vector1,"Vector1")

+ +

id_vector2 = geompy.addToStudy(vector2,"Vector2")

+ +

 

+ +

# display points and vectors

+ +

gg.createAndDisplayGO(id_p1)

+ +

gg.createAndDisplayGO(id_p2)

+ +

gg.createAndDisplayGO(id_vector1)

+ +

gg.createAndDisplayGO(id_vector2) +

+ +

 

+ +

Creation of a Plane

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p1 = geompy.MakeVertex( +  0.,   0., + 100.)

+ +

p2 = geompy.MakeVertex(100., +   0., +   0.)

+ +

p3 = geompy.MakeVertex(200., + 200., 200.)

+ +

p4 = geompy.MakeVertex(100., + 100.,   0.)

+ +

p5 = geompy.MakeVertex(0. +  , 100., +   0.)

+ +

 

+ +

# create vector with the given components

+ +

vector = geompy.MakeVectorDXDYDZ(100., + 100., 100.)

+ +

 

+ +

# create vector with two points

+ +

vector_arc = geompy.MakeVector(p2, + p5)

+ +

 

+ +

# create arc with three points

+ +

arc = geompy.MakeArc(p2, + p4, p5)

+ +

 

+ +

# create wire

+ +

wire = geompy.MakeWire([vector_arc, + arc])

+ +

 

+ +

# create face

+ +

isPlanarWanted = 1

+ +

face = geompy.MakeFace(wire, + isPlanarWanted)

+ +

trimsize = 1000.

+ +

 

+ +

# create plane with point, vector and trimsize

+ +

plane1 = geompy.MakePlane(p1, + vector, trimsize)

+ +

 

+ +

# create plane with three points and trimsize

+ +

plane2 = geompy.MakePlaneThreePnt(p1, + p2, p3, trimsize)

+ +

 

+ +

# create plane with given face

+ +

plane3 = geompy.MakePlaneFace(face, + trimsize)

+ +

 

+ +

# add objects in study

+ +

id_face   = + geompy.addToStudy(face,  "Face")

+ +

id_plane1 = geompy.addToStudy(plane1,"Plane1")

+ +

id_plane2 = geompy.addToStudy(plane2,"Plane2")

+ +

id_plane3 = geompy.addToStudy(plane3,"Plane3")

+ +

 

+ +

# display points and vectors

+ +

gg.createAndDisplayGO(id_face)

+ +

gg.createAndDisplayGO(id_plane1)

+ +

gg.createAndDisplayGO(id_plane2)

+ +

gg.createAndDisplayGO(id_plane3)

+ +

gg.setDisplayMode(id_plane1,1)

+ +

gg.setTransparency(id_plane1,0.5)

+ +

gg.setDisplayMode(id_plane2,1)

+ +

gg.setTransparency(id_plane2,0.5)

+ +

gg.setDisplayMode(id_plane3,1)

+ +

gg.setTransparency(id_plane3,0.5) +

+ + + + diff --git a/doc/salome/gui/GEOM/basic_operations.htm b/doc/salome/gui/GEOM/basic_operations.htm new file mode 100755 index 000000000..afe039963 --- /dev/null +++ b/doc/salome/gui/GEOM/basic_operations.htm @@ -0,0 +1,242 @@ + + + + + +Basic Operations + + + + + + + + + + + +

Basic Operations

+ +

Partition

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p0   = + geompy.MakeVertex(  0., +   0., +   0.)

+ +

p200 = geompy.MakeVertex(200., + 200., 200.)

+ +

pz   = + geompy.MakeVertex(  0., +   0., + 100.)

+ +

 

+ +

# create vector

+ +

vxyz = geompy.MakeVectorDXDYDZ(100., + 100., 100.)

+ +

 

+ +

# create box with two points

+ +

box = geompy.MakeBoxTwoPnt(p0, + p200)

+ +

 

+ +

# create plane

+ +

trimsize  = + 500.

+ +

plane = geompy.MakePlane(pz, + vxyz, trimsize)

+ +

 

+ +

# create partition objects

+ +

partition1 = geompy.MakePartition([box], + [plane])

+ +

partition2 = geompy.Partition([box], + [plane])

+ +

partition3 = geompy.MakeHalfPartition(box, + plane)

+ +

 

+ +

# add objects in study

+ +

id_box = geompy.addToStudy(box,"Box")

+ +

id_plane = geompy.addToStudy(plane,"Plane")

+ +

id_partition1 = geompy.addToStudy(partition1,"MakePartition")

+ +

id_partition2 = geompy.addToStudy(partition2,"Partition")

+ +

id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")

+ +

 

+ +

# display partition objects and plane

+ +

gg.createAndDisplayGO(id_box)

+ +

gg.setDisplayMode(id_box,1)

+ +

gg.createAndDisplayGO(id_plane)

+ +

gg.setDisplayMode(id_plane,1)

+ +

gg.createAndDisplayGO(id_partition1)

+ +

gg.createAndDisplayGO(id_partition2)

+ +

gg.createAndDisplayGO(id_partition3) +

+ +

Archimede

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p0   = + geompy.MakeVertex(  0., +   0., +   0.)

+ +

p200 = geompy.MakeVertex(200., + 200., 200.)

+ +

 

+ +

# create box with two points

+ +

box = geompy.MakeBoxTwoPnt(p0, + p200)

+ +

 

+ +

# perform an Archimede operation on the given shape with given parameters

+ +

weight  = + 1000000.

+ +

waterdensity = 1.

+ +

meshingdeflection + = 0.01

+ +

archimede  = + geompy.Archimede(box, weight, waterdensity, meshingdeflection)

+ +

 

+ +

# add objects in study

+ +

id_box = geompy.addToStudy(box,"Box")

+ +

id_archimede = geompy.addToStudy(archimede,"Archimede")

+ +

 

+ +

# display box and result of Archimede operation

+ +

gg.createAndDisplayGO(id_box)

+ +

gg.setDisplayMode(id_box,1)

+ +

gg.createAndDisplayGO(id_archimede)

+ +

gg.setDisplayMode(id_archimede,1) +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/blocks_operations.htm b/doc/salome/gui/GEOM/blocks_operations.htm new file mode 100755 index 000000000..6cff43bd2 --- /dev/null +++ b/doc/salome/gui/GEOM/blocks_operations.htm @@ -0,0 +1,258 @@ + + + + + +Blocks Operations + + + + + + + + + + + +

Blocks Operations

+ +

Multi Transformation

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p_25_25_50 = geompy.MakeVertex(25., + 25., 50.)

+ +

p_50_25_25 = geompy.MakeVertex(50., + 25., 25.)

+ +

p_25_50_25 = geompy.MakeVertex(25., + 50., 25.)

+ +

box = geompy.MakeBoxDXDYDZ(50, + 50, 50)

+ +

top_face = geompy.GetFaceNearPoint(box, + p_25_25_50)

+ +

yz_face = geompy.GetFaceNearPoint(box, + p_50_25_25)

+ +

xz_face = geompy.GetFaceNearPoint(box, + p_25_50_25)

+ +

top_face_ind = geompy.LocalOp.GetSubShapeIndex(box, + top_face)

+ +

yz_face_ind = geompy.LocalOp.GetSubShapeIndex(box, + yz_face)

+ +

xz_face_ind = geompy.LocalOp.GetSubShapeIndex(box, + xz_face)

+ +

 

+ +

# Multi-transformate block and glue the result

+ +

box_tr1 = geompy.MakeMultiTransformation1D(box, + yz_face_ind, top_face_ind, 3)

+ +

box_tr2 = geompy.MakeMultiTransformation2D(box, + xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)

+ +

 

+ +

# add objects in study

+ +

id_box = geompy.addToStudy(box, + "Box")

+ +

id_box_tr1 = geompy.addToStudy(box_tr1, + "Multi-transformed Block 1D")

+ +

id_box_tr2 = geompy.addToStudy(box_tr2, + "Multi-transformed Block 2D")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_box)

+ +

gg.setDisplayMode(id_box,1)

+ +

gg.createAndDisplayGO(id_box_tr1)

+ +

gg.createAndDisplayGO(id_box_tr2) +

+ +

 

+ +

Explode on Blocks

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create box and sphere

+ +

box = geompy.MakeBoxDXDYDZ(200, + 200, 200)

+ +

sphere = geompy.MakeSphereR(100)

+ +

 

+ +

# make compound

+ +

compound = geompy.MakeCompound([box, + sphere])

+ +

 

+ +

# get all the blocks, contained in the given compound

+ +

make_block_explode + = geompy.MakeBlockExplode(compound, 1, 1)

+ +

 

+ +

# add objects in study

+ +

id_compound = geompy.addToStudy(compound, + "Compound")

+ +

id_make_block_explode + = geompy.addToStudy(make_block_explode[0], "MakeBlockExplode")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_compound)

+ +

gg.createAndDisplayGO(id_make_block_explode)

+ +

gg.setDisplayMode(id_make_block_explode,1) +

+ +

 

+ +

Propagate

+ +

import geompy

+ +

import salome

+ +

 

+ +

# create box and sphere

+ +

box = geompy.MakeBoxDXDYDZ(200, + 200, 200)

+ +

 

+ +

# check and improve

+ +

check_box = geompy.CheckAndImprove(box)

+ +

  

+ +

# build all possible propagation groups

+ +

listChains = geompy.Propagate(check_box)

+ +

 

+ +

# add objects in study

+ +

geompy.addToStudy(check_box, + "Box")

+ +

for chain in listChains:

+ +

    geompy.addToStudyInFather(check_box, + chain, "propagation chain")

+ +

salome.sg.updateObjBrowser(1) +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/boolean_operations.htm b/doc/salome/gui/GEOM/boolean_operations.htm new file mode 100755 index 000000000..86dc17fa8 --- /dev/null +++ b/doc/salome/gui/GEOM/boolean_operations.htm @@ -0,0 +1,348 @@ + + + + + +Boolean Operations + + + + + + + + + + + +

Boolean Operations

+ +

Fuse

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex(25, + 55, 0)

+ +

p2 = geompy.MakeVertex( + 0,  0, 0)

+ +

v = geompy.MakeVector(p1, + p2)

+ +

 

+ +

# create cylinder

+ +

height = 35

+ +

radius1 = 20

+ +

cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

+ +

 

+ +

# create sphere

+ +

sphere = geompy.MakeSphereR(40)

+ +

 

+ +

# make fuse

+ +

fuse = geompy.MakeFuse(cylinder, + sphere)

+ +

 

+ +

# add objects in study

+ +

id_cylinder = geompy.addToStudy(cylinder, + "Cylinder")

+ +

id_sphere = geompy.addToStudy(sphere, + "Sphere")

+ +

id_fuse = geompy.addToStudy(fuse, + "Fuse")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_cylinder)

+ +

gg.setDisplayMode(id_cylinder,1)

+ +

gg.createAndDisplayGO(id_sphere)

+ +

gg.setDisplayMode(id_sphere,1)

+ +

gg.createAndDisplayGO(id_fuse)

+ +

gg.setDisplayMode(id_fuse,1) +

+ +

 

+ +

Common

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex(25, + 55, 0)

+ +

p2 = geompy.MakeVertex( + 0,  0, 0)

+ +

v = geompy.MakeVector(p1, + p2)

+ +

 

+ +

# create cylinder

+ +

height = 35

+ +

radius1 = 20

+ +

cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

+ +

 

+ +

# create sphere

+ +

sphere = geompy.MakeSphereR(40)

+ +

 

+ +

# make common

+ +

common = geompy.MakeCommon(cylinder, + sphere)

+ +

 

+ +

# add objects in study

+ +

id_common = geompy.addToStudy(common, + "Common")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_common)

+ +

gg.setDisplayMode(id_common,1) +

+ +

 

+ +

Cut

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex(25, + 55, 0)

+ +

p2 = geompy.MakeVertex( + 0,  0, 0)

+ +

v = geompy.MakeVector(p1, + p2)

+ +

 

+ +

# create cylinder

+ +

height = 35

+ +

radius1 = 20

+ +

cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

+ +

 

+ +

# create sphere

+ +

sphere = geompy.MakeSphereR(40)

+ +

 

+ +

# make cut

+ +

cut = geompy.MakeCut(cylinder, + sphere)

+ +

 

+ +

# add objects in study

+ +

id_cut = geompy.addToStudy(cut, + "Cut")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_cut)

+ +

gg.setDisplayMode(id_cut,1) +

+ +

 

+ +

Section

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex(25, + 55, 0)

+ +

p2 = geompy.MakeVertex( + 0,  0, 0)

+ +

v = geompy.MakeVector(p1, + p2)

+ +

 

+ +

# create cylinder

+ +

height = 35

+ +

radius1 = 20

+ +

cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

+ +

 

+ +

# create sphere

+ +

sphere = geompy.MakeSphereR(40)

+ +

 

+ +

# make section

+ +

section = geompy.MakeSection(cylinder, + sphere)

+ +

 

+ +

# add objects in study

+ +

id_section = geompy.addToStudy(section, + "Section")

+ +

 

+ +

# display results

+ +

gg.createAndDisplayGO(id_section)

+ +

gg.setDisplayMode(id_section,1) +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/box.htm b/doc/salome/gui/GEOM/box.htm new file mode 100755 index 000000000..74feb2e36 --- /dev/null +++ b/doc/salome/gui/GEOM/box.htm @@ -0,0 +1,172 @@ + + + + + +Box + + + + + + + + + + + +

Box

+ +

To create a Box + in the Main Menu select New Entity - > Primitives - > Box

+ +

 

+ +

There are 2 algorithms for creation of a Box. +

+ +

The + Result of each operation will be a + GEOM_Object (SOLID).

+ +

 

+ +

Firstly, you can define a Box + by two specified Vertices (its + opposite corners), and with edges, parallel to the coordinate axes.

+ +

TUI Command + : geompy.MakeBoxTwoPnt(Point1, + Point2)

+ +

Arguments: Name + + 2 vertices (opposite corners of the box).

+ +

 

+ +

+ +

 

+ +

Secondly, + you can define a Box by specified dimensions along the coordinate + axes and with edges, parallel to them.  The + center of the box will be at point (DX/2, DY/2, DZ/2).

+ +

TUI Command + : geompy.MakeBoxDXDYDZ(DX, + DY, DZ)

+ +

Arguments: Name + + 3 values (dimensions at origin).

+ +

+ +

 

+ +

NB! The is + a third way to create a Box, which is currently accessible only via TUI commands.

+ +

You + can define a Box by the coordinates + of two Vertices (in this way + you don't need to create them in advance).

+ +

TUI Command: + geompy.MakeBox(x1,y1,z1,x2,y2,z2) +

+ +

Arguments: Name + X, + Y and Z coordinates of both points.

+ +

 

+ +

Example:

+ +

+ +

 

+ +

Our TUI Scripts + provide you with useful examples of creation of Primitives. +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/building_by_blocks.htm b/doc/salome/gui/GEOM/building_by_blocks.htm new file mode 100755 index 000000000..246c6f436 --- /dev/null +++ b/doc/salome/gui/GEOM/building_by_blocks.htm @@ -0,0 +1,330 @@ + + + + + +Building by Blocks + + + + + + + + + + + +

Building by Blocks

+ +

Quadrangle Face

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p1 = geompy.MakeVertex( +  0.,   0., +   0.)

+ +

p2 = geompy.MakeVertex(150., +  30.,   0.)

+ +

p3 = geompy.MakeVertex( +  0., 120., +  50.)

+ +

p4 = geompy.MakeVertex( +  0.,  40., +  70.)

+ +

 

+ +

# create edges

+ +

edge1 = geompy.MakeEdge(p1, + p2)

+ +

edge2 = geompy.MakeEdge(p2, + p3)

+ +

edge3 = geompy.MakeEdge(p3, + p4)

+ +

edge4 = geompy.MakeEdge(p4, + p1)

+ +

 

+ +

# create quadrangle face from four edges

+ +

qface1 = geompy.MakeQuad(edge1, + edge2, edge3, edge4)

+ +

 

+ +

# create quadrangle face on two edges

+ +

qface2 = geompy.MakeQuad2Edges(edge1, + edge3)

+ +

 

+ +

# create quadrangle with specified corners

+ +

qface3 = geompy.MakeQuad4Vertices(p1, + p2, p3, p4)

+ +

 

+ +

# add objects in study

+ +

id_p1 = geompy.addToStudy(p1,"Point1")

+ +

id_p2 = geompy.addToStudy(p2,"Point2")

+ +

id_p3 = geompy.addToStudy(p3,"Point3")

+ +

id_p4 = geompy.addToStudy(p4,"Point4")

+ +

id_edge1 = geompy.addToStudy(edge1,"Edge1")

+ +

id_edge2 = geompy.addToStudy(edge2,"Edge2")

+ +

id_edge3 = geompy.addToStudy(edge3,"Edge3")

+ +

id_edge4 = geompy.addToStudy(edge4,"Edge4")

+ +

id_qface1 = geompy.addToStudy(qface1,"Qface1")

+ +

id_qface2 = geompy.addToStudy(qface2,"Qface2")

+ +

id_qface3 = geompy.addToStudy(qface3,"Qface3")

+ +

 

+ +

# display vertices, edges and quadrangle faces

+ +

gg.createAndDisplayGO(id_p1)

+ +

gg.createAndDisplayGO(id_p2)

+ +

gg.createAndDisplayGO(id_p3)

+ +

gg.createAndDisplayGO(id_p4)

+ +

gg.createAndDisplayGO(id_edge1)

+ +

gg.createAndDisplayGO(id_edge2)

+ +

gg.createAndDisplayGO(id_edge3)

+ +

gg.createAndDisplayGO(id_edge4)

+ +

gg.createAndDisplayGO(id_qface1)

+ +

gg.setDisplayMode(id_qface1,1)

+ +

gg.createAndDisplayGO(id_qface2)

+ +

gg.setDisplayMode(id_qface2,1)

+ +

gg.createAndDisplayGO(id_qface3)

+ +

gg.setDisplayMode(id_qface3,1) +

+ +

 

+ +

Hexagonal Solid

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p1 = geompy.MakeVertex( +  0.,   0., +   0.)

+ +

p2 = geompy.MakeVertex(150., +  30.,   0.)

+ +

p3 = geompy.MakeVertex( +  0., 120., +  50.)

+ +

p4 = geompy.MakeVertex( +  0.,  40., +  70.)

+ +

p5 = geompy.MakeVertex(100., +  20.,  45.)

+ +

p6 = geompy.MakeVertex( +  0., 70., +  40.)

+ +

p7 = geompy.MakeVertex( + 70., 70.,  70.)

+ +

p8 = geompy.MakeVertex( + 70.,-15.,  70.)

+ +

p9 = geompy.MakeVertex( +  0.,  0., +  40.)

+ +

p10 = geompy.MakeVertex( +  0., 70., +   0.)

+ +

p11 = geompy.MakeVertex( + 70., 70.,   0.)

+ +

p12 = geompy.MakeVertex( + 70., -15.,   0.)

+ +

p13 = geompy.MakeVertex( +  0.,  0., +   0.)

+ +

 

+ +

# create faces

+ +

qface1 = geompy.MakeQuad4Vertices(p1, + p2, p3, p4)

+ +

qface2 = geompy.MakeQuad4Vertices(p1, + p2, p5, p4)

+ +

qface3 = geompy.MakeQuad4Vertices(p13, + p12, p11, p10)

+ +

qface4 = geompy.MakeQuad4Vertices(p9, + p8, p7, p6)

+ +

qface5 = geompy.MakeQuad4Vertices(p13, + p9, p6, p10)

+ +

qface6 = geompy.MakeQuad4Vertices(p13, + p9, p8, p12)

+ +

qface7 = geompy.MakeQuad4Vertices(p12, + p8, p7, p11)

+ +

qface8 = geompy.MakeQuad4Vertices(p11, + p7, p6, p10)

+ +

 

+ +

# create hexahedral solid between two given faces

+ +

solid1 = geompy.MakeHexa2Faces(qface1, + qface2)

+ +

 

+ +

# create hexahedral solids, bounded by the six given faces

+ +

solid2 = geompy.MakeHexa(qface3, + qface4, qface5, qface6, qface7, qface8)

+ +

 

+ +

# add objects in study

+ +

id_solid1 = geompy.addToStudy(solid1,"Solid1")

+ +

id_solid2 = geompy.addToStudy(solid2,"Solid2")

+ +

 

+ +

# display solids

+ +

gg.createAndDisplayGO(id_solid1)

+ +

gg.setDisplayMode(id_solid1,1)

+ +

gg.createAndDisplayGO(id_solid2)

+ +

gg.setDisplayMode(id_solid2,1) +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/chamfer.htm b/doc/salome/gui/GEOM/chamfer.htm new file mode 100755 index 000000000..4ad8cfcbe --- /dev/null +++ b/doc/salome/gui/GEOM/chamfer.htm @@ -0,0 +1,192 @@ + + + + + +Chamfer + + + + + + + + + + + + +

Chamfer

+ +

To produce + a Fillet in the Main Menu select + Operations - > Transformation - > + Fillet

+ +

 

+ +

This operation allows you to make chamfer + of the edges of a Shape.

+ +

The Result will + be a GEOM_Object.

+ +

 

+ +

To create + chamfer on all edges of the given shape, you need to define the Main Object to create a chamfer on and + the Dimension (radius) of the + chamfer.  

+ +

TUI Command: + geompy.MakeChamferAll(Shape, D) +

+ +

Arguments: Name + + 1 SHAPE + 1 value (Chamfer dimension).

+ +

 

+ +

 

+ +

 

+ +

To create chamfer on the specified edges of + the given shape,  you + need to define the Main Object + to create a fillet on, select the necessary edges in the object browser + or in the viewer and define the Dimension + of the Chamfer.

+ +

TUI Command: + geompy.MakeChamferEdge(Shape, D1, + D2, Face1, Face2), where Shape is a shape to create a chamfer on, + D1 is a chamfer size along Face1, D2 is a chamfer size along Face2, Face1 + and Face2 are indices of faces in Shape.

+ +

 

+ +

 

+ +

 

+ +

To create chamfer on the specified faces of + the given shape,  you + need to define the Main Object + to create a fillet on, select the necessary faces in the object browser + or in the viewer and define the Dimension + of the Chamfer.

+ +

TUI Command: + geompy.MakeChamferFace(Shape, D1, + D2, ListOfFaceID), where Shape is a shape to create chamfer on, + D1 is a chamfer size along a face from  ListOfFaceID, +  D2 is a + chamfer size along two faces connected to the edge to which the chamfer + is applied, ListOfFaceID is a list of indices of faces in Shape.

+ +

 

+ +

 

+ +

 

+ +

  Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

+ +

 

+ +

 

+ +

 

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/changing_display_parameters.htm b/doc/salome/gui/GEOM/changing_display_parameters.htm new file mode 100755 index 000000000..c2ed2dffe --- /dev/null +++ b/doc/salome/gui/GEOM/changing_display_parameters.htm @@ -0,0 +1,176 @@ + + + + + +Changing Display Parameters + + + + + + + + + + + +

Changing Displaying Parameters

+ +

Changing Color

+ +

import salome

+ +

import geompy

+ +

box = geompy.MakeBox(0,0,0, + 50,50,50)

+ +

 

+ +

sphere = geompy.MakeSphere(50,50,50, + 30)

+ +

fuse = geompy.MakeBoolean(box,sphere,3)

+ +

fuse_id = geompy.addToStudy(fuse,"Fuse")

+ +

 

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

gg.createAndDisplayGO(fuse_id)

+ +

gg.setDisplayMode(fuse_id,1)

+ +

gg.setColor(fuse_id,218,165,31) +

+ +

 

+ +

Changing Display Mode

+ +

import + salome

+ +

import geompy

+ +

box = geompy.MakeBox(0,0,0, + 50,50,50)

+ +

 

+ +

sphere = geompy.MakeSphere(50,50,50, + 30)

+ +

fuse = geompy.MakeBoolean(box,sphere,3)

+ +

fuse_id = geompy.addToStudy(fuse,"Fuse")

+ +

 

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

gg.createAndDisplayGO(fuse_id)

+ +

gg.setDisplayMode(fuse_id,1) +

+ +

 

+ +

Changing Transparency

+ +

import salome

+ +

import geompy

+ +

 

+ +

box = geompy.MakeBox(0,0,0, + 50,50,50)

+ +

sphere = geompy.MakeSphere(50,50,50, + 30)

+ +

 

+ +

fuse = geompy.MakeBoolean(box,sphere,3)

+ +

fuse_id = geompy.addToStudy(fuse,"Fuse")

+ +

 

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

gg.createAndDisplayGO(fuse_id)

+ +

gg.setDisplayMode(fuse_id,1)

+ +

gg.setColor(fuse_id,218,165,31)

+ +

gg.setTransparency(fuse_id,0.5) +

+ + + + diff --git a/doc/salome/gui/GEOM/changing_displaying_parameters.htm b/doc/salome/gui/GEOM/changing_displaying_parameters.htm new file mode 100755 index 000000000..42ab05be2 --- /dev/null +++ b/doc/salome/gui/GEOM/changing_displaying_parameters.htm @@ -0,0 +1,256 @@ + + + + + +Changing displaying parameters + + + + + + + + + + + +

Changing displaying parameters

+ +

In GEOM you can set different + displaying parameters for visualization of geometrical objects in the + viewer:

+ +

 

+ + + +

 

+ +

To set displaying parameters of a geometrical object:

+ +

 

+ +

Right-click on this geometrical object in + the viewer and from the pop-up menu select Properties.

+ +

 

+ +

 

+ +

Wireframe/Shading

+ +

 

+ +

Description: + Set the display mode of the selected shape.

+ +

 

+ +

TUI + Command: gg.setDisplayMode(ID, Short)

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

 

+ +

Color

+ +

 

+ +

Description: + Change the color of a shape.

+ +

 

+ +

TUI Command: + gg.setColor(ID, Short, Short, Short)

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

 

+ +

 

+ +

Transparency

+ +

 

+ +

Description: + Change the transparency (between 0 & 1) of a shape.

+ +

 

+ +

TUI Command: + gg.setTransparency(ID, Double)

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

Isos

+ +

 

+ +

Description: + Changes the number of isolines displayed within a shape.

+ +

 

+ +

Arguments: + 2 values (number of isolines).

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of Changing Displaying Parameters. +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/check_free_boundaries.htm b/doc/salome/gui/GEOM/check_free_boundaries.htm new file mode 100755 index 000000000..d5da15b92 --- /dev/null +++ b/doc/salome/gui/GEOM/check_free_boundaries.htm @@ -0,0 +1,154 @@ + + + + + +Check Free Boundaries + + + + + + + + + + + + +

Check Free Boundaries

+ +

To Check Free Boundaries in the Main Menu + select Repair - > Check Free Boundaries.

+ +

 

+ +

This operation detects wires and edges that + correspond to the shape's boundary, and highlights it

+ +

 

+ +

Result: GEOM_Object. +

+ +

 

+ +

TUI Command : (NoError, ClosedWires, OpenWires) = geompy.GetFreeBoundary(Shape), + where Shape is a shape to be checked, NoError is false if an error occurred + while checking free boundaries, ClosedWires is a list of closed free boundary + wires, OpenWires is a list of open free boundary wires.

+ +

 

+ +

Arguments: + Shape

+ +

 

+ +

Dialog + Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

  

+ +

 

+ +

Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/check_free_faces.htm b/doc/salome/gui/GEOM/check_free_faces.htm new file mode 100755 index 000000000..68757732c --- /dev/null +++ b/doc/salome/gui/GEOM/check_free_faces.htm @@ -0,0 +1,148 @@ + + + + + +Check Free Faces + + + + + + + + + + + + +

Check Free Faces

+ +

To Check Free Faces in the Main Menu select + Repair - > Check Free Faces.

+ +

 

+ +

This operation retrieves all free faces from + a given shape. A free face is a face not shared between two shells of + the shape.

+ +

 

+ +

Result: GEOM_Object. + Returns a list of IDs of all free faces, contained in the shape.

+ +

TUI Command : GetFreeFacesIDs(Shape), where + Shape is a shape to be checked.

+ +

Arguments: + Shape

+ +

 

+ +

 

+ +

+ +

 

+ +

Examples:

+ +

 

+ +

 

+ +

 

+ +

Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/circle.htm b/doc/salome/gui/GEOM/circle.htm new file mode 100755 index 000000000..22ad198ca --- /dev/null +++ b/doc/salome/gui/GEOM/circle.htm @@ -0,0 +1,150 @@ + + + + + +Circle + + + + + + + + + + + +

Circle

+ +

To create a Circle + in the Main Menu select New Entity - > Basic - > Circle

+ +

 

+ +

There + are 2 algorithms to create a Circle in + the 3D space.

+ +

The + Result of each operation will be a + GEOM_Object (edge).

+ +

 

+ +

Firstly, + you can define a Circle by a Center Point, a + Vector giving the circleÂ’s + normal and a Radius.

+ +

TUI Command: + geompy.MakeCircle(Point, Vector, Radius)

+ +

Arguments: + Name + 1 vertex (for the center) + + 1 edge (for the direction) + Radius.

+ +

 

+ +

+ +

 

+ +

Secondly, + you can define a Circle by three + Points that lie on it.

+ +

TUI + Command:  geompy.MakeCircleThreePnt(Point1, + Point2, Point3)

+ +

Arguments: + Name + 3 points which will form + the circle.

+ +

 

+ +

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Basic + Geometric Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/close_contour.htm b/doc/salome/gui/GEOM/close_contour.htm new file mode 100755 index 000000000..3dd603fc4 --- /dev/null +++ b/doc/salome/gui/GEOM/close_contour.htm @@ -0,0 +1,149 @@ + + + + + +Close Contour + + + + + + + + + + + +

Close Contour

+ +

To produce + a Close Contour operation in the + Main Menu select Repair - > Close + Contour.

+ +

 

+ +

This operation closes an open contour and modifies + the underlying face (if needed) in accordance with user specified mode:

+ + + +

This operation is available in OCC + Viewer only.

+ +

 

+ +

Result: GEOM_Object.

+ +

 

+ +

TUI Command: + geompy.CloseContour(Shape, Wires, + IsCommonVertex), where Shape is a shape to be processed, Wires + is a list of edges or wires IDÂ’s which has to be closed within the shape + (if the list contains only one element = -1, the shape itself is considered + as a wire),  IsCommonVertex + if this parameter is True a closure has to be done by creation of a common + vertex, otherwise an edge is added between the end vertices.

+ +

 

+ +

Arguments: Name + 1 shape + contour (Wire, + or a set of Edges) + mode of closure (by vertex or by edge)

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/common.htm b/doc/salome/gui/GEOM/common.htm new file mode 100755 index 000000000..02eab0666 --- /dev/null +++ b/doc/salome/gui/GEOM/common.htm @@ -0,0 +1,141 @@ + + + + + +Common + + + + + + + + + + + + +

Common

+ +

To produce + a Common in the Main Menu select + Operations - > Boolean - > Common

+ +

 

+ +

This + operation cuts the common part of two shapes and transforms + it into an independent geometrical object.

+ +

 

+ +

The + Result will be a GEOM_Object + (COMPOUND).

+ +

TUI Command: +  geompy.MakeCommon(s1, + s2)

+ +

Arguments: + Name + 2 shapes.

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of the use of Boolean Operations. +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/complex_objects.htm b/doc/salome/gui/GEOM/complex_objects.htm new file mode 100755 index 000000000..00e9e0437 --- /dev/null +++ b/doc/salome/gui/GEOM/complex_objects.htm @@ -0,0 +1,484 @@ + + + + + +Complex Objects + + + + + + + + + + + +

Complex Objects

+ +

Creation of a Prism

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex( +   0., +   0., +   0.)

+ +

p2 = geompy.MakeVertex( + 100.,   0., +   0.)

+ +

p3 = geompy.MakeVertex( + 100., 100.,   0.)

+ +

p4 = geompy.MakeVertex( +   0., + 100.,   0.)

+ +

p5 = geompy.MakeVertex( +   0., +   0., +  60.)

+ +

p6 = geompy.MakeVertex(-100., +   0., +   0.)

+ +

p7 = geompy.MakeVertex(-100.,-100., +   0.)

+ +

p8 = geompy.MakeVertex( +   0.,-100., +   0.)

+ +

 

+ +

# create vector with the given components

+ +

vector = geompy.MakeVectorDXDYDZ(50., + 50., 50.)

+ +

 

+ +

#create vectors with two points

+ +

vector1_arc1 = geompy.MakeVector(p1, + p2)

+ +

vector2_arc1 = geompy.MakeVector(p1, + p4)

+ +

vector1_arc2 = geompy.MakeVector(p1, + p6)

+ +

vector2_arc2 = geompy.MakeVector(p1, + p8)

+ +

 

+ +

# create arcs with three points

+ +

arc1 = geompy.MakeArc(p2, + p3, p4)

+ +

arc2 = geompy.MakeArc(p6, + p7, p8)

+ +

 

+ +

# create wires

+ +

wire1 = geompy.MakeWire([vector1_arc1, + arc1, vector2_arc1])

+ +

wire2 = geompy.MakeWire([vector1_arc2, + arc2, vector2_arc2])

+ +

 

+ +

# create faces

+ +

isPlanarWanted = 1

+ +

face1 = geompy.MakeFace(wire1, + isPlanarWanted)

+ +

face2 = geompy.MakeFace(wire2, + isPlanarWanted)

+ +

 

+ +

# create prisms

+ +

prism1 = geompy.MakePrism(face2, + p1, p5)

+ +

prism2 = geompy.MakePrismVecH(face1, + vector, 50)

+ +

 

+ +

# add objects in study

+ +

id_face1   = + geompy.addToStudy(face1,"Face1")

+ +

id_face2   = + geompy.addToStudy(face2,"Face2")

+ +

id_prism1 = geompy.addToStudy(prism1,"Prism1")

+ +

id_prism2 = geompy.addToStudy(prism2,"Prism2")

+ +

 

+ +

# display cylinders

+ +

gg.createAndDisplayGO(id_face1)

+ +

gg.setDisplayMode(id_face1,1)

+ +

gg.createAndDisplayGO(id_face2)

+ +

gg.setDisplayMode(id_face2,1)

+ +

gg.createAndDisplayGO(id_prism1)

+ +

gg.setDisplayMode(id_prism1,1)

+ +

gg.createAndDisplayGO(id_prism2)

+ +

gg.setDisplayMode(id_prism2,1) +

+ +

Creation of a Revolution

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex( +  10.,  10., +  10.)

+ +

p2 = geompy.MakeVertex( +  15.,  15., +  50.)

+ +

p3 = geompy.MakeVertex( +  40.,  40., +   0.)

+ +

 

+ +

#create vectors with two points

+ +

vector1 = geompy.MakeVector(p1, + p2)

+ +

vector2 = geompy.MakeVector(p1, + p3)

+ +

 

+ +

# create vector with the given components

+ +

vector3 = geompy.MakeVectorDXDYDZ(-20., + -20., 100.)

+ +

 

+ +

# create wire

+ +

wire = geompy.MakeWire([vector1, + vector2])

+ +

 

+ +

# create revolution

+ +

revolution = geompy.MakeRevolution(wire, + vector3, 2.3)

+ +

 

+ +

# add objects in study

+ +

id_vector3    = + geompy.addToStudy(vector3,"Axis")

+ +

id_wire       = + geompy.addToStudy(wire,"Wire")

+ +

id_revolution = geompy.addToStudy(revolution,"Revolution")

+ +

 

+ +

# display vector, wire and revolution

+ +

gg.createAndDisplayGO(id_vector3)

+ +

gg.createAndDisplayGO(id_wire)

+ +

gg.createAndDisplayGO(id_revolution)

+ +

gg.setDisplayMode(id_revolution,1) +

+ +

Creation of a Filling

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

mindeg = 2

+ +

maxdeg = 5

+ +

tol3d   = + 0.0001

+ +

tol2d   = + 0.0001

+ +

nbiter = 5

+ +

 

+ +

# create vertex and vector

+ +

p1 = geompy.MakeVertex( +  -30.,  -30., +  50.)

+ +

p2 = geompy.MakeVertex( +  -60.,  -60., +  30.)

+ +

p3 = geompy.MakeVertex( +  -30.,  -30., +  10.)

+ +

 

+ +

# create arc with three points

+ +

arc = geompy.MakeArc(p1, + p2, p3)

+ +

ShapeListCompound + = []

+ +

i = 0

+ +

while i <= 3 :

+ +

    S + = geompy.MakeTranslation(arc, i * 50., 0., 0.)

+ +

    ShapeListCompound.append(S)

+ +

    i + = i + 1

+ +

compound = geompy.MakeCompound(ShapeListCompound)

+ +

 

+ +

# create filling

+ +

filling = geompy.MakeFilling(compound, + mindeg, maxdeg, tol3d, tol2d, nbiter)

+ +

 

+ +

# add objects in study

+ +

id_compound = geompy.addToStudy(compound,"Compound")

+ +

id_filling = geompy.addToStudy(filling,"Filling")

+ +

 

+ +

# display compound and filling

+ +

gg.createAndDisplayGO(id_compound)

+ +

gg.createAndDisplayGO(id_filling)

+ +

gg.setDisplayMode(id_filling,1) +

+ +

 

+ +

Creation of a Pipe

+ +

import geompy

+ +

import salome

+ +

gg = salome.ImportComponentGUI("GEOM")

+ +

 

+ +

# create vertices

+ +

p0   = + geompy.MakeVertex(0.  , + 0.  , 0. +  )

+ +

px   = + geompy.MakeVertex(100., 0.  , + 0.  )

+ +

py   = + geompy.MakeVertex(0.  , + 100., 0.  )

+ +

pz   = + geompy.MakeVertex(0.  , + 0.  , 100.)

+ +

pxyz = geompy.MakeVertex(100., + 100., 100.)

+ +

 

+ +

# create vector on two points

+ +

vxy = geompy.MakeVector(px, + py)

+ +

 

+ +

# create arc with three points

+ +

arc = geompy.MakeArc(py, + pz, px)

+ +

 

+ +

# create wire

+ +

wire = geompy.MakeWire([vxy, + arc])

+ +

 

+ +

# create edge

+ +

edge = geompy.MakeEdge(p0, + pxyz)

+ +

 

+ +

# create pipe

+ +

pipe = geompy.MakePipe(wire, + edge)

+ +

 

+ +

# add objects in study

+ +

id_wire = geompy.addToStudy(wire,"Wire")

+ +

id_edge = geompy.addToStudy(edge,"Edge")

+ +

id_pipe = geompy.addToStudy(pipe,"Pipe")

+ +

 

+ +

# display wire, edge (path) and pipe

+ +

gg.createAndDisplayGO(id_wire)

+ +

gg.createAndDisplayGO(id_edge)

+ +

gg.createAndDisplayGO(id_pipe)

+ +

gg.setDisplayMode(id_pipe,1) +

+ + + + diff --git a/doc/salome/gui/GEOM/compound.htm b/doc/salome/gui/GEOM/compound.htm new file mode 100755 index 000000000..2649dacef --- /dev/null +++ b/doc/salome/gui/GEOM/compound.htm @@ -0,0 +1,133 @@ + + + + + +Compound + + + + + + + + + + + +

Compound

+ +

To create + a Compound in the Main Menu select + New Entity - > Build - > Compound.

+ +

 

+ +

You can create a compound from a list of shells. +

+ +

The + Result will be a GEOM_Object + (COMPOUND).

+ +

 

+ +

TUI Command: + geompy.MakeCompound(ListOfShape)

+ +

Arguments: + Name + List of shapes.

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

+ +

 

+ +

 

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/cone.htm b/doc/salome/gui/GEOM/cone.htm new file mode 100755 index 000000000..08858fe3f --- /dev/null +++ b/doc/salome/gui/GEOM/cone.htm @@ -0,0 +1,169 @@ + + + + + +Cone + + + + + + + + + + + + +

 Cone

+ +

To create a Cone + in the Main Menu select New Entity - > Primitives - > Cone

+ +

 

+ +

There are two algorithms for creation of a Torus. +

+ +

The + Result of each operation will be a + GEOM_Object (SOLID).

+ +

 

+ +

Firstly, you can define a Cone + by the Base Point (the central + point of the cone base), the Axis, + the Height and the first and the + second Radiuses.

+ +

TUI Command: geompy.MakeCone(Point, + Axis, Radius1, Radius2)

+ +

Arguments: + Name + 1 vertex + + 1 vector (for direction) + 3 values (Radius of the base part, radius + of the upper part, height).

+ +

+ +

 

+ +

Secondly, you can define a Cone + with the centre at the origin of coordinates by its Height + and Radiuses. The Axis + of the Cone will be collinear + to the OZ axis of the coordinate system.

+ +

TUI Command: geompy.MakeConeR1R2H(Radius1, + Radius2, Height)

+ +

Arguments: + Name + 3 values + (Radius of the base part, radius of the upper part, height).

+ +

  

+ +

 

+ +

Note: If both radiuses are non-zero, + the Cone will be truncated. If + the radiuses are equal, a Cylinder + will be created instead.

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Primitives.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/curve.htm b/doc/salome/gui/GEOM/curve.htm new file mode 100755 index 000000000..fd55288e3 --- /dev/null +++ b/doc/salome/gui/GEOM/curve.htm @@ -0,0 +1,162 @@ + + + + + +Curve + + + + + + + + + + + +

 Curve

+ +

To create a Curve in the Main Menu select New + Entity - > Basic - > Curve

+ +

 

+ +

There are three algorithms to create + a Curve in the 3D space. Each time you define it by + a list of Points through which the curve passes. The three Curve Construction menu choices correspond to the three possible + types of curves: Polyline, Besier or B-spline (Interpolated) curve.

+ +

The Result of + each operation will be a GEOM_Object (edge).

+ +

 

+ +

TUI Commands: +

+ + + +

ListOfShape is a list of points through which + the curve passes.

+ +

Arguments: + Name + at least 2 points which will serve as nodes on the curve.

+ +

 

+ +

+ +

 

+ +

Examples:

+ +

 

+ +

Polyline +                                                                      Bezier +                                                                        B-Spline

+ +

          

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Basic + Geometric Objects.

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/cut.htm b/doc/salome/gui/GEOM/cut.htm new file mode 100755 index 000000000..cc5d74ed0 --- /dev/null +++ b/doc/salome/gui/GEOM/cut.htm @@ -0,0 +1,138 @@ + + + + + +Cut + + + + + + + + + + + + +

Cut

+ +

To produce + a Cut in the Main Menu select + Operations - > Boolean - > Cut

+ +

 

+ +

This operation cuts a shape with another + one.

+ +

The + Result will be a  GEOM_Object + (COMPOUND).

+ +

Arguments: + Name + 2 shapes.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of the use of Boolean Operations. +

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/cylinder.htm b/doc/salome/gui/GEOM/cylinder.htm new file mode 100755 index 000000000..087d2d73d --- /dev/null +++ b/doc/salome/gui/GEOM/cylinder.htm @@ -0,0 +1,160 @@ + + + + + +Cylinder + + + + + + + + + + + + +

Cylinder

+ +

To create a Cylinder + in the Main Menu select New Entity - > Primitives - > Cylinder

+ +

 

+ +

There are 2 algorithms for creation of a Cylinder. +

+ +

The + Result of each operation will be a + GEOM_Object (SOLID).

+ +

 

+ +

Firstly, you can define a Cylinder + by the Base Point (the central + point of the cylinder base), the Vector + (the axis of the cylinder), and its dimensions: the Radius and the Height.

+ +

TUI Command: geompy.MakeCylinder(Point, + Axis, Radius, Height),

+ +

Arguments: +  Name + + 1 vertex + 1 vector + 2 values (Dimensions: radius and height).

+ +

+ +

 

+ +

Secondly, you can define a + Cylinder by the given radius + and the height at  the + origin of coordinate system. The axis of the cylinder will be collinear + to the OZ axis of the coordinate system.

+ +

TUI Command: geompy.MakeCylinderRH(Radius, + Height)

+ +

Arguments: Name + + 2 values (Dimensions at origin: radius and height).

+ +

  

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Primitives.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/edge.htm b/doc/salome/gui/GEOM/edge.htm new file mode 100755 index 000000000..184e5ba47 --- /dev/null +++ b/doc/salome/gui/GEOM/edge.htm @@ -0,0 +1,130 @@ + + + + + +Edge + + + + + + + + + + + +

Edge

+ +

To + create an Edge in the Main + Menu select New Entity - > + Build - > Edge

+ +

 

+ +

You can create an Edge + from two points (Point1 and Point2), being the first and the last + vertices of the edge.

+ +

The + Result  will + be a GEOM_Object (EDGE).

+ +

TUI Command: + geompy.MakeEdge(Vertex1, Vertex2), + where Vertex1 and Vertex2 are correspondingly the first and the last vertex + of the edge.

+ +

Arguments: + Name + 2 vertices.

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/ellipse.htm b/doc/salome/gui/GEOM/ellipse.htm new file mode 100755 index 000000000..f8b34dad2 --- /dev/null +++ b/doc/salome/gui/GEOM/ellipse.htm @@ -0,0 +1,148 @@ + + + + + +Ellipse + + + + + + + + + + + + +

Ellipse

+ +

To create an Ellipse in the Main + Menu select New Entity - > + Basic - > Ellipse

+ +

 

+ +

You + can define an Ellipse by its + Center Point, a Vector giving its normal, and its Major & + Minor Radiuses.

+ +

The + Result of the operation will be a + GEOM_Object (edge).

+ +

 

+ +

TUI Command: geompy.MakeEllipse(Point, Vector, RadiusMajor, + RadiusMinor),

+ +

Arguments: + Name + 1 vertex (for the center) + 1 edge (for the direction) + 1 X Radius + + 1 Y Radius.

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts + provide you with useful examples of creation of Basic + Geometric Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/explode.htm b/doc/salome/gui/GEOM/explode.htm new file mode 100755 index 000000000..46e1d3560 --- /dev/null +++ b/doc/salome/gui/GEOM/explode.htm @@ -0,0 +1,180 @@ + + + + + +Explode + + + + + + + + + + + + +

 Explode

+ +

To Explode + an object into subshapes, in the main menu select New + Entity > Explode.

+ +

 

+ +

To create a list of  subshapes + (vertices, edges, wires etc.) of the given shape using the Explode + operation, you need to define the Main + Object, which will be exploded and + the Type of Subshapes you wish to obtain from it.

+ +

The + Result of the operation will be a List + of GEOM_Objects (edges, faces, solids or compsolids).

+ +

 

+ +

Using + TUI Commands you can perform this operation + in a variety of ways:

+ + + +

 

+ +

Arguments: + 1 SHAPE + 1 type of SubShape.

+ +

 

+ +

 

+ +

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/explode_on_blocks.htm b/doc/salome/gui/GEOM/explode_on_blocks.htm new file mode 100755 index 000000000..7022e94bd --- /dev/null +++ b/doc/salome/gui/GEOM/explode_on_blocks.htm @@ -0,0 +1,163 @@ + + + + + +Explode on Blocks + + + + + + + + + + + + +

Explode on Blocks

+ +

To produce + an Explode on Blocks operation + in the Main Menu select Operations - + > Blocks - > Explode on Blocks.

+ +

 

+ +

This operation + returns blocks of the given compound. The user may define the type blocks + to be extracted by setting the minimum and maximum number of faces in + the target block. By checking the corresponding box the user may also + interactively choose the blocks from a compound .

+ +

 

+ +

The + Result will be a GEOM_Object.

+ +

 

+ +

TUI Command: + geompy.MakeBlockExplode(Compound, + MinNbFaces, MaxNbFaces), where Compound is a compound to be exploded + into the blocks, MinNbFaces, MaxNbFaces are correspondingly the minimal + and  the + maximal number of faces of the resulting blocks.

+ +

Arguments: 1 compound + 1 integer (min. and max. number + of faces in the block to be extracted).

+ +

 

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

   Our TUI + Scripts provide you with useful examples + of the use of Blocks + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/extrusion.htm b/doc/salome/gui/GEOM/extrusion.htm new file mode 100755 index 000000000..27efe7e60 --- /dev/null +++ b/doc/salome/gui/GEOM/extrusion.htm @@ -0,0 +1,169 @@ + + + + + +Extrusion + + + + + + + + + + + + +

 Extrusion

+ +

To generate an Extrusion on an object in the Main Menu select New + Entity - > Generation  - + > Extrusion

+ +

 

+ +

To create an Extrusion (Prism) you should define + the Base Shape (a basis of the + extrusion), the Vector + (a normal of the extrusion) and the Height + of extrusion.  

+ +

The + Result of the operation will be a + GEOM_Object (edge, face, solid or compsolid).

+ +

TUI + Command : geompy.MakePrismVecH(Base, + Vector, Height)

+ +

Arguments: Name + 1 shape (vertex, + edge, wire, face or shell) serving as base object + 1 vector (for direction) + + 1 value (dimension).

+ +

 

+ +

+ +

 

+ +

NB! The + is another way to create an Extrusion, which + is currently accessible only via TUI commands.

+ +

You + can define the Extrusion by + the Base Shape and the Start and End Point + of the Vector  (in + this way you don't need to create it in advance).

+ +

TUI + Command: geompy.MakePrism(Base, + Point1, Point2)

+ +

 

+ +

 

+ +

Examples:

+ +

 

+ +

Base Shape                                                          Prisms

+ +

 

+ +

 

+ +

Our TUI Scripts + provide you with useful examples of creation of Complex + Geometric Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/face.htm b/doc/salome/gui/GEOM/face.htm new file mode 100755 index 000000000..0b8231d67 --- /dev/null +++ b/doc/salome/gui/GEOM/face.htm @@ -0,0 +1,151 @@ + + + + + +Face + + + + + + + + + + + +

 Face

+ +

To create + a Face in the Main Menu select + New Entity - > Build - > Face

+ +

 

+ +

To + create a Face + you need to select a wire, whose elements will be connected so that the + surface of the resulting object was minimal. Check Try + to create a planar face to create + a planar face or nothing if it is impossible.

+ +

The + Result will be a GEOM_Object + (FACE).

+ +

 

+ +

TUI Command: + geompy.MakeFace(Wire, isPlanarWanted)

+ +

Arguments: + Name + 1 wire.

+ +

 

+ +

+ +

 

+ +

TUI commands + give you some advanced possibilities.

+ +

 

+ +

geompy.MakeFaceWires(Wires, + isPlanarWanted) - Creates a face on the given wires set. The argument + is not a single wire, but a list of wires.

+ +

geompy.MakeFaces(Wires, + isPlanarWanted) is a shortcut to MakeFaceWires(). +

+ +

 

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_basicgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_basicgui_functions.htm new file mode 100755 index 000000000..1630c691f --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_basicgui_functions.htm @@ -0,0 +1,885 @@ + + + + + +Titre + + + + + + + + + + + + +

Creating basic geometrical objects

+ +

In GEOM you can create basic geometrical objects (1D + & 2D elements) such as:

+ +

+ + + + + + +

 

+ +

 

+ +

To create basic geometrical objects:

+ +

 

+ +

In the main menu select New + Entity > Basic.

+ +

 

+ +  + +

Point

+ +

 

+ +

Description: + Creates a point.

+ +

 

+ +

Result: GEOM_Object + (vertex).

+ +

 

+ +

TUI Command : +   geompy.MakeVertex(X, + Y, Z) -

+ +

geompy.MakeVertexWithRef(Reference, + X, Y, Z)

+ +

geompy.MakeVertexOnCurve(Edge, Parameter) +

+ +

 

+ +

Arguments:

+ + + +

 

+ +

Dialog Box:

+ +

 

+ + ++++ + + + + +
+

+

+

+ +

 

+ +

 

+ +

   

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

Line

+ +

 

+ +

Description: + Creates a line.

+ +

 

+ +

Result: GEOM_Object + (edge).

+ +

 

+ +

TUI Command: + geompy.MakeLine(Point1, Point2), + where Point1 and Point2 are points through  which + the line passes.

+ +

 

+ +

Arguments: + Name + 2 vertices.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

Circle

+ +

 

+ +

Description: + Creates a circle.

+ +

 

+ +

Result: GEOM_Object + (edge).

+ +

 

+ +

TUI Command: + geompy.MakeCircle(Point, Vector, Radius), + where Point defines the center of the circle, Vector gives the circleÂ’s + normal and Radius is the circleÂ’s  radius.

+ +

 

+ +

Arguments: +

+ + + +

 

+ +

 

+ +

 

+ +

Dialog Box:

+ +

 

+ + +++ + + + +
+

+

+ +

 

+ +

 

+ +

 

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Ellipse

+ +

 

+ +

Description: + Creates an ellipse.

+ +

 

+ +

Result: GEOM_Object + (edge).

+ +

 

+ +

TUI Command: geompy.MakeEllipse(Point, Vector, RadiusMajor, + RadiusMinor), where Point defines the center of the ellipse, Vector + gives the ellipseÂ’s normal, RadiusMajor and RadiusMinor  are + correspondingly a major and minor radiuses of the ellipse.

+ +

 

+ +

Arguments: + Name + 1 vertex (for the center) + 1 edge (for the direction) + 1 X Radius + + 1 Y Radius.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

Arc

+ +

 

+ +

Description: + Creates an arc.

+ +

 

+ +

Result: GEOM_Object + (edge).

+ +

 

+ +

TUI Command: + geompy.MakeArc(Point1, Point2, Point3), + where Point1 is the starting point of the arc, Point2 is a middle point + of the arc and Point3 is the ending point of the arc.

+ +

 

+ +

Arguments: + Name + 3 vertices.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

Curve

+ +

 

+ +

Description: + Creates a curve in 3D space.

+ +

 

+ +

Result: + GEOM_Object (edge).

+ +

 

+ +

TUI Command: +

+ + + +

 

+ +

Arguments: + Name + at least 2 points which will serve as nodes on the curve.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

Polyline +                                          Bezier +                                      B-Spline

+ +

          

+ +

 

+ +

 

+ +

Vector

+ +

 

+ +

Description: + Creates a vector.

+ +

 

+ +

Result: GEOM_Object + (edge).

+ +

 

+ +

TUI Command: + geompy.MakeVector(Point1, Point2), + where Point1 is the first point of the vector and the Point2 is the last + point of the vector.

+ +

 

+ +

Arguments :

+ + + +

 

+ +

Dialog Box:

+ +

 

+ +

      

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Plane

+ +

 

+ +

Description: + Creates a plane.

+ +

 

+ +

Result: GEOM_Object + (face).

+ +

 

+ +

TUI Command: + geompy.MakePlane(Point, Vector, TrimSize), + where Point is a point through which  the + plane passes, Vector gives a normal of the plane and TrimSize is a half + size of a side of quadrangle face, representing the plane.

+ +

 

+ +

Arguments:

+ + + +

 

+ +

Dialog Box:

+ +

 

+ + ++++ + + + + +
+

+

+

+ +

 

+ +

 

+ +

         

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

Working + Plane

+ +

 

+ +

Description: + Sets the working plane (and the camera position).

+ +

 

+ +

Arguments: +

+ + + +

 

+ +

 

+ +

Dialog Box:

+ +

 

+ + ++++ + + + + +
+

+

+

+ +

 

+ +

 

+ +

 

+ +

 

+ +

 

+ +

Local + coordinate system

+ +

 

+ +

Description: +  The user + may manually enter values of X, Y, and Z coordinates of origin in the + corresponding fields of the dialog box, or select a point in the object + browser or 3D viewer, in this case coordinates of origin are automatically + filled in with the coordinates of the selected point.

+ +

The user then specifies components of X and + Y axes direction.

+ +

Preview of the new LCS (small trihedron located + and oriented according to parameters of LCS) is displayed in the 3D viewer + and updated as soon as the user modifies some parameter.

+ +

Then the user presses «OK» or «Apply» button + to create an LCS at the location with the specified coordinates. The new + object is shown in the Object Browser and in 3D viewer.

+ +

 

+ +

 

+ +

TUI command: + geompy.MakeMarker(OX, OY, OZ, XDX, XDY, + XDZ, YDX, YDY, YDZ), where OX, OY, OZ are coordinates of the origin + of LCS, XDX, XDY, XDZ is a vector of OX  direction + of the LCS and YDX, YDY, YDZ is a a vector of OY direction of the LCS.

+ +

 

+ +

 

+ +

Arguments: +

+ + + +

 

+ +

.

+ +

 

+ +

Dialog Box:

+ +

 

+ + ++++ + + + + +
+

+

+

+ +

 

+ +

Example:

+ +

 

+ +

+ + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_booleangui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_booleangui_functions.htm new file mode 100755 index 000000000..c290d8bf3 --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_booleangui_functions.htm @@ -0,0 +1,153 @@ + + + + + +Titre + + + + + + + + + + + + +

Using boolean operations

+ +

 

+ +

In GEOM for construction of more complex geometrical objects + (2D & 3D elements) you can use the following boolean operations:

+ +

 

+ + + + + +

 

+ +

There is a general TUI command covering + all these operations, which can be used alongside with separate commands + for each operation.

+ +

geompy.MakeBoolean(Shape1, + Shape2, Operation), where Shape1 is the first argument and Shape2 + is the second argument of Boolean operation, Operation is a type of the + Boolean operation (1 – Common, 2 – Cut, 3 – Fuse, 4 – Section).

+ +

 

+ +

Our TUI + Scripts provide you with useful examples of the use of Boolean + Operations.

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_buildgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_buildgui_functions.htm new file mode 100755 index 000000000..42c0ee8ea --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_buildgui_functions.htm @@ -0,0 +1,458 @@ + + + + + +Titre + + + + + + + + + + + +

Building geometrical objects

+ +

In GEOM you can create basic and advanced geometrical objects + (2D & 3D elements) using the following building functions:

+ +

 

+ + + +

 

+ +

 

+ +

 

+ +

To use Explode:

+ +

 

+ +

In the main menu select New + Entity > Explode.

+ +

 

+ +

Explode

+ +

 

+ +

Description: + Returns a list of subshapes (vertices, edges, wires etc.) of the given + shape.

+ +

 

+ +

Result : + List of GEOM_Objects.

+ +

 

+ +

TUI Command: +

+ + + +

 

+ +

Arguments: + 1 SHAPE + 1 type of SubShape.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

 

+ +

To use building functions:

+ +

 

+ +

In the main menu select + New Entity > Build + submenu.

+ +

 

+ +

Edge

+ +

 

+ +

Description: + Creates an edge.

+ +

 

+ +

Result: GEOM_Object + (EDGE).

+ +

 

+ +

TUI Command: + geompy.MakeEdge(Vertex1, Vertex2), + where Vertex1 and Vertex2 are correspondingly the first and the last vertex + of the edge.

+ +

 

+ +

Arguments: + Name + 2 vertices.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Wire

+ +

 

+ +

Description: + Creates a wire.

+ +

 

+ +

Result: GEOM_Object + (WIRE).

+ +

 

+ +

TUI Command : + geompy.MakeWire(ListOfShape), + where ListOfShape is a list of edges and/or wires from which the wire + to be constructed.

+ +

 

+ +

Arguments: + Name + List of connected wires or edges..

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Face

+ +

 

+ +

Description: + Creates a face.

+ +

 

+ +

Result: GEOM_Object + (FACE).

+ +

 

+ +

TUI Command: + geompy.MakeFace(Wire, WantPlanarFace), + where Wire is a wire and if boolean parameter WantPlanarFace is planar + then only a planar face or no face is constructed.

+ +

 

+ +

Arguments: + Name + 1 wire.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Shell

+ +

 

+ +

Description: + Creates a shell.

+ +

 

+ +

Result: GEOM_Object + (SHELL).

+ +

 

+ +

TUI Command: + geompy.MakeShell(ListOfShape), + where ListOfShape is a list of faces and (or) shells from which the shell + is constructed.

+ +

 

+ +

Arguments: + Name + List of faces having connected edges.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

Solid

+ +

 

+ +

Description: + Creates a solid - closed geometrical 3D element.

+ +

 

+ +

Result: GEOM_Object + (SOLID).

+ +

 

+ +

TUI Command: + geompy.MakeSolid(ListOfShape), + where ListOfShape is a list of shells from which the solid is constructed.

+ +

 

+ +

Arguments: + Name + A closed shell or a list of shells.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

 

+ +

Compound

+ +

 

+ +

Description: + Creates a compound.

+ +

 

+ +

Result: GEOM_Object + (COMPOUND).

+ +

 

+ +

TUI Command: + geompy.MakeCompound(ListOfShape), + where ListOfShape is a list of shapes from which the compound is constructed.

+ +

 

+ +

Arguments: + Name + List of shapes.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

+ +

 

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_generationgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_generationgui_functions.htm new file mode 100755 index 000000000..322971bfa --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_generationgui_functions.htm @@ -0,0 +1,307 @@ + + + + + +Titre + + + + + + + + + + + +

Generating complex objects

+ +

Generation operations in GEOM are used to create advanced + geometrical objects (3D elements). They are:

+ +

 

+ + + +

 

+ +

To use generation operations:

+ +

 

+ +

In the main menu select New + Entity > Generation.

+ +

 

+ +

Extrusion

+ +

Description: + Creates an extruded shape.

+ +

 

+ +

Result: GEOM_Object + (edge, face, solid or compsolid).

+ +

 

+ +

TUI Command : + geompy.MakePrism(baseShape, Vector, + Height), where baseShape is a basis of the prism, Vector is a normal + of the prism and Height is a height of the prism.

+ +

 

+ +

Arguments: + Name + 1 shape (vertex, edge, wire, face or shell) serving as base object + + 1 vector (for direction) + 1 value (dimension).

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

Revolution

+ +

+ +

Description: + Creates an extruded shape by revolution.

+ +

 

+ +

Result: GEOM_Object + (edge, face, solid or compsolid).

+ +

 

+ +

TUI Command: + geompy.MakeRevolution(Shape, Axis, + Angle), where Shape is a shape to rotate, Axis is the axis of the + revolution and Angle is an angle by which Shape has to be rotated around + Axis.

+ +

 

+ +

Arguments: + Name + 1 shape (vertex, edge, wire, face or shell) serving as base object + + 1 vector (for direction) + 1 value (angle).

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

Filling

+ +

 

+ +

Description: + Creates a curving face using several curves.

+ +

 

+ +

Result: GEOM_Object + (face).

+ +

 

+ +

TUI Command: + geompy.MakeFilling(Shape, MinDegree, + MaxDegree, Tol2D, Tol3D, NbIter), where Shape is a shape to fill, + MinDegree and MaxDegree are correspondingly maximal and minimal degree, + Tol2D is a tolerance for 2D and Tol3D is a tolerance for 3D, NbIter is + a number of iterations.

+ +

 

+ +

Arguments: + Name + 1 List of edges + 5 Parameters (Min. degree, Max. degree, Number + of iterations, 2D tolerance, 3D tolerance).

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ +

Pipe

+ +

+ +

Description: + Creates an extruded shape.

+ +

 

+ +

Result: GEOM_Object + (edge, face, solid or compsolid).

+ +

 

+ +

TUI Command: + geompy.MakePipe(baseShape, pathShape), + where baseShape is a shape to be extruded, pathShape is a path along which + baseShape is extruded.

+ +

 

+ +

Arguments: + Name + 1 shape (vertex, edge, wire, face or shell) serving as base object + + 1 shape (edge, face or shell) for definition of the path.

+ +

 

+ +

Dialog Box:

+ +

 

+ +

+ +

 

+ +

Example:

+ +

 

+ +

 

+ +

 

+ + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_geomtoolsgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_geomtoolsgui_functions.htm new file mode 100755 index 000000000..9baefc0bc --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_geomtoolsgui_functions.htm @@ -0,0 +1,145 @@ + + + + + +Titre + + + + + + + + + + + +

Importing\exporting geometrical objects

+ +

In GEOM you can import + and export geometrical objects from\into BREP, IGES, STEP files.

+ +  + +

To import geometrical objects from a BREP, IGES, STEP file:

+ +

 

+ +

From the File + menu choose Import and + select the required format of the file for importation. Then you will + see a standard dialog box allowing to search for and choose *.brep, *.iges + or *.step  file:

+ +

 

+ +

+ +

 

+ +

Select the required file and click OK. You file will be imported into GEOM + and its contents (geometrical objects) will be displayed in the Object Browser.

+ +

 

+ +

 

+ +

To export geometrical objects into a BREP, IGES, STEP file:

+ +

 

+ +

Select the object you wish to export, then + from the File menu choose Export and select the required format + of the file for exportation. You will see a standard dialog box allowing + to enter the name and select the location for the file which will be exported:

+ +

 

+ +

+ +

 

+ +

Click OK + to confirm your exportation.  

+ +

 

+ +

 

+ +
  •  

  • + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_measuregui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_measuregui_functions.htm new file mode 100755 index 000000000..cedecfb90 --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_measuregui_functions.htm @@ -0,0 +1,597 @@ + + + + + +Titre + + + + + + + + + + + + +

    Using measurement tools

    + +

    Measurement tools in GEOM are necessary for getting different + data concerning created or imported geometrical objects. They are:

    + +

     

    + + + +

     

    + +

    Our TUI Scripts + show how to use Measurement Tools + with  TUI + commands.

    + +

     

    + +

    To use measurement tools:

    + +

     

    + +

    In the main menu select Measures + submenu.

    + +

     

    + +

     

    + +

      Point coordinates

    + +

     

    + +

    Description: + Returns the coordinates of a point.

    + +

     

    + +

    Result: Point + coordinates (X, Y, Z) in 3D space in the form of Python Tuple.

    + +

     

    + +

    TUI command: + geompy.PointCoordinates(Point), + where Point is a point whose coordinates are inquired.

    + +

     

    + +

     

    + +

    Arguments: + 1 point.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Basic properties +

    + +

     

    + +

    Description: + Return the properties (Length, Surface & Volume) of a definite geometrical + object.

    + +

     

    + +

    Result: Display + Length, Surface & Volume in the form of Python Tuple.

    + +

     

    + +

    TUI command: + geompy.BasicProperties(Shape), + where Shape is a shape whose properties are inquired.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    + Center of mass

    + +

     

    + +

    Description: + Creates a gravity center of a shape and returns its coordinates.

    + +

     

    + +

    Result: GEOM_Object + (vertex).

    + +

     

    + +

    TUI Command: + geompy.MakeCDG(Shape), where + Shape is the shape for which a center of gravity is computed.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Inertia +

    + +

     

    + +

    Description: + Returns the inertia axis of a geometrical object.

    + +

     

    + +

    Result: Display + the matrix and moments of inretia in the form of Python Tuple (I11, I12, + I13,

    + +

     I21, + I22, I23,

    + +

     I31, + I32, I33,

    + +

     Ix, + Iy, Iz).

    + +

     

    + +

    TUI command: + geompy.Inertia(Shape), where + Shape is a shape for which a matrix of inertia and moment of inertia are + returned.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Bounding + box

    + +

     

    + +

    Description: + Returns the dimensions of the bounding box of a geometrical object.

    + +

     

    + +

    Result: Displays + the dimensions of the bounding box of a geometrical object in the form + of Python Tuple (Xmin, Xmax, Ymin, Ymax, Zmin, Zmax).

    + +

     

    + +

    TUI command: geompy.BoundingBox(Shape), where Shape is a shape for which a bounding + box is computed.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Min. distance

    + +

     

    + +

    Description: + Returns the min. distance between 2 geometrical objects.

    + +

     

    + +

    Result: Displays + the min. distance.

    + +

     

    + +

    TUI command: geompy.MinDistance(Shape1, + Shape2), where Shape1 and Shape2 + are shapes between which the minimal distance computed.

    + +

     

    + +

    Arguments: + 2 shapes.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    + Tolerance

    + +

     

    + +

    Description: + Returns the tolerance of a geometrical object.

    + +

     

    + +

    Result: Displays + the tolerance values (FaceMinTol, FaceMaxTol, EgdeMinTol, EgdeMaxTol, + VertexMinTol, VertexMaxTol).

    + +

     

    + +

    TUI command: geompy.Tolerance(Shape), where Shape is a shape for which minimal + and maximal tolerances are returned.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    WhatIs +

    + +

     

    + +

    Description: + Returns the type of a geometrical object.

    + +

     

    + +

    Result: Displays + all elements composing your geometrical object.

    + +

     

    + +

    TUI command: + geompy.WhatIs(Shape), where Shape + is a shape from which a description is returned.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Check +

    + +

     

    + +

    Description: + Returns True if this geometrical object is valid.

    + +

     

    + +

    Result: Boolean.

    + +

     

    + +

    TUI Command: + geompy.CheckShape(Shape), + where is shape which is checked for validity.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

     

    + +

     

    + +

    Check compound + of blocks

    + +

     

    + +

    Description: + Checks whether a shape is a compound of glued blocks. To be considered + as a compound of blocks, the given shape must satisfy the following conditions:

    + + + +

     

    + +

    Informs of the following possible errors:

    + + + +

     

    + +

    Result: Boolean; + highlight in the viewer.

    + +

     

    + +

    TUI Command: + geompy.CheckCompoundOfBlocks(Compound), + where the Compound is a shape, investigated in order to see, if it is + a valid compound of blocks. Validity flag is returned, encountered errors + are printed in the python console.

    + +

     

    + +

    Arguments: + 1 shape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_operationgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_operationgui_functions.htm new file mode 100755 index 000000000..d67650a0a --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_operationgui_functions.htm @@ -0,0 +1,637 @@ + + + + + +Titre + + + + + + + + + + + + +

    Basic operations

    + +

    In GEOM you can perform + basic operations with geometrical objects aimed at creation of more complex + shapes. These operations are:

    + +

     

    + + + +

     

    + +

    To perform basic operations on geometrical objects:

    + +

     

    + +

    In the main menu select Operations.

    + +

     

    + +

     

    + +

    Partition

    + +

     

    + +

    Description: + Builds a shape by intersection.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakePartition(ListOfShapes, + ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, + ListOfMaterials), where ListOfShapes is a list of shapes to be + intersected, ListOfTools is a list of shapes to intersect the shapes from + ListOfShapes, ListOfKeepInside is a list of shapes outside which the results + will be deleted, ListOfRemoveInside is a list of shapes inside which the + results will be deleted, Limit is a type of the result shapes, if RemoveWebs + is True the Glue 3D algorithm will be performed on the results, ListOfMaterials + is a list of materials indices for each shape, it makes sense only if + RemoveWebs is True.

    + +

     

    + +

    Arguments: + Up to 4 shapes + reconstruction limit.

    + + + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Archimede

    + +

     

    + +

    Description: + Creates a plane corresponding to the modeled water-line of the object + plunged into the water (in Z direction).

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.Archimede(Shape,Weight,WaterDensity,MeshingDeflection), + where Shape is a shape to put into the water, Weight is a weight of the + shape, WaterDensity  is + density of water, MeshingDeflection is a deflection of the mesh, using + to compute the section.

    + +

     

    + +

    GUI Arguments: + Name + 1 shape  + + 3 values (Weight, Water Density & Meshing Deflection).

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

       

    + +

     

    + +

     

    + +

    Fillet

    + +

     

    + +

    Description: + Make fillets of the edges of a shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeFillet(Shape, Radius, + ShapeType, ListOfShapeID), where Shape is a shape to create a fillet + on, Radius is a radius of the fillet, ShapeType is a type of shapes to + be processed, ListOfShapeID is a list of subshapeÂ’s Ids to be processed.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

       

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

     

    + +

    Chamfer

    + +

     

    + +

    Description: + Makes chamfer of the edges of a Shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: +

    + + + +

     

    + +

    Arguments:

    + +

     

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

       

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

    Block + multi-transformation

    + +

     

    + +

    Description: + Makes several translations of a block (solid) in one + or two directions depending on + the arguments specified by the user.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: +

    + + + +

     

    + +

    Arguments:

    + +

     

    + + + +

     

    + +

    Dialog Box:

    + + +++ + + + +
    +

    +

    + +

     

    + +

    Example:

    + +

     

    + +

        

    + +

     

    + +

     

    + +

    Explode + on Blocks

    + +

     

    + +

    Description: + Returns blocks of the given compound. The user may define the type blocks + to be extracted by setting the minimum and maximum number of faces in + the target block. By checking the corresponding box the user may also + interactively choose the blocks from a compound .

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeBlockExplode(Compound, + MinNbFaces, MaxNbFaces), where Compound is a compound to be exploded + into the blocks, MinNbFaces, MaxNbFaces are correspondingly the minimal + and  the + maximal number of faces of the resulting blocks.

    + +

     

    + +

    Arguments: 1 compound + 1 integer (min. and max. number + of faces in the block to be extracted).

    + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

     

    + +

    Propagate

    + +

     

    + +

    Description: + Breaks a multitude of edges of a shape into groups (builds all possible + propagation groups).

    + +

     

    + +

    Result: List + of GEOM_Objects. Each Geom Object will contain a group of edges.

    + +

     

    + +

    TUI Command: + geompy.Propagate(Shape), + where Shape is a shape to build propagation groups on.

    + +

     

    + +

    Arguments: 1 Shape.

    + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

         

    + + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_primitivegui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_primitivegui_functions.htm new file mode 100755 index 000000000..96c0d677f --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_primitivegui_functions.htm @@ -0,0 +1,395 @@ + + + + + +Titre + + + + + + + + + + + +

    Constructing primitives

    + +

    In + GEOM you can create different types of primitive geometrical objects (3D + elements):

    + +

     

    + + + +

     

    + +

    To construct primitive geometrical objects:

    + +

     

    + +

    In the main menu select New + Entity > Primitives.

    + +

     

    + +

    Box

    + +

     

    + +

    Description: Creates a box.

    + +

     

    + +

    Result: GEOM_Object (SOLID).

    + +

     

    + +

    TUI Command : geompy.MakeBox(X1, + Y1, Z1, X2, Y2, Z2),  where + (X1, Y1, X2) and (X2, Y2, Z2) are coordinates of two points which define + a diagonal of the box.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Cylinder

    + +

     

    + +

    Description: Creates a cylinder.

    + +

     

    + +

    Result: GEOM_Object (solid).

    + +

     

    + +

    TUI Command: geompy.MakeCylinder(Point, + Axis, Radius, Height), where Point is a central point of the cylinder + base, Axis (vector value) is an axis of the cylinder, Radius and Height + are correspondingly a radius and a height of the cylinder.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Sphere

    + +

     

    + +

    Description: Creates a sphere.

    + +

     

    + +

    Result: GEOM_Object (solid).

    + +

     

    + +

    TUI Command: geompy.MakeSphere(Point, + Radius), where Point is a center of the sphere and Radius is a + radius of the sphere.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Torus

    + +

     

    + +

    Description: Creates a torus.

    + +

     

    + +

    Result: GEOM_Object (solid).

    + +

     

    + +

    TUI Command: geompy.MakeTorus(Point, + Vector, RadiusMajor, RadiusMinor), where Point is a central point + of the torus, Vector is an axis of symmetry, RadiusMajor and RadiusMinor +  are correspondingly + a major and minor radiuses of the torus.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Cone

    + +

     

    + +

    Description: Creates a cone.

    + +

     

    + +

    Result: GEOM_Object (SOLID).

    + +

     

    + +

    TUI Command: geompy.MakeCone(Point, + Axis, Radius1, Radius2), where Point is a central point of the + cone base, Axis (vector value) is an axis of the cone, Radius1 and Radius2 + are correspondingly the first and the second radiuses of the cone

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_repairgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_repairgui_functions.htm new file mode 100755 index 000000000..56d2c9c22 --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_repairgui_functions.htm @@ -0,0 +1,898 @@ + + + + + +Titre + + + + + + + + + + + + +

    Repairing geometrical objects

    + +

    Repairing operations are + used for adjustment and modification of created geometrical shapes. The + are:

    + +

     

    + + + +

     

    + +

    The operations Suppress + faces, Close contour, Suppress internal wires, Suppress holes and + Add point on edge are + available only if you are using OCC + viewer.

    + +

     

    + +

    To apply repairing operations:

    + +

     

    + +

    In the main menu select Repair + submenu.

    + +

     

    + +

    Shape + processing

    + +

     

    + +

    Description: + Processes a shape using various operators.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.ProcessShape(Shape, Operators, + Parameters, Values), where Shape is a processed shape, Operators + is a list of names of operators ("FixShape", "SplitClosedFaces", + etc.), Parameters is a list of names of parameters (“FixShape.Tolerance3d”, + etc), Values is a list of values of parameters in the same order as the + Parameters list.

    + +

     

    + +

    Arguments: + 1 or more shapes.

    + + + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    1

    +

    SplitAngle – + this operator is intended for splitting faces based on conical surfaces, + surfaces of revolution and cylindrical surfaces by angle

    +

    SplitAngle.Angle – angle (in radians) defining + size of result segments.

    +

    SplitAngle.MaxTolerance – maximal possible + tolerance on result shape

    +

    2

    +

    SplitClosedFaces + – this operator is intended for dividing all closed faces in the shape + according to the number of points.

    +

    SplitClosedFaces.NbSplitPoints – number of + points for cutting each closed faces.

    +

    3

    +

    FixFaceSize + – this operator is intended for removing small faces (case of the spot + face and strip face)

    +

    FixFaceSize.Tolerance – work tolerance defining + which faces will be removed.

    +

    4

    +

    DropSmallEdges + – this operator is intended for removing small edges or merging with neigbour. +  

    +

    DropSmallEdges.Tolerance3d – work tolerance + for detection and removing small edges.

    +

    5

    +

    BsplineRestriction + –this operator is intended for re-approximation BSplines curves and surfaces + or conversion of the curves and surfaces to BSplines with specified parameters. +

    +

    BSplineRestriction.SurfaceMode - mode of approximation + of surfaces if restriction is necessary

    +

    BSplineRestriction.Curve3dMode -mode of conversion + of any 3D curve to BSpline and approximation.

    +

    BSplineRestriction.Curve2dMode - mode of conversion + of any 2D curve to BSpline and approximation

    +

    BSplineRestriction.Tolerance3d – work tolerance + for definition of the possibility of the approximation of the surfaces + and 3D curves with specified parameters.

    +

    BSplineRestriction.Tolerance2d - work tolerance + for definition of the possibility of the approximation of the 2D curves + with specified parameters.

    +

    BSplineRestriction.Continuity3d – desired continuity + of the resultant surfaces and 3D curves.

    +

    BSplineRestriction.Continuity2d – desired continuity + of the resultant 2D curves.

    +

    BSplineRestriction.RequiredDegree - required + degree of the resultant BSplines

    +

    BSplineRestriction.RequiredNbSegments - required + maximum number of segments of resultant BSplines.

    +

    6

    +

    SplitContinuity + – this operator is intended for splitting shapes to achieve continuities + of curves and surfaces less than specified ones.

    +

    SplitContinuity.Tolerance3d - 3D tolerance + for correction of geometry.

    +

    SplitContinuity.SurfaceContinuity - required + continuity for surfaces.

    +

    SplitContinuity.CurveContinuity - required + continuity for curves.

    +

    7

    +

    ToBezier - this + operator is intended for conversion of the curves and surfaces of the + all types into Bezier curves and surfaces.

    +

    ToBezier.SurfaceMode - mode of conversion of + the surfaces.

    +

    ToBezier.Curve3dMode – mode for conversion + of the 3D curves.

    +

    ToBezier.Curve2dMode – mode for conversion + of the 2D curves.

    +

    ToBezier.MaxTolerance – max possible tolerance + on the resultant shape.

    +

    8

    +

    FixShape – this + operator is intended for correction of the invalid shapes

    +

    FixShape.Tolerance3d – work tolerance for detection + of the problems and correction of them.

    +

    FixShape.MaxTolerance3d - maximal possible + tolerance of the shape after correction.

    +

    9

    +

    SameParameter + – this operator is intended for fixing edges having not same parameter + 2D and 3D curves.

    +

    SameParameter.Tolerance3d – tolerance for detection + and fix problems.

    + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    Shape before applying Shape Processing (FixShape + operator).

    + +

     

    + +

       

    + +

     

    + +

    The + same shape after applying Shape Processing.

    + +

     

    + +

    + +

     

    + +

     

    + +

    Suppress faces

    + +

     

    + +

    Description: + Suppresses a face of a shape.

    + +

     

    + +

    Result: GEOM_Object + (ListOfGeomShapes).

    + +

     

    + +

    TUI Command: + geompy.SuppressFaces(Shape, ListOfID), + where Shape is a shape to be processed, ListOfID is a list of faces ID's + to be removed.

    + +

     

    + +

    Arguments: + Name + Faces which should be removed (you can select them in the 3D viewer).

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Close contour

    + +

     

    + +

    Description : + Closes an open contour and modifies the underlying face (if needed) in + accordance with user specified mode:

    + + + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.CloseContour(Shape, Wires, + IsCommonVertex), where Shape is a shape to be processed, Wires + is a list of edges or wires IDÂ’s which has to be closed within the shape + (if the list contains only one element = -1, the shape itself is considered + as a wire),  IsCommonVertex + if this parameter is True a closure has to be done by creation of a common + vertex, otherwise an edge is added between the end vertices.

    + +

     

    + +

    Arguments: Name + 1 shape + contour (Wire, + or a set of Edges) + mode of closure (by vertex or by edge)

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    Suppress + internal wires

    + +

     

    + +

    Description : + Removes all internal wires or specified internal wires from user specified + faces.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.SuppressInternalWires(Shape, + Wires), where Shape is a shape where wires are to be removed, Wires + is a list of wires IDÂ’s to be removed; if the list is empty then all internal + wires are removed.

    + +

     

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

       

    + +

     

    + +

     

    + +

    Suppress + holes

    + +

     

    + +

    Description : +

    + + + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.SuppressHoles(Shape, + ListOfWireID), where Shape is a + shape where holes must be removed, ListOfWireID is a list of wire sub + shapes IDÂ’s. If it is empty, then all holes are removed.

    + +

     

    + +

    Arguments: Name + + 1 shape + Wires which should be removed.

    + +

    Remove all + holes checkbox allows to fill all holes of a definite shape.

    + +

    Detect button + allows to display the number of free boundaries in your shape:

    + +

     

    + +

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

      

    + +

    Example:

    + +

     

    + +

       

    + +

     

    + +

     

    + +

     

    + +

    Sewing

    + +

     

    + +

    Description: + Sew several  shapes.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command : + geompy.MakeSewing(ListOfShape, Precision), + where ListOfShape is list of shapes to be sewed, Precision is a precision + for sewing.

    + +

     

    + +

    Arguments: + Name + 1 or more shapes + 1 value (sew precision).

    + +

    Detect + button allows to display the number of free boundaries in your + shape:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

    Add point on edge

    + +

     

    + +

    Description: + Splits an edge in two in accordance with the specified mode (by length + or by parameter) and a value specifying the position of the point on edge + (for example val =0.5; mode = Length).

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command : + geompy.DivideEdge(Shape, EdgeID, + Value, IsByParameter), where Shape is a shape which contains an + edge to be divided, EdgeID is the ID of the edge to be divided, if it + = -1, then Shape is an edge, Value is a paramter on the edge or a length. + IsByParameter if it is True then Value is the edge parameter in the range + [0:1] otherwise it is a length of the edge in the range [0:1]

    + +

     

    + +

    Arguments: + Name + 1 Edge + 1 value setting the position of the point according to + one of the selected modes

    + +

     

    + +

    Dialog + Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

         

    + +

     

    + +

     

    + +

     

    + +

    Glue faces

    + +

     

    + +

    Description: + Glues faces that are coincident with respect to the given tolerance

    + +

    value.

    + +

     

    + +

    Result: + GEOM_Object.

    + +

     

    + +

    TUI Command + : geompy.MakeGlueFaces(theShape, + theTolerance), where theShape is a compound of shapesto be glued, + theTolerance is a maximum distance between two faces, which can be considered + as coincident.

    + +

     

    + +

    Arguments: + Name + 1 Compound + + Tolerance value

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

      

    + +

     

    + +

     

    + +

     

    + +

    Check free boundaries

    + +

     

    + +

    Description: + Detects wires and edges that correspond to the shape's boundary, and highlights + it

    + +

     

    + +

    Result: GEOM_Object. +

    + +

     

    + +

    TUI Command : (NoError, ClosedWires, OpenWires) = geompy.GetFreeBoundary(Shape), + where Shape is a shape to be checked, NoError is false if an error occurred + while checking free boundaries, ClosedWires is a list of closed free boundary + wires, OpenWires is a list of open free boundary wires.

    + +

     

    + +

    Arguments: + Shape

    + +

     

    + +

    Dialog + Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

      

    + +

     

    + +

     

    + +

     

    + +

    Check free + faces

    + +

     

    + +

    Description: + Retrieves all free faces from a given shape. A free face is + a face not shared between two shells of the shape.

    + +

     

    + +

    Result: GEOM_Object. + Returns a list of IDs of all free faces, contained in the shape.

    + +

     

    + +

    TUI Command : GetFreeFacesIDs(Shape), where + Shape is a shape to be checked.

    + +

     

    + +

    Arguments: + Shape

    + +

     

    + +

    Dialog + Box:

    + +

     

    + +

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/files/salome2_sp3_transformationgui_functions.htm b/doc/salome/gui/GEOM/files/salome2_sp3_transformationgui_functions.htm new file mode 100755 index 000000000..956e7ec71 --- /dev/null +++ b/doc/salome/gui/GEOM/files/salome2_sp3_transformationgui_functions.htm @@ -0,0 +1,669 @@ + + + + + +Titre + + + + + + + + + + + + +

    Using transformation operations

    + +

    In GEOM there is a set + of operations allowing to transform the initial geometrical object into + other objects, which will be also created. These operations are

    + +

     

    + + + +

     

    + +

    All these operations are accessible in the + main menu, via Operations / Transformation.

    + +

     

    + +

    Translation

    + +

     

    + +

    Description: + Makes a translation of a shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeTranslation(Shape, DX, + DY, DZ), where Shape is a shape to be translated, DX, DY, DZ are + components of translation vector.

    + +

     

    + +

    Arguments: +

    + + + +

     

    + +

    Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

       

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Rotation +

    + +

     

    + +

    Description: + Rotates the initial shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeRotation(Shape, Axis, + Angle), where Shape is a shape to be rotated, Axis is an axis of + rotation, Angle is an angle of rotation.

    + +

     

    + +

    Arguments: + 1 shape + 1 vector for direction of rotation + 1 angle.

    + +

    Reverse checkbox + allows to specify the direction of rotation.

    + +

    Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

     

    + +

    Modify the Location

    + +

     

    + +

    Description: + Modification of location of an object.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakePosition(theObject, theStartLCS, theEndLCS), where theObject + is a shape, location of which is modified, theStartLCS is a location to + move the shape from, theEndLCS is a location to move the shape to.

    + +

     

    + +

    Arguments: + Name + 1 GEOM_Object + [Starting Coordinate System] + End Coordinate System.

    + +

    Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

      

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

     

    + +

    Mirror +

    + +

     

    + +

    Description: + Symmetrical copy of a shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeMirrorByPlane(Shape, + Plane), where Shape is a shape to be mirrored, Plane is a plane + of symmetry.

    + +

     

    + +

    Arguments: +

    + + + +

    Create a copy + checkbox allows to keep the initial object, otherwise it + will be removed.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Scale transform +

    + +

     

    + +

    Description: + Creates a scaled shape basing on the initial shape.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeScaleTransform(Shape, + CenterOfScale, Factor), where Shape is a shape to be scaled, CenterOfScale + is a center point of scale, Factor is a factor of the scale.

    + +

     

    + +

    Arguments: + Name + 1 shape(s) + 1 vertex + 1 Scale Factor.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Offset surface

    + +

     

    + +

    Description: + Each point is translated along a local normal by a given distance (signed + number, negative value meaning inner offset). Offset operation is applicable + to faces, shells and solids.

    + +

     

    + +

    Result: GEOM_Object +

    + +

     

    + +

    TUI Command: + geompy.MakeOffset(Shape, Offset), + where Shape is a shape which has to be an offset, Offset is a value of + the offset.

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

    + +

     

    + +

     

    + +

    Multi-Translation

    + +

     

    + +

    Description: + Makes several translations of a shape in one + or two directions.

    + +

     

    + +

    Result: GEOM_Object + (compound).

    + +

     

    + +

    TUI Command:

    + + + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    One direction:

    + +

     

    + +

     

    + +

     

    + +

    Two directions:

    + +

     

    + +

     

    + +

     

    + +

     

    + +

    Multi-Rotation

    + +

     

    + +

    Description: + Creates several rotated geometrical objects in one + or two directions + basing on the initial geometrical object.

    + +

     

    + +

    Result: GEOM_Object + (compound).

    + +

     

    + +

    TUI Command:

    + + + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    One direction:

    + +

     

    + +

     

    + +

     

    + +

    Two directions:

    + +

     

    + +

     

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/fillet.htm b/doc/salome/gui/GEOM/fillet.htm new file mode 100755 index 000000000..9c7c45168 --- /dev/null +++ b/doc/salome/gui/GEOM/fillet.htm @@ -0,0 +1,179 @@ + + + + + +Fillet + + + + + + + + + + + + +

    Fillet

    + +

    To produce + a Fillet in the Main Menu select + Operations - > Transformation - > + Fillet  

    + +

     

    + +

    This operation creates + fillets on the edges of a shape.

    + +

    The + Result will be a GEOM_Object.

    + +

     

    + +

    To create fillets on all edges of the given + shape, you need to define the Main Object + to create a fillet on and the Radius + of the Fillet.  

    + +

    TUI Command: + geompy.MakeFilletAll(Shape, R)

    + +

    Arguments: Name + 1 shape + 1 value + (fillet radius).

    + +

     

    + +

    + +

     

    + +

    To create fillets  on + the specified edges or faces of the given shape,  you + need to define the Main Object + to create a fillet on, select the necessary edges or faces in the object + browser or in the viewer and define the  Radius + of the Fillet.

    + +

    TUI + Command: geompy.MakeFillet(Shape, R, ShapeType, ListShapes) +

    + +

    Arguments: Name + 1 shape + 1 Selection + of edges (or faces) + 1 value (Fillet radius).

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    Fillet on all                                           Fillet + on an edge                             Fillet + on a Face

    + +

     

    + +

        

    + +

      

    + +

    Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/filling.htm b/doc/salome/gui/GEOM/filling.htm new file mode 100755 index 000000000..2d6edb477 --- /dev/null +++ b/doc/salome/gui/GEOM/filling.htm @@ -0,0 +1,153 @@ + + + + + +Filling + + + + + + + + + + + + +

     Filling + Surface with Curves

    + +

    To generate + a Filling in the Main + Menu select New Entity - > + Generation  - + > Filling

    + +

     

    + +

    To create a curving face using several curves + you need to define the Curves, + which will be the components of your face, Minimum + and Maximum Degree, Tolerance + for 2D and for 3D +  and + the Number of Iterations.

    + +

    The + Result of the operation will be a + GEOM_Object (face).

    + +

     

    + +

    TUI Command: + geompy.MakeFilling(Shape, MinDegree, + MaxDegree, Tol2D, Tol3D, NbIter),

    + +

    Arguments: + Name + 1 List of edges + 5 Parameters (Min. degree, Max. degree, Number + of iterations, 2D tolerance, 3D tolerance).

    + +

     

    + +

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Complex Geometric + Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/fuse.htm b/doc/salome/gui/GEOM/fuse.htm new file mode 100755 index 000000000..6108eb671 --- /dev/null +++ b/doc/salome/gui/GEOM/fuse.htm @@ -0,0 +1,147 @@ + + + + + +Fuse + + + + + + + + + + + + +

    Fuse

    + +

    To produce + a Fuse in the Main Menu select + Operations - > Boolean - > Fuse

    + +

     

    + +

    This operation creates a shape from two + shapes.

    + +

     

    + +

    The Result + will be a GEOM_Object (COMPOUND).

    + +

    Arguments: + Name + 2 shapes.

    + +

    TUI + Command:  geompy.MakeFuse(s1, + s2)

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of the use of Boolean + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/geom.log b/doc/salome/gui/GEOM/geom.log new file mode 100755 index 000000000..b154fdc0f --- /dev/null +++ b/doc/salome/gui/GEOM/geom.log @@ -0,0 +1,648 @@ +|SourceProjectName:GEOM.hpr +|DestinationProjectName:geom.htm +whhost.js +whmsg.js +whmozemu.js +whproxy.js +whstub.js +whutils.js +whver.js +whform.js +whphost.js +whstart.js +whtopic.js +whframes.js +whlang.js +whskin_info.htm +whskin_blank.htm +whskin_pickup.htm +whskin_homepage.htm +whskin_tw.htm +whnjs.htm +whthost.js +whtdhtml.htm +whihost.js +whibody.htm +whiform.htm +whfhost.js +whfbody.htm +whfform.htm +whghost.js +whgbody.htm +whgdhtml.htm +whgdef.htm +whproj.js +whproj.xml +whproj.htm +whxdata\whtoc.xml +whxdata\whidx.xml +whxdata\whfts.xml +whxdata\whglo.xml +whdata\whtoc.js +whdata\whtoc.htm +whdata\whtdata.js +whdata\whidx.js +whdata\whidx.htm +whdata\whidata.js +whdata\whfts.js +whdata\whfts.htm +whdata\whglo.js +whdata\whglo.htm +whdata\whgdata.js +whdata\whftdata.js +whdata\whfwdata.js +whres.xml +webhelp.jar +webhelp.cab +whgdata\whnvp30.htm +whgdata\whnvp31.htm +whgdata\whnvp32.htm +whgdata\whnvp33.htm +whgdata\whnvt30.htm +whgdata\whnvt31.htm +whgdata\whnvt32.htm +whgdata\whnvt33.htm +whgdata\whnvf30.htm +whgdata\whnvf31.htm +whgdata\whnvf32.htm +whgdata\whnvf33.htm +whgdata\whnvl31.htm +whgdata\whnvl32.htm +whgdata\whnvl33.htm +whgdata\whexpbar.gif +cshdat_webhelp.htm +whcsh_home.htm +whcshdata.htm +cshdat_robohelp.htm +wht_tab0.gif +wht_tab1.gif +wht_tab2.gif +wht_tab3.gif +wht_tab4.gif +wht_tab5.gif +wht_tab6.gif +wht_tab7.gif +wht_tab8.gif +wht_glo_h.gif +wht_glo_n.gif +wht_fts_h.gif +wht_fts_n.gif +wht_idx_h.gif +wht_idx_n.gif +wht_toc_h.gif +wht_toc_n.gif +wht_ws.gif +wht_ws_g.gif +wht_logo1.gif +wht_logo2.gif +wht_abgw.jpg +wht_abgi.jpg +wht_abge.jpg +wht_abtw.jpg +wht_abte.jpg +wht_abti.jpg +wht_spac.gif +wht_next.gif +wht_next_g.gif +wht_prev.gif +wht_prev_g.gif +wht_sync.gif +wht_hide.gif +wht_go.gif +whstart.ico +whestart.ico +whrstart.ico +whidhtml.htm +whfdhtml.htm +whskin_banner.htm +whtbar.js +whskin_pdhtml.htm +whskin_papplet.htm +whskin_plist.htm +whskin_tbars.htm +whskin_mbars.htm +wht_toc4.gif +wht_toc1.gif +wht_toc2.gif +wht_toc3.gif +whskin_frmset010.htm +whst_topics.xml +whskin_frmset01.htm +geom_hha.hhk +geom.hhc +geom.hhk +add_point_on_edge.htm +arc.htm +archimede.htm +basic_geometrical_objects.htm +basic_operations.htm +blocks.htm +blocks_operations.htm +boolean_operations.htm +box.htm +building_by_blocks.htm +chamfer.htm +changing_display_parameters.htm +changing_displaying_parameters.htm +check_free_boundaries.htm +check_free_faces.htm +circle.htm +close_contour.htm +common.htm +complex_objects.htm +compound.htm +cone.htm +curve.htm +cut.htm +cylinder.htm +edge.htm +ellipse.htm +explode.htm +explode_on_blocks.htm +extrusion.htm +face.htm +files\introduction_to_geom.htm +files\salome2_sp3_basicgui_functions.htm +files\salome2_sp3_booleangui_functions.htm +files\salome2_sp3_buildgui_functions.htm +files\salome2_sp3_displaygui_functions.htm +files\salome2_sp3_generationgui_functions.htm +files\salome2_sp3_geomtoolsgui_functions.htm +files\salome2_sp3_measuregui_functions.htm +files\salome2_sp3_operationgui_functions.htm +files\salome2_sp3_primitivegui_functions.htm +files\salome2_sp3_repairgui_functions.htm +files\salome2_sp3_transformationgui_functions.htm +fillet.htm +filling.htm +fuse.htm +geometrical_objects.htm +glue_faces.htm +groups.htm +line.htm +local_coordinate_system.htm +measurement_tools.htm +mirror_image.htm +modify_the_location.htm +multi_rotation.htm +multi_transformation.htm +multi_translation.htm +newentity_blocks.htm +offset_surface.htm +partition.htm +pipe_creation.htm +plane.htm +point.htm +primitives.htm +propagate.htm +repairing_operations.htm +revolution.htm +rotation.htm +scale_transform.htm +section.htm +sewing.htm +shape_processing.htm +shell.htm +sketcher.htm +sketcher_tui.htm +solid.htm +sphere.htm +suppress_faces.htm +suppress_holes.htm +suppress_internal_wires.htm +transformation_operations.htm +translation.htm +turus.htm +vector.htm +wire.htm +working_plane.htm +working_with_groups.htm +ehelp.xml +geom.glo +default.css +pics\chamfer_all.png +pics\edgesn.png +pics\boxes.png +pics\mtrans1.png +pics\transformation3.png +pics\mtransf2.png +pics\export.png +image15.jpg +image204.jpg +image56.gif +image149.jpg +image127.jpg +image23.gif +image12.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image73.gif +files\salome2_sp3_displaygui_functions_salome2_sp3_displaygui_functions_image55.gif +files\salome2_sp3_booleangui_functions_salome2_sp3_booleangui_functions_image4.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image17.gif +pics\archimedesn1.png +pics\neo-basicprop.png +pics\mtrans2.png +pics\transformation4.png +pics\mtransf3.png +pics\plane1.png +image16.jpg +image57.gif +image35.gif +image128.jpg +image24.gif +image27.jpg +image13.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image74.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image18.gif +pics\suppress_faces1.png +pics\mirror_axissn1.png +pics\archimedesn2.png +pics\revolutionsn.png +pics\ellipsesn.png +pics\transformation10.png +pics\transformation5.png +pics\mtransf4.png +pics\plane2.png +image206.jpg +image25.gif +image129.jpg +image14.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image75.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image30.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image19.gif +pics\suppress_faces2.png +pics\multi_translation1dsn.png +pics\mirror_axissn2.png +pics\multi_transformationsn2d.png +pics\archimedesn3.png +pics\wiresn.png +pics\transformation11.png +pics\transformation6.png +pics\block1.png +pics\creategroup.png +pics\pipe.png +pics\torus1.png +pics\plane3.png +image59.gif +image37.gif +image15.gif +image18.jpg +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image130.gif +files\salome2_sp3_operationgui_functions_salome2_sp3_operationgui_functions_image87.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image76.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image31.gif +pics\multi_transformationsn1d.png +pics\fillingsn.png +pics\spheres.png +pics\polyline.png +pics\neo-obj1.png +pics\repair1.png +pics\transformation7.png +pics\block2.png +pics\torus2.png +image27.gif +image191.jpg +image180.jpg +image49.gif +image109.jpg +image16.gif +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image131.gif +files\salome2_sp3_repairgui_functions_salome2_sp3_repairgui_functions_image119.gif +files\salome2_sp3_operationgui_functions_salome2_sp3_operationgui_functions_image88.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image77.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image32.gif +pics\glue_faces1.png +pics\supp_int_wires1.png +pics\fusesn1.png +pics\transparencysn.png +pics\arcsn.png +pics\points.png +pics\neo-obj2.png +pics\neo-localcs1.png +pics\measures10.png +pics\repair2.png +pics\transformation8.png +pics\block3.png +image181.jpg +image170.jpg +image80.jpg +image17.gif +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image132.gif +files\salome2_sp3_operationgui_functions_salome2_sp3_operationgui_functions_image89.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image78.gif +image3.jpg +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image33.gif +pics\glue_faces2.png +pics\supp_int_wires2.png +pics\sectionsn.png +pics\fusesn2.png +pics\toruses.png +pics\circles.png +pics\neo-materials.png +pics\neo-obj3.png +pics\neo-localcs2.png +pics\neo-isos.png +pics\measures1.png +pics\repair3.png +pics\transformation9.png +pics\bool1.png +pics\partition1.png +pics\block4.png +pics\sphere1.png +image193.jpg +image29.gif +image171.jpg +image160.jpg +image81.jpg +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image133.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image34.gif +pics\chamfer_faces.png +pics\fillet_prism.png +pics\rotationsn1.png +pics\disp_mode1sn.png +pics\pipesn.png +pics\pipe_wire_edgesn.png +pics\cones.png +pics\planes1.png +pics\lines.png +pics\neo-obj4.png +pics\neo-localcs3.png +pics\repair4.png +pics\bool2.png +pics\partition2.png +pics\block5.png +pics\sphere2.png +pics\point1.png +pics\import.png +image172.jpg +image150.jpg +image82.jpg +image19.gif +image5.jpg +pics\rotationsn2.png +pics\disp_mode2sn.png +pics\neo-detect2.png +pics\neo-section.png +pics\neo-obj5.png +pics\measures3.png +pics\repair5.png +pics\bool3.png +pics\chamfer1.png +pics\filling.png +pics\revolution.png +pics\arc.png +pics\ellipse.png +pics\circle1.png +image3.gif +image151.jpg +image94.jpg +image83.jpg +files\salome2_sp3_generationgui_functions_salome2_sp3_generationgui_functions_image56.gif +pics\free_boudaries1.png +pics\multi_rotation1d1.png +pics\multi_translation2dsn.png +pics\offsetsn.png +pics\isos_u12_v12sn.png +pics\compoundsn.png +pics\prisms_basessn.png +pics\cylinders.png +pics\vectors.png +pics\neo-obj6.png +pics\measures4.png +pics\repair6.png +pics\chamfer2.png +pics\cone1.png +pics\circle2.png +pics\point3.png +image185.jpg +image163.jpg +image130.jpg +image95.jpg +image84.jpg +image4.gif +files\salome2_sp3_generationgui_functions_salome2_sp3_generationgui_functions_image57.gif +pics\free_boudaries2.png +pics\multi_rotation2d1.png +pics\multi_rotation1d2.png +pics\mirror_pointsn1.png +pics\new-tolerance.png +pics\neo-obj7.png +pics\neo-point2.png +pics\measures5.png +pics\repair7.png +pics\chamfer3.png +pics\cone2.png +image197.jpg +image164.jpg +image96.jpg +image85.jpg +image52.jpg +image8.jpg +files\salome2_sp3_generationgui_functions_salome2_sp3_generationgui_functions_image58.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image27.gif +pics\chamfer_edge.png +pics\fillet_edge.png +pics\multi_rotation2d2.png +pics\scale_transformsn1.png +pics\mirror_pointsn2.png +pics\cutsn.png +pics\shellsn.png +pics\filling_compoundsn.png +pics\prismssn.png +pics\neo-mrot1.png +pics\repair8.png +pics\cylinder1.png +pics\vector1.png +image61.gif +image154.jpg +image121.jpg +image110.jpg +image97.jpg +image53.jpg +image9.jpg +image6.gif +files\salome2_sp3_generationgui_functions_salome2_sp3_generationgui_functions_image59.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image28.gif +pics\scale_transformsn2.png +pics\translationsn1.png +pics\facesn1.png +pics\neo-mrot2.png +pics\repair9.png +pics\cylinder2.png +pics\vector2.png +image188.jpg +image51.gif +image133.jpg +image122.jpg +image98.jpg +image76.jpg +image54.jpg +image7.gif +image10.jpg +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image128.gif +files\salome2_sp3_repairgui_functions_salome2_sp3_repairgui_functions_image121.gif +files\salome2_sp3_operationgui_functions_salome2_sp3_operationgui_functions_image90.gif +files\salome2_sp3_basicgui_functions_salome2_sp3_basicgui_functions_image29.gif +i_blue.jpg +pics\free_faces1.png +pics\fillet_all.png +pics\translationsn2.png +pics\partitionsn1.png +pics\colorsn.png +pics\facesn2.png +pics\interpol.png +pics\measures8.png +pics\fillet1.png +pics\archimede.png +pics\workplane4.png +image189.jpg +image52.gif +image167.jpg +image156.jpg +image41.gif +image145.jpg +image112.jpg +files\salome2_sp3_displaygui_functions_salome2_sp3_displaygui_functions_image51.gif +image8.gif +image11.jpg +files\salome2_sp3_transformationgui_functions_salome2_sp3_transformationgui_functions_image129.gif +files\salome2_sp3_repairgui_functions_salome2_sp3_repairgui_functions_image122.gif +files\salome2_sp3_primitivegui_functions_salome2_sp3_primitivegui_functions_image100.gif +files\salome2_sp3_primitivegui_functions_salome2_sp3_primitivegui_functions_image99.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image13.gif +pics\free_faces2.png +pics\mirror_planesn1.png +pics\block_explodesn.png +pics\partitionsn2.png +pics\solidsn.png +pics\facesn3.png +pics\distance.png +pics\neo-scetcher1.png +pics\neo-transparency.png +pics\measures9.png +pics\fillet2.png +pics\workplane5.png +image201.jpg +image53.gif +image168.jpg +image42.gif +image124.jpg +image113.jpg +image78.jpg +image20.gif +image67.jpg +image9.gif +image12.jpg +files\salome2_sp3_primitivegui_functions_salome2_sp3_primitivegui_functions_image101.gif +files\salome2_sp3_displaygui_functions_salome2_sp3_displaygui_functions_image52.gif +files\salome2_sp3_booleangui_functions_salome2_sp3_booleangui_functions_image1.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image14.gif +pics\mirror_planesn2.png +pics\neo-scetcher2.png +pics\transformation1.png +pics\fillet3.png +pics\box1.png +pics\workplane6.png +pics\curve.png +pics\line.png +image10.gif +image202.jpg +image147.jpg +image32.gif +image79.jpg +image21.gif +files\salome2_sp3_primitivegui_functions_salome2_sp3_primitivegui_functions_image102.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image71.gif +files\salome2_sp3_displaygui_functions_salome2_sp3_displaygui_functions_image53.gif +files\salome2_sp3_booleangui_functions_salome2_sp3_booleangui_functions_image2.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image15.gif +pics\multi_translation_initialsn.png +pics\plane_on_face.png +pics\bezier.png +pics\repair10.png +pics\transformation2.png +pics\mtransf1.png +pics\editgroup.png +pics\extrusion.png +pics\box2.png +image44.gif +image22.gif +image11.gif +files\salome2_sp3_primitivegui_functions_salome2_sp3_primitivegui_functions_image103.gif +files\salome2_sp3_measuregui_functions_salome2_sp3_measuregui_functions_image72.gif +files\salome2_sp3_displaygui_functions_salome2_sp3_displaygui_functions_image54.gif +files\salome2_sp3_booleangui_functions_salome2_sp3_booleangui_functions_image3.gif +salome2_sp3_buildgui_functions_salome2_sp3_buildgui_functions_image16.gif +ehlpdhtm.js +geom.ppf +default_ns.css +whxdata\whtdata0.xml +whxdata\whftdata0.xml +whxdata\whfwdata0.xml +whxdata\whgdata0.xml +whdata\whtdata0.htm +whdata\whftdata0.htm +whdata\whfwdata0.htm +whdata\whgdata0.htm +whgdata\whlstt0.htm +whgdata\whlstt1.htm +whgdata\whlstt2.htm +whgdata\whlstt3.htm +whgdata\whlstt4.htm +whgdata\whlstt5.htm +whgdata\whlstt6.htm +whgdata\whlstt7.htm +whgdata\whlstt8.htm +whgdata\whlstt9.htm +whgdata\whlstt10.htm +whgdata\whlstt11.htm +whgdata\whlstt12.htm +whgdata\whlstt13.htm +whgdata\whlstt14.htm +whgdata\whlstt15.htm +whgdata\whlstt16.htm +whgdata\whlsti0.htm +whgdata\whlstfl0.htm +whgdata\whlstfl1.htm +whgdata\whlstfl2.htm +whgdata\whlstfl3.htm +whgdata\whlstfl4.htm +whgdata\whlstfl5.htm +whgdata\whlstfl6.htm +whgdata\whlstfl7.htm +whgdata\whlstfl8.htm +whgdata\whlstfl9.htm +whgdata\whlstfl10.htm +whgdata\whlstfl11.htm +whgdata\whlstfl12.htm +whgdata\whlstfl13.htm +whgdata\whlstfl14.htm +whgdata\whlstfl15.htm +whgdata\whlstfl16.htm +whgdata\whlstfl17.htm +whgdata\whlstfl18.htm +whgdata\whlstfl19.htm +whgdata\whlstfl20.htm +whgdata\whlstfl21.htm +whgdata\whlstfl22.htm +whgdata\whlstfl23.htm +whgdata\whlstfl24.htm +whgdata\whlstfl25.htm +whgdata\whlstf0.htm +whgdata\whlstf1.htm +whgdata\whlstf2.htm +whgdata\whlstf3.htm +whgdata\whlstf4.htm +whgdata\whlstf5.htm +whgdata\whlstf6.htm +whgdata\whlstf7.htm +whgdata\whlstf8.htm +whgdata\whlstf9.htm +whgdata\whlstf10.htm +whgdata\whlstf11.htm +whgdata\whlstf12.htm +whgdata\whlstf13.htm +whgdata\whlstf14.htm +whgdata\whlstg0.htm +geom.htm +geom_csh.htm +geom_rhc.htm diff --git a/doc/salome/gui/GEOM/geometrical_objects.htm b/doc/salome/gui/GEOM/geometrical_objects.htm new file mode 100755 index 000000000..7008952e1 --- /dev/null +++ b/doc/salome/gui/GEOM/geometrical_objects.htm @@ -0,0 +1,571 @@ + + + + + +Geometrical Objects + + + + + + + + + + + +

    Advanced Geometrical Objects

    + +

    Creation of an Edge

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices

    + +

    p0   = + geompy.MakeVertex(0.  , + 0.  , 0. +  )

    + +

    pxyz = geompy.MakeVertex(100., + 100., 100.)

    + +

     

    + +

    # create edge

    + +

    edge = geompy.MakeEdge(p0, + pxyz)

    + +

     

    + +

    # add object in study

    + +

    id_edge = geompy.addToStudy(edge,"Edge")

    + +

     

    + +

    # display edge

    + +

    gg.createAndDisplayGO(id_edge) +

    + +

     

    + +

    Creation of a Wire

    + +

    import + geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices

    + +

    px   = + geompy.MakeVertex(100., 0.  , + 0.  )

    + +

    py   = + geompy.MakeVertex(0.  , + 100., 0.  )

    + +

    pz   = + geompy.MakeVertex(0.  , + 0.  , 100.)

    + +

     

    + +

    # create vector on two + points

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

     

    + +

    # create arc with three + points

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # add object in study

    + +

    id_wire = geompy.addToStudy(wire,"Wire")

    + +

     

    + +

    # display wire

    + +

    gg.createAndDisplayGO(id_wire) +

    + +

     

    + +

     

    + +

    Creation of a Face

    + +

    import + geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices

    + +

    p0   = + geompy.MakeVertex(0.  , + 0.  , 0. +  )

    + +

    px   = + geompy.MakeVertex(100., 0.  , + 0.  )

    + +

    py   = + geompy.MakeVertex(0.  , + 100., 0.  )

    + +

    pz   = + geompy.MakeVertex(0.  , + 0.  , 100.)

    + +

    pxyz = geompy.MakeVertex(100., + 100., 100.)

    + +

     

    + +

    # create vector on two + points

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

     

    + +

    # create arc with three + points

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # create sketchers

    + +

    sketcher1 = geompy.MakeSketcher("Sketcher:F + -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",

    + +

                                    [100,0,0, + 1,1,1, -1,1,0])

    + +

    sketcher2 = geompy.MakeSketcher("Sketcher:F + 0 0:TT 70 0:TT 70 70:TT 0 70:WW")

    + +

    sketcher3 = geompy.MakeSketcher("Sketcher:F + 20 20:TT 50 20:TT 50 50:TT 20 50:WW")

    + +

    isPlanarFace = 1

    + +

     

    + +

    # create face from wire

    + +

    face1 = geompy.MakeFace(wire, + isPlanarFace)

    + +

     

    + +

    # create faces from two + wires

    + +

    face2 = geompy.MakeFaceWires([wire, + sketcher1],isPlanarFace)

    + +

    face3 = geompy.MakeFaces([sketcher2, + sketcher3],isPlanarFace)

    + +

     

    + +

    # add objects in study

    + +

    id_face1 = geompy.addToStudy(face1,"Face1")

    + +

    id_face2 = geompy.addToStudy(face2,"Face2")

    + +

    id_face3 = geompy.addToStudy(face3,"Face3")

    + +

     

    + +

    # display faces

    + +

    gg.createAndDisplayGO(id_face1)

    + +

    gg.setDisplayMode(id_face1,1)

    + +

    gg.setTransparency(id_face1,0.2)

    + +

    gg.createAndDisplayGO(id_face2)

    + +

    gg.setDisplayMode(id_face2,1)

    + +

    gg.setTransparency(id_face2,0.2)

    + +

    gg.createAndDisplayGO(id_face3)

    + +

    gg.setDisplayMode(id_face3,1)

    + +

    gg.setTransparency(id_face3,0.2) +

    + +

     

    + +

    Creation of a Shell

    + +

    import + geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    #create vertices

    + +

    p0   = + geompy.MakeVertex( 0.,  0., +  0.)

    + +

    pxyz = geompy.MakeVertex( + 5.,  5., + 40.)

    + +

     

    + +

    # create sketchers

    + +

    sketcher1 = geompy.MakeSketcher("Sketcher:F + 0 0:TT 70 0:TT 70 70:TT 0 70:WW")

    + +

    sketcher2 = geompy.MakeSketcher("Sketcher:F + 20 20:TT 50 20:TT 50 50:TT 20 50:WW")

    + +

    isPlanarFace = 1

    + +

     

    + +

    # create face from two + wires

    + +

    face = geompy.MakeFaces([sketcher1, + sketcher2],isPlanarFace)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrism(face, + p0, pxyz)

    + +

     

    + +

    # explode prism on faces

    + +

    prism_faces = geompy.SubShapeAllSorted(prism, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # create shell from the + set of faces

    + +

    shell = geompy.MakeShell([prism_faces[0], + prism_faces[2], prism_faces[3],

    + +

                              prism_faces[7], + prism_faces[9]])

    + +

     

    + +

    # add objects in study

    + +

    id_shell = geompy.addToStudy(shell,"Shell")

    + +

     

    + +

    # display shell

    + +

    gg.createAndDisplayGO(id_shell)

    + +

    gg.setDisplayMode(id_shell,1) +

    + +

     

    + +

    Creation of a Solid

    + +

    import + geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    #create vertices

    + +

    p0 = geompy.MakeVertex( + 0.,  0., +  0.)

    + +

    pz = geompy.MakeVertex( + 0.,  0., + 40.)

    + +

     

    + +

    # create sketchers

    + +

    sketcher = geompy.MakeSketcher("Sketcher:F + -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")

    + +

     

    + +

    # create faces from two + wires

    + +

    face = geompy.MakeFace(sketcher,1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrism(face, + p0, pz)

    + +

     

    + +

    # explode prism on faces

    + +

    prism_faces = geompy.SubShapeAllSorted(prism, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # create shell from the + set of faces

    + +

    shell = geompy.MakeShell([prism_faces[0], + prism_faces[1],

    + +

                              prism_faces[3], + prism_faces[4],

    + +

                              prism_faces[5], + prism_faces[2]])

    + +

     

    + +

    # create solid, bounded + by the given shells

    + +

    solid = geompy.MakeSolid([shell])

    + +

     

    + +

    # add objects in study

    + +

    id_solid = geompy.addToStudy(solid,"Solid")

    + +

     

    + +

    # display solid

    + +

    gg.createAndDisplayGO(id_solid)

    + +

    gg.setDisplayMode(id_solid,1) +

    + +

     

    + +

    Creation of a Compound

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    #create vertices

    + +

    p0 = geompy.MakeVertex( + 0.,  0., +  0.)

    + +

    pz = geompy.MakeVertex( + 0.,  0., + 40.)

    + +

     

    + +

    # create sketchers

    + +

    sketcher = geompy.MakeSketcher("Sketcher:F + -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")

    + +

     

    + +

    # create faces from two + wires

    + +

    face = geompy.MakeFace(sketcher,1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrism(face, + p0, pz)

    + +

     

    + +

    # explode prism on faces

    + +

    prism_faces = geompy.SubShapeAllSorted(prism, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # create shell from the + set of faces

    + +

    shell = geompy.MakeShell([prism_faces[0], + prism_faces[1],

    + +

                              prism_faces[3], + prism_faces[4],

    + +

                              prism_faces[5], + prism_faces[2]])

    + +

     

    + +

    # create solid, bounded + by the given shells

    + +

    solid = geompy.MakeSolid([shell])

    + +

     

    + +

    # add objects in study

    + +

    id_solid = geompy.addToStudy(solid,"Solid")

    + +

     

    + +

    # display solid

    + +

    gg.createAndDisplayGO(id_solid)

    + +

    gg.setDisplayMode(id_solid,1) +

    + + + + diff --git a/doc/salome/gui/GEOM/geompy_doc/GEOM__TestMeasures_8py.html b/doc/salome/gui/GEOM/geompy_doc/GEOM__TestMeasures_8py.html new file mode 100644 index 000000000..06a37f66a --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/GEOM__TestMeasures_8py.html @@ -0,0 +1,29 @@ + + + + + + Main Page + + + +  +
    + +
    + + + + + +

    GEOM_TestMeasures.py File Reference

    + + + + +

    Namespaces

    namespace  GEOM_TestMeasures
    +
    Generated on Tue Oct 18 00:47:36 2005 for SALOME - GEOM - v.2.1.0 by + +doxygen 1.3.7
    + + diff --git a/doc/salome/gui/GEOM/geompy_doc/doxygen.css b/doc/salome/gui/GEOM/geompy_doc/doxygen.css new file mode 100644 index 000000000..dc9da5220 --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/doxygen.css @@ -0,0 +1,218 @@ +H1 { + text-align: center; + font-family: Geneva, Arial, Helvetica, sans-serif; +} +H2 { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #eeeeff; + border: 1px solid #B0B0B0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 120%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; + padding: 2px; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D + padding: 2px; +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; + padding: 2px; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + padding: 2px 6px; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; + padding: 2px 6px; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code { text-decoration: none; font-weight: normal; color: #1A419D} +A.codeRef { font-weight: normal; color: #1A419D} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + padding: 6px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #F4F4FB; font-weight: bold; } +TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; } +TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; } +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; + font-family: Geneva, Arial, Helvetica, sans-serif; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + font-size: smaller; + font-style: italic; + background-color: #FAFAFA; + padding-left: 8px; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + font-size: smaller; + font-style: italic; + background-color: #FAFAFA; + padding-left: 4px; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; + padding-bottom: 0px; + padding-right: 8px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 12px; +} +.memItemRight { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 13px; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #eeeeff; +} +TD.tiny { font-size: 75%; +} +a { + color: #252E78; +} +a:visited { + color: #3D2185; +} diff --git a/doc/salome/gui/GEOM/geompy_doc/doxygen.png b/doc/salome/gui/GEOM/geompy_doc/doxygen.png new file mode 100644 index 000000000..9da55f95f Binary files /dev/null and b/doc/salome/gui/GEOM/geompy_doc/doxygen.png differ diff --git a/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.jpg b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.jpg new file mode 100644 index 000000000..b1a0ce260 Binary files /dev/null and b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.jpg differ diff --git a/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.map b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.map new file mode 100644 index 000000000..5a14779e7 --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.map @@ -0,0 +1 @@ +base referer diff --git a/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.md5 b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.md5 new file mode 100644 index 000000000..1f2d2ba0e --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/geompy_8py__incl.md5 @@ -0,0 +1 @@ +0848e1ec9d428b6f7446355ed9f585a7 \ No newline at end of file diff --git a/doc/salome/gui/GEOM/geompy_doc/namespaceGEOM__TestMeasures.html b/doc/salome/gui/GEOM/geompy_doc/namespaceGEOM__TestMeasures.html new file mode 100644 index 000000000..24ab2972a --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/namespaceGEOM__TestMeasures.html @@ -0,0 +1,70 @@ + + + + + + Main Page + + + +  +
    + +
    + + + + + +

    Package GEOM_TestMeasures

    Module "GEOM_TestMeasures". +More... +

    + + + + + +

    Functions

     TestMeasureOperations (geompy, math)
    +


    Function Documentation

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    TestMeasureOperations geompy ,
    math 
    +
    + + + + + +
    +   + + +

    +

    +


    Generated on Tue Oct 18 00:47:37 2005 for SALOME - GEOM - v.2.1.0 by + +doxygen 1.3.7
    + + diff --git a/doc/salome/gui/GEOM/geompy_doc/namespacegeompy.html b/doc/salome/gui/GEOM/geompy_doc/namespacegeompy.html new file mode 100644 index 000000000..189eb4505 --- /dev/null +++ b/doc/salome/gui/GEOM/geompy_doc/namespacegeompy.html @@ -0,0 +1,8409 @@ + + + + + + Main Page + + + +  +
    + +
    + + + + + +

    Package geompy

    Module geompy. +More... +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Functions

     init_geom (theStudy)
     SubShapeName (aSubObj, aMainObj)
     Get name for sub-shape aSubObj of shape aMainObj.

     addToStudy (aShape, aName)
     Publish in study aShape with name aName.

     addToStudyInFather (aFather, aShape, aName)
     Publish in study aShape with name aName as sub-object of previously published aFather.

     MakeVertex (theX, theY, theZ)
     Create point by three coordinates.

     MakeVertexWithRef (theReference, theX, theY, theZ)
     Create a point, distant from the referenced point on the given distances along the coordinate axes.

     MakeVertexOnCurve (theRefCurve, theParameter)
     Create a point, corresponding to the given parameter on the given curve.

     MakeVectorDXDYDZ (theDX, theDY, theDZ)
     Create a vector with the given components.

     MakeVector (thePnt1, thePnt2)
     Create a vector between two points.

     MakeLine (thePnt, theDir)
     Create a line, passing through the given point and parrallel to the given direction.

     MakeLineTwoPnt (thePnt1, thePnt2)
     Create a line, passing through the given points.

     MakePlane (thePnt, theVec, theTrimSize)
     Create a plane, passing through the given point and normal to the given vector.

     MakePlaneThreePnt (thePnt1, thePnt2, thePnt3, theTrimSize)
     Create a plane, passing through the three given points.

     MakePlaneFace (theFace, theTrimSize)
     Create a plane, similar to the existing one, but with another size of representing face.

     MakeMarker (OX, OY, OZ, XDX, XDY, XDZ, YDX, YDY, YDZ)
     Create a local coordinate system.

     MakeMarkerPntTwoVec (theOrigin, theXVec, theYVec)
     Create a local coordinate system.

     MakeArc (thePnt1, thePnt2, thePnt3)
     Create an arc of circle, passing through three given points.

     MakeCircle (thePnt, theVec, theR)
     Create a circle with given center, normal vector and radius.

     MakeCircleThreePnt (thePnt1, thePnt2, thePnt3)
     Create a circle, passing through three given points.

     MakeEllipse (thePnt, theVec, theRMajor, theRMinor)
     Create an ellipse with given center, normal vector and radiuses.

     MakePolyline (thePoints)
     Create a polyline on the set of points.

     MakeBezier (thePoints)
     Create bezier curve on the set of points.

     MakeInterpol (thePoints)
     Create B-Spline curve on the set of points.

     MakeSketcher (theCommand, theWorkingPlane=[0, 0, 0, 0, 0, 1, 1, 0, 0])
     Create a sketcher (wire or face), following the textual description, passed through theCommand argument.

     MakeSketcherOnPlane (theCommand, theWorkingPlane)
     Create a sketcher (wire or face), following the textual description, passed through theCommand argument.

     MakeBox (x1, y1, z1, x2, y2, z2)
     Create a box by coordinates of two opposite vertices.

     MakeBoxDXDYDZ (theDX, theDY, theDZ)
     Create a box with specified dimensions along the coordinate axes and with edges, parallel to the coordinate axes.

     MakeBoxTwoPnt (thePnt1, thePnt2)
     Create a box with two specified opposite vertices, and with edges, parallel to the coordinate axes.

     MakeCylinder (thePnt, theAxis, theR, theH)
     Create a cylinder with given base point, axis, radius and height.

     MakeCylinderRH (theR, theH)
     Create a cylinder with given radius and height at the origin of coordinate system.

     MakeSpherePntR (thePnt, theR)
     Create a sphere with given center and radius.

     MakeSphere (x, y, z, theR)
     Create a sphere with given center and radius.

     MakeSphereR (theR)
     Create a sphere with given radius at the origin of coordinate system.

     MakeCone (thePnt, theAxis, theR1, theR2, theH)
     Create a cone with given base point, axis, height and radiuses.

     MakeConeR1R2H (theR1, theR2, theH)
     Create a cone with given height and radiuses at the origin of coordinate system.

     MakeTorus (thePnt, theVec, theRMajor, theRMinor)
     Create a torus with given center, normal vector and radiuses.

     MakeTorusRR (theRMajor, theRMinor)
     Create a torus with given radiuses at the origin of coordinate system.

     MakePrism (theBase, thePoint1, thePoint2)
     Create a shape by extrusion of the base shape along a vector, defined by two points.

     MakePrismVecH (theBase, theVec, theH)
     Create a shape by extrusion of the base shape along the vector, i.e.

     MakePipe (theBase, thePath)
     Create a shape by extrusion of the base shape along the path shape.

     MakeRevolution (theBase, theAxis, theAngle)
     Create a shape by revolution of the base shape around the axis on the given angle, i.e.

     MakeEdge (thePnt1, thePnt2)
     Create a linear edge with specified ends.

     MakeWire (theEdgesAndWires)
     Create a wire from the set of edges and wires.

     MakeFace (theWire, isPlanarWanted)
     Create a face on the given wire.

     MakeFaceWires (theWires, isPlanarWanted)
     Create a face on the given wires set.

     MakeFaces (theWires, isPlanarWanted)
     Shortcut to MakeFaceWires().

     MakeShell (theFacesAndShells)
     Create a shell from the set of faces and shells.

     MakeSolid (theShells)
     Create a solid, bounded by the given shells.

     MakeCompound (theShapes)
     Create a compound of the given shapes.

     NumberOfFaces (theShape)
     Gives quantity of faces in the given shape.

     NumberOfEdges (theShape)
     Gives quantity of edges in the given shape.

     ChangeOrientation (theShape)
     Reverses an orientation the given shape.

     OrientationChange (theShape)
     Shortcut to ChangeOrientation().

     GetFreeFacesIDs (theShape)
     Retrieve all free faces from the given shape.

     GetSharedShapes (theShape1, theShape2, theShapeType)
     Get all sub-shapes of theShape1 of the given type, shared with theShape2.

     GetShapesOnPlane (theShape, theShapeType, theAx1, theState)
     Find in theShape all sub-shapes of type theShapeType, situated relatively the specified plane by the certain way, defined through theState parameter.

     GetShapesOnPlaneIDs (theShape, theShapeType, theAx1, theState)
     Works like the above method, but returns list of sub-shapes indices.

     GetShapesOnCylinder (theShape, theShapeType, theAxis, theRadius, theState)
     Find in theShape all sub-shapes of type theShapeType, situated relatively the specified cylinder by the certain way, defined through theState parameter.

     GetShapesOnCylinderIDs (theShape, theShapeType, theAxis, theRadius, theState)
     Works like the above method, but returns list of sub-shapes indices.

     GetShapesOnSphere (theShape, theShapeType, theCenter, theRadius, theState)
     Find in theShape all sub-shapes of type theShapeType, situated relatively the specified sphere by the certain way, defined through theState parameter.

     GetShapesOnSphereIDs (theShape, theShapeType, theCenter, theRadius, theState)
     Works like the above method, but returns list of sub-shapes indices.

     GetShapesOnQuadrangle (theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
     Find in theShape all sub-shapes of type theShapeType, situated relatively the specified quadrangle by the certain way, defined through theState parameter.

     GetShapesOnQuadrangleIDs (theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
     Works like the above method, but returns list of sub-shapes indices.

     GetInPlace (theShapeWhere, theShapeWhat)
     Get sub-shape(s) of theShapeWhere, which are coincident with theShapeWhat or could be a part of it.

     GetSubShape (aShape, ListOfID)
     Obtain a composite sub-shape of <ashape>, composed from sub-shapes of <ashape>, selected by their unique IDs inside <ashape>.

     GetSubShapeID (aShape, aSubShape)
     Obtain unique ID of sub-shape <asubshape> inside <ashape>.

     SubShapeAll (aShape, aType)
     Explode a shape on subshapes of a given type.

     SubShapeAllIDs (aShape, aType)
     Explode a shape on subshapes of a given type.

     SubShapeAllSorted (aShape, aType)
     Explode a shape on subshapes of a given type.

     SubShapeAllSortedIDs (aShape, aType)
     Explode a shape on subshapes of a given type.

     SubShape (aShape, aType, ListOfInd)
     Obtain a compound of sub-shapes of <ashape>, selected by they indices in list of all sub-shapes of type <atype>.

     SubShapeSorted (aShape, aType, ListOfInd)
     Obtain a compound of sub-shapes of <ashape>, selected by they indices in sorted list of all sub-shapes of type <atype>.

     ProcessShape (theShape, theOperators, theParameters, theValues)
     Apply a sequence of Shape Healing operators to the given object.

     SuppressFaces (theObject, theFaces)
     Remove faces from the given object (shape).

     MakeSewing (ListShape, theTolerance)
     Sewing of some shapes into single shape.

     Sew (theObject, theTolerance)
     Sewing of the given object.

     SuppressInternalWires (theObject, theWires)
     Remove internal wires and edges from the given object (face).

     SuppressHoles (theObject, theWires)
     Remove internal closed contours (holes) from the given object.

     CloseContour (theObject, theWires, isCommonVertex)
     Close an open wire.

     DivideEdge (theObject, theEdgeIndex, theValue, isByParameter)
     Addition of a point to a given edge object.

     GetFreeBoundary (theObject)
     Get a list of wires (wrapped in GEOM_Object-s), that constitute a free boundary of the given shape.

     MakeCopy (theOriginal)
     Create a copy of the given object.

     MakeFilling (theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
     Create a filling from the given compound of contours.

     MakeGlueFaces (theShape, theTolerance)
     Replace coincident faces in theShape by one face.

     MakeBoolean (theShape1, theShape2, theOperation)
     Perform one of boolean operations on two given shapes.

     MakeCommon (s1, s2)
     Shortcut to MakeBoolean(s1, s2, 1).

     MakeCut (s1, s2)
     Shortcut to MakeBoolean(s1, s2, 2).

     MakeFuse (s1, s2)
     Shortcut to MakeBoolean(s1, s2, 3).

     MakeSection (s1, s2)
     Shortcut to MakeBoolean(s1, s2, 4).

     MakePartition (ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[])
     Perform partition operation.

     Partition (ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[])
     Shortcut to MakePartition().

     MakeHalfPartition (theShape, thePlane)
     Perform partition of the Shape with the Plane.

     MakeTranslationTwoPoints (theObject, thePoint1, thePoint2)
     Translate the given object along the vector, specified by its end points, creating its copy before the translation.

     MakeTranslation (theObject, theDX, theDY, theDZ)
     Translate the given object along the vector, specified by its components, creating its copy before the translation.

     MakeTranslationVector (theObject, theVector)
     Translate the given object along the given vector, creating its copy before the translation.

     MakeRotation (theObject, theAxis, theAngle)
     Rotate the given object around the given axis on the given angle, creating its copy before the rotatation.

     MakeScaleTransform (theObject, thePoint, theFactor)
     Scale the given object by the factor, creating its copy before the scaling.

     MakeMirrorByPlane (theObject, thePlane)
     Create an object, symmetrical to the given one relatively the given plane.

     MakeMirrorByAxis (theObject, theAxis)
     Create an object, symmetrical to the given one relatively the given axis.

     MakeMirrorByPoint (theObject, thePoint)
     Create an object, symmetrical to the given one relatively the given point.

     MakePosition (theObject, theStartLCS, theEndLCS)
     Modify the Location of the given object by LCS creating its copy before the setting.

     MakeOffset (theObject, theOffset)
     Create new object as offset of the given one.

     MakeMultiTranslation1D (theObject, theVector, theStep, theNbTimes)
     Translate the given object along the given vector a given number times.

     MakeMultiTranslation2D (theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2)
     Conseqently apply two specified translations to theObject specified number of times.

     MultiRotate1D (theObject, theAxis, theNbTimes)
     Rotate the given object around the given axis a given number times.

     MultiRotate2D (theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
     Rotate the given object around the given axis on the given angle a given number times and multi-translate each rotation result.

     MakeMultiRotation1D (aShape, aDir, aPoint, aNbTimes)
     The same, as MultiRotate1D(), but axis is given by direction and point.

     MakeMultiRotation2D (aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2)
     The same, as MultiRotate2D(), but axis is given by direction and point.

     MakeFilletAll (theShape, theR)
     Perform a fillet on all edges of the given shape.

     MakeFillet (theShape, theR, theShapeType, theListShapes)
     Perform a fillet on the specified edges/faces of the given shape.

     MakeChamferAll (theShape, theD)
     Perform a symmetric chamfer on all edges of the given shape.

     MakeChamferEdge (theShape, theD1, theD2, theFace1, theFace2)
     Perform a chamfer on edges, common to the specified faces, with distance D1 on the Face1.

     MakeChamferFaces (theShape, theD1, theD2, theFaces)
     Perform a chamfer on all edges of the specified faces, with distance D1 on the first specified face (if several for one edge).

     MakeChamfer (aShape, d1, d2, aShapeType, ListShape)
     Shortcut to MakeChamferEdge() and MakeChamferFaces().

     Archimede (theShape, theWeight, theWaterDensity, theMeshDeflection)
     Perform an Archimde operation on the given shape with given parameters.

     PointCoordinates (Point)
     Get point coordinates.

     BasicProperties (theShape)
     Get summarized length of all wires, area of surface and volume of the given shape.

     BoundingBox (theShape)
     Get parameters of bounding box of the given shape.

     Inertia (theShape)
     Get inertia matrix and moments of inertia of theShape.

     MinDistance (theShape1, theShape2)
     Get minimal distance between the given shapes.

     Tolerance (theShape)
     Get min and max tolerances of sub-shapes of theShape.

     WhatIs (theShape)
     Obtain description of the given shape (number of sub-shapes of each type).

     MakeCDG (theShape)
     Get a point, situated at the centre of mass of theShape.

     CheckShape (theShape)
     Check a topology of the given shape.

     Import (theFileName, theFormatName)
     Import a shape from the BREP or IGES or STEP file (depends on given format) with given name.

     ImportBREP (theFileName)
     Shortcut to Import() for BREP format.

     ImportIGES (theFileName)
     Shortcut to Import() for IGES format.

     ImportSTEP (theFileName)
     Shortcut to Import() for STEP format.

     Export (theObject, theFileName, theFormatName)
     Export the given shape into a file with given name.

     ExportBREP (theObject, theFileName)
     Shortcut to Export() for BREP format.

     ExportIGES (theObject, theFileName)
     Shortcut to Export() for IGES format.

     ExportSTEP (theObject, theFileName)
     Shortcut to Export() for STEP format.

     MakeQuad (E1, E2, E3, E4)
     Create a quadrangle face from four edges.

     MakeQuad2Edges (E1, E2)
     Create a quadrangle face on two edges.

     MakeQuad4Vertices (V1, V2, V3, V4)
     Create a quadrangle face with specified corners.

     MakeHexa (F1, F2, F3, F4, F5, F6)
     Create a hexahedral solid, bounded by the six given faces.

     MakeHexa2Faces (F1, F2)
     Create a hexahedral solid between two given faces.

     GetPoint (theShape, theX, theY, theZ, theEpsilon)
     Get a vertex, found in the given shape by its coordinates.

     GetEdge (theShape, thePoint1, thePoint2)
     Get an edge, found in the given shape by two given vertices.

     GetEdgeNearPoint (theShape, thePoint)
     Find an edge of the given shape, which has minimal distance to the given point.

     GetFaceByPoints (theShape, thePoint1, thePoint2, thePoint3, thePoint4)
     Returns a face, found in the given shape by four given corner vertices.

     GetFaceByEdges (theShape, theEdge1, theEdge2)
     Get a face of block, found in the given shape by two given edges.

     GetOppositeFace (theBlock, theFace)
     Find a face, opposite to the given one in the given block.

     GetFaceNearPoint (theShape, thePoint)
     Find a face of the given shape, which has minimal distance to the given point.

     GetFaceByNormale (theBlock, theVector)
     Find a face of block, whose outside normale has minimal angle with the given vector.

     CheckCompoundOfBlocks (theCompound)
     Check, if the compound of blocks is given.

     RemoveExtraEdges (theShape)
     Remove all seam and degenerated edges from theShape.

     CheckAndImprove (theShape)
     Check, if the given shape is a blocks compound.

     MakeBlockExplode (theCompound, theMinNbFaces, theMaxNbFaces)
     Get all the blocks, contained in the given compound.

     GetBlockNearPoint (theCompound, thePoint)
     Find block, containing the given point inside its volume or on boundary.

     GetBlockByParts (theCompound, theParts)
     Find block, containing all the elements, passed as the parts, or maximum quantity of them.

     GetBlocksByParts (theCompound, theParts)
     Return all blocks, containing all the elements, passed as the parts.

     MakeMultiTransformation1D (Block, DirFace1, DirFace2, NbTimes)
     Multi-transformate block and glue the result.

     MakeMultiTransformation2D (Block, DirFace1U, DirFace2U, NbTimesU, DirFace1V, DirFace2V, NbTimesV)
     Multi-transformate block and glue the result.

     Propagate (theShape)
     Build all possible propagation groups.

     CreateGroup (theMainShape, theShapeType)
     Creates a new group which will store sub shapes of theMainShape.

     AddObject (theGroup, theSubShapeID)
     Adds a sub object with ID theSubShapeId to the group.

     RemoveObject (theGroup, theSubShapeID)
     Removes a sub object with ID theSubShapeId from the group.

     UnionList (theGroup, theSubShapes)
     Adds to the group all the given shapes.

     UnionIDs (theGroup, theSubShapes)
     Works like the above method, but argument theSubShapes here is a list of sub-shapes indices.

     DifferenceList (theGroup, theSubShapes)
     Removes from the group all the given shapes.

     DifferenceIDs (theGroup, theSubShapes)
     Works like the above method, but argument theSubShapes here is a list of sub-shapes indices.

     GetObjectIDs (theGroup)
     Returns a list of sub objects ID stored in the group.

     GetType (theGroup)
     Returns a type of sub objects stored in the group.

     GetMainShape (theGroup)
     Returns a main shape associated with the group.

     GetEdgesByLength (theShape, min_length, max_length, include_min=1, include_max=1)
     Create group of edges of theShape, whose length is in range [min_length, max_length].

     SelectEdges (min_length, max_length, include_min=1, include_max=1)
     Create group of edges of selected shape, whose length is in range [min_length, max_length].

     addPath (Path)
     Add Path to load python scripts from.

    +


    Function Documentation

    +

    + + + + +
    + + + + + + + + + +
    init_geom theStudy   ) 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SubShapeName aSubObj ,
    aMainObj 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    addToStudy aShape ,
    aName 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    addToStudyInFather aFather ,
    aShape ,
    aName 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeVertex theX ,
    theY ,
    theZ 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theX The X coordinate of the point.
    theY The Y coordinate of the point.
    theZ The Z coordinate of the point.
    +
    +
    Returns:
    New GEOM_Object, containing the created point.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeVertexWithRef theReference ,
    theX ,
    theY ,
    theZ 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theReference The referenced point.
    theX Displacement from the referenced point along OX axis.
    theY Displacement from the referenced point along OY axis.
    theZ Displacement from the referenced point along OZ axis.
    +
    +
    Returns:
    New GEOM_Object, containing the created point.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeVertexOnCurve theRefCurve ,
    theParameter 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theRefCurve The referenced curve.
    theParameter Value of parameter on the referenced curve.
    +
    +
    Returns:
    New GEOM_Object, containing the created point.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeVectorDXDYDZ theDX ,
    theDY ,
    theDZ 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theDX X component of the vector.
    theDY Y component of the vector.
    theDZ Z component of the vector.
    +
    +
    Returns:
    New GEOM_Object, containing the created vector.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeVector thePnt1 ,
    thePnt2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt1 Start point for the vector.
    thePnt2 End point for the vector.
    +
    +
    Returns:
    New GEOM_Object, containing the created vector.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeLine thePnt ,
    theDir 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt Point. The resulting line will pass through it.
    theDir Direction. The resulting line will be parallel to it.
    +
    +
    Returns:
    New GEOM_Object, containing the created line.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeLineTwoPnt thePnt1 ,
    thePnt2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt1 First of two points, defining the line.
    thePnt2 Second of two points, defining the line.
    +
    +
    Returns:
    New GEOM_Object, containing the created line.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePlane thePnt ,
    theVec ,
    theTrimSize 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    thePnt Point, the plane has to pass through.
    theVec Vector, defining the plane normal direction.
    theTrimSize Half size of a side of quadrangle face, representing the plane.
    +
    +
    Returns:
    New GEOM_Object, containing the created plane.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePlaneThreePnt thePnt1 ,
    thePnt2 ,
    thePnt3 ,
    theTrimSize 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    thePnt1 First of three points, defining the plane.
    thePnt2 Second of three points, defining the plane.
    thePnt3 Fird of three points, defining the plane.
    theTrimSize Half size of a side of quadrangle face, representing the plane.
    +
    +
    Returns:
    New GEOM_Object, containing the created plane.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakePlaneFace theFace ,
    theTrimSize 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theFace Referenced plane.
    theTrimSize New half size of a side of quadrangle face, representing the plane.
    +
    +
    Returns:
    New GEOM_Object, containing the created plane.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMarker OX ,
    OY ,
    OZ ,
    XDX ,
    XDY ,
    XDZ ,
    YDX ,
    YDY ,
    YDZ 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    OX,OY,OZ Three coordinates of coordinate system origin.
    XDX,XDY,XDZ Three components of OX direction
    YDX,YDY,YDZ Three components of OY direction
    +
    +
    Returns:
    New GEOM_Object, containing the created coordinate system.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMarkerPntTwoVec theOrigin ,
    theXVec ,
    theYVec 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theOrigin Point of coordinate system origin.
    theXVec Vector of X direction
    theYVec Vector of Y direction
    +
    +
    Returns:
    New GEOM_Object, containing the created coordinate system.
    +
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeArc thePnt1 ,
    thePnt2 ,
    thePnt3 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    thePnt1 Start point of the arc.
    thePnt2 Middle point of the arc.
    thePnt3 End point of the arc.
    +
    +
    Returns:
    New GEOM_Object, containing the created arc.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeCircle thePnt ,
    theVec ,
    theR 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    thePnt Circle center.
    theVec Vector, normal to the plane of the circle.
    theR Circle radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created circle.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeCircleThreePnt thePnt1 ,
    thePnt2 ,
    thePnt3 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    thePnt1,thePnt2,thePnt3 Points, defining the circle.
    +
    +
    Returns:
    New GEOM_Object, containing the created circle.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeEllipse thePnt ,
    theVec ,
    theRMajor ,
    theRMinor 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    thePnt Ellipse center.
    theVec Vector, normal to the plane of the ellipse.
    theRMajor Major ellipse radius.
    theRMinor Minor ellipse radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created ellipse.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakePolyline thePoints   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    thePoints Sequence of points for the polyline.
    +
    +
    Returns:
    New GEOM_Object, containing the created polyline.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeBezier thePoints   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    thePoints Sequence of points for the bezier curve.
    +
    +
    Returns:
    New GEOM_Object, containing the created bezier curve.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeInterpol thePoints   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    thePoints Sequence of points for the B-Spline curve.
    +
    +
    Returns:
    New GEOM_Object, containing the created B-Spline curve.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeSketcher theCommand ,
    theWorkingPlane  = [0,
    ,
    ,
    ,
    ,
    ,
    ,
    ,
    0] 
    +
    + + + + + +
    +   + + +

    +
    + Edges of the resulting wire or face will be arcs of circles and/or linear segments.
    + Format of the description string have to be the following:

    +"Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"

    +Where:

      +
    • x1, y1 are coordinates of the first sketcher point (zero by default),
    • CMD is one of
        +
      • "R angle" : Set the direction by angle
      • "D dx dy" : Set the direction by DX & DY
      +
      +
        +
      • "TT x y" : Create segment by point at X & Y
      • "T dx dy" : Create segment by point with DX & DY
      • "L length" : Create segment by direction & Length
      • "IX x" : Create segment by direction & Intersect. X
      • "IY y" : Create segment by direction & Intersect. Y
      +
      +
        +
      • "C radius length" : Create arc by direction, radius and length(in degree)
      +
      +
        +
      • "WW" : Close Wire (to finish)
      • "WF" : Close Wire and build face (to finish)
      +
    +

    +

    Parameters:
    + + + +
    theCommand String, defining the sketcher in local coordinates of the working plane.
    theWorkingPlane Nine double values, defining origin, OZ and OX directions of the working plane.
    +
    +
    Returns:
    New GEOM_Object, containing the created wire.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeSketcherOnPlane theCommand ,
    theWorkingPlane 
    +
    + + + + + +
    +   + + +

    +
    + For format of the description string see the previous method.
    +

    Parameters:
    + + + +
    theCommand String, defining the sketcher in local coordinates of the working plane.
    theWorkingPlane Planar Face of the working plane.
    +
    +
    Returns:
    New GEOM_Object, containing the created wire.
    +
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeBox x1 ,
    y1 ,
    z1 ,
    x2 ,
    y2 ,
    z2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeBoxDXDYDZ theDX ,
    theDY ,
    theDZ 
    +
    + + + + + +
    +   + + +

    +Center of the box will be at point (DX/2, DY/2, DZ/2).

    Parameters:
    + + + + +
    theDX Length of Box edges, parallel to OX axis.
    theDY Length of Box edges, parallel to OY axis.
    theDZ Length of Box edges, parallel to OZ axis.
    +
    +
    Returns:
    New GEOM_Object, containing the created box.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeBoxTwoPnt thePnt1 ,
    thePnt2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt1 First of two opposite vertices.
    thePnt2 Second of two opposite vertices.
    +
    +
    Returns:
    New GEOM_Object, containing the created box.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeCylinder thePnt ,
    theAxis ,
    theR ,
    theH 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    thePnt Central point of cylinder base.
    theAxis Cylinder axis.
    theR Cylinder radius.
    theH Cylinder height.
    +
    +
    Returns:
    New GEOM_Object, containing the created cylinder.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeCylinderRH theR ,
    theH 
    +
    + + + + + +
    +   + + +

    +Axis of the cylinder will be collinear to the OZ axis of the coordinate system.

    Parameters:
    + + + +
    theR Cylinder radius.
    theH Cylinder height.
    +
    +
    Returns:
    New GEOM_Object, containing the created cylinder.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeSpherePntR thePnt ,
    theR 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt Sphere center.
    theR Sphere radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created sphere.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeSphere ,
    ,
    ,
    theR 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    x,y,z Coordinates of sphere center.
    theR Sphere radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created sphere.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeSphereR theR   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theR Sphere radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created sphere.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeCone thePnt ,
    theAxis ,
    theR1 ,
    theR2 ,
    theH 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    thePnt Central point of the first cone base.
    theAxis Cone axis.
    theR1 Radius of the first cone base.
    theR2 Radius of the second cone base.
    +
    +
    Note:
    If both radiuses are non-zero, the cone will be truncated.

    +If the radiuses are equal, a cylinder will be created instead.

    +
    Parameters:
    + + +
    theH Cone height.
    +
    +
    Returns:
    New GEOM_Object, containing the created cone.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeConeR1R2H theR1 ,
    theR2 ,
    theH 
    +
    + + + + + +
    +   + + +

    +Axis of the cone will be collinear to the OZ axis of the coordinate system.

    Parameters:
    + + + +
    theR1 Radius of the first cone base.
    theR2 Radius of the second cone base.
    +
    +
    Note:
    If both radiuses are non-zero, the cone will be truncated.

    +If the radiuses are equal, a cylinder will be created instead.

    +
    Parameters:
    + + +
    theH Cone height.
    +
    +
    Returns:
    New GEOM_Object, containing the created cone.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeTorus thePnt ,
    theVec ,
    theRMajor ,
    theRMinor 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    thePnt Torus central point.
    theVec Torus axis of symmetry.
    theRMajor Torus major radius.
    theRMinor Torus minor radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created torus.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeTorusRR theRMajor ,
    theRMinor 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theRMajor Torus major radius.
    theRMinor Torus minor radius.
    +
    +
    Returns:
    New GEOM_Object, containing the created torus.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePrism theBase ,
    thePoint1 ,
    thePoint2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theBase Base shape to be extruded.
    thePoint1 First end of extrusion vector.
    thePoint2 Second end of extrusion vector.
    +
    +
    Returns:
    New GEOM_Object, containing the created prism.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePrismVecH theBase ,
    theVec ,
    theH 
    +
    + + + + + +
    +   + + +

    +all the space, transfixed by the base shape during its translation along the vector on the given distance.

    Parameters:
    + + + + +
    theBase Base shape to be extruded.
    theVec Direction of extrusion.
    theH Prism dimension along theVec.
    +
    +
    Returns:
    New GEOM_Object, containing the created prism.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakePipe theBase ,
    thePath 
    +
    + + + + + +
    +   + + +

    +The path shape can be a wire or an edge.

    Parameters:
    + + + +
    theBase Base shape to be extruded.
    thePath Path shape to extrude the base shape along it.
    +
    +
    Returns:
    New GEOM_Object, containing the created pipe.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeRevolution theBase ,
    theAxis ,
    theAngle 
    +
    + + + + + +
    +   + + +

    +all the space, transfixed by the base shape during its rotation around the axis on the given angle.

    Parameters:
    + + + + +
    theBase Base shape to be rotated.
    theAxis Rotation axis.
    theAngle Rotation angle in radians.
    +
    +
    Returns:
    New GEOM_Object, containing the created revolution.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeEdge thePnt1 ,
    thePnt2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    thePnt1 Point for the first end of edge.
    thePnt2 Point for the second end of edge.
    +
    +
    Returns:
    New GEOM_Object, containing the created edge.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeWire theEdgesAndWires   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theEdgesAndWires List of edges and/or wires.
    +
    +
    Returns:
    New GEOM_Object, containing the created wire.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeFace theWire ,
    isPlanarWanted 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theWire Wire to build the face on.
    isPlanarWanted If TRUE, only planar face will be built. If impossible, NULL object will be returned.
    +
    +
    Returns:
    New GEOM_Object, containing the created face.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeFaceWires theWires ,
    isPlanarWanted 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theWires List of wires to build the face on.
    isPlanarWanted If TRUE, only planar face will be built. If impossible, NULL object will be returned.
    +
    +
    Returns:
    New GEOM_Object, containing the created face.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeFaces theWires ,
    isPlanarWanted 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + +
    MakeShell theFacesAndShells   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theFacesAndShells List of faces and/or shells.
    +
    +
    Returns:
    New GEOM_Object, containing the created shell.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeSolid theShells   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShells Sequence of bounding shells.
    +
    +
    Returns:
    New GEOM_Object, containing the created solid.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    MakeCompound theShapes   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShapes List of shapes to put in compound.
    +
    +
    Returns:
    New GEOM_Object, containing the created compound.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    NumberOfFaces theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to count faces of.
    +
    +
    Returns:
    Quantity of faces.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    NumberOfEdges theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to count edges of.
    +
    +
    Returns:
    Quantity of edges.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    ChangeOrientation theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to be reversed.
    +
    +
    Returns:
    The reversed copy of theShape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    OrientationChange theShape   ) 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + +
    GetFreeFacesIDs theShape   ) 
    +
    + + + + + +
    +   + + +

    +Free face is a face, which is not shared between two shells of the shape.

    Parameters:
    + + +
    theShape Shape to find free faces in.
    +
    +
    Returns:
    List of IDs of all free faces, contained in theShape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    GetSharedShapes theShape1 ,
    theShape2 ,
    theShapeType 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theShape1 Shape to find sub-shapes in.
    theShape2 Shape to find shared sub-shapes with.
    theShapeType Type of sub-shapes to be retrieved.
    +
    +
    Returns:
    List of sub-shapes of theShape1, shared with theShape2.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnPlane theShape ,
    theShapeType ,
    theAx1 ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theShape Shape to find sub-shapes of.
    theShapeType Type of sub-shapes to be retrieved.
    theAx1 Vector (or line, or linear edge), specifying normal direction and location of the plane to find shapes on.
    theState The state of the subshapes to find. It can be one of ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
    +
    +
    Returns:
    List of all found sub-shapes.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnPlaneIDs theShape ,
    theShapeType ,
    theAx1 ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnCylinder theShape ,
    theShapeType ,
    theAxis ,
    theRadius ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + +
    theShape Shape to find sub-shapes of.
    theShapeType Type of sub-shapes to be retrieved.
    theAxis Vector (or line, or linear edge), specifying axis of the cylinder to find shapes on.
    theRadius Radius of the cylinder to find shapes on.
    theState The state of the subshapes to find. It can be one of ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
    +
    +
    Returns:
    List of all found sub-shapes.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnCylinderIDs theShape ,
    theShapeType ,
    theAxis ,
    theRadius ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnSphere theShape ,
    theShapeType ,
    theCenter ,
    theRadius ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + +
    theShape Shape to find sub-shapes of.
    theShapeType Type of sub-shapes to be retrieved.
    theCenter Point, specifying center of the sphere to find shapes on.
    theRadius Radius of the sphere to find shapes on.
    theState The state of the subshapes to find. It can be one of ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
    +
    +
    Returns:
    List of all found sub-shapes.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnSphereIDs theShape ,
    theShapeType ,
    theCenter ,
    theRadius ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnQuadrangle theShape ,
    theShapeType ,
    theTopLeftPoint ,
    theTopRigthPoint ,
    theBottomLeftPoint ,
    theBottomRigthPoint ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + +
    theShape Shape to find sub-shapes of.
    theShapeType Type of sub-shapes to be retrieved.
    theCenter Point, specifying center of the sphere to find shapes on.
    theRadius Radius of the sphere to find shapes on.
    theState The state of the subshapes to find. It can be one of ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
    +
    +
    Returns:
    List of all found sub-shapes.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetShapesOnQuadrangleIDs theShape ,
    theShapeType ,
    theTopLeftPoint ,
    theTopRigthPoint ,
    theBottomLeftPoint ,
    theBottomRigthPoint ,
    theState 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetInPlace theShapeWhere ,
    theShapeWhat 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShapeWhere Shape to find sub-shapes of.
    theShapeWhat Shape, specifying what to find.
    +
    +
    Returns:
    Group of all found sub-shapes or a single found sub-shape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetSubShape aShape ,
    ListOfID 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetSubShapeID aShape ,
    aSubShape 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SubShapeAll aShape ,
    aType 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Shape to be exploded.
    theShapeType Type of sub-shapes to be retrieved.
    +
    +
    Returns:
    List of sub-shapes of type theShapeType, contained in theShape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SubShapeAllIDs aShape ,
    aType 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Shape to be exploded.
    theShapeType Type of sub-shapes to be retrieved.
    +
    +
    Returns:
    List of IDs of sub-shapes.
    +
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SubShapeAllSorted aShape ,
    aType 
    +
    + + + + + +
    +   + + +

    +Sub-shapes will be sorted by coordinates of their gravity centers.

    Parameters:
    + + + +
    theShape Shape to be exploded.
    theShapeType Type of sub-shapes to be retrieved.
    +
    +
    Returns:
    List of sub-shapes of type theShapeType, contained in theShape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SubShapeAllSortedIDs aShape ,
    aType 
    +
    + + + + + +
    +   + + +

    +Sub-shapes will be sorted by coordinates of their gravity centers.

    Parameters:
    + + + +
    theShape Shape to be exploded.
    theShapeType Type of sub-shapes to be retrieved.
    +
    +
    Returns:
    List of IDs of sub-shapes.
    +
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SubShape aShape ,
    aType ,
    ListOfInd 
    +
    + + + + + +
    +   + + +

    +Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    SubShapeSorted aShape ,
    aType ,
    ListOfInd 
    +
    + + + + + +
    +   + + +

    +Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ProcessShape theShape ,
    theOperators ,
    theParameters ,
    theValues 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theShape Shape to be processed.
    theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
    theParameters List of names of parameters ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
    theValues List of values of parameters, in the same order as parameters are listed in theParameters list.
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SuppressFaces theObject ,
    theFaces 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject Shape to be processed.
    theFaces Indices of faces to be removed, if EMPTY then the method removes ALL faces of the given object.
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeSewing ListShape ,
    theTolerance 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestHealing.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    Sew theObject ,
    theTolerance 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject Shape to be processed.
    theTolerance Required tolerance value.
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see MakeSewing() above
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SuppressInternalWires theObject ,
    theWires 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject Shape to be processed.
    theWires Indices of wires to be removed, if EMPTY then the method removes ALL internal wires of the given object.
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    SuppressHoles theObject ,
    theWires 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject Shape to be processed.
    theWires Indices of wires to be removed, if EMPTY then the method removes ALL internal holes of the given object
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    CloseContour theObject ,
    theWires ,
    isCommonVertex 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theObject Shape to be processed.
    theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, if -1, then theObject itself is a wire.
    isCommonVertex If TRUE : closure by creation of a common vertex, If FALS : closure by creation of an edge between ends.
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DivideEdge theObject ,
    theEdgeIndex ,
    theValue ,
    isByParameter 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theObject Shape to be processed.
    theEdgeIndex Index of edge to be divided within theObject's shape, if -1, then theObject itself is the edge.
    theValue Value of parameter on edge or length parameter, depending on isByParameter.
    isByParameter If TRUE : theValue is treated as a curve parameter [0..1], if FALSE : theValue is treated as a length parameter [0..1]
    +
    +
    Returns:
    New GEOM_Object, containing processed shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + +
    GetFreeBoundary theObject   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theObject Shape to get free boundary of.
    +
    +
    Returns:
    [status, theClosedWires, theOpenWires] status: FALSE, if an error(s) occured during the method execution. theClosedWires: Closed wires on the free boundary of the given shape. theOpenWires: Open wires on the free boundary of the given shape.
    +Example: see GEOM_TestHealing.py
    +

    + + + + +
    + + + + + + + + + +
    MakeCopy theOriginal   ) 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeFilling theShape ,
    theMinDeg ,
    theMaxDeg ,
    theTol2D ,
    theTol3D ,
    theNbIter 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + + +
    theShape the compound of contours
    theMinDeg a minimal degree
    theMaxDeg a maximal degree
    theTol2D a 2d tolerance
    theTol3D a 3d tolerance
    theNbIter a number of iteration
    +
    +
    Returns:
    New GEOM_Object, containing the created filling surface.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeGlueFaces theShape ,
    theTolerance 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Initial shape.
    theTolerance Maximum distance between faces, which can be considered as coincident.
    +
    +
    Returns:
    New GEOM_Object, containing a copy of theShape without coincident faces.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeBoolean theShape1 ,
    theShape2 ,
    theOperation 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theShape1 First argument for boolean operation.
    theShape2 Second argument for boolean operation.
    theOperation Indicates the operation to be done: 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
    +
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeCommon s1 ,
    s2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeCut s1 ,
    s2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeFuse s1 ,
    s2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeSection s1 ,
    s2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePartition ListShapes ,
    ListTools  = [],
    ListKeepInside  = [],
    ListRemoveInside  = [],
    Limit  = ShapeType["SHAPE"],
    RemoveWebs  = 0,
    ListMaterials  = []
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + + + +
    ListShapes Shapes to be intersected.
    ListTools Shapes to intersect theShapes.
    ListKeepInside Shapes, outside which the results will be deleted. Each shape from theKeepInside must belong to theShapes also.
    ListRemoveInside Shapes, inside which the results will be deleted. Each shape from theRemoveInside must belong to theShapes also.
    Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
    RemoveWebs If TRUE, perform Glue 3D algorithm.
    ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
    +
    +
    Returns:
    New GEOM_Object, containing the result shapes.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Partition ListShapes ,
    ListTools  = [],
    ListKeepInside  = [],
    ListRemoveInside  = [],
    Limit  = ShapeType["SHAPE"],
    RemoveWebs  = 0,
    ListMaterials  = []
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeHalfPartition theShape ,
    thePlane 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Shape to be intersected.
    thePlane Tool shape, to intersect theShape.
    +
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeTranslationTwoPoints theObject ,
    thePoint1 ,
    thePoint2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theObject The object to be translated.
    thePoint1 Start point of translation vector.
    thePoint2 End point of translation vector.
    +
    +
    Returns:
    New GEOM_Object, containing the translated object.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeTranslation theObject ,
    theDX ,
    theDY ,
    theDZ 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The object to be translated.
    theDX,theDY,theDZ Components of translation vector.
    +
    +
    Returns:
    New GEOM_Object, containing the translated object.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeTranslationVector theObject ,
    theVector 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The object to be translated.
    theVector The translation vector.
    +
    +
    Returns:
    New GEOM_Object, containing the translated object.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeRotation theObject ,
    theAxis ,
    theAngle 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theObject The object to be rotated.
    theAxis Rotation axis.
    theAngle Rotation angle in radians.
    +
    +
    Returns:
    New GEOM_Object, containing the rotated object.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeScaleTransform theObject ,
    thePoint ,
    theFactor 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theObject The object to be scaled.
    thePoint Center point for scaling.
    theFactor Scaling factor value.
    +
    +
    Returns:
    New GEOM_Object, containing the scaled shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeMirrorByPlane theObject ,
    thePlane 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The object to be mirrored.
    thePlane Plane of symmetry.
    +
    +
    Returns:
    New GEOM_Object, containing the mirrored shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeMirrorByAxis theObject ,
    theAxis 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The object to be mirrored.
    theAxis Axis of symmetry.
    +
    +
    Returns:
    New GEOM_Object, containing the mirrored shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeMirrorByPoint theObject ,
    thePoint 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The object to be mirrored.
    thePoint Point of symmetry.
    +
    +
    Returns:
    New GEOM_Object, containing the mirrored shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakePosition theObject ,
    theStartLCS ,
    theEndLCS 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestAll.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeOffset theObject ,
    theOffset 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theObject The base object for the offset.
    theOffset Offset value.
    +
    +
    Returns:
    New GEOM_Object, containing the offset object.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiTranslation1D theObject ,
    theVector ,
    theStep ,
    theNbTimes 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theObject The object to be translated.
    theVector Direction of the translation.
    theStep Distance to translate on.
    theNbTimes Quantity of translations to be done.
    +
    +
    Returns:
    New GEOM_Object, containing compound of all the shapes, obtained after each translation.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiTranslation2D theObject ,
    theVector1 ,
    theStep1 ,
    theNbTimes1 ,
    theVector2 ,
    theStep2 ,
    theNbTimes2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + + + + +
    theObject The object to be translated.
    theVector1 Direction of the first translation.
    theStep1 Step of the first translation.
    theNbTimes1 Quantity of translations to be done along theVector1.
    theVector2 Direction of the second translation.
    theStep2 Step of the second translation.
    theNbTimes2 Quantity of translations to be done along theVector2.
    +
    +
    Returns:
    New GEOM_Object, containing compound of all the shapes, obtained after each translation.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MultiRotate1D theObject ,
    theAxis ,
    theNbTimes 
    +
    + + + + + +
    +   + + +

    +Rotation angle will be 2*PI/theNbTimes.

    Parameters:
    + + + + +
    theObject The object to be rotated.
    theAxis The rotation axis.
    theNbTimes Quantity of rotations to be done.
    +
    +
    Returns:
    New GEOM_Object, containing compound of all the shapes, obtained after each rotation.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MultiRotate2D theObject ,
    theAxis ,
    theAngle ,
    theNbTimes1 ,
    theStep ,
    theNbTimes2 
    +
    + + + + + +
    +   + + +

    +Translation direction passes through center of gravity of rotated shape and its projection on the rotation axis.

    Parameters:
    + + + + + + + +
    theObject The object to be rotated.
    theAxis Rotation axis.
    theAngle Rotation angle in graduces.
    theNbTimes1 Quantity of rotations to be done.
    theStep Translation distance.
    theNbTimes2 Quantity of translations to be done.
    +
    +
    Returns:
    New GEOM_Object, containing compound of all the shapes, obtained after each transformation.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiRotation1D aShape ,
    aDir ,
    aPoint ,
    aNbTimes 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiRotation2D aShape ,
    aDir ,
    aPoint ,
    anAngle ,
    nbtimes1 ,
    aStep ,
    nbtimes2 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeFilletAll theShape ,
    theR 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Shape, to perform fillet on.
    theR Fillet radius.
    +
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeFillet theShape ,
    theR ,
    theShapeType ,
    theListShapes 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theShape Shape, to perform fillet on.
    theR Fillet radius.
    theShapeType Type of shapes in <thelistshapes>.
    theListShapes Global indices of edges/faces to perform fillet on.
    +
    +
    Note:
    Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeChamferAll theShape ,
    theD 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Shape, to perform chamfer on.
    theD Chamfer size along each face.
    +
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeChamferEdge theShape ,
    theD1 ,
    theD2 ,
    theFace1 ,
    theFace2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theShape Shape, to perform chamfer on.
    theD1 Chamfer size along theFace1.
    theD2 Chamfer size along theFace2.
    theFace1,theFace2 Global indices of two faces of theShape.
    +
    +
    Note:
    Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeChamferFaces theShape ,
    theD1 ,
    theD2 ,
    theFaces 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    theShape Shape, to perform chamfer on.
    theD1 Chamfer size along face from theFaces. If both faces, connected to the edge, are in theFaces, theD1 will be get along face, which is nearer to theFaces beginning.
    theD2 Chamfer size along another of two faces, connected to the edge.
    theFaces Sequence of global indices of faces of theShape.
    +
    +
    Note:
    Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeChamfer aShape ,
    d1 ,
    d2 ,
    aShapeType ,
    ListShape 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Archimede theShape ,
    theWeight ,
    theWaterDensity ,
    theMeshDeflection 
    +
    + + + + + +
    +   + + +

    +The object presenting the resulting face is returned

    Parameters:
    + + + + + +
    theShape Shape to be put in water.
    theWeight Weight og the shape.
    theWaterDensity Density of the water.
    theMeshDeflection Deflection of the mesh, using to compute the section.
    +
    +
    Returns:
    New GEOM_Object, containing a section of theShape by a plane, corresponding to water level.
    +Example: see GEOM_TestAll.py
    +

    + + + + +
    + + + + + + + + + +
    PointCoordinates Point   ) 
    +
    + + + + + +
    +   + + +

    +

    Returns:
    [x, y, z]
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    BasicProperties theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to define properties of.
    +
    +
    Returns:
    [theLength, theSurfArea, theVolume] theLength: Summarized length of all wires of the given shape. theSurfArea: Area of surface of the given shape. theVolume: Volume of the given shape.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    BoundingBox theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to obtain bounding box of.
    +
    +
    Returns:
    [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] Xmin,Xmax: Limits of shape along OX axis. Ymin,Ymax: Limits of shape along OY axis. Zmin,Zmax: Limits of shape along OZ axis.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    Inertia theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to calculate inertia of.
    +
    +
    Returns:
    [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz] I(1-3)(1-3): Components of the inertia matrix of the given shape. Ix,Iy,Iz: Moments of inertia of the given shape.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MinDistance theShape1 ,
    theShape2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape1,theShape2 Shapes to find minimal distance between.
    +
    +
    Returns:
    Value of the minimal distance between the given shapes.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    Tolerance theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape, to get tolerances of.
    +
    +
    Returns:
    [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] FaceMin,FaceMax: Min and max tolerances of the faces. EdgeMin,EdgeMax: Min and max tolerances of the edges. VertMin,VertMax: Min and max tolerances of the vertices.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    WhatIs theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to be described.
    +
    +
    Returns:
    Description of the given shape.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    MakeCDG theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to define centre of mass of.
    +
    +
    Returns:
    New GEOM_Object, containing the created point.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + +
    CheckShape theShape   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theShape Shape to check validity of.
    +
    +
    Returns:
    TRUE, if the shape "seems to be valid" from the topological point of view. If theShape is invalid, prints a description of problem.
    +Example: see GEOM_TestMeasures.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    Import theFileName ,
    theFormatName 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theFileName The file, containing the shape.
    theFormatName Specify format for the file reading. Available formats can be obtained with InsertOp.ImportTranslators() method.
    +
    +
    Returns:
    New GEOM_Object, containing the imported shape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    ImportBREP theFileName   ) 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + +
    ImportIGES theFileName   ) 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + +
    ImportSTEP theFileName   ) 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Export theObject ,
    theFileName ,
    theFormatName 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theObject Shape to be stored in the file.
    theFileName Name of the file to store the given shape in.
    theFormatName Specify format for the shape storage. Available formats can be obtained with InsertOp.ImportTranslators() method.
    +
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    ExportBREP theObject ,
    theFileName 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    ExportIGES theObject ,
    theFileName 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    ExportSTEP theObject ,
    theFileName 
    +
    + + + + + +
    +   + + +

    +Example: see GEOM_TestOthers.py

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeQuad E1 ,
    E2 ,
    E3 ,
    E4 
    +
    + + + + + +
    +   + + +

    +Order of Edges is not important. It is not necessary that edges share the same vertex.

    Parameters:
    + + +
    E1,E2,E3,E4 Edges for the face bound.
    +
    +
    Returns:
    New GEOM_Object, containing the created face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeQuad2Edges E1 ,
    E2 
    +
    + + + + + +
    +   + + +

    +The missing edges will be built by creating the shortest ones.

    Parameters:
    + + +
    E1,E2 Two opposite edges for the face.
    +
    +
    Returns:
    New GEOM_Object, containing the created face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeQuad4Vertices V1 ,
    V2 ,
    V3 ,
    V4 
    +
    + + + + + +
    +   + + +

    +The missing edges will be built by creating the shortest ones.

    Parameters:
    + + +
    V1,V2,V3,V4 Corner vertices for the face.
    +
    +
    Returns:
    New GEOM_Object, containing the created face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeHexa F1 ,
    F2 ,
    F3 ,
    F4 ,
    F5 ,
    F6 
    +
    + + + + + +
    +   + + +

    +Order of faces is not important. It is not necessary that Faces share the same edge.

    Parameters:
    + + +
    F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
    +
    +
    Returns:
    New GEOM_Object, containing the created solid.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    MakeHexa2Faces F1 ,
    F2 
    +
    + + + + + +
    +   + + +

    +The missing faces will be built by creating the smallest ones.

    Parameters:
    + + +
    F1,F2 Two opposite faces for the hexahedral solid.
    +
    +
    Returns:
    New GEOM_Object, containing the created solid.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetPoint theShape ,
    theX ,
    theY ,
    theZ ,
    theEpsilon 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theShape Block or a compound of blocks.
    theX,theY,theZ Coordinates of the sought vertex.
    theEpsilon Maximum allowed distance between the resulting vertex and point with the given coordinates.
    +
    +
    Returns:
    New GEOM_Object, containing the found vertex.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    GetEdge theShape ,
    thePoint1 ,
    thePoint2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    thePoint1,thePoint2 Points, close to the ends of the desired edge.
    +
    +
    Returns:
    New GEOM_Object, containing the found edge.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetEdgeNearPoint theShape ,
    thePoint 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    thePoint Point, close to the desired edge.
    +
    +
    Returns:
    New GEOM_Object, containing the found edge.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetFaceByPoints theShape ,
    thePoint1 ,
    thePoint2 ,
    thePoint3 ,
    thePoint4 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    thePoint1-thePoint4 Points, close to the corners of the desired face.
    +
    +
    Returns:
    New GEOM_Object, containing the found face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    GetFaceByEdges theShape ,
    theEdge1 ,
    theEdge2 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    theEdge1,theEdge2 Edges, close to the edges of the desired face.
    +
    +
    Returns:
    New GEOM_Object, containing the found face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetOppositeFace theBlock ,
    theFace 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theBlock Must be a hexahedral solid.
    theFace Face of theBlock, opposite to the desired face.
    +
    +
    Returns:
    New GEOM_Object, containing the found face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetFaceNearPoint theShape ,
    thePoint 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    thePoint Point, close to the desired face.
    +
    +
    Returns:
    New GEOM_Object, containing the found face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetFaceByNormale theBlock ,
    theVector 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theShape Block or a compound of blocks.
    theVector Vector, close to the normale of the desired face.
    +
    +
    Returns:
    New GEOM_Object, containing the found face.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + +
    CheckCompoundOfBlocks theCompound   ) 
    +
    + + + + + +
    +   + + +

    +To be considered as a compound of blocks, the given shape must satisfy the following conditions:

      +
    • Each element of the compound should be a Block (6 faces and 12 edges).
    • A connection between two Blocks should be an entire quadrangle face or an entire edge.
    • The compound should be connexe.
    • The glue between two quadrangle faces should be applied.
      Parameters:
      + + +
      theCompound The compound to check.
      +
      +
      Returns:
      TRUE, if the given shape is a compound of blocks. If theCompound is not valid, prints all discovered errors.
      +Example: see GEOM_Spanner.py
    +
    +

    + + + + +
    + + + + + + + + + +
    RemoveExtraEdges theShape   ) 
    +
    + + + + + +
    +   + + +

    +Unite faces and edges, sharing one surface.

    Parameters:
    + + +
    theShape The compound or single solid to remove irregular edges from.
    +
    +
    Returns:
    Improved shape.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    CheckAndImprove theShape   ) 
    +
    + + + + + +
    +   + + +

    +Fix all detected errors.

    Note:
    Single block can be also fixed by this method.
    +
    Parameters:
    + + +
    theCompound The compound to check and improve.
    +
    +
    Returns:
    Improved compound.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeBlockExplode theCompound ,
    theMinNbFaces ,
    theMaxNbFaces 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + +
    theCompound The compound to explode.
    theMinNbFaces If solid has lower number of faces, it is not a block.
    theMaxNbFaces If solid has higher number of faces, it is not a block.
    +
    +
    Note:
    If theMaxNbFaces = 0, the maximum number of faces is not restricted.
    +
    Returns:
    List of GEOM_Objects, containing the retrieved blocks.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetBlockNearPoint theCompound ,
    thePoint 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theCompound Compound, to find block in.
    thePoint Point, close to the desired block. If the point lays on boundary between some blocks, we return block with nearest center.
    +
    +
    Returns:
    New GEOM_Object, containing the found block.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetBlockByParts theCompound ,
    theParts 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theCompound Compound, to find block in.
    theParts List of faces and/or edges and/or vertices to be parts of the found block.
    +
    +
    Returns:
    New GEOM_Object, containing the found block.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    GetBlocksByParts theCompound ,
    theParts 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theCompound Compound, to find blocks in.
    theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
    +
    +
    Returns:
    List of GEOM_Objects, containing the found blocks.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiTransformation1D Block ,
    DirFace1 ,
    DirFace2 ,
    NbTimes 
    +
    + + + + + +
    +   + + +

    +Transformation is defined so, as to superpose direction faces.

    Parameters:
    + + + + + +
    Block Hexahedral solid to be multi-transformed.
    DirFace1 ID of First direction face.
    DirFace2 ID of Second direction face.
    NbTimes Quantity of transformations to be done.
    +
    +
    Note:
    Unique ID of sub-shape can be obtained, using method GetSubShapeID().
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MakeMultiTransformation2D Block ,
    DirFace1U ,
    DirFace2U ,
    NbTimesU ,
    DirFace1V ,
    DirFace2V ,
    NbTimesV 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + + + +
    Block Hexahedral solid to be multi-transformed.
    DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
    DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
    NbTimesU,NbTimesV Quantity of transformations to be done.
    +
    +
    Returns:
    New GEOM_Object, containing the result shape.
    +Example: see GEOM_Spanner.py
    +

    + + + + +
    + + + + + + + + + +
    Propagate theShape   ) 
    +
    + + + + + +
    +   + + +

    +Propagation group is a set of all edges, opposite to one (main) edge of this group directly or through other opposite edges. Notion of Opposite Edge make sence only on quadrangle face.

    Parameters:
    + + +
    theShape Shape to build propagation groups on.
    +
    +
    Returns:
    List of GEOM_Objects, each of them is a propagation group.
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    CreateGroup theMainShape ,
    theShapeType 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theMainShape is a GEOM object on which the group is selected
    theShapeType defines a shape type of the group
    +
    +
    Returns:
    a newly created GEOM group
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    AddObject theGroup ,
    theSubShapeID 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theGroup is a GEOM group to which the new sub shape is added
    theSubShapeID is a sub shape ID in the main object.
    +
    +
    Note:
    Use method GetSubShapeID() to get an unique ID of the sub shape
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    RemoveObject theGroup ,
    theSubShapeID 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + + +
    theGroup is a GEOM group from which the new sub shape is removed
    theSubShapeID is a sub shape ID in the main object.
    +
    +
    Note:
    Use method GetSubShapeID() to get an unique ID of the sub shape
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    UnionList theGroup ,
    theSubShapes 
    +
    + + + + + +
    +   + + +

    +No errors, if some shapes are alredy included.

    Parameters:
    + + + +
    theGroup is a GEOM group to which the new sub shapes are added.
    theSubShapes is a list of sub shapes to be added.
    +
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    UnionIDs theGroup ,
    theSubShapes 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    DifferenceList theGroup ,
    theSubShapes 
    +
    + + + + + +
    +   + + +

    +No errors, if some shapes are not included.

    Parameters:
    + + + +
    theGroup is a GEOM group from which the sub-shapes are removed.
    theSubShapes is a list of sub-shapes to be removed.
    +
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    DifferenceIDs theGroup ,
    theSubShapes 
    +
    + + + + + +
    +   + + +

    +

    +

    + + + + +
    + + + + + + + + + +
    GetObjectIDs theGroup   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theGroup is a GEOM group for which a list of IDs is requested
    +
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    GetType theGroup   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theGroup is a GEOM group which type is returned.
    +
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + +
    GetMainShape theGroup   ) 
    +
    + + + + + +
    +   + + +

    +

    Parameters:
    + + +
    theGroup is a GEOM group for which a main shape object is requested
    +
    +
    Returns:
    a GEOM object which is a main shape for theGroup
    +Example: see GEOM_TestOthers.py
    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GetEdgesByLength theShape ,
    min_length ,
    max_length ,
    include_min  = 1,
    include_max  = 1
    +
    + + + + + +
    +   + + +

    +If include_min/max == 0, edges with length == min/max_length will not be included in result.

    +

    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SelectEdges min_length ,
    max_length ,
    include_min  = 1,
    include_max  = 1
    +
    + + + + + +
    +   + + +

    +If include_min/max == 0, edges with length == min/max_length will not be included in result.

    +

    + + + + +
    + + + + + + + + + +
    addPath Path   ) 
    +
    + + + + + +
    +   + + +

    +

    +


    Generated on Tue Oct 18 00:47:37 2005 for SALOME - GEOM - v.2.1.0 by + +doxygen 1.3.7
    + + diff --git a/doc/salome/gui/GEOM/glue_faces.htm b/doc/salome/gui/GEOM/glue_faces.htm new file mode 100755 index 000000000..d6a6ef4fd --- /dev/null +++ b/doc/salome/gui/GEOM/glue_faces.htm @@ -0,0 +1,158 @@ + + + + + +Glue Faces + + + + + + + + + + + + +

    Glue Faces

    + +

    To + Glue Faces in the Main Menu select Repair - > Glue Faces.

    + +

     

    + +

    This operation + glues faces that are coincident with respect to the given tolerance + value.

    + +

     

    + +

    Result: + GEOM_Object.

    + +

    TUI Command + : geompy.MakeGlueFaces(theShape, + theTolerance), where theShape is a compound of shapesto be glued, + theTolerance is a maximum distance between two faces, which can be considered + as coincident.

    + +

    Arguments: + Name + 1 Compound + + Tolerance value

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

      

    + +

     

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/groups.htm b/doc/salome/gui/GEOM/groups.htm new file mode 100755 index 000000000..9fadb7869 --- /dev/null +++ b/doc/salome/gui/GEOM/groups.htm @@ -0,0 +1,326 @@ + + + + + +Groups + + + + + + + + + + + +

    Groups

    + +

    Creation of a group

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create two vertices

    + +

    p0 = geompy.MakeVertex(0. +  , 0.  , + 0.  )

    + +

    p200 = geompy.MakeVertex(200., + 200., 200.)

    + +

     

    + +

    # create a box on two points

    + +

    Box = geompy.MakeBoxTwoPnt(p0, + p200)

    + +

     

    + +

    # create group on box's faces

    + +

    group = geompy.CreateGroup(Box, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # add objects to the group

    + +

    SubFaceList = geompy.SubShapeAllSorted(Box, + geompy.ShapeType["FACE"])

    + +

    for i in [0, 3, 5] + :

    + +

        FaceID + = geompy.GetSubShapeID(Box, SubFaceList[i])

    + +

        geompy.AddObject(group, + FaceID)

    + +

     

    + +

    # add to the group all the given shapes from the list

    + +

    # (no errors, if some shapes are already included)

    + +

    geompy.UnionList(group, + [SubFaceList[0], SubFaceList[2], SubFaceList[5]])

    + +

     

    + +

    # remove object from the group

    + +

    geompy.RemoveObject(group, + FaceID)

    + +

     

    + +

    # remove from the group all the given shapes

    + +

    # (no errors, if some shapes are not included)

    + +

    geompy.DifferenceList(group, + [SubFaceList[2], SubFaceList[3], SubFaceList[4]])

    + +

    id_group1 = geompy.addToStudy(group, + "Group1")

    + +

     

    + +

    # display group's contents

    + +

    gg.createAndDisplayGO(id_group1)

    + +

    salome.sg.updateObjBrowser(1) +

    + +

     

    + +

     

    + +

    Adding an object in a group.

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create two vertices

    + +

    p0 = geompy.MakeVertex(0. +  , 0.  , + 0.  )

    + +

    p200 = geompy.MakeVertex(200., + 200., 200.)

    + +

     

    + +

    # create a box on two points

    + +

    Box = geompy.MakeBoxTwoPnt(p0, + p200)

    + +

     

    + +

    # create group on box's faces

    + +

    group = geompy.CreateGroup(Box, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # add objects to the group

    + +

    SubFaceList = geompy.SubShapeAllSorted(Box, + geompy.ShapeType["FACE"])

    + +

    for i in [0, 3, 5] + :

    + +

        FaceID + = geompy.GetSubShapeID(Box, SubFaceList[i])

    + +

        geompy.AddObject(group, + FaceID)

    + +

    id_group1 = geompy.addToStudy(group, + "Group1")

    + +

     

    + +

    # display group's contents

    + +

    gg.createAndDisplayGO(id_group1)

    + +

    salome.sg.updateObjBrowser(1) +

    + +

     

    + +

    Removing an object from a group

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create two vertices

    + +

    p0 = geompy.MakeVertex(0. +  , 0.  , + 0.  )

    + +

    p200 = geompy.MakeVertex(200., + 200., 200.)

    + +

     

    + +

    # create a box on two points

    + +

    Box = geompy.MakeBoxTwoPnt(p0, + p200)

    + +

     

    + +

    # create group on box's faces

    + +

    group = geompy.CreateGroup(Box, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # add objects to the group

    + +

    SubFaceList = geompy.SubShapeAllSorted(Box, + geompy.ShapeType["FACE"])

    + +

    for i in [0, 3, 5] + :

    + +

        FaceID + = geompy.GetSubShapeID(Box, SubFaceList[i])

    + +

        geompy.AddObject(group, + FaceID)

    + +

     

    + +

    # add to the group all the given shapes from the list

    + +

    # (no errors, if some shapes are already included)

    + +

    geompy.UnionList(group, + [SubFaceList[0], SubFaceList[2], SubFaceList[5]])

    + +

     

    + +

    # remove object from the group

    + +

    geompy.RemoveObject(group, + FaceID)

    + +

    id_group1 = geompy.addToStudy(group, + "Group1")

    + +

     

    + +

    # display group's contents

    + +

    gg.createAndDisplayGO(id_group1)

    + +

    salome.sg.updateObjBrowser(1) +

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/image10.gif b/doc/salome/gui/GEOM/image10.gif new file mode 100755 index 000000000..01327b7a8 Binary files /dev/null and b/doc/salome/gui/GEOM/image10.gif differ diff --git a/doc/salome/gui/GEOM/image27.gif b/doc/salome/gui/GEOM/image27.gif new file mode 100755 index 000000000..52d87e25b Binary files /dev/null and b/doc/salome/gui/GEOM/image27.gif differ diff --git a/doc/salome/gui/GEOM/image3.gif b/doc/salome/gui/GEOM/image3.gif new file mode 100755 index 000000000..a3cdf64a3 Binary files /dev/null and b/doc/salome/gui/GEOM/image3.gif differ diff --git a/doc/salome/gui/GEOM/line.htm b/doc/salome/gui/GEOM/line.htm new file mode 100755 index 000000000..8cd5e7464 --- /dev/null +++ b/doc/salome/gui/GEOM/line.htm @@ -0,0 +1,154 @@ + + + + + +Line + + + + + + + + + + + +

    Line

    + +

    To create a Line in the Main Menu select New + Entity - > Basic - > Line

    + +

     

    + +

    To create a Line + you should define Point1 and Point2, which are the points through +  which the + Line passes.

    + +

    The + Result of the operation will be a + GEOM_Object (edge).

    + +

     

    + +

    TUI Command: + geompy.MakeLine(Point1, Point2) +

    + +

    Arguments: + Name + 2 vertices.

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    NB! The + is another way to create a line, which is currently accessible only via + TUI commands.

    + +

     

    + +

    You + can define a line  passing + through the given Point and + parallel to the given Vector.

    + +

    TUI + Command: geompy.MakeLine(Point, + Vector)

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of creation of Basic + Geometric Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/local_coordinate_system.htm b/doc/salome/gui/GEOM/local_coordinate_system.htm new file mode 100755 index 000000000..e4eaa59c8 --- /dev/null +++ b/doc/salome/gui/GEOM/local_coordinate_system.htm @@ -0,0 +1,207 @@ + + + + + +Local Coordinate System + + + + + + + + + + + + +

    Local Coordinate + System

    + +

    To create a Local Coordinate System + in the Main Menu select New Entity - > Basic - > Local Coordinate + System

    + +

     

    + +

    You can enter the values of X, Y, and Z coordinates + of origin in the corresponding fields of the dialog box, or select a point + in the object browser or 3D viewer, in this case the coordinates of origin + are automatically filled in with the coordinates of the selected point. +

    + +

    The user then specifies components of X and + Y axes direction.

    + +

    Preview of the new LCS (small trihedron located + and oriented according to parameters of LCS) is displayed in the 3D viewer + and updated as soon as the user modifies some parameter.

    + +

    Then the user presses «OK» or «Apply» button + to create an LCS at the location with the specified coordinates. The new + object is shown in the Object Browser and in 3D viewer.

    + +

     

    + +

    TUI command: + geompy.MakeMarker(OX, OY, OZ, XDX, XDY, + XDZ, YDX, YDY, YDZ), where OX, OY, OZ are coordinates of the origin + of LCS, XDX, XDY, XDZ is a vector of OX  direction + of the LCS and YDX, YDY, YDZ is a a vector of OY direction of the LCS.

    + +

     

    + +

     

    + +

    Arguments: +

    + + + +

     

    + +

    .

    + +

     

    + +

    Dialog Box:

    + +

     

    + + ++++ + + + + +
    +

    +

    +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/measurement_tools.htm b/doc/salome/gui/GEOM/measurement_tools.htm new file mode 100755 index 000000000..d06d968fd --- /dev/null +++ b/doc/salome/gui/GEOM/measurement_tools.htm @@ -0,0 +1,459 @@ + + + + + +Measurement Tools + + + + + + + + + + + +

    Measurement Tools

    + +

    Point Coordinates

    + +

    import geompy

    + +

     

    + +

    # create a point

    + +

    point = geompy.MakeVertex(15, + 23, 80)

    + +

     

    + +

    # get point's coordinates and check its values

    + +

    coords = geompy.PointCoordinates(point)

    + +

    if coords[0] != 15 + or coords[1] != 23 or coords[2] != 80 :

    + +

        print + "Coordinates of point must be (15, 23, 80), but returned (", + coords[0], ", ", coords[1], ", ", coords[2], ")"

    + +

    else :

    + +

        print + "All values are OK."

    + +

    Basic Properties

    + +

    import geompy

    + +

    import math

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    props = geompy.BasicProperties(box)

    + +

    print "\nBox + 100x30x100 Basic Properties:"

    + +

    print " Wires + length: ", props[0]

    + +

    print " Surface + area: ", props[1]

    + +

    print " Volume +      : + ", props[2]

    + +

    length = math.sqrt((props[0] + - 1840)*(props[0] - 1840))

    + +

    area = math.sqrt((props[1] + - 32000)*(props[1] - 32000))

    + +

    volume = math.sqrt((props[2] + - 300000)*(props[2] - 300000))

    + +

    if length > 1e-7 + or area > 1e-7 or volume > 1e-7:

    + +

        print + "While must be:"

    + +

        print + " Wires length: ", 1840

    + +

        print + " Surface area: ", 32000

    + +

        print + " Volume      : + ", 300000.

    + +

    Center of masses

    + +

    import geompy

    + +

    import math

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    cm = geompy.MakeCDG(box)

    + +

    if cm is None:

    + +

        raise + RuntimeError, "MakeCDG(box) failed"

    + +

    else:

    + +

        print + "\nCentre of gravity of box has been successfully obtained:"

    + +

        coords + = geompy.PointCoordinates(cm)

    + +

        print + "(", coords[0], ", ", coords[1], ", ", coords[2], + ")"

    + +

        dx + = math.sqrt((coords[0] - 50)*(coords[0] - 50))

    + +

        dy + = math.sqrt((coords[1] - 15)*(coords[1] - 15))

    + +

        dz + = math.sqrt((coords[2] - 50)*(coords[2] - 50))

    + +

        if + dx > 1e-7 or dy > 1e-7 or dz > 1e-7:

    + +

            print + "But must be (50, 15, 50)"

    + +

    Inertia

    + +

    import geompy

    + +

    import math

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    In = geompy.Inertia(box)

    + +

    print "\nInertia + matrix of box 100x30x100:"

    + +

    print " (", + In[0], ", ", In[1], ", ", In[2], ")"

    + +

    print " (", + In[3], ", ", In[4], ", ", In[5], ")"

    + +

    print " (", + In[6], ", ", In[7], ", ", In[8], ")"

    + +

    print "Main moments + of inertia of box 100x30x100:"

    + +

    print " Ix = + ", In[9], ", Iy = ", In[10], ", Iz = ", In[11] +

    + +

     

    + +

    Bounding Box

    + +

    import geompy

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    bb = geompy.BoundingBox(box)

    + +

    print "\nBounding + Box of box 100x30x100:"

    + +

    print " Xmin + = ", bb[0], ", Xmax = ", bb[1]

    + +

    print " Ymin + = ", bb[2], ", Ymax = ", bb[3]

    + +

    print " Zmin + = ", bb[4], ", Zmax = ", bb[5]

    + +

     

    + +

     

    + +

    Minimal Distance

    + +

    import + geompy

    + +

     

    + +

    # create boxes

    + +

    box1 = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    box2 = geompy.MakeBox(105,0,0,200,30,100)

    + +

    min_dist = geompy.MinDistance(box1,box2)

    + +

    print "\nMinimal + distance between box1 and box2 = ", min_dist

    + +

     

    + +

    Point Coordinates

    + +

     

    + +

     

    + +

    import + geompy

    + +

    # create a point

    + +

    point = geompy.MakeVertex(15, + 23, 80)

    + +

    # get point's coordinates + and check its values

    + +

    coords = geompy.PointCoordinates(point)

    + +

    if coords[0] != 15 + or coords[1] != 23 or coords[2] != 80 :

    + +

        print + "Coordinates of point must be (15, 23, 80), but returned (", + coords[0], ", ", coords[1], ", ", coords[2], ")"

    + +

    else :

    + +

        print + "All values are OK."

    + +

     

    + +

    Tolerance

    + +

    import + geompy

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    Toler = geompy.Tolerance(box)

    + +

    print "\nBox + 100x30x100 tolerance:"

    + +

    print " Face + min. tolerance: ", Toler[0]

    + +

    print " Face + max. tolerance: ", Toler[1]

    + +

    print " Edge + min. tolerance: ", Toler[2]

    + +

    print " Edge + max. tolerance: ", Toler[3]

    + +

    print " Vertex + min. tolerance: ", Toler[4]

    + +

    print " Vertex + max. tolerance: ", Toler[5]

    + +

     

    + +

    What Is

    + +

    import + geompy

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    Descr = geompy.WhatIs(box)

    + +

    print "\nBox + 100x30x100 description:"

    + +

    print Descr

    + +

     

    + +

    Check Shape

    + +

    import geompy

    + +

     

    + +

    # create a box

    + +

    box = geompy.MakeBoxDXDYDZ(100,30,100)

    + +

    IsValid = geompy.CheckShape(box)

    + +

    if IsValid == 0:

    + +

        raise + RuntimeError, "Invalid box created"

    + +

    else:

    + +

        print + "\nBox is valid"

    + +

     

    + +

     

    + +

    Check Compound of Blocks

    + +

    import + geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create boxes

    + +

    box1 = geompy.MakeBox(0,0,0,100,50,100)

    + +

    box2 = geompy.MakeBox(100,0,0,250,50,100)

    + +

     

    + +

    # make compound

    + +

    compound = geompy.MakeCompound([box1, + box2])

    + +

     

    + +

    # glue compound's faces

    + +

    tolerance = 1e-5

    + +

    glue = geompy.MakeGlueFaces(compound, + tolerance)

    + +

    IsValid = geompy.CheckCompoundOfBlocks(glue)

    + +

    if IsValid == 0:

    + +

        raise + RuntimeError, "Invalid compound created"

    + +

    else:

    + +

        print + "\nCompound is valid"

    + +

     

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/mirror_image.htm b/doc/salome/gui/GEOM/mirror_image.htm new file mode 100755 index 000000000..a71a3c140 --- /dev/null +++ b/doc/salome/gui/GEOM/mirror_image.htm @@ -0,0 +1,178 @@ + + + + + +Mirror Image + + + + + + + + + + + + +

    Mirror Image

    + +

    To produce + a Mirror Image in the Main Menu + select Operations - > Transformation + - > Mirror Image

    + +

     

    + +

    This operation creates a symmetrical copy of + an Object, which can be mirrored + in three different ways. Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

    The + Result will be a GEOM_Object.

    + +

     

    + +

    Firstly an Object + can be mirrored through a Plane + of symmetry

    + +

    TUI Command: + geompy.MakeMirrorByPlane(Shape, + Plane),

    + +

    Arguments: + Name + 1 shape + 1 plane

    + +

     

    + +

       

    + +

     

    + +

    Secondly an + Object can be mirrored through an Axis of symmetry

    + +

    TUI Command: + geompy.MakeMirrorByAxis(Object, + Axis)

    + +

    Arguments: Name + 1 shape + 1 vector.

    + +

     

    + +

       

    + +

     

    + +

    Finally an Object + can be mirrored through a Point + of symmetry

    + +

    TUI Command: + geompy.MakeMirrorByPoint(Object, + Point)

    + +

    Arguments: Name + 1 shape + 1 vertex.

    + +

     

    + +

       

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/modify_the_location.htm b/doc/salome/gui/GEOM/modify_the_location.htm new file mode 100755 index 000000000..56c7db721 --- /dev/null +++ b/doc/salome/gui/GEOM/modify_the_location.htm @@ -0,0 +1,152 @@ + + + + + +Modify the Location + + + + + + + + + + + + +

    Modify the Location

    + +

    To Modify the Location in the Main Menu + select Operations - > Transformation + - > Modify the Location

    + +

     

    + +

    This operation modifies the Location + of an Object.

    + +

    The Result will + be a  GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakePosition(theObject, theStartLCS, theEndLCS), where theObject + is a shape, location of which is modified, theStartLCS is a location to + move the shape from, theEndLCS is a location to move the shape to.

    + +

    Arguments: + Name + 1 GEOM_Object + [Starting Coordinate System] + End Coordinate System.

    + +

    Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

     

    + +

      

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/multi_rotation.htm b/doc/salome/gui/GEOM/multi_rotation.htm new file mode 100755 index 000000000..5d85b8283 --- /dev/null +++ b/doc/salome/gui/GEOM/multi_rotation.htm @@ -0,0 +1,182 @@ + + + + + +Multi Rotation + + + + + + + + + + + +

     Multi + Rotation

    + +

    To produce + a Multi Rotation in the Main Menu + select Operations - > Transformation + - > Multi Rotation

    + +

     

    + +

    This operation creates several geometrical + objects rotated in one or two dimentions basing on the initial + geometrical object.

    + +

    The Result will + be one or several GEOM_Objects (compound).

    + +

     

    + +

    To produce a Simple + Multi Rotation (in one dimension) you need to define a Shape + to be rotated, an Axis of rotation + and a Number of Times the shape + must be rotated. Rotation Angle + will be 2*PI/NbTimes

    + +

    TUI + Command: geompy.MakeMultiRotation1D(Shape, + Axis, NbTimes)

    + +

    Arguments: + Name + 1 shape + 1 vector for direction + + 1 value (repetition).

    + +

     

    + +

    There is a TUI + Command geompy.MakeMultiRotation1D(Shape, + Dir, Point, NbTimes) + which works in the same way, but the Axis is defined  by + direction and point.

    + +

     

    + +

     

    + +

     

    + +

    Double Multi + Rotation (in two dimensions) rotates the given Object + around the given Axis on the given + Angle a given Number + of Times and multi-translates each rotation result.  Translation + direction passes through the center of gravity of the rotated shape and + its projection on the rotation axis. Reverse + checkbox allows to set the direction of rotation.

    + +

    TUI + Command: geompy.MakeMultiRotation2D(Shape, + Axis, Angle, NbTimes1, Step, NbTimes2)

    + +

    Arguments: Name + 1 shape + 1 vector + for direction + 1 angle + 1 value (repetition) + 1 step value + 1 value + (repetition);

    + +

     

    + +

    There is a TUI + Command geompy.MakeMultiRotation2D(Shape, + Dir, Point, Angle, nbtimes1, Step, nbtimes2) + which works in the same way, but the Axis is defined  by + direction and point.

    + +

     

    + +

    + +

      

    + +

         

    + +

        

    + +

    Our TUI + Scripts provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/multi_transformation.htm b/doc/salome/gui/GEOM/multi_transformation.htm new file mode 100755 index 000000000..8cc27fc34 --- /dev/null +++ b/doc/salome/gui/GEOM/multi_transformation.htm @@ -0,0 +1,192 @@ + + + + + +Multi Transformation + + + + + + + + + + + + +

    Block Multi Transformation

    + +

    To produce + a Multi Translation operation + in the Main Menu select Operations - + > Blocks - > Multi Translation

    + +

     

    + +

    This operation makes several translations of + a block (solid) in one or two directions depending on the arguments + specified by the user.

    + +

    The + Result in both cases will be a + GEOM_Object.

    + +

     

    + +

    Simple Multi + Transformation (in one direction).

    + +

    TUI + Command: geompy. + MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes), where + Block is a block to be transformed, DirFaceID1 is an ID of the face which defines the first + direction of transformation, + DirFaceID2 is an ID of the face + which defines the second direction of transformation, + NbTimes is a number of transformations.

    + +

    Arguments: Name + + 1 hexahedral solid + 1 or 2 faces + 1 integer (number of blocks).

    + +

     

    + +

      

    + +

     

    + +

    Double + Multi Transformation (in two directions).

    + +

    TUI + Command: geompy. + MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, DirFaceID1V, + DirFaceID2V, NbTimesV), where Block + is a block to be transformed, DirFaceID1U and DirFace1V are IDÂ’s of the + faces, which define directions of the first transformation, DirFaceID1V + and DirFaceID2V are IDÂ’s of the faces which define directions of the second + transformation, NbTimesU and NbTimesV are numbers of transformations.

    + +

    Arguments:  Name + + 1 hexahedral solid +

    + +
      + +
        + +
      • 2 + faces and 1 integer, or

      • + +
      • 3 + or 4 faces and 2 integers

      • +
      +
    + +

     

    + +

     

    + +

     

    + +

       Our TUI Scripts + provide you with useful examples of the use of + Blocks Operations.

    + +

      

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/multi_translation.htm b/doc/salome/gui/GEOM/multi_translation.htm new file mode 100755 index 000000000..16f14a137 --- /dev/null +++ b/doc/salome/gui/GEOM/multi_translation.htm @@ -0,0 +1,168 @@ + + + + + +Multi Translation + + + + + + + + + + + + +

    Multi Translation

    + +

    To produce + a Multi Translation in the Main + Menu select Operations - > Transformation + - > Multi Translation

    + +

     

    + +

    This operation + makes several translations of a shape in one + or two directions.

    + +

    The + Result will be one or several + GEOM_Objects (compound).

    + +

     

    + +

    To produce a Simple + Multi Translation (in one direction) you need to indicate a Shape to be translated, a Vector + of translation, a Step of translation + and a Number of Times the shape + must be moved.

    + +

    TUI Command: + geompy.MakeMultiTranslation1D(Shape, + Dir, Step, NbTimes)

    + +

    Arguments: + Name + 1 shape + 1 vector (for direction) + 1 step value + + 1 value (repetition).

    + +

         

    + +

     

    + +

    To produce a Double + Multi Translation (in two directions) you need to indicate a Shape to be translated and a Vector + of translation, a Step of translation + and a Number of Times the shape + must be moved along each axis.

    + +

    TUI Command: + geompy.MakeMultiTranslation2D(Shape, Dir1, + Step1, NbTimes1, Dir2, Step2, NbTimes2), where Shape is a shape + to be translated, Dir1 is the first direction of translation, Step1 of + the first translation, NbTimes1 is a number of translations to be done + along, Dir2 is the second direction of translation, Step2 of the second + translation, NbTimes2 is a number of translations to be done along Dir2.

    + +

    Arguments: + Name + 1 shape + 2 vectors defining the direction + 2 step + values + 2 values (repetitions).

    + +

     

    + +

      

    + +

    Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/newentity_blocks.htm b/doc/salome/gui/GEOM/newentity_blocks.htm new file mode 100755 index 000000000..d4c7991ab --- /dev/null +++ b/doc/salome/gui/GEOM/newentity_blocks.htm @@ -0,0 +1,322 @@ + + + + + +Blocks + + + + + + + + + + + + +

    Building by blocks

    + +

    Introduction.

    + +

     

    + +

    Below are some general notions about blocks:

    + +

     

    + +

    A block is a an elementary geometric solid that + has specific geometric constraints oriented for meshing. In the hexahedral + case, blocks have 6 faces and each face has 4 edges.  

    + +

     

    + +

    Tetrahedral Block - is a block with constraints for tetrahedral meshing. +

    + +

     

    + +

    Hexahedral Block - is a block with constraints for hexahedral meshing.

    + +

     

    + +

    Block Compound - is a compound composed of blocks only.

    + +

     

    + +

    These functionalities are available from the main menu via New + Entity / Blocks.

    + +

     

    + + + +

     

    + +

     

    + +

    Quadrangle + face

    + +

     

    + +

    Description: + Builds a face using the below mentioned arguments. This operation allows + to build a face bypassing the intermediate stage of building edges and + wires (in the case of building by 4 points) or wires (in the case of building + by 4 or 2 edges).

    + +

     

    + +

    Result : + GEOM_Object (face).

    + +

     

    + +

    TUI Command:

    + + + +

     

    + +

    Arguments: +

    + + + +

     

    + +

    Dialog Box:

    + + ++++ + + + + +
    +

    +

    +

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

    Hexahedral + solid

    + +

     

    + +

    Description: + Builds a hexahedral solid. either of the below mentioned arguments. This + operation allows to build a solid bypassing the intermediate stage of + building a shell and 4 faces (in the case of building by 2 faces) or just + a shell (in the case of building by 6 faces).

    + +

     

    + +

    Result : + GEOM_Object.

    + +

     

    + +

    TUI Command:

    + + + +

     

    + +

    Arguments: +

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + + +++ + + + +
    +

     

    +

    + +

     

    + +

    Example:

    + +

     

    + +

         

    + +

         

    + +

    Our TUI Scripts + provide you with useful examples of Building + by Blocks.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/offset_surface.htm b/doc/salome/gui/GEOM/offset_surface.htm new file mode 100755 index 000000000..204a067b7 --- /dev/null +++ b/doc/salome/gui/GEOM/offset_surface.htm @@ -0,0 +1,146 @@ + + + + + +Offset Surface + + + + + + + + + + + + +

    Offset Surface

    + +

    To produce + an Offset Surface in the Main + Menu select Operations - > Transformation + - > Offset Surface

    + +

     

    + +

    This operation + translates each point of an Object + (a set of Objects) along a local normal by a given Offset + distance (signed number, negative value meaning inner offset). Offset + operation is applicable to faces, shells and solids.

    + +

    The + Result will be a GEOM_Object +

    + +

    TUI + Command: geompy.MakeOffset(Shape, + Offset), where Shape is a shape which has to be an offset, Offset + is a value of the offset.

    + +

    Arguments: Name + Object (face, shell, solid, compound) + + Offset value

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/partition.htm b/doc/salome/gui/GEOM/partition.htm new file mode 100755 index 000000000..60c97c87c --- /dev/null +++ b/doc/salome/gui/GEOM/partition.htm @@ -0,0 +1,172 @@ + + + + + +Partition + + + + + + + + + + + +

     Partition

    + +

    To produce + a Partition in the Main Menu select + Operations - > Partition

    + +

     

    + +

    This + operation builds a shape by intersection of two shapes or a shape + and a plane.

    + +

    The + Result will be any GEOM_Object.

    + +

     

    + +

    Intersection + of two shapes.

    + +

     

    + +

    TUI Command: + geompy.MakePartition(ListOfShapes, + ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, + ListOfMaterials), where ListOfShapes is a list of shapes to be + intersected, ListOfTools is a list of shapes to intersect the shapes from + ListOfShapes, ListOfKeepInside is a list of shapes outside which the results + will be deleted, ListOfRemoveInside is a list of shapes inside which the + results will be deleted, Limit is a type of the result shapes, if RemoveWebs + is True the Glue 3D algorithm will be performed on the results, ListOfMaterials + is a list of materials indices for each shape, it makes sense only if + RemoveWebs is True.

    + +

    Arguments: + Name + 2 shapes (first shape will + be intersected by the second shape) + reconstruction limit.

    + +

     

    + +

    + +

     

    + +

    + +

     

    + +

     

    + +

    Intersection of a Shape + and a Plane.

    + +

    TUI Command +  geompy.MakeHalfPartition(Shape, + Plane), where Shape is + a Shape to be intersected and Plane + is a Tool shape, to intersect the Shape.

    + +

    Arguments: Name + + 1 shape which will be intersected + 1 cutting face.

    + +

     

    + +

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of the use of Basic Operations. +

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/pics/arc.png b/doc/salome/gui/GEOM/pics/arc.png new file mode 100755 index 000000000..260a5fb7d Binary files /dev/null and b/doc/salome/gui/GEOM/pics/arc.png differ diff --git a/doc/salome/gui/GEOM/pics/archimede.png b/doc/salome/gui/GEOM/pics/archimede.png new file mode 100755 index 000000000..cd620020e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/archimede.png differ diff --git a/doc/salome/gui/GEOM/pics/archimedesn1.png b/doc/salome/gui/GEOM/pics/archimedesn1.png new file mode 100755 index 000000000..402092052 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/archimedesn1.png differ diff --git a/doc/salome/gui/GEOM/pics/archimedesn2.png b/doc/salome/gui/GEOM/pics/archimedesn2.png new file mode 100755 index 000000000..b3b84b155 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/archimedesn2.png differ diff --git a/doc/salome/gui/GEOM/pics/archimedesn3.png b/doc/salome/gui/GEOM/pics/archimedesn3.png new file mode 100755 index 000000000..da57c0fb9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/archimedesn3.png differ diff --git a/doc/salome/gui/GEOM/pics/arcsn.png b/doc/salome/gui/GEOM/pics/arcsn.png new file mode 100755 index 000000000..4131e41f5 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/arcsn.png differ diff --git a/doc/salome/gui/GEOM/pics/bezier.png b/doc/salome/gui/GEOM/pics/bezier.png new file mode 100755 index 000000000..3c0e8df2b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/bezier.png differ diff --git a/doc/salome/gui/GEOM/pics/block1.png b/doc/salome/gui/GEOM/pics/block1.png new file mode 100755 index 000000000..71a93b0c9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block1.png differ diff --git a/doc/salome/gui/GEOM/pics/block2.png b/doc/salome/gui/GEOM/pics/block2.png new file mode 100755 index 000000000..c66dd7f02 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block2.png differ diff --git a/doc/salome/gui/GEOM/pics/block3.png b/doc/salome/gui/GEOM/pics/block3.png new file mode 100755 index 000000000..61aad9b43 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block3.png differ diff --git a/doc/salome/gui/GEOM/pics/block4.png b/doc/salome/gui/GEOM/pics/block4.png new file mode 100755 index 000000000..d0661b6e9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block4.png differ diff --git a/doc/salome/gui/GEOM/pics/block5.png b/doc/salome/gui/GEOM/pics/block5.png new file mode 100755 index 000000000..9810f6f0d Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block5.png differ diff --git a/doc/salome/gui/GEOM/pics/block_explodesn.png b/doc/salome/gui/GEOM/pics/block_explodesn.png new file mode 100755 index 000000000..372de3f20 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/block_explodesn.png differ diff --git a/doc/salome/gui/GEOM/pics/bool1.png b/doc/salome/gui/GEOM/pics/bool1.png new file mode 100755 index 000000000..3f997a772 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/bool1.png differ diff --git a/doc/salome/gui/GEOM/pics/bool2.png b/doc/salome/gui/GEOM/pics/bool2.png new file mode 100755 index 000000000..4e9b96862 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/bool2.png differ diff --git a/doc/salome/gui/GEOM/pics/bool3.png b/doc/salome/gui/GEOM/pics/bool3.png new file mode 100755 index 000000000..af409a15e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/bool3.png differ diff --git a/doc/salome/gui/GEOM/pics/box1.png b/doc/salome/gui/GEOM/pics/box1.png new file mode 100755 index 000000000..812027dcf Binary files /dev/null and b/doc/salome/gui/GEOM/pics/box1.png differ diff --git a/doc/salome/gui/GEOM/pics/box2.png b/doc/salome/gui/GEOM/pics/box2.png new file mode 100755 index 000000000..85a737afb Binary files /dev/null and b/doc/salome/gui/GEOM/pics/box2.png differ diff --git a/doc/salome/gui/GEOM/pics/boxes.png b/doc/salome/gui/GEOM/pics/boxes.png new file mode 100755 index 000000000..f2fad497e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/boxes.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer1.png b/doc/salome/gui/GEOM/pics/chamfer1.png new file mode 100755 index 000000000..94fedcd12 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer1.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer2.png b/doc/salome/gui/GEOM/pics/chamfer2.png new file mode 100755 index 000000000..b2c09870e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer2.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer3.png b/doc/salome/gui/GEOM/pics/chamfer3.png new file mode 100755 index 000000000..84b52e5c6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer3.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer_all.png b/doc/salome/gui/GEOM/pics/chamfer_all.png new file mode 100755 index 000000000..c398cb0c5 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer_all.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer_edge.png b/doc/salome/gui/GEOM/pics/chamfer_edge.png new file mode 100755 index 000000000..8ed8fc005 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer_edge.png differ diff --git a/doc/salome/gui/GEOM/pics/chamfer_faces.png b/doc/salome/gui/GEOM/pics/chamfer_faces.png new file mode 100755 index 000000000..961cf0386 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/chamfer_faces.png differ diff --git a/doc/salome/gui/GEOM/pics/circle1.png b/doc/salome/gui/GEOM/pics/circle1.png new file mode 100755 index 000000000..840a25973 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/circle1.png differ diff --git a/doc/salome/gui/GEOM/pics/circle2.png b/doc/salome/gui/GEOM/pics/circle2.png new file mode 100755 index 000000000..7500eaf2c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/circle2.png differ diff --git a/doc/salome/gui/GEOM/pics/circles.png b/doc/salome/gui/GEOM/pics/circles.png new file mode 100755 index 000000000..dc367ce8b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/circles.png differ diff --git a/doc/salome/gui/GEOM/pics/colorsn.png b/doc/salome/gui/GEOM/pics/colorsn.png new file mode 100755 index 000000000..f0c440147 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/colorsn.png differ diff --git a/doc/salome/gui/GEOM/pics/commonsn.png b/doc/salome/gui/GEOM/pics/commonsn.png new file mode 100755 index 000000000..e5c0c4131 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/commonsn.png differ diff --git a/doc/salome/gui/GEOM/pics/compoundsn.png b/doc/salome/gui/GEOM/pics/compoundsn.png new file mode 100755 index 000000000..33e1012ed Binary files /dev/null and b/doc/salome/gui/GEOM/pics/compoundsn.png differ diff --git a/doc/salome/gui/GEOM/pics/cone1.png b/doc/salome/gui/GEOM/pics/cone1.png new file mode 100755 index 000000000..f5a95922a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cone1.png differ diff --git a/doc/salome/gui/GEOM/pics/cone2.png b/doc/salome/gui/GEOM/pics/cone2.png new file mode 100755 index 000000000..1b0582140 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cone2.png differ diff --git a/doc/salome/gui/GEOM/pics/cones.png b/doc/salome/gui/GEOM/pics/cones.png new file mode 100755 index 000000000..4c8108ce1 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cones.png differ diff --git a/doc/salome/gui/GEOM/pics/creategroup.png b/doc/salome/gui/GEOM/pics/creategroup.png new file mode 100755 index 000000000..85c6bc550 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/creategroup.png differ diff --git a/doc/salome/gui/GEOM/pics/curve.png b/doc/salome/gui/GEOM/pics/curve.png new file mode 100755 index 000000000..a9541de0a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/curve.png differ diff --git a/doc/salome/gui/GEOM/pics/cutsn.png b/doc/salome/gui/GEOM/pics/cutsn.png new file mode 100755 index 000000000..eda9bb712 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cutsn.png differ diff --git a/doc/salome/gui/GEOM/pics/cylinder1.png b/doc/salome/gui/GEOM/pics/cylinder1.png new file mode 100755 index 000000000..71b619df8 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cylinder1.png differ diff --git a/doc/salome/gui/GEOM/pics/cylinder2.png b/doc/salome/gui/GEOM/pics/cylinder2.png new file mode 100755 index 000000000..ee6ed12e6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cylinder2.png differ diff --git a/doc/salome/gui/GEOM/pics/cylinders.png b/doc/salome/gui/GEOM/pics/cylinders.png new file mode 100755 index 000000000..fc0d43276 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/cylinders.png differ diff --git a/doc/salome/gui/GEOM/pics/disp_mode1sn.png b/doc/salome/gui/GEOM/pics/disp_mode1sn.png new file mode 100755 index 000000000..b5b7e8ff2 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/disp_mode1sn.png differ diff --git a/doc/salome/gui/GEOM/pics/disp_mode2sn.png b/doc/salome/gui/GEOM/pics/disp_mode2sn.png new file mode 100755 index 000000000..362232739 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/disp_mode2sn.png differ diff --git a/doc/salome/gui/GEOM/pics/distance.png b/doc/salome/gui/GEOM/pics/distance.png new file mode 100755 index 000000000..7466fc424 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/distance.png differ diff --git a/doc/salome/gui/GEOM/pics/edgesn.png b/doc/salome/gui/GEOM/pics/edgesn.png new file mode 100755 index 000000000..9de8df9ef Binary files /dev/null and b/doc/salome/gui/GEOM/pics/edgesn.png differ diff --git a/doc/salome/gui/GEOM/pics/editgroup.png b/doc/salome/gui/GEOM/pics/editgroup.png new file mode 100755 index 000000000..db3e23575 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/editgroup.png differ diff --git a/doc/salome/gui/GEOM/pics/ellipse.png b/doc/salome/gui/GEOM/pics/ellipse.png new file mode 100755 index 000000000..0888b5021 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/ellipse.png differ diff --git a/doc/salome/gui/GEOM/pics/ellipsesn.png b/doc/salome/gui/GEOM/pics/ellipsesn.png new file mode 100755 index 000000000..1c421541d Binary files /dev/null and b/doc/salome/gui/GEOM/pics/ellipsesn.png differ diff --git a/doc/salome/gui/GEOM/pics/export.png b/doc/salome/gui/GEOM/pics/export.png new file mode 100755 index 000000000..7e441f93a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/export.png differ diff --git a/doc/salome/gui/GEOM/pics/extrusion.png b/doc/salome/gui/GEOM/pics/extrusion.png new file mode 100755 index 000000000..2d7017e93 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/extrusion.png differ diff --git a/doc/salome/gui/GEOM/pics/facesn1.png b/doc/salome/gui/GEOM/pics/facesn1.png new file mode 100755 index 000000000..c78703a11 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/facesn1.png differ diff --git a/doc/salome/gui/GEOM/pics/facesn2.png b/doc/salome/gui/GEOM/pics/facesn2.png new file mode 100755 index 000000000..59403a08c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/facesn2.png differ diff --git a/doc/salome/gui/GEOM/pics/facesn3.png b/doc/salome/gui/GEOM/pics/facesn3.png new file mode 100755 index 000000000..7c95d1156 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/facesn3.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet1.png b/doc/salome/gui/GEOM/pics/fillet1.png new file mode 100755 index 000000000..7fd3db53f Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet1.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet2.png b/doc/salome/gui/GEOM/pics/fillet2.png new file mode 100755 index 000000000..d42e333ea Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet2.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet3.png b/doc/salome/gui/GEOM/pics/fillet3.png new file mode 100755 index 000000000..73e453339 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet3.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet_all.png b/doc/salome/gui/GEOM/pics/fillet_all.png new file mode 100755 index 000000000..c1650b907 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet_all.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet_edge.png b/doc/salome/gui/GEOM/pics/fillet_edge.png new file mode 100755 index 000000000..9572abb79 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet_edge.png differ diff --git a/doc/salome/gui/GEOM/pics/fillet_prism.png b/doc/salome/gui/GEOM/pics/fillet_prism.png new file mode 100755 index 000000000..3a44a07e6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillet_prism.png differ diff --git a/doc/salome/gui/GEOM/pics/filling.png b/doc/salome/gui/GEOM/pics/filling.png new file mode 100755 index 000000000..5ed4f45a5 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/filling.png differ diff --git a/doc/salome/gui/GEOM/pics/filling_compoundsn.png b/doc/salome/gui/GEOM/pics/filling_compoundsn.png new file mode 100755 index 000000000..9d3846b2b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/filling_compoundsn.png differ diff --git a/doc/salome/gui/GEOM/pics/fillingsn.png b/doc/salome/gui/GEOM/pics/fillingsn.png new file mode 100755 index 000000000..2446e89d5 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fillingsn.png differ diff --git a/doc/salome/gui/GEOM/pics/free_boudaries1.png b/doc/salome/gui/GEOM/pics/free_boudaries1.png new file mode 100755 index 000000000..20c29f965 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/free_boudaries1.png differ diff --git a/doc/salome/gui/GEOM/pics/free_boudaries2.png b/doc/salome/gui/GEOM/pics/free_boudaries2.png new file mode 100755 index 000000000..1523fe911 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/free_boudaries2.png differ diff --git a/doc/salome/gui/GEOM/pics/free_faces1.png b/doc/salome/gui/GEOM/pics/free_faces1.png new file mode 100755 index 000000000..530d8440b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/free_faces1.png differ diff --git a/doc/salome/gui/GEOM/pics/free_faces2.png b/doc/salome/gui/GEOM/pics/free_faces2.png new file mode 100755 index 000000000..7526bd17c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/free_faces2.png differ diff --git a/doc/salome/gui/GEOM/pics/fusesn1.png b/doc/salome/gui/GEOM/pics/fusesn1.png new file mode 100755 index 000000000..e0118cbd2 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fusesn1.png differ diff --git a/doc/salome/gui/GEOM/pics/fusesn2.png b/doc/salome/gui/GEOM/pics/fusesn2.png new file mode 100755 index 000000000..f8a2b0108 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/fusesn2.png differ diff --git a/doc/salome/gui/GEOM/pics/glue_faces1.png b/doc/salome/gui/GEOM/pics/glue_faces1.png new file mode 100755 index 000000000..787c9b0d6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/glue_faces1.png differ diff --git a/doc/salome/gui/GEOM/pics/glue_faces2.png b/doc/salome/gui/GEOM/pics/glue_faces2.png new file mode 100755 index 000000000..d33661367 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/glue_faces2.png differ diff --git a/doc/salome/gui/GEOM/pics/import.png b/doc/salome/gui/GEOM/pics/import.png new file mode 100755 index 000000000..8039e55a3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/import.png differ diff --git a/doc/salome/gui/GEOM/pics/interpol.png b/doc/salome/gui/GEOM/pics/interpol.png new file mode 100755 index 000000000..ac77ddfa3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/interpol.png differ diff --git a/doc/salome/gui/GEOM/pics/isos_u12_v12sn.png b/doc/salome/gui/GEOM/pics/isos_u12_v12sn.png new file mode 100755 index 000000000..10a13ce4b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/isos_u12_v12sn.png differ diff --git a/doc/salome/gui/GEOM/pics/line.png b/doc/salome/gui/GEOM/pics/line.png new file mode 100755 index 000000000..3c931a1e9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/line.png differ diff --git a/doc/salome/gui/GEOM/pics/lines.png b/doc/salome/gui/GEOM/pics/lines.png new file mode 100755 index 000000000..de12c1122 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/lines.png differ diff --git a/doc/salome/gui/GEOM/pics/measures1.png b/doc/salome/gui/GEOM/pics/measures1.png new file mode 100755 index 000000000..6d5d698b4 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures1.png differ diff --git a/doc/salome/gui/GEOM/pics/measures10.png b/doc/salome/gui/GEOM/pics/measures10.png new file mode 100755 index 000000000..33023cc49 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures10.png differ diff --git a/doc/salome/gui/GEOM/pics/measures3.png b/doc/salome/gui/GEOM/pics/measures3.png new file mode 100755 index 000000000..9a55aad4a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures3.png differ diff --git a/doc/salome/gui/GEOM/pics/measures4.png b/doc/salome/gui/GEOM/pics/measures4.png new file mode 100755 index 000000000..ea243e888 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures4.png differ diff --git a/doc/salome/gui/GEOM/pics/measures5.png b/doc/salome/gui/GEOM/pics/measures5.png new file mode 100755 index 000000000..a323426e6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures5.png differ diff --git a/doc/salome/gui/GEOM/pics/measures8.png b/doc/salome/gui/GEOM/pics/measures8.png new file mode 100755 index 000000000..94bed3271 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures8.png differ diff --git a/doc/salome/gui/GEOM/pics/measures9.png b/doc/salome/gui/GEOM/pics/measures9.png new file mode 100755 index 000000000..1767aad75 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/measures9.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_axissn1.png b/doc/salome/gui/GEOM/pics/mirror_axissn1.png new file mode 100755 index 000000000..86be83e7a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_axissn1.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_axissn2.png b/doc/salome/gui/GEOM/pics/mirror_axissn2.png new file mode 100755 index 000000000..6009fa7cf Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_axissn2.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_planesn1.png b/doc/salome/gui/GEOM/pics/mirror_planesn1.png new file mode 100755 index 000000000..969f0e0f4 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_planesn1.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_planesn2.png b/doc/salome/gui/GEOM/pics/mirror_planesn2.png new file mode 100755 index 000000000..e9eb4966d Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_planesn2.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_pointsn1.png b/doc/salome/gui/GEOM/pics/mirror_pointsn1.png new file mode 100755 index 000000000..675b0bff1 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_pointsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/mirror_pointsn2.png b/doc/salome/gui/GEOM/pics/mirror_pointsn2.png new file mode 100755 index 000000000..ab6235906 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mirror_pointsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/mtrans1.png b/doc/salome/gui/GEOM/pics/mtrans1.png new file mode 100755 index 000000000..7dfe730c3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtrans1.png differ diff --git a/doc/salome/gui/GEOM/pics/mtrans2.png b/doc/salome/gui/GEOM/pics/mtrans2.png new file mode 100755 index 000000000..62b35bb0c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtrans2.png differ diff --git a/doc/salome/gui/GEOM/pics/mtransf1.png b/doc/salome/gui/GEOM/pics/mtransf1.png new file mode 100755 index 000000000..207e920f9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtransf1.png differ diff --git a/doc/salome/gui/GEOM/pics/mtransf2.png b/doc/salome/gui/GEOM/pics/mtransf2.png new file mode 100755 index 000000000..3435f0f8c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtransf2.png differ diff --git a/doc/salome/gui/GEOM/pics/mtransf3.png b/doc/salome/gui/GEOM/pics/mtransf3.png new file mode 100755 index 000000000..628d8b0a6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtransf3.png differ diff --git a/doc/salome/gui/GEOM/pics/mtransf4.png b/doc/salome/gui/GEOM/pics/mtransf4.png new file mode 100755 index 000000000..cbe904444 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/mtransf4.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_rotation1d1.png b/doc/salome/gui/GEOM/pics/multi_rotation1d1.png new file mode 100755 index 000000000..4085f434b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_rotation1d1.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_rotation1d2.png b/doc/salome/gui/GEOM/pics/multi_rotation1d2.png new file mode 100755 index 000000000..8089092a8 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_rotation1d2.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_rotation2d1.png b/doc/salome/gui/GEOM/pics/multi_rotation2d1.png new file mode 100755 index 000000000..1bdd25302 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_rotation2d1.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_rotation2d2.png b/doc/salome/gui/GEOM/pics/multi_rotation2d2.png new file mode 100755 index 000000000..aa61ca606 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_rotation2d2.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_transformationsn1d.png b/doc/salome/gui/GEOM/pics/multi_transformationsn1d.png new file mode 100755 index 000000000..dfcc440ae Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_transformationsn1d.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_transformationsn2d.png b/doc/salome/gui/GEOM/pics/multi_transformationsn2d.png new file mode 100755 index 000000000..f0fc1279c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_transformationsn2d.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_translation1dsn.png b/doc/salome/gui/GEOM/pics/multi_translation1dsn.png new file mode 100755 index 000000000..436a8169a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_translation1dsn.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_translation2dsn.png b/doc/salome/gui/GEOM/pics/multi_translation2dsn.png new file mode 100755 index 000000000..f44c8520e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_translation2dsn.png differ diff --git a/doc/salome/gui/GEOM/pics/multi_translation_initialsn.png b/doc/salome/gui/GEOM/pics/multi_translation_initialsn.png new file mode 100755 index 000000000..0b7b70afe Binary files /dev/null and b/doc/salome/gui/GEOM/pics/multi_translation_initialsn.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-basicprop.png b/doc/salome/gui/GEOM/pics/neo-basicprop.png new file mode 100755 index 000000000..2a9d7ca2a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-basicprop.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-detect2.png b/doc/salome/gui/GEOM/pics/neo-detect2.png new file mode 100755 index 000000000..f0dabe311 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-detect2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-isos.png b/doc/salome/gui/GEOM/pics/neo-isos.png new file mode 100755 index 000000000..dbbcf8ef5 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-isos.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-localcs1.png b/doc/salome/gui/GEOM/pics/neo-localcs1.png new file mode 100755 index 000000000..9bdacafa2 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-localcs1.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-localcs2.png b/doc/salome/gui/GEOM/pics/neo-localcs2.png new file mode 100755 index 000000000..3fc54a67c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-localcs2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-localcs3.png b/doc/salome/gui/GEOM/pics/neo-localcs3.png new file mode 100755 index 000000000..01c8e24fa Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-localcs3.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-materials.png b/doc/salome/gui/GEOM/pics/neo-materials.png new file mode 100755 index 000000000..66917490c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-materials.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-mrot1.png b/doc/salome/gui/GEOM/pics/neo-mrot1.png new file mode 100755 index 000000000..6cf2ab91b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-mrot1.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-mrot2.png b/doc/salome/gui/GEOM/pics/neo-mrot2.png new file mode 100755 index 000000000..e2f37e052 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-mrot2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj1.png b/doc/salome/gui/GEOM/pics/neo-obj1.png new file mode 100755 index 000000000..88a7a8b8a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj1.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj2.png b/doc/salome/gui/GEOM/pics/neo-obj2.png new file mode 100755 index 000000000..c940eaa38 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj3.png b/doc/salome/gui/GEOM/pics/neo-obj3.png new file mode 100755 index 000000000..d773938e2 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj3.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj4.png b/doc/salome/gui/GEOM/pics/neo-obj4.png new file mode 100755 index 000000000..db5d49715 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj4.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj5.png b/doc/salome/gui/GEOM/pics/neo-obj5.png new file mode 100755 index 000000000..e1579f082 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj5.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj6.png b/doc/salome/gui/GEOM/pics/neo-obj6.png new file mode 100755 index 000000000..b6b3be440 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj6.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-obj7.png b/doc/salome/gui/GEOM/pics/neo-obj7.png new file mode 100755 index 000000000..15dfa2376 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-obj7.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-point2.png b/doc/salome/gui/GEOM/pics/neo-point2.png new file mode 100755 index 000000000..3bc59b860 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-point2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-scetcher1.png b/doc/salome/gui/GEOM/pics/neo-scetcher1.png new file mode 100755 index 000000000..7130e8b08 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-scetcher1.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-scetcher2.png b/doc/salome/gui/GEOM/pics/neo-scetcher2.png new file mode 100755 index 000000000..330e1e3a3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-scetcher2.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-section.png b/doc/salome/gui/GEOM/pics/neo-section.png new file mode 100755 index 000000000..0d58ad244 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-section.png differ diff --git a/doc/salome/gui/GEOM/pics/neo-transparency.png b/doc/salome/gui/GEOM/pics/neo-transparency.png new file mode 100755 index 000000000..ec1fb7f70 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/neo-transparency.png differ diff --git a/doc/salome/gui/GEOM/pics/new-tolerance.png b/doc/salome/gui/GEOM/pics/new-tolerance.png new file mode 100755 index 000000000..796115ba9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/new-tolerance.png differ diff --git a/doc/salome/gui/GEOM/pics/offsetsn.png b/doc/salome/gui/GEOM/pics/offsetsn.png new file mode 100755 index 000000000..6404310e0 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/offsetsn.png differ diff --git a/doc/salome/gui/GEOM/pics/partition1.png b/doc/salome/gui/GEOM/pics/partition1.png new file mode 100755 index 000000000..eb6bf4305 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/partition1.png differ diff --git a/doc/salome/gui/GEOM/pics/partition2.png b/doc/salome/gui/GEOM/pics/partition2.png new file mode 100755 index 000000000..bd388a5fb Binary files /dev/null and b/doc/salome/gui/GEOM/pics/partition2.png differ diff --git a/doc/salome/gui/GEOM/pics/partitionsn1.png b/doc/salome/gui/GEOM/pics/partitionsn1.png new file mode 100755 index 000000000..fa8404de4 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/partitionsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/partitionsn2.png b/doc/salome/gui/GEOM/pics/partitionsn2.png new file mode 100755 index 000000000..b7480a4fa Binary files /dev/null and b/doc/salome/gui/GEOM/pics/partitionsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/pipe.png b/doc/salome/gui/GEOM/pics/pipe.png new file mode 100755 index 000000000..e773731d2 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/pipe.png differ diff --git a/doc/salome/gui/GEOM/pics/pipe_wire_edgesn.png b/doc/salome/gui/GEOM/pics/pipe_wire_edgesn.png new file mode 100755 index 000000000..4424b6bf1 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/pipe_wire_edgesn.png differ diff --git a/doc/salome/gui/GEOM/pics/pipesn.png b/doc/salome/gui/GEOM/pics/pipesn.png new file mode 100755 index 000000000..11ac1096b Binary files /dev/null and b/doc/salome/gui/GEOM/pics/pipesn.png differ diff --git a/doc/salome/gui/GEOM/pics/plane1.png b/doc/salome/gui/GEOM/pics/plane1.png new file mode 100755 index 000000000..47a9b8bcd Binary files /dev/null and b/doc/salome/gui/GEOM/pics/plane1.png differ diff --git a/doc/salome/gui/GEOM/pics/plane2.png b/doc/salome/gui/GEOM/pics/plane2.png new file mode 100755 index 000000000..f4b880b44 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/plane2.png differ diff --git a/doc/salome/gui/GEOM/pics/plane3.png b/doc/salome/gui/GEOM/pics/plane3.png new file mode 100755 index 000000000..bce562350 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/plane3.png differ diff --git a/doc/salome/gui/GEOM/pics/plane_on_face.png b/doc/salome/gui/GEOM/pics/plane_on_face.png new file mode 100755 index 000000000..5df8823cd Binary files /dev/null and b/doc/salome/gui/GEOM/pics/plane_on_face.png differ diff --git a/doc/salome/gui/GEOM/pics/planes1.png b/doc/salome/gui/GEOM/pics/planes1.png new file mode 100755 index 000000000..c9a594cee Binary files /dev/null and b/doc/salome/gui/GEOM/pics/planes1.png differ diff --git a/doc/salome/gui/GEOM/pics/point1.png b/doc/salome/gui/GEOM/pics/point1.png new file mode 100755 index 000000000..39bca25f4 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/point1.png differ diff --git a/doc/salome/gui/GEOM/pics/point3.png b/doc/salome/gui/GEOM/pics/point3.png new file mode 100755 index 000000000..0a2e325c6 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/point3.png differ diff --git a/doc/salome/gui/GEOM/pics/points.png b/doc/salome/gui/GEOM/pics/points.png new file mode 100755 index 000000000..547b277fd Binary files /dev/null and b/doc/salome/gui/GEOM/pics/points.png differ diff --git a/doc/salome/gui/GEOM/pics/polyline.png b/doc/salome/gui/GEOM/pics/polyline.png new file mode 100755 index 000000000..bd259e120 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/polyline.png differ diff --git a/doc/salome/gui/GEOM/pics/prisms_basessn.png b/doc/salome/gui/GEOM/pics/prisms_basessn.png new file mode 100755 index 000000000..d6a070083 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/prisms_basessn.png differ diff --git a/doc/salome/gui/GEOM/pics/prismssn.png b/doc/salome/gui/GEOM/pics/prismssn.png new file mode 100755 index 000000000..80c9af357 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/prismssn.png differ diff --git a/doc/salome/gui/GEOM/pics/repair1.png b/doc/salome/gui/GEOM/pics/repair1.png new file mode 100755 index 000000000..2b47fa5a4 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair1.png differ diff --git a/doc/salome/gui/GEOM/pics/repair10.png b/doc/salome/gui/GEOM/pics/repair10.png new file mode 100755 index 000000000..c3c77164a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair10.png differ diff --git a/doc/salome/gui/GEOM/pics/repair2.png b/doc/salome/gui/GEOM/pics/repair2.png new file mode 100755 index 000000000..488a6a4c9 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair2.png differ diff --git a/doc/salome/gui/GEOM/pics/repair3.png b/doc/salome/gui/GEOM/pics/repair3.png new file mode 100755 index 000000000..4c2a41f90 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair3.png differ diff --git a/doc/salome/gui/GEOM/pics/repair4.png b/doc/salome/gui/GEOM/pics/repair4.png new file mode 100755 index 000000000..2af7cbabb Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair4.png differ diff --git a/doc/salome/gui/GEOM/pics/repair5.png b/doc/salome/gui/GEOM/pics/repair5.png new file mode 100755 index 000000000..b99fbcbaf Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair5.png differ diff --git a/doc/salome/gui/GEOM/pics/repair6.png b/doc/salome/gui/GEOM/pics/repair6.png new file mode 100755 index 000000000..5123d1f84 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair6.png differ diff --git a/doc/salome/gui/GEOM/pics/repair7.png b/doc/salome/gui/GEOM/pics/repair7.png new file mode 100755 index 000000000..2b553b9fd Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair7.png differ diff --git a/doc/salome/gui/GEOM/pics/repair8.png b/doc/salome/gui/GEOM/pics/repair8.png new file mode 100755 index 000000000..f0016836e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair8.png differ diff --git a/doc/salome/gui/GEOM/pics/repair9.png b/doc/salome/gui/GEOM/pics/repair9.png new file mode 100755 index 000000000..7f5d4f5c3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/repair9.png differ diff --git a/doc/salome/gui/GEOM/pics/revolution.png b/doc/salome/gui/GEOM/pics/revolution.png new file mode 100755 index 000000000..c02c859b1 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/revolution.png differ diff --git a/doc/salome/gui/GEOM/pics/revolutionsn.png b/doc/salome/gui/GEOM/pics/revolutionsn.png new file mode 100755 index 000000000..7242c6710 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/revolutionsn.png differ diff --git a/doc/salome/gui/GEOM/pics/rotationsn1.png b/doc/salome/gui/GEOM/pics/rotationsn1.png new file mode 100755 index 000000000..697dcdedf Binary files /dev/null and b/doc/salome/gui/GEOM/pics/rotationsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/rotationsn2.png b/doc/salome/gui/GEOM/pics/rotationsn2.png new file mode 100755 index 000000000..741d00c90 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/rotationsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/scale_transformsn1.png b/doc/salome/gui/GEOM/pics/scale_transformsn1.png new file mode 100755 index 000000000..5af390922 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/scale_transformsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/scale_transformsn2.png b/doc/salome/gui/GEOM/pics/scale_transformsn2.png new file mode 100755 index 000000000..fa76d4158 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/scale_transformsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/sectionsn.png b/doc/salome/gui/GEOM/pics/sectionsn.png new file mode 100755 index 000000000..8e636ee91 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/sectionsn.png differ diff --git a/doc/salome/gui/GEOM/pics/shellsn.png b/doc/salome/gui/GEOM/pics/shellsn.png new file mode 100755 index 000000000..c7f22f323 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/shellsn.png differ diff --git a/doc/salome/gui/GEOM/pics/solidsn.png b/doc/salome/gui/GEOM/pics/solidsn.png new file mode 100755 index 000000000..297fc068c Binary files /dev/null and b/doc/salome/gui/GEOM/pics/solidsn.png differ diff --git a/doc/salome/gui/GEOM/pics/sphere1.png b/doc/salome/gui/GEOM/pics/sphere1.png new file mode 100755 index 000000000..377f1c9ce Binary files /dev/null and b/doc/salome/gui/GEOM/pics/sphere1.png differ diff --git a/doc/salome/gui/GEOM/pics/sphere2.png b/doc/salome/gui/GEOM/pics/sphere2.png new file mode 100755 index 000000000..dd2cadb1f Binary files /dev/null and b/doc/salome/gui/GEOM/pics/sphere2.png differ diff --git a/doc/salome/gui/GEOM/pics/spheres.png b/doc/salome/gui/GEOM/pics/spheres.png new file mode 100755 index 000000000..2b79050f0 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/spheres.png differ diff --git a/doc/salome/gui/GEOM/pics/supp_int_wires1.png b/doc/salome/gui/GEOM/pics/supp_int_wires1.png new file mode 100755 index 000000000..5f760560e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/supp_int_wires1.png differ diff --git a/doc/salome/gui/GEOM/pics/supp_int_wires2.png b/doc/salome/gui/GEOM/pics/supp_int_wires2.png new file mode 100755 index 000000000..e6dc3142a Binary files /dev/null and b/doc/salome/gui/GEOM/pics/supp_int_wires2.png differ diff --git a/doc/salome/gui/GEOM/pics/suppress_faces1.png b/doc/salome/gui/GEOM/pics/suppress_faces1.png new file mode 100755 index 000000000..7534ebeee Binary files /dev/null and b/doc/salome/gui/GEOM/pics/suppress_faces1.png differ diff --git a/doc/salome/gui/GEOM/pics/suppress_faces2.png b/doc/salome/gui/GEOM/pics/suppress_faces2.png new file mode 100755 index 000000000..d38a4add3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/suppress_faces2.png differ diff --git a/doc/salome/gui/GEOM/pics/torus1.png b/doc/salome/gui/GEOM/pics/torus1.png new file mode 100755 index 000000000..28e18afa0 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/torus1.png differ diff --git a/doc/salome/gui/GEOM/pics/torus2.png b/doc/salome/gui/GEOM/pics/torus2.png new file mode 100755 index 000000000..8877f1c37 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/torus2.png differ diff --git a/doc/salome/gui/GEOM/pics/toruses.png b/doc/salome/gui/GEOM/pics/toruses.png new file mode 100755 index 000000000..721bae271 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/toruses.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation1.png b/doc/salome/gui/GEOM/pics/transformation1.png new file mode 100755 index 000000000..8dbf8fe11 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation1.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation10.png b/doc/salome/gui/GEOM/pics/transformation10.png new file mode 100755 index 000000000..0847a5e03 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation10.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation11.png b/doc/salome/gui/GEOM/pics/transformation11.png new file mode 100755 index 000000000..b78acec2e Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation11.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation2.png b/doc/salome/gui/GEOM/pics/transformation2.png new file mode 100755 index 000000000..569752740 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation2.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation3.png b/doc/salome/gui/GEOM/pics/transformation3.png new file mode 100755 index 000000000..96a1f1e36 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation3.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation4.png b/doc/salome/gui/GEOM/pics/transformation4.png new file mode 100755 index 000000000..5b1775686 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation4.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation5.png b/doc/salome/gui/GEOM/pics/transformation5.png new file mode 100755 index 000000000..8d1cf9254 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation5.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation6.png b/doc/salome/gui/GEOM/pics/transformation6.png new file mode 100755 index 000000000..3e3828bd8 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation6.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation7.png b/doc/salome/gui/GEOM/pics/transformation7.png new file mode 100755 index 000000000..03a16fe01 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation7.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation8.png b/doc/salome/gui/GEOM/pics/transformation8.png new file mode 100755 index 000000000..77d030385 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation8.png differ diff --git a/doc/salome/gui/GEOM/pics/transformation9.png b/doc/salome/gui/GEOM/pics/transformation9.png new file mode 100755 index 000000000..c7f6194d3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transformation9.png differ diff --git a/doc/salome/gui/GEOM/pics/translationsn1.png b/doc/salome/gui/GEOM/pics/translationsn1.png new file mode 100755 index 000000000..42e008cb3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/translationsn1.png differ diff --git a/doc/salome/gui/GEOM/pics/translationsn2.png b/doc/salome/gui/GEOM/pics/translationsn2.png new file mode 100755 index 000000000..01d695937 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/translationsn2.png differ diff --git a/doc/salome/gui/GEOM/pics/transparencysn.png b/doc/salome/gui/GEOM/pics/transparencysn.png new file mode 100755 index 000000000..0b3638ed1 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/transparencysn.png differ diff --git a/doc/salome/gui/GEOM/pics/vector1.png b/doc/salome/gui/GEOM/pics/vector1.png new file mode 100755 index 000000000..46e3b20f3 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/vector1.png differ diff --git a/doc/salome/gui/GEOM/pics/vector2.png b/doc/salome/gui/GEOM/pics/vector2.png new file mode 100755 index 000000000..bb5c64c56 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/vector2.png differ diff --git a/doc/salome/gui/GEOM/pics/vectors.png b/doc/salome/gui/GEOM/pics/vectors.png new file mode 100755 index 000000000..bb8e7c5ab Binary files /dev/null and b/doc/salome/gui/GEOM/pics/vectors.png differ diff --git a/doc/salome/gui/GEOM/pics/wiresn.png b/doc/salome/gui/GEOM/pics/wiresn.png new file mode 100755 index 000000000..623ae3b58 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/wiresn.png differ diff --git a/doc/salome/gui/GEOM/pics/workplane4.png b/doc/salome/gui/GEOM/pics/workplane4.png new file mode 100755 index 000000000..1f9dab5fb Binary files /dev/null and b/doc/salome/gui/GEOM/pics/workplane4.png differ diff --git a/doc/salome/gui/GEOM/pics/workplane5.png b/doc/salome/gui/GEOM/pics/workplane5.png new file mode 100755 index 000000000..a20eb6021 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/workplane5.png differ diff --git a/doc/salome/gui/GEOM/pics/workplane6.png b/doc/salome/gui/GEOM/pics/workplane6.png new file mode 100755 index 000000000..5e5134821 Binary files /dev/null and b/doc/salome/gui/GEOM/pics/workplane6.png differ diff --git a/doc/salome/gui/GEOM/pipe_creation.htm b/doc/salome/gui/GEOM/pipe_creation.htm new file mode 100755 index 000000000..76df0d948 --- /dev/null +++ b/doc/salome/gui/GEOM/pipe_creation.htm @@ -0,0 +1,140 @@ + + + + + +Pipe Creation + + + + + + + + + + + +

    Pipe Construction

    + +

    To generate + a Pipe + in the Main Menu select New Entity - > Generation  - + > Pipe

    + +

     

    + +

    To create an extruded Pipe shape, + you need to define the Base Object (vertex, edge, wire, face or shell), which will be extruded and the Path Object (edge, + face or shell) along which the Base Object will be extruded.

    + +

    The + Result of the operation will be a + GEOM_Object (edge, face, solid or compsolid).

    + +

     

    + +

    TUI Command: + geompy.MakePipe(baseShape, pathShape) +

    + +

    Arguments: + Name + 1 shape (vertex, edge, wire, face or shell) serving as base object + + 1 shape (edge, face or shell) for definition of the path.

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Complex Geometric + Objects.

    + +

     

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/plane.htm b/doc/salome/gui/GEOM/plane.htm new file mode 100755 index 000000000..742dffc57 --- /dev/null +++ b/doc/salome/gui/GEOM/plane.htm @@ -0,0 +1,196 @@ + + + + + +Plane + + + + + + + + + + + +

    Plane

    + +

    To create a Plane in the Main Menu select New + Entity - > Basic - > Plane

    + +

     

    + +

    There are three algorithms to create + a point in the 3D space.

    + +

    The Result of + each operation will be a GEOM_Object + (face).

    + +

     

    + +

    Firstly, you can define a Plane + by a Point through which  the + plane passes, a Vector giving + a normal of the plane and a Size of the + Plane (size of a side of quadrangle face, representing the plane).

    + +

    TUI + Command: geompy.MakePlane(Point, + Vector, TrimSize)

    + +

    Arguments: Name + + 1 vertex + 1 vector  + + 1 value (to define the size of the plane).

    + +

    + +

     

    + +

    Secondly, you can define a Plane + by three Points through which +  the plane + passes.

    + +

    TUI + Command: geompy.MakePlaneThreePnt(Point1, + Point2, Point3, TrimSize)

    + +

    Arguments: + Name + 1 vertex + 3 points (for + the direction) + 1 value (to define the size of the plane).

    + +

     

    + +

    + +

     

    + +

    Finally, you can define a Plane, + similar to the existing one, but with another size of representing face. +

    + +

    TUI + Command: geompy.MakePlaneFace(Face, TrimSize)

    + +

    Arguments: + Name + 1 selection + 1 value (to define the size of the plane).

    + + + +

     

    + +

    Examples:

    + +

     

    + +

    Planes +                                                             A + Plane created on a Plane of another size

    + +

     

    + + ++++ + + + + +
    +

    +

    +

     

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Basic + Geometric Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/point.htm b/doc/salome/gui/GEOM/point.htm new file mode 100755 index 000000000..1618af626 --- /dev/null +++ b/doc/salome/gui/GEOM/point.htm @@ -0,0 +1,193 @@ + + + + + +Point + + + + + + + + + + + + +

    Point

    + +

    To create a Point in the Main Menu select New + Entity - > Basic - > Point

    + +

     

    + +

    There are three algorithms to create + a Point in the 3D space.

    + +

    Each + time the Result of the operation + will be a GEOM_Object (vertex).

    + +

     

    + +

    Firstly, + we can define a point by and + setting its X, Y and Z Coordinates. +

    + +

    TUI Command : +   geompy.MakeVertex(X, + Y, Z)

    + +

    Arguments: Name + (Vertex_n by default) + + X, Y and Z coordinates of the point.

    + +

     

    + +

    + +

     

    + +

    Secondly,  we + can define a point by a Reference + to another point and the shift of the coordinates of the new point regarding + the coordinates of the old one.

    + +

    TUI Command : +   geompy.MakeVertexWithRef(Reference, X, Y, Z)

    + +

    Arguments: + Name + 1 reference point + 3 coordinates defining the position of + this point regarding the reference one

    + +

     

    + +

    + +

     

    + +

    Finally, we can define a + point by an Edge and a Parameter +  indicating + its position on the Edge. For example, 0.5 means that the point is located + in the middle of the edge.

    + +

    TUI + Command :   geompy.MakeVertexOnCurve(Edge, + Parameter)

    + +

    Arguments: + Name + 1 edge  + + 1 Parameter defining the position of the point on the given edge.

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of creation of Basic + Geometric Objects.

    + + + + diff --git a/doc/salome/gui/GEOM/primitives.htm b/doc/salome/gui/GEOM/primitives.htm new file mode 100755 index 000000000..38218aa9c --- /dev/null +++ b/doc/salome/gui/GEOM/primitives.htm @@ -0,0 +1,362 @@ + + + + + +Primitives + + + + + + + + + + + +

    Primitives

    + +

    Creation of a Box

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices

    + +

    p0 = geompy.MakeVertex(15, + 25, 35)

    + +

    p70 = geompy.MakeVertex(70, + 70, 70)

    + +

     

    + +

    # create boxes

    + +

    box1 = geompy.MakeBoxDXDYDZ(10, + 20, 30)

    + +

    box2 = geompy.MakeBox(10,20,30, + 15,25,35)

    + +

    box3 = geompy.MakeBoxTwoPnt(p0, + p70)

    + +

     

    + +

    # add objects in study

    + +

    id_box1 = geompy.addToStudy(box1,"Box1")

    + +

    id_box2 = geompy.addToStudy(box2,"Box2")

    + +

    id_box3 = geompy.addToStudy(box3,"Box3")

    + +

     

    + +

    # display boxes

    + +

    gg.createAndDisplayGO(id_box1)

    + +

    gg.setDisplayMode(id_box1,1)

    + +

    gg.createAndDisplayGO(id_box2)

    + +

    gg.setDisplayMode(id_box2,1)

    + +

    gg.createAndDisplayGO(id_box3)

    + +

    gg.setDisplayMode(id_box3,1) +

    + +

     

    + +

    Creation of a Cylinder

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(35, + 35, 0)

    + +

    p2 = geompy.MakeVertex(35, + 35, 70)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cones

    + +

    cone1 = geompy.MakeCone(p1, + v, 17, 1, 20)

    + +

    cone2 = geompy.MakeConeR1R2H(30, + 10, 30)

    + +

     

    + +

    # add objects in study

    + +

    id_cone1 = geompy.addToStudy(cone1,"Cone1")

    + +

    id_cone2 = geompy.addToStudy(cone2,"Cone2")

    + +

     

    + +

    # display cones

    + +

    gg.createAndDisplayGO(id_cone1)

    + +

    gg.setDisplayMode(id_cone1,1)

    + +

    gg.createAndDisplayGO(id_cone2)

    + +

    gg.setDisplayMode(id_cone2,1) +

    + +

     

    + +

    Creation of a Sphere

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex

    + +

    p = geompy.MakeVertex(55, + 45, 25)

    + +

     

    + +

    # create spheres

    + +

    radius1 = 20

    + +

    sphere1 = geompy.MakeSpherePntR(p, + radius1)

    + +

    radius2 = 15

    + +

    sphere2 = geompy.MakeSphere(0, + 0, 45, radius2)

    + +

    radius3 = 30

    + +

    sphere3 = geompy.MakeSphereR(radius3)

    + +

     

    + +

    # add objects in study

    + +

    id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")

    + +

    id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")

    + +

    id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")

    + +

     

    + +

    # display spheres

    + +

    gg.createAndDisplayGO(id_sphere1)

    + +

    gg.setDisplayMode(id_sphere1,1)

    + +

    gg.createAndDisplayGO(id_sphere2)

    + +

    gg.setDisplayMode(id_sphere2,1)

    + +

    gg.createAndDisplayGO(id_sphere3)

    + +

    gg.setDisplayMode(id_sphere3,1) +

    + +

     

    + +

    Creation of a Torus

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(35, + 40, 45)

    + +

    p2 = geompy.MakeVertex(35, + 45, 70)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create toruses

    + +

    torus1 = geompy.MakeTorus(p1, + v, 20, 10)

    + +

    torus2 = geompy.MakeTorusRR(30, + 15)

    + +

     

    + +

    # add objects in study

    + +

    id_torus1 = geompy.addToStudy(torus1,"Torus1")

    + +

    id_torus2 = geompy.addToStudy(torus2,"Torus2")

    + +

     

    + +

    # display toruses

    + +

    gg.createAndDisplayGO(id_torus1)

    + +

    gg.setDisplayMode(id_torus1,1)

    + +

    gg.createAndDisplayGO(id_torus2)

    + +

    gg.setDisplayMode(id_torus2,1) +

    + +

    Creation of a Cone

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(35, + 35, 0)

    + +

    p2 = geompy.MakeVertex(35, + 35, 70)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cones

    + +

    cone1 = geompy.MakeCone(p1, + v, 17, 1, 20)

    + +

    cone2 = geompy.MakeConeR1R2H(30, + 10, 30)

    + +

     

    + +

    # add objects in study

    + +

    id_cone1 = geompy.addToStudy(cone1,"Cone1")

    + +

    id_cone2 = geompy.addToStudy(cone2,"Cone2")

    + +

     

    + +

    # display cones

    + +

    gg.createAndDisplayGO(id_cone1)

    + +

    gg.setDisplayMode(id_cone1,1)

    + +

    gg.createAndDisplayGO(id_cone2)

    + +

    gg.setDisplayMode(id_cone2,1) +

    + + + + diff --git a/doc/salome/gui/GEOM/propagate.htm b/doc/salome/gui/GEOM/propagate.htm new file mode 100755 index 000000000..9fd1dd1be --- /dev/null +++ b/doc/salome/gui/GEOM/propagate.htm @@ -0,0 +1,149 @@ + + + + + +Propagate + + + + + + + + + + + + +

    Propagate

    + +

    To produce + a Propagate operation in the Main + Menu select Operations - > Blocks + - > Propagate

    + +

     

    + +

    This operation breaks a multitude of edges + of a shape into groups (builds all possible propagation groups).

    + +

    The + Result will be a List of + GEOM_Objects. Each Geom Object will contain a group of edges.

    + +

     

    + +

    TUI Command: + geompy.Propagate(Shape), + where Shape is a shape to build propagation groups on.

    + +

    Arguments: 1 Shape.

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

         

    + +

     

    + +

       Our TUI + Scripts provide you with useful examples + of the use of Blocks + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/repairing_operations.htm b/doc/salome/gui/GEOM/repairing_operations.htm new file mode 100755 index 000000000..2b48c2851 --- /dev/null +++ b/doc/salome/gui/GEOM/repairing_operations.htm @@ -0,0 +1,1069 @@ + + + + + +Repairing Operations + + + + + + + + + + + +

    Repairing Operations

    + +

    Shape Processing

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices, edge, arc, wire, face and prism

    + +

    p1 = geompy.MakeVertex(0,0,0)

    + +

    p2 = geompy.MakeVertex(200,0,0)

    + +

    p3 = geompy.MakeVertex(100,150,0)

    + +

    edge = geompy.MakeEdge(p1,p2)

    + +

    arc  = + geompy.MakeArc(p1,p3,p2)

    + +

    wire = geompy.MakeWire([edge,arc])

    + +

    face = geompy.MakeFace(wire, + 1)

    + +

    theShape = geompy.MakePrismVecH(face, + edge, 130)

    + +

     

    + +

    # check shape at the beginning

    + +

    print "Before + ProcessShape:"

    + +

    isValid = geompy.CheckShape(theShape)

    + +

    if isValid == 0:

    + +

        print + "The shape is not valid"

    + +

    else:

    + +

        print + "The shape seems to be valid"

    + +

     

    + +

    # process Shape

    + +

    Operators = ["FixShape"]

    + +

    Parameters = ["FixShape.Tolerance3d"]

    + +

    Values = ["1e-7"]

    + +

    PS = geompy.ProcessShape(theShape, + Operators, Parameters, Values)

    + +

     

    + +

    # check shape at the end

    + +

    print "After + ProcessShape:"

    + +

    isValid = geompy.CheckShape(PS)

    + +

    if isValid == 0:

    + +

        print + "The shape is not valid"

    + +

        raise + RuntimeError, "It seems, that the ProcessShape() has failed"

    + +

    else:

    + +

        print + "The shape seems to be valid"

    + +

     

    + +

    # add in study and display

    + +

    Id_Shape = geompy.addToStudy(theShape, + "Invalid Shape")

    + +

    Id_PS    = + geompy.addToStudy(PS, "Processed Shape")

    + +

    gg.createAndDisplayGO(Id_Shape)

    + +

    gg.setDisplayMode(Id_Shape,1)

    + +

    gg.createAndDisplayGO(Id_PS)

    + +

    gg.setDisplayMode(Id_PS,1) +

    + +

     

    + +

    Suppress Faces

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create box

    + +

    box = geompy.MakeBoxDXDYDZ(200, + 200, 200)

    + +

     

    + +

    # IDList for suppress faces

    + +

    sup_faces = []

    + +

    sup_faces = geompy.SubShapeAllSorted(box, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # get sub-shape indexes

    + +

    f1_id = geompy.GetSubShapeID(box, + sup_faces[3])

    + +

     

    + +

    # remove faces from the given object (shape)

    + +

    result = geompy.SuppressFaces(box, + [f1_id])

    + +

     

    + +

    # add objects in study

    + +

    id_box = geompy.addToStudy(box, + "Box")

    + +

    id_result = geompy.addToStudy(result, + "Result")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_box)

    + +

    gg.setDisplayMode(id_box,1)

    + +

    gg.createAndDisplayGO(id_result)

    + +

    gg.setDisplayMode(id_result,1) +

    + +

     

    + +

    Close Contour

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices and vectors

    + +

    p0  = + geompy.MakeVertex(  0., +   0., +   0.)

    + +

    px  = + geompy.MakeVertex(100.,   0., +   0.)

    + +

    py  = + geompy.MakeVertex(  0., + 100.,   0.)

    + +

    py1 = geompy.MakeVertex( +  0., 140., +   0.)

    + +

    pz  = + geompy.MakeVertex(  0., +   0., + 100.)

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

      

    + +

    # create arc

    + +

    arc = geompy.MakeArc(py1, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # close an open wire by creation of an edge between ends

    + +

    wire_close = geompy.CloseContour(wire, + [1], 0)

    + +

     

    + +

    # add objects in study

    + +

    id_wire = geompy.addToStudy(wire, + "Wire")

    + +

    id_wire_close = geompy.addToStudy(wire_close, + "Wire close")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_wire)

    + +

    gg.createAndDisplayGO(id_wire_close) +

    + +

     

    + +

    Suppress Internal Wires

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(55, + 65, 50)

    + +

    p2 = geompy.MakeVertex(55, +  0, 50)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cylinder

    + +

    height = 100

    + +

    radius1 = 40

    + +

    cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

    + +

     

    + +

    # create box

    + +

    box = geompy.MakeBoxDXDYDZ(100, + 100, 100)

    + +

     

    + +

    # make cut

    + +

    cut = geompy.MakeCut(box, + cylinder)

    + +

     

    + +

    # suppress all internal wires

    + +

    result = geompy.SuppressInternalWires(cut, + [])

    + +

     

    + +

    # add objects in study

    + +

    id_cut = geompy.addToStudy(cut, + "Cut")

    + +

    id_result = geompy.addToStudy(result, + "Result")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_cut)

    + +

    gg.setDisplayMode(id_cut,1)

    + +

    gg.createAndDisplayGO(id_result)

    + +

    gg.setDisplayMode(id_result,1) +

    + +

     

    + +

    Suppress Holes

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(35, + 35, 0)

    + +

    p2 = geompy.MakeVertex(35, + 35, 50)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cylinder

    + +

    height = 20

    + +

    radius1 = 20

    + +

    cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

    + +

     

    + +

    # create cone

    + +

    cone = geompy.MakeCone(p1, + v, 70, 0, 80)

    + +

     

    + +

    # make cut

    + +

    cut = geompy.MakeCut(cone, + cylinder)

    + +

     

    + +

    # get faces as sub-shapes

    + +

    faces = []

    + +

    faces = geompy.SubShapeAllSorted(cut, + geompy.ShapeType["FACE"])

    + +

    f_2 = geompy.GetSubShapeID(cut, + faces[2])

    + +

     

    + +

    # remove one face from the shape

    + +

    cut_without_f_2 = + geompy.SuppressFaces(cut, [f_2])

    + +

     

    + +

    # get wires as sub-shapes

    + +

    wires = []

    + +

    wires = geompy.SubShapeAllSorted(cut_without_f_2, + geompy.ShapeType["WIRE"])

    + +

    w_0 = geompy.GetSubShapeID(cut_without_f_2, + wires[0])

    + +

     

    + +

    # suppress the selected wire

    + +

    result = geompy.SuppressHoles(cut_without_f_2, + [w_0])

    + +

     

    + +

    # add objects in study

    + +

    id_cut = geompy.addToStudy(cut, + "Cut")

    + +

    id_cut_without_f_2 + = geompy.addToStudy(cut_without_f_2, "Cut without f_2")

    + +

    id_result = geompy.addToStudy(result, + "Result")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_cut)

    + +

    gg.setDisplayMode(id_cut,1)

    + +

    gg.createAndDisplayGO(id_cut_without_f_2)

    + +

    gg.setDisplayMode(id_cut_without_f_2,1)

    + +

    gg.createAndDisplayGO(id_result)

    + +

    gg.setDisplayMode(id_result,1) +

    + +

     

    + +

    Sewing

    + +

    import geompy

    + +

    import salome

    + +

    import math

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create base points

    + +

    px = geompy.MakeVertex(100., + 0., 0.)

    + +

    py = geompy.MakeVertex(0., + 100., 0.)

    + +

    pz = geompy.MakeVertex(0., + 0., 100.)

    + +

     

    + +

    # create base geometry 2D & 3D

    + +

    vector = geompy.MakeVector(px, + py)

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create base objects

    + +

    angle = 45. * math.pi + / 180

    + +

    WantPlanarFace = 1 + #True

    + +

    wire = geompy.MakeWire([vector, + arc])

    + +

    face = geompy.MakeFace(wire, + WantPlanarFace)

    + +

    face_rot = geompy.MakeRotation(face, + vector, angle)

    + +

     

    + +

    # make sewing

    + +

    precision = 0.00001

    + +

    sewing = geompy.MakeSewing([face, + face_rot], precision)

    + +

     

    + +

    # add objects in study

    + +

    id_face = geompy.addToStudy(face, + "Face")

    + +

    id_face_rot = geompy.addToStudy(face_rot, + "Face rotation")

    + +

    id_sewing = geompy.addToStudy(sewing, + "Sewing")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_face)

    + +

    gg.setDisplayMode(id_face,1)

    + +

    gg.createAndDisplayGO(id_face_rot)

    + +

    gg.setDisplayMode(id_face_rot,1)

    + +

    gg.createAndDisplayGO(id_sewing)

    + +

    gg.setDisplayMode(id_sewing,1) +

    + +

     

    + +

    Glue Faces

    + +

    import geompy

    + +

    import salome

    + +

    import math

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create base points

    + +

    px = geompy.MakeVertex(100., + 0., 0.)

    + +

    py = geompy.MakeVertex(0., + 100., 0.)

    + +

    pz = geompy.MakeVertex(0., + 0., 100.)

    + +

     

    + +

    # create base geometry + 2D & 3D

    + +

    vector = geompy.MakeVector(px, + py)

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create base objects

    + +

    angle = 45. * math.pi + / 180

    + +

    WantPlanarFace = 1 + #True

    + +

    wire = geompy.MakeWire([vector, + arc])

    + +

    face = geompy.MakeFace(wire, + WantPlanarFace)

    + +

    face_rot = geompy.MakeRotation(face, + vector, angle)

    + +

     

    + +

    # make sewing

    + +

    precision = 0.00001

    + +

    sewing = geompy.MakeSewing([face, + face_rot], precision)

    + +

     

    + +

    # add objects in study

    + +

    id_face = geompy.addToStudy(face, + "Face")

    + +

    id_face_rot = geompy.addToStudy(face_rot, + "Face rotation")

    + +

    id_sewing = geompy.addToStudy(sewing, + "Sewing")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_face)

    + +

    gg.setDisplayMode(id_face,1)

    + +

    gg.createAndDisplayGO(id_face_rot)

    + +

    gg.setDisplayMode(id_face_rot,1)

    + +

    gg.createAndDisplayGO(id_sewing)

    + +

    gg.setDisplayMode(id_sewing,1) +

    + +

     

    + +

    Add Point on Edge

    + +

    import + geompy

    + +

    import salome

    + +

     

    + +

    # create vertices

    + +

    p1 = geompy.MakeVertex(0,0,50)

    + +

    p2 = geompy.MakeVertex(60,0,50)

    + +

     

    + +

    # make edge

    + +

    edge = geompy.MakeEdge(p1, + p2) #geompy.GetSubShape(box, edge_ind)

    + +

     

    + +

    # divide edge

    + +

    divide = geompy.DivideEdge(edge, + -1, 0.5, 0)

    + +

     

    + +

    # add objects in study

    + +

    id_edge = geompy.addToStudy(edge, + "Edge")

    + +

    edge_points = geompy.SubShapeAllSorted(edge, + geompy.ShapeType["VERTEX"])

    + +

    for point in edge_points:

    + +

        geompy.addToStudyInFather(edge, + point, "Edge's point")

    + +

        

    + +

    id_divide = geompy.addToStudy(divide, + "Divided edge")

    + +

    edge_points = geompy.SubShapeAllSorted(divide, + geompy.ShapeType["VERTEX"])

    + +

    for point in edge_points:

    + +

        geompy.addToStudyInFather(divide, + point, "Edge's point after divide")

    + +

      

    + +

    salome.sg.updateObjBrowser(1) +

    + +

     

    + +

    Check Free Boundaries

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create boxes

    + +

    box1 = geompy.MakeBox(0,0,0,100,50,100)

    + +

    box2 = geompy.MakeBox(100,0,0,250,50,100)

    + +

     

    + +

    # make compound

    + +

    compound = geompy.MakeCompound([box1, + box2])

    + +

     

    + +

    # import from *.brep

    + +

    ImportBREP = geompy.ImportBREP("/tmp/flight_solid.brep")

    + +

     

    + +

    # get face

    + +

    faces = geompy.SubShapeAllSorted(ImportBREP, + geompy.ShapeType["FACE"])

    + +

     

    + +

    # get free boundary for + face 32

    + +

    Res = geompy.GetFreeBoundary(faces[32])

    + +

    isSuccess   = + Res[0]

    + +

    ClosedWires = Res[1]

    + +

    OpenWires   = + Res[2]

    + +

      

    + +

    if + isSuccess == 1 :

    + +

        print + "Checking free boudaries is OK."

    + +

    else :

    + +

        print + "Checking free boudaries is KO!"

    + +

    print "len(ClosedWires) + = ", len(ClosedWires)

    + +

    i = 0

    + +

    for wire in ClosedWires + :

    + +

        wire_name + = "Face 32 -> Close wires : WIRE %d"%(i+1)

    + +

        geompy.addToStudy(ClosedWires[i], + wire_name)

    + +

        if + i < len(ClosedWires) :

    + +

            i + = i+ 1

    + +

    print "len(OpenWires) + = ", len(OpenWires)

    + +

    i = 0

    + +

    for wire in OpenWires + :

    + +

        wire_name + = "Face 32 -> Open wires : WIRE %d"%(i+1)

    + +

        geompy.addToStudy(OpenWires[i], + wire_name)

    + +

        if + i < len(OpenWires) :

    + +

            i + = i+ 1

    + +

     

    + +

    # get free boundary for + face 41

    + +

    Res = geompy.GetFreeBoundary(faces[41])

    + +

    isSuccess   = + Res[0]

    + +

    ClosedWires = Res[1]

    + +

    OpenWires   = + Res[2]

    + +

      

    + +

    if isSuccess == 1 + :

    + +

        print + "Checking free boudaries is OK."

    + +

    else :

    + +

        print + "Checking free boudaries is KO!"

    + +

    print "len(ClosedWires) + = ", len(ClosedWires)

    + +

    i = 0

    + +

    for wire in ClosedWires + :

    + +

        wire_name + = "Face 41 -> Close wires : WIRE %d"%(i+1)

    + +

        geompy.addToStudy(ClosedWires[i], + wire_name)

    + +

        if + i < len(ClosedWires) :

    + +

            i + = i+ 1

    + +

    print "len(OpenWires) + = ", len(OpenWires)

    + +

    i = 0

    + +

    for wire in OpenWires + :

    + +

        wire_name + = "Face 41 -> Open wires : WIRE %d"%(i+1)

    + +

        geompy.addToStudy(OpenWires[i], + wire_name)

    + +

        if + i < len(OpenWires) :

    + +

            i + = i+ 1

    + +

            

    + +

    # add imported object + in study

    + +

    id_ImportBREP = geompy.addToStudy(ImportBREP, + "ImportBREP")

    + +

    salome.sg.updateObjBrowser(1) +

    + +

     

    + +

    Check Free Faces

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(35, + 35, 0)

    + +

    p2 = geompy.MakeVertex(35, + 35, 50)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cylinder

    + +

    cylinder = geompy.MakeCone(p1, + v, 30, 20, 20)

    + +

     

    + +

    # create cone

    + +

    cone = geompy.MakeCone(p1, + v, 70, 40, 60)

    + +

     

    + +

    # make cut

    + +

    cut = geompy.MakeCut(cone, + cylinder)

    + +

     

    + +

    # get faces as sub-shapes

    + +

    faces = []

    + +

    faces = geompy.SubShapeAllSorted(cut, + geompy.ShapeType["FACE"])

    + +

    f_2 = geompy.GetSubShapeID(cut, + faces[0])

    + +

     

    + +

    # remove one face from the shape

    + +

    cut_without_f_2 = + geompy.SuppressFaces(cut, [f_2])

    + +

     

    + +

    # suppress specified wire

    + +

    result = geompy.GetFreeFacesIDs(cut_without_f_2)

    + +

    print "A number + of free faces is ", len(result)

    + +

     

    + +

    # add objects in study

    + +

    all_faces = geompy.SubShapeAllSorted(cut_without_f_2, + geompy.ShapeType["FACE"])

    + +

    for face in all_faces + :

    + +

        sub_shape_id + = geompy.GetSubShapeID(cut_without_f_2, face)

    + +

        if + result.count(sub_shape_id) > 0 :

    + +

            face_name + = "Free face %d"%(sub_shape_id)

    + +

            geompy.addToStudy(face, + face_name)

    + +

     

    + +

    # in this example all faces from cut_without_f_2 are free

    + +

    id_cut_without_f_2 + = geompy.addToStudy(cut_without_f_2, "Cut without f_2")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_cut_without_f_2)

    + +

    gg.setDisplayMode(id_cut_without_f_2,1) +

    + + + + diff --git a/doc/salome/gui/GEOM/revolution.htm b/doc/salome/gui/GEOM/revolution.htm new file mode 100755 index 000000000..f19dcf81a --- /dev/null +++ b/doc/salome/gui/GEOM/revolution.htm @@ -0,0 +1,147 @@ + + + + + +Revolution + + + + + + + + + + + + +

    Revolution

    + +

    To create + an extruded shape by Revolution + in the Main Menu select New Entity - > Generation  - + > Revolution

    + +

     

    + +

    To create an extruded shape by Revolution + you need to define the source Object + to rotate, the Axis of revolution + and the Angle by which the Shape + has to be rotated around the Axis + (in degrees).

    + +

    The Result of + the operation will be a GEOM_Object (edge, face, solid or compsolid).

    + +

     

    + +

    TUI Command: + geompy.MakeRevolution(Shape, Axis, + Angle).

    + +

    Arguments: + Name + 1 shape (vertex, edge, wire, face or shell) serving as base object + + 1 vector (for direction) + 1 value (angle).

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of creation of Complex + Geometric Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/rotation.htm b/doc/salome/gui/GEOM/rotation.htm new file mode 100755 index 000000000..cc5464188 --- /dev/null +++ b/doc/salome/gui/GEOM/rotation.htm @@ -0,0 +1,155 @@ + + + + + +Rotation + + + + + + + + + + + + +

    Rotation

    + +

    To produce + a Rotation in the Main Menu select + Operations - > Transformation - > + Rotation

    + +

     

    + +

    This operation rotates the initial shape. To + produce a Rotation you need to + define an Object  to + be rotated, an Axis of rotation + and an Angle of rotation.

    + +

    Reverse + checkbox allows to specify the direction of rotation.

    + +

    Create a copy + checkbox allows to keep the initial object, otherwise it will be + removed.

    + +

     

    + +

    The + Result will be any  GEOM_Object.

    + +

    TUI Command: + geompy.MakeRotation(Shape, Axis, + Angle)

    + +

    Arguments: + 1 shape + 1 vector for direction of rotation + 1 angle.

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

      

    + +

    Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/scale_transform.htm b/doc/salome/gui/GEOM/scale_transform.htm new file mode 100755 index 000000000..094686751 --- /dev/null +++ b/doc/salome/gui/GEOM/scale_transform.htm @@ -0,0 +1,147 @@ + + + + + +Scale Transform + + + + + + + + + + + + +

     Scale + Transform

    + +

    To produce + a Scale Transform in the Main + Menu select Operations - > Transformation + - > Scale Transform

    + +

     

    + +

    This operation creates a scaled shape basing + on the initial shape. For this, you need to define the Shape + to be scaled, the Central Point + of scale and the Scale Factor.

    + +

    The + Result will be a GEOM_Object.

    + +

    TUI Command: + geompy.MakeScaleTransform(Shape, + CenterOfScale, Factor),

    + +

    Arguments: + Name + 1 shape(s) + 1 vertex + 1 Scale Factor.

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/section.htm b/doc/salome/gui/GEOM/section.htm new file mode 100755 index 000000000..e5681eef6 --- /dev/null +++ b/doc/salome/gui/GEOM/section.htm @@ -0,0 +1,150 @@ + + + + + +Section + + + + + + + + + + + + +

    Section

    + +

    To produce + a Section in the Main Menu select + Operations - > Boolean - > Section

    + +

     

    + +

    This + operation creates the section between 2 shapes.

    + +

     

    + +

    The + Result will be a GEOM_Object + (COMPOUND).

    + +

    TUI Command: +  geompy.MakeSection(s1, + s2)

    + +

    Arguments: + Name + 2 shapes.

    + +

     

    + +

     

    + +

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Boolean + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/sewing.htm b/doc/salome/gui/GEOM/sewing.htm new file mode 100755 index 000000000..abac91a38 --- /dev/null +++ b/doc/salome/gui/GEOM/sewing.htm @@ -0,0 +1,143 @@ + + + + + +Sewing + + + + + + + + + + + +

    Sewing

    + +

    To produce + a Sewing operation in the Main + Menu select Repair - > Sewing.

    + +

     

    + +

    This + operation allows to sew several  shapes.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command : + geompy.MakeSewing(ListOfShape, Precision), + where ListOfShape is list of shapes to be sewed, Precision is a precision + for sewing.

    + +

     

    + +

    + +

     

    + +

    Arguments: + Name + 1 or more shapes + 1 value (sew precision).

    + +

    Detect + button allows to display the number of free boundaries in your + shape:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/shape_processing.htm b/doc/salome/gui/GEOM/shape_processing.htm new file mode 100755 index 000000000..ba0c19f7f --- /dev/null +++ b/doc/salome/gui/GEOM/shape_processing.htm @@ -0,0 +1,302 @@ + + + + + +Shape Processing + + + + + + + + + + + +

    Shape Processing

    + +

    To produce + a Shape Processing operation in + the Main Menu select Repair - > + Shape Processing.

    + +

     

    + +

    This operation processes a shape using various + operators.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.ProcessShape(Shape, Operators, + Parameters, Values), where Shape is a processed shape, Operators + is a list of names of operators ("FixShape", "SplitClosedFaces", + etc.), Parameters is a list of names of parameters (“FixShape.Tolerance3d”, + etc), Values is a list of values of parameters in the same order as the + Parameters list.

    + +

     

    + +

    Arguments: + 1 or more shapes.

    + + + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    1

    +

    SplitAngle – + this operator is intended for splitting faces based on conical surfaces, + surfaces of revolution and cylindrical surfaces by angle

    +

    SplitAngle.Angle – angle (in radians) defining + size of result segments.

    +

    SplitAngle.MaxTolerance – maximal possible + tolerance on result shape

    +

    2

    +

    SplitClosedFaces + – this operator is intended for dividing all closed faces in the shape + according to the number of points.

    +

    SplitClosedFaces.NbSplitPoints – number of + points for cutting each closed faces.

    +

    3

    +

    FixFaceSize + – this operator is intended for removing small faces (case of the spot + face and strip face)

    +

    FixFaceSize.Tolerance – work tolerance defining + which faces will be removed.

    +

    4

    +

    DropSmallEdges + – this operator is intended for removing small edges or merging with neigbour. +  

    +

    DropSmallEdges.Tolerance3d – work tolerance + for detection and removing small edges.

    +

    5

    +

    BsplineRestriction + –this operator is intended for re-approximation BSplines curves and surfaces + or conversion of the curves and surfaces to BSplines with specified parameters. +

    +

    BSplineRestriction.SurfaceMode - mode of approximation + of surfaces if restriction is necessary

    +

    BSplineRestriction.Curve3dMode -mode of conversion + of any 3D curve to BSpline and approximation.

    +

    BSplineRestriction.Curve2dMode - mode of conversion + of any 2D curve to BSpline and approximation

    +

    BSplineRestriction.Tolerance3d – work tolerance + for definition of the possibility of the approximation of the surfaces + and 3D curves with specified parameters.

    +

    BSplineRestriction.Tolerance2d - work tolerance + for definition of the possibility of the approximation of the 2D curves + with specified parameters.

    +

    BSplineRestriction.Continuity3d – desired continuity + of the resultant surfaces and 3D curves.

    +

    BSplineRestriction.Continuity2d – desired continuity + of the resultant 2D curves.

    +

    BSplineRestriction.RequiredDegree - required + degree of the resultant BSplines

    +

    BSplineRestriction.RequiredNbSegments - required + maximum number of segments of resultant BSplines.

    +

    6

    +

    SplitContinuity + – this operator is intended for splitting shapes to achieve continuities + of curves and surfaces less than specified ones.

    +

    SplitContinuity.Tolerance3d - 3D tolerance + for correction of geometry.

    +

    SplitContinuity.SurfaceContinuity - required + continuity for surfaces.

    +

    SplitContinuity.CurveContinuity - required + continuity for curves.

    +

    7

    +

    ToBezier - this + operator is intended for conversion of the curves and surfaces of the + all types into Bezier curves and surfaces.

    +

    ToBezier.SurfaceMode - mode of conversion of + the surfaces.

    +

    ToBezier.Curve3dMode – mode for conversion + of the 3D curves.

    +

    ToBezier.Curve2dMode – mode for conversion + of the 2D curves.

    +

    ToBezier.MaxTolerance – max possible tolerance + on the resultant shape.

    +

    8

    +

    FixShape – this + operator is intended for correction of the invalid shapes

    +

    FixShape.Tolerance3d – work tolerance for detection + of the problems and correction of them.

    +

    FixShape.MaxTolerance3d - maximal possible + tolerance of the shape after correction.

    +

    9

    +

    SameParameter + – this operator is intended for fixing edges having not same parameter + 2D and 3D curves.

    +

    SameParameter.Tolerance3d – tolerance for detection + and fix problems.

    + +

     

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    Shape before applying Shape Processing (FixShape + operator).

    + +

     

    + +

       

    + +

     

    + +

    The + same shape after applying Shape Processing.

    + +

     

    + +

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/shell.htm b/doc/salome/gui/GEOM/shell.htm new file mode 100755 index 000000000..df6d6ee37 --- /dev/null +++ b/doc/salome/gui/GEOM/shell.htm @@ -0,0 +1,132 @@ + + + + + +Shell + + + + + + + + + + + +

    Shell

    + +

    To create + a Shell in the Main Menu select + New Entity - > Build - > Shell

    + +

     

    + +

    You + can create a Shell from a list of faces and (or) + shells.

    + +

    The + Result will be a  GEOM_Object + (SHELL).

    + +

     

    + +

    TUI Command: + geompy.MakeShell(ListOfShape) +

    + +

    Arguments: + Name + List of faces having connected edges.

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/sketcher.htm b/doc/salome/gui/GEOM/sketcher.htm new file mode 100755 index 000000000..c90905659 --- /dev/null +++ b/doc/salome/gui/GEOM/sketcher.htm @@ -0,0 +1,215 @@ + + + + + +Sketcher + + + + + + + + + + + + +

    Sketcher

    + +

    Sketcher allows to create curves of 2 types: line + segment and arc.  The + curve is created from the current point (center of coordinates when the + sketcher is started).  The + end of the curve is defined by means of "destination", which + can be a destination point (for segment only) or destination direction + coupled with length of a segment or angle and radius of an arc.

    + +

     

    + +

    Sketcher is able to create planar curves only. Therefore, it is necessary + to select a working plane before starting a sketch (by default, XOY plane + is used). Sketcher creates curves lying in the current working plane (New + Entity -> Basic -> Working Plane).

    + +

     

    + +

    This functionality is available from the main menu via New + Entity / Sketch.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.MakeSketcher(Command, WorkingPlane)

    + +

    This algorithm creates + a sketcher (wire or face), following the textual description, passed through + the Command argument. The edges of the resulting wire or face will be + arcs of circles and/or linear segments.

    + +

    Command is a string, defining the sketcher by the + coordinates of points in the local working plane.

    + +

    WorkingPlane + is a planar face of the working plane (a list of 9 doubles which are coordinates + of OZ and OX of the local working plane).

    + +

     

    + +

    Arguments: +

    + +

    1. Element type (segment or arc).

    + +

    2. Destination type (point or direction).

    + +

    3. Destination point by means of:

    + + + +

    4. Destination direction by means of:

    + + + +

    5. Parameters of an element (for segment : + length or target X or Y coordinate value, for arc : radius and angle).

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

      

    + +

     

    + +

    Example:

    + +

     

    + +

      

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of the use of Sketcher. +

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/sketcher_tui.htm b/doc/salome/gui/GEOM/sketcher_tui.htm new file mode 100755 index 000000000..6ba4e5ff5 --- /dev/null +++ b/doc/salome/gui/GEOM/sketcher_tui.htm @@ -0,0 +1,176 @@ + + + + + +Sketcher + + + + + + + + + + + +

    Sketcher

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices

    + +

    p1 = geompy.MakeVertex(70., +  0.,  0.)

    + +

    p2 = geompy.MakeVertex(70., + 70., 80.)

    + +

    p3 = geompy.MakeVertex( + 0., 70.,  0.)

    + +

     

    + +

    #create vector with two points

    + +

    vector_arc = geompy.MakeVector(p1, + p3)

    + +

     

    + +

    # create arc with three points

    + +

    arc = geompy.MakeArc(p1, + p2, p3)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vector_arc, + arc])

    + +

     

    + +

    # create planar face

    + +

    isPlanarWanted = 1

    + +

    face = geompy.MakeFace(wire, + isPlanarWanted)

    + +

     

    + +

    # create sketcher (face), following the textual description

    + +

    sketcher1 = geompy.MakeSketcher("Sketcher:F + -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WF",

    + +

                                    [100,0,0, + 1,1,1, -1,1,0])

    + +

     

    + +

    # create sketcher (wire) on the given face

    + +

    sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F + 10 -30:R 10:C 20 180:R 15:L 50:WW",

    + +

                                           face)

    + +

     

    + +

    # add objects in study

    + +

    id_face = geompy.addToStudy(face,"Face")

    + +

    id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")

    + +

    id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")

    + +

     

    + +

    # display first sketcher and second sketcher with its planar face

    + +

    gg.createAndDisplayGO(id_face)

    + +

    gg.setDisplayMode(id_face,1)

    + +

    gg.setTransparency(id_face,0.5)

    + +

    gg.createAndDisplayGO(id_sketcher1)

    + +

    gg.createAndDisplayGO(id_sketcher2) +

    + + + + diff --git a/doc/salome/gui/GEOM/solid.htm b/doc/salome/gui/GEOM/solid.htm new file mode 100755 index 000000000..7e71bd580 --- /dev/null +++ b/doc/salome/gui/GEOM/solid.htm @@ -0,0 +1,133 @@ + + + + + +Solid + + + + + + + + + + + +

     Solid

    + +

    To create + a Solid in the Main Menu select + New Entity - > Build - > Solid.

    + +

     

    + +

    You + can create a Solid from a list + of shells.

    + +

     

    + +

    The + Result will be a +  GEOM_Object + (SOLID).

    + +

     

    + +

    TUI Command: + geompy.MakeSolid(ListOfShape), + where ListOfShape is a list of shells from which the solid is constructed.

    + +

    Arguments: + Name + A closed shell or a list of shells.

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/sphere.htm b/doc/salome/gui/GEOM/sphere.htm new file mode 100755 index 000000000..f2b200bde --- /dev/null +++ b/doc/salome/gui/GEOM/sphere.htm @@ -0,0 +1,160 @@ + + + + + +Sphere + + + + + + + + + + + +

     Sphere

    + +

    To create a Sphere + in the Main Menu select New Entity - > Primitives - > Sphere

    + +

     

    + +

    There are two algorithms for creation of a Sphere. +

    + +

    The + Result of each operation will be a + GEOM_Object (SOLID).

    + +

     

    + +

    Firstly, you can define a Sphere + by the Center Point and the Radius.

    + +

    TUI Command: geompy.MakeSphere(Point, + Radius)

    + +

    Arguments: Name + + 1 vertex + 1 value (Radius).

    + +

    + +

     

    + +

    Secondly, + you can define a Sphere with + the center at the origin of coordinate system by the Radius.

    + +

    TUI Command: geompy. + MakeSphereR(Radius)

    + +

    Arguments: Name + + 1  value + (Radius from the origin).

    + +

    + +

     

    + +

    NB! The + is another way to create a Sphere, + which is currently accessible only via TUI commands.

    + +

    You + can define the Sphere by the + coordinates of the Center Point + (in this way you don't need to create it in advance).

    + +

    TUI + Command: geompy.MakeSphere(X, + Y, Z, Radius)

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Primitives.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/suppress_faces.htm b/doc/salome/gui/GEOM/suppress_faces.htm new file mode 100755 index 000000000..a67a8a697 --- /dev/null +++ b/doc/salome/gui/GEOM/suppress_faces.htm @@ -0,0 +1,135 @@ + + + + + +Suppress Faces + + + + + + + + + + + +

    Suppress Faces

    + +

    To produce + a Suppress Faces operation in + the Main Menu select Repair - > Suppress + Faces.

    + +

     

    + +

    This operation suppresses a face of a shape. + This operation is available in OCC Viewer + only.

    + +

     

    + +

    Result: GEOM_Object + (ListOfGeomShapes).

    + +

    TUI Command: + geompy.SuppressFaces(Shape, ListOfID), + where Shape is a shape to be processed, ListOfID is a list of faces ID's + to be removed.

    + +

    Arguments: + Name + Faces which should be removed (you can select them in the 3D viewer).

    + +

     

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/suppress_holes.htm b/doc/salome/gui/GEOM/suppress_holes.htm new file mode 100755 index 000000000..3206a63ed --- /dev/null +++ b/doc/salome/gui/GEOM/suppress_holes.htm @@ -0,0 +1,149 @@ + + + + + +Suppress Holes + + + + + + + + + + + +

    Suppress Holes

    + +

    To Suppress Holes in the Main Menu select + Repair - > Suppress Holes.

    + +

     

    + +

    This operation removes holes on a selected shape. This + operation is available in OCC + Viewer only.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.SuppressHoles(Shape, ListOfWireID), + where Shape is a shape where holes must be removed, ListOfWireID is a + list of wire sub shapes IDÂ’s. If it is empty, then all holes are removed.

    + +

     

    + +

    + +

     

    + +

    Arguments: Name + + 1 shape + Wires which should be removed.

    + +

    Remove all + holes checkbox allows to fill all holes of a definite shape.

    + +

    Detect button + allows to display the number of free boundaries in your shape:

    + +

     

    + +

    + +

     

    + +

      

    + +

    Example:

    + +

     

    + +

       

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/suppress_internal_wires.htm b/doc/salome/gui/GEOM/suppress_internal_wires.htm new file mode 100755 index 000000000..463cd206a --- /dev/null +++ b/doc/salome/gui/GEOM/suppress_internal_wires.htm @@ -0,0 +1,159 @@ + + + + + +Suppress Internal Wires + + + + + + + + + + + +

    Suppress Internal + Wires

    + +

    To Suppress Internal Wires in the Main + Menu select Repair - > Suppress Internal + Wires.

    + +

     

    + +

    This operation removes all internal wires or + specified internal wires from user specified faces. This operation is + available in OCC Viewer only. +

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.SuppressInternalWires(Shape, + Wires), where Shape is a shape where wires are to be removed, Wires + is a list of wires IDÂ’s to be removed; if the list is empty then all internal + wires are removed.

    + +

     

    + +

     

    + +

    Arguments:

    + + + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

       

    + +

     

    + +

    Our + TUI Scripts provide you with useful + examples of the use of Repairing + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/transformation_operations.htm b/doc/salome/gui/GEOM/transformation_operations.htm new file mode 100755 index 000000000..5cf40c1c9 --- /dev/null +++ b/doc/salome/gui/GEOM/transformation_operations.htm @@ -0,0 +1,1069 @@ + + + + + +Transformation Operations + + + + + + + + + + + +

    Transformation Operations

    + +

    Translation

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(10, + 40, 0)

    + +

    p2 = geompy.MakeVertex( + 0,  0, 50)

    + +

    p3 = geompy.MakeVertex(50, + 80, 0)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

    vt = geompy.MakeVector(p1, + p3)

    + +

     

    + +

    # create cylinder

    + +

    height = 35

    + +

    radius1 = 20

    + +

    cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

    + +

     

    + +

    # translate the given object along the vector, specified by its end + points

    + +

    # (all three functions produce the same result)

    + +

    translation1 = geompy.MakeTranslationTwoPoints(cylinder, + p1, p3)

    + +

    translation2 = geompy.MakeTranslation(cylinder, + 40, 40, 0)

    + +

    translation3 = geompy.MakeTranslationVector(cylinder, + vt)

    + +

     

    + +

    # add objects in study

    + +

    id_cylinder = geompy.addToStudy(cylinder, + "Cylinder")

    + +

    id_translation1 = + geompy.addToStudy(translation1, "Translation1")

    + +

    id_translation2 = + geompy.addToStudy(translation2, "Translation2")

    + +

    id_translation3 = + geompy.addToStudy(translation3, "Translation3")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_cylinder)

    + +

    gg.setDisplayMode(id_cylinder,1)

    + +

    gg.createAndDisplayGO(id_translation1)

    + +

    gg.setDisplayMode(id_translation1,1)

    + +

    gg.createAndDisplayGO(id_translation2)

    + +

    gg.setDisplayMode(id_translation2,1)

    + +

    gg.createAndDisplayGO(id_translation3)

    + +

    gg.setDisplayMode(id_translation3,1) +

    + +

    Rotation

    + +

    import geompy

    + +

    import salome

    + +

    import math

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(10, + 40, 0)

    + +

    p2 = geompy.MakeVertex( + 0,  0, 50)

    + +

    p3 = geompy.MakeVertex(10, + 50,-20)

    + +

    p4 = geompy.MakeVertex(10, + 50, 60)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

    vr = geompy.MakeVector(p3, + p4)

    + +

     

    + +

    # create cylinder

    + +

    height = 35

    + +

    radius1 = 20

    + +

    cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

    + +

     

    + +

    # rotate the given object around the given axis on the given angle

    + +

    rotation = geompy.MakeRotation(cylinder, + vr, math.pi)

    + +

     

    + +

    # add objects in study

    + +

    id_vr = geompy.addToStudy(vr, + "Rotation axis")

    + +

    id_cylinder = geompy.addToStudy(cylinder, + "Cylinder")

    + +

    id_rotation = geompy.addToStudy(rotation, + "Rotation")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_vr)

    + +

    gg.createAndDisplayGO(id_cylinder)

    + +

    gg.setDisplayMode(id_cylinder,1)

    + +

    gg.createAndDisplayGO(id_rotation)

    + +

    gg.setDisplayMode(id_rotation,1) +

    + +

     

    + +

    Modify Location

    + +

    import geompy

    + +

    import salome

    + +

    import math

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertex and vector

    + +

    p1 = geompy.MakeVertex(10, + 40, 0)

    + +

    p2 = geompy.MakeVertex( + 0,  0, 50)

    + +

    v = geompy.MakeVector(p1, + p2)

    + +

     

    + +

    # create cylinder

    + +

    height = 35

    + +

    radius1 = 20

    + +

    cylinder = geompy.MakeCylinder(p1, + v, radius1, height)

    + +

     

    + +

    # create local coordinate systems

    + +

    cs1 = geompy.MakeMarker( + 0, 0, 0, 1,0,0, 0,1,0)

    + +

    cs2 = geompy.MakeMarker(30,40,40, + 1,0,0, 0,1,0)

    + +

     

    + +

    # modify the location of the given object

    + +

    position = geompy.MakePosition(cylinder, + cs1, cs2)

    + +

     

    + +

    # add objects in study

    + +

    id_cs1 = geompy.addToStudy(cs1, + "Coordinate system 1")

    + +

    id_cs2 = geompy.addToStudy(cs2, + "Coordinate system 2")

    + +

    id_cylinder = geompy.addToStudy(cylinder, + "Cylinder")

    + +

    id_position = geompy.addToStudy(position, + "Position")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_cylinder)

    + +

    gg.setDisplayMode(id_cylinder,1)

    + +

    gg.createAndDisplayGO(id_position)

    + +

    gg.setDisplayMode(id_position,1) +

    + +

     

    + +

    Mirror Image

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create box

    + +

    box = geompy.MakeBoxDXDYDZ(200, + 200, 200)

    + +

     

    + +

    # create an object, symmetrical to the given one relatively the given + plane

    + +

    p1 = geompy.MakeVertex( + 0, 25,  0)

    + +

    p2 = geompy.MakeVertex( + 5, 25,  0)

    + +

    p3 = geompy.MakeVertex( + 0,-30, 40)

    + +

    plane = geompy.MakePlaneThreePnt(p1, + p2, p3, 1000.)

    + +

    mirror1 = geompy.MakeMirrorByPlane(box, + plane)

    + +

     

    + +

    # create an object, symmetrical to the given one relatively the given + axis

    + +

    p4 = geompy.MakeVertex( + 210, 210, -20)

    + +

    p5 = geompy.MakeVertex( + 210, 210, 220)

    + +

    axis = geompy.MakeVector(p4, + p5)

    + +

    mirror2 = geompy.MakeMirrorByAxis(box, + axis)

    + +

     

    + +

    # create an object, symmetrical to the given one relatively the given + point

    + +

    mirror3 = geompy.MakeMirrorByPoint(box, + p4)

    + +

     

    + +

    # add objects in study

    + +

    id_box = geompy.addToStudy(box, + "Box")

    + +

    id_plane = geompy.addToStudy(plane, + "Plane")

    + +

    id_mirror1 = geompy.addToStudy(mirror1, + "Mirror plane")

    + +

    id_axis = geompy.addToStudy(axis, + "Axis")

    + +

    id_mirror2 = geompy.addToStudy(mirror2, + "Mirror axis")

    + +

    id_p4 = geompy.addToStudy(p4, + "Point")

    + +

    id_mirror3 = geompy.addToStudy(mirror3, + "Mirror point")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_box)

    + +

    gg.setDisplayMode(id_box,1)

    + +

    gg.createAndDisplayGO(id_plane)

    + +

    gg.createAndDisplayGO(id_mirror1)

    + +

    gg.setDisplayMode(id_mirror1,1)

    + +

    gg.createAndDisplayGO(id_axis)

    + +

    gg.createAndDisplayGO(id_mirror2)

    + +

    gg.setDisplayMode(id_mirror2,1)

    + +

    gg.createAndDisplayGO(id_p4)

    + +

    gg.createAndDisplayGO(id_mirror3)

    + +

    gg.setDisplayMode(id_mirror3,1) +

    + +

     

    + +

    Scale Transform

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create box and sphere

    + +

    box = geompy.MakeBoxDXDYDZ(200, + 200, 200)

    + +

     

    + +

    # scale the given object by the factor

    + +

    p0 = geompy.MakeVertex(100, + 100, 100)

    + +

    factor = 0.5

    + +

    scale = geompy.MakeScaleTransform(box, + p0, factor)

    + +

     

    + +

    # add objects in study

    + +

    id_box = geompy.addToStudy(box, + "Box")

    + +

    id_scale = geompy.addToStudy(scale, + "Scale")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_box)

    + +

    gg.setDisplayMode(id_box,1)

    + +

    gg.createAndDisplayGO(id_scale)

    + +

    gg.setDisplayMode(id_scale,1) +

    + +

     

    + +

    Offset Surface

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create box and sphere

    + +

    box = geompy.MakeBox(20, + 20, 20, 200, 200, 200)

    + +

     

    + +

    # create new object as offset of the given one

    + +

    offset = geompy.MakeOffset(box, + 70.)

    + +

     

    + +

    # add objects in study

    + +

    id_box = geompy.addToStudy(box, + "Box")

    + +

    id_offset = geompy.addToStudy(offset, + "Offset")

    + +

     

    + +

    # display results

    + +

    gg.createAndDisplayGO(id_box)

    + +

    gg.setDisplayMode(id_box,1)

    + +

    gg.createAndDisplayGO(id_offset) +

    + +

     

    + +

    Multi Translation

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices and vectors

    + +

    p0  = + geompy.MakeVertex( 0.,  0., +  0.)

    + +

    px  = + geompy.MakeVertex(20.,  0., +  0.)

    + +

    py  = + geompy.MakeVertex( 0., 20.,  0.)

    + +

    pz  = + geompy.MakeVertex( 0.,  0., + 20.)

    + +

    pxy = geompy.MakeVertex( + 50., 0., 0.)

    + +

    pxyz = geompy.MakeVertex( + 50., 50., 50.)

    + +

    vz  = + geompy.MakeVector(p0, pz)

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

    vtr1d = geompy.MakeVector(p0, + pxyz)

    + +

    vtr2d = geompy.MakeVector(p0, + pxy)

    + +

      

    + +

    # create arc

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # create planar face

    + +

    face = geompy.MakeFace(wire, + 1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrismVecH(face, + vz, 20.0)

    + +

     

    + +

    # translate the given object along the given vector a given number times

    + +

    tr1d = geompy.MakeMultiTranslation1D(prism, + vtr1d, 20, 4)

    + +

     

    + +

    # consequently apply two specified translations to the object specified + number of times

    + +

    tr2d = geompy.MakeMultiTranslation2D(prism, + vtr1d, 20, 4, vtr2d, 80, 3)

    + +

     

    + +

    # add objects in study

    + +

    id_prism = geompy.addToStudy(prism,"Prism")

    + +

    id_tr1d = geompy.addToStudy(tr1d,"Translation + 1D")

    + +

    id_tr2d = geompy.addToStudy(tr2d,"Translation + 2D")

    + +

     

    + +

    # display prism and results of fillet operation

    + +

    gg.createAndDisplayGO(id_prism)

    + +

    gg.setDisplayMode(id_prism,1)

    + +

    gg.createAndDisplayGO(id_tr1d)

    + +

    gg.setDisplayMode(id_tr1d,1)

    + +

    gg.createAndDisplayGO(id_tr2d)

    + +

    gg.setDisplayMode(id_tr2d,1) +

    + +

     

    + +

    Multi Rotation

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

     

    + +

    # create vertices and vectors

    + +

    p0  = + geompy.MakeVertex( 0.,  0., +  0.)

    + +

    px  = + geompy.MakeVertex(20.,  0., +  0.)

    + +

    py  = + geompy.MakeVertex( 0., 20.,  0.)

    + +

    pz  = + geompy.MakeVertex( 0.,  0., + 20.)

    + +

    pxyz = geompy.MakeVertex( + 50., 50., 10.)

    + +

    vz  = + geompy.MakeVector(p0, pz)

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

    vrot1d = geompy.MakeVector(p0, + pxyz)

    + +

      

    + +

    # create arc

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # create planar face

    + +

    face = geompy.MakeFace(wire, + 1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrismVecH(face, + vz, 20.0)

    + +

     

    + +

    # rotate the given object around the given axis on the given angle a + given number times

    + +

    rot1d = geompy.MultiRotate1D(prism, + vrot1d, 4)

    + +

     

    + +

    # rotate the given object around the given axis on the given angle a + given number times

    + +

    # and multi-translate each rotation result

    + +

    rot2d = geompy.MultiRotate2D(prism, + vrot1d, 60, 4, 50, 5)

    + +

     

    + +

    # add objects in study

    + +

    id_prism = geompy.addToStudy(prism,"Prism")

    + +

    id_rot1d = geompy.addToStudy(rot1d,"Rotation + 1D")

    + +

    id_rot2d = geompy.addToStudy(rot2d,"Rotation + 2D")

    + +

     

    + +

    # display prism and results of fillet operation

    + +

    gg.createAndDisplayGO(id_prism)

    + +

    gg.setDisplayMode(id_prism,1)

    + +

    gg.createAndDisplayGO(id_rot1d)

    + +

    gg.setDisplayMode(id_rot1d,1)

    + +

    gg.createAndDisplayGO(id_rot2d)

    + +

    gg.setDisplayMode(id_rot2d,1) +

    + +

     

    + +

    Fillet

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

    radius  = + 10.

    + +

    ShapeTypeEdge = geompy.ShapeType["EDGE"]

    + +

     

    + +

    # create vertices and vectors

    + +

    p0  = + geompy.MakeVertex(  0., +   0., +   0.)

    + +

    px  = + geompy.MakeVertex(100.,   0., +   0.)

    + +

    py  = + geompy.MakeVertex(  0., + 100.,   0.)

    + +

    pz  = + geompy.MakeVertex(  0., +   0., + 100.)

    + +

    vz  = + geompy.MakeVector(p0, pz)

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

      

    + +

    # create arc

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # create planar face

    + +

    face = geompy.MakeFace(wire, + 1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrismVecH(face, + vz, 100.0)

    + +

     

    + +

    # get IDList for fillet

    + +

    prism_edges = geompy.SubShapeAllSorted(prism, + ShapeTypeEdge)

    + +

    IDlist_e = []

    + +

    IDlist_e.append(geompy.GetSubShapeID(prism, + prism_edges[0]))

    + +

    IDlist_e.append(geompy.GetSubShapeID(prism, + prism_edges[1]))

    + +

    IDlist_e.append(geompy.GetSubShapeID(prism, + prism_edges[2]))

    + +

     

    + +

    # make fillet on the specified edges of the given shape

    + +

    fillet = geompy.MakeFillet(prism, + radius, ShapeTypeEdge, IDlist_e)

    + +

     

    + +

    # make fillet on all edges of the given shape

    + +

    filletall = geompy.MakeFilletAll(prism, + radius)

    + +

     

    + +

    # add objects in study

    + +

    id_prism = geompy.addToStudy(prism,"Prism")

    + +

    id_fillet = geompy.addToStudy(fillet,"Fillet")

    + +

    id_filletall = geompy.addToStudy(filletall,"Fillet + all")

    + +

     

    + +

    # display prism and results of fillet operation

    + +

    gg.createAndDisplayGO(id_prism)

    + +

    gg.setDisplayMode(id_prism,1)

    + +

    gg.createAndDisplayGO(id_fillet)

    + +

    gg.setDisplayMode(id_fillet,1)

    + +

    gg.createAndDisplayGO(id_filletall)

    + +

    gg.setDisplayMode(id_filletall,1) +

    + +

     

    + +

    Chamfer

    + +

    import geompy

    + +

    import salome

    + +

    gg = salome.ImportComponentGUI("GEOM")

    + +

    d1 = 10.

    + +

    d2 = 10.

    + +

    ShapeTypeFace = geompy.ShapeType["FACE"]

    + +

     

    + +

    # create vertices and vectors

    + +

    p0  = + geompy.MakeVertex(  0., +   0., +   0.)

    + +

    px  = + geompy.MakeVertex(100.,   0., +   0.)

    + +

    py  = + geompy.MakeVertex(  0., + 100.,   0.)

    + +

    pz  = + geompy.MakeVertex(  0., +   0., + 100.)

    + +

    vz  = + geompy.MakeVector(p0, pz)

    + +

    vxy = geompy.MakeVector(px, + py)

    + +

      

    + +

    # create arc

    + +

    arc = geompy.MakeArc(py, + pz, px)

    + +

     

    + +

    # create wire

    + +

    wire = geompy.MakeWire([vxy, + arc])

    + +

     

    + +

    # create planar face

    + +

    face = geompy.MakeFace(wire, + 1)

    + +

     

    + +

    # create prism

    + +

    prism = geompy.MakePrismVecH(face, + vz, 100.0)

    + +

     

    + +

    # get IDList for chamfer

    + +

    prism_faces = geompy.SubShapeAllSorted(prism, + ShapeTypeFace)

    + +

    f_ind_1 = geompy.GetSubShapeID(prism, + prism_faces[0])

    + +

    f_ind_2 = geompy.GetSubShapeID(prism, + prism_faces[1])

    + +

    IDlist_f = [f_ind_1, + f_ind_2]

    + +

     

    + +

    # perform a chamfer on edges, common to the specified faces

    + +

    chamfer_e = geompy.MakeChamferEdge(prism, + d1, d2, f_ind_1, f_ind_2)

    + +

     

    + +

    # perform a chamfer on all edges of the specified faces

    + +

    chamfer_f = geompy.MakeChamferFaces(prism, + d1, d2, IDlist_f)

    + +

    chamfer_f1 = geompy.MakeChamfer(prism, + d1, d2, ShapeTypeFace, IDlist_f)

    + +

     

    + +

    # perform a symmetric chamfer on all edges of the given shape

    + +

    chamfer_all = geompy.MakeChamferAll(prism, + d1)

    + +

     

    + +

    # add objects in study

    + +

    id_prism = geompy.addToStudy(prism,"Prism")

    + +

    id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer + edge")

    + +

    id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer + faces")

    + +

    id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer + faces 1")

    + +

    id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer + all")

    + +

     

    + +

    # display prism and results of chamfer operation

    + +

    gg.createAndDisplayGO(id_prism)

    + +

    gg.setDisplayMode(id_prism,1)

    + +

    gg.createAndDisplayGO(id_chamfer_e)

    + +

    gg.setDisplayMode(id_chamfer_e,1)

    + +

    gg.createAndDisplayGO(id_chamfer_f)

    + +

    gg.setDisplayMode(id_chamfer_f,1)

    + +

    gg.createAndDisplayGO(id_chamfer_f1)

    + +

    gg.setDisplayMode(id_chamfer_f1,1)

    + +

    gg.createAndDisplayGO(id_chamfer_all)

    + +

    gg.setDisplayMode(id_chamfer_all,1) +

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/translation.htm b/doc/salome/gui/GEOM/translation.htm new file mode 100755 index 000000000..83cc3bfff --- /dev/null +++ b/doc/salome/gui/GEOM/translation.htm @@ -0,0 +1,187 @@ + + + + + +Translation + + + + + + + + + + + + +

    Translation

    + +

    To produce + a Translation in the Main Menu + select Operations - > Transformation + - > Translation

    + +

     

    + +

    This Operation makes a translation of an Object. To translate a shape you need + to define the base shape and the coordinates of the vector of translation. + Create a copy checkbox allows + to keep the initial object, otherwise it will be removed.

    + +

    The + Result of all operations will be any + GEOM_Object.

    + +

     

    + +

    Firstly you can define an Object + and the vector coordinates along the axes.

    + +

    TUI Command: + geompy.MakeTranslation(Shape, DX, + DY, DZ), where Shape is a shape to be translated, DX, DY, DZ are + components of translation vector.

    + +

    Arguments: + Name + 1 shape + 3 values (coordinates).

    + +

     

    + +

    + +

     

    + +

    Secondly you can define an Object + and the start and the end points of the vector  

    + +

    TUI Command: + geompy.MakeTranslationTwoPoints(Object, + Point1, Point2)

    + +

    Arguments: + Name + 1 shape + 2 vertices

    + +

     

    + +

    + +

     

    + +

    Finally you can define an Object and + the vector  

    + +

    TUI Command: + geompy.MakeTranslationVector(Object, Vector)

    + +

    Arguments: + Name + 1 shape + 1 vector.

    + +

     

    + +

    + +

        

    + +

     

    + +

    Example:

    + +

     

    + +

     

    + +

     

    + +

      Our TUI Scripts + provide you with useful examples of the use of Transformation + Operations.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/turus.htm b/doc/salome/gui/GEOM/turus.htm new file mode 100755 index 000000000..4ee8a4f4b --- /dev/null +++ b/doc/salome/gui/GEOM/turus.htm @@ -0,0 +1,147 @@ + + + + + +Turus + + + + + + + + + + + +

    Torus

    + +

    To create a Torus + in the Main Menu select New Entity - > Primitives - > Torus

    + +

     

    + +

    There are two algorithms for creation of a Torus. +

    + +

    The + Result of each operation will be a + GEOM_Object (SOLID).

    + +

     

    + +

    Firstly, you can define a Torus + by the given Base Point, the normal + Vector and the Major and Minor + Radiuses.

    + +

    TUI Command: geompy.MakeTorus(Point, + Vector, RadiusMajor, RadiusMinor) ,

    + +

    Arguments: + Name + 1 vertex + + 1 vector (for direction) + 2 values (1 & 2 Radius).

    + +

    + +

     

    + +

    Secondly, you can define a Torus with the centre at the origin of coordinates + by its Major and Minor Radiuses. +

    + +

    TUI Command: geompy.MakeTorusRR(RadiusMajor, + RadiusMinor)

    + +

    Arguments: + Name + 2 values (1 & 2 Radius from the origin).

    + +

    + +

     

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Primitives.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/vector.htm b/doc/salome/gui/GEOM/vector.htm new file mode 100755 index 000000000..5a2000660 --- /dev/null +++ b/doc/salome/gui/GEOM/vector.htm @@ -0,0 +1,151 @@ + + + + + +Vector + + + + + + + + + + + +

    Vector

    + +

    To + create a Vector in the Main + Menu select New Entity - > + Basic - > Vector

    + +

     

    + +

    There + are 2 algorithms to create a Circle in + the 3D space.

    + +

    The + Result of each operation will be a + GEOM_Object (edge).

    + +

     

    + +

    Firstly, + you can define a Vector by its + Start and End Points

    + +

    TUI Command:  geompy.MakeVector(Point1, + Point2)

    + +

    Arguments + : Name + 2 vertices.

    + +

     

    + +

    + +

     

    + +

    Secondly, you can define a Vector + starting in the Origin of coordinates + by its End Point.

    + +

    TUI Command: +  geompy.MakeVectorDXDYDZ(DX, + DY, DZ)

    + +

    Arguments + : Name + 3 values

    + +

     

    + +

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Basic + Geometric Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/whdata/whftdata0.htm b/doc/salome/gui/GEOM/whdata/whftdata0.htm new file mode 100755 index 000000000..78a9ccb88 --- /dev/null +++ b/doc/salome/gui/GEOM/whdata/whftdata0.htm @@ -0,0 +1,104 @@ + + + + + + + + + + + diff --git a/doc/salome/gui/GEOM/whdata/whfts.htm b/doc/salome/gui/GEOM/whdata/whfts.htm new file mode 100755 index 000000000..623fb674a --- /dev/null +++ b/doc/salome/gui/GEOM/whdata/whfts.htm @@ -0,0 +1,18 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/GEOM/whdata/whfwdata0.htm b/doc/salome/gui/GEOM/whdata/whfwdata0.htm new file mode 100755 index 000000000..1314a91c3 --- /dev/null +++ b/doc/salome/gui/GEOM/whdata/whfwdata0.htm @@ -0,0 +1,1260 @@ + + + + + + + + + + + diff --git a/doc/salome/gui/GEOM/whdata/whtdata0.htm b/doc/salome/gui/GEOM/whdata/whtdata0.htm new file mode 100755 index 000000000..6da6be60a --- /dev/null +++ b/doc/salome/gui/GEOM/whdata/whtdata0.htm @@ -0,0 +1,110 @@ + + + + + + + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf0.htm b/doc/salome/gui/GEOM/whgdata/whlstf0.htm new file mode 100755 index 000000000..ca47d334b --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf0.htm @@ -0,0 +1,46 @@ + + +Search Words List + + + + + + + +

    + + +100x30x100
    1d 1 2 3 4
    1e 1 2
    1st 1 2 3 4 5 6
    2d 1 2 3 4 5 6 7 8 9 10 11
    2nd 1 2 3 4 5 6
    2st
    3d 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    3rd 1 2 3
    3st
    +

    +able
    absolute
    accessible 1 2 3 4 5
    accordance 1 2 3
    according 1 2 3 4 5
    achieve 1 2
    add 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    added 1 2 3
    adding
    addobject 1 2
    addtostudy 1 2 3 4 5 6 7 8 9 10 11 12 13
    addtostudyinfather 1 2
    adjustment
    advance 1 2 3
    advanced 1 2 3 4 5 6 7 8 9
    aimed
    algorithm 1 2 3
    algorithms 1 2 3 4 5 6 7 8 9 10 11
    all_faces
    allowing 1 2
    allows 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    along 1 2 3 4 5 6 7 8 9 10
    alongside
    already
    angle 1 2 3 4 5 6 7 8 9 10
    another 1 2 3 4 5 6
    any 1 2 3 4 5 6
    append 1 2
    applicable 1 2
    applied 1 2
    apply 1 2 3 4
    applying 1 2
    approximation 1 2
    arc 1 2 3 4 5 6 7 8 9
    arc1
    arc2
    archimede 1 2 3
    arcs 1 2
    area
    argument 1 2 3
    arguments 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    around 1 2 3 4
    associated
    attributes
    automatically 1 2 3
    available 1 2 3 4 5 6 7 8 9 10
    axes 1 2 3 4
    axis 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    +

    +b 1 2
    background
    base 1 2 3 4 5 6 7 8 9 10
    based 1 2
    baseshape 1 2
    basic 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    basicproperties 1 2
    basing 1 2 3
    basis 1 2
    bb


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf1.htm b/doc/salome/gui/GEOM/whgdata/whlstf1.htm new file mode 100755 index 000000000..be0246f51 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf1.htm @@ -0,0 +1,43 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +before 1 2 3 4
    beginning
    being
    below
    besier
    bezier 1 2 3 4 5
    block 1 2 3 4 5 6
    blocks 1 2 3 4 5 6 7 8 9 10
    boolean 1 2 3 4 5 6 7 8 9
    both 1 2 3 4
    boudaries
    boundaries 1 2 3 4 5
    boundary 1 2 3 4
    bounded 1 2
    bounding 1 2
    boundingbox 1 2
    box 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    box_tr1
    box_tr2
    box1 1 2 3
    box2 1 2 3
    box3
    boxes 1 2 3
    breaks 1 2
    brep 1 2 3
    browser 1 2 3 4 5 6 7
    bspline 1 2
    bsplinerestriction 1 2
    bsplines 1 2
    build 1 2 3 4 5 6 7 8 9 10 11
    building 1 2 3 4 5
    builds 1 2 3 4
    button 1 2 3 4 5 6
    bypassing
    +

    +c 1 2
    cad
    camera 1 2
    case 1 2 3 4 5 6
    cases
    center 1 2 3 4 5 6 7 8 9 10 11
    centerofscale 1 2
    centers
    central 1 2 3 4
    centre 1 2
    chain
    chamfer 1 2 3
    chamfer_all
    chamfer_e
    chamfer_f
    chamfer_f1
    change
    changes
    changing 1 2
    check 1 2 3 4 5 6 7 8
    check_box
    checkandimprove
    checkbox 1 2 3 4 5 6 7 8
    checkcompoundofblocks 1 2
    checked 1 2 3 4 5
    checking 1 2 3 4 5
    checks
    checkshape 1 2 3
    choices
    choose 1 2 3 4
    circle 1 2 3 4
    circle1
    circle2
    circles 1 2
    click 1 2 3
    close 1 2 3
    closecontour 1 2 3
    closed 1 2 3 4 5 6
    closedwires 1 2 3
    closes 1 2
    closure 1 2
    cm
    coincident 1 2
    collinear 1 2
    color 1 2
    command 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
    commands 1 2 3 4 5 6 7 8 9
    common 1 2 3 4 5 6
    complex 1 2 3 4 5 6 7 8 9
    components 1 2 3 4 5 6 7 8
    composed
    composing
    compound 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
    compsolid 1 2 3 4
    compsolids
    compute 1 2
    computed
    concerning
    conditions
    cone 1 2 3 4
    cone1
    cone2
    cones
    confirm
    conical 1 2
    connected 1 2 3 4 5 6 7
    connection
    consequently
    considered 1 2 3 4
    console
    constraints
    construct
    constructed 1 2 3
    constructing
    construction 1 2 3 4
    constructor 1 2 3 4 5 6
    contain 1 2
    contained 1 2 3
    contains 1 2 3
    contents 1 2
    continuities 1 2
    continuity 1 2
    continuity2d 1 2
    continuity3d 1 2
    contour 1 2 3
    conversion 1 2
    coordinate 1 2 3 4 5 6 7 8 9 10 11
    coordinates 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    coords
    copy 1 2 3 4 5
    corners 1 2 3
    correction 1 2
    correspond 1 2 3
    corresponding 1 2 3 4 5
    correspondingly 1 2 3 4 5 6 7
    count
    coupled
    covering


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf10.htm b/doc/salome/gui/GEOM/whgdata/whlstf10.htm new file mode 100755 index 000000000..ef28b5370 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf10.htm @@ -0,0 +1,47 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +pz 1 2 3 4 5 6
    +

    +qface1
    qface2
    qface3
    qface4
    qface5
    qface6
    qface7
    qface8
    quadrangle 1 2 3 4 5
    +

    +r 1 2 3
    radians 1 2
    radius 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    radius1 1 2 3 4 5 6
    radius2 1 2 3
    radius3
    radiuses 1 2 3 4 5 6
    radiusmajor 1 2 3 4
    radiusminor 1 2 3 4
    raise 1 2
    range 1 2 3 4
    re 1 2
    reasonable
    reconstruction 1 2
    reference 1 2 3
    regarding 1 2
    relative
    relatively
    remove 1 2 3 4 5
    removed 1 2 3 4 5 6 7 8 9 10 11
    removeobject 1 2
    removes 1 2 3
    removewebs 1 2
    removing 1 2 3
    repair 1 2 3 4 5 6 7 8 9 10 11
    repairing 1 2 3 4 5 6 7 8 9 10 11 12 13
    repetition 1 2 3
    repetitions 1 2
    representing 1 2
    requested
    required 1 2 3 4
    requireddegree 1 2
    requirednbsegments 1 2
    res
    respect 1 2 3
    restriction 1 2
    result 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    resultant 1 2
    resulting 1 2 3 4 5 6 7
    results 1 2 3 4 5 6
    retrieved
    retrieves 1 2
    return
    returned 1 2 3
    returning
    returns 1 2 3 4 5 6 7 8
    reverse 1 2 3
    revolution 1 2 3 4 5
    right 1 2
    rot1d
    rot2d
    rotate 1 2 3
    rotated 1 2 3 4 5
    rotates 1 2 3
    rotation 1 2 3 4 5
    runtimeerror 1 2
    +

    +s 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    s1 1 2 3
    s2 1 2 3
    salome 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
    same 1 2 3 4 5
    sameparameter 1 2
    satisfy
    scale 1 2 3
    scaled 1 2
    scripts 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf11.htm b/doc/salome/gui/GEOM/whgdata/whlstf11.htm new file mode 100755 index 000000000..aa8fe657c --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf11.htm @@ -0,0 +1,41 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +search
    second 1 2 3 4 5 6 7 8 9
    secondly 1 2 3 4 5 6 7 8 9 10 11 12
    section 1 2 3 4 5
    see 1 2
    seems
    segment
    segments 1 2 3
    select 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    selected 1 2 3 4 5 6 7 8 9
    selecting
    selection 1 2 3 4 5 6
    sense 1 2
    separate
    serve 1 2
    serving 1 2 3 4
    set 1 2 3 4 5 6 7 8 9
    setcolor 1 2
    setdisplaymode 1 2 3 4 5 6 7 8 9 10 11 12 13
    sets
    setting 1 2 3 4 5
    settransparency 1 2 3 4 5
    sew 1 2
    sewed 1 2
    sewing 1 2 3
    sg 1 2 3 4
    shading
    shape 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    shape1 1 2
    shape2 1 2
    shapelistcompound
    shapes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    shapes_of_given_type
    shapesto 1 2
    shapetype 1 2 3 4 5 6 7
    shapetypeedge
    shapetypeface
    shared 1 2
    shell 1 2 3 4 5 6 7 8 9 10 11
    shells 1 2 3 4 5 6 7 8 9
    shift 1 2
    short
    shortcut
    should 1 2 3 4 5 6
    show
    shown 1 2
    side 1 2
    signed 1 2
    similar
    simple 1 2 3
    single
    six 1 2
    size 1 2 3 4 5 6
    sketch
    sketcher 1 2 3
    sketcher1 1 2
    sketcher2 1 2
    sketcher3
    sketchers
    small 1 2 3 4
    so
    solid 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    solid1
    solid2
    solids 1 2 3 4
    soon 1 2
    sorted
    sorts
    source
    space 1 2 3 4 5 6 7
    specific
    specified 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    specifies 1 2
    specify 1 2
    specifying 1 2
    sphere 1 2 3 4 5 6 7
    sphere1
    sphere2
    sphere3
    spheres
    spline 1 2
    splitangle 1 2
    splitclosedfaces 1 2
    splitcontinuity 1 2
    splits 1 2
    splitting 1 2
    spot 1 2


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf12.htm b/doc/salome/gui/GEOM/whgdata/whlstf12.htm new file mode 100755 index 000000000..08b7291d9 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf12.htm @@ -0,0 +1,43 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +sqrt
    stage
    standard
    start 1 2 3
    started
    starting 1 2 3 4 5 6
    step 1 2 3 4 5
    step1 1 2
    step2 1 2
    string
    strip 1 2
    study 1 2 3 4 5 6 7 8 9 10 11 12
    sub 1 2 3 4 5 6
    sub_shape_id
    subfacelist
    submenu 1 2 3 4
    subshape 1 2 3 4
    subshapeall 1 2
    subshapeallids
    subshapeallsorted 1 2 3 4 5
    subshapeallsortedids
    subshapeid
    subshapes 1 2 3
    subshapesorted
    successfully
    sup_faces
    suppress 1 2 3 4 5
    suppresses 1 2
    suppressfaces 1 2 3
    suppressholes 1 2 3
    suppressinternalwires 1 2 3
    surface 1 2 3 4 5 6 7
    surfacecontinuity 1 2
    surfacemode 1 2
    surfaces 1 2
    symmetric
    symmetrical 1 2 3
    symmetry 1 2 3
    system 1 2 3 4 5 6 7 8 9
    systems
    +

    +t 1 2 3
    tangent
    target 1 2 3
    tetrahedral
    textual 1 2
    theendlcs 1 2
    them 1 2 3 4 5 6
    theobject 1 2
    therefore
    theshape 1 2 3
    thestartlcs 1 2
    thetolerance 1 2
    third
    three 1 2 3 4 5 6 7 8 9 10 11 12
    time 1 2
    times 1 2 3 4
    tmp
    tobezier 1 2
    toggle
    tol2d 1 2 3
    tol3d 1 2 3
    toler
    tolerance 1 2 3 4 5 6 7 8
    tolerance2d 1 2
    tolerance3d 1 2 3
    tolerances
    tool
    tools 1 2
    top_face
    top_face_ind
    torus 1 2 3 4
    torus1
    torus2
    toruses
    tr1d
    tr2d
    transform 1 2 3
    transformate
    transformation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
    transformations 1 2 3
    transformed 1 2 3
    transforms
    translate 1 2
    translated 1 2 3
    translates 1 2
    translation 1 2 3 4 5 6
    translation1
    translation2
    translation3
    translations 1 2 3 4 5
    transparency 1 2
    trihedron 1 2
    trimsize 1 2 3 4
    true 1 2 3 4 5 6 7
    truncated
    try
    tt 1 2


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf13.htm b/doc/salome/gui/GEOM/whgdata/whlstf13.htm new file mode 100755 index 000000000..adef489a6 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf13.htm @@ -0,0 +1,45 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +tui 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    tuple
    two 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    type 1 2 3 4 5 6 7 8 9
    typeofshape
    types 1 2 3 4 5
    +

    +underlying 1 2
    unionlist
    up 1 2 3
    updated 1 2
    updateobjbrowser 1 2 3
    upper 1 2
    used 1 2 3 4 5
    useful 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    user 1 2 3 4 5 6 7 8
    using 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    +

    +v 1 2 3 4
    v1
    v2
    v3
    v4
    val 1 2
    valid 1 2 3
    validity
    value 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    values 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    variety
    various 1 2
    vector 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    vector_arc 1 2
    vector1 1 2
    vector1_arc1
    vector1_arc2
    vector2 1 2
    vector2_arc1
    vector2_arc2
    vector3
    vectors 1 2 3 4 5 6 7 8
    vertex 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    vertex_n
    vertex1 1 2
    vertex2 1 2
    vertexmaxtol
    vertexmintol
    vertices 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    via 1 2 3 4 5 6 7 8
    view
    viewer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    viewers
    visibility
    visualization 1 2


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf14.htm b/doc/salome/gui/GEOM/whgdata/whlstf14.htm new file mode 100755 index 000000000..8299f3652 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf14.htm @@ -0,0 +1,48 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +volume 1 2
    vr
    vrot1d
    vt
    vtk
    vtr1d
    vtr2d
    vx
    vxy 1 2 3 4 5
    vxyz
    vz
    +

    +w_0
    wantplanarface 1 2
    water 1 2
    waterdensity 1 2 3
    way 1 2 3 4 5
    ways 1 2
    weight 1 2 3
    wf
    what
    whatis 1 2
    whether
    while 1 2 3 4
    whose 1 2 3
    wide
    will 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    wire 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    wire_close
    wire_name
    wire1
    wire2
    wireframe
    wires 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    wish 1 2
    within 1 2 3
    without
    work 1 2 3
    working 1 2 3 4
    workingplane
    works
    ww 1 2
    +

    +x 1 2 3 4 5 6 7 8 9
    x1 1 2
    x2 1 2
    xdx 1 2
    xdy 1 2
    xdz 1 2
    xmax 1 2
    xmin 1 2
    xoy
    xyz 1 2
    xz_face
    xz_face_ind
    +

    +y 1 2 3 4 5 6 7 8 9
    y1 1 2
    y2 1 2
    ydx 1 2
    ydy 1 2
    ydz 1 2
    ymax 1 2
    ymin 1 2
    your 1 2 3 4 5 6 7 8
    yz_face
    yz_face_ind
    +

    +z 1 2 3 4 5 6 7 8 9
    z1 1 2
    z2 1 2
    zero
    zmax 1 2
    zmin 1 2


    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf2.htm b/doc/salome/gui/GEOM/whgdata/whlstf2.htm new file mode 100755 index 000000000..3f41ccc7f --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf2.htm @@ -0,0 +1,43 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +create 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    createanddisplaygo 1 2 3 4 5 6 7 8 9 10 11 12 13
    created 1 2 3 4 5 6 7 8 9 10 11
    creategroup 1 2
    creates 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    creating
    creation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    cs1
    cs2
    current 1 2
    currently 1 2 3 4
    curve 1 2 3 4 5 6
    curve2dmode 1 2
    curve3dmode 1 2
    curvecontinuity 1 2
    curves 1 2 3 4 5 6 7
    curving 1 2
    cut 1 2 3 4
    cut_without_f_2
    cuts 1 2
    cutting 1 2 3 4
    cylinder 1 2 3 4 5 6 7
    cylinders
    cylindrical 1 2
    +

    +d 1 2
    d1 1 2 3
    d2 1 2 3
    data
    default 1 2 3
    define 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    defined 1 2
    defines 1 2 3
    defining 1 2 3 4 5 6 7
    definite 1 2 3
    definition 1 2 3 4
    deflection 1 2
    degenerated
    degree 1 2 3 4
    degrees 1 2
    deleted 1 2
    density 1 2
    depending 1 2
    descr
    description 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    desired 1 2
    destination
    destined
    detect 1 2 3
    detection 1 2
    detects 1 2
    diagonal
    dialog 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    differ
    differencelist
    different 1 2 3 4 5
    dimension 1 2 3 4 5
    dimensions 1 2 3 4 5 6
    dimentions
    dir 1 2 3
    dir1 1 2
    dir2 1 2
    direction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    directions 1 2 3 4
    dirface1v 1 2
    dirfaceid1 1 2
    dirfaceid1u 1 2
    dirfaceid1v 1 2
    dirfaceid2 1 2
    dirfaceid2u 1 2
    dirfaceid2v 1 2
    display 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    displayall
    displayed 1 2 3 4 5
    displaying 1 2 3
    displayonly
    displays 1 2
    distance 1 2 3 4 5 6
    divide
    divided 1 2 3
    divideedge 1 2 3
    dividing 1 2


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf3.htm b/doc/salome/gui/GEOM/whgdata/whlstf3.htm new file mode 100755 index 000000000..1a72bd4a9 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf3.htm @@ -0,0 +1,45 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +don 1 2 3
    done 1 2 3 4
    double 1 2 3 4
    doubles
    dropsmalledges 1 2
    dx 1 2 3 4 5 6
    dy 1 2 3 4 5 6
    dz 1 2 3 4 5
    +

    +e
    e1
    e2
    e3
    e4
    easier
    edge 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
    edge_ind
    edge_points
    edge1
    edge2
    edge3
    edge4
    edgeid 1 2
    edges 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    edit
    editing
    egdemaxtol
    egdemintol
    either
    element 1 2 3 4 5 6
    elementary
    elements 1 2 3 4 5 6 7
    ellipse 1 2 3
    else 1 2
    empty 1 2 3
    encountered
    end 1 2 3 4 5 6 7 8 9 10
    ending 1 2
    ends 1 2 3
    enter 1 2 3
    entire
    entity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    equal 1 2
    erase
    eraseall
    eraseonly
    erases
    error 1 2
    errors 1 2
    etc 1 2 3 4
    example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    examples 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    except 1 2
    existing 1 2 3
    explode 1 2 3 4 5 6 7
    exploded 1 2 3 4
    explodes
    export 1 2
    exportation
    exported
    exporting
    extra
    extracted 1 2
    extruded 1 2 3
    extrusion 1 2
    +

    +f 1 2
    f_2
    f_ind_1
    f_ind_2
    f1
    f1_id
    f2
    f3
    f4
    f5
    f6


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf4.htm b/doc/salome/gui/GEOM/whgdata/whlstf4.htm new file mode 100755 index 000000000..586a5d2af --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf4.htm @@ -0,0 +1,43 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +face 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    face_name
    face_rot
    face1 1 2 3 4
    face2 1 2 3 4
    face3
    faceid
    facemaxtol
    facemintol
    faces 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
    factor 1 2 3
    failed 1 2
    false 1 2
    fields 1 2
    file
    files
    fill 1 2 3
    filled 1 2
    fillet 1 2 3 4
    filletall
    fillets 1 2
    filling 1 2 3
    finally 1 2 3 4 5
    first 1 2 3 4 5 6 7 8 9 10 11 12
    firstly 1 2 3 4 5 6 7 8 9 10 11 12
    fix 1 2
    fixfacesize 1 2
    fixing 1 2
    fixshape 1 2 3
    flag
    flight_solid
    following 1 2 3 4 5 6
    format
    formats
    four 1 2
    free 1 2 3 4 5 6
    functionalities
    functionality 1 2
    functions 1 2 3
    fuse 1 2 3 4
    fuse_id
    +

    +gap 1 2
    general 1 2
    generate 1 2 3
    generating
    generation 1 2 3 4 5 6
    geom 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    geom_object 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    geom_objects 1 2 3 4 5 6
    geometric 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    geometrical 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    geometry 1 2 3
    geompy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    get 1 2 3 4 5
    getfacenearpoint
    getfreeboundary 1 2 3
    getfreefacesids 1 2 3
    getobjectids
    getsubshape
    getsubshapeid 1 2 3 4
    getsubshapeindex
    getting


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf5.htm b/doc/salome/gui/GEOM/whgdata/whlstf5.htm new file mode 100755 index 000000000..efc03df5c --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf5.htm @@ -0,0 +1,45 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +gg 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    give
    given 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    gives
    giving 1 2 3
    glue 1 2 3 4 5 6 7
    glued 1 2 3
    glues 1 2
    graphic
    gravity 1 2 3 4
    group 1 2 3 4
    group1
    groups 1 2 3 4 5
    gui
    +

    +half
    handling
    having 1 2 3 4
    height 1 2 3 4 5 6 7 8
    hexagonal
    hexahedral 1 2 3 4
    hexahedron
    hide
    hiding
    highlight
    highlights 1 2
    holding
    hole
    holes 1 2 3
    how
    +

    +i 1 2 3 4
    i11
    i12
    i13
    i21
    i22
    i23
    i31
    i32
    i33
    id 1 2 3 4 5 6 7 8 9 10 11 12
    id_arc
    id_archimede
    id_axis
    id_bezier
    id_box 1 2 3 4
    id_box_tr1
    id_box_tr2
    id_box1
    id_box2
    id_box3
    id_chamfer_all
    id_chamfer_e
    id_chamfer_f
    id_chamfer_f1
    id_circle1
    id_circle2
    id_common
    id_compound 1 2
    id_cone1
    id_cone2
    id_cs1
    id_cs2
    id_cut 1 2
    id_cut_without_f_2
    id_cylinder 1 2
    id_divide
    id_edge 1 2 3
    id_edge1
    id_edge2
    id_edge3
    id_edge4
    id_ellipse
    id_face 1 2 3
    id_face_rot
    id_face1 1 2
    id_face2 1 2
    id_face3
    id_fillet
    id_filletall
    id_filling
    id_fuse
    id_group1
    id_importbrep
    id_interpol
    id_line1
    id_line2
    id_make_block_explode
    id_mirror1
    id_mirror2
    id_mirror3
    id_offset
    id_p_on_arc
    id_p0
    id_p1 1 2
    id_p100
    id_p2 1 2
    id_p3 1 2
    id_p4 1 2 3
    id_partition1
    id_partition2
    id_partition3
    id_pipe
    id_plane 1 2
    id_plane1
    id_plane2
    id_plane3
    id_polyline
    id_position
    id_prism
    id_prism1
    id_prism2
    id_ps
    id_px
    id_py
    id_pz
    id_qface1
    id_qface2
    id_qface3
    id_result
    id_revolution
    id_rot1d
    id_rot2d
    id_rotation
    id_scale
    id_section
    id_sewing
    id_shape
    id_shell
    id_sketcher1
    id_sketcher2
    id_solid
    id_solid1
    id_solid2
    id_sphere
    id_sphere1
    id_sphere2
    id_sphere3
    id_torus1
    id_torus2
    id_tr1d
    id_tr2d
    id_translation1
    id_translation2
    id_translation3
    id_vector
    id_vector1
    id_vector2
    id_vector3
    id_vr
    id_vxy
    id_wire 1 2 3
    id_wire_close
    idlist 1 2
    idlist_e
    idlist_f
    ids 1 2 3 4 5 6


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf6.htm b/doc/salome/gui/GEOM/whgdata/whlstf6.htm new file mode 100755 index 000000000..0b91256d6 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf6.htm @@ -0,0 +1,49 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +if 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    iges 1 2
    image 1 2 3
    import 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
    importation
    importbrep
    importcomponentgui 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    imported 1 2 3 4
    importing
    impossible
    improve
    included
    increased 1 2
    independent
    independently
    index
    indexes
    indicate
    indicating
    indices 1 2 3 4
    inertia 1 2
    informs
    initial 1 2 3 4 5 6 7
    inner 1 2
    inquired
    inretia
    inserted 1 2
    inside 1 2
    instead
    integer 1 2 3
    integers 1 2
    intended 1 2
    interactively 1 2
    intermediate
    internal 1 2 3
    interpol
    interpolated
    interpolation
    intersect 1 2
    intersected 1 2
    intersection 1 2
    introduction 1 2
    invalid 1 2 3 4
    investigated
    ion
    isbyparameter 1 2
    iscommonvertex 1 2
    isolines
    isos
    isplanarface
    isplanarwanted 1 2 3 4
    issuccess
    isvalid 1 2
    iterations 1 2
    itself 1 2
    ix 1 2
    iy 1 2
    iz 1 2
    +

    +just
    +

    +keep 1 2 3 4 5
    ko
    +

    +l 1 2
    last 1 2 3
    lcs 1 2
    least 1 2
    len
    length 1 2 3 4 5
    less 1 2
    lie 1 2
    limit 1 2
    line 1 2 3 4 5 6
    line1
    line2
    linear
    lines
    list 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
    listchains
    listoffaceid 1 2
    listofgeomshapes 1 2
    listofid 1 2 3
    listofind
    listofkeepinside 1 2
    listofmaterials 1 2
    listofremoveinside 1 2
    listofshape 1 2 3 4 5 6 7 8 9
    listofshapeid
    listofshapes 1 2 3 4
    listoftools 1 2
    listofwireid 1 2
    listshapes
    local 1 2 3 4 5 6
    localop
    located 1 2 3
    location 1 2 3 4 5 6
    lying 1 2 3
    +

    +main 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
    mainshape
    major 1 2 3 4
    make 1 2 3 4 5 6 7
    make_block_explode
    makearc 1 2 3 4 5 6 7 8
    makebezier 1 2 3
    makeblockexplode 1 2 3
    makeboolean 1 2
    makebox 1 2 3 4 5 6 7
    makeboxdxdydz 1 2 3 4 5 6
    makeboxtwopnt 1 2 3 4
    makecdg 1 2
    makechamfer
    makechamferall 1 2
    makechamferedge 1 2 3
    makechamferface 1 2
    makechamferfaces
    makecircle 1 2 3
    makecirclethreepnt 1 2
    makecommon 1 2
    makecompound 1 2 3 4 5 6
    makecone 1 2 3 4
    makeconer1r2h 1 2
    makecut 1 2
    makecylinder 1 2 3 4 5
    makecylinderrh
    makeedge 1 2 3 4 5 6
    makeellipse 1 2 3
    makeface 1 2 3 4 5 6 7 8
    makefaces 1 2
    makefacewires 1 2
    makefillet 1 2 3
    makefilletall 1 2
    makefilling 1 2 3
    makefuse 1 2
    makegluefaces 1 2 3
    makehalfpartition 1 2
    makehexa
    makehexa2faces
    makehexasolid
    makehexasolidtwofaces
    makeinterpol 1 2 3
    makeline 1 2 3
    makelinetwopnt
    makemarker 1 2 3
    makemirrorbyaxis 1 2
    makemirrorbyplane 1 2 3
    makemirrorbypoint 1 2
    makemultirotation1d 1 2
    makemultirotation2d 1 2
    makemultitransformation1d 1 2 3
    makemultitransformation2d 1 2 3
    makemultitranslation1d 1 2 3
    makemultitranslation2d 1 2 3
    makeoffset 1 2 3
    makepartition 1 2 3
    makepipe 1 2 3
    makeplane 1 2 3 4
    makeplaneface 1 2
    makeplanethreepnt 1 2 3
    makepolyline 1 2 3
    makeposition 1 2 3
    makeprism 1 2 3 4
    makeprismvech 1 2 3 4
    makequad
    makequad2edges
    makequad4vertices
    makequadface
    makequadfaceedges
    makequadfacevertices
    makerevolution 1 2 3
    makerotation 1 2 3 4
    makes 1 2 3 4 5 6 7
    makescaletransform 1 2 3
    makesection 1 2
    makesewing 1 2 3
    makeshell 1 2 3
    makesketcher 1 2 3
    makesketcheronplane
    makesolid 1 2 3
    makesphere 1 2 3 4
    makespherepntr
    makespherer 1 2 3 4
    maketorus 1 2 3
    maketorusrr 1 2
    maketranslation 1 2 3 4
    maketranslationtwopoints 1 2
    maketranslationvector 1 2
    makevector 1 2 3 4 5 6 7 8 9 10
    makevectordxdydz 1 2 3 4
    makevertex 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    makevertexoncurve 1 2 3
    makevertexwithref 1 2 3
    makewire 1 2 3 4 5 6 7 8
    manually
    mass
    masses
    materials 1 2
    math 1 2 3
    matrix 1 2
    max 1 2 3 4 5 6 7
    maxdeg
    maxdegree 1 2
    maximal 1 2 3 4 5 6
    maximum 1 2 3 4 5 6
    maxnbfaces 1 2
    maxtolerance 1 2
    maxtolerance3d 1 2


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf7.htm b/doc/salome/gui/GEOM/whgdata/whlstf7.htm new file mode 100755 index 000000000..5041cd26b --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf7.htm @@ -0,0 +1,43 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +meaning 1 2
    means 1 2
    measurement 1 2
    measures
    mentioned
    menu 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    merging 1 2
    mesh 1 2
    meshing 1 2 3
    meshingdeflection 1 2 3
    method
    middle 1 2 3
    min 1 2 3 4 5 6
    min_dist
    mindeg
    mindegree 1 2
    mindistance 1 2
    minimal 1 2 3 4 5 6
    minimum 1 2 3
    minnbfaces 1 2
    minor 1 2 3 4
    mirror 1 2 3
    mirror1
    mirror2
    mirror3
    mirrored 1 2
    mode 1 2 3 4 5 6
    modeled 1 2
    models
    modes 1 2
    modification 1 2
    modified 1 2
    modifies 1 2 3 4 5
    modify 1 2 3
    module 1 2
    moment
    moments 1 2
    move 1 2
    moved 1 2
    much
    multi 1 2 3 4 5 6 7 8
    multirotate1d
    multirotate2d
    multitude 1 2
    must 1 2 3 4 5 6 7
    +

    +name 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    names 1 2
    nb 1 2 3 4
    nb_sub
    nbiter 1 2 3
    nbounding
    nbox
    nbsplitpoints 1 2
    nbtimes 1 2 3 4 5
    nbtimes1 1 2 3
    nbtimes2 1 2 3
    nbtimesu 1 2
    nbtimesv 1 2
    ncentre
    ncompound
    necessary 1 2 3 4 5 6 7
    need 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    needed 1 2
    negative 1 2
    neigbour 1 2
    new 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    ninertia
    nminimal
    nodes 1 2
    noerror 1 2
    none
    normal 1 2 3 4 5 6 7 8 9 10
    note
    nothing
    notions


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf8.htm b/doc/salome/gui/GEOM/whgdata/whlstf8.htm new file mode 100755 index 000000000..0c9caac68 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf8.htm @@ -0,0 +1,45 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
    numbers 1 2
    numeber
    +

    +object 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    objects 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    obtain
    obtained
    occ 1 2 3 4 5 6 7 8 9
    occurred 1 2
    offers
    offset 1 2 3
    ok 1 2 3 4 5
    old
    one 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    ones 1 2
    open 1 2 3 4
    openwires 1 2 3
    operation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    operations 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    operator 1 2
    operators 1 2 3
    opposite 1 2
    optimization
    options
    order 1 2 3
    oriented 1 2 3
    origin 1 2 3 4 5 6 7 8 9
    otherwise 1 2 3 4 5 6 7 8
    our 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
    outside 1 2
    ox 1 2 3
    oy 1 2
    oz 1 2 3 4 5
    +

    +p
    p_25_25_50
    p_25_50_25
    p_50_25_25
    p_on_arc
    p0 1 2 3 4 5 6 7 8
    p1 1 2 3 4 5 6 7 8
    p10
    p100
    p11
    p12
    p13
    p2 1 2 3 4 5 6 7 8
    p200 1 2
    p3 1 2 3 4 5 6
    p4 1 2 3 4
    p5 1 2 3 4
    p50
    p6 1 2
    p7 1 2
    p70
    p8 1 2
    p9


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf9.htm b/doc/salome/gui/GEOM/whgdata/whlstf9.htm new file mode 100755 index 000000000..326431a52 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstf9.htm @@ -0,0 +1,41 @@ + + +Search Words List + + + + + + + +

    <<

    +

    +parallel 1 2
    parameter 1 2 3 4 5 6 7 8
    parameters 1 2 3 4 5 6 7 8 9 10 11
    paramter 1 2
    part 1 2 3
    partition 1 2 3
    partition1
    partition2
    partition3
    passed
    passes 1 2 3 4 5
    passing
    path 1 2 3
    pathshape 1 2
    pattern
    perform 1 2 3 4 5
    performed 1 2
    perpendicular
    pi 1 2 3
    pipe 1 2 3
    planar 1 2 3 4 5 6 7
    plane 1 2 3 4 5 6 7 8 9 10 11 12
    plane1
    plane2
    plane3
    planes
    platform
    plunged 1 2
    point 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    point1 1 2 3 4 5 6 7 8 9 10 11 12
    point2 1 2 3 4 5 6 7 8 9 10 11 12
    point3 1 2 3 4 5 6
    point4 1 2
    point5
    pointcoordinates 1 2
    points 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    polyline 1 2 3
    pop 1 2
    position 1 2 3 4 5 6
    possibilities
    possibility 1 2
    possible 1 2 3 4 5 6 7 8
    precision 1 2 3
    predefined
    preferences
    presses 1 2
    preview 1 2
    previous
    primitive
    primitives 1 2 3 4 5 6 7 8
    print 1 2
    printed
    prism 1 2 3 4 5 6
    prism_edges
    prism_faces 1 2
    prism1
    prism2
    prisms 1 2
    problems 1 2
    process
    processed 1 2 3 4 5 6
    processes 1 2
    processing 1 2 3
    processshape 1 2 3
    produce 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    project
    projection
    projections
    propagate 1 2 3
    propagation 1 2 3
    properties 1 2 3
    props
    provide 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    ps
    put 1 2
    px 1 2 3 4 5
    pxy
    pxyz 1 2 3
    py 1 2 3 4 5
    py1
    python


    >> + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl0.htm b/doc/salome/gui/GEOM/whgdata/whlstfl0.htm new file mode 100755 index 000000000..db5af94cf --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl0.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ { {D {E {S {D {N {S {D {R {S ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl10.htm b/doc/salome/gui/GEOM/whgdata/whlstfl10.htm new file mode 100755 index 000000000..826e1f2fe --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl10.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ KE KO ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl11.htm b/doc/salome/gui/GEOM/whgdata/whlstfl11.htm new file mode 100755 index 000000000..b5a4de155 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl11.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ L LA LC LE LI LO LY ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl12.htm b/doc/salome/gui/GEOM/whgdata/whlstfl12.htm new file mode 100755 index 000000000..921dbda8d --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl12.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ MA ME MI MO MU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl13.htm b/doc/salome/gui/GEOM/whgdata/whlstfl13.htm new file mode 100755 index 000000000..266fc86f0 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl13.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ NA NB NC NE NI NM NO NU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl14.htm b/doc/salome/gui/GEOM/whgdata/whlstfl14.htm new file mode 100755 index 000000000..d573df409 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl14.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ OB OC OF OK OL ON OP OR OT OU OX OY OZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl15.htm b/doc/salome/gui/GEOM/whgdata/whlstfl15.htm new file mode 100755 index 000000000..72acab74e --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl15.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ P PA PE PI PL PO PR PS PU PX PY PZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl16.htm b/doc/salome/gui/GEOM/whgdata/whlstfl16.htm new file mode 100755 index 000000000..f3621cd7b --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl16.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ QF QU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl17.htm b/doc/salome/gui/GEOM/whgdata/whlstfl17.htm new file mode 100755 index 000000000..d2273c9ff --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl17.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ R RA RE RI RO RU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl18.htm b/doc/salome/gui/GEOM/whgdata/whlstfl18.htm new file mode 100755 index 000000000..c87aafa9f --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl18.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ S SA SC SE SG SH SI SK SM SO SP SQ ST SU SY ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl19.htm b/doc/salome/gui/GEOM/whgdata/whlstfl19.htm new file mode 100755 index 000000000..39b862d1f --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl19.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ T TA TE TH TI TM TO TR TT TU TW TY ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl2.htm b/doc/salome/gui/GEOM/whgdata/whlstfl2.htm new file mode 100755 index 000000000..576c9d705 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl2.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ B BA BB BE BL BO BR BS BU BY ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl20.htm b/doc/salome/gui/GEOM/whgdata/whlstfl20.htm new file mode 100755 index 000000000..e7ed85f1e --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl20.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ UN UP US ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl21.htm b/doc/salome/gui/GEOM/whgdata/whlstfl21.htm new file mode 100755 index 000000000..ebc9e5cdf --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl21.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ V VA VE VI VO VR VT VX VZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl22.htm b/doc/salome/gui/GEOM/whgdata/whlstfl22.htm new file mode 100755 index 000000000..644108be7 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl22.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ W WA WE WF WH WI WO WW ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl23.htm b/doc/salome/gui/GEOM/whgdata/whlstfl23.htm new file mode 100755 index 000000000..e911e965e --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl23.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ X XD XM XO XY XZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl24.htm b/doc/salome/gui/GEOM/whgdata/whlstfl24.htm new file mode 100755 index 000000000..a7d1b67b9 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl24.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ Y YD YM YO YZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl25.htm b/doc/salome/gui/GEOM/whgdata/whlstfl25.htm new file mode 100755 index 000000000..bb8bdb60c --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl25.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ Z ZE ZM ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl3.htm b/doc/salome/gui/GEOM/whgdata/whlstfl3.htm new file mode 100755 index 000000000..0eaa79900 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl3.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ C CA CE CH CI CL CM CO CR CS CU CY ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl4.htm b/doc/salome/gui/GEOM/whgdata/whlstfl4.htm new file mode 100755 index 000000000..14d3e4533 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl4.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ D DA DE DI DO DR DX DY DZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl5.htm b/doc/salome/gui/GEOM/whgdata/whlstfl5.htm new file mode 100755 index 000000000..c7b1ee66e --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl5.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ E EA ED EG EI EL EM EN EQ ER ET EX ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl6.htm b/doc/salome/gui/GEOM/whgdata/whlstfl6.htm new file mode 100755 index 000000000..9959aea31 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl6.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ F FA FI FL FO FR FU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl7.htm b/doc/salome/gui/GEOM/whgdata/whlstfl7.htm new file mode 100755 index 000000000..a7c64dea2 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl7.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ GA GE GG GI GL GR GU ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl8.htm b/doc/salome/gui/GEOM/whgdata/whlstfl8.htm new file mode 100755 index 000000000..ea456ba3c --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl8.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ HA HE HI HO ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl9.htm b/doc/salome/gui/GEOM/whgdata/whlstfl9.htm new file mode 100755 index 000000000..cb988a831 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstfl9.htm @@ -0,0 +1,45 @@ + + +Search Words letter + + + + + + + + + +

    ^ I ID IF IG IM IN IO IS IT IX IY IZ ^

    + + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt1.htm b/doc/salome/gui/GEOM/whgdata/whlstt1.htm new file mode 100755 index 000000000..347ab0afb --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt1.htm @@ -0,0 +1,58 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt10.htm b/doc/salome/gui/GEOM/whgdata/whlstt10.htm new file mode 100755 index 000000000..00c4532f8 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt10.htm @@ -0,0 +1,68 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +       Boolean Operations
    +          Using boolean operations
    +          Fuse
    +          Common
    +          Cut
    +          Section
    +       Transformation Operations
    +       Blocks Operations
    +       Repairing Operations
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt11.htm b/doc/salome/gui/GEOM/whgdata/whlstt11.htm new file mode 100755 index 000000000..884dcff6a --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt11.htm @@ -0,0 +1,73 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +       Boolean Operations
    +       Transformation Operations
    +          Translation
    +          Rotation
    +          Modify the Location
    +          Mirror Image
    +          Scale Transform
    +          Offset Surface
    +          Multi Translation
    +          Multi Rotation
    +          Fillet
    +          Chamfer
    +       Blocks Operations
    +       Repairing Operations
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt12.htm b/doc/salome/gui/GEOM/whgdata/whlstt12.htm new file mode 100755 index 000000000..9cc4acffd --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt12.htm @@ -0,0 +1,66 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +       Boolean Operations
    +       Transformation Operations
    +       Blocks Operations
    +          Multi Transformation
    +          Explode on Blocks
    +          Propagate
    +       Repairing Operations
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt13.htm b/doc/salome/gui/GEOM/whgdata/whlstt13.htm new file mode 100755 index 000000000..a35a64a97 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt13.htm @@ -0,0 +1,73 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +       Boolean Operations
    +       Transformation Operations
    +       Blocks Operations
    +       Repairing Operations
    +          Shape Processing
    +          Suppress Faces
    +          Close Contour
    +          Suppress Internal Wires
    +          Suppress Holes
    +          Sewing
    +          Glue Faces
    +          Add Point on Edge
    +          Check Free Boundaries
    +          Check Free Faces
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt14.htm b/doc/salome/gui/GEOM/whgdata/whlstt14.htm new file mode 100755 index 000000000..2d6bec4f5 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt14.htm @@ -0,0 +1,63 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +       Changing Displaying Parameters
    +       Creation of Geometric Objects
    +       Transformation
    +       Measurement Tools
    +       Module geompy
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt15.htm b/doc/salome/gui/GEOM/whgdata/whlstt15.htm new file mode 100755 index 000000000..e9610f41d --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt15.htm @@ -0,0 +1,69 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +       Changing Displaying Parameters
    +       Creation of Geometric Objects
    +          Basic Geometrical Objects
    +          Primitives
    +          Complex Objects
    +          Working with Groups
    +          Building by Blocks
    +          Sketcher
    +          Advanced Geometrical Objects
    +       Transformation
    +       Measurement Tools
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt16.htm b/doc/salome/gui/GEOM/whgdata/whlstt16.htm new file mode 100755 index 000000000..00a0a5d76 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt16.htm @@ -0,0 +1,67 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +       Changing Displaying Parameters
    +       Creation of Geometric Objects
    +       Transformation
    +          Basic Operations
    +          Boolean Operations
    +          Transformation Operations
    +          Blocks Operations
    +          Repairing Operations
    +       Measurement Tools
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt2.htm b/doc/salome/gui/GEOM/whgdata/whlstt2.htm new file mode 100755 index 000000000..b8cc3abcc --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt2.htm @@ -0,0 +1,60 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +       Changing displaying parameters
    +       Displaying\hiding objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt3.htm b/doc/salome/gui/GEOM/whgdata/whlstt3.htm new file mode 100755 index 000000000..a821036b5 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt3.htm @@ -0,0 +1,65 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +       Creation of Basic Geometric Objects
    +       Creation of Primitives
    +       Generation of Complex Objects
    +       Working with groups
    +       Building by blocks
    +       Sketcher
    +       Creation of Advanced Geometrical Objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt4.htm b/doc/salome/gui/GEOM/whgdata/whlstt4.htm new file mode 100755 index 000000000..c3ae759ad --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt4.htm @@ -0,0 +1,75 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +       Creation of Basic Geometric Objects
    +          Point
    +          Line
    +          Circle
    +          Ellipse
    +          Arc
    +          Curve
    +          Vector
    +          Plane
    +          Working Plane
    +          Local Coordinate System
    +       Creation of Primitives
    +       Generation of Complex Objects
    +       Working with groups
    +       Building by blocks
    +       Sketcher
    +       Creation of Advanced Geometrical Objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt5.htm b/doc/salome/gui/GEOM/whgdata/whlstt5.htm new file mode 100755 index 000000000..b4bb30f34 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt5.htm @@ -0,0 +1,70 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +       Creation of Basic Geometric Objects
    +       Creation of Primitives
    +          Box
    +          Cylinder
    +          Sphere
    +          Torus
    +          Cone
    +       Generation of Complex Objects
    +       Working with groups
    +       Building by blocks
    +       Sketcher
    +       Creation of Advanced Geometrical Objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt6.htm b/doc/salome/gui/GEOM/whgdata/whlstt6.htm new file mode 100755 index 000000000..378054ec4 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt6.htm @@ -0,0 +1,69 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +       Creation of Basic Geometric Objects
    +       Creation of Primitives
    +       Generation of Complex Objects
    +          Extrusion
    +          Revolution
    +          Filling
    +          Pipe
    +       Working with groups
    +       Building by blocks
    +       Sketcher
    +       Creation of Advanced Geometrical Objects
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt7.htm b/doc/salome/gui/GEOM/whgdata/whlstt7.htm new file mode 100755 index 000000000..f500692f0 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt7.htm @@ -0,0 +1,72 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +       Creation of Basic Geometric Objects
    +       Creation of Primitives
    +       Generation of Complex Objects
    +       Working with groups
    +       Building by blocks
    +       Sketcher
    +       Creation of Advanced Geometrical Objects
    +          Explode
    +          Edge
    +          Wire
    +          Face
    +          Shell
    +          Solid
    +          Compound
    +    Transforming geometrical objects
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt8.htm b/doc/salome/gui/GEOM/whgdata/whlstt8.htm new file mode 100755 index 000000000..15b0d086c --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt8.htm @@ -0,0 +1,63 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +       Boolean Operations
    +       Transformation Operations
    +       Blocks Operations
    +       Repairing Operations
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whlstt9.htm b/doc/salome/gui/GEOM/whgdata/whlstt9.htm new file mode 100755 index 000000000..020ca4200 --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whlstt9.htm @@ -0,0 +1,65 @@ + + + +Content + + + + + + + + + + +
    +

    + GEOM module
    +    Introduction to GEOM
    +    Importing\exporting geometrical objects
    +    Managing geometrical objects
    +    Creating geometrical objects
    +    Transforming geometrical objects
    +       Basic Operations
    +          Partition
    +          Archimede
    +       Boolean Operations
    +       Transformation Operations
    +       Blocks Operations
    +       Repairing Operations
    +    Using measurement tools
    +    TUI Scripts
    +

    + +
    +

    +

    + + + + diff --git a/doc/salome/gui/GEOM/whgdata/whnvl32.htm b/doc/salome/gui/GEOM/whgdata/whnvl32.htm new file mode 100755 index 000000000..5927c3d7f --- /dev/null +++ b/doc/salome/gui/GEOM/whgdata/whnvl32.htm @@ -0,0 +1,72 @@ + + + +Search Letters + + + + + + + + +

    + # + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z +

    + + + + diff --git a/doc/salome/gui/GEOM/whskin_info.htm b/doc/salome/gui/GEOM/whskin_info.htm new file mode 100755 index 000000000..ddaed6656 --- /dev/null +++ b/doc/salome/gui/GEOM/whskin_info.htm @@ -0,0 +1,20 @@ + + +WebHelp 5.50 + + + + +

    WebHelp 5.50 System Info

    + + + + + + + + + +
    Start Page geom.htm
    Skin Name Default
    Generating Time 18:44 10/18/2005
    Language ID 1033
    Compile Script webhelp5_compile_script.xml
    Compile Build Version 13.10.606
    Product Name WebHelp 5.50
    Authoring Tool Name RoboHelp X5
    + + \ No newline at end of file diff --git a/doc/salome/gui/GEOM/whxdata/whftdata0.xml b/doc/salome/gui/GEOM/whxdata/whftdata0.xml new file mode 100755 index 000000000..0bfb928b7 --- /dev/null +++ b/doc/salome/gui/GEOM/whxdata/whftdata0.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/gui/GEOM/whxdata/whfts.xml b/doc/salome/gui/GEOM/whxdata/whfts.xml new file mode 100755 index 000000000..0ac71382b --- /dev/null +++ b/doc/salome/gui/GEOM/whxdata/whfts.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/doc/salome/gui/GEOM/whxdata/whfwdata0.xml b/doc/salome/gui/GEOM/whxdata/whfwdata0.xml new file mode 100755 index 000000000..9025f2ef1 --- /dev/null +++ b/doc/salome/gui/GEOM/whxdata/whfwdata0.xml @@ -0,0 +1,1246 @@ + + + 0,3,4,6,7,9,11,12,18,45,47,50,61,62,64,73,40,79, + 64, + 18, + 4, + 0,2,3,4,6,7,9,10,11,12,15,16,18,20,23,25,26,27,28,29,42,43,45,46,47,49,50,51,52,53,54,55,58,59,60,61,62,63,64,65,66,67,69,70,72,73,75,77,33,35,37,38,39,40,41,32,31,79,80,81,84,85, + 3,18,50,62,73,79, + 3,4,6,9,18,45,50,64,73,79, + 3,79, + 4, + 50, + 50, + 50, + 37, + 9, + 64, + 64, + 9,18,50,62,73, + 3,9,45,64,73, + 11, + 62, + 3, + 64,73, + 50, + 6,38,31,79, + 50,64, + 49,38,39,40,41,31, + 56,6,8,12,15,17,18,21,22,23,24,44,45,47,48,50,53,54,55,58,64,68,70,72,33,37,38,39,40,41,32,31,79,80,81,82,84, + 3,7,9,18,45,62,64,73,79, + 3,4,6,47,50,64,79, + 79, + 11, + 79, + 50, + 3,6,7,62,79, + 45,50,64,73, + 6,43,64,70,33,35,38,40,32,31,79, + 49,38,39,40,41,31, + 41, + 1,2,6,8,11,15,18,20,45,47,50,54,60,61,64,70,72,38,39,40,41,32,31,79,80,82, + 3,9,11,18,50,62,64,73,79, + 45,73, + 50, + 11, + 64, + 50, + 7,62,64,79, + 15,21,43,49,58,60,61,64,70,76,33,34,35,37,38,39,40,32,31,82, + 49,38,31, + 41, + 56,45,47,50,54,70,72,38,40,32,79, + 7,9,18,45,62,64,79, + 64, + 9,62,64, + 0,3,11,18,43,45,47,50,61,64,70,72,73,35,40,79, + 3,6,9,11,18,45,50,64,73,79, + 4, + 7,62,64, + 56,50,70,37,40, + 18,64,79, + 64, + 45,50,64,70,40, + 3,9,45,62,64,73,79, + 50,70,40, + 50,64,73,79, + 45,50,70,72,40, + 72, + 72, + 72, + 8,28,48,75,41, + 0,49,70,40,31, + 0,16,40, + 70,40, + 16,47,40,85, + 0,3,4,6,7,9,18,45,47,62,64,73,40,79, + 47,85, + 3,4,6,7,9,11,18,45,47,62,64,73,79, + 6,64, + 40, + 8,19,24,28,29,45,71,74,75,33,35,83, + 38, + 8,15,20,21,23,58,60,61,72,75,38,81,82,84, + 64, + 56,10,26,51,52,53,66,69,72,77,36,40,41,80,85, + 8,10,55,57,59,35,38,41,79,80, + 32, + 47, + 53,64,65,66,70,72,35,40,41,79, + 22,28,48,60,61,75, + 2,58,66,70,40,80, + 49,40,31,79, + 18,79, + 10,38, + 57,41, + 70,40, + 70,40, + 1,3,18,45,64,72,73,31,79, + 18, + 18, + 2,4,38, + 50, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,35,37,38,39,40,41,32,31,80,81,82,83,84,85, + 53,65,35,79, + 34, + 34, + 56,49,31, + 0,56,16,72,76,77,78,34,40,85, + 8,49,31,80, + 18,20,23,49,51,53,55,65,66,35,37,39,41,31,79, + 21,31, + 85, + 20,23,28,53,59,64,65,67,70,35,39,40,41,80,81, + 59,35, + 28,35, + 1,2,3,4,15,21,25,30,48,49,50,58,60,61,72,33,37,38,31,82,84, + 50,37, + 50, + 24, + 64,70,72,40, + 64, + 56, + 21, + 3,21,70,40,31, + 56,6,9,5,27,50,54,63,37,38, + 7,17,22,44,30,68,33,37,32, + 8,20,54,34, + 64, + 9,45,50,37, + 13,64,69,77,40, + 13,64,78,40, + 50,37, + 0,4,56,6,8,11,12,13,16,22,27,47,49,50,62,64,70,72,78,33,35,36,37,38,39,40,41,31,79,83,85, + 6, + 6, + 50,62,64, + 50,62,64, + 62, + 63,38, + 30,64,36, + 10,42,49,34,36,31,83, + 70,40, + 70,40, + 56,6,9,5,19,24,29,30,58,63,71,74,33,38,83, + 49,69,77,40,31,83, + 56, + 45,73, + 30, + 31,84, + 56,49,54,70,78,40,31, + 8,15,25,50,53,72,75,37,39,41,31, + 26, + 67,41, + 20,81, + 20,23,67,39, + 6, + 10,38,79, + 79, + 79, + 79, + 79, + 11,12, + 6,13,14,27,29,50,64,78,37,38,40, + 6, + 6, + 51,52,53,66,77,40,41,80, + 50,37, + 50,64,37, + 21, + 27,34,36,38, + 3,15,72,31,82, + 3, + 3, + 12,34,36, + 13,16,64,70,74,33,40, + 16,64,40, + 13,64,40, + 16,40, + 50, + 46,40, + 20,23, + 11,12, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,23,24,25,26,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,34,35,37,38,39,40,41,32,31,80,81,82,83,85, + 7,16,17,40,32,79, + 18,28,43,30,59,65,35,38,32, + 3,18,43,49,72,41,31,80, + 56,37, + 56,6,17,18,19,22,26,27,44,45,46,50,53,55,57,64,68,33,37,38,40,41, + 26,28,59,65,35, + 2,37,38, + 20,62,64,39, + 37, + 37, + 62, + 62, + 36, + 70,40, + 10,29,71,33,37,38,83, + 37, + 79, + 16,46,37,40, + 37, + 56, + 56,74,33,39, + 21,30,59,32, + 49,38,39,40,41,31, + 0,6,14,16,63,38,40, + 47,36, + 70,40, + 70,40, + 70,40, + 70,40, + 16,64,40, + 70,40, + 50, + 8,20,23,26,49,50,52,61,72,75,37,39,41,31,79,80,81,82,84, + 51,52,66,41,80, + 8,9,39, + 70,40, + 2,13,21,24,27,49,33,35,38,39,40,31, + 64, + 72, + 32, + 1,2,3,4,56,6,7,8,9,10,15,16,18,19,20,21,23,24,25,26,28,29,42,43,44,45,47,48,49,50,51,52,53,59,60,61,62,64,65,66,67,68,71,72,73,74,75,33,34,35,37,38,39,40,41,31,79,80,81,82,83,84,85, + 3,4,6,7,9,11,18,45,47,62,64,73,79, + 47,85, + 1,3,8,15,16,18,19,20,21,23,24,25,28,29,43,45,47,30,48,59,60,61,62,64,65,71,74,75,35,38,40,81,82,83,85, + 79, + 79, + 8,28,48,72,75,34, + 3,21,43,70,72,35,40,31, + 70,40, + 70,40, + 70,40, + 7,17,22,58,64,70,38,40,32, + 64, + 7,20,23,62,64,39,79, + 18, + 70,40, + 10,64, + 10,38,79, + 10,38,79, + 37, + 61,72,85, + 1,8,10,15,20,21,23,25,26,27,28,42,43,48,53,54,55,59,60,61,65,66,67,70,72,75,38,39,40,41,31,80,81,82,84, + 77,37,40, + 59,70,35,40, + 2,38, + 37, + 43,65,70,72,35,40, + 58,38, + 2,38, + 54,38, + 50, + 56,12,50,72,73,33,34,35,37,38,39,40,41,31,85, + 70,40, + 30, + 72, + 13,69,77,40, + 70,40, + 39, + 0,56,12,13,16,22,49,70,72,78,33,35,36,37,38,39,40,41,31,83,85, + 34, + 47, + 12,51,34,37,39, + 8,10,23,28,53,35,37,38,39, + 53, + 53,55,41, + 55,41, + 55,41, + 2,15,20,25,28,49,53,54,55,60,65,66,72,35,38,39,41,31,81, + 54,38, + 54,38, + 54,38, + 54,38, + 54,38, + 54,38, + 54,38, + 3,4,6,7,9,11,12,18,45,47,49,62,64,69,73,77,34,36,37,40,31,79, + 34, + 34, + 46,50,57,37,40,41, + 0,64,70,40, + 0,64,40, + 8,16,28,55,75,40,41, + 12,53,54,55,72, + 70,40, + 8,50,72,41,80,82, + 8,50,72,41,80,82, + 8,50,41,80,82, + 34, + 56, + 56, + 56, + 56, + 85, + 0,1,56,8,9,10,13,15,16,18,21,24,25,26,28,42,43,45,48,50,59,61,63,64,65,70,71,72,33,35,37,38,40,31,79,82,83, + 64, + 64, + 9, + 9, + 9, + 9, + 0,40, + 85, + 37, + 37, + 56, + 16,29,72,33,34,35,37,39,40,32,31, + 56, + 3,25,31, + 50,64, + 77,78,40, + 37, + 1,16,28,52,64,72,40,41,31,79,80,82, + 49,36,31, + 37, + 1,56,8,15,19,20,21,23,24,25,26,28,29,43,48,49,59,60,61,65,71,72,74,75,33,35,39,31,81,82,83,84,85, + 20,72, + 34, + 34, + 34, + 13,47,37,40, + 26,70,33,40, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,33,35,38,39,40,41,32,31,80,81,82,83,85, + 78,40, + 60,72,85, + 6,5,26,27,45,33,38, + 30,36, + 36, + 37, + 27,38, + 59,65,35, + 28,35, + 45,73, + 64, + 79, + 79, + 56, + 64, + 56, + 56, + 56, + 56, + 56, + 3,56,9,10,14,16,18,26,27,28,29,42,43,45,46,47,50,54,57,58,59,60,64,65,70,71,72,73,76,78,33,35,37,38,40,41,31,79,84, + 64, + 64, + 10,18,45,38, + 10,18,45,38, + 45, + 47, + 37, + 37, + 67,41,79, + 50,64, + 13,40, + 49,31, + 18,43,49,35,36,31, + 77,35,40, + 10,42,38,79, + 79, + 51,60,61,80,84, + 8,15,20,23,24,51,54,55,58,60,61,73,75,33,38,39,41,32,31,80,81,82,84, + 70,40, + 70,40, + 64,70,40, + 37, + 64, + 72,73,33,34,37,32, + 30,36, + 56,9, + 13,14,64,69,77,40, + 30,33,79, + 56, + 72,85, + 7,11,44,32, + 11, + 16,40, + 56,32, + 28,43,59,35, + 28,43,30,59,65,35, + 3,4,6,7,9,11,12,18,45,47,30,50,62,63,64,73,33,34,35,36,37,38,39,41,32,31,79, + 0,1,2,56,8,10,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,35,37,38,39,40,41,31,80,81,82,83,85, + 1,56,15,19,21,24,25,28,29,43,48,59,60,61,65,71,74,82,83, + 3,12,17,45,30,53,33,34,35,36,37,38,39,40,41,32,31,85, + 64,70,40, + 0,1,2,3,4,56,6,7,8,9,10,11,13,15,16,17,18,19,20,21,23,24,25,26,27,28,29,42,43,44,45,46,47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,33,35,37,38,39,40,41,32,31,79,80,81,82,83,85, + 6,50,64,33,37,79, + 6, + 13,64,40, + 14,64,40, + 85, + 64, + 47,64,33,79, + 6, + 3,4,6,7,9,11,12,18,45,47,50,62,64,73,79, + 15,25,29,60,31, + 3,4,6,9,10,14,18,23,26,27,29,42,45,46,47,48,53,57,61,64,73,33,37,38,40,41,31,79,81, + 6,46,50,58,64,37,38,40, + 34, + 26,50,53,37, + 6,47,63,38,85, + 47, + 38, + 31, + 85, + 70,71,33,40, + 7,20,23,28,64,35,39,79, + 9, + 56,9,54,38, + 56, + 34, + 13,37,40, + 64,77,40, + 83, + 37, + 18,47,64,34, + 37, + 37, + 37, + 37, + 37, + 37, + 37, + 37, + 37, + 0,12,14,16,26,54,76,77,78,33,34,38,40,85, + 3, + 4, + 79, + 3, + 4,6,64,79, + 6, + 6, + 62, + 62, + 62, + 79, + 79, + 79, + 79, + 3, + 3, + 7, + 6,18, + 62, + 62, + 79, + 79, + 7,64, + 64, + 7,79, + 64, + 18,45,64, + 9, + 9, + 9, + 9, + 3, + 3,64,73, + 64, + 18,45, + 18,45, + 45, + 18, + 79, + 79, + 7, + 47, + 64, + 3, + 3, + 3, + 6, + 79, + 79, + 79, + 79, + 64, + 3, + 3, + 3,9, + 3, + 3,9, + 3,9, + 3,9,79, + 4, + 4, + 4, + 18, + 4,79, + 3, + 3, + 3, + 3, + 79, + 79, + 18, + 18, + 3, + 3, + 3, + 9, + 9, + 9, + 64, + 18, + 79, + 79, + 79, + 79, + 7, + 64, + 64, + 45, + 73, + 73, + 45, + 9, + 9, + 7, + 62, + 62, + 62, + 62, + 62, + 79, + 79, + 79, + 79, + 79, + 3, + 3, + 3, + 18, + 79, + 3, + 18,45,64, + 64, + 64,79, + 79, + 79, + 0,13,16,20,29,47,50,58,64,70,77,78,33,37,38,40,85, + 30,36, + 51,41,79, + 3,4,6,7,9,11,18,45,47,30,50,62,64,73,34,36,37,79, + 36, + 64, + 3,4,6,7,9,11,18,45,47,50,62,64,73,79, + 29, + 6, + 57,41, + 47, + 16,40, + 17,34, + 26,64, + 10,26,58,38, + 55,61, + 50,37, + 37, + 51,52,53,66,67,41,80, + 37, + 37, + 16,40, + 58,38, + 20, + 27,54,38, + 54,38, + 70,40, + 27,38, + 56, + 64,78,40, + 3, + 21, + 3, + 58,38, + 58,38, + 56,30, + 50,64,70,40, + 37, + 83, + 0,40, + 16,40, + 12, + 12, + 45, + 3,18,29,73, + 64, + 50,64, + 43,35, + 16,40, + 50,37, + 50,37, + 50,37, + 56, + 51,52,66,41,80, + 64, + 45,73, + 24,33,31, + 49,31, + 21,31, + 64, + 0,50,72,37,40, + 70,40, + 1,15, + 58,38, + 2,3,48,72,38,31, + 3, + 3, + 72, + 3,10,13,14,16,19,21,26,29,43,47,58,63,69,70,71,72,74,76,77,78,33,35,38,40,31,83,85, + 6, + 10,38, + 76,40, + 76,33,40, + 26, + 58,38, + 58,38, + 58,38, + 19,21,58,69,71,74,33,38,40,31,83, + 38, + 58,38, + 77,40, + 42, + 49,57,72,41,31,79, + 6, + 49,61,31, + 49,52,36,41,31,79, + 72,78,40, + 0,1,2,56,8,5,10,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,49,50,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,34,35,37,38,39,40,41,31,80,81,82,83,84,85, + 85, + 25,39,31,81, + 6,7,10,50,54,55,58,64,38,41,79,80,85, + 6, + 1,3,18,45,64,73,31,79, + 3,21,31, + 6,27,38, + 11,32, + 8,11,50,62,64,39,79, + 6,8,50,62,64,79, + 4,8,47,62, + 50,37, + 79, + 10,79, + 10,38,79, + 10,38,79, + 3,15,31, + 3,15, + 7,17, + 6,18,19,50,64,33, + 20,62,64,39, + 20,62, + 7,64, + 7,23,64,39,79, + 23, + 9,18,24,45,64,33, + 3,25,31, + 3,18,29,45,64,73,33,79, + 29,45, + 18,43,35, + 42,38,79, + 42,79, + 7,44, + 46,50,40, + 4,58, + 9, + 9, + 56, + 56, + 3,21,31, + 3,48,31, + 3, + 49,31,79, + 51,79, + 51,41,79, + 51,79, + 53,41, + 53,41, + 6,54,38, + 6,54,38, + 55,41,79, + 55,41,79, + 57,41,79, + 4,58,38, + 18,59,35, + 3,4,60,31, + 3,60, + 3,60,79, + 3,21,31, + 52,41,79, + 18,28,45,35, + 18,28,64,79, + 9, + 9, + 9, + 56, + 56, + 56, + 18,65,35, + 64,66,41,79, + 67,41,79, + 7,68, + 64,69,40, + 45,71,33, + 45,72,73, + 73, + 45,74,33, + 6,7,11,62,75,39, + 62, + 62,39,81, + 62,81, + 18,41,79,80, + 79,80, + 79,80, + 3,7,18,45,62,64,73,31,79,82, + 3,4,18,82, + 3,4,6,7,9,18,45,47,50,61,62,64,73,31,79, + 3,61,31, + 3,61,31, + 3,18,45,64,73,33,79,83, + 31, + 50,37, + 58,38, + 50,64,79, + 50,37, + 27,43,50,70,35,38,40, + 18, + 43,35, + 27,70,35,37,38,40, + 27,43,46,70,38,40, + 27,38, + 70,40, + 70,40, + 57,61,72,41, + 37, + 50,37, + 56, + 0,1,2,56,8,5,10,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,34,35,36,37,38,39,40,41,31,80,81,82,83,84,85, + 70,40, + 2,56,38, + 2,4,38, + 33, + 1,61,31, + 27,43,50,35,37,38, + 50, + 18, + 43,35, + 50,37, + 27,29,50,35,37,38, + 27,43,38, + 27,38, + 25,39,31,81, + 51,41,79, + 79, + 79, + 79, + 0,11,12,16,70,40, + 2,30,38, + 16,49,52,40,41,31, + 40,41, + 52,41,79, + 30,34, + 50,37, + 52,55,41, + 85, + 6,5,53,54,55,38,41,79, + 79, + 79, + 63,38, + 50,53,55,77,37,40,41, + 0,1,2,56,8,10,15,16,17,19,20,21,22,23,24,25,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,65,67,68,69,70,71,74,75,76,77,78,33,35,36,38,39,40,41,31,80,81,82,83,84, + 8,28,48,75, + 26, + 18,43,35, + 50, + 50, + 70,40, + 53,54,55,38,41, + 53,55,41, + 53,55,41, + 54,38, + 54,38, + 50, + 50, + 8,10,26,28,29,42,43,53,55,59,65,66,67,75,80, + 10,42,70,72,34,37,40, + 16,40, + 57,41, + 70,40, + 1,56,8,15,16,19,20,21,23,24,25,26,28,29,43,48,49,59,60,61,65,71,72,74,75,33,35,39,40,31,79,81,82,83,84,85, + 50, + 50, + 21,31, + 13,40, + 50, + 3,15,25,28,57,60,35,41,31,81, + 20, + 29, + 56, + 12,27,43,53,54,55,57,64,69,70,77,35,38,40,41,79, + 54,38, + 38, + 1,2,3,4,6,7,9,10,12,15,17,18,19,21,24,25,26,28,29,42,43,45,47,30,48,49,51,52,53,57,59,60,61,62,63,64,65,66,71,73,74,78,33,34,35,36,37,38,39,40,41,32,31,79,80,82,83,85, + 26,50, + 0,12,16,76,77,78,34,40,85, + 13,40, + 85, + 57,41,79, + 49,50,64,36,31, + 61, + 0,16,22,53,54,55,60,61,64,70,72,34,38,40,41,31,79,84, + 13,16,64,40, + 13,64,40, + 0,1,2,4,56,6,7,8,10,13,14,15,16,17,20,21,22,23,25,26,27,28,42,43,44,46,30,48,51,52,53,54,55,57,58,59,60,61,63,64,65,66,67,68,69,70,75,76,77,78,34,35,38,40,41,32,79,80,81,82,85, + 64,70,40, + 8,39, + 30, + 5, + 70,37,40, + 56,49,31, + 8,20,23,49,75,39,31,81,82, + 0,16,51,52,66,40,41,80, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,37,32,80,81,82,83,85, + 58,38, + 49,72,31, + 49,31, + 20,23,49,72,31, + 62, + 6, + 6, + 6, + 3, + 3,4,18,45,47,62,64,79, + 3,7,9,18,62,64,73,79, + 9, + 3, + 9, + 9, + 9, + 3,7,9,18,62,64,73,79, + 4,47, + 3,9,18,64,73,79, + 3,9,18,79, + 3,9,18,79, + 3, + 9,18, + 9,18, + 62, + 9,18, + 9, + 8,48, + 0,16,49,61,70,33,40,31, + 4,11,12,43,49,64,70,72,35,40,31, + 0,40, + 17,20,39, + 4,58,38, + 4, + 4, + 4, + 21,48,53,60,72,31, + 18,59,35, + 59,35, + 41, + 4,26,58,38,79,85, + 72, + 53,64,79, + 18,59,35, + 2,3,4,51,58,60,72,38,41,31,79,84, + 29,72,73,33,31,79,84, + 3, + 3, + 3, + 85, + 2,38, + 0,1,3,4,56,8,15,16,18,20,21,23,24,25,28,45,47,48,49,50,51,53,57,60,61,64,67,70,72,73,75,37,39,40,41,31,79,80,81,82, + 1,3,8,9,15,24,28,48,60,31,80,82, + 1,3,8,9,15,24,28,48,60,31,80,82, + 1,3,9,15,60,31, + 3,9, + 3, + 50,37, + 3,21,31, + 12,34, + 0,61,40,31,79,84, + 29, + 70,40, + 6,21,63,70,34,37,38,40, + 64,69,40, + 72, + 85, + 49,31, + 49,31, + 72, + 8,20,23,30,62,75,39,81, + 50,64,37, + 18,28,45,64,35,79, + 79, + 45,79, + 18, + 18, + 70,40, + 16,64,70,76,38,40, + 64,70,40, + 2,10,16,17,22,27,42,44,51,53,54,55,57,58,63,66,67,68,69,70,76,79,80, + 85, + 53,84, + 50, + 6,63,38, + 6,63,38, + 12,50,37, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,32,80,81,82,83,85, + 64, + 2,38, + 3,18,45,64,79, + 79, + 18,45,79, + 3,18,45,64,79, + 64, + 37, + 3,4,18,45,64,79, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 56,9,60,37,31, + 42,45,73, + 70,40, + 3,10,15,20,23,25,42,72,75,38,39,31,79,81, + 3,20,25,39,31,81, + 7,20,62,64,39,79, + 20,62,39, + 62, + 25,39,31,81, + 25,39,31,81, + 50,64, + 0,26,30,40, + 70,40, + 34, + 58,38, + 49,61,31, + 61,31, + 72, + 79, + 47,51,52,64,66,70,76,77,78,40,41,80,85, + 47,85, + 58,38, + 0,13,14,16,46,30,64,69,70,76,77,78,40, + 53,55,41, + 60,31, + 33, + 70,34,36,40, + 70,40, + 70,40, + 64, + 46,72,40, + 70,40, + 0,1,2,4,56,6,7,8,10,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,33,35,37,38,39,40,41,31,79,80,81,82,83,85, + 70,40, + 14,33,40, + 14,26,27,50,33,37,38,40,85, + 53,66,41, + 18,65,70,35,40, + 12,34, + 79, + 79, + 53,65,66,35,41,79, + 53,64,66,41,79, + 50,64, + 13,15,16,18,47,50,54,64,67,76,77,78,33,38,40,41,31,85, + 17,44,68, + 17,44,68, + 3,4,6,7,9,11,18,45,47,30,50,62,64,73,79,85, + 53,70,72,40,79, + 70,40, + 37, + 67,41,79, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,37,32,80,81,82,83,85, + 36,37, + 36, + 8,15,20,23,51,54,55,58,60,61,73,75,38,39,41,32,80,81,82,84, + 2,7,68,38,32, + 64, + 70,72,40, + 0,1,2,8,5,10,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,33,34,35,36,37,38,39,40,31,80,81,82,83,84,85, + 42,60,72,38,31,84, + 58,38, + 32, + 21,28,59,65,35,31, + 0,12,16,27,29,45,53,57,61,38,40,41,31,84, + 11,12, + 3,4,6,7,9,11,12,18,45,62,64,73,79, + 3,11,12,45,73, + 64,69,40, + 6,47,64,34, + 12, + 0,2,4,10,12,13,14,16,17,19,22,26,28,42,43,44,47,30,50,51,52,53,55,57,58,59,63,64,65,66,67,68,69,70,76,77,78,33,34,35,37,38,40,41,79,80,85, + 37,32, + 37,32, + 18, + 26, + 46,40, + 42,45,47,64,38,79,85, + 79, + 79, + 14,40, + 14,19,45,57,71,74,33,40,41, + 56,28,45,57,59,65,71,74,33,35,41, + 61,83, + 12, + 29, + 28,48,76,77,37,40, + 37, + 49,31, + 60,31, + 57,41, + 60, + 53,54,55, + 29, + 56,9, + 10,60,70,38,40,31, + 45,72,73, + 45, + 45,73, + 45,73, + 45, + 49,70,40,31, + 29, + 56,8,9,20,23,26,28,45,54,57,59,65,74,75,33,35,38,39,41,81, + 9, + 9, + 49,31, + 26, + 65, + 15,21,60,61,37,31,82, + 0,8,9,10,16,42,49,54,64,70,78,38,40,31,79, + 56, + 0,66,40,41, + 6,7,11,62,75,39,79, + 62, + 62, + 62, + 21,31, + 0,70,40, + 70,40, + 70,40, + 70,40, + 70,40, + 50, + 56, + 36, + 1,28,52,72,41,31,80,82, + 30,53,55,36,41, + 55,41, + 55,41, + 72, + 70,40, + 3,4,6,7,9,18,45,62,64,73,34,79, + 26,64,77,33,40,85, + 64, + 47, + 5,33,37,40, + 26,33,38,85, + 26,33, + 26, + 26,45,47,64,79, + 26, + 85, + 26, + 50, + 64, + 64,76,77,78,40, + 64,76,40, + 64,77,40, + 64,78,40, + 29,43,50,57,70,37,40,41,79, + 70,40, + 70,40, + 79, + 51,41,79, + 51,39,41, + 20,23,49,52,75,41,31,79,84, + 8,28,75, + 72, + 27,72,38, + 56, + 72,73, + 52,41, + 8,26,70,76,40,83, + 52,41, + 72, + 46,64,40, + 52,41, + 46,40, + 8, + 1,3,15,18,21,45,51,60,61,73,79,84, + 21,53,55,61,41,79, + 64, + 70,40, + 85, + 50, + 18,43,35, + 18,43,35, + 16,43,46,50,70,35,37,40, + 70,40, + 64,70,40, + 50,58,37, + 6, + 6, + 20,62,39,81, + 62, + 62, + 62, + 79, + 79, + 6,17,54,67,38,41,79, + 6, + 6,5,10,42,30,51,52,53,54,55,57,66,67,38,41,79,80, + 53,55,57,41,79,80, + 53,54,55,38,41,79,80, + 79, + 79, + 79, + 11,12, + 49,31, + 3,4,60,31, + 0,16,58,64,37,38,40, + 20, + 29, + 45,73, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,46,48,49,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,33,34,35,37,38,39,40,41,32,31,80,81,82,83,85, + 37, + 0,3,4,56,8,9,10,14,17,18,20,24,44,45,46,47,53,54,55,58,73,75,37,38,39,40,41,79,81,84, + 21,26,27,58,70,72,33,37,38,39,40,32,85, + 33, + 16,40, + 47, + 12,20,34,38,39, + 49,31, + 6,47,64, + 2,56,16,26,27,43,30,49,54,70,72,78,33,34,35,37,38,40,41,32,31,85, + 0,1,2,56,8,10,12,13,14,15,16,17,19,20,21,22,23,24,25,27,28,29,42,43,44,46,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,69,70,71,72,74,75,76,77,78,32,80,81,82,83,85, + 7,62,64,79, + 56, + 56, + 56, + 56, + 0,40, + 50,64,37, + 37, + 0,2,8,10,12,16,20,23,28,42,46,49,50,53,55,57,60,64,65,69,70,72,75,35,37,38,39,40,41,31,80,81,82, + 26, + 70,40, + 3,4,7,15,18,20,23,25,28,45,48,49,51,53,55,60,62,64,65,66,72,73,35,39,41,31,79,80,81,82,84, + 3,73, + 3,18, + 18, + 18, + 3,18, + 18, + 18, + 18, + 3,4,7,15,16,18,20,23,24,25,28,50,51,59,60,61,62,64,65,67,75,33,35,37,39,40,41,31,79,81, + 61, + 24,33, + 24,33, + 37, + 37, + 1,3,56,6,8,9,16,18,24,26,45,47,48,62,64,73,33,39,40,41,31,79,80,82, + 56,8,28,48,72,75,41,85, + 0,10,12,16,42,49,76,77,78,34,37,40,31,83,85, + 34, + 34, + 12,34, + 50,37, + 79, + 79, + 79, + 34, + 79, + 79, + 72, + 3,18,45,64,79, + 4, + 79, + 64, + 64,33, + 2,38, + 2,4,38, + 8,26,28,48,51,53,75, + 2,4,38, + 73, + 50, + 50,37, + 37, + 13,18,50,40, + 29,33,37, + 30, + 1,2,8,10,15,17,19,20,21,22,23,24,25,26,27,28,29,42,43,44,48,51,52,53,54,55,57,58,59,60,61,63,65,66,67,68,70,71,72,74,75,36,38,40,41,31,80,81,82,83, + 3,56,13,16,18,26,28,29,45,50,59,64,65,72,73,77,78,33,35,40,79,83, + 64, + 64, + 18, + 18, + 12, + 26,36, + 12,16,40, + 64, + 53,70,72,34,40,31,84,85, + 72, + 45,73, + 3,8,25,49,61,72,75,37,31, + 8,39, + 8,39, + 49,31, + 49,31, + 49,31, + 50,37, + 50,37, + 72, + 31,84, + 6, + 6, + 3,8,25,49,61,72,75,37,31, + 8,39, + 8,39, + 49,31, + 49,31, + 49,31, + 50,37, + 50,37, + 43,69,77,36,37,40,84,85, + 6, + 6, + 2,3,8,49,61,75,37,38,31, + 8,39, + 8,39, + 20, + 50,37, + 50,37, + + diff --git a/doc/salome/gui/GEOM/whxdata/whtdata0.xml b/doc/salome/gui/GEOM/whxdata/whtdata0.xml new file mode 100755 index 000000000..adf85eb28 --- /dev/null +++ b/doc/salome/gui/GEOM/whxdata/whtdata0.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/gui/GEOM/wire.htm b/doc/salome/gui/GEOM/wire.htm new file mode 100755 index 000000000..f2afb8e0e --- /dev/null +++ b/doc/salome/gui/GEOM/wire.htm @@ -0,0 +1,134 @@ + + + + + +Wire + + + + + + + + + + + +

     Wire

    + +

    To create + a Wire in the Main Menu select + New Entity - > Build - > Wire

    + +

     

    + +

    You can create a Wire from several + connected edges and wires by selecting them in the object browser or ion + the viewer holding Shift button.  

    + +

    The + Result  will + be a GEOM_Object (WIRE).

    + +

     

    + +

    TUI Command : + geompy.MakeWire(ListOfShape).

    + +

     

    + +

    Arguments: + Name + List of connected wires or edges..

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts provide you with useful examples + of creation of Advanced Geometric + Objects.

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/working_plane.htm b/doc/salome/gui/GEOM/working_plane.htm new file mode 100755 index 000000000..8b8c33f30 --- /dev/null +++ b/doc/salome/gui/GEOM/working_plane.htm @@ -0,0 +1,131 @@ + + + + + +Working Plane + + + + + + + + + + + +

    Working Plane

    + +

    To create a Working Plane in + the Main Menu select New + Entity - > Basic - > Working Plane

    + +

     

    + +

    There are some algorithms to set the Working Plane and the Camera Position.

    + +

     

    + +

    Firstly, you can select a Plane + or a Planar Face to be your Working Plane

    + +

    Arguments: + Name + 1 selection (face or planar face),

    + +

    + +

     

    + +

    Secondly, you can define a Working + Plane by two Vectors

    + +

    Arguments: + Name +  2 + vectors,

    + +

    + +

     

    + +

    Finally, you can select one of three basic + projections of XYZ coordinate system to be your Working + Plane

    + +

     

    + +

    + +

     

    + +

     

    + + + + diff --git a/doc/salome/gui/GEOM/working_with_groups.htm b/doc/salome/gui/GEOM/working_with_groups.htm new file mode 100755 index 000000000..401729081 --- /dev/null +++ b/doc/salome/gui/GEOM/working_with_groups.htm @@ -0,0 +1,211 @@ + + + + + +Working with groups + + + + + + + + + + + +

    Working with groups

    + +

    The Salome platform offers + such a useful functionality as creation and editing groups of subshapes + of a geometrical object which makes handling subshapes much easier. However + the functionality is available in the OCC viewer only. If other viewer + is used in your project by default, you can toggle the OCC viewer via + Preferences / Viewer background / OCC viewer.  

    + +

     

    + +

    To perform operations with groups:

    + +

     

    + +

    In the main menu select New + entity > Group.

    + +

     

    + +

    Create + a group

    + +

     

    + +

    Description: + Creates a group of subshapes of a geometrical object.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: + geompy.CreateGroup(MainShape, ShapeType), + where MainShape is a shape for which the group is created, ShapeType is + a type of shapes in the created group.

    + +

     

    + +

    Arguments: + 1 Shape + Type of subshape.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Example:

    + +

     

    + +

    + +

     

    + +

     

    + +

     

    + +

    Edit + a group

    + +

     

    + +

    Description: + Allows to edit the existing group.

    + +

     

    + +

    Result: GEOM_Object.

    + +

     

    + +

    TUI Command: +

    + + + +

    Returns: + List of IDs.

    + +

     

    + +

    Arguments: + 1 Shape + its subshapes.

    + +

     

    + +

    Dialog Box:

    + +

     

    + +

    + +

     

    + +

    Our TUI Scripts + provide you with useful examples of Working + with Groups.

    + +

     

    + + + + diff --git a/doc/salome/tui/GEOM/doxyfile b/doc/salome/tui/GEOM/doxyfile new file mode 100755 index 000000000..0ed451a70 --- /dev/null +++ b/doc/salome/tui/GEOM/doxyfile @@ -0,0 +1,200 @@ +# Doxyfile 1.3-rc1 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME - GEOM - v.3.1.0" +PROJECT_NUMBER = id#1.1 +OUTPUT_DIRECTORY = ../ +OUTPUT_LANGUAGE = English +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = NO +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 5 +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ALIASES = +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 25 +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = YES +SHOW_USED_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = log.txt +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = ../../../share/salome/idl/GEOM_Gen.idl +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = sources/ +INPUT_FILTER = +FILTER_SOURCE_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = GEOM +HTML_FILE_EXTENSION = .html +HTML_HEADER = sources/myheader.html +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_SCHEMA = +XML_DTD = +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = NO +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = jpg +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1200 +GENERATE_LEGEND = NO +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO +CGI_NAME = search.cgi +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = /usr/local/bin/ +EXT_DOC_PATHS = diff --git a/doc/salome/tui/GEOM/doxyfile_py b/doc/salome/tui/GEOM/doxyfile_py new file mode 100755 index 000000000..2d28cceaa --- /dev/null +++ b/doc/salome/tui/GEOM/doxyfile_py @@ -0,0 +1,200 @@ +# Doxyfile 1.3-rc1 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME - GEOM - v.3.1.0" +PROJECT_NUMBER = id#1.1 +OUTPUT_DIRECTORY = ../ +OUTPUT_LANGUAGE = English +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = NO +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 5 +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ALIASES = +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 25 +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = YES +SHOW_USED_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = log.txt +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = list_py_files_to_process +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = ../sources/ +INPUT_FILTER = +FILTER_SOURCE_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = ../GEOM/geompy_doc +HTML_FILE_EXTENSION = .html +HTML_HEADER = ../sources/myheader_py2.html +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_SCHEMA = +XML_DTD = +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = NO +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = jpg +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1200 +GENERATE_LEGEND = NO +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO +CGI_NAME = search.cgi +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = /usr/local/bin/ +EXT_DOC_PATHS = diff --git a/doc/salome/tui/GEOM/sources/static/tree.js b/doc/salome/tui/GEOM/sources/static/tree.js new file mode 100755 index 000000000..d1ca30e7b --- /dev/null +++ b/doc/salome/tui/GEOM/sources/static/tree.js @@ -0,0 +1,59 @@ +foldersTree = gFld("SALOME v.3.1.0 ", "", "") + insDoc(foldersTree, gLnk("Main Page", "", "main.html")) + +aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) + aux2 = insFld(aux1, gFld("Modules", "")) + aux3 = insFld(aux2, gFld("SALOME GEOMETRY module", "")) +/*! insDoc(aux3, gLnk("Overview", "", "overview_Geometry.html"))*/ + aux4 = insFld(aux3, gFld("Packages", "")) + insDoc(aux4, gLnk("GEOM", "", "namespaceGEOM.html")) +/*! insDoc(aux3, gLnk("Examples", "", "examples_GEOM.html")) +*/ + +/*! Data structures +*/ + insDoc(aux1, gLnk("Data Structures", "", "annotated.html")) + +/*! insDoc(aux1, gLnk("GEOM::GEOM_Gen", "", "interfaceGEOM_1_1GEOM__Gen.html")) + insDoc(aux1, gLnk("GEOM::GEOM_Shape", "", "interfaceGEOM_1_1GEOM__Shape.html")) +*/ + insDoc(aux1, gLnk("Class Hierarchy", "", "hierarchy.html")) + +/*! + aux3 = insFld(aux2, gFld("GEOM::GEOM_Gen", "", "interfaceGEOM_1_1GEOM__Gen.html")) + aux3 = insFld(aux2, gFld("GEOM::GEOM_Shape", "", "interfaceGEOM_1_1GEOM__Shape.html")) + aux3 = insFld(aux2, gFld("GEOM::AxisStruct", "", "structGEOM_1_1AxisStruct.html")) + aux3 = insFld(aux2, gFld("GEOM::DirStruct", "", "structGEOM_1_1DirStruct.html")) + aux3 = insFld(aux2, gFld("GEOM::PointStruct", "", "structGEOM_1_1PointStruct.html")) +*/ + insDoc(aux1, gLnk("Class methods list", "", "functions.html")) +/*! +aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html")) + insDoc(aux1, gLnk("GEOM", "", "namespaceGEOM.html")) +*/ + insDoc(aux1, gLnk("Namespace Members", "", "namespacemembers.html")) + + insDoc(aux1, gLnk("File List", "", "files.html")) + +/*! + + insDoc(aux1, gLnk("GEOM_Gen.idl", "", "GEOM__Gen_8idl.html")) + insDoc(aux1, gLnk("GEOM_Shape.idl", "", "GEOM__Shape_8idl.html")) +*/ + +aux1 = insFld(foldersTree, gFld("IDL/Python mapping", "")) + insDoc(aux1, gLnk("Mapping of GEOMETRY IDL definitions to Python language", "", "page2.html")) + +/*!aux1 = insFld(foldersTree, gFld("Python Commands", "", "geompy_doc/main.html")) + insDoc(aux1, gLnk("Package geompy", "", "geompy_doc/namespacegeompy.html")) + insDoc(aux1, gLnk("Namespace Members", "", "geompy_doc/namespacemembers.html")) + insDoc(aux1, gLnk("File geompy.py", "", "geompy_doc/geompy_8py.html")) +*/ + +aux1 = insFld(foldersTree, gFld("Python Commands", "", "geompy_doc/main.html")) + insDoc(aux1, gLnk("Package List", "", "geompy_doc/namespaces.html")) + insDoc(aux1, gLnk("Namespace Members", "", "geompy_doc/namespacemembers.html")) + insDoc(aux1, gLnk("File List", "", "geompy_doc/files.html")) + +/*! insDoc(foldersTree, gLnk("Graphical Class Hierarchy", "", "inherits.html")) +*/ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl new file mode 100644 index 000000000..28c2ad4ae --- /dev/null +++ b/idl/GEOM_Gen.idl @@ -0,0 +1,2134 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOM_Gen.idl +// Author : Sergey RUIN + +#ifndef __GEOM_GEN__ +#define __GEOM_GEN__ + +#include "SALOME_Exception.idl" +#include "SALOME_Component.idl" +#include "SALOMEDS.idl" + +#include "SALOME_GenericObj.idl" + +module GEOM +{ + /*! + * Topological types of shapes (like Open Cascade types) + */ + enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, + FACE, WIRE, EDGE, VERTEX, SHAPE }; + + + /*! + * State of shape relatively geometrical surface like plane, sphere or cylinder. + * Is used in functions GEOM_IShapesOperations.GetShapesOn() + */ + enum shape_state + { + /*! Shape is on surface */ + ST_ON, + + /*! + * Shape is in the direction defined by the normal and not on surface. + * For plane it means above the plane, + * For sphere and cylinder it means outside of volume, bounded by the surface. + */ + ST_OUT, + + /*! + * Shape is in the direction defined by the normal and on surface. + * ONOUT = ON || OUT + */ + ST_ONOUT, + + /*! + * Complementary to ONOUT. + * For plane it means below the plane, + * For sphere and cylinder it means inside the volume, bounded by the surface + * (beyond axis and surface for cylinder and beyond cented and surface for sphere). + */ + ST_IN, + + /*! + * Complementary to OUT. + * ONIN = ON || IN + */ + ST_ONIN + }; + + typedef sequence string_array; + typedef sequence short_array; + typedef sequence ListOfLong; + typedef sequence ListOfDouble; + + interface GEOM_Object; + + typedef sequence ListOfGO; + + /*! + * GEOM_Object: interface of geometric object + */ + interface GEOM_Object : SALOME::GenericObj + { + + /*! + * Get an entry of the object in GEOM component. + */ + string GetEntry(); + + /*! + * Get ID of study, where the object is created. + */ + long GetStudyID(); + + /*! + * Get internal type of the object (POINT, BOX, CYLINDER, EXTRUSION...). + */ + long GetType(); + + /*! + * Get a shape_type of the object value. + */ + shape_type GetShapeType(); + + /*! + * Set name of the object. + * \param theName is a name which will be associated with this object. + */ + void SetName (in string theName); + + /*! + * Get name of the object associated with this object. + */ + string GetName(); + + /*! + * Set a Study entry where this object was published. + */ + void SetStudyEntry (in string theEntry); + + /*! + * Get a Study entry where this object was published. + */ + string GetStudyEntry(); + + /*! + * Get a list of all GEOM objects on which were the arguments + * when this object was constructed and modified. + * \note This method is supposed to be used by GUI only. + */ + ListOfGO GetDependency(); + + /*! + * Get a list of GEOM objects on which the last function that created or modified the object depends. + * \note This method is supposed to be used by GUI only. + */ + ListOfGO GetLastDependency(); + + /*! + * Get the TopoDS_Shape, for colocated case only. + */ + long getShape(); + + /*! + ###################################################################### + * Internal methods (For sub shape identification) + ###################################################################### + */ + + /*! + * Get geometric shape of the object as a byte stream + */ + SALOMEDS::TMPFile GetShapeStream(); + + /* + * Returns True if this object is not a sub shape of another object. + */ + boolean IsMainShape(); + + /* + * Get a list of ID's of sub shapes in the main shape. + * \note Internal method, suppopsed to be used only by GEOM_Client + */ + ListOfLong GetSubShapeIndices(); + + /* + * Get a main shape object to which this object is a sub shape + * \note Internal method, suppopsed to be used only by GEOM_Client + */ + GEOM_Object GetMainShape(); + + /* + * Return true if geom object representes a shape. + * For example, method return false for GEOM_MARKER + */ + boolean IsShape(); + }; + + + /*! + * GEOM_IOperations: basic methods of all geometric operations + */ + interface GEOM_IOperations : SALOME::GenericObj + { + /*! + * To know, if the operation was successfully performed + */ + boolean IsDone(); + + /*! + * Set the operation error code + * \param theErrorID is a string describing the error occured + * \note This method is supposed to be used only by interfaces inheriting from IOperations. + */ + void SetErrorCode (in string theErrorID); + + /*! + * Get the operation error code + */ + string GetErrorCode(); + + /*! + * Get ID of study, where the operation is defined + */ + long GetStudyID(); + + /*! + * Opens a new transaction + */ + void StartOperation(); + + /*! + * Closes the previously opened trasaction + */ + void FinishOperation(); + + /*! + * Aborts the previously opened transaction + */ + void AbortOperation(); + }; + + /*! + * GEOM_IBasicOperations: interface for basic geometry creation + * (Point, Vector, Plane, Marker) + */ + interface GEOM_IBasicOperations : GEOM_IOperations + { + /*! + * Create point by three coordinates. + * \param theX The X coordinate of the point. + * \param theY The Y coordinate of the point. + * \param theZ The Z coordinate of the point. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointXYZ (in double theX, in double theY, in double theZ); + + /*! + * Create a point, distant from the referenced point + * on the given distances along the coordinate axes. + * \param theReference The referenced point. + * \param theX Displacement from the referenced point along OX axis. + * \param theY Displacement from the referenced point along OY axis. + * \param theZ Displacement from the referenced point along OZ axis. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointWithReference (in GEOM_Object theReference, + in double theX, in double theY, in double theZ); + + /*! + * Create a point, corresponding to the given parameter on the given curve. + * \param theRefCurve The referenced curve. + * \param theParameter Value of parameter on the referenced curve. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, + in double theParameter); + + /*! + * Create a vector with the given components. + * \param theDX X component of the vector. + * \param theDY Y component of the vector. + * \param theDZ Z component of the vector. + * \return New GEOM_Object, containing the created vector. + */ + GEOM_Object MakeVectorDXDYDZ (in double theDX, + in double theDY, + in double theDZ); + + /*! + * Create a vector between two points. + * \param thePnt1 Start point for the vector. + * \param thePnt2 End point for the vector. + * \return New GEOM_Object, containing the created vector. + */ + GEOM_Object MakeVectorTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + + /*! + * Create a line, passing through the given point + * and parrallel to the given direction + * \param thePnt Point. The resulting line will pass through it. + * \param theDir Direction. The resulting line will be parallel to it. + * \return New GEOM_Object, containing the created line. + */ + GEOM_Object MakeLine (in GEOM_Object thePnt, in GEOM_Object theDir); + + /*! + * Create a line, passing through the given points + * \param thePnt1 First of two points, defining the line. + * \param thePnt2 Second of two points, defining the line. + * \return New GEOM_Object, containing the created line. + */ + GEOM_Object MakeLineTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + + /*! + * Create a plane, passing through the three given points + * \param thePnt1 First of three points, defining the plane. + * \param thePnt2 Second of three points, defining the plane. + * \param thePnt3 Fird of three points, defining the plane. + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + */ + GEOM_Object MakePlaneThreePnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in double theTrimSize); + + /*! + * Create a plane, passing through the given point + * and normal to the given vector. + * \param thePnt Point, the plane has to pass through. + * \param theVec Vector, defining the plane normal direction. + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + */ + GEOM_Object MakePlanePntVec (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theTrimSize); + + /*! + * Create a plane, similar to the existing one, but with another size of representing face. + * \param theFace Referenced plane. + * \param theTrimSize New half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + */ + GEOM_Object MakePlaneFace (in GEOM_Object theFace, + in double theTrimSize); + + /*! + * Create a local coordinate system. + * \param theOX,theOY,theOZ Three coordinates of coordinate system origin. + * \param theXDX,theXDY,theXDZ Three components of OX direction + * \param theYDX,theYDY,theYDZ Three components of OY direction + * \return New GEOM_Object, containing the created coordinate system. + */ + GEOM_Object MakeMarker (in double theOX , in double theOY , in double theOZ, + in double theXDX, in double theXDY, in double theXDZ, + in double theYDX, in double theYDY, in double theYDZ); + }; + + interface GEOM_ITransformOperations : GEOM_IOperations + { + /*! + * Translate the given object along the vector, specified by its end points. + * \param theObject The object to be translated. + * \param thePoint1 Start point of translation vector. + * \param thePoint2 End point of translation vector. + * \return theObject. + */ + GEOM_Object TranslateTwoPoints (in GEOM_Object theObject, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + + /*! + * Translate the given object along the vector, specified + * by its end points, creating its copy before the translation. + * \param theObject The object to be translated. + * \param thePoint1 Start point of translation vector. + * \param thePoint2 End point of translation vector. + * \return New GEOM_Object, containing the translated object. + */ + GEOM_Object TranslateTwoPointsCopy (in GEOM_Object theObject, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + + /*! + * Translate the given object along the vector, specified by its components. + * \param theObject The object to be translated. + * \param theDX,theDY,theDZ Components of translation vector. + * \return theObject. + */ + GEOM_Object TranslateDXDYDZ (in GEOM_Object theObject, + in double theDX, in double theDY, in double theDZ); + + /*! + * Translate the given object along the vector, specified + * by its components, creating its copy before the translation. + * \param theObject The object to be translated. + * \param theDX,theDY,theDZ Components of translation vector. + * \return New GEOM_Object, containing the translated object. + */ + GEOM_Object TranslateDXDYDZCopy (in GEOM_Object theObject, + in double theDX, in double theDY, in double theDZ); + + + /*! + * Translate the given object along the given vector. + * \param theObject The object to be translated. + * \param theVector Translation vector, giving both direction and distance. + * \return theObject. + */ + GEOM_Object TranslateVector (in GEOM_Object theObject, + in GEOM_Object theVector); + + /*! + * Translate the given object along the given vector, + * creating its copy before the translation. + * \param theObject The object to be translated. + * \param theVector Translation vector, giving both direction and distance. + * \return New GEOM_Object, containing the translated object. + */ + GEOM_Object TranslateVectorCopy (in GEOM_Object theObject, + in GEOM_Object theVector); + + /*! + * Translate the given object along the given vector a given number times + * \param theObject The object to be translated. + * \param theVector Direction of the translation. + * \param theStep Distance to translate on. + * \param theNbTimes Quantity of translations to be done. + * \return New GEOM_Object, containing compound of all + * the shapes, obtained after each translation. + */ + GEOM_Object MultiTranslate1D (in GEOM_Object theObject, + in GEOM_Object theVector, + in double theStep, + in long theNbTimes); + + /*! + * Conseqently apply two specified translations to theObject specified number of times. + * \param theObject The object to be translated. + * \param theVector1 Direction of the first translation. + * \param theStep1 Step of the first translation. + * \param theNbTimes1 Quantity of translations to be done along theVector1. + * \param theVector2 Direction of the second translation. + * \param theStep2 Step of the second translation. + * \param theNbTimes2 Quantity of translations to be done along theVector2. + * \return New GEOM_Object, containing compound of all + * the shapes, obtained after each translation. + */ + GEOM_Object MultiTranslate2D (in GEOM_Object theObject, + in GEOM_Object theVector1, + in double theStep1, + in long theNbTimes1, + in GEOM_Object theVector2, + in double theStep2, + in long theNbTimes2); + + /*! + * Rotate the given object around the given axis on the given angle. + * \param theObject The object to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in radians. + * \return theObject. + */ + GEOM_Object Rotate (in GEOM_Object theObject, + in GEOM_Object theAxis, + in double theAngle); + + /*! + * Rotate the given object around the given axis + * on the given angle, creating its copy before the rotatation. + * \param theObject The object to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in radians. + * \return New GEOM_Object, containing the rotated object. + */ + GEOM_Object RotateCopy (in GEOM_Object theObject, + in GEOM_Object theAxis, + in double theAngle); + + /*! + * Rotate the given object around the given axis a given number times. + * Rotation angle will be 2*PI/theNbTimes. + * \param theObject The object to be rotated. + * \param theAxis The rotation axis. + * \param theNbTimes Quantity of rotations to be done. + * \return New GEOM_Object, containing compound of all the + * shapes, obtained after each rotation. + */ + GEOM_Object MultiRotate1D (in GEOM_Object theObject, + in GEOM_Object theAxis, + in long theNbTimes); + + /*! + * Rotate the given object around the + * given axis on the given angle a given number + * times and multi-translate each rotation result. + * Translation direction passes through center of gravity + * of rotated shape and its projection on the rotation axis. + * \param theObject The object to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in graduces. + * \param theNbTimes1 Quantity of rotations to be done. + * \param theStep Translation distance. + * \param theNbTimes2 Quantity of translations to be done. + * \return New GEOM_Object, containing compound of all the + * shapes, obtained after each transformation. + */ + GEOM_Object MultiRotate2D (in GEOM_Object theObject, + in GEOM_Object theAxis, + in double theAngle, + in long theNbTimes1, + in double theStep, + in long theNbTimes2); + + /*! + * Replace the given object by an object, + * symmetrical to it relatively the given plane. + * \param theObject The object to be mirrored. + * \param thePlane Plane of symmetry. + */ + GEOM_Object MirrorPlane (in GEOM_Object theObject, in GEOM_Object thePlane); + + /*! + * Create an object, symmetrical + * to the given one relatively the given plane. + * \param theObject The object to be mirrored. + * \param thePlane Plane of symmetry. + * \return New GEOM_Object, containing the mirrored shape. + */ + GEOM_Object MirrorPlaneCopy (in GEOM_Object theObject, in GEOM_Object thePlane); + + /*! + * Replace the given object by an object, + * symmetrical to it relatively the given axis. + * \param theObject The object to be mirrored. + * \param theAxis Axis of symmetry. + * \return theObject. + */ + GEOM_Object MirrorAxis (in GEOM_Object theObject, in GEOM_Object theAxis); + + /*! + * Create an object, symmetrical + * to the given one relatively the given axis. + * \param theObject The object to be mirrored. + * \param theAxis Axis of symmetry. + * \return New GEOM_Object, containing the mirrored object. + */ + GEOM_Object MirrorAxisCopy (in GEOM_Object theObject, in GEOM_Object theAxis); + + /*! + * Replace the given object by an object, symmetrical to it relatively the given point. + * \param theObject The object to be mirrored. + * \param thePoint Point of symmetry. + * \return theObject. + */ + GEOM_Object MirrorPoint (in GEOM_Object theObject, in GEOM_Object thePoint); + + /*! + * Create an object, symmetrical to the given one relatively the given point. + * \param theObject The object to be mirrored. + * \param thePoint Point of symmetry. + * \return New GEOM_Object, containing the mirrored object. + */ + GEOM_Object MirrorPointCopy (in GEOM_Object theObject, in GEOM_Object thePoint); + + /*! + * Replace the given object by its offset. + * \param theObject The base object for the offset. + * \param theOffset Offset value. + * \return theObject. + */ + GEOM_Object OffsetShape (in GEOM_Object theObject, in double theOffset); + + /*! + * Create new object as offset of the given one. + * \param theObject The base object for the offset. + * \param theOffset Offset value. + * \return New GEOM_Object, containing the offset object. + */ + GEOM_Object OffsetShapeCopy (in GEOM_Object theObject, in double theOffset); + + /*! + * Scale the given object by the factor. + * \param theObject The object to be scaled. + * \param thePoint Center point for scaling. + * \param theFactor Scaling factor value. + * \return theObject. + */ + GEOM_Object ScaleShape (in GEOM_Object theObject, in GEOM_Object thePoint, + in double theFactor); + + /*! + * Scale the given object by the factor, creating its copy before the scaling. + * \param theObject The object to be scaled. + * \param thePoint Center point for scaling. + * \param theFactor Scaling factor value. + * \return New GEOM_Object, containing the scaled shape. + */ + GEOM_Object ScaleShapeCopy (in GEOM_Object theObject, in GEOM_Object thePoint, + in double theFactor); + + /*! + * Modify the Location of the given object by LCS + */ + GEOM_Object PositionShape (in GEOM_Object theObject, + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS); + + /*! + * Modify the Location of the given object by LCS + * creating its copy before the setting + */ + GEOM_Object PositionShapeCopy (in GEOM_Object theObject, + in GEOM_Object theStartLCS, + in GEOM_Object theEndLCS); + }; + + /*! + * GEOM_I3DPrimOperations: Interface for 3D primitives creation + * Box, Cylinder, Cone, Sphere, Prism (extrusion), + * Pipe (extrusion along contour), Revolution, Solid (from shell). + */ + interface GEOM_I3DPrimOperations : GEOM_IOperations + { + /*! + * Create a box with specified dimensions along the coordinate axes + * and with edges, parallel to the coordinate axes. + * Center of the box will be at point (DX/2, DY/2, DZ/2). + * \param theDX Length of Box edges, parallel to OX axis. + * \param theDY Length of Box edges, parallel to OY axis. + * \param theDZ Length of Box edges, parallel to OZ axis. + * \return New GEOM_Object, containing the created box. + */ + GEOM_Object MakeBoxDXDYDZ (in double theDX, in double theDY, in double theDZ); + + /*! + * Create a box with two specified opposite vertices, + * and with edges, parallel to the coordinate axes + * \param thePnt1 First of two opposite vertices. + * \param thePnt2 Second of two opposite vertices. + * \return New GEOM_Object, containing the created box. + */ + GEOM_Object MakeBoxTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + + /*! + * Create a cylinder with given radius and height at + * the origin of coordinate system. Axis of the cylinder + * will be collinear to the OZ axis of the coordinate system. + * \param theR Cylinder radius. + * \param theH Cylinder height. + * \return New GEOM_Object, containing the created cylinder. + */ + GEOM_Object MakeCylinderRH (in double theR, in double theH); + + /*! + * Create a cylinder with given base point, axis, radius and height. + * \param thePnt Central point of cylinder base. + * \param theAxis Cylinder axis. + * \param theR Cylinder radius. + * \param theH Cylinder height. + * \return New GEOM_Object, containing the created cylinder. + */ + GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt, + in GEOM_Object theAxis, + in double theR, + in double theH); + + /*! + * Create a cone with given height and radiuses at + * the origin of coordinate system. Axis of the cone will + * be collinear to the OZ axis of the coordinate system. + * \param theR1 Radius of the first cone base. + * \param theR2 Radius of the second cone base. + * \note If both radiuses are non-zero, the cone will be truncated. + * \note If the radiuses are equal, a cylinder will be created instead. + * \param theH Cone height. + * \return New GEOM_Object, containing the created cone. + */ + GEOM_Object MakeConeR1R2H (in double theR1, in double theR2, in double theH); + + /*! + * Create a cone with given base point, axis, height and radiuses. + * \param thePnt Central point of the first cone base. + * \param theAxis Cone axis. + * \param theR1 Radius of the first cone base. + * \param theR2 Radius of the second cone base. + * \note If both radiuses are non-zero, the cone will be truncated. + * \note If the radiuses are equal, a cylinder will be created instead. + * \param theH Cone height. + * \return New GEOM_Object, containing the created cone. + */ + GEOM_Object MakeConePntVecR1R2H (in GEOM_Object thePnt, + in GEOM_Object theAxis, + in double theR1, + in double theR2, + in double theH); + + /*! + * Create a torus with given radiuses at the origin of coordinate system. + * \param theRMajor Torus major radius. + * \param theRMinor Torus minor radius. + * \return New GEOM_Object, containing the created torus. + */ + GEOM_Object MakeTorusRR (in double theRMajor, + in double theRMinor); + + /*! + * Create a torus with given center, normal vector and radiuses. + * \param thePnt Torus central point. + * \param theVec Torus axis of symmetry. + * \param theRMajor Torus major radius. + * \param theRMinor Torus minor radius. + * \return New GEOM_Object, containing the created torus. + */ + GEOM_Object MakeTorusPntVecRR (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor); + + /*! + * Create a sphere with given radius at the origin of coordinate system. + * \param theR Sphere radius. + * \return New GEOM_Object, containing the created sphere. + */ + GEOM_Object MakeSphereR (in double theR); + + /*! + * Create a sphere with given center and radius. + * \param thePnt Sphere center. + * \param theR Sphere radius. + * \return New GEOM_Object, containing the created . + */ + GEOM_Object MakeSpherePntR (in GEOM_Object thePnt, in double theR); + + /*! + * Create a shape by extrusion of the base shape along the vector, + * i.e. all the space, transfixed by the base shape during its translation + * along the vector on the given distance. + * \param theBase Base shape to be extruded. + * \param theVec Direction of extrusion. + * \param theH Prism dimension along theVec. + * \return New GEOM_Object, containing the created prism. + */ + GEOM_Object MakePrismVecH (in GEOM_Object theBase, + in GEOM_Object theVec, + in double theH); + + /*! + * Create a shape by extrusion of the base shape along a vector, defined by two points. + * \param theBase Base shape to be extruded. + * \param thePoint1 First end of extrusion vector. + * \param thePoint2 Second end of extrusion vector. + * \return New GEOM_Object, containing the created prism. + */ + GEOM_Object MakePrismTwoPnt (in GEOM_Object theBase, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + + /*! + * Create a shape by extrusion of the base shape along + * the path shape. The path shape can be a wire or an edge. + * \param theBase Base shape to be extruded. + * \param thePath Path shape to extrude the base shape along it. + * \return New GEOM_Object, containing the created pipe. + */ + GEOM_Object MakePipe (in GEOM_Object theBase, in GEOM_Object thePath); + + /*! + * Create a shape by revolution of the base shape around the axis + * on the given angle, i.e. all the space, transfixed by the base + * shape during its rotation around the axis on the given angle. + * \param theBase Base shape to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in radians. + * \return New GEOM_Object, containing the created revolution. + */ + GEOM_Object MakeRevolutionAxisAngle (in GEOM_Object theBase, + in GEOM_Object theAxis, + in double theAngle); + + /*! + * Create a filling from the given compound of contours. + * \param theMinDeg a minimal degree + * \param theMaxDeg a maximal degree + * \param theTol2D a 2d tolerance + * \param theTol3D a 3d tolerance + * \param theNbIter a number of iteration + * \return New GEOM_Object, containing the created filling surface. + */ + GEOM_Object MakeFilling (in GEOM_Object theShape, + in long theMinDeg, in long theMaxDeg, + in double theTol2D, in double theTol3D, + in long theNbIter); + }; + + /*! + * GEOM_IShapesOperations: Interface for Shapes creation: + * Edge from two points, Wire from edges, Face from wire, + * Shell from faces, Solid from shells, Compound from shapes + */ + interface GEOM_IShapesOperations : GEOM_IOperations + { + /*! + * Create a linear edge with specified ends. + * \param thePnt1 Point for the first end of edge. + * \param thePnt2 Point for the second end of edge. + * \return New GEOM_Object, containing the created edge. + */ + GEOM_Object MakeEdge (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + + /*! + * Create a wire from the set of edges and wires. + * \param theEdgesAndWires List of edge and/or wires. + * \return New GEOM_Object, containing the created wire. + */ + GEOM_Object MakeWire (in ListOfGO theEdgesAndWires); + + /*! + * Create a face on the given wire. + * \param theWire Wire to build the face on. + * \param isPlanarWanted If TRUE, only planar face will be built. + * If impossible, NULL object will be returned. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeFace (in GEOM_Object theWire, in boolean isPlanarWanted); + + /*! + * Create a face on the given wires set. + * \param theWires List of wires to build the face on. + * \param isPlanarWanted If TRUE, only planar face will be built. + * If impossible, NULL object will be returned. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeFaceWires (in ListOfGO theWires, in boolean isPlanarWanted); + + /*! + * Create a shell from the set of faces and shells. + * \param theFacesAndShells List of faces and/or shells. + * \return New GEOM_Object, containing the created shell. + */ + GEOM_Object MakeShell (in ListOfGO theFacesAndShells); + + /*! + * Create a solid, bounded by the given shell. + * \param theShell Bounding shell. + * \return New GEOM_Object, containing the created solid. + */ + GEOM_Object MakeSolidShell (in GEOM_Object theShell); + + /*! + * Create a solid, bounded by the given shells. + * \param theShells Bounding shells. + * \return New GEOM_Object, containing the created solid. + */ + GEOM_Object MakeSolidShells (in ListOfGO theShells); + + /*! + * Create a compound of the given shapes. + * \param theShapes List of shapes to put in compound. + * \return New GEOM_Object, containing the created compound. + */ + GEOM_Object MakeCompound (in ListOfGO theShapes); + + /*! + * Replace coincident faces in theShape by one face. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \return New GEOM_Object, containing a copy of theShape without coincident faces. + */ + GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance); + + /*! + * Explode a shape on subshapes of a given type. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param isSorted If this parameter is TRUE, sub-shapes will be + * sorted by coordinates of their gravity centers. + * \return List of sub-shapes of type theShapeType, contained in theShape. + */ + ListOfGO MakeExplode (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); + + /*! + * Explode a shape on subshapes of a given type. + * Does the same, as the above method, but returns IDs of sub-shapes, + * not GEOM_Objects. It works faster. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param isSorted If this parameter is TRUE, sub-shapes will be + * sorted by coordinates of their gravity centers. + * \return List of IDs of sub-shapes of type theShapeType, contained in theShape. + */ + ListOfLong SubShapeAllIDs (in GEOM_Object theShape, + in long theShapeType, + in boolean isSorted); + + /*! + * Get a sub shape defined by its unique ID inside \a theMainShape + * \note The sub shape GEOM_Objects can has ONLY ONE function. + * Don't try to apply modification operations on them. + */ + GEOM_Object GetSubShape (in GEOM_Object theMainShape, + in long theID); + + /*! + * Count number of faces in the given shape. + * \param theShape Shape to count faces in. + * \return Number of faces in the given shape. + */ + long NumberOfFaces (in GEOM_Object theShape); + + /*! + * Count number of edges in the given shape. + * \param theShape Shape to count edges in. + * \return Number of edges in theShape. + */ + long NumberOfEdges (in GEOM_Object theShape); + + /*! + * Reverses an orientation the given shape. + * \param theShape Shape to be reversed. + * \return The reversed copy of theShape. + */ + GEOM_Object ChangeOrientation (in GEOM_Object theShape); + + /*! + * Retrieve all free faces from the given shape. + * Free face is a face, which is not shared between two shells of the shape. + * \param theShape Shape to find free faces in. + * \return List of IDs of all free faces, contained in theShape. + */ + ListOfLong GetFreeFacesIDs (in GEOM_Object theShape); + + /*! + * Get all sub-shapes of theShape1 of the given type, shared with theShape2. + * \param theShape1 Shape to find sub-shapes in. + * \param theShape2 Shape to find shared sub-shapes with. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of sub-shapes of theShape1, shared with theShape2. + */ + ListOfGO GetSharedShapes (in GEOM_Object theShape1, + in GEOM_Object theShape2, + in long theShapeType); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified plane by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAx1 Vector (or line, or linear edge), specifying normal + * direction and location of the plane to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of all found sub-shapes. + */ + ListOfGO GetShapesOnPlane (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAx1, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified cylinder by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAxis Vector (or line, or linear edge), specifying + * axis of the cylinder to find shapes on. + * \param theRadius Radius of the cylinder to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of all found sub-shapes. + */ + ListOfGO GetShapesOnCylinder (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAxis, + in double theRadius, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified sphere by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theCenter Point, specifying center of the sphere to find shapes on. + * \param theRadius Radius of the sphere to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of all found sub-shapes. + */ + ListOfGO GetShapesOnSphere (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theCenter, + in double theRadius, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified quadrangle by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theTopLeftPoint Top left quadrangle corner + * \param theTopRigthPoint Top right quadrangle corner + * \param theBottomLeftPoint Bottom left quadrangle corner + * \param theBottomRigthPoint Bottom right quadrangle corner + * \param theState The state of the subshapes to find. + * \return List of all found sub-shapes. + */ + ListOfGO GetShapesOnQuadrangle (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theTopLeftPoint, + in GEOM_Object theTopRigthPoint, + in GEOM_Object theBottomLeftPoint, + in GEOM_Object theBottomRigthPoint, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified plane by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAx1 Vector (or line, or linear edge), specifying normal + * direction and location of the plane to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of IDs of all found sub-shapes. + */ + ListOfLong GetShapesOnPlaneIDs (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAx1, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified cylinder by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAxis Vector (or line, or linear edge), specifying + * axis of the cylinder to find shapes on. + * \param theRadius Radius of the cylinder to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of IDs of all found sub-shapes. + */ + ListOfLong GetShapesOnCylinderIDs (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theAxis, + in double theRadius, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified sphere by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theCenter Point, specifying center of the sphere to find shapes on. + * \param theRadius Radius of the sphere to find shapes on. + * \param theState The state of the subshapes to find. + * \return List of IDs of all found sub-shapes. + */ + ListOfLong GetShapesOnSphereIDs (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theCenter, + in double theRadius, + in shape_state theState); + + /*! + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified quadrangle by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theTopLeftPoint Top left quadrangle corner + * \param theTopRigthPoint Top right quadrangle corner + * \param theBottomLeftPoint Bottom left quadrangle corner + * \param theBottomRigthPoint Bottom right quadrangle corner + * \param theState The state of the subshapes to find. + * \return List of IDs of all found sub-shapes. + */ + ListOfLong GetShapesOnQuadrangleIDs (in GEOM_Object theShape, + in long theShapeType, + in GEOM_Object theTopLeftPoint, + in GEOM_Object theTopRigthPoint, + in GEOM_Object theBottomLeftPoint, + in GEOM_Object theBottomRigthPoint, + in shape_state theState); + + /*! + * Get sub-shape(s) of theShapeWhere, which are + * coincident with \a theShapeWhat or could be a part of it. + * \param theShapeWhere Shape to find sub-shapes of. + * \param theShapeWhat Shape, specifying what to find. + * \return Group of all found sub-shapes or a single found sub-shape. + */ + GEOM_Object GetInPlace (in GEOM_Object theShapeWhere, + in GEOM_Object theShapeWhat); + }; + + /*! + * GEOM_IBlocksOperations: Interface for Blocks construction + * Face from points or edges, Block from faces, + * Blocks multi-translation and multi-rotation + */ + interface GEOM_IBlocksOperations : GEOM_IOperations + { + /*! + * Creation of blocks + */ + + /*! + * Create a quadrangle face from four edges. Order of Edges is not + * important. It is not necessary that edges share the same vertex. + * \param theEdge1,theEdge2,theEdge3,theEdge4 Edges for the face bound. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeQuad (in GEOM_Object theEdge1, + in GEOM_Object theEdge2, + in GEOM_Object theEdge3, + in GEOM_Object theEdge4); + + /*! + * Create a quadrangle face on two edges. + * The missing edges will be built by creating the shortest ones. + * \param theEdge1,theEdge2 Two opposite edges for the face. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeQuad2Edges (in GEOM_Object theEdge1, + in GEOM_Object theEdge2); + + /*! + * Create a quadrangle face with specified corners. + * The missing edges will be built by creating the shortest ones. + * \param thePnt1,thePnt2,thePnt3,thePnt4 Corner vertices for the face. + * \return New GEOM_Object, containing the created face. + */ + GEOM_Object MakeQuad4Vertices (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3, + in GEOM_Object thePnt4); + + /*! + * Create a hexahedral solid, bounded by the six given faces. Order of + * faces is not important. It is not necessary that Faces share the same edge. + * \param theFace1-theFace6 Faces for the hexahedral solid. + * \return New GEOM_Object, containing the created solid. + */ + GEOM_Object MakeHexa (in GEOM_Object theFace1, + in GEOM_Object theFace2, + in GEOM_Object theFace3, + in GEOM_Object theFace4, + in GEOM_Object theFace5, + in GEOM_Object theFace6); + + /*! + * Create a hexahedral solid between two given faces. + * The missing faces will be built by creating the smallest ones. + * \param theFace1,theFace2 Two opposite faces for the hexahedral solid. + * \return New GEOM_Object, containing the created solid. + */ + GEOM_Object MakeHexa2Faces (in GEOM_Object theFace1, + in GEOM_Object theFace2); + + /*! + * Extract elements of blocks and blocks compounds + */ + + /*! + * Get a vertex, found in the given shape by its coordinates. + * \param theShape Block or a compound of blocks. + * \param theX,theY,theZ Coordinates of the sought vertex. + * \param theEpsilon Maximum allowed distance between the resulting + * vertex and point with the given coordinates. + * \return New GEOM_Object, containing the found vertex. + */ + GEOM_Object GetPoint (in GEOM_Object theShape, + in double theX, + in double theY, + in double theZ, + in double theEpsilon); + + /*! + * Get an edge, found in the given shape by two given vertices. + * \param theShape Block or a compound of blocks. + * \param thePoint1,thePoint2 Points, close to the ends of the desired edge. + * \return New GEOM_Object, containing the found edge. + */ + GEOM_Object GetEdge (in GEOM_Object theShape, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); + + /*! + * Find an edge of the given shape, which has minimal distance to the given point. + * \param theShape Block or a compound of blocks. + * \param thePoint Point, close to the desired edge. + * \return New GEOM_Object, containing the found edge. + */ + GEOM_Object GetEdgeNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint); + + /*! + * Returns a face, found in the given shape by four given corner vertices. + * \param theShape Block or a compound of blocks. + * \param thePoint1-thePoint4 Points, close to the corners of the desired face. + * \return New GEOM_Object, containing the found face. + */ + GEOM_Object GetFaceByPoints (in GEOM_Object theShape, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2, + in GEOM_Object thePoint3, + in GEOM_Object thePoint4); + + /*! + * Get a face of block, found in the given shape by two given edges. + * \param theShape Block or a compound of blocks. + * \param theEdge1,theEdge2 Edges, close to the edges of the desired face. + * \return New GEOM_Object, containing the found face. + */ + GEOM_Object GetFaceByEdges (in GEOM_Object theShape, + in GEOM_Object theEdge1, + in GEOM_Object theEdge2); + + /*! + * Find a face, opposite to the given one in the given block. + * \param theBlock Must be a hexahedral solid. + * \param theFace Face of \a theBlock, opposite to the desired face. + * \return New GEOM_Object, containing the found face. + */ + GEOM_Object GetOppositeFace (in GEOM_Object theBlock, + in GEOM_Object theFace); + + /*! + * Find a face of the given shape, which has minimal distance to the given point. + * \param theShape Block or a compound of blocks. + * \param thePoint Point, close to the desired face. + * \return New GEOM_Object, containing the found face. + */ + GEOM_Object GetFaceNearPoint (in GEOM_Object theShape, + in GEOM_Object thePoint); + + /*! + * Find a face of block, whose outside normale has minimal angle with the given vector. + * \param theShape Block or a compound of blocks. + * \param theVector Vector, close to the normale of the desired face. + * \return New GEOM_Object, containing the found face. + */ + GEOM_Object GetFaceByNormale (in GEOM_Object theBlock, + in GEOM_Object theVector); + + /*! + * Extract blocks from blocks compounds + */ + + /*! + * Check, if the compound contains only specified blocks. + * \param theCompound The compound to check. + * \param theMinNbFaces If solid has lower number of faces, it is not a block. + * \param theMaxNbFaces If solid has higher number of faces, it is not a block. + * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. + * \return TRUE, if the given compound contains only blocks. + * \return theNbBlocks Number of specified blocks in theCompound. + */ + boolean IsCompoundOfBlocks (in GEOM_Object theCompound, + in long theMinNbFaces, + in long theMaxNbFaces, + out long theNbBlocks); + + /*! + * Enumeration of Blocks Compound defects. + */ + enum BCErrorType + { + /* Each element of the compound should be a Block */ + NOT_BLOCK, + + /* An element is a potential block, but has degenerated and/or seam edge(s). */ + EXTRA_EDGE, + + /* A connection between two Blocks should be an entire face or an entire edge */ + INVALID_CONNECTION, + + /* The compound should be connexe */ + NOT_CONNECTED, + + /* The glue between two quadrangle faces should be applied */ + NOT_GLUED + }; + + /*! + * Description of Blocks Compound defect: type and incriminated sub-shapes. + */ + struct BCError + { + BCErrorType error; + ListOfLong incriminated; + }; + + /*! + * Sequence of all Blocks Compound defects. + */ + typedef sequence BCErrors; + + /*! + * Check, if the compound of blocks is given. + * To be considered as a compound of blocks, the + * given shape must satisfy the following conditions: + * - Each element of the compound should be a Block (6 faces and 12 edges). + * - A connection between two Blocks should be an entire quadrangle face or an entire edge. + * - The compound should be connexe. + * - The glue between two quadrangle faces should be applied. + * \note Single block is also accepted as a valid compound of blocks. + * \param theCompound The compound to check. + * \return TRUE, if the given shape is a compound of blocks. + * \return theErrors Structure, containing discovered errors and incriminated sub-shapes. + */ + boolean CheckCompoundOfBlocks (in GEOM_Object theCompound, + out BCErrors theErrors); + + /*! + * Convert sequence of Blocks Compound errors, returned by + * CheckCompoundOfBlocks(), into string. + * \param theCompound The bad compound. + * \param theErrors The sequence of \a theCompound errors. + * \return String, describing all the errors in form, suitable for printing. + */ + string PrintBCErrors (in GEOM_Object theCompound, + in BCErrors theErrors); + + /*! + * Remove all seam and degenerated edges from \a theShape. + * Unite faces and edges, sharing one surface. + * \param theShape The compound or single solid to remove irregular edges from. + * \return Improved shape. + */ + GEOM_Object RemoveExtraEdges (in GEOM_Object theShape); + + /*! + * Check, if the given shape is a blocks compound. + * Fix all detected errors. + * \note Single block can be also fixed by this method. + * \param theCompound The compound to check and improve. + * \return Improved compound. + */ + GEOM_Object CheckAndImprove (in GEOM_Object theCompound); + + /*! + * Get all the blocks, contained in the given compound. + * \param theCompound The compound to explode. + * \param theMinNbFaces If solid has lower number of faces, it is not a block. + * \param theMaxNbFaces If solid has higher number of faces, it is not a block. + * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. + * \return List of GEOM_Objects, containing the retrieved blocks. + */ + ListOfGO ExplodeCompoundOfBlocks (in GEOM_Object theCompound, + in long theMinNbFaces, + in long theMaxNbFaces); + + /*! + * Find block, containing the given point inside its volume or on boundary. + * \param theCompound Compound, to find block in. + * \param thePoint Point, close to the desired block. If the point lays on + * boundary between some blocks, we return block with nearest center. + * \return New GEOM_Object, containing the found block. + */ + GEOM_Object GetBlockNearPoint (in GEOM_Object theCompound, + in GEOM_Object thePoint); + + /*! + * Find block, containing all the elements, passed as the parts, or maximum quantity of them. + * \param theCompound Compound, to find block in. + * \param theParts List of faces and/or edges and/or vertices to be parts of the found block. + * \return New GEOM_Object, containing the found block. + */ + GEOM_Object GetBlockByParts (in GEOM_Object theCompound, + in ListOfGO theParts); + + /*! + * Return all blocks, containing all the elements, passed as the parts. + * \param theCompound Compound, to find blocks in. + * \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks. + * \return List of GEOM_Objects, containing the found blocks. + */ + ListOfGO GetBlocksByParts (in GEOM_Object theCompound, + in ListOfGO theParts); + + /*! + * Operations on blocks with gluing of result + */ + + /*! + * Multi-transformate block and glue the result. + * Transformation is defined so, as to superpose theDirFace1 with theDirFace2. + * \param theBlock Hexahedral solid to be multi-transformed. + * \param theDirFace1 First direction face global index. + * \param theDirFace2 Second direction face global index. + * \param theNbTimes Quantity of transformations to be done. + * \note Global index of sub-shape can be obtained, using method + * GEOM_ILocalOperations.GetSubShapeIndex(). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeMultiTransformation1D (in GEOM_Object theBlock, + in long theDirFace1, + in long theDirFace2, + in long theNbTimes); + + /*! + * Multi-transformate block and glue the result. + * \param theBlock Hexahedral solid to be multi-transformed. + * \param theDirFace1U,theDirFace2U Direction faces for the first transformation. + * \param theDirFace1V,theDirFace2V Direction faces for the second transformation. + * \param theNbTimesU,theNbTimesV Quantity of transformations to be done. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeMultiTransformation2D (in GEOM_Object theBlock, + in long theDirFace1U, + in long theDirFace2U, + in long theNbTimesU, + in long theDirFace1V, + in long theDirFace2V, + in long theNbTimesV); + + /*! + * Special operation - propagation + */ + + /*! + * Build all possible propagation groups. + * Propagation group is a set of all edges, opposite to one (main) + * edge of this group directly or through other opposite edges. + * Notion of Opposite Edge make sence only on quadrangle face. + * \param theShape Shape to build propagation groups on. + * \return List of GEOM_Objects, each of them is a propagation group. + */ + ListOfGO Propagate (in GEOM_Object theShape); + }; + + /*! + * GEOM_IBooleanOperations: Interface for boolean operations (Cut, Fuse, Common) + */ + interface GEOM_IBooleanOperations : GEOM_IOperations + { + /*! + * Perform one of boolean operations on two given shapes. + * \param theShape1 First argument for boolean operation. + * \param theShape2 Second argument for boolean operation. + * \param theOperation Indicates the operation to be done: + * 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeBoolean (in GEOM_Object theShape1, + in GEOM_Object theShape2, + in long theOperation); + + /*! + * Perform partition operation. + * \param theShapes Shapes to be intersected. + * \param theTools Shapes to intersect theShapes. + * \param theKeepInside Shapes, outside which the results will be deleted. + * Each shape from theKeepInside must belong to theShapes also. + * \param theRemoveInside Shapes, inside which the results will be deleted. + * Each shape from theRemoveInside must belong to theShapes also. + * \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). + * \param theRemoveWebs If TRUE, perform Glue 3D algorithm. + * \param theMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE. + * \return New GEOM_Object, containing the result shapes. + */ + GEOM_Object MakePartition (in ListOfGO theShapes, + in ListOfGO theTools, + in ListOfGO theKeepInside, + in ListOfGO theRemoveInside, + in short theLimit, + in boolean theRemoveWebs, + in ListOfLong theMaterials); + + /*! + * Perform partition of the Shape with the Plane + * \param theShape Shape to be intersected. + * \param thePlane Tool shape, to intersect theShape. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeHalfPartition (in GEOM_Object theShape, + in GEOM_Object thePlane); + }; + + /*! + * GEOM_ICurvesOperations: Interface for curves creation. + * Polyline, Circle, Spline (Bezier and Interpolation) + */ + interface GEOM_ICurvesOperations : GEOM_IOperations + { + /*! + * Create a circle with given center, normal vector and radius. + * \param thePnt Circle center. + * \param theVec Vector, normal to the plane of the circle. + * \param theR Circle radius. + * \return New GEOM_Object, containing the created circle. + */ + GEOM_Object MakeCirclePntVecR (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theR); + /*! + * Create a circle, passing through three given points + * \param thePnt1,thePnt2,thePnt3 Points, defining the circle. + * \return New GEOM_Object, containing the created circle. + */ + GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); + + /*! + * Create an ellipse with given center, normal vector and radiuses. + * \param thePnt Ellipse center. + * \param theVec Vector, normal to the plane of the ellipse. + * \param theRMajor Major ellipse radius. + * \param theRMinor Minor ellipse radius. + * \return New GEOM_Object, containing the created ellipse. + */ + GEOM_Object MakeEllipse (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor); + + /*! + * Create an arc of circle, passing through three given points. + * \param thePnt1 Start point of the arc. + * \param thePnt2 Middle point of the arc. + * \param thePnt3 End point of the arc. + * \return New GEOM_Object, containing the created arc. + */ + GEOM_Object MakeArc (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); + + /*! + * Create a polyline on the set of points. + * \param thePoints Sequence of points for the polyline. + * \return New GEOM_Object, containing the created polyline. + */ + GEOM_Object MakePolyline (in ListOfGO thePoints); + + /*! + * Create bezier curve on the set of points. + * \param thePoints Sequence of points for the bezier curve. + * \return New GEOM_Object, containing the created bezier curve. + */ + GEOM_Object MakeSplineBezier (in ListOfGO thePoints); + + /*! + * Create B-Spline curve on the set of points. + * \param thePoints Sequence of points for the B-Spline curve. + * \return New GEOM_Object, containing the created B-Spline curve. + */ + GEOM_Object MakeSplineInterpolation (in ListOfGO thePoints); + + /*! + * Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. \n + * Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n + * Format of the description string have to be the following: + * + * "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]" + * + * Where: + * - x1, y1 are coordinates of the first sketcher point (zero by default), + * - CMD is one of + * - "R angle" : Set the direction by angle + * - "D dx dy" : Set the direction by DX & DY + * . + * \n + * - "TT x y" : Create segment by point at X & Y + * - "T dx dy" : Create segment by point with DX & DY + * - "L length" : Create segment by direction & Length + * - "IX x" : Create segment by direction & Intersect. X + * - "IY y" : Create segment by direction & Intersect. Y + * . + * \n + * - "C radius length" : Create arc by direction, radius and length(in degree) + * . + * \n + * - "WW" : Close Wire (to finish) + * - "WF" : Close Wire and build face (to finish) + * + * \param theCommand String, defining the sketcher in local + * coordinates of the working plane. + * \param theWorkingPlane Nine double values, defining origin, + * OZ and OX directions of the working plane. + * \return New GEOM_Object, containing the created wire. + */ + GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane); + + /*! + * Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. \n + * For format of the description string see the previous method.\n + * \param theCommand String, defining the sketcher in local + * coordinates of the working plane. + * \param theWorkingPlane Planar Face of the working plane. + * \return New GEOM_Object, containing the created wire. + */ + GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane); + }; + + /*! + * GEOM_ILocalOperations: Interface for fillet and chamfer creation. + */ + interface GEOM_ILocalOperations : GEOM_IOperations + { + /*! + * Perform a fillet on all edges of the given shape. + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeFilletAll (in GEOM_Object theShape, + in double theR); + + /*! + * Perform a fillet on the specified edges of the given shape + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \param theEdges Global indices of edges to perform fillet on. + * \note Global index of sub-shape can be obtained, using method GetSubShapeIndex(). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeFilletEdges (in GEOM_Object theShape, + in double theR, + in ListOfLong theEdges); + + /*! + * Perform a fillet on all edges of the specified faces of the given shape. + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \param theFaces Global indices of faces to perform fillet on. + * \note Global index of sub-shape can be obtained, using method GetSubShapeIndex(). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeFilletFaces (in GEOM_Object theShape, + in double theR, + in ListOfLong theFaces); + + /*! + * Perform a symmetric chamfer on all edges of the given shape. + * \param theShape Shape, to perform chamfer on. + * \param theD Chamfer size along each face. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeChamferAll (in GEOM_Object theShape, + in double theD); + + /*! + * Perform a chamfer on edges, common to the specified faces. + * with distance D1 on the Face1 + * \param theShape Shape, to perform chamfer on. + * \param theD1 Chamfer size along \a theFace1. + * \param theD2 Chamfer size along \a theFace2. + * \param theFace1,theFace2 Global indices of two faces of \a theShape. + * \note Global index of sub-shape can be obtained, using method GetSubShapeIndex(). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeChamferEdge (in GEOM_Object theShape, + in double theD1, in double theD2, + in long theFace1, in long theFace2); + + /*! + * Perform a chamfer on all edges of the specified faces. + * with distance D1 on the first specified face (if several for one edge) + * \param theShape Shape, to perform chamfer on. + * \param theD1 Chamfer size along face from \a theFaces. If both faces, + * connected to the edge, are in \a theFaces, \a theD1 + * will be get along face, which is nearer to \a theFaces beginning. + * \param theD2 Chamfer size along another of two faces, connected to the edge. + * \param theFaces Sequence of global indices of faces of \a theShape. + * \note Global index of sub-shape can be obtained, using method GetSubShapeIndex(). + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeChamferFaces (in GEOM_Object theShape, + in double theD1, in double theD2, + in ListOfLong theFaces); + + /*! + * Perform an Archimde operation on the given shape with given parameters. + * The object presenting the resulting face is returned + * \param theShape Shape to be put in water. + * \param theWeight Weight og the shape. + * \param theWaterDensity Density of the water. + * \param theMeshDeflection Deflection od the mesh, using to compute the section. + * \return New GEOM_Object, containing a section of \a theShape + * by a plane, corresponding to water level. + */ + GEOM_Object MakeArchimede (in GEOM_Object theShape, + in double theWeight, + in double theWaterDensity, + in double theMeshDeflection); + + /*! + * Get global index of \a theSubShape in \a theShape. + * \param theShape Main shape. + * \param theSubShape Sub-shape of the main shape. + * \return global index of \a theSubShape in \a theShape. + */ + long GetSubShapeIndex (in GEOM_Object theShape, in GEOM_Object theSubShape); + }; + + /*! + * GEOM_IHealingOperations: Interface for shape healing operations. + * Shape Processing, SuppressFaces, etc. + */ + interface GEOM_IHealingOperations : GEOM_IOperations + { + /*! + * Apply a sequence of Shape Healing operators to the given object. + * \param theShapes Shape to be processed. + * \param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.). + * \param theParameters List of names of parameters + * ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.). + * \param theValues List of values of parameters, in the same order + * as parameters are listed in \a theParameters list. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object ProcessShape (in GEOM_Object theShapes, + in string_array theOperators, + in string_array theParameters, + in string_array theValues); + + /*! + * Get default sequence of operators, their parameters and parameters' values + * of Shape Process operation. In the current implementation the defaults are + * read from the file pointed by CSF_ShHealingDefaults environmental variable. + * \param theOperators Output. Default list of names of operators. + * \param theParameters Output. Default list of names of parameters. + * \param theValues Output. List of default values of parameters, in the same order + * as parameters are listed in \a theParameters list. + */ + void GetShapeProcessParameters (out string_array theOperators, + out string_array theParameters, + out string_array theValues); + /*! + * Get parameters and parameters' values for the given Shape Process operation. + * In the current implementation the defaults are + * read from the file pointed by CSF_ShHealingDefaults environmental variable. + * \param theOperator Input. The operator's name. + * \param theParameters Output. Default list of names of parameters. + * \param theValues Output. List of default values of parameters, in the same order + * as parameters are listed in \a theParameters list. + */ + void GetOperatorParameters (in string theOperator, + out string_array theParameters, + out string_array theValues); + + /*! + * Remove faces from the given object (shape). + * \param theObject Shape to be processed. + * \param theFaces Indices of faces to be removed, if EMPTY then the method + * removes ALL faces of the given object. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object SuppressFaces (in GEOM_Object theObject, in short_array theFaces); + + /*! + * Close an open wire. + * \param theObject Shape to be processed. + * \param theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, + * if -1, then theObject itself is a wire. + * \param isCommonVertex If TRUE : closure by creation of a common vertex, + * If FALS : closure by creation of an edge between ends. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object CloseContour (in GEOM_Object theObject, in short_array theWires, + in boolean isCommonVertex); + + /*! + * Remove internal wires and edges from the given object (face). + * \param theObject Shape to be processed. + * \param theWires Indices of wires to be removed, if EMPTY then the method + * removes ALL internal wires of the given object. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object RemoveIntWires (in GEOM_Object theObject, in short_array theWires); + + /*! + * Remove internal closed contours (holes) from the given object. + * \param theObject Shape to be processed. + * \param theWires Indices of wires to be removed, if EMPTY then the method + * removes ALL internal holes of the given object + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object FillHoles (in GEOM_Object theObject, in short_array theWires); + + /*! + * Sewing of the given object. + * \param theObject Shape to be processed. + * \param theTolerance Required tolerance value. + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object Sew (in GEOM_Object theObject, in double theTolerance); + + /*! + * Addition of a point to a given edge object. + * \param theObject Shape to be processed. + * \param theEdgeIndex Index of edge to be divided within theObject's shape, + * if -1, then theObject itself is the edge. + * \param theValue Value of parameter on edge or length parameter, + * depending on \a isByParameter. + * \param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], + * if FALSE : \a theValue is treated as a length parameter [0..1] + * \return New GEOM_Object, containing processed shape. + */ + GEOM_Object DivideEdge (in GEOM_Object theObject, in short theEdgeIndex, + in double theValue, in boolean isByParameter); + + /*! + * Get a list of wires (wrapped in GEOM_Object-s), + * that constitute a free boundary of the given shape. + * \param theObject Shape to get free boundary of. + * \param theClosedWires Output. Closed wires on the free boundary of the given shape. + * \param theOpenWires Output. Open wires on the free boundary of the given shape. + * \return FALSE, if an error(s) occured during the method execution. + */ + boolean GetFreeBoundary (in GEOM_Object theObject, + out ListOfGO theClosedWires, + out ListOfGO theOpenWires); + }; + + /*! + * GEOM_IInsertOperations: Interface for shape insert operations (like copy, import). + * + */ + interface GEOM_IInsertOperations : GEOM_IOperations + { + /*! + * Create a copy of the given object + */ + GEOM_Object MakeCopy (in GEOM_Object theOriginal); + + /*! + * Export the given shape into a file with given name. + * \param theObject Shape to be stored in the file. + * \param theFileName Name of the file to store the given shape in. + * \param theFormatName Specify format for the shape storage. + * Available formats can be obtained with ImportTranslators() method. + */ + void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName); + + /*! + * Import a shape from the BRep or IGES or STEP file + * (depends on given format) with given name. + * \param theFileName The file, containing the shape. + * \param theFormatName Specify format for the file reading. + * Available formats can be obtained with ImportTranslators() method. + * \return New GEOM_Object, containing the imported shape. + */ + GEOM_Object Import (in string theFileName, in string theFormatName); + + /*! + * Get the supported import formats and corresponding patterns for File dialog. + * \param theFormats Output. List of formats, available for import. + * \param thePatterns Output. List of file patterns, corresponding to available formats. + * \return Returns available formats and patterns through the arguments. + */ + void ImportTranslators (out string_array theFormats, + out string_array thePatterns); + + /*! + * Get the supported export formats and corresponding patterns for File dialog. + * \param theFormats Output. List of formats, available for export. + * \param thePatterns Output. List of file patterns, corresponding to available formats. + * \return Returns available formats and patterns through the arguments. + */ + void ExportTranslators (out string_array theFormats, + out string_array thePatterns); + }; + + /*! + * GEOM_IMeasureOperations: Interface for measurement (distance, whatis) and + * properties calculation (like Centre of Mass, Inertia, etc.). + * + */ + interface GEOM_IMeasureOperations : GEOM_IOperations + { + /*! + * Get summarized length of all wires, + * area of surface and volume of the given shape. + * \param theShape Shape to define properties of. + * \param theLength Output. Summarized length of all wires of the given shape. + * \param theSurfArea Output. Area of surface of the given shape. + * \param theVolume Output. Volume of the given shape. + * \return Returns shape properties through the last three arguments. + */ + void GetBasicProperties (in GEOM_Object theShape, + out double theLength, + out double theSurfArea, + out double theVolume); + + /*! + * Get a point, situated at the centre of mass of theShape. + * \param theShape Shape to define centre of mass of. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object GetCentreOfMass (in GEOM_Object theShape); + + /*! + * Get inertia matrix and moments of inertia of theShape. + * \param theShape Shape to calculate inertia of. + * \param I(1-3)(1-3) Output. Components of the inertia matrix of the given shape. + * \param Ix,Iy,Iz Output. Moments of inertia of the given shape. + * \return Returns inertia through the last twelve arguments. + */ + void GetInertia (in GEOM_Object theShape, + out double I11, out double I12, out double I13, + out double I21, out double I22, out double I23, + out double I31, out double I32, out double I33, + out double Ix , out double Iy , out double Iz); + + /*! + * Get parameters of bounding box of the given shape + * \param theShape Shape to obtain bounding box of. + * \param Xmin,Xmax Output. Limits of shape along OX axis. + * \param Ymin,Ymax Output. Limits of shape along OY axis. + * \param Zmin,Zmax Output. Limits of shape along OZ axis. + * \return Returns parameters of bounding box through the last six arguments. + */ + void GetBoundingBox (in GEOM_Object theShape, + out double Xmin, out double Xmax, + out double Ymin, out double Ymax, + out double Zmin, out double Zmax); + + /*! + * Get min and max tolerances of sub-shapes of theShape + * \param theShape Shape, to get tolerances of. + * \param FaceMin,FaceMax Output. Min and max tolerances of the faces. + * \param EdgeMin,EdgeMax Output. Min and max tolerances of the edges. + * \param VertMin,VertMax Output. Min and max tolerances of the vertices. + * \return Returns shape tolerances through the last six arguments. + */ + void GetTolerance (in GEOM_Object theShape, + out double FaceMin, out double FaceMax, + out double EdgeMin, out double EdgeMax, + out double VertMin, out double VertMax); + + /*! + * Check a topology of the given shape. + * \param theShape Shape to check validity of. + * \param theDescription Output. Description of problems in the shape, if they are. + * \return TRUE, if the shape "seems to be valid" from the topological point of view. + */ + boolean CheckShape (in GEOM_Object theShape, + out string theDescription); + + /*! + * Obtain description of the given shape + * \param theShape Shape to be described. + * \return Description of the given shape. + */ + string WhatIs (in GEOM_Object theShape); + + /*! + * Get minimal distance between the given shapes. + * \param theShape1,theShape2 Shapes to find minimal distance between. + * \param X1,Y1,Z1 Output. Coordinates of point on theShape1, nearest to theShape2. + * \param X2,Y2,Z2 Output. Coordinates of point on theShape2, nearest to theShape1. + * \return Value of the minimal distance between the given shapes. + */ + double GetMinDistance (in GEOM_Object theShape1, in GEOM_Object theShape2, + out double X1, out double Y1, out double Z1, + out double X2, out double Y2, out double Z2); + + + /*! + * Get point coordinates + */ + void PointCoordinates (in GEOM_Object theShape, out double X, out double Y, out double Z); + }; + + + /*! + * GEOM_IGroupOperations: Interface for groups creation. + */ + interface GEOM_IGroupOperations : GEOM_IOperations + { + /*! + * Creates a new group which will store sub shapes of theMainShape + * \param theMainShape is a GEOM object on which the group is selected + * \param theShapeType defines a shape type of the group + * \return a newly created GEOM group + */ + GEOM_Object CreateGroup (in GEOM_Object theMainShape, in long theShapeType); + + /*! + * Adds a sub object with ID theSubShapeId to the group + * \param theGroup is a GEOM group to which the new sub shape is added + * \param theSubShapeId is a sub shape ID in the main object. + * \note Use method ILocalOperations.GetSubShapeIndex() to get an ID by the sub shape + */ + void AddObject (in GEOM_Object theGroup, in long theSubShapeId); + + /*! + * Removes a sub object with ID \a theSubShapeId from the group + * \param theGroup is a GEOM group from which the sub shape is removed. + * \param theSubShapeId is a sub shape ID in the main object. + * \note Use method ILocalOperations.GetSubShapeIndex() to get an ID by the sub shape + */ + void RemoveObject (in GEOM_Object theGroup, in long theSubShapeId); + + /*! + * Adds to the group all the given shapes. No errors, if some shapes are alredy included. + * \param theGroup is a GEOM group to which the new sub shapes are added. + * \param theSubShapes is a list of sub shapes to be added. + */ + void UnionList (in GEOM_Object theGroup, in ListOfGO theSubShapes); + + /*! + * Removes from the group all the given shapes. No errors, if some shapes are not included. + * \param theGroup is a GEOM group from which the sub-shapes are removed. + * \param theSubShapes is a list of sub-shapes to be removed. + */ + void DifferenceList (in GEOM_Object theGroup, in ListOfGO theSubShapes); + + /*! + * Adds to the group all the given shapes. No errors, if some shapes are alredy included. + * \param theGroup is a GEOM group to which the new sub shapes are added. + * \param theSubShapes is a list of IDs of sub shapes to be added. + */ + void UnionIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes); + + /*! + * Removes from the group all the given shapes. No errors, if some shapes are not included. + * \param theGroup is a GEOM group from which the sub-shapes are removed. + * \param theSubShapes is a list of IDs of sub-shapes to be removed. + */ + void DifferenceIDs (in GEOM_Object theGroup, in ListOfLong theSubShapes); + + /*! + * Returns a type of sub objects stored in the group + * \param theGroup is a GEOM group which type is returned. + */ + long GetType (in GEOM_Object theGroup); + + /*! + * Returns a main shape associated with the group + * \param theGroup is a GEOM group for which a main shape object is requested + * \return a GEOM object which is a main shape for theGroup + */ + GEOM_Object GetMainShape (in GEOM_Object theGroup); + + /*! + * Returns a list of sub objects ID stored in the group + * \param theGroup is a GEOM group for which a list of IDs is requested + */ + ListOfLong GetObjects (in GEOM_Object theGroup); + }; + + + /*! + * GEOM_Gen: Interface to access other GEOM interfaces. + * Also contains some methods to access and manage GEOM objects. + */ + interface GEOM_Gen : Engines::Component,SALOMEDS::Driver + { + /*! + * Undo/Redo Management + */ + + void Undo (in long theStudyID); + + void Redo (in long theStudyID); + + /*! + * Publishing manangement + * Adds in theStudy a object theObject under with a name theName, + * if theFather is not NULL the object is placed under thFather's SObject. + * Returns a SObject where theObject is placed + */ + SALOMEDS::SObject AddInStudy (in SALOMEDS::Study theStudy, + in GEOM_Object theObject, + in string theName, + in GEOM_Object theFather); + + /*! + * Methods to access interfaces for objects creation and transformation + */ + GEOM_IBasicOperations GetIBasicOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_ITransformOperations GetITransformOperations(in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_I3DPrimOperations GetI3DPrimOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IShapesOperations GetIShapesOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IBooleanOperations GetIBooleanOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_ICurvesOperations GetICurvesOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_ILocalOperations GetILocalOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IHealingOperations GetIHealingOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IInsertOperations GetIInsertOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IMeasureOperations GetIMeasureOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IBlocksOperations GetIBlocksOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + GEOM_IGroupOperations GetIGroupOperations (in long theStudyID) raises (SALOME::SALOME_Exception); + + /*! + * Objects Management + */ + + /*! + * Removes the object from the GEOM component + * \param theObject is a GEOM object to be removed + */ + void RemoveObject (in GEOM_Object theObject); + + /*! + * Returns an object defined by the study and its entry in the GEOM component + * \param theStudyID is a SALOMEDS Study ID + * \param theEntry is an entry of the requested GEOM object in the GEOM component + * \note if the object has not previously been created a NULL GEOM object is returned + */ + GEOM_Object GetObject (in long theStudyID, in string theEntry); + + /*! + * Add a sub shape defined by indices in \a theIndices + * (contains unique IDs of sub shapes inside theMainShape) + * \note The sub shape GEOM_Objects can has ONLY ONE function. + * Don't try to apply modification operations on them. + * \note Internal method + */ + GEOM_Object AddSubShape (in GEOM_Object theMainShape, in ListOfLong theIndices); + + /*! + * GEOM object's IOR Management + */ + + /*! + * Returns a GEOM Object defined by its IOR + * \param theIOR a string containg an IOR of the requested GEOM object + */ + GEOM_Object GetIORFromString (in string theIOR); + + /*! + * Returns a string which contains an IOR of the GEOM object + * \param theObject is a GEOM object which IOR is requested + */ + string GetStringFromIOR (in GEOM_Object theObject); + + /*! + * Returns a name with which a GEOM object was dumped into python script + * \param theStudyEntry is an entry of the GEOM object in the study + */ + string GetDumpName (in string theStudyEntry); + + /*! + * Returns all names with which a GEOM objects was dumped + * into python script to avoid the same names in SMESH script + */ + string_array GetAllDumpNames(); + }; +}; + +#endif diff --git a/resources/GEOMCatalog.xml b/resources/GEOMCatalog.xml new file mode 100644 index 000000000..c6931a556 --- /dev/null +++ b/resources/GEOMCatalog.xml @@ -0,0 +1,4276 @@ + + + + + + + + + + + + + + + GEOM + Geometry + Geom + NRI + 3.1.0 + Geometry component + 1 + ModuleGeom.png + + + + + GEOM + No comment + + + + + + Undo + + + + 1 + + + + theStudyID + long + + + + + + + + + Redo + + + + 1 + + + + theStudyID + long + + + + + + + + + AddInStudy + + + + 1 + + + + theStudy + Study + + + + theObject + GEOM_Object + + + + theName + string + + + + theFather + GEOM_Object + + + + + + return + SObject + + + + + + + + GetIBasicOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IBasicOperations + + + + + + + + GetITransformOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_ITransformOperations + + + + + + + + GetI3DPrimOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_I3DPrimOperations + + + + + + + + GetIShapesOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IShapesOperations + + + + + + + + GetIBooleanOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IBooleanOperations + + + + + + + + GetICurvesOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_ICurvesOperations + + + + + + + + GetILocalOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_ILocalOperations + + + + + + + + GetIHealingOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IHealingOperations + + + + + + + + GetIInsertOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IInsertOperations + + + + + + + + GetIMeasureOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IMeasureOperations + + + + + + + + GetIBlocksOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IBlocksOperations + + + + + + + + GetIGroupOperations + + + + 1 + + + + theStudyID + long + + + + + + return + GEOM_IGroupOperations + + + + + + + + RemoveObject + + + + 1 + + + + theObject + GEOM_Object + + + + + + + + + GetObject + + + + 1 + + + + theStudyID + long + + + + theEntry + string + + + + + + return + GEOM_Object + + + + + + + + AddSubShape + + + + 1 + + + + theMainShape + GEOM_Object + + + + theIndices + ListOfLong + + + + + + return + GEOM_Object + + + + + + + + GetIORFromString + + + + 1 + + + + ior + string + + + + + + return + GEOM_Object + + + + + + + + GetStringFromIOR + + + + 1 + + + + theObject + GEOM_Object + + + + + + return + string + + + + + + + + hostname = localhost + + + + GEOM_Superv + GEOM_Superv + OTHER + mkr + 3.1.0 + Supervision wrapper for Geometry component + 1 + + + + GEOM_Superv + unknown + + + SetStudyID + mkr + 2.1.0 + unknown + 0 + + + theStudyID + long + unknown + + + + + + + CreateListOfGO + mkr + 2.1.0 + unknown + 0 + + + + return + GEOM_List + unknown + + + + + + AddItemToListOfGO + mkr + 2.1.0 + unknown + 0 + + + theList + GEOM_List + unknown + + + theObject + GEOM_Object + unknown + + + + + theList + GEOM_List + unknown + + + + + + CreateListOfLong + mkr + 2.1.0 + unknown + 0 + + + + return + GEOM_List + unknown + + + + + + AddItemToListOfLong + mkr + 2.1.0 + unknown + 0 + + + theList + GEOM_List + unknown + + + theObject + long + unknown + + + + + theList + GEOM_List + unknown + + + + + + CreateListOfDouble + mkr + 2.1.0 + unknown + 0 + + + + return + GEOM_List + unknown + + + + + + AddItemToListOfDouble + mkr + 2.1.0 + unknown + 0 + + + theList + GEOM_List + unknown + + + theObject + double + unknown + + + + + theList + GEOM_List + unknown + + + + + + MakePointXYZ + mkr + 2.1.0 + unknown + 0 + + + theX + double + unknown + + + theY + double + unknown + + + theZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePointWithReference + mkr + 2.1.0 + unknown + 0 + + + theReference + GEOM_Object + unknown + + + theX + double + unknown + + + theY + double + unknown + + + theZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePointOnCurve + mkr + 2.1.0 + unknown + 0 + + + theRefCurve + GEOM_Object + unknown + + + theParameter + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeVectorDXDYDZ + mkr + 2.1.0 + unknown + 0 + + + theDX + double + unknown + + + theDY + double + unknown + + + theDZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeVectorTwoPnt + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeLineTwoPnt + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePlaneThreePnt + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + thePnt3 + GEOM_Object + unknown + + + theTrimSize + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePlanePntVec + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theTrimSize + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePlaneFace + mkr + 2.1.0 + unknown + 0 + + + theFace + GEOM_Object + unknown + + + theTrimSize + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeMarker + mkr + 2.1.0 + unknown + 0 + + + theOX + double + unknown + + + theOY + double + unknown + + + theOZ + double + unknown + + + theXDX + double + unknown + + + theXDY + double + unknown + + + theXDZ + double + unknown + + + theYDX + double + unknown + + + theYDY + double + unknown + + + theYDZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeBox + mkr + 2.1.0 + unknown + 0 + + + theX1 + double + unknown + + + theY1 + double + unknown + + + theZ1 + double + unknown + + + theX2 + double + unknown + + + theY2 + double + unknown + + + theZ2 + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeBoxDXDYDZ + mkr + 2.1.0 + unknown + 0 + + + theDX + double + unknown + + + theDY + double + unknown + + + theDZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeBoxTwoPnt + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCylinderPntVecRH + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theRadius + double + unknown + + + theHeight + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCylinderRH + mkr + 2.1.0 + unknown + 0 + + + theR + double + unknown + + + theH + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSphere + mkr + 2.1.0 + unknown + 0 + + + theX + double + unknown + + + theY + double + unknown + + + theZ + double + unknown + + + theRadius + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSphereR + mkr + 2.1.0 + unknown + 0 + + + theR + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSpherePntR + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theR + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeTorusPntVecRR + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theRMajor + double + unknown + + + theRMinor + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeTorusRR + mkr + 2.1.0 + unknown + 0 + + + theRMajor + double + unknown + + + theRMinor + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeConePntVecR1R2H + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theR1 + double + unknown + + + theR2 + double + unknown + + + theHeight + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeConeR1R2H + mkr + 2.1.0 + unknown + 0 + + + theR1 + double + unknown + + + theR2 + double + unknown + + + theHeight + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePrismVecH + mkr + 2.1.0 + unknown + 0 + + + theBase + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theH + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePrismTwoPnt + mkr + 2.1.0 + unknown + 0 + + + theBase + GEOM_Object + unknown + + + thePoint1 + GEOM_Object + unknown + + + thePoint2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePipe + mkr + 2.1.0 + unknown + 0 + + + theBase + GEOM_Object + unknown + + + thePath + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeRevolutionAxisAngle + mkr + 2.1.0 + unknown + 0 + + + theBase + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theAngle + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFilling + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theMinDeg + long + unknown + + + theMaxDeg + long + unknown + + + theTol2D + double + unknown + + + theTol3D + double + unknown + + + theNbIter + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeBoolean + mkr + 2.1.0 + unknown + 0 + + + theShape1 + GEOM_Object + unknown + + + theShape2 + GEOM_Object + unknown + + + theOperation + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFuse + mkr + 2.1.0 + unknown + 0 + + + theShape1 + GEOM_Object + unknown + + + theShape2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePartition + mkr + 2.1.0 + unknown + 0 + + + theShapes + GEOM_List + unknown + + + theTools + GEOM_List + unknown + + + theKeepInside + GEOM_List + unknown + + + theRemoveInside + GEOM_List + unknown + + + theLimit + short + unknown + + + theRemoveWebs + boolean + unknown + + + theMaterials + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeHalfPartition + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + thePlane + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCopy + mkr + 2.1.0 + unknown + 0 + + + theOriginal + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + Export + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theFileName + string + unknown + + + theFormatName + string + unknown + + + + + + + Import + mkr + 2.1.0 + unknown + 0 + + + theFileName + string + unknown + + + theFormatName + string + unknown + + + + + return + GEOM_Object + unknown + + + + + + ImportTranslators + mkr + 2.1.0 + unknown + 0 + + + + theFormats + string_array + unknown + + + thePatterns + string_array + unknown + + + + + + ExportTranslators + mkr + 2.1.0 + unknown + 0 + + + + theFormats + string_array + unknown + + + thePatterns + string_array + unknown + + + + + + TranslateTwoPoints + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint1 + GEOM_Object + unknown + + + thePoint2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + TranslateTwoPointsCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint1 + GEOM_Object + unknown + + + thePoint2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + TranslateDXDYDZ + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theDX + double + unknown + + + theDY + double + unknown + + + theDZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + TranslateDXDYDZCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theDX + double + unknown + + + theDY + double + unknown + + + theDZ + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + TranslateVector + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theVector + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + TranslateVectorCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theVector + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MultiTranslate1D + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theVector + GEOM_Object + unknown + + + theStep + double + unknown + + + theNbTimes + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MultiTranslate2D + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theVector1 + GEOM_Object + unknown + + + theStep1 + double + unknown + + + theNbTimes1 + long + unknown + + + theVector2 + GEOM_Object + unknown + + + theStep2 + double + unknown + + + theNbTimes2 + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + Rotate + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theAngle + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + RotateCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theAngle + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MultiRotate1D + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theNbTimes + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MultiRotate2D + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + theAngle + double + unknown + + + theNbTimes1 + long + unknown + + + theStep + double + unknown + + + theNbTimes2 + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorPlane + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePlane + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorPlaneCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePlane + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorAxis + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorAxisCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theAxis + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorPoint + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MirrorPointCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + OffsetShape + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theOffset + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + OffsetShapeCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theOffset + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + ScaleShape + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + theFactor + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + ScaleShapeCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + theFactor + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + PositionShape + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theStartLCS + GEOM_Object + unknown + + + theEndLCS + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + PositionShapeCopy + mkr + 2.1.0 + unknown + 0 + + + theObject + GEOM_Object + unknown + + + theStartLCS + GEOM_Object + unknown + + + theEndLCS + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeEdge + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeWire + mkr + 2.1.0 + unknown + 0 + + + theEdgesAndWires + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFace + mkr + 2.1.0 + unknown + 0 + + + theWire + GEOM_Object + unknown + + + isPlanarWanted + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFaceWires + mkr + 2.1.0 + unknown + 0 + + + theWires + GEOM_List + unknown + + + isPlanarWanted + boolean + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeShell + mkr + 2.1.0 + unknown + 0 + + + theFacesAndShells + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSolidShell + mkr + 2.1.0 + unknown + 0 + + + theShell + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSolidShells + mkr + 2.1.0 + unknown + 0 + + + theShells + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCompound + mkr + 2.1.0 + unknown + 0 + + + theShapes + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeGlueFaces + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theTolerance + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeExplode + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theShapeType + long + unknown + + + isSorted + boolean + unknown + + + + + return + GEOM_List + unknown + + + + + + NumberOfFaces + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + + + return + long + unknown + + + + + + NumberOfEdges + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + + + return + long + unknown + + + + + + ChangeOrientation + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeQuad4Vertices + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + thePnt3 + GEOM_Object + unknown + + + thePnt4 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeQuad + mkr + 2.1.0 + unknown + 0 + + + theEdge1 + GEOM_Object + unknown + + + theEdge2 + GEOM_Object + unknown + + + theEdge3 + GEOM_Object + unknown + + + theEdge4 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeQuad2Edges + mkr + 2.1.0 + unknown + 0 + + + theEdge1 + GEOM_Object + unknown + + + theEdge2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeHexa + mkr + 2.1.0 + unknown + 0 + + + theFace1 + GEOM_Object + unknown + + + theFace2 + GEOM_Object + unknown + + + theFace3 + GEOM_Object + unknown + + + theFace4 + GEOM_Object + unknown + + + theFace5 + GEOM_Object + unknown + + + theFace6 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeHexa2Faces + mkr + 2.1.0 + unknown + 0 + + + theFace1 + GEOM_Object + unknown + + + theFace2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetPoint + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theX + double + unknown + + + theY + double + unknown + + + theZ + double + unknown + + + theEpsilon + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetEdge + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + thePoint1 + GEOM_Object + unknown + + + thePoint2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetEdgeNearPoint + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetFaceByPoints + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + thePoint1 + GEOM_Object + unknown + + + thePoint2 + GEOM_Object + unknown + + + thePoint3 + GEOM_Object + unknown + + + thePoint4 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetFaceByEdges + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theEdge1 + GEOM_Object + unknown + + + theEdge2 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetOppositeFace + mkr + 2.1.0 + unknown + 0 + + + theBlock + GEOM_Object + unknown + + + theFace + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetFaceNearPoint + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetFaceByNormale + mkr + 2.1.0 + unknown + 0 + + + theBlock + GEOM_Object + unknown + + + theVector + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + IsCompoundOfBlocks + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + theMinNbFaces + long + unknown + + + theMaxNbFaces + long + unknown + + + + + return + long + unknown + + + theNbBlocks + long + unknown + + + + + + CheckCompoundOfBlocks + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + + + return + long + unknown + + + theErrors + BCErrors + unknown + + + + + + PrintBCErrors + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + theErrors + BCErrors + unknown + + + + + return + string + unknown + + + + + + ExplodeCompoundOfBlocks + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + theMinNbFaces + long + unknown + + + theMaxNbFaces + long + unknown + + + + + return + GEOM_List + unknown + + + + + + GetBlockNearPoint + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + thePoint + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetBlockByParts + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + theParts + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetBlocksByParts + mkr + 2.1.0 + unknown + 0 + + + theCompound + GEOM_Object + unknown + + + theParts + GEOM_List + unknown + + + + + return + GEOM_List + unknown + + + + + + MakeMultiTransformation1D + mkr + 2.1.0 + unknown + 0 + + + theBlock + GEOM_Object + unknown + + + theDirFace1 + long + unknown + + + theDirFace2 + long + unknown + + + theNbTimes + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeMultiTransformation2D + mkr + 2.1.0 + unknown + 0 + + + theBlock + GEOM_Object + unknown + + + theDirFace1U + long + unknown + + + theDirFace2U + long + unknown + + + theNbTimesU + long + unknown + + + theDirFace1V + long + unknown + + + theDirFace2V + long + unknown + + + theNbTimesV + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCirclePntVecR + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theR + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeCircleThreePnt + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + thePnt3 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeEllipse + mkr + 2.1.0 + unknown + 0 + + + thePnt + GEOM_Object + unknown + + + theVec + GEOM_Object + unknown + + + theRMajor + double + unknown + + + theRMinor + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeArc + mkr + 2.1.0 + unknown + 0 + + + thePnt1 + GEOM_Object + unknown + + + thePnt2 + GEOM_Object + unknown + + + thePnt3 + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakePolyline + mkr + 2.1.0 + unknown + 0 + + + thePoints + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSplineBezier + mkr + 2.1.0 + unknown + 0 + + + thePoints + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSplineInterpolation + mkr + 2.1.0 + unknown + 0 + + + thePoints + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeSketcher + mkr + 2.1.0 + unknown + 0 + + + theCommand + string + unknown + + + theWorkingPlane + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFilletAll + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theR + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFilletEdges + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theR + double + unknown + + + theEdges + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeFilletFaces + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theR + double + unknown + + + theFaces + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeChamferAll + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theD + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeChamferEdge + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theD1 + double + unknown + + + theD2 + double + unknown + + + theFace1 + long + unknown + + + theFace2 + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeChamferFaces + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theD1 + double + unknown + + + theD2 + double + unknown + + + theFaces + GEOM_List + unknown + + + + + return + GEOM_Object + unknown + + + + + + MakeArchimede + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theWeight + double + unknown + + + theWaterDensity + double + unknown + + + theMeshDeflection + double + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetSubShapeIndex + mkr + 2.1.0 + unknown + 0 + + + theShape + GEOM_Object + unknown + + + theSubShape + GEOM_Object + unknown + + + + + return + long + unknown + + + + + + CreateGroup + mkr + 2.1.0 + unknown + 0 + + + theMainShape + GEOM_Object + unknown + + + theShapeType + long + unknown + + + + + return + GEOM_Object + unknown + + + + + + AddObject + mkr + 2.1.0 + unknown + 0 + + + theGroup + GEOM_Object + unknown + + + theSubShapeId + long + unknown + + + + + + + RemoveObject + mkr + 2.1.0 + unknown + 0 + + + theGroup + GEOM_Object + unknown + + + theSubShapeId + long + unknown + + + + + + + GetType + mkr + 2.1.0 + unknown + 0 + + + theGroup + GEOM_Object + unknown + + + + + return + long + unknown + + + + + + GetMainShape + mkr + 2.1.0 + unknown + 0 + + + theGroup + GEOM_Object + unknown + + + + + return + GEOM_Object + unknown + + + + + + GetObjects + mkr + 2.1.0 + unknown + 0 + + + theGroup + GEOM_Object + unknown + + + + + return + GEOM_List + unknown + + + + + + + + + diff --git a/src/BREPExport/BREPExport.cxx b/src/BREPExport/BREPExport.cxx new file mode 100644 index 000000000..2580cfac0 --- /dev/null +++ b/src/BREPExport/BREPExport.cxx @@ -0,0 +1,56 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BREPExport.cxx +// Created: Wed May 19 13:10:05 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include + +#include +#include + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName) + { + MESSAGE("Export BREP into file " << theFileName.ToCString()); + + if ( !BRepTools::Write( theShape, theFileName.ToCString() ) ) + return 0; + + return 1; + } +} diff --git a/src/BREPImport/BREPImport.cxx b/src/BREPImport/BREPImport.cxx new file mode 100644 index 000000000..5412fb3e8 --- /dev/null +++ b/src/BREPImport/BREPImport.cxx @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BREPImport.cxx +// Created: Wed May 19 14:29:52 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include +#include + +#include +#include + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + TopoDS_Shape Import (const TCollection_AsciiString& theFileName, + TCollection_AsciiString& theError) + { + MESSAGE("Import BREP from file " << theFileName); + TopoDS_Shape aShape; + BRep_Builder B; + BRepTools::Read(aShape, theFileName.ToCString(), B); + if (aShape.IsNull()) { + theError = "BREP Import failed"; + } + return aShape; + } +} diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx new file mode 100644 index 000000000..07de548cd --- /dev/null +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -0,0 +1,337 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_ArcDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_ArcDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include +#include +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : BasicGUI_ArcDlg() +// purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, WFlags fl) + : GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ARC_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ARC")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + Group3Pnts = new DlgRef_3Sel_QTD(this, "Group3Pnts"); + Group3Pnts->GroupBox1->setTitle(tr("GEOM_POINTS")); + Group3Pnts->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + Group3Pnts->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + Group3Pnts->TextLabel3->setText(tr("GEOM_POINT_I").arg("3")); + + Group3Pnts->LineEdit1->setReadOnly( true ); + Group3Pnts->LineEdit2->setReadOnly( true ); + Group3Pnts->LineEdit3->setReadOnly( true ); + + Group3Pnts->PushButton1->setPixmap(image1); + Group3Pnts->PushButton2->setPixmap(image1); + Group3Pnts->PushButton3->setPixmap(image1); + + Layout1->addWidget( Group3Pnts, 2, 0 ); + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_ArcDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_ArcDlg::~BasicGUI_ArcDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::Init() +{ + /* init variables */ + // myGeometryGUI->SetState( 0 ); + globalSelection( GEOM_POINT ); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + myEditCurrentArgument->setFocus(); + + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_ARC" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_ArcDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + // reset + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); + myEditCurrentArgument = Group3Pnts->LineEdit1; + + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_ArcDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == Group3Pnts->LineEdit1 || + send == Group3Pnts->LineEdit2 || + send == Group3Pnts->LineEdit3 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + // myGeometryGUI->SetState( 0 ); + globalSelection( GEOM_POINT ); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + myEditCurrentArgument->setFocus(); + + Group3Pnts->LineEdit1->setText( "" ); + Group3Pnts->LineEdit2->setText( "" ); + Group3Pnts->LineEdit3->setText( "" ); + myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_ArcDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); +} + +//================================================================================= +// function : isEqual +// purpose : it may also be needed to check for min distance between gp_Pnt-s... +//================================================================================= +static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) +{ + return thePnt1->_is_equivalent( thePnt2 ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_ArcDlg::isValid( QString& msg ) +{ + return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_ArcDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = + GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + return true; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx new file mode 100644 index 000000000..8476ef36e --- /dev/null +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -0,0 +1,435 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_CircleDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_CircleDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +//================================================================================= +// class : BasicGUI_CircleDlg() +// purpose : Constructs a BasicGUI_CircleDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PV"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PNTS"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CIRCLE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CIRCLE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image2); + RadioButton3->close(TRUE); + + GroupPntVecR = new DlgRef_2Sel1Spin(this, "GroupPntVecR"); + GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + + GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT")); + GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupPntVecR->PushButton1->setPixmap(image1); + GroupPntVecR->PushButton2->setPixmap(image1); + + GroupPntVecR->LineEdit1->setReadOnly( true ); + GroupPntVecR->LineEdit2->setReadOnly( true ); + + Group3Pnts = new DlgRef_3Sel_QTD(this, "Group3Pnts"); + Group3Pnts->GroupBox1->setTitle(tr("GEOM_3_POINTS")); + Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1")); + Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2")); + Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3")); + Group3Pnts->PushButton1->setPixmap(image1); + Group3Pnts->PushButton2->setPixmap(image1); + Group3Pnts->PushButton3->setPixmap(image1); + + Group3Pnts->LineEdit1->setReadOnly( true ); + Group3Pnts->LineEdit2->setReadOnly( true ); + Group3Pnts->LineEdit3->setReadOnly( true ); + + Layout1->addWidget( GroupPntVecR, 2, 0 ); + Layout1->addWidget( Group3Pnts, 2, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_CircleDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_CircleDlg::~BasicGUI_CircleDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPntVecR->LineEdit1; + + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + // myGeometryGUI->SetState( 0 ); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, aStep, 3); + GroupPntVecR->SpinBox_DX->SetValue( 100 ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntVecR->SpinBox_DX, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_CIRCLE" ) ); + + Group3Pnts->hide(); + ConstructorsClicked( 0 ); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); + + switch ( constructorId ) + { + case 0: + { + Group3Pnts->hide(); + resize(0, 0); + GroupPntVecR->show(); + + myEditCurrentArgument = GroupPntVecR->LineEdit1; + GroupPntVecR->LineEdit1->setText(""); + GroupPntVecR->LineEdit2->setText(""); + break; + } + case 1: + { + GroupPntVecR->hide(); + resize( 0, 0 ); + Group3Pnts->show(); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->LineEdit1->setText(""); + Group3Pnts->LineEdit2->setText(""); + Group3Pnts->LineEdit3->setText(""); + break; + } + } + + myEditCurrentArgument->setFocus(); + globalSelection( GEOM_POINT ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_CircleDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_CircleDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_CircleDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == GroupPntVecR->PushButton1 ) myEditCurrentArgument = GroupPntVecR->LineEdit1; + else if ( send == GroupPntVecR->PushButton2 ) myEditCurrentArgument = GroupPntVecR->LineEdit2; + else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + + myEditCurrentArgument->setFocus(); + + if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) + globalSelection( GEOM_LINE ); + else + globalSelection( GEOM_POINT ); + SelectionIntoArgument(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPntVecR->LineEdit1 || + send == GroupPntVecR->LineEdit2 || + send == Group3Pnts->LineEdit1 || + send == Group3Pnts->LineEdit2 || + send == Group3Pnts->LineEdit3 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_POINT ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + // myGeometryGUI->SetState( 0 ); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_CircleDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + +//================================================================================= +// function : getRadius() +// purpose : +//================================================================================= +double BasicGUI_CircleDlg::getRadius() const +{ + return GroupPntVecR->SpinBox_DX->GetValue(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_CircleDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); +} + +//================================================================================= +// function : isEqual +// purpose : it may also be needed to check for min distance between gp_Pnt-s... +//================================================================================= +static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) +{ + return thePnt1->_is_equivalent( thePnt2 ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_CircleDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + if ( id == 0 ) + return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; + else if ( id == 1 ) + return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_CircleDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); + res = true; + break; + case 1 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 ); + res = true; + break; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx new file mode 100644 index 000000000..a558a22f0 --- /dev/null +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -0,0 +1,397 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_CurveDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#include "BasicGUI_CurveDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "utilities.h" + +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_ListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +using namespace std; +#include + +//================================================================================= +// class : BasicGUI_CurveDlg() +// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_CurveDlg::BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POLYLINE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPLINE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); + + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CURVE_TITLE")); + + /***************************************************************/ + RadioButton1->setPixmap( image0 ); + RadioButton2->setPixmap( image3 ); + RadioButton3->setPixmap( image2 ); + + GroupPoints = new DlgRef_1Sel_QTD( this, "GroupPoints" ); + GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) ); + GroupPoints->TextLabel1->setText( tr("GEOM_POINTS") ); + GroupPoints->PushButton1->setPixmap(image1); + + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_CurveDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_CurveDlg::~BasicGUI_CurveDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoints = new GEOM::ListOfGO(); + myPoints->length( 0 ); + + globalSelection( GEOM_POINT ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_CURVE" ) ); + ConstructorsClicked( 0 ); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ConstructorsClicked( int id ) +{ + QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" ); + GroupConstructors->setTitle( aTitle ); + + myPoints = new GEOM::ListOfGO(); + myPoints->length( 0 ); + + myEditCurrentArgument->setText(""); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::SetEditCurrentArgument() +{ + if ( sender() == GroupPoints->PushButton1 ) + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::LineEditReturnPressed() +{ + if ( sender() == GroupPoints->LineEdit1 ) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_CurveDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_CurveDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +/*! function : isPointInList() + * purpose : Check is point (theObject) in the list \a thePoints. + * \author enk + * \retval -1, if point not in list, else 1 in list + */ +//================================================================================= +static int isPointInList(list& thePoints, + GEOM::GEOM_Object_var& theObject) +{ + int len = thePoints.size(); + + if(len<1){ + return -1; + } + + for(list::iterator i=thePoints.begin();i!=thePoints.end();i++) + if (string((*i)->GetEntry()) == string(theObject->GetEntry())){ + return 1; + } + + return -1; +} +//================================================================================= +/*! function : removeUnnecessaryPnt() + * purpose : Remove unnecessary points from list \a theOldPoints + * \author enk + * \li \a theOldPoints - ordered sequence with unnecessary point + * \li \a theNewPoints - not ordered sequence with necessary points + */ +//================================================================================= +static void removeUnnecessaryPnt(list& theOldPoints, + GEOM::ListOfGO_var& theNewPoints) +{ + list objs_to_remove; + for(list::iterator i=theOldPoints.begin();i!=theOldPoints.end();i++){ + bool found = false; + for (int j=0;jlength() && !found ; j++){ + if(string((*i)->GetEntry()) == string(theNewPoints[j]->GetEntry())){ + found = true; + } + } + if(!found){ + objs_to_remove.push_back(*i); + //cout << "removed: " << (*i)->GetEntry() << endl; + } + } + for(list::iterator i=objs_to_remove.begin();i!=objs_to_remove.end();i++){ + theOldPoints.remove(*i); + } +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_CurveDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + Standard_Boolean aRes = Standard_False; + int i = 0; + int IOC = IObjectCount(); + bool is_append = myPoints->length() < IOC; // if true - add point, else remove + myPoints->length( IOC ); // this length may be greater than number of objects, + // that will actually be put into myPoints + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) + { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + //TopoDS_Shape aPointShape; + //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) + int pos = isPointInList(myOrderedSel,aSelectedObject); + if(is_append && pos==-1) + myOrderedSel.push_back(aSelectedObject); + myPoints[i++] = aSelectedObject; + } + } + + myPoints->length( i ); // this is the right length, smaller of equal to the previously set + if(IOC == 0) + myOrderedSel.clear(); + else + removeUnnecessaryPnt(myOrderedSel,myPoints); + + if(myOrderedSel.size() == myPoints->length()){ + int k=0; + for (list::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++) + myPoints[k++] = *j; + } else { + //cout << "ERROR: Ordered sequence size != selection sequence size! ("<length()<<")"<LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); + + displayPreview(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + // myGeometryGUI->SetState( 0 ); + + globalSelection( GEOM_POINT ); + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_CurveDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_CurveDlg::isValid( QString& msg ) +{ + return myPoints->length() > 1; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_CurveDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakePolyline( myPoints ); + res = true; + break; + case 1 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineBezier( myPoints ); + res = true; + break; + case 2 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSplineInterpolation( myPoints ); + res = true; + break; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_CurveDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx new file mode 100644 index 000000000..273d3267a --- /dev/null +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -0,0 +1,348 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_EllipseDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#include "BasicGUI_EllipseDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : BasicGUI_EllipseDlg() +// purpose : Constructs a BasicGUI_EllipseDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ELLIPSE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ELLIPSE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ELLIPSE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_MAJOR")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MINOR")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_EllipseDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_EllipseDlg::~BasicGUI_EllipseDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + // myGeometryGUI->SetState( 0 ); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + double aMajorR( 200. ), aMinorR( 100. ); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator( 0.001, 999.999, step, 3 ); + GroupPoints->SpinBox_DY->RangeStepAndValidator( 0.001, 999.999, step, 3 ); + GroupPoints->SpinBox_DX->SetValue( aMajorR ); + GroupPoints->SpinBox_DY->SetValue( aMinorR ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_ELLIPSE" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_EllipseDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + // reset + myPoint = myDir = GEOM::GEOM_Object::_nil(); + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + + return true; +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_EllipseDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_EllipseDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); + return; + } + + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + + myEditCurrentArgument->setFocus(); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + globalSelection( GEOM_LINE ); + else + globalSelection( GEOM_POINT ); + SelectionIntoArgument(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + + myPoint = myDir = GEOM::GEOM_Object::_nil(); + globalSelection( GEOM_POINT ); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_EllipseDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue) +{ + displayPreview(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_EllipseDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_EllipseDlg::isValid( QString& msg ) +{ + double aMajorR = GroupPoints->SpinBox_DX->GetValue(); + double aMinorR = GroupPoints->SpinBox_DY->GetValue(); + if ( aMajorR < aMinorR ) + { + msg = tr( "GEOM_ELLIPSE_ERROR_1" ); + return false; + } + return !myPoint->_is_nil() && !myDir->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) +{ + double aMajorR = GroupPoints->SpinBox_DX->GetValue(); + double aMinorR = GroupPoints->SpinBox_DY->GetValue(); + GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx new file mode 100644 index 000000000..014f7e18c --- /dev/null +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -0,0 +1,296 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_LineDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_LineDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : BasicGUI_LineDlg() +// purpose : Constructs a BasicGUI_LineDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_LineDlg::BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_LINE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_LINE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_LineDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_LineDlg::~BasicGUI_LineDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + + // myGeometryGUI->SetState( 0 ); + globalSelection( GEOM_POINT ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr("GEOM_LINE") ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_LineDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_LineDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_LineDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + else return; + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + // myGeometryGUI->SetState( 0 ); + globalSelection( GEOM_POINT ); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_LineDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_LineDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_LineDlg::isValid( QString& msg ) +{ + return !myPoint1->_is_nil() && !myPoint2->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_LineDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + return true; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_LineDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx new file mode 100644 index 000000000..faf073950 --- /dev/null +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -0,0 +1,748 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_MarkerDlg.cxx +// Author : Sergey LITONIN +// Module : GEOM +// $Header$ + +#include "BasicGUI_MarkerDlg.h" +#include "DlgRef_SpinBox.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : BasicGUI_MarkerDlg() +// purpose : Constructor +//================================================================================= +BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent ) +: GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); + QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) ); + QPixmap iconCS3 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) ); + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + + setCaption( tr( "CAPTION" ) ); + + GroupConstructors->setTitle( tr( "LOCALCS" ) ); + RadioButton1->setPixmap( iconCS1 ); + RadioButton2->setPixmap( iconCS2 ); + RadioButton3->setPixmap( iconCS3 ); + + Group1 = new DlgRef_1Sel_QTD(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group1->TextLabel1->setText(tr("GEOM_OBJECT")); + Group1->PushButton1->setPixmap(iconSelect); + + Group2 = new DlgRef_3Sel_QTD(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group2->TextLabel1->setText(tr("GEOM_POINT")); + Group2->TextLabel2->setText(tr("XDIR")); + Group2->TextLabel3->setText(tr("YDIR")); + Group2->PushButton1->setPixmap(iconSelect); + Group2->PushButton2->setPixmap(iconSelect); + Group2->PushButton3->setPixmap(iconSelect); + + aMainGrp = new QGroupBox( 1, Qt::Horizontal, this ); + aMainGrp->setFrameStyle( QFrame::NoFrame ); + aMainGrp->setInsideMargin( 0 ); + + QGroupBox* anOriGrp = new QGroupBox( 1, Qt::Vertical, tr( "ORIGIN" ), aMainGrp ); + new QLabel( tr( "GEOM_X" ), anOriGrp ); + myData[ X ] = new DlgRef_SpinBox( anOriGrp ); + new QLabel( tr( "GEOM_Y" ), anOriGrp ); + myData[ Y ] = new DlgRef_SpinBox( anOriGrp ); + new QLabel( tr( "GEOM_Z" ), anOriGrp ); + myData[ Z ] = new DlgRef_SpinBox( anOriGrp ); + + QGroupBox* aXAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "XDIR" ), aMainGrp ); + new QLabel( tr( "DX" ), aXAxisGrp ); + myData[ DX1 ] = new DlgRef_SpinBox( aXAxisGrp ); + new QLabel( tr( "DY" ), aXAxisGrp ); + myData[ DY1 ] = new DlgRef_SpinBox( aXAxisGrp ); + new QLabel( tr( "DZ" ), aXAxisGrp ); + myData[ DZ1 ] = new DlgRef_SpinBox( aXAxisGrp ); + + QGroupBox* anYAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "YDIR" ), aMainGrp ); + new QLabel( tr( "DX" ), anYAxisGrp ); + myData[ DX2 ] = new DlgRef_SpinBox( anYAxisGrp ); + new QLabel( tr( "DY" ), anYAxisGrp ); + myData[ DY2 ] = new DlgRef_SpinBox( anYAxisGrp ); + new QLabel( tr( "DZ" ), anYAxisGrp ); + myData[ DZ2 ] = new DlgRef_SpinBox( anYAxisGrp ); + + Layout1->addWidget( aMainGrp, 2, 0 ); + Layout1->addWidget( Group1, 2, 0 ); + Layout1->addWidget( Group2, 2, 0 ); + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_MarkerDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::Init() +{ + myBlockPreview = false; + myConstructorId = -1; + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setReadOnly( true ); + Group2->LineEdit1->setReadOnly( true ); + Group2->LineEdit2->setReadOnly( true ); + Group2->LineEdit3->setReadOnly( true ); + + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); + connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) ); + + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) ); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); + + initName( tr( "LCS_NAME" ) ); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) + { + anIter.data()->RangeStepAndValidator( -999.999, 999.999, step, 3 ); + connect( anIter.data(), SIGNAL( valueChanged( double ) ), + this, SLOT( onValueChanged( double ) ) ); + } + + myBlockPreview = true; + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) + anIter.data()->SetValue( 0 ); + myData[ DX1 ]->SetValue( 1 ); + myData[ DY2 ]->SetValue( 1 ); + myBlockPreview = false; + + ConstructorsClicked( 0 ); + + + //@ + /* + QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> + getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); + + VTKViewer_ViewFrame* aVTKFrame = dynamic_cast( aFrame ); + if ( aVTKFrame ) + { + aVTKFrame->AdjustTrihedrons( true ); + return; + } + + OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); + if ( aOCCFrame ) + aOCCFrame->AdjustTrihedrons( true ); + */ +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) +{ + if ( myConstructorId == constructorId && myConstructorId == 0 ) + { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + activate( GEOM_MARKER ); + displayPreview(); + return; + } + + myConstructorId = constructorId; + + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + Group1->hide(); + Group2->hide(); + resize(0, 0); + aMainGrp->show(); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + activate( GEOM_MARKER ); + break; + } + case 1: + { + Group2->hide(); + aMainGrp->hide(); + resize(0, 0); + Group1->show(); + + globalSelection( GEOM_ALLGEOM ); + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); + break; + } + case 2: + { + aMainGrp->hide(); + Group1->show(); + resize(0, 0); + Group2->show(); + + globalSelection( GEOM_POINT ); + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); + Group2->LineEdit2->setText(""); + Group2->LineEdit3->setText(""); + break; + } + } + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); + onSelectionDone(); +} + +//================================================================================= +// function : onOk() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::onOk() +{ + if ( onApply() ) + onClose(); +} + +//======================================================================= +// function : onClose() +// purpose : +//======================================================================= +void BasicGUI_MarkerDlg::onClose() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : onApply() +// purpose : +//================================================================================= +bool BasicGUI_MarkerDlg::onApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + + return true; +} + +//================================================================================= +// function : onSelectionDone0() +// purpose : Reaction on selection when first method of creation is current one +//================================================================================= +void BasicGUI_MarkerDlg::onSelectionDone0() +{ + if ( IObjectCount() == 1 ) + { + + Standard_Boolean aRes = Standard_False; + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + + if ( aRes && !aSelectedObj->_is_nil() ) + { + TopoDS_Shape aShape; + if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) + { + if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) + { + TopoDS_Face aFace = TopoDS::Face( aShape ); + Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); + + if ( !aPlane.IsNull() ) + { + gp_Ax3 anAx3 = aPlane->Pln().Position(); + gp_Pnt aLoc = anAx3.Location(); + gp_Dir aXDir = anAx3.XDirection(); + gp_Dir aYDir = anAx3.YDirection(); + + myData[ X ]->SetValue( aLoc.X() ); + myData[ Y ]->SetValue( aLoc.Y() ); + myData[ Z ]->SetValue( aLoc.Z() ); + + myData[ DX1 ]->SetValue( aXDir.X() ); + myData[ DY1 ]->SetValue( aXDir.Y() ); + myData[ DZ1 ]->SetValue( aXDir.Z() ); + + myData[ DX2 ]->SetValue( aYDir.X() ); + myData[ DY2 ]->SetValue( aYDir.Y() ); + myData[ DZ2 ]->SetValue( aYDir.Z() ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); + } + } + else + { + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + if ( aMap.Extent() == 1 ) + { + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); + } + + + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + myData[ X ]->SetValue( aPnt.X() ); + myData[ Y ]->SetValue( aPnt.Y() ); + myData[ Z ]->SetValue( aPnt.Z() ); + } + } + } + } + } + + displayPreview(); +} + + +//================================================================================= +// function : onSelectionDone() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_MarkerDlg::onSelectionDone() +{ + if ( getConstructorId() == 0 ) + { + onSelectionDone0(); + return; + } + + + myEditCurrentArgument->setText(""); + QString aName; + + if ( IObjectCount() == 1 ) { + Standard_Boolean aRes = Standard_False; + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + + if ( !CORBA::is_nil( aSelectedObj ) && aRes ) { + aName = GEOMBase::GetName( aSelectedObj ); + TopoDS_Shape aShape; + if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { + GEOM::short_array anIndexes; + + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) { + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + } + + if ( getConstructorId() == 1 ) { + if ( !aShape.IsNull() ) { + gp_Pnt aPnt; + if (aShape.ShapeType() == TopAbs_VERTEX) { + aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); + } + else { + GProp_GProps aSystem; + if (aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE) + BRepGProp::LinearProperties(aShape, aSystem); + else if (aShape.ShapeType() == TopAbs_FACE || aShape.ShapeType() == TopAbs_SHELL) + BRepGProp::SurfaceProperties(aShape, aSystem); + else + BRepGProp::VolumeProperties(aShape, aSystem); + + aPnt = aSystem.CentreOfMass(); + } + + gp_Ax3 anAx3; + anAx3.Transform(aShape.Location().Transformation()); + if(aShape.ShapeType() == TopAbs_FACE) { + Handle(Geom_Surface) aGS = BRep_Tool::Surface( TopoDS::Face( aShape ) ); + if (!aGS.IsNull() && aGS->IsKind( STANDARD_TYPE( Geom_Plane ) ) ) { + Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS ); + gp_Pln aPln = aGPlane->Pln(); + anAx3 = aPln.Position(); + } + } + + gp_Dir aDirX = anAx3.XDirection(); + gp_Dir aDirY = anAx3.YDirection(); + + myData[ X ]->SetValue( aPnt.X() ); + myData[ Y ]->SetValue( aPnt.Y() ); + myData[ Z ]->SetValue( aPnt.Z() ); + + myData[ DX1 ]->SetValue( aDirX.X() ); + myData[ DY1 ]->SetValue( aDirX.Y() ); + myData[ DZ1 ]->SetValue( aDirX.Z() ); + + myData[ DX2 ]->SetValue( aDirY.X() ); + myData[ DY2 ]->SetValue( aDirY.Y() ); + myData[ DZ2 ]->SetValue( aDirY.Z() ); + + myEditCurrentArgument->setText( aName ); + } + else { + myData[ X ]->SetValue( 0 ); + myData[ Y ]->SetValue( 0 ); + myData[ Z ]->SetValue( 0 ); + + myData[ DX1 ]->SetValue( 0 ); + myData[ DY1 ]->SetValue( 0 ); + myData[ DZ1 ]->SetValue( 0 ); + + myData[ DX2 ]->SetValue( 0 ); + myData[ DY2 ]->SetValue( 0 ); + myData[ DZ2 ]->SetValue( 0 ); + } + } + else if ( getConstructorId() == 2 ) { + if (myEditCurrentArgument == Group2->LineEdit1) { + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + myData[ X ]->SetValue( aPnt.X() ); + myData[ Y ]->SetValue( aPnt.Y() ); + myData[ Z ]->SetValue( aPnt.Z() ); + myEditCurrentArgument->setText( aName ); + } + else { + myData[ X ]->SetValue( 0 ); + myData[ Y ]->SetValue( 0 ); + myData[ Z ]->SetValue( 0 ); + } + } + else if (myEditCurrentArgument == Group2->LineEdit2) { + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); + gp_Dir aDir(gp_Vec(aP1, aP2)); + + myData[ DX1 ]->SetValue( aDir.X() ); + myData[ DY1 ]->SetValue( aDir.Y() ); + myData[ DZ1 ]->SetValue( aDir.Z() ); + myEditCurrentArgument->setText( aName ); + } + else { + myData[ DX1 ]->SetValue( 0 ); + myData[ DY1 ]->SetValue( 0 ); + myData[ DZ1 ]->SetValue( 0 ); + } + } + else if (myEditCurrentArgument == Group2->LineEdit3) { + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); + gp_Dir aDir(gp_Vec(aP1, aP2)); + + myData[ DX2 ]->SetValue( aDir.X() ); + myData[ DY2 ]->SetValue( aDir.Y() ); + myData[ DZ2 ]->SetValue( aDir.Z() ); + myEditCurrentArgument->setText( aName ); + } + else { + myData[ DX2 ]->SetValue( 0 ); + myData[ DY2 ]->SetValue( 0 ); + myData[ DZ2 ]->SetValue( 0 ); + } + } + } + } + } + } + else { + if ( getConstructorId() == 1 ) { + myData[ X ]->SetValue( 0 ); + myData[ Y ]->SetValue( 0 ); + myData[ Z ]->SetValue( 0 ); + + myData[ DX1 ]->SetValue( 0 ); + myData[ DY1 ]->SetValue( 0 ); + myData[ DZ1 ]->SetValue( 0 ); + + myData[ DX2 ]->SetValue( 0 ); + myData[ DY2 ]->SetValue( 0 ); + myData[ DZ2 ]->SetValue( 0 ); + } + else if ( getConstructorId() == 2 ) { + if (myEditCurrentArgument == Group2->LineEdit1) { + myData[ X ]->SetValue( 0 ); + myData[ Y ]->SetValue( 0 ); + myData[ Z ]->SetValue( 0 ); + } + else if (myEditCurrentArgument == Group2->LineEdit2) { + myData[ DX1 ]->SetValue( 0 ); + myData[ DY1 ]->SetValue( 0 ); + myData[ DZ1 ]->SetValue( 0 ); + } + else if (myEditCurrentArgument == Group2->LineEdit3) { + myData[ DX2 ]->SetValue( 0 ); + myData[ DY2 ]->SetValue( 0 ); + myData[ DZ2 ]->SetValue( 0 ); + } + } + } + + displayPreview(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) { + myEditCurrentArgument = Group1->LineEdit1; + globalSelection( GEOM_ALLGEOM ); + } + else if(send == Group2->PushButton1) { + myEditCurrentArgument = Group2->LineEdit1; + globalSelection( GEOM_POINT ); + } + else if(send == Group2->PushButton2) { + myEditCurrentArgument = Group2->LineEdit2; + globalSelection( GEOM_LINE ); + } + else if(send == Group2->PushButton3) { + myEditCurrentArgument = Group2->LineEdit3; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + onSelectionDone(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); +} + +//================================================================================= +// function : onActivate() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::onActivate() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : onDeactivate() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_MarkerDlg::onDeactivate() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + onActivate(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_MarkerDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + gp_Vec v1( myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue() ), + v2( myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() ); + + bool isOk = false; + // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution() + // Vectors shouldn't be checked for being orthogonal here! + if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) { + isOk = !v1.IsParallel( v2, Precision::Angular() ); + if ( !isOk ) + msg += tr( "VEC_PARALLEL" ); + } + + switch ( id ) + { + case 0: + return isOk; + case 1: + return !Group1->LineEdit1->text().isEmpty() && isOk; + case 2: + return !Group2->LineEdit1->text().isEmpty() && + !Group2->LineEdit2->text().isEmpty() && + !Group2->LineEdit3->text().isEmpty() && isOk; + } + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_MarkerDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( + getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(), + myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(), + myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : onValueChanged +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::onValueChanged( double ) +{ + displayPreview(); +} + +//================================================================================= +// function : displayPreview +// purpose : +//================================================================================= +void BasicGUI_MarkerDlg::displayPreview ( const bool activate, + const bool update, + const bool toRemoveFromEngine, + const double lineWidth ) +{ + if ( !myBlockPreview ) + { + GEOMBase_Skeleton::displayPreview( activate, update, toRemoveFromEngine, lineWidth ); + if ( myConstructorId == 0 ) + { + GEOMBase_Skeleton::activate( GEOM_MARKER ); + } + } +} + + + + + + + + + + + + + + diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx new file mode 100644 index 000000000..544f2611d --- /dev/null +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -0,0 +1,507 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_PlaneDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_PlaneDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +using namespace std; + +//================================================================================= +// class : BasicGUI_PlaneDlg() +// purpose : Constructs a BasicGUI_PlaneDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_3PNTS"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PLANE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PLANE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + GroupPntDir = new DlgRef_2Sel1Spin(this, "GroupPointDirection"); + GroupPntDir->GroupBox1->setTitle(tr("GEOM_PLANE_PV")); + GroupPntDir->TextLabel1->setText(tr("GEOM_POINT")); + GroupPntDir->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPntDir->TextLabel3->setText(tr("GEOM_PLANE_SIZE")); + GroupPntDir->PushButton1->setPixmap(image3); + GroupPntDir->PushButton2->setPixmap(image3); + GroupPntDir->LineEdit1->setReadOnly( true ); + GroupPntDir->LineEdit2->setReadOnly( true ); + + Group3Pnts = new DlgRef_3Sel1Spin(this, "Group3Pnts"); + Group3Pnts->GroupBox1->setTitle(tr("GEOM_3_POINTS")); + Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1")); + Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2")); + Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3")); + Group3Pnts->TextLabel4->setText(tr("GEOM_PLANE_SIZE")); + Group3Pnts->PushButton1->setPixmap(image3); + Group3Pnts->PushButton2->setPixmap(image3); + Group3Pnts->PushButton3->setPixmap(image3); + + Group3Pnts->LineEdit1->setReadOnly( true ); + Group3Pnts->LineEdit2->setReadOnly( true ); + Group3Pnts->LineEdit3->setReadOnly( true ); + + GroupFace = new DlgRef_1Sel1Spin(this, "GroupFace"); + GroupFace->GroupBox1->setTitle(tr("GEOM_FACE")); + GroupFace->TextLabel1->setText(tr("GEOM_SELECTION")); + GroupFace->TextLabel2->setText(tr("GEOM_PLANE_SIZE")); + GroupFace->PushButton1->setPixmap(image3); + + GroupFace->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPntDir, 2, 0); + Layout1->addWidget(Group3Pnts, 2, 0); + Layout1->addWidget(GroupFace, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_PlaneDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_PlaneDlg::~BasicGUI_PlaneDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPntDir->LineEdit1; + + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); + + // myGeometryGUI->SetState( 0 ); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + double aTrimSize = 2000.0; + + /* min, max, step and decimals for spin boxes */ + GroupPntDir->SpinBox_DX->RangeStepAndValidator( 0.001, 10000000.0, aStep, 3 ); + GroupPntDir->SpinBox_DX->SetValue( aTrimSize ); + Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, aStep, 3); + Group3Pnts->SpinBox_DX->SetValue( aTrimSize ); + GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, aStep, 3); + GroupFace->SpinBox_DX->SetValue( aTrimSize ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPntDir->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPntDir->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFace->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPntDir->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPntDir->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFace->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPntDir->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Pnts->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntDir->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_PLANE" ) ); + + Group3Pnts->hide(); + GroupFace->hide(); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); + + switch ( constructorId ) + { + case 0: /* plane from a point and a direction (vector, edge...) */ + { + Group3Pnts->hide(); + GroupFace->hide(); + resize(0, 0); + GroupPntDir->show(); + + myEditCurrentArgument = GroupPntDir->LineEdit1; + GroupPntDir->LineEdit1->setText(tr("")); + GroupPntDir->LineEdit2->setText(tr("")); + + /* for the first argument */ + globalSelection( GEOM_POINT ); + break; + } + case 1: /* plane from 3 points */ + { + GroupPntDir->hide(); + GroupFace->hide(); + resize(0, 0); + Group3Pnts->show(); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->LineEdit1->setText(""); + Group3Pnts->LineEdit2->setText(""); + Group3Pnts->LineEdit3->setText(""); + + /* for the first argument */ + globalSelection( GEOM_POINT ); + break; + } + case 2: /* plane from a planar face selection */ + { + GroupPntDir->hide(); + Group3Pnts->hide(); + resize(0, 0); + GroupFace->show(); + + myEditCurrentArgument = GroupFace->LineEdit1; + GroupFace->LineEdit1->setText(tr("")); + + /* for the first argument */ + globalSelection( GEOM_PLANE ); + break; + } + } + + myEditCurrentArgument->setFocus(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_PlaneDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_PlaneDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BasicGUI_PlaneDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1; + else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2; + else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; + else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; + else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + else if ( send == GroupFace->PushButton1 ) myEditCurrentArgument = GroupFace->LineEdit1; + + myEditCurrentArgument->setFocus(); + + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) + globalSelection( GEOM_LINE ); + else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) + globalSelection( GEOM_PLANE ); + else + globalSelection( GEOM_POINT ); + + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPntDir->LineEdit1 || + send == GroupPntDir->LineEdit2 || + send == Group3Pnts->LineEdit1 || + send == Group3Pnts->LineEdit2 || + send == Group3Pnts->LineEdit3 || + send == GroupFace->LineEdit1 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + // myGeometryGUI->SetState( 0 ); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_PlaneDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue) +{ + displayPreview(); +} + +//================================================================================= +// function : getSize() +// purpose : +//================================================================================= +double BasicGUI_PlaneDlg::getSize() const +{ + switch ( getConstructorId() ) + { + case 0 : return GroupPntDir->SpinBox_DX->GetValue(); + case 1 : return Group3Pnts->SpinBox_DX->GetValue(); + case 2 : return GroupFace->SpinBox_DX->GetValue(); + } + return 0.; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_PlaneDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); +} + +//================================================================================= +// function : isEqual +// purpose : it may also be needed to check for min distance between gp_Pnt-s... +//================================================================================= +static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) +{ + return thePnt1->_is_equivalent( thePnt2 ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_PlaneDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + if ( getSize() <= 0 ) + { + msg = QString( "Please, enter size greater than 0." ); + return false; + } + if ( id == 0 ) + return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ); + else if ( id == 1 ) + return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + else if ( id == 2 ) + return !CORBA::is_nil( myFace ); + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlanePntVec( myPoint, myDir, getSize() ); + res = true; + break; + case 1 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneThreePnt( myPoint1, myPoint2, myPoint3, getSize() ); + res = true; + break; + case 2 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneFace( myFace, getSize() ); + res = true; + break; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx new file mode 100644 index 000000000..e21f745ec --- /dev/null +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -0,0 +1,595 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_PointDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_PointDlg.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "GEOMImpl_Types.hxx" + +#include + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +using namespace std; +//================================================================================= +// class : BasicGUI_PointDlg() +// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl ), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); + + setCaption(tr("GEOM_POINT_TITLE")); + + QGroupBox* aFrame = new QGroupBox( 1, Qt::Horizontal, this ); + aFrame->setInsideMargin( 0 ); + aFrame->setFrameStyle( QFrame::NoFrame ); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_POINTS")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image3); + RadioButton3->setPixmap(image1); + + GroupXYZ = new DlgRef_3Spin( aFrame, "GroupXYZ" ); + GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES")); + GroupXYZ->TextLabel1->setText(tr("GEOM_X")); + GroupXYZ->TextLabel2->setText(tr("GEOM_Y")); + GroupXYZ->TextLabel3->setText(tr("GEOM_Z")); + + GroupOnCurve = new DlgRef_1Sel1Spin( aFrame, "GroupOnCurve" ); + GroupOnCurve->GroupBox1->setTitle(tr("GEOM_PARAM_POINT")); + GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE")); + GroupOnCurve->TextLabel2->setText(tr("GEOM_PARAMETER")); + GroupOnCurve->PushButton1->setPixmap(image2); + + GroupRefPoint = new DlgRef_1Sel3Spin( aFrame, "GoupRefPoint" ); + GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT")); + GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT")); + GroupRefPoint->PushButton1->setPixmap(image2); + GroupRefPoint->TextLabel2->setText(tr("GEOM_DX")); + GroupRefPoint->TextLabel3->setText(tr("GEOM_DY")); + GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ")); + + Layout1->addWidget( aFrame, 2, 0 ); + /***************************************************************/ + + myCoordGrp = new QGroupBox( 2, Qt::Horizontal, tr( "GEOM_COORDINATES" ), aFrame ); + new QLabel( tr( "GEOM_X" ), myCoordGrp ); + myX = new QLineEdit( myCoordGrp ); + new QLabel( tr( "GEOM_Y" ), myCoordGrp ); + myY = new QLineEdit( myCoordGrp ); + new QLabel( tr( "GEOM_Z" ), myCoordGrp ); + myZ = new QLineEdit( myCoordGrp ); + + myX->setReadOnly( true ); + myY->setReadOnly( true ); + myZ->setReadOnly( true ); + + myX->setEnabled( false ); + myY->setEnabled( false ); + myZ->setEnabled( false ); + + QPalette aPal = myX->palette(); + aPal.setColor( QPalette::Disabled, QColorGroup::Text, QColor( 0, 0, 0 ) ) ; + myX->setPalette( aPal ); + myY->setPalette( aPal ); + myZ->setPalette( aPal ); + + Init(); +} + + +//======================================================================= +// function : ~BasicGUI_PointDlg() +// purpose : Destructor +//======================================================================= +BasicGUI_PointDlg::~BasicGUI_PointDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::Init() +{ + GroupOnCurve->LineEdit1->setReadOnly( true ); + GroupRefPoint->LineEdit1->setReadOnly( true ); + + myEdge = GEOM::GEOM_Object::_nil(); + myRefPoint = GEOM::GEOM_Object::_nil(); + + myEditCurrentArgument = 0; + + // myGeometryGUI->SetState( 0 ); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes */ + GroupXYZ->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupXYZ->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupXYZ->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupXYZ->SpinBox_DX->SetValue(0.0); + GroupXYZ->SpinBox_DY->SetValue(0.0); + GroupXYZ->SpinBox_DZ->SetValue(0.0); + + GroupRefPoint->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupRefPoint->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupRefPoint->SpinBox_DX->SetValue(0.0); + GroupRefPoint->SpinBox_DY->SetValue(0.0); + GroupRefPoint->SpinBox_DZ->SetValue(0.0); + + step = 0.1; + GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, 3); + GroupOnCurve->SpinBox_DX->SetValue( 0.5 ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnCurve->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupXYZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr("GEOM_VERTEX") ); + + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) +{ + switch ( constructorId ) + { + case 0: + { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + + GroupRefPoint->hide(); + GroupOnCurve->hide(); + + GroupXYZ->show(); + + myCoordGrp->hide(); + break; + } + case 1: + { + myEditCurrentArgument = GroupRefPoint->LineEdit1; + myEditCurrentArgument->setText(""); + myRefPoint = GEOM::GEOM_Object::_nil(); + + globalSelection( GEOM_POINT ); + + GroupXYZ->hide(); + GroupOnCurve->hide(); + + GroupRefPoint->show(); + + myCoordGrp->show(); + break; + } + case 2: + { + myEditCurrentArgument = GroupOnCurve->LineEdit1; + myEditCurrentArgument->setText(""); + myEdge = GEOM::GEOM_Object::_nil(); + + globalSelection( GEOM_EDGE ); + + GroupXYZ->hide(); + GroupRefPoint->hide(); + + GroupOnCurve->show(); + + myCoordGrp->show(); + break; + } + } + + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + + qApp->processEvents(); + updateGeometry(); + resize( minimumSize() ); + + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ClickOnOk() +{ + if ( onAccept() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_PointDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_PointDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed (for constructors not using local context) +//================================================================================= +void BasicGUI_PointDlg::SelectionIntoArgument() +{ + const int id = getConstructorId(); + + if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) + { + myEditCurrentArgument->setText(""); + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); + } + + if ( IObjectCount() == 1 ) + { + Standard_Boolean aRes = Standard_False; + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + if ( id == 0 ) + { + // get CORBA reference to data object + TopoDS_Shape aShape = myGeometryGUI->GetShapeReader().GetShape( myGeometryGUI->GetGeomGen(), aSelectedObject ); + if ( aShape.IsNull() ) + return; + + if ( aShape.ShapeType() != TopAbs_VERTEX ) + { + TColStd_IndexedMapOfInteger aMap; + + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( aMap.Extent() == 1 ) + { + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) + return; + } + else + return; + } + + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); + GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); + GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() ); + } + else if ( id == 1 ) + { + myRefPoint = aSelectedObject; + GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } + else if ( id == 2 ) + { + myEdge = aSelectedObject; + GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } + } + } + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == GroupRefPoint->PushButton1 ) + { + GroupRefPoint->LineEdit1->setFocus(); + myEditCurrentArgument = GroupRefPoint->LineEdit1; + + globalSelection( GEOM_POINT ); + } + else if ( send == GroupOnCurve->PushButton1 ) + { + GroupOnCurve->LineEdit1->setFocus(); + myEditCurrentArgument = GroupOnCurve->LineEdit1; + + globalSelection( GEOM_EDGE ); + } +} + + +//================================================================================= +// function : enterEvent() +// purpose : to reactivate this dialog box when mouse enter onto the window +//================================================================================= +void BasicGUI_PointDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ActivateThisDialog( ) +{ + GEOMBase_Skeleton::ActivateThisDialog(); + // myGeometryGUI->SetState( 0 ); + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_PointDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) +{ + displayPreview(); +} + +//======================================================================= +// funcion : getParameter() +// purpose : +//======================================================================= +double BasicGUI_PointDlg::getParameter() const +{ + return GroupOnCurve->SpinBox_DX->GetValue(); +} + +//================================================================================= +// function : OnPointSelected +// purpose : +//================================================================================= +void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt ) +{ + if ( getConstructorId() == 0 ) + { + GroupXYZ->SpinBox_DX->SetValue( thePnt.X() ); + GroupXYZ->SpinBox_DY->SetValue( thePnt.Y() ); + GroupXYZ->SpinBox_DZ->SetValue( thePnt.Z() ); + + displayPreview(); + } +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_PointDlg::isValid( QString& msg ) +{ + const int id = getConstructorId(); + if ( id == 0 ) + return true; + else if ( id == 1 ) + return !myRefPoint->_is_nil(); + else if ( id == 2 ) + return !myEdge->_is_nil(); + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_PointDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + double x = GroupXYZ->SpinBox_DX->GetValue(); + double y = GroupXYZ->SpinBox_DY->GetValue(); + double z = GroupXYZ->SpinBox_DZ->GetValue(); + + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x,y,z ); + res = true; + break; + } + case 1 : + { + double dx = GroupRefPoint->SpinBox_DX->GetValue(); + double dy = GroupRefPoint->SpinBox_DY->GetValue(); + double dz = GroupRefPoint->SpinBox_DZ->GetValue(); + + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointWithReference( myRefPoint, dx, dy, dz ); + res = true; + break; + } + case 2 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointOnCurve( myEdge, getParameter() ); + res = true; + break; + } + + if ( getConstructorId() == 1 || getConstructorId() == 2 ) + { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + myX->setText( QString( "%1" ).arg( aPnt.X() ) ); + myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); + myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + } + else + { + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + } + } + + if ( !anObj->_is_nil() ) + { + //printf( "--> a valid point is created\n" ); + objects.push_back( anObj._retn() ); + } + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_PointDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx new file mode 100644 index 000000000..8860b2e48 --- /dev/null +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -0,0 +1,416 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_VectorDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BasicGUI_VectorDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : BasicGUI_VectorDlg() +// purpose : Constructs a BasicGUI_VectorDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_VectorDlg::BasicGUI_VectorDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl ), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_VECTOR_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_VECTOR")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + GroupDimensions = new DlgRef_3Spin1Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_COORDINATES")); + GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); + GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); + GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); + GroupDimensions->CheckBox1->setText(tr("GEOM_REVERSE_VECTOR")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_VectorDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_VectorDlg::~BasicGUI_VectorDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1 = GEOM::GEOM_Object::_nil(); + myPoint2 = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes */ + GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + double dx( 0. ), dy( 0. ), dz( 200. ); + GroupDimensions->SpinBox_DX->SetValue( dx ); + GroupDimensions->SpinBox_DY->SetValue( dy ); + GroupDimensions->SpinBox_DZ->SetValue( dz ); + + GroupDimensions->CheckBox1->setChecked(FALSE); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + + connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr("GEOM_VECTOR") ); + + GroupDimensions->hide(); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + myPoint1 = GEOM::GEOM_Object::_nil(); + myPoint2 = GEOM::GEOM_Object::_nil(); + + switch (constructorId) + { + case 0: + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + globalSelection( GEOM_POINT ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + + double dx( 0. ), dy( 0. ), dz( 0. ); + GroupDimensions->SpinBox_DX->SetValue( dx ); + GroupDimensions->SpinBox_DY->SetValue( dy ); + GroupDimensions->SpinBox_DZ->SetValue( dz ); + + GroupDimensions->CheckBox1->setChecked( FALSE ); + break; + } + } + + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_VectorDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_VectorDlg::ClickOnApply() +{ + buttonApply->setFocus(); + + if ( !onAccept() ) + return false; + + initName(); + if ( getConstructorId() != 1 ) + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_VectorDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; + } + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + else return; + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_VectorDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) +{ + displayPreview(); +} + +//================================================================================= +// function : ReverseVector() +// purpose : 'state' not used here +//================================================================================= +void BasicGUI_VectorDlg::ReverseVector(int state) +{ + double dx = -GroupDimensions->SpinBox_DX->GetValue(); + double dy = -GroupDimensions->SpinBox_DY->GetValue(); + double dz = -GroupDimensions->SpinBox_DZ->GetValue(); + + GroupDimensions->SpinBox_DX->SetValue( dx ); + GroupDimensions->SpinBox_DY->SetValue( dy ); + GroupDimensions->SpinBox_DZ->SetValue( dz ); + + displayPreview(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BasicGUI_VectorDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil(): true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BasicGUI_VectorDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) { + case 0 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorTwoPnt( myPoint1, myPoint2 ); + res = true; + break; + + case 1 : + { + double dx = GroupDimensions->SpinBox_DX->GetValue(); + double dy = GroupDimensions->SpinBox_DY->GetValue(); + double dz = GroupDimensions->SpinBox_DZ->GetValue(); + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx,dy,dz ); + res = true; + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx new file mode 100644 index 000000000..168c8bc7b --- /dev/null +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -0,0 +1,468 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BasicGUI_WorkingPlaneDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM + +#include "BasicGUI_WorkingPlaneDlg.h" + +#include "GEOMBase.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include +#include + +using namespace std; + +//================================================================================= +// class : BasicGUI_WorkingPlaneDlg() +// purpose : Constructs a BasicGUI_WorkingPlaneDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(GeometryGUI* theGeometryGUI , QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_FACE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_VECTOR"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_ORIGIN"))); + + setCaption(tr("GEOM_WPLANE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_WPLANE")); + RadioButton1->setPixmap(image1); + RadioButton2->setPixmap(image2); + RadioButton3->setPixmap(image3); + + Group1 = new DlgRef_1Sel_QTD(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_WPLANE_FACE")); + Group1->TextLabel1->setText(tr("GEOM_SELECTION")); + Group1->PushButton1->setPixmap(image0); + Group1->LineEdit1->setReadOnly( true ); + + Group2 = new DlgRef_2Sel_QTD(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_WPLANE_VECTOR")); + Group2->TextLabel1->setText(tr("GEOM_WPLANE_VX")); + Group2->TextLabel2->setText(tr("GEOM_WPLANE_VZ")); + Group2->PushButton1->setPixmap(image0); + Group2->PushButton2->setPixmap(image0); + Group2->LineEdit1->setReadOnly( true ); + Group2->LineEdit2->setReadOnly( true ); + + Group3 = new DlgRef_3Check_QTD(this, "Group3"); + Group3->GroupBox1->setTitle(tr("GEOM_WPLANE_ORIGIN")); + Group3->RadioButton1->setText(tr("GEOM_WPLANE_OXY")); + Group3->RadioButton2->setText(tr("GEOM_WPLANE_OYZ")); + Group3->RadioButton3->setText(tr("GEOM_WPLANE_OZX")); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + Layout1->addWidget(Group3, 1, 0); + /***************************************************************/ + + Init(); +} + +//================================================================================= +// function : ~BasicGUI_WorkingPlaneDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_WorkingPlaneDlg::~BasicGUI_WorkingPlaneDlg() +{ +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = Group1->LineEdit1; + myWPlane = myGeometryGUI->GetWorkingPlane(); + + // myGeometryGUI->SetState( 0 ); + + myFace = GEOM::GEOM_Object::_nil(); + myVectX = GEOM::GEOM_Object::_nil(); + myVectZ = GEOM::GEOM_Object::_nil(); + + aOriginType = 1; + + /* Filter definition */ + globalSelection( GEOM_PLANE ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group3->GroupBox1, SIGNAL(clicked(int)), this, SLOT(GroupClicked(int))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_WPLANE" ) ); + ConstructorsClicked(0); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + // myGeometryGUI->SetState( 0 ); + + switch (constructorId) + { + case 0: + { + globalSelection( GEOM_PLANE ); + + Group2->hide(); + Group3->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); + myFace = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + globalSelection( GEOM_LINE ); + + Group1->hide(); + Group3->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); + Group2->LineEdit2->setText(""); + myVectX = GEOM::GEOM_Object::_nil(); + myVectZ = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 2: + { + Group1->hide(); + Group2->hide(); + resize(0, 0); + Group3->show(); + + Group3->RadioButton1->setChecked(true); + aOriginType = 1; + break; + } + } + displayPreview(); +} + +//================================================================================= +// function : GroupClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_WorkingPlaneDlg::GroupClicked(int groupId) +{ + aOriginType = groupId; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BasicGUI_WorkingPlaneDlg::ClickOnApply() +{ + buttonApply->setFocus(); + myGeometryGUI->application()->putInfo(tr("")); + const int id = getConstructorId(); + + if (id == 0) { + if ( !CORBA::is_nil( myFace ) ) { + TopoDS_Face aPlaneShape; + if ( GEOMBase::GetShape( myFace, aPlaneShape, TopAbs_FACE ) ) { + Handle(Geom_Surface) aGS = BRep_Tool::Surface( TopoDS::Face( aPlaneShape ) ); + if ( !aGS.IsNull() && aGS->IsKind( STANDARD_TYPE( Geom_Plane ) ) ) { + Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS ); + gp_Pln aPln = aGPlane->Pln(); + + myWPlane = aPln.Position(); + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); + return true; + } + } + } + } else if (id == 1) { + if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { + showError( "Two vectors have to be selected" ); + return false; + } + + TopoDS_Edge aVectX, aVectZ; + TopoDS_Vertex V1, V2; + gp_Vec aVX, aVZ; + if (GEOMBase::GetShape( myVectX, aVectX, TopAbs_EDGE ) && + GEOMBase::GetShape( myVectZ, aVectZ, TopAbs_EDGE )) { + TopExp::Vertices(aVectZ, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) + aVZ = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + else { + showError( "Bad OZ vector" ); + return false; + } + + TopExp::Vertices(aVectX, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) + aVX = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + else { + showError( "Bad OX vector" ); + return false; + } + + gp_Dir aDirZ = gp_Dir(aVZ.X(), aVZ.Y(), aVZ.Z()); + gp_Dir aDirX = gp_Dir(aVX.X(), aVX.Y(), aVX.Z()); + + if (aDirX.IsParallel(aDirZ, Precision::Confusion())) { + showError( "Parallel vectors selected" ); + return false; + } + + myWPlane = gp_Ax3(BRep_Tool::Pnt(V1), aDirZ, aDirX); + + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); + return true; + } + } else if (id == 2) { + gp_Pnt P1 = gp_Pnt(0., 0., 0.); + gp_Dir aDirZ, aDirX; + + if (aOriginType == 1) { + aDirZ = gp_Dir(0., 0., 1.); + aDirX = gp_Dir(1., 0., 0.); + } + else if (aOriginType == 2) { + aDirZ = gp_Dir(1., 0., 0.); + aDirX = gp_Dir(0., 1., 0.); + } + else if (aOriginType == 0) { + aDirZ = gp_Dir(0., 1., 0.); + aDirX = gp_Dir(0., 0., 1.); + } + + myWPlane = gp_Ax3(P1, aDirZ, aDirX); + + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); + return true; + } + return false; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + const int id = getConstructorId(); + if ( IObjectCount() != 1 ) { + if(id == 0) + myFace = GEOM::GEOM_Object::_nil(); + else if(id == 1) { + if (myEditCurrentArgument == Group2->LineEdit1) + myVectX = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group2->LineEdit2) + myVectZ = GEOM::GEOM_Object::_nil(); + } + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); + + if(!aRes || CORBA::is_nil( aSelectedObject )) + return; + + if(myEditCurrentArgument == Group1->LineEdit1) + myFace = aSelectedObject; + else if(myEditCurrentArgument == Group2->LineEdit1) + myVectX = aSelectedObject; + else if(myEditCurrentArgument == Group2->LineEdit2) + myVectZ = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) { + myEditCurrentArgument = Group1->LineEdit1; + globalSelection( GEOM_PLANE ); + } + else if(send == Group2->PushButton1) { + myEditCurrentArgument = Group2->LineEdit1; + globalSelection( GEOM_LINE ); + } + else if(send == Group2->PushButton2) { + myEditCurrentArgument = Group2->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1 || send == Group2->LineEdit1 || send == Group2->LineEdit2) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ActivateThisDialog( ) +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog() +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_WorkingPlaneDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e ) +{ + // myGeometryGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx new file mode 100644 index 000000000..5d0444ea4 --- /dev/null +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -0,0 +1,400 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BlocksGUI_BlockDlg.cxx +// Author : Julia DOROVSKIKH +// Module : GEOM +// $Header$ + +#include "BlocksGUI_BlockDlg.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "GEOMImpl_Types.hxx" + +using namespace std; + +#include + +//================================================================================= +// class : BlocksGUI_BlockDlg() +// purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'. +//================================================================================= +BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (QWidget* parent, + bool modal) + : GEOMBase_Skeleton(parent, "BlockDlg", modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_2F"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_6F"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BLOCK_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BLOCK")); + + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + // Create first group + Group2F = new DlgRef_2Sel_QTD(this, "Group2F"); + Group2F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group2F->TextLabel1->setText(tr("FACE_1")); + Group2F->TextLabel2->setText(tr("FACE_2")); + Group2F->PushButton1->setPixmap(imageS); + Group2F->PushButton2->setPixmap(imageS); + + // Create second group + Group6F = new DlgRef_6Sel_QTD(this, "Group2F"); + Group6F->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group6F->TextLabel1->setText(tr("FACE_1")); + Group6F->TextLabel2->setText(tr("FACE_2")); + Group6F->TextLabel3->setText(tr("FACE_3")); + Group6F->TextLabel4->setText(tr("FACE_4")); + Group6F->TextLabel5->setText(tr("FACE_5")); + Group6F->TextLabel6->setText(tr("FACE_6")); + Group6F->PushButton1->setPixmap(imageS); + Group6F->PushButton2->setPixmap(imageS); + Group6F->PushButton3->setPixmap(imageS); + Group6F->PushButton4->setPixmap(imageS); + Group6F->PushButton5->setPixmap(imageS); + Group6F->PushButton6->setPixmap(imageS); + + // Add groups to layout + Layout1->addWidget(Group2F, 2, 0); + Layout1->addWidget(Group6F, 2, 0); + /***************************************************************/ + + Init(); +} + +//================================================================================= +// function : ~BlocksGUI_BlockDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BlocksGUI_BlockDlg::~BlocksGUI_BlockDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BlocksGUI_BlockDlg::Init() +{ + // init variables + Group2F->LineEdit1->setReadOnly(true); + Group2F->LineEdit2->setReadOnly(true); + + Group6F->LineEdit1->setReadOnly(true); + Group6F->LineEdit2->setReadOnly(true); + Group6F->LineEdit3->setReadOnly(true); + Group6F->LineEdit4->setReadOnly(true); + Group6F->LineEdit5->setReadOnly(true); + Group6F->LineEdit6->setReadOnly(true); + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(Group2F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group6F->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group6F->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group6F->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group6F->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group6F->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group6F->PushButton6, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + // init controls and fields + initName(tr("GEOM_BLOCK")); + + myConstructorId = -1; + ConstructorsClicked(0); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) +{ + if (myConstructorId == constructorId) + return; + + myConstructorId = constructorId; + + switch (constructorId) { + case 0: + Group6F->hide(); + resize(0, 0); + Group2F->show(); + + myEditCurrentArgument = Group2F->LineEdit1; + Group2F->LineEdit1->setText(tr("")); + Group2F->LineEdit2->setText(tr("")); + break; + case 1: + Group2F->hide(); + resize(0, 0); + Group6F->show(); + + myEditCurrentArgument = Group6F->LineEdit1; + Group6F->LineEdit1->setText(tr("")); + Group6F->LineEdit2->setText(tr("")); + Group6F->LineEdit3->setText(tr("")); + Group6F->LineEdit4->setText(tr("")); + Group6F->LineEdit5->setText(tr("")); + Group6F->LineEdit6->setText(tr("")); + break; + default: + break; + } + + // init fields + myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); + myFace3 = myFace4 = myFace5 = myFace6 = myFace1; + + globalSelection(GEOM_FACE); + SelectionIntoArgument(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BlocksGUI_BlockDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BlocksGUI_BlockDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BlocksGUI_BlockDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if (IObjectCount() != 1) + { + if (myEditCurrentArgument == Group2F->LineEdit1 || + myEditCurrentArgument == Group6F->LineEdit1) + myFace1 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group2F->LineEdit2 || + myEditCurrentArgument == Group6F->LineEdit2) + myFace2 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group6F->LineEdit3) + myFace3 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group6F->LineEdit4) + myFace4 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group6F->LineEdit5) + myFace5 = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == Group6F->LineEdit6) + myFace6 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if (!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if (myEditCurrentArgument == Group2F->LineEdit1 || + myEditCurrentArgument == Group6F->LineEdit1) + myFace1 = aSelectedObject; + else if (myEditCurrentArgument == Group2F->LineEdit2 || + myEditCurrentArgument == Group6F->LineEdit2) + myFace2 = aSelectedObject; + else if (myEditCurrentArgument == Group6F->LineEdit3) + myFace3 = aSelectedObject; + else if (myEditCurrentArgument == Group6F->LineEdit4) + myFace4 = aSelectedObject; + else if (myEditCurrentArgument == Group6F->LineEdit5) + myFace5 = aSelectedObject; + else if (myEditCurrentArgument == Group6F->LineEdit6) + myFace6 = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BlocksGUI_BlockDlg::SetEditCurrentArgument() +{ + QPushButton* aSender = (QPushButton*)sender(); + + if (aSender == Group2F->PushButton1) { + myEditCurrentArgument = Group2F->LineEdit1; + } else if (aSender == Group2F->PushButton2) { + myEditCurrentArgument = Group2F->LineEdit2; + + } else if (aSender == Group6F->PushButton1) { + myEditCurrentArgument = Group6F->LineEdit1; + } else if (aSender == Group6F->PushButton2) { + myEditCurrentArgument = Group6F->LineEdit2; + } else if (aSender == Group6F->PushButton3) { + myEditCurrentArgument = Group6F->LineEdit3; + } else if (aSender == Group6F->PushButton4) { + myEditCurrentArgument = Group6F->LineEdit4; + } else if (aSender == Group6F->PushButton5) { + myEditCurrentArgument = Group6F->LineEdit5; + } else if (aSender == Group6F->PushButton6) { + myEditCurrentArgument = Group6F->LineEdit6; + } + + globalSelection(GEOM_FACE); + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BlocksGUI_BlockDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + globalSelection(GEOM_FACE); + + SelectionIntoArgument(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BlocksGUI_BlockDlg::enterEvent (QEvent* e) +{ + if (!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +//void BlocksGUI_BlockDlg::DeactivateActiveDialog() +//{ +// GEOMBase_Skeleton::DeactivateActiveDialog(); +//} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation() +{ + return getGeomEngine()->GetIBlocksOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BlocksGUI_BlockDlg::isValid (QString&) +{ + switch (getConstructorId()) { + case 0: + return !(myFace1->_is_nil() || myFace2->_is_nil()); + case 1: + return !(myFace1->_is_nil() || myFace2->_is_nil() || + myFace3->_is_nil() || myFace4->_is_nil() || + myFace5->_is_nil() || myFace6->_is_nil()); + default: + return false; + } + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BlocksGUI_BlockDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch (getConstructorId()) { + case 0: + if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2)) { + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> + MakeHexa2Faces(myFace1, myFace2); + res = true; + } + break; + case 1: + if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2) && + !CORBA::is_nil(myFace3) && !CORBA::is_nil(myFace4) && + !CORBA::is_nil(myFace5) && !CORBA::is_nil(myFace6)) { + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> + MakeHexa(myFace1, myFace2, myFace3, myFace4, myFace5, myFace6); + res = true; + } + break; + } + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx new file mode 100644 index 000000000..728082a4e --- /dev/null +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -0,0 +1,505 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BlocksGUI_ExplodeDlg.cxx +// Author : Julia DOROVSKIKH +// Module : GEOM +// $Header$ + +#include "BlocksGUI_ExplodeDlg.h" + +#include "DlgRef_SpinBox.h" + +#include "GEOM_Displayer.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "utilities.h" + +#include + +#include +#include +#include +#include + +//================================================================================= +// class : BlocksGUI_ExplodeDlg() +// purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'. +//================================================================================= +BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg (QWidget* parent, + bool modal) + : GEOMBase_Skeleton(parent, "ExplodeDlg", modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_EXPLODE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BLOCK_EXPLODE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BLOCK_EXPLODE")); + + RadioButton1->setPixmap(image1); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + // Create first group + myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); + + QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, myGrp1); + aSelGrp->setFrameStyle(QFrame::NoFrame); + aSelGrp->setInsideMargin(0); + + new QLabel(tr("GEOM_MAIN_OBJECT"), aSelGrp); + mySelBtn = new QPushButton(aSelGrp); + mySelBtn->setPixmap(imageS); + mySelName = new QLineEdit(aSelGrp); + mySelName->setReadOnly(true); + + QGroupBox* aSpinGrp = new QGroupBox(2, Qt::Horizontal, myGrp1); + aSpinGrp->setFrameStyle(QFrame::NoFrame); + aSpinGrp->setInsideMargin(0); + + new QLabel(tr("NB_FACES_MIN"), aSpinGrp); + mySpinBoxMin = new DlgRef_SpinBox(aSpinGrp); + + new QLabel(tr("NB_FACES_MAX"), aSpinGrp); + mySpinBoxMax = new DlgRef_SpinBox(aSpinGrp); + + QGroupBox* anInfoGrp = new QGroupBox(2, Qt::Horizontal, myGrp1); + anInfoGrp->setFrameStyle(QFrame::NoFrame); + anInfoGrp->setInsideMargin(0); + + myBlocksNb = new QTextEdit(anInfoGrp); + myBlocksNb->setReadOnly(true); + + QGroupBox* aCheckGrp = new QGroupBox(3, Qt::Horizontal, myGrp1); + aCheckGrp->setFrameStyle(QFrame::NoFrame); + aCheckGrp->setInsideMargin(0); + + myCheckBtn = new QCheckBox(aCheckGrp, "CheckButton1"); + myCheckBtn->setText(tr("GEOM_SUBSHAPE_SELECT")); + + // Add groups to layout + Layout1->addWidget(myGrp1, 1, 0); + /***************************************************************/ + + Init(); +} + +//================================================================================= +// function : ~BlocksGUI_ExplodeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BlocksGUI_ExplodeDlg::~BlocksGUI_ExplodeDlg() +{ + // no need to delete child widgets, Qt does it all for us + clearTemporary(); +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::Init() +{ + // Set range of spinboxes + double SpecificStep = 1.0; + mySpinBoxMin->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); + mySpinBoxMax->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); + + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) + myCheckBtn->setEnabled(false); + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySpinBoxMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(mySpinBoxMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myCheckBtn, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + myConstructorId = -1; + ConstructorsClicked(0); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BlocksGUI_ExplodeDlg::ConstructorsClicked (int constructorId) +{ + if (myConstructorId == constructorId) + return; + + myConstructorId = constructorId; + + switch (constructorId) { + case 0: + myGrp1->show(); + mySpinBoxMin->SetValue(6.0); + mySpinBoxMax->SetValue(6.0); + myCheckBtn->setChecked(FALSE); + break; + default: + break; + } + + // init fields + myEditCurrentArgument = mySelName; + myObject = GEOM::GEOM_Object::_nil(); + + activateSelection(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BlocksGUI_ExplodeDlg::ClickOnApply() +{ + SUIT_Session::session()->activeApplication()->putInfo(tr("")); + + // Explode all sub shapes + if (isAllSubShapes()) { + // More than 30 subshapes : ask confirmation + if (myNbBlocks > 30) { + const QString caption = tr("GEOM_CONFIRM"); + const QString text = tr("GEOM_CONFIRM_INFO").arg(myNbBlocks); + const QString button0 = tr("GEOM_BUT_EXPLODE"); + const QString button1 = tr("GEOM_BUT_CANCEL"); + + if (QMessageBox::warning(this, caption, text, button0, button1) != 0) + return false; /* aborted */ + } + } + + if (!onAccept()) + return false; + + activateSelection(); + + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BlocksGUI_ExplodeDlg::SelectionIntoArgument() +{ + if (!isAllSubShapes()) + return; + + myObject = GEOM::GEOM_Object::_nil(); + mySelName->setText(""); + + if (IObjectCount() == 1) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + + if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + myObject = anObj; + mySelName->setText(GEOMBase::GetName(anObj)); + } + } + + updateButtonState(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::SetEditCurrentArgument() +{ + QPushButton* aSender = (QPushButton*)sender(); + + if (mySelBtn == aSender) { + mySelName->setFocus(); + myEditCurrentArgument = mySelName; + myCheckBtn->setChecked(FALSE); + } + + activateSelection(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + activateSelection(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::enterEvent (QEvent* e) +{ + if (!GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::ValueChangedInSpinBox (double newValue) +{ + if (!isAllSubShapes()) + activateSelection(); + else + updateButtonState(); +} + +//================================================================================= +// function : SubShapeToggled() +// purpose : Allow user selection of all or only selected sub shapes +// : Called when 'myCheckBtn' state change +//================================================================================= +void BlocksGUI_ExplodeDlg::SubShapeToggled() +{ + activateSelection(); +} + +//================================================================================= +// function : activateSelection +// purpose : Redisplay preview and Activate selection +//================================================================================= +void BlocksGUI_ExplodeDlg::activateSelection() +{ + clearTemporary(); + erasePreview(true); + + if (isAllSubShapes()) { // Sub-shapes selection disabled + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + globalSelection( GEOM_ALLSHAPES ); + if (myObject->_is_nil()) { + SelectionIntoArgument(); + } + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + } else { + displayPreview(true, true, false); + globalSelection(GEOM_PREVIEW); + } +} + +//================================================================================= +// function : updateButtonState +// purpose : +//================================================================================= +void BlocksGUI_ExplodeDlg::updateButtonState() +{ + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() || myObject->_is_nil()) { + myCheckBtn->setChecked(FALSE); + myCheckBtn->setEnabled(FALSE); + } else { + myCheckBtn->setEnabled(TRUE); + } + + myNbBlocks = 0; + + if (myObject->_is_nil()) { + myBlocksNb->setText(""); + } else { + bool isOnlyBlocks = GEOM::GEOM_IBlocksOperations::_narrow + (getOperation())->IsCompoundOfBlocks(myObject, + (int)mySpinBoxMin->GetValue(), + (int)mySpinBoxMax->GetValue(), + myNbBlocks); + if (isOnlyBlocks) + myBlocksNb->setText(tr("GEOM_NB_BLOCKS_NO_OTHERS").arg(myNbBlocks)); + else + myBlocksNb->setText(tr("GEOM_NB_BLOCKS_SOME_OTHERS").arg(myNbBlocks)); + } +} + +//================================================================================= +// function : isAllSubShapes +// purpose : +//================================================================================= +bool BlocksGUI_ExplodeDlg::isAllSubShapes() const +{ + return !myCheckBtn->isChecked() || !myCheckBtn->isEnabled(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation() +{ + return getGeomEngine()->GetIBlocksOperations(getStudyId()); +} + +//================================================================================= +// function : isValid() +// purpose : Verify validity of input data +//================================================================================= +bool BlocksGUI_ExplodeDlg::isValid (QString&) +{ + switch (getConstructorId()) { + case 0: + if (IsPreview()) + return !myObject->_is_nil(); + else + return !myObject->_is_nil() && (isAllSubShapes() || IObjectCount()); + default: + return false; + } + + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects) +{ + GEOM::ListOfGO_var aList; + + switch (getConstructorId()) { + case 0: + aList = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->ExplodeCompoundOfBlocks + (myObject, + (int)mySpinBoxMin->GetValue(), + (int)mySpinBoxMax->GetValue()); + break; + } + + if (!aList->length()) + return false; + + if (IsPreview()) { + clearTemporary(); + + // Store objects. They will be put in study when "Apply" is pressed + for (int i = 0, n = aList->length(); i < n; i++) { + objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + } + + return objects.size() ? true : false; + } + + // Throw away sub-shapes not selected by user if not in preview mode + // and manual selection is active + if (!isAllSubShapes()) + { + QMap selected; + + // Get names of selected objects + SALOME_ListIteratorOfListIO it (selectedIO()); + for (; it.More(); it.Next()) { + selected.insert(it.Value()->getName(), 0); + } + + // Iterate through result and select objects with names from selection + ObjectList toRemoveFromEnggine; + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) { + if (selected.contains(myGeomGUI->getApp()->orb()->object_to_string(*anIter))) + objects.push_back(*anIter); + else + toRemoveFromEnggine.push_back(*anIter); + } + + // Remove from engine useless objects + ObjectList::iterator anIter2 = toRemoveFromEnggine.begin(); + for (; anIter2 != toRemoveFromEnggine.end(); ++anIter2) + getGeomEngine()->RemoveObject(*anIter2); + + myTmpObjs.clear(); + + } else { + for (int i = 0, n = aList->length(); i < n; i++) + objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); + } + + return objects.size(); +} + +//================================================================================= +// function : clearTemporary +// purpose : Remove temporary objects from engine +//================================================================================= +void BlocksGUI_ExplodeDlg::clearTemporary() +{ + ObjectList::iterator anIter; + for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) + getGeomEngine()->RemoveObject(*anIter); + + myTmpObjs.clear(); +} + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// ( called with addInStudy method ) +//================================================================ +GEOM::GEOM_Object_ptr BlocksGUI_ExplodeDlg::getFather (GEOM::GEOM_Object_ptr) +{ + return myObject; +} + +//================================================================ +// Function : getNewObjectName +// Purpose : Redefine this method to return proper name for a new object +//================================================================ +const char* BlocksGUI_ExplodeDlg::getNewObjectName() const +{ + return ""; +} diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx new file mode 100644 index 000000000..0c4bdc44b --- /dev/null +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx @@ -0,0 +1,319 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BlocksGUI_PropagateDlg.cxx +// Author : VKN +// Module : GEOM +// $Header$ + +#include "BlocksGUI_PropagateDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include + +using namespace std; + +//================================================================================= +// class : BlocksGUI_PropagateDlg() +// purpose : Constructs a BlocksGUI_PropagateDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PROPAGATE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PROPAGATE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PROPAGATE_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this ); + QGroupBox* aSelGrp = new QGroupBox(3, Qt::Horizontal, aMainGrp); + aSelGrp->setFrameStyle(QFrame::NoFrame); + aSelGrp->setInsideMargin(0); + + new QLabel(tr("GEOM_OBJECT"), aSelGrp); + mySelBtn = new QPushButton(aSelGrp); + mySelBtn->setPixmap(image1); + mySelName = new QLineEdit(aSelGrp); + mySelName->setReadOnly(true); + + Layout1->addWidget(aMainGrp, 1, 0); + + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~BlocksGUI_PropagateDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BlocksGUI_PropagateDlg::~BlocksGUI_PropagateDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::Init() +{ + /* init variables */ + + myObject = GEOM::GEOM_Object::_nil(); + ResultName->setText( "" ); + + //myGeomGUI->SetState( 0 ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(mySelBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelName, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + activateSelection(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void BlocksGUI_PropagateDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BlocksGUI_PropagateDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + mySelName->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + activateSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void BlocksGUI_PropagateDlg::SelectionIntoArgument() +{ + mySelName->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + if ( IObjectCount() == 1 ) { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes ) + mySelName->setText( GEOMBase::GetName( myObject ) ); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == mySelBtn ) { + mySelName->setFocus(); + } + activateSelection(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == mySelName ) { + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + mySelName->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState( 0 ); + activateSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void BlocksGUI_PropagateDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void BlocksGUI_PropagateDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BlocksGUI_PropagateDlg::createOperation() +{ + return getGeomEngine()->GetIBlocksOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BlocksGUI_PropagateDlg::isValid( QString& msg ) +{ + return !myObject->_is_nil() ; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BlocksGUI_PropagateDlg::execute( ObjectList& objects ) +{ + + GEOM::ListOfGO_var aList = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->Propagate( myObject ); + ResultName->setText( "" ); + + if ( !aList->length() ) + return false; + + for ( int i = 0, n = aList->length(); i < n; i++ ) + { + objects.push_back(aList[i]._retn()); + } + + return objects.size() ? true : false; +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection +//================================================================================= +void BlocksGUI_PropagateDlg::activateSelection() +{ + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SOLID ); + aMap.Add( GEOM_COMPOUND ); + globalSelection( aMap ); + if (myObject->_is_nil()) { + SelectionIntoArgument(); + } + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; +} + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// ( called with addInStudy method ) +//================================================================ +GEOM::GEOM_Object_ptr BlocksGUI_PropagateDlg::getFather (GEOM::GEOM_Object_ptr) +{ + return myObject; +} + diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx new file mode 100644 index 000000000..ebf979a2b --- /dev/null +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -0,0 +1,413 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BlocksGUI_QuadFaceDlg.cxx +// Author : Julia DOROVSKIKH +// Module : GEOM +// $Header$ + +#include "BlocksGUI_QuadFaceDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +//using namespace std; + +#include + +//================================================================================= +// class : BlocksGUI_QuadFaceDlg() +// purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'. +//================================================================================= +BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (QWidget* parent, + bool modal) + : GEOMBase_Skeleton(parent, "QuadFaceDlg", modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_VERT"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_2_EDGE"))); + QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_EDGE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_QUAD_FACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_QUAD_FACE")); + + RadioButton1->setPixmap(image1); + RadioButton2->setPixmap(image2); + RadioButton3->setPixmap(image3); + + // Create first group + myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); + + QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); + aSelGrp1->setFrameStyle(QFrame::NoFrame); + aSelGrp1->setInsideMargin(0); + + createSelWg(tr("VERTEX_1"), imageS, aSelGrp1, Vertex1); + createSelWg(tr("VERTEX_2"), imageS, aSelGrp1, Vertex2); + createSelWg(tr("VERTEX_3"), imageS, aSelGrp1, Vertex3); + createSelWg(tr("VERTEX_4"), imageS, aSelGrp1, Vertex4); + + // Create second group + myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); + + QGroupBox* aSelGrp2 = new QGroupBox(3, Qt::Horizontal, myGrp2); + aSelGrp2->setFrameStyle(QFrame::NoFrame); + aSelGrp2->setInsideMargin(0); + + createSelWg(tr("EDGE_1"), imageS, aSelGrp2, Edge12); + createSelWg(tr("EDGE_2"), imageS, aSelGrp2, Edge22); + + // Create fird group + myGrp3 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_ARGUMENTS"), this); + + QGroupBox* aSelGrp3 = new QGroupBox(3, Qt::Horizontal, myGrp3); + aSelGrp3->setFrameStyle(QFrame::NoFrame); + aSelGrp3->setInsideMargin(0); + + createSelWg(tr("EDGE_1"), imageS, aSelGrp3, Edge14); + createSelWg(tr("EDGE_2"), imageS, aSelGrp3, Edge24); + createSelWg(tr("EDGE_3"), imageS, aSelGrp3, Edge34); + createSelWg(tr("EDGE_4"), imageS, aSelGrp3, Edge44); + + (new QLabel(myGrp3))->setSizePolicy( + QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + + // Add groups to layout + Layout1->addWidget(myGrp1, 2, 0); + Layout1->addWidget(myGrp2, 2, 0); + Layout1->addWidget(myGrp3, 2, 0); + /***************************************************************/ + + Init(); +} + +//================================================================================= +// function : ~BlocksGUI_QuadFaceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BlocksGUI_QuadFaceDlg::~BlocksGUI_QuadFaceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::Init() +{ + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + QMap::iterator anIterBtn; + for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) + connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + // init controls and fields + initName(tr("GEOM_QUAD_FACE")); + + myConstructorId = -1; + ConstructorsClicked(0); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId) +{ + if (myConstructorId == constructorId) + return; + + myConstructorId = constructorId; + + switch (constructorId) { + case 0: + myGrp2->hide(); + myGrp3->hide(); + myGrp1->show(); + myEditCurrentArgument = mySelName[Vertex1]; + break; + case 1: + myGrp1->hide(); + myGrp3->hide(); + myGrp2->show(); + myEditCurrentArgument = mySelName[Edge12]; + break; + case 2: + myGrp1->hide(); + myGrp2->hide(); + myGrp3->show(); + myEditCurrentArgument = mySelName[Edge14]; + break; + default: + break; + } + + // clear line edits + QMap::iterator anIterLE; + for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE) + anIterLE.data()->setText(""); + + // init fields + myShape1 = myShape2 = GEOM::GEOM_Object::_nil(); + myShape3 = myShape4 = myShape1; + + activateSelection(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BlocksGUI_QuadFaceDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + // Get index of current selection focus + int aCurrFocus = -1; + QMap::iterator anIter; + for (anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter) { + if (myEditCurrentArgument == anIter.data()) { + aCurrFocus = anIter.key(); + break; + } + } + + GEOM::GEOM_Object_var anObj; + Standard_Boolean aResult = Standard_False; + if (IObjectCount() == 1) { + anObj = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + if (aResult) { + if (anObj->_is_nil()) { + aResult = Standard_False; + } else { + mySelName[aCurrFocus]->setText(GEOMBase::GetName(anObj)); + } + } else { + anObj = GEOM::GEOM_Object::_nil(); + } + } + + if (aCurrFocus == Vertex1 || aCurrFocus == Edge12 || aCurrFocus == Edge14) { + myShape1 = anObj; + } else if (aCurrFocus == Vertex2 || aCurrFocus == Edge22 || aCurrFocus == Edge24) { + myShape2 = anObj; + } else if (aCurrFocus == Vertex3 || aCurrFocus == Edge34) { + myShape3 = anObj; + } else if (aCurrFocus == Vertex4 || aCurrFocus == Edge44) { + myShape4 = anObj; + } else { + return; + } + + displayPreview(); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument() +{ + QPushButton* aSender = (QPushButton*)sender(); + + QMap::iterator anIter; + for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) { + if (anIter.data() == aSender) { + mySelName[anIter.key()]->setFocus(); + myEditCurrentArgument = mySelName[anIter.key()]; + } + } + + activateSelection(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + activateSelection(); + displayPreview(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::enterEvent (QEvent* e) +{ + if (!GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +//void BlocksGUI_QuadFaceDlg::DeactivateActiveDialog() +//{ +// // disconnect selection +// GEOMBase_Skeleton::DeactivateActiveDialog(); +//} + +//================================================================================= +// function : createSelWg() +// purpose : +//================================================================================= +void BlocksGUI_QuadFaceDlg::createSelWg (const QString& theLbl, + QPixmap& thePix, + QWidget* theParent, + const int theId) +{ + new QLabel(theLbl, theParent); + mySelBtn[theId] = new QPushButton(theParent); + mySelBtn[theId]->setPixmap(thePix); + mySelName[theId] = new QLineEdit(theParent); + mySelName[theId]->setReadOnly(true); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void BlocksGUI_QuadFaceDlg::activateSelection() +{ + if (myEditCurrentArgument == mySelName[Vertex1] || + myEditCurrentArgument == mySelName[Vertex2] || + myEditCurrentArgument == mySelName[Vertex3] || + myEditCurrentArgument == mySelName[Vertex4]) { + + globalSelection(GEOM_POINT); + + } else { + globalSelection(GEOM_EDGE); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BlocksGUI_QuadFaceDlg::createOperation() +{ + return getGeomEngine()->GetIBlocksOperations(getStudyId()); +} + +//================================================================================= +// function : isValid +// purpose : Verify validity of input data +//================================================================================= +bool BlocksGUI_QuadFaceDlg::isValid (QString&) +{ + switch (getConstructorId()) { + case 0: + return (!myShape1->_is_nil() && !myShape2->_is_nil() && + !myShape3->_is_nil() && !myShape4->_is_nil()); + case 1: + return (!myShape1->_is_nil() && !myShape2->_is_nil()); + case 2: + return (!myShape1->_is_nil() && !myShape2->_is_nil() && + !myShape3->_is_nil() && !myShape4->_is_nil()); + default: + return false; + } + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch (getConstructorId()) { + case 0: + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad4Vertices + (myShape1, myShape2, myShape3, myShape4); + res = true; + break; + case 1: + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad2Edges + (myShape1, myShape2); + res = true; + break; + case 2: + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeQuad + (myShape1, myShape2, myShape3, myShape4); + res = true; + break; + default: + break; + } + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx new file mode 100644 index 000000000..b58b8c62d --- /dev/null +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -0,0 +1,520 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BlocksGUI_TrsfDlg.cxx +// Author : Julia DOROVSKIKH +// Module : GEOM +// $Header$ + +#include "BlocksGUI_TrsfDlg.h" + +#include "DlgRef_SpinBox.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" + +#include + +#include + +//================================================================================= +// class : BlocksGUI_TrsfDlg() +// purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'. +//================================================================================= +BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg (QWidget* parent, + bool modal) + : GEOMBase_Skeleton(parent, "TrsfDlg", modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_SIMPLE"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_DOUBLE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BLOCK_MULTITRSF_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BLOCK_MULTITRSF")); + + RadioButton1->setPixmap(image1); + RadioButton2->setPixmap(image2); + RadioButton3->close(TRUE); + + // Create first group + myGrp1 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_SIMPLE"), this); + + QGroupBox* aSelGrp1 = new QGroupBox(3, Qt::Horizontal, myGrp1); + aSelGrp1->setFrameStyle(QFrame::NoFrame); + aSelGrp1->setInsideMargin(0); + + createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp1, MainObj1); + createSelWg(tr("FACE_1"), imageS, aSelGrp1, Face1); + createSelWg(tr("FACE_2"), imageS, aSelGrp1, Face2); + + QGroupBox* aSpinGrp1 = new QGroupBox(1, Qt::Vertical, myGrp1); + aSpinGrp1->setFrameStyle(QFrame::NoFrame); + aSpinGrp1->setInsideMargin(0); + + new QLabel(tr("GEOM_NB_TIMES"), aSpinGrp1); + mySpinBox[SpinBox1] = new DlgRef_SpinBox(aSpinGrp1); + + // Create second group + myGrp2 = new QGroupBox(1, Qt::Horizontal, tr("GEOM_BLOCK_MULTITRSF_DOUBLE"), this); + + // U trsf + QGroupBox* aSelGrp2U = new QGroupBox(3, Qt::Horizontal, myGrp2); + aSelGrp2U->setFrameStyle(QFrame::NoFrame); + aSelGrp2U->setInsideMargin(0); + + createSelWg(tr("GEOM_MAIN_OBJECT"), imageS, aSelGrp2U, MainObj2); + createSelWg(tr("FACE_1U"), imageS, aSelGrp2U, Face1U); + createSelWg(tr("FACE_2U"), imageS, aSelGrp2U, Face2U); + + QGroupBox* aSpinGrp2U = new QGroupBox(1, Qt::Vertical, myGrp2); + aSpinGrp2U->setFrameStyle(QFrame::NoFrame); + aSpinGrp2U->setInsideMargin(0); + + new QLabel(tr("GEOM_NB_TIMES_U"), aSpinGrp2U); + mySpinBox[SpinBox2U] = new DlgRef_SpinBox(aSpinGrp2U); + + // V trsf + QGroupBox* aSelGrp2V = new QGroupBox(3, Qt::Horizontal, myGrp2); + aSelGrp2V->setFrameStyle(QFrame::NoFrame); + aSelGrp2V->setInsideMargin(0); + + createSelWg(tr("FACE_1V"), imageS, aSelGrp2V, Face1V); + createSelWg(tr("FACE_2V"), imageS, aSelGrp2V, Face2V); + + QGroupBox* aSpinGrp2V = new QGroupBox(1, Qt::Vertical, myGrp2); + aSpinGrp2V->setFrameStyle(QFrame::NoFrame); + aSpinGrp2V->setInsideMargin(0); + + new QLabel(tr("GEOM_NB_TIMES_V"), aSpinGrp2V); + mySpinBox[SpinBox2V] = new DlgRef_SpinBox(aSpinGrp2V); + + (new QLabel(myGrp2))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + + // Add groups to layout + Layout1->addWidget( myGrp1, 2, 0 ); + Layout1->addWidget( myGrp2, 2, 0 ); + /***************************************************************/ + + Init(); +} + +//================================================================================= +// function : ~BlocksGUI_TrsfDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BlocksGUI_TrsfDlg::~BlocksGUI_TrsfDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::Init() +{ + // Set range of spinboxes + double SpecificStep = 1.0; + QMap::iterator anIter; + for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { + anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + } + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + QMap::iterator anIterBtn; + for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) + connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + QMap::iterator anIterSpin; + for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) + connect(anIterSpin.data(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + // init controls and fields + initName(tr("GEOM_BLOCK_MULTITRSF")); + + myConstructorId = -1; + ConstructorsClicked(0); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BlocksGUI_TrsfDlg::ConstructorsClicked (int constructorId) +{ + if (myConstructorId == constructorId) + return; + + myConstructorId = constructorId; + + switch (constructorId) { + case 0: + myGrp2->hide(); + myGrp1->show(); + mySpinBox[SpinBox1]->SetValue(2.0); + myEditCurrentArgument = mySelName[MainObj1]; + myFaces[Face1] = -1; + myFaces[Face2] = -1; + break; + case 1: + myGrp1->hide(); + myGrp2->show(); + mySpinBox[SpinBox2U]->SetValue(2.0); + mySpinBox[SpinBox2V]->SetValue(2.0); + myEditCurrentArgument = mySelName[MainObj2]; + myFaces[Face1U] = -1; + myFaces[Face2U] = -1; + myFaces[Face1V] = -1; + myFaces[Face2V] = -1; + break; + default: + break; + } + + // clear line edits + QMap::iterator anIterLE; + for (anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE) + anIterLE.data()->setText(""); + + // init fields + myShape = GEOM::GEOM_Object::_nil(); + + activateSelection(); +// enableWidgets(); +// displayPreview(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::ClickOnOk() +{ + if (ClickOnApply()) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BlocksGUI_TrsfDlg::ClickOnApply() +{ + if (!onAccept()) + return false; + + initName(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BlocksGUI_TrsfDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + // Get index of current selection focus + int aCurrFocus = -1; + QMap::iterator anIter; + for (anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter) { + if (myEditCurrentArgument == anIter.data()) { + aCurrFocus = anIter.key(); + break; + } + } + + // If selection of main object is activated + if (aCurrFocus == MainObj1 || aCurrFocus == MainObj2) { + if (IObjectCount() == 1) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + + if (aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + myShape = anObj; + mySelName[aCurrFocus]->setText(GEOMBase::GetName(anObj)); + enableWidgets(); + return; + } + } + + myShape = GEOM::GEOM_Object::_nil(); + enableWidgets(); + } + // If face selection is activated + else if (aCurrFocus == Face1 || aCurrFocus == Face2 || + aCurrFocus == Face1U || aCurrFocus == Face2U || + aCurrFocus == Face1V || aCurrFocus == Face2V) { + if (IObjectCount() == 1) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); + + if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + TColStd_IndexedMapOfInteger anIndexes; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + + if (anIndexes.Extent() == 1) { + int anIndex = anIndexes(1); + QString aFaceName = QString(GEOMBase::GetName(anObj)) + ":%1"; + myEditCurrentArgument->setText(aFaceName.arg(anIndex)); + myFaces[aCurrFocus] = anIndex; + displayPreview(); + return; + } + } + } + + myFaces[aCurrFocus] = -1; + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::SetEditCurrentArgument() +{ + QPushButton* aSender = (QPushButton*)sender(); + + QMap::iterator anIter; + for (anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter) { + if (anIter.data() == aSender) { + mySelName[anIter.key()]->setFocus(); + myEditCurrentArgument = mySelName[anIter.key()]; + break; + } + } + + activateSelection(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + activateSelection(); + displayPreview(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::enterEvent (QEvent* e) +{ + if (!GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +//void BlocksGUI_TrsfDlg::DeactivateActiveDialog() +//{ +// // disconnect selection +// GEOMBase_Skeleton::DeactivateActiveDialog(); +//} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::ValueChangedInSpinBox (double newValue) +{ + displayPreview(); +} + +//================================================================================= +// function : createSelWg() +// purpose : +//================================================================================= +void BlocksGUI_TrsfDlg::createSelWg (const QString& theLbl, + QPixmap& thePix, + QWidget* theParent, + const int theId) +{ + new QLabel(theLbl, theParent); + mySelBtn[theId] = new QPushButton(theParent); + mySelBtn[theId]->setPixmap(thePix); + mySelName[theId] = new QLineEdit(theParent); + mySelName[theId]->setReadOnly(true); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void BlocksGUI_TrsfDlg::activateSelection() +{ + if (!myShape->_is_nil() && + (myEditCurrentArgument == mySelName[ Face1 ] || + myEditCurrentArgument == mySelName[ Face2 ] || + myEditCurrentArgument == mySelName[ Face1U ] || + myEditCurrentArgument == mySelName[ Face2U ] || + myEditCurrentArgument == mySelName[ Face1V ] || + myEditCurrentArgument == mySelName[ Face2V ])) { + + // Local selection is available only in the OCC Viewer + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + == OCCViewer_Viewer::Type()) { + localSelection(myShape, TopAbs_FACE); + } else { + return; + } + } else { + globalSelection( GEOM_ALLSHAPES ); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : enableWidgets +// purpose : Enable widgets of faces in accordance with value of main object +//================================================================================= +void BlocksGUI_TrsfDlg::enableWidgets() +{ + int anId = getConstructorId(); + + bool toEnable = !myShape->_is_nil(); + + if (anId == 0) { + mySelName[Face1]->setEnabled(toEnable); + mySelName[Face2]->setEnabled(toEnable); + mySelBtn[Face1]->setEnabled(toEnable); + mySelBtn[Face2]->setEnabled(toEnable); + + if (!toEnable) { + mySelName[Face1]->setText(""); + mySelName[Face2]->setText(""); + myFaces[Face1] = -1; + myFaces[Face2] = -1; + } + } else if (anId == 1) { + mySelName[Face1U]->setEnabled(toEnable); + mySelName[Face2U]->setEnabled(toEnable); + mySelName[Face1V]->setEnabled(toEnable); + mySelName[Face2V]->setEnabled(toEnable); + mySelBtn[Face1U]->setEnabled(toEnable); + mySelBtn[Face2U]->setEnabled(toEnable); + mySelBtn[Face1V]->setEnabled(toEnable); + mySelBtn[Face2V]->setEnabled(toEnable); + + if (!toEnable) { + mySelName[Face1U]->setText(""); + mySelName[Face2U]->setText(""); + mySelName[Face1V]->setText(""); + mySelName[Face2V]->setText(""); + myFaces[Face1U] = -1; + myFaces[Face2U] = -1; + myFaces[Face1V] = -1; + myFaces[Face2V] = -1; + } + } +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation() +{ + return getGeomEngine()->GetIBlocksOperations(getStudyId()); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : Verify validity of input data +//================================================================================= +bool BlocksGUI_TrsfDlg::isValid (QString&) +{ + switch (getConstructorId()) { + case 0: + return !myShape->_is_nil() && myFaces[Face1] > 0; + case 1: + return !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0; + default: + return false; + } + return false; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch (getConstructorId()) { + case 0: + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeMultiTransformation1D + (myShape, + myFaces[Face1], + myFaces[Face2], + (int)mySpinBox[SpinBox1]->GetValue()); + res = true; + break; + case 1: + anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->MakeMultiTransformation2D + (myShape, + myFaces[Face1U], + myFaces[Face2U], + (int)mySpinBox[SpinBox2U]->GetValue(), + myFaces[Face1V], + myFaces[Face2V], + (int)mySpinBox[SpinBox2V]->GetValue()); + res = true; + break; + } + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); + + return res; +} diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx new file mode 100644 index 000000000..c1e4e6d5d --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -0,0 +1,289 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BooleanGUI_Dialog.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BooleanGUI_Dialog.h" +#include "BooleanGUI.h" +#include "DlgRef_2Sel_QTD.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +using namespace std; + +//================================================================================= +// class : BooleanGUI_Dialog() +// purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl), + myOperation( theOperation ) +{ + QPixmap image0; + QString aTitle, aCaption; + switch ( myOperation ) + { + case BooleanGUI::COMMON: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_COMMON"))); + aTitle = tr("GEOM_COMMON"); + aCaption = tr("GEOM_COMMON_TITLE"); + break; + case BooleanGUI::CUT: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CUT"))); + aTitle = tr("GEOM_CUT"); + aCaption = tr("GEOM_CUT_TITLE"); + break; + case BooleanGUI::FUSE: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); + aTitle = tr("GEOM_FUSE"); + aCaption = tr("GEOM_FUSE_TITLE"); + break; + case BooleanGUI::SECTION: + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SECTION"))); + aTitle = tr("GEOM_SECTION"); + aCaption = tr("GEOM_SECTION_TITLE"); + break; + } + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption( aCaption ); + + /***************************************************************/ + GroupConstructors->setTitle( aTitle ); + RadioButton1->setPixmap( image0 ); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + myGroup = new DlgRef_2Sel_QTD(this, "GroupCommon"); + myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + if ( myOperation != BooleanGUI::CUT ) + { + myGroup->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + myGroup->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + } + else + { + myGroup->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + myGroup->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); + } + + myGroup->PushButton1->setPixmap(image1); + myGroup->PushButton2->setPixmap(image1); + myGroup->LineEdit1->setReadOnly( true ); + myGroup->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(myGroup, 2, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); +} + + +//================================================================================= +// function : ~BooleanGUI_Dialog() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BooleanGUI_Dialog::~BooleanGUI_Dialog() +{ +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BooleanGUI_Dialog::Init() +{ + /* init variables */ + myEditCurrentArgument = myGroup->LineEdit1; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( GroupConstructors->title() ); + + globalSelection( GEOM_ALLSHAPES ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BooleanGUI_Dialog::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BooleanGUI_Dialog::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BooleanGUI_Dialog::SelectionIntoArgument() +{ + myEditCurrentArgument->setText( "" ); + + if ( IObjectCount() != 1 ) + { + if ( myEditCurrentArgument == myGroup->LineEdit1 ) myObject1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == myGroup->LineEdit2 ) myObject2 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes && GEOMBase::IsShape( aSelectedObject ) ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + if ( myEditCurrentArgument == myGroup->LineEdit1 ) myObject1 = aSelectedObject; + else if ( myEditCurrentArgument == myGroup->LineEdit2 ) myObject2 = aSelectedObject; + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BooleanGUI_Dialog::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == myGroup->PushButton1 ) myEditCurrentArgument = myGroup->LineEdit1; + else if ( send == myGroup->PushButton2 ) myEditCurrentArgument = myGroup->LineEdit2; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BooleanGUI_Dialog::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == myGroup->LineEdit1 || send == myGroup->LineEdit2 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BooleanGUI_Dialog::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void BooleanGUI_Dialog::enterEvent(QEvent * e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation() +{ + return getGeomEngine()->GetIBooleanOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BooleanGUI_Dialog::isValid( QString& msg ) +{ + return !CORBA::is_nil( myObject1 ) && !CORBA::is_nil( myObject2 ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BooleanGUI_Dialog::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->MakeBoolean( myObject1, myObject2, myOperation ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx new file mode 100644 index 000000000..d993cbbe0 --- /dev/null +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -0,0 +1,227 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_CompoundDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BuildGUI_CompoundDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +//================================================================================= +// class : BuildGUI_CompoundDlg() +// purpose : Constructs a BuildGUI_CompoundDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_COMPOUND"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_COMPOUND_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_COMPOUND")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupShapes = new DlgRef_1Sel_QTD(this, "GroupShapes"); + GroupShapes->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupShapes->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupShapes->PushButton1->setPixmap(image1); + GroupShapes->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupShapes, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_CompoundDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_CompoundDlg::~BuildGUI_CompoundDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupShapes->LineEdit1; + GroupShapes->LineEdit1->setReadOnly( true ); + + myOkShapes = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupShapes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + globalSelection( GEOM_ALLSHAPES ); + + initName( tr( "GEOM_COMPOUND" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_CompoundDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_CompoundDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText( "" ); + QString aString = ""; /* name of selection */ + + myOkShapes = false; + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); + if ( nbSel == 0 ) + return; + if ( nbSel != 1 ) + aString = QString( "%1_objects").arg( nbSel ); + + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myShapes, true ); + myEditCurrentArgument->setText( aString ); + myOkShapes = true; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if (send != GroupShapes->PushButton1) + return; + + myEditCurrentArgument = GroupShapes->LineEdit1; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_CompoundDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_CompoundDlg::isValid( QString& ) +{ + return myOkShapes; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_CompoundDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->MakeCompound( myShapes ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx new file mode 100644 index 000000000..e43e9e6f9 --- /dev/null +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -0,0 +1,283 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_EdgeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BuildGUI_EdgeDlg.h" + +#include +#include + +#include "utilities.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +//================================================================================= +// class : BuildGUI_EdgeDlg() +// purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_EdgeDlg::BuildGUI_EdgeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_EDGE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_EDGE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_EDGE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_EdgeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myOkPoint1 = myOkPoint2 = false; + + globalSelection( GEOM_POINT ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_EDGE") ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_EdgeDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_EdgeDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if(!testResult) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myPoint1 = aSelectedObject; + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myPoint2 = aSelectedObject; + myOkPoint2 = true; + } + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::SetEditCurrentArgument() +{ + + QPushButton* send = (QPushButton*)sender(); + globalSelection(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_POINT ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + globalSelection( GEOM_POINT ); + displayPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_EdgeDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_EdgeDlg::isValid( QString& ) +{ + return myOkPoint1 && myOkPoint2; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_EdgeDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->MakeEdge( myPoint1, myPoint2 ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx new file mode 100644 index 000000000..f9a5891f2 --- /dev/null +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -0,0 +1,243 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_FaceDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BuildGUI_FaceDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +//Qt includes +#include +#include + +using namespace std; + +//================================================================================= +// class : BuildGUI_FaceDlg() +// purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_FACE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FACE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupWire = new DlgRef_1Sel1Check_QTD(this, "GroupWire"); + GroupWire->GroupBox1->setTitle(tr("GEOM_FACE_FFW")); + GroupWire->TextLabel1->setText(tr("GEOM_WIRES")); + GroupWire->CheckButton1->setText(tr("GEOM_FACE_OPT")); + GroupWire->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupWire, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_FaceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_FaceDlg::~BuildGUI_FaceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupWire->LineEdit1; + GroupWire->LineEdit1->setReadOnly( true ); + + GroupWire->CheckButton1->setChecked(TRUE); + + globalSelection( GEOM_WIRE ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupWire->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupWire->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_FACE")); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_FaceDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_FaceDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + + if(aNbSel < 1) + { + myWires.length(0); + return; + } + + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myWires); + if (!myWires.length()) + return; + if(aNbSel != 1) + aName = tr("%1_wires").arg(aNbSel); + + myEditCurrentArgument->setText( aName ); + + myEditCurrentArgument->setText( aName ); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if (send != GroupWire->PushButton1) + return; + + globalSelection( GEOM_WIRE ); + myEditCurrentArgument = GroupWire->LineEdit1; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + globalSelection( GEOM_WIRE ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_FaceDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_FaceDlg::isValid( QString& ) +{ + return (myWires.length() != 0); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_FaceDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + bool isPlanarWanted = GroupWire->CheckButton1->isChecked(); + anObj = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeFaceWires( myWires, isPlanarWanted ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx new file mode 100644 index 000000000..54fd59132 --- /dev/null +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -0,0 +1,246 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_ShellDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "BuildGUI_ShellDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "TColStd_MapOfInteger.hxx" + +#include + +//================================================================================= +// class : BuildGUI_ShellDlg() +// purpose : Constructs a BuildGUI_ShellDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_ShellDlg::BuildGUI_ShellDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SHELL"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SHELL_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SHELL")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupShell = new DlgRef_1Sel_QTD(this, "GroupShell"); + GroupShell->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupShell->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupShell->PushButton1->setPixmap(image1); + GroupShell->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupShell, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_ShellDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_ShellDlg::~BuildGUI_ShellDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupShell->LineEdit1; + GroupShell->LineEdit1->setReadOnly( true ); + + myOkFacesAndShells = false; + + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_SHELL); + aMap.Add(GEOM_FACE); + globalSelection( aMap ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupShell->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_SHELL")); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_ShellDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_ShellDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText( "" ); + QString aString; + + myOkFacesAndShells = false; + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); + if ( nbSel == 0 ) + return; + if ( nbSel != 1 ) + aString = QString( "%1_objects ").arg( nbSel ); + + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myFacesAndShells, true ); + if ( !myFacesAndShells.length() ) + return; + + myEditCurrentArgument->setText( aString ); + myOkFacesAndShells = true; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if (send != GroupShell->PushButton1) + return; + + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_SHELL); + aMap.Add(GEOM_FACE); + globalSelection( aMap ); + myEditCurrentArgument = GroupShell->LineEdit1; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_SHELL); + aMap.Add(GEOM_FACE); + globalSelection( aMap ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_ShellDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_ShellDlg::isValid( QString& ) +{ + return myOkFacesAndShells; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_ShellDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeShell( myFacesAndShells ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx new file mode 100644 index 000000000..9dbdec0db --- /dev/null +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -0,0 +1,262 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_SolidDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "BuildGUI_SolidDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +//Qt includes +#include +#include + +//================================================================================= +// class : BuildGUI_SolidDlg() +// purpose : Constructs a BuildGUI_SolidDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_SolidDlg::BuildGUI_SolidDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SOLID"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SOLID_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SOLID")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupSolid = new DlgRef_1Sel1Check_QTD(this, "GroupSolid"); + GroupSolid->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupSolid->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupSolid->CheckButton1->setText(tr("GEOM_CREATE_SINGLE_SOLID")); + GroupSolid->PushButton1->setPixmap(image1); + GroupSolid->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupSolid, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_SolidDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_SolidDlg::~BuildGUI_SolidDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupSolid->LineEdit1; + GroupSolid->LineEdit1->setReadOnly( true ); + GroupSolid->CheckButton1->setChecked( true ); + + myOkShells = false; + + globalSelection( GEOM_SHELL ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupSolid->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupSolid->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(EnableNameField(bool))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_SOLID")); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_SolidDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_SolidDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + myOkShells = false; + int nbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aString); + if (nbSel == 0) + return; + if(nbSel != 1) + aString = tr("%1_objects").arg(nbSel); + + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myShells); + if (!myShells.length()) + return; + + myEditCurrentArgument->setText(aString); + myOkShells = true; +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if(send != GroupSolid->PushButton1) + return; + + globalSelection( GEOM_SHELL ); + myEditCurrentArgument = GroupSolid->LineEdit1; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + globalSelection( GEOM_SHELL ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : EnableNameField() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::EnableNameField(bool toEnable) +{ + this->GroupBoxName->setEnabled(toEnable); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_SolidDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_SolidDlg::isValid( QString& ) +{ + return myOkShells; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_SolidDlg::execute( ObjectList& objects ) +{ + bool toCreateSingleSolid = GroupSolid->CheckButton1->isChecked(); + + if ( toCreateSingleSolid ) + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeSolidShells( myShells ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + { + for ( int i = 0, n = myShells.length(); i< n; i++ ) + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeSolidShell( myShells[ i ] ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + } + + return true; +} + diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx new file mode 100644 index 000000000..9775a5cb1 --- /dev/null +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -0,0 +1,245 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_WireDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "BuildGUI_WireDlg.h" +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "TColStd_MapOfInteger.hxx" + +#include + +//================================================================================= +// class : BuildGUI_WireDlg() +// purpose : Constructs a BuildGUI_WireDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_WireDlg::BuildGUI_WireDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_WIRE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_WIRE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_WIRE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_WIRE_CONNECT")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_WireDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_WireDlg::~BuildGUI_WireDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + + myOkEdgesAndWires = false; + + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_WIRE); + aMap.Add(GEOM_EDGE); + globalSelection( aMap ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_WIRE")); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool BuildGUI_WireDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_WireDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + myOkEdgesAndWires = false; + int nbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aString); + + if(nbSel == 0) + return; + if(nbSel != 1) + aString = tr("%1_objects").arg(nbSel); + + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myEdgesAndWires); + if (!myEdgesAndWires.length()) + return; + + myEditCurrentArgument->setText(aString); + myOkEdgesAndWires = true; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + if (send != GroupPoints->PushButton1) + return; + + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_WIRE); + aMap.Add(GEOM_EDGE); + globalSelection( aMap ); + myEditCurrentArgument = GroupPoints->LineEdit1; + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + TColStd_MapOfInteger aMap; + aMap.Add(GEOM_WIRE); + aMap.Add(GEOM_EDGE); + globalSelection( aMap ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr BuildGUI_WireDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool BuildGUI_WireDlg::isValid( QString& ) +{ + return myOkEdgesAndWires; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool BuildGUI_WireDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeWire( myEdgesAndWires ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + diff --git a/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.cxx b/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.cxx new file mode 100644 index 000000000..be2fc4683 --- /dev/null +++ b/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.cxx @@ -0,0 +1,92 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1List1Spin1Btn_QTD.ui' +** +** Created: Wed Mar 17 11:29:24 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1List1Spin1Btn_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1List1Spin1Btn_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1List1Spin1Btn_QTD::DlgRef_1List1Spin1Btn_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1List1Spin1Btn_QTD" ); + resize( 204, 148 ); + setCaption( trUtf8( "DlgRef_3Sel4Spin2Check_QTD" ) ); + DlgRef_1List1Spin1Btn_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "DlgRef_1List1Spin1Btn_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + QSpacerItem* spacer = new QSpacerItem( 0, 23, QSizePolicy::Minimum, QSizePolicy::Expanding ); + GroupBox1Layout->addItem( spacer, 3, 1 ); + + ListView1 = new QListView( GroupBox1, "ListView1" ); + + GroupBox1Layout->addMultiCellWidget( ListView1, 0, 3, 0, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + GroupBox1Layout->addWidget( TextLabel1, 0, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + + GroupBox1Layout->addWidget( SpinBox1, 1, 1 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setText( trUtf8( "" ) ); + + GroupBox1Layout->addWidget( PushButton1, 2, 1 ); + + DlgRef_1List1Spin1Btn_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1List1Spin1Btn_QTD::~DlgRef_1List1Spin1Btn_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.h b/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.h new file mode 100644 index 000000000..4ef73377f --- /dev/null +++ b/src/DlgRef/DlgRef_1List1Spin1Btn_QTD.h @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1List1Spin1Btn_QTD.ui' +** +** Created: Wed Mar 17 11:29:24 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1LIST1SPIN1BTN_QTD_H +#define DLGREF_1LIST1SPIN1BTN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QListView; +class QListViewItem; +class QPushButton; +class QSpinBox; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_1List1Spin1Btn_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1List1Spin1Btn_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1List1Spin1Btn_QTD(); + + QGroupBox* GroupBox1; + QListView* ListView1; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QPushButton* PushButton1; + + +protected: + QGridLayout* DlgRef_1List1Spin1Btn_QTDLayout; + QGridLayout* GroupBox1Layout; +}; + +#endif // DLGREF_1LIST1SPIN1BTN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx new file mode 100644 index 000000000..a23049fb2 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx @@ -0,0 +1,110 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' +** +** Created: lun oct 27 16:18:55 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Check1List_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Check1List_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Check1List_QTD::DlgRef_1Sel1Check1List_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Check1List_QTD" ); + resize( 129, 104 ); + setCaption( trUtf8( "DlgRef_1Sel1Check1List_QTD" ) ); + DlgRef_1Sel1Check1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check1List_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 166, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addMultiCellWidget( TextLabel2, 1, 1, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Check1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Check1List_QTD::~DlgRef_1Sel1Check1List_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h new file mode 100644 index 000000000..9daae866b --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' +** +** Created: lun oct 27 16:18:55 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1CHECK1LIST_QTD_H +#define DLGREF_1SEL1CHECK1LIST_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_1Sel1Check1List_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Check1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Check1List_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckButton1; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QPushButton* PushButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Check1List_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL1CHECK1LIST_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx new file mode 100644 index 000000000..eb0f2cdb3 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx @@ -0,0 +1,102 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui' +** +** Created: Thu May 20 11:55:05 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Check_QTD::DlgRef_1Sel1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Check_QTD" ); + resize( 382, 219 ); + setCaption( trUtf8( "DlgRef_1Sel1Check_QTD" ) ); + DlgRef_1Sel1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout3->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout3->addWidget( PushButton1, 0, 1 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout3->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer, 2, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout3->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + DlgRef_1Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, CheckButton1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Check_QTD::~DlgRef_1Sel1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Check_QTD.h b/src/DlgRef/DlgRef_1Sel1Check_QTD.h new file mode 100644 index 000000000..70189f021 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check_QTD.h @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui' +** +** Created: Thu May 20 11:55:05 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1CHECK_QTD_H +#define DLGREF_1SEL1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_1Sel1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QCheckBox* CheckButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; +}; + +#endif // DLGREF_1SEL1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx new file mode 100644 index 000000000..a92fc99e5 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx @@ -0,0 +1,114 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: Mon May 24 15:59:03 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Spin1Check_QTD::DlgRef_1Sel1Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Spin1Check_QTD" ); + resize( 163, 109 ); + setCaption( trUtf8( "DlgRef_1Sel1Spin1Check_QTD" ) ); + DlgRef_1Sel1Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout8 = new QGridLayout( 0, 1, 1, 0, 6, "Layout8"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + Layout8->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout8->addWidget( TextLabel1, 0, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout8->addWidget( LineEdit1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout8->addWidget( PushButton1, 0, 1 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout8->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout8->addItem( spacer, 3, 2 ); + + GroupBox1Layout->addLayout( Layout8, 0, 0 ); + + DlgRef_1Sel1Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin1Check_QTD::~DlgRef_1Sel1Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h new file mode 100644 index 000000000..1f943faa7 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: Mon May 24 15:59:03 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1SPIN1CHECK_QTD_H +#define DLGREF_1SEL1SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel1Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QCheckBox* CheckButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout8; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL1SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx new file mode 100644 index 000000000..7eae9fbec --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx @@ -0,0 +1,108 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Spin_QTD::DlgRef_1Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Spin_QTD" ); + resize( 129, 87 ); + setCaption( trUtf8( "DlgRef_1Sel1Spin_QTD" ) ); + DlgRef_1Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin_QTD::~DlgRef_1Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.h b/src/DlgRef/DlgRef_1Sel1Spin_QTD.h new file mode 100644 index 000000000..1aa7d9d5d --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.h @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1SPIN_QTD_H +#define DLGREF_1SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_1Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* DlgRef_1Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx new file mode 100644 index 000000000..38d5551f5 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx @@ -0,0 +1,119 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel2Spin_QTD.ui' +** +** Created: jeu oct 2 11:08:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel2Spin_QTD::DlgRef_1Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel2Spin_QTD" ); + resize( 129, 115 ); + setCaption( trUtf8( "DlgRef_1Sel2Spin_QTD" ) ); + DlgRef_1Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 1, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 30, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel2Spin_QTD::~DlgRef_1Sel2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel2Spin_QTD.h b/src/DlgRef/DlgRef_1Sel2Spin_QTD.h new file mode 100644 index 000000000..9a5cbe961 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin_QTD.h @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel2Spin_QTD.ui' +** +** Created: jeu oct 2 11:08:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL2SPIN_QTD_H +#define DLGREF_1SEL2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel2Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QSpinBox* SpinBox2; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Sel2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL2SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx new file mode 100644 index 000000000..854abd297 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx @@ -0,0 +1,114 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: Thu May 20 10:15:08 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel3Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel3Check_QTD::DlgRef_1Sel3Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel3Check_QTD" ); + resize( 163, 116 ); + setCaption( trUtf8( "DlgRef_1Sel3Check_QTD" ) ); + DlgRef_1Sel3Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout6 = new QGridLayout( 0, 1, 1, 0, 6, "Layout6"); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout6->addItem( spacer, 4, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout6->addWidget( LineEdit1, 0, 2 ); + + CheckButton2 = new QCheckBox( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout6->addMultiCellWidget( CheckButton2, 2, 2, 0, 2 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout6->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 ); + + CheckButton3 = new QCheckBox( GroupBox1, "CheckButton3" ); + CheckButton3->setText( trUtf8( "" ) ); + + Layout6->addMultiCellWidget( CheckButton3, 3, 3, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout6->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout6->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout6, 0, 0 ); + + DlgRef_1Sel3Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, CheckButton1 ); + setTabOrder( CheckButton1, CheckButton2 ); + setTabOrder( CheckButton2, CheckButton3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Check_QTD::~DlgRef_1Sel3Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.h b/src/DlgRef/DlgRef_1Sel3Check_QTD.h new file mode 100644 index 000000000..3ea5d09d2 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.h @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: Thu May 20 10:15:07 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL3CHECK_QTD_H +#define DLGREF_1SEL3CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_1Sel3Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel3Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel3Check_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QCheckBox* CheckButton2; + QCheckBox* CheckButton1; + QCheckBox* CheckButton3; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Sel3Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout6; +}; + +#endif // DLGREF_1SEL3CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx new file mode 100644 index 000000000..d08f76765 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx @@ -0,0 +1,130 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' +** +** Created: ven oct 24 15:55:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel3Spin_QTD::DlgRef_1Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel3Spin_QTD" ); + resize( 129, 143 ); + setCaption( trUtf8( "DlgRef_1Sel3Spin_QTD" ) ); + DlgRef_1Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 150, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 1, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 2, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 2, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Spin_QTD::~DlgRef_1Sel3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.h b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h new file mode 100644 index 000000000..a52e1e696 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' +** +** Created: ven oct 24 15:55:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL3SPIN_QTD_H +#define DLGREF_1SEL3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_1Sel3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel3Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel4; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_1Sel3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL3SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx new file mode 100644 index 000000000..735bc811e --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx @@ -0,0 +1,151 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel4Spin_QTD::DlgRef_1Sel4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel4Spin_QTD" ); + resize( 284, 119 ); + setCaption( trUtf8( "DlgRef_1Sel4Spin_QTD" ) ); + DlgRef_1Sel4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel4Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout3->addWidget( TextLabel5, 0, 5 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout3->addWidget( TextLabel3, 0, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout3->addWidget( TextLabel4, 0, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 6 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox1, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout3->addWidget( TextLabel2, 0, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox2, 0, 4 ); + + Layout1->addLayout( Layout3, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout4->addWidget( TextLabel6, 0, 0 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + + Layout4->addWidget( SpinBox4, 0, 1 ); + + Layout1->addLayout( Layout4, 2, 0 ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + Layout2->addWidget( TextLabel1 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( PushButton1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + Layout2->addWidget( LineEdit1 ); + + Layout1->addLayout( Layout2, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel4Spin_QTD::~DlgRef_1Sel4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.h b/src/DlgRef/DlgRef_1Sel4Spin_QTD.h new file mode 100644 index 000000000..60f2a44c2 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.h @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL4SPIN_QTD_H +#define DLGREF_1SEL4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel4Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel5; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QSpinBox* SpinBox2; + QLabel* TextLabel6; + QSpinBox* SpinBox4; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout4; + QHBoxLayout* Layout2; +}; + +#endif // DLGREF_1SEL4SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx new file mode 100644 index 000000000..a37665f71 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx @@ -0,0 +1,152 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel5Spin_QTD.ui' +** +** Created: mar nov 18 11:19:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel5Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel5Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel5Spin_QTD::DlgRef_1Sel5Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel5Spin_QTD" ); + resize( 162, 143 ); + setCaption( trUtf8( "DlgRef_1Sel5Spin_QTD" ) ); + DlgRef_1Sel5Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel5Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 0, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 2, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 2, 0 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox4, 1, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout2->addWidget( TextLabel6, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + SpinBox5 = new QSpinBox( GroupBox1, "SpinBox5" ); + SpinBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox5->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox5, 1, 3 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 120, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel5Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel5Spin_QTD::~DlgRef_1Sel5Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel5Spin_QTD.h b/src/DlgRef/DlgRef_1Sel5Spin_QTD.h new file mode 100644 index 000000000..a7a35a866 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin_QTD.h @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel5Spin_QTD.ui' +** +** Created: mar nov 18 11:19:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL5SPIN_QTD_H +#define DLGREF_1SEL5SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel5Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel5Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel5Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QSpinBox* SpinBox2; + QSpinBox* SpinBox3; + QLabel* TextLabel5; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox4; + QSpinBox* SpinBox1; + QLabel* TextLabel6; + QLabel* TextLabel2; + QSpinBox* SpinBox5; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel5Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL5SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel_Ext.h b/src/DlgRef/DlgRef_1Sel_Ext.h new file mode 100644 index 000000000..138227aa6 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel_Ext.h @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DlgRef_1Sel_Ext_H +#define DlgRef_1Sel_Ext_H + +#include "DlgRef_1Sel_QTD.h" + +class QGridLayout; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_1Sel_Ext : public DlgRef_1Sel_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel_Ext( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ) + : DlgRef_1Sel_QTD( parent, name, fl ) {}; + ~DlgRef_1Sel_Ext() {}; + + QGridLayout* getGroupBoxLayout() { return GroupBox1Layout; } +}; + +#endif // DlgRef_1Sel_Ext_H diff --git a/src/DlgRef/DlgRef_1Sel_QTD.cxx b/src/DlgRef/DlgRef_1Sel_QTD.cxx new file mode 100644 index 000000000..730efcc15 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel_QTD.cxx @@ -0,0 +1,93 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:06 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel_QTD::DlgRef_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel_QTD" ); + resize( 129, 57 ); + setCaption( trUtf8( "DlgRef_1Sel_QTD" ) ); + DlgRef_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel_QTD::~DlgRef_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel_QTD.h b/src/DlgRef/DlgRef_1Sel_QTD.h new file mode 100644 index 000000000..55587c0a5 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel_QTD.h @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL_QTD_H +#define DLGREF_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL_QTD_H diff --git a/src/DlgRef/DlgRef_1Spin_QTD.cxx b/src/DlgRef/DlgRef_1Spin_QTD.cxx new file mode 100644 index 000000000..e01489a12 --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin_QTD.cxx @@ -0,0 +1,87 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Spin_QTD.ui' +** +** Created: jeu sep 25 12:22:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Spin_QTD::DlgRef_1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Spin_QTD" ); + resize( 124, 55 ); + setCaption( trUtf8( "DlgRef_1Spin_QTD" ) ); + DlgRef_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Spin_QTD::~DlgRef_1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Spin_QTD.h b/src/DlgRef/DlgRef_1Spin_QTD.h new file mode 100644 index 000000000..f50d92bc9 --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin_QTD.h @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Spin_QTD.ui' +** +** Created: jeu sep 25 12:22:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SPIN_QTD_H +#define DLGREF_1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.cxx new file mode 100644 index 000000000..f67e3e07f --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.cxx @@ -0,0 +1,139 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel1Spin2Check_QTD.ui' +** +** Created: Fri Aug 13 15:32:26 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel1Spin2Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin2Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel1Spin2Check_QTD::DlgRef_2Sel1Spin2Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1Spin2Check_QTD" ); + resize( 256, 139 ); + setCaption( trUtf8( "DlgRef_2Sel1Spin2Check_QTD" ) ); + DlgRef_2Sel1Spin2Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1Spin2Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 316, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 2 ); + + CheckButton2 = new QCheckBox( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( CheckButton2, 2, 3 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addMultiCellWidget( LineEdit2, 1, 1, 2, 3 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addMultiCellWidget( LineEdit1, 0, 0, 2, 3 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 3, 3, 0, 3 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 2, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1Spin2Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, SpinBox1 ); + setTabOrder( SpinBox1, CheckButton2 ); + setTabOrder( CheckButton2, CheckButton1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin2Check_QTD::~DlgRef_2Sel1Spin2Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.h b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.h new file mode 100644 index 000000000..d57b10531 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.h @@ -0,0 +1,70 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel1Spin2Check_QTD.ui' +** +** Created: Fri Aug 13 15:32:26 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL1SPIN2CHECK_QTD_H +#define DLGREF_2SEL1SPIN2CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel1Spin2Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin2Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1Spin2Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel2; + QPushButton* PushButton1; + QLabel* TextLabel3; + QLabel* TextLabel1; + QCheckBox* CheckButton2; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QLineEdit* LineEdit1; + QCheckBox* CheckButton1; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* DlgRef_2Sel1Spin2Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SEL1SPIN2CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx new file mode 100644 index 000000000..5e03c2747 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx @@ -0,0 +1,132 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel1Spin_QTD.ui' +** +** Created: Tue Jun 1 16:15:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel1Spin_QTD::DlgRef_2Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1Spin_QTD" ); + resize( 163, 122 ); + setCaption( trUtf8( "DlgRef_2Sel1Spin_QTD" ) ); + DlgRef_2Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setFrameShape( QLabel::NoFrame ); + TextLabel2->setFrameShadow( QLabel::Plain ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, SpinBox1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin_QTD::~DlgRef_2Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1Spin_QTD.h b/src/DlgRef/DlgRef_2Sel1Spin_QTD.h new file mode 100644 index 000000000..df9ec8e3e --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin_QTD.h @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel1Spin_QTD.ui' +** +** Created: Tue Jun 1 16:14:59 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL1SPIN_QTD_H +#define DLGREF_2SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_2Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_2Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx new file mode 100644 index 000000000..3091cdf4b --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx @@ -0,0 +1,149 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel2Spin1Check_QTD.ui' +** +** Created: Tue Jun 1 16:29:28 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel2Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel2Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel2Spin1Check_QTD::DlgRef_2Sel2Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel2Spin1Check_QTD" ); + resize( 163, 170 ); + setCaption( trUtf8( "DlgRef_2Sel2Spin1Check_QTD" ) ); + DlgRef_2Sel2Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel2Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 2 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 3, 3, 0, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel2Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); + setTabOrder( SpinBox2, CheckButton1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin1Check_QTD::~DlgRef_2Sel2Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h new file mode 100644 index 000000000..2cf259170 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel2Spin1Check_QTD.ui' +** +** Created: Tue Jun 1 16:29:28 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL2SPIN1CHECK_QTD_H +#define DLGREF_2SEL2SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel2Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel2Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox2; + QLineEdit* LineEdit1; + QCheckBox* CheckButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QPushButton* PushButton1; + + +protected: + QGridLayout* DlgRef_2Sel2Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL2SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx new file mode 100644 index 000000000..2e18f0411 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx @@ -0,0 +1,135 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel2Spin_QTD::DlgRef_2Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel2Spin_QTD" ); + resize( 129, 145 ); + setCaption( trUtf8( "DlgRef_2Sel2Spin_QTD" ) ); + DlgRef_2Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin_QTD::~DlgRef_2Sel2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel2Spin_QTD.h b/src/DlgRef/DlgRef_2Sel2Spin_QTD.h new file mode 100644 index 000000000..5dbea6b93 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin_QTD.h @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL2SPIN_QTD_H +#define DLGREF_2SEL2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_2Sel2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel2Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QPushButton* PushButton2; + QLabel* TextLabel2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + + +protected: + QGridLayout* DlgRef_2Sel2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL2SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx new file mode 100644 index 000000000..a931f602b --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx @@ -0,0 +1,146 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel3Spin_QTD.ui' +** +** Created: jeu sep 25 16:18:43 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel3Spin_QTD::DlgRef_2Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel3Spin_QTD" ); + resize( 129, 173 ); + setCaption( trUtf8( "DlgRef_2Sel3Spin_QTD" ) ); + DlgRef_2Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel5, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 2, 1 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel3Spin_QTD::~DlgRef_2Sel3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel3Spin_QTD.h b/src/DlgRef/DlgRef_2Sel3Spin_QTD.h new file mode 100644 index 000000000..97f47417a --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin_QTD.h @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel3Spin_QTD.ui' +** +** Created: jeu sep 25 16:18:43 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL3SPIN_QTD_H +#define DLGREF_2SEL3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_2Sel3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel3Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLabel* TextLabel5; + QSpinBox* SpinBox1; + QSpinBox* SpinBox3; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + + +protected: + QGridLayout* DlgRef_2Sel3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL3SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx new file mode 100644 index 000000000..8449ee1bd --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx @@ -0,0 +1,177 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel4Spin1Check_QTD.ui' +** +** Created: Tue Jun 1 12:38:04 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel4Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel4Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel4Spin1Check_QTD::DlgRef_2Sel4Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel4Spin1Check_QTD" ); + resize( 262, 230 ); + setCaption( trUtf8( "DlgRef_2Sel4Spin1Check_QTD" ) ); + DlgRef_2Sel4Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel4Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout5 = new QGridLayout( 0, 1, 1, 0, 6, "Layout5"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout5->addWidget( PushButton1, 0, 1 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout5->addMultiCellWidget( CheckButton1, 3, 3, 0, 3 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + Layout5->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout5->addWidget( LineEdit2, 1, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout5->addWidget( TextLabel1, 0, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout5->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout5->addItem( spacer, 5, 3 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout5->addWidget( PushButton2, 1, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout5->addWidget( TextLabel2, 1, 0 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox4, 1, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout3->addWidget( TextLabel5, 0, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout3->addWidget( TextLabel6, 1, 0 ); + + Layout5->addMultiCellLayout( Layout3, 4, 4, 0, 2 ); + + GroupBox1Layout->addLayout( Layout5, 0, 0 ); + + DlgRef_2Sel4Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); + setTabOrder( SpinBox2, CheckButton1 ); + setTabOrder( CheckButton1, SpinBox3 ); + setTabOrder( SpinBox3, SpinBox4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel4Spin1Check_QTD::~DlgRef_2Sel4Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h new file mode 100644 index 000000000..585708b58 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h @@ -0,0 +1,77 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel4Spin1Check_QTD.ui' +** +** Created: Tue Jun 1 12:38:04 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL4SPIN1CHECK_QTD_H +#define DLGREF_2SEL4SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel4Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel4Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel4Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QCheckBox* CheckButton1; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLineEdit* LineEdit2; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + QLabel* TextLabel2; + QSpinBox* SpinBox4; + QLabel* TextLabel5; + QSpinBox* SpinBox3; + QLabel* TextLabel6; + + +protected: + QGridLayout* DlgRef_2Sel4Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout5; + QGridLayout* Layout2; + QGridLayout* Layout3; +}; + +#endif // DLGREF_2SEL4SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel_QTD.cxx b/src/DlgRef/DlgRef_2Sel_QTD.cxx new file mode 100644 index 000000000..62f352171 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel_QTD.cxx @@ -0,0 +1,109 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel_QTD::DlgRef_2Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel_QTD" ); + resize( 129, 87 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_2Sel_QTD" ) ); + DlgRef_2Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel_QTD::~DlgRef_2Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel_QTD.h b/src/DlgRef/DlgRef_2Sel_QTD.h new file mode 100644 index 000000000..70ad2b2f9 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel_QTD.h @@ -0,0 +1,70 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL_QTD_H +#define DLGREF_2SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_2Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_2Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SEL_QTD_H diff --git a/src/DlgRef/DlgRef_2Spin_QTD.cxx b/src/DlgRef/DlgRef_2Spin_QTD.cxx new file mode 100644 index 000000000..31f468010 --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin_QTD.cxx @@ -0,0 +1,98 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:30 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Spin_QTD::DlgRef_2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Spin_QTD" ); + resize( 124, 83 ); + setCaption( trUtf8( "DlgRef_2Spin_QTD" ) ); + DlgRef_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Spin_QTD::~DlgRef_2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Spin_QTD.h b/src/DlgRef/DlgRef_2Spin_QTD.h new file mode 100644 index 000000000..8c2acbab9 --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin_QTD.h @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:30 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SPIN_QTD_H +#define DLGREF_2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox2; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_3Check_QTD.cxx b/src/DlgRef/DlgRef_3Check_QTD.cxx new file mode 100644 index 000000000..30dc8c1e5 --- /dev/null +++ b/src/DlgRef/DlgRef_3Check_QTD.cxx @@ -0,0 +1,94 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Check_QTD.ui' +** +** Created: Tue Aug 24 11:27:47 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Check_QTD::DlgRef_3Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Check_QTD" ); + resize( 135, 108 ); + setCaption( trUtf8( "DlgRef_3Check_QTD" ) ); + DlgRef_3Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Check_QTDLayout"); + + GroupBox1 = new QButtonGroup( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RadioButton3 = new QRadioButton( GroupBox1, "RadioButton3" ); + RadioButton3->setText( trUtf8( "RadioButton3" ) ); + + Layout1->addWidget( RadioButton3, 2, 0 ); + + RadioButton1 = new QRadioButton( GroupBox1, "RadioButton1" ); + RadioButton1->setText( trUtf8( "RadioButton1" ) ); + + Layout1->addWidget( RadioButton1, 0, 0 ); + + RadioButton2 = new QRadioButton( GroupBox1, "RadioButton2" ); + RadioButton2->setText( trUtf8( "RadioButton2" ) ); + + Layout1->addWidget( RadioButton2, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 91, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( RadioButton1, RadioButton2 ); + setTabOrder( RadioButton2, RadioButton3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Check_QTD::~DlgRef_3Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Check_QTD.h b/src/DlgRef/DlgRef_3Check_QTD.h new file mode 100644 index 000000000..d843073c6 --- /dev/null +++ b/src/DlgRef/DlgRef_3Check_QTD.h @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Check_QTD.ui' +** +** Created: Tue Aug 24 11:27:47 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3CHECK_QTD_H +#define DLGREF_3CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_3Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Check_QTD(); + + QButtonGroup* GroupBox1; + QRadioButton* RadioButton3; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + + +protected: + QGridLayout* DlgRef_3Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.cxx new file mode 100644 index 000000000..45d83b358 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.cxx @@ -0,0 +1,177 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel3Spin1Check_QTD.ui' +** +** Created: Mon Apr 19 16:36:48 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Sel3Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel3Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel3Spin1Check_QTD::DlgRef_3Sel3Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel3Spin1Check_QTD" ); + resize( 380, 229 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_3Sel3Spin1Check_QTD" ) ); + DlgRef_3Sel3Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel3Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox_2 = new QSpinBox( GroupBox1, "SpinBox_2" ); + SpinBox_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox_2, 4, 2 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 2, 2 ); + + SpinBox_3 = new QSpinBox( GroupBox1, "SpinBox_3" ); + SpinBox_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox_3, 5, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + CheckBox1 = new QCheckBox( GroupBox1, "CheckBox1" ); + CheckBox1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckBox1, 6, 6, 0, 1 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout1->addWidget( TextLabel4, 3, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 2, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout1->addWidget( TextLabel6, 5, 0 ); + + SpinBox_1 = new QSpinBox( GroupBox1, "SpinBox_1" ); + SpinBox_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox_1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox_1, 3, 2 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout1->addWidget( TextLabel5, 4, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 250, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 7, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Sel3Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, PushButton3 ); + setTabOrder( PushButton3, LineEdit3 ); + setTabOrder( LineEdit3, SpinBox_1 ); + setTabOrder( SpinBox_1, SpinBox_2 ); + setTabOrder( SpinBox_2, SpinBox_3 ); + setTabOrder( SpinBox_3, CheckBox1 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel3Spin1Check_QTD::~DlgRef_3Sel3Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.h b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.h new file mode 100644 index 000000000..553f90840 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel3Spin1Check_QTD.h @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel3Spin1Check_QTD.ui' +** +** Created: Mon Apr 19 16:36:48 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SEL3SPIN1CHECK_QTD_H +#define DLGREF_3SEL3SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_3Sel3Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel3Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel3Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox_2; + QLineEdit* LineEdit3; + QSpinBox* SpinBox_3; + QLabel* TextLabel1; + QLabel* TextLabel3; + QCheckBox* CheckBox1; + QPushButton* PushButton1; + QLabel* TextLabel4; + QLineEdit* LineEdit2; + QPushButton* PushButton3; + QLabel* TextLabel6; + QSpinBox* SpinBox_1; + QLabel* TextLabel5; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + + +protected: + QGridLayout* DlgRef_3Sel3Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SEL3SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx new file mode 100644 index 000000000..e32b155cb --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx @@ -0,0 +1,201 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel4Spin2Check_QTD.ui' +** +** Created: Tue Jun 1 16:29:29 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Sel4Spin2Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel4Spin2Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel4Spin2Check_QTD::DlgRef_3Sel4Spin2Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel4Spin2Check_QTD" ); + resize( 269, 281 ); + setCaption( trUtf8( "DlgRef_3Sel4Spin2Check_QTD" ) ); + DlgRef_3Sel4Spin2Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel4Spin2Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + CheckButton2 = new QCheckBox( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton2, 6, 6, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 2, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox4, 1, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 1 ); + + TextLabel7 = new QLabel( GroupBox1, "TextLabel7" ); + TextLabel7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel7->sizePolicy().hasHeightForWidth() ) ); + TextLabel7->setText( trUtf8( "TL7" ) ); + + Layout3->addWidget( TextLabel7, 1, 0 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout3->addWidget( TextLabel6, 0, 0 ); + + Layout1->addMultiCellLayout( Layout3, 5, 5, 0, 2 ); + + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 4, 4, 0, 2 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 2, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 7, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 3, 3, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Sel4Spin2Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, PushButton3 ); + setTabOrder( PushButton3, LineEdit3 ); + setTabOrder( LineEdit3, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); + setTabOrder( SpinBox2, CheckButton1 ); + setTabOrder( CheckButton1, SpinBox3 ); + setTabOrder( SpinBox3, SpinBox4 ); + setTabOrder( SpinBox4, CheckButton2 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel4Spin2Check_QTD::~DlgRef_3Sel4Spin2Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h new file mode 100644 index 000000000..5bbc36d54 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h @@ -0,0 +1,81 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel4Spin2Check_QTD.ui' +** +** Created: Tue Jun 1 16:29:29 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SEL4SPIN2CHECK_QTD_H +#define DLGREF_3SEL4SPIN2CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_3Sel4Spin2Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel4Spin2Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel4Spin2Check_QTD(); + + QGroupBox* GroupBox1; + QCheckBox* CheckButton2; + QLineEdit* LineEdit1; + QLabel* TextLabel3; + QPushButton* PushButton2; + QLineEdit* LineEdit3; + QPushButton* PushButton1; + QSpinBox* SpinBox4; + QSpinBox* SpinBox3; + QLabel* TextLabel7; + QLabel* TextLabel6; + QCheckBox* CheckButton1; + QPushButton* PushButton3; + QLabel* TextLabel1; + QLineEdit* LineEdit2; + QLabel* TextLabel5; + QLabel* TextLabel4; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_3Sel4Spin2Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout2; +}; + +#endif // DLGREF_3SEL4SPIN2CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Sel_QTD.cxx b/src/DlgRef/DlgRef_3Sel_QTD.cxx new file mode 100644 index 000000000..9381494f3 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel_QTD.cxx @@ -0,0 +1,125 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel_QTD.ui' +** +** Created: lun sep 29 11:05:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel_QTD::DlgRef_3Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel_QTD" ); + resize( 129, 117 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_3Sel_QTD" ) ); + DlgRef_3Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 2, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 159, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 2, 1 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel_QTD::~DlgRef_3Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Sel_QTD.h b/src/DlgRef/DlgRef_3Sel_QTD.h new file mode 100644 index 000000000..f1832c9ee --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel_QTD.h @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel_QTD.ui' +** +** Created: lun sep 29 11:05:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SEL_QTD_H +#define DLGREF_3SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_3Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit3; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QLabel* TextLabel1; + QLabel* TextLabel3; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QPushButton* PushButton3; + QPushButton* PushButton2; + + +protected: + QGridLayout* DlgRef_3Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SEL_QTD_H diff --git a/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx new file mode 100644 index 000000000..12f779933 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx @@ -0,0 +1,115 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Spin1Check_QTD.ui' +** +** Created: dim sep 28 18:11:19 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Spin1Check_QTD::DlgRef_3Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Spin1Check_QTD" ); + resize( 124, 130 ); + setCaption( trUtf8( "DlgRef_3Spin1Check_QTD" ) ); + DlgRef_3Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + CheckBox1 = new QRadioButton( GroupBox1, "CheckBox1" ); + CheckBox1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckBox1, 3, 3, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin1Check_QTD::~DlgRef_3Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Spin1Check_QTD.h b/src/DlgRef/DlgRef_3Spin1Check_QTD.h new file mode 100644 index 000000000..a8b5a61dd --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check_QTD.h @@ -0,0 +1,71 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Spin1Check_QTD.ui' +** +** Created: dim sep 28 18:11:19 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SPIN1CHECK_QTD_H +#define DLGREF_3SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QRadioButton; +class QSpinBox; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_3Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_3Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Spin_QTD.cxx b/src/DlgRef/DlgRef_3Spin_QTD.cxx new file mode 100644 index 000000000..57823e5f5 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin_QTD.cxx @@ -0,0 +1,109 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Spin_QTD::DlgRef_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Spin_QTD" ); + resize( 124, 111 ); + setCaption( trUtf8( "DlgRef_3Spin_QTD" ) ); + DlgRef_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin_QTD::~DlgRef_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Spin_QTD.h b/src/DlgRef/DlgRef_3Spin_QTD.h new file mode 100644 index 000000000..8d30c4e73 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin_QTD.h @@ -0,0 +1,68 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SPIN_QTD_H +#define DLGREF_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QSpinBox* SpinBox3; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_4Sel1List1Check_QTD.cxx b/src/DlgRef/DlgRef_4Sel1List1Check_QTD.cxx new file mode 100644 index 000000000..14bf1ec8b --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List1Check_QTD.cxx @@ -0,0 +1,195 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_4Sel1List1Check_QTD.ui' +** +** Created: lun oct 27 17:21:04 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_4Sel1List1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_4Sel1List1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_4Sel1List1Check_QTD::DlgRef_4Sel1List1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_4Sel1List1Check_QTD" ); + resize( 129, 210 ); + setCaption( trUtf8( "DlgRef_4Sel1List1Check_QTD" ) ); + DlgRef_4Sel1List1Check_QTDLayout = + new QGridLayout( this, 1, 1, 0, 6, "DlgRef_4Sel1List1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 2, 2 ); + + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_4Sel1List1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + + GroupBox2 = new QGroupBox( this, "GroupBox2" ); + GroupBox2->setTitle( trUtf8( "" ) ); + GroupBox2->setColumnLayout(0, Qt::Vertical ); + GroupBox2->layout()->setSpacing( 6 ); + GroupBox2->layout()->setMargin( 11 ); + GroupBox2Layout = new QGridLayout( GroupBox2->layout() ); + GroupBox2Layout->setAlignment( Qt::AlignTop ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel4 = new QLabel( GroupBox2, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 5, 2 ); + + PushButton3 = new QPushButton( GroupBox2, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton3, 0, 1 ); + + LineEdit3 = new QLineEdit( GroupBox2, "LineEdit3" ); + + Layout2->addWidget( LineEdit3, 0, 2 ); + + + TextLabel5 = new QLabel( GroupBox2, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + PushButton4 = new QPushButton( GroupBox2, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton4, 1, 1 ); + + LineEdit4 = new QLineEdit( GroupBox2, "LineEdit4" ); + + Layout2->addWidget( LineEdit4, 1, 2 ); + + CheckBox1 = new QCheckBox( GroupBox1, "CheckBox1" ); + CheckBox1->setText( trUtf8( "" ) ); + Layout1->addMultiCellWidget( CheckBox1, 5, 5, 0, 1 ); + + PushButton5 = new QPushButton( GroupBox1, "PushButton5" ); + PushButton5->setText( trUtf8( "" ) ); + Layout1->addWidget( PushButton5, 5, 2 ); + + GroupBox2Layout->addLayout( Layout2, 0, 0 ); + + DlgRef_4Sel1List1Check_QTDLayout->addWidget( GroupBox2, 1, 0 ); + + // tab order + setTabOrder(PushButton1 , LineEdit1); + setTabOrder(LineEdit1 , PushButton2); + setTabOrder(PushButton2 , LineEdit2); + setTabOrder(LineEdit2, ComboBox1); + setTabOrder(ComboBox1, CheckBox1); + setTabOrder(CheckBox1, PushButton5); + setTabOrder(PushButton5, PushButton3); + setTabOrder(PushButton3 , LineEdit3); + setTabOrder(LineEdit3, PushButton4 ); + setTabOrder(PushButton4 , LineEdit4); + +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_4Sel1List1Check_QTD::~DlgRef_4Sel1List1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_4Sel1List1Check_QTD.h b/src/DlgRef/DlgRef_4Sel1List1Check_QTD.h new file mode 100644 index 000000000..da2a5b98e --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List1Check_QTD.h @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_4Sel1List1Check_QTD.ui' +** +** Created: lun oct 27 17:21:03 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_4SEL1LIST1CHECK_QTD_H +#define DLGREF_4SEL1LIST1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QCheckBox; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_4Sel1List1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_4Sel1List1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_4Sel1List1Check_QTD(); + + QGroupBox* GroupBox1; + QGroupBox* GroupBox2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QPushButton* PushButton1; + QPushButton* PushButton2; + QPushButton* PushButton3; + QPushButton* PushButton4; + QLineEdit* LineEdit1; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QLineEdit* LineEdit4; + QComboBox* ComboBox1; + QCheckBox* CheckBox1; + QPushButton* PushButton5; + +protected: + QGridLayout* DlgRef_4Sel1List1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* GroupBox2Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_4SEL1LIST1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.cxx b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx new file mode 100644 index 000000000..d6e5b2086 --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx @@ -0,0 +1,171 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_4Sel1List_QTD.ui' +** +** Created: lun oct 27 17:21:04 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_4Sel1List_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_4Sel1List_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_4Sel1List_QTD::DlgRef_4Sel1List_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_4Sel1List_QTD" ); + resize( 129, 175 ); + setCaption( trUtf8( "DlgRef_4Sel1List_QTD" ) ); + DlgRef_4Sel1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_4Sel1List_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 2, 2 ); + + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); + + + GroupBox2 = new QGroupBox( this, "GroupBox2" ); + GroupBox2->setTitle( trUtf8( "" ) ); + GroupBox2->setColumnLayout(0, Qt::Vertical ); + GroupBox2->layout()->setSpacing( 6 ); + GroupBox2->layout()->setMargin( 11 ); + GroupBox2Layout = new QGridLayout( GroupBox2->layout() ); + GroupBox2Layout->setAlignment( Qt::AlignTop ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel4 = new QLabel( GroupBox2, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 5, 2 ); + + PushButton3 = new QPushButton( GroupBox2, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton3, 0, 1 ); + + LineEdit3 = new QLineEdit( GroupBox2, "LineEdit3" ); + + Layout2->addWidget( LineEdit3, 0, 2 ); + + + TextLabel5 = new QLabel( GroupBox2, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + PushButton4 = new QPushButton( GroupBox2, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton4, 1, 1 ); + + LineEdit4 = new QLineEdit( GroupBox2, "LineEdit4" ); + + Layout2->addWidget( LineEdit4, 1, 2 ); + + GroupBox2Layout->addLayout( Layout2, 0, 0 ); + + DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox2, 1, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_4Sel1List_QTD::~DlgRef_4Sel1List_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.h b/src/DlgRef/DlgRef_4Sel1List_QTD.h new file mode 100644 index 000000000..278cbc3bf --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.h @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_4Sel1List_QTD.ui' +** +** Created: lun oct 27 17:21:03 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_4SEL1LIST_QTD_H +#define DLGREF_4SEL1LIST_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_4Sel1List_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_4Sel1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_4Sel1List_QTD(); + + QGroupBox* GroupBox1; + QGroupBox* GroupBox2; + QLineEdit* LineEdit2; + QPushButton* PushButton4; + QPushButton* PushButton1; + QLineEdit* LineEdit4; + QPushButton* PushButton3; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLabel* TextLabel4; + QLineEdit* LineEdit1; + QLabel* TextLabel5; + QLineEdit* LineEdit3; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_4Sel1List_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* GroupBox2Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_4SEL1LIST_QTD_H diff --git a/src/DlgRef/DlgRef_6Sel_QTD.cxx b/src/DlgRef/DlgRef_6Sel_QTD.cxx new file mode 100644 index 000000000..c3f541853 --- /dev/null +++ b/src/DlgRef/DlgRef_6Sel_QTD.cxx @@ -0,0 +1,171 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_6Sel_QTD.ui' +** +** Created: Tue Aug 24 18:18:57 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_6Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_6Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_6Sel_QTD::DlgRef_6Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_6Sel_QTD" ); + resize( 235, 196 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_6Sel_QTD" ) ); + DlgRef_6Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_6Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout1->addWidget( TextLabel4, 3, 0 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout1->addWidget( TextLabel5, 4, 0 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout1->addWidget( TextLabel6, 5, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 2, 1 ); + + PushButton4 = new QPushButton( GroupBox1, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton4, 3, 1 ); + + PushButton5 = new QPushButton( GroupBox1, "PushButton5" ); + PushButton5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton5->sizePolicy().hasHeightForWidth() ) ); + PushButton5->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton5, 4, 1 ); + + PushButton6 = new QPushButton( GroupBox1, "PushButton6" ); + PushButton6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton6->sizePolicy().hasHeightForWidth() ) ); + PushButton6->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton6, 5, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 2, 2 ); + + LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" ); + + Layout1->addWidget( LineEdit4, 3, 2 ); + + LineEdit5 = new QLineEdit( GroupBox1, "LineEdit5" ); + + Layout1->addWidget( LineEdit5, 4, 2 ); + + LineEdit6 = new QLineEdit( GroupBox1, "LineEdit6" ); + + Layout1->addWidget( LineEdit6, 5, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_6Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_6Sel_QTD::~DlgRef_6Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_6Sel_QTD.h b/src/DlgRef/DlgRef_6Sel_QTD.h new file mode 100644 index 000000000..52b0db336 --- /dev/null +++ b/src/DlgRef/DlgRef_6Sel_QTD.h @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_6Sel_QTD.ui' +** +** Created: Tue Aug 24 18:18:28 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_6SEL_QTD_H +#define DLGREF_6SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_6Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_6Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_6Sel_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QLabel* TextLabel6; + QPushButton* PushButton1; + QPushButton* PushButton2; + QPushButton* PushButton3; + QPushButton* PushButton4; + QPushButton* PushButton5; + QPushButton* PushButton6; + QLineEdit* LineEdit1; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QLineEdit* LineEdit4; + QLineEdit* LineEdit5; + QLineEdit* LineEdit6; + + +protected: + QGridLayout* DlgRef_6Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_6SEL_QTD_H diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.cxx b/src/DlgRef/DlgRef_Skeleton_QTD.cxx new file mode 100644 index 000000000..f16b05e10 --- /dev/null +++ b/src/DlgRef/DlgRef_Skeleton_QTD.cxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui' +** +** Created: Wed Aug 11 18:42:51 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_Skeleton_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "DlgRef_Skeleton_QTD" ); + resize( 307, 378 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_Skeleton_QTD" ) ); + setSizeGripEnabled( TRUE ); + DlgRef_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "DlgRef_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupMedium = new QGroupBox( this, "GroupMedium" ); + GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); + GroupMedium->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupMedium, 2, 0 ); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( trUtf8( "&Ok" ) ); + Layout3->addWidget( buttonOk ); + + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( trUtf8( "&Apply" ) ); + Layout3->addWidget( buttonApply ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + Layout1->addWidget( GroupButtons, 3, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QHBoxLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton1 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton2 ); + + RadioButton3 = new QRadioButton( GroupConstructors, "RadioButton3" ); + RadioButton3->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton3 ); + + RadioButton4 = new QRadioButton( GroupConstructors, "RadioButton4" ); + RadioButton4->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton4 ); + GroupConstructorsLayout->addLayout( Layout2 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupBoxName = new QGroupBox( this, "GroupBoxName" ); + GroupBoxName->setTitle( trUtf8( "Result name" ) ); + GroupBoxName->setColumnLayout(0, Qt::Vertical ); + GroupBoxName->layout()->setSpacing( 6 ); + GroupBoxName->layout()->setMargin( 11 ); + GroupBoxNameLayout = new QGridLayout( GroupBoxName->layout() ); + GroupBoxNameLayout->setAlignment( Qt::AlignTop ); + + Layout66 = new QGridLayout( 0, 1, 1, 0, 6, "Layout66"); + + ResultName = new QLineEdit( GroupBoxName, "ResultName" ); + + Layout66->addWidget( ResultName, 0, 1 ); + + NameLabel = new QLabel( GroupBoxName, "NameLabel" ); + NameLabel->setText( trUtf8( "Name" ) ); + + Layout66->addWidget( NameLabel, 0, 0 ); + + GroupBoxNameLayout->addLayout( Layout66, 0, 0 ); + + Layout1->addWidget( GroupBoxName, 1, 0 ); + + DlgRef_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_Skeleton_QTD::~DlgRef_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.h b/src/DlgRef/DlgRef_Skeleton_QTD.h new file mode 100644 index 000000000..fb4807f31 --- /dev/null +++ b/src/DlgRef/DlgRef_Skeleton_QTD.h @@ -0,0 +1,83 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui' +** +** Created: Wed Aug 11 18:42:51 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_SKELETON_QTD_H +#define DLGREF_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif + +class DLGREF_WNT_EXPORT DlgRef_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + DlgRef_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~DlgRef_Skeleton_QTD(); + + QGroupBox* GroupMedium; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonApply; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QRadioButton* RadioButton3; + QRadioButton* RadioButton4; + QGroupBox* GroupBoxName; + QLineEdit* ResultName; + QLabel* NameLabel; + + +protected: + QGridLayout* DlgRef_Skeleton_QTDLayout; + QGridLayout* Layout1; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; + QHBoxLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; + QGridLayout* GroupBoxNameLayout; + QGridLayout* Layout66; +}; + +#endif // DLGREF_SKELETON_QTD_H diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx new file mode 100755 index 000000000..4c4c512b8 --- /dev/null +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -0,0 +1,104 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#!/bin/sh + +#uic -o DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui +#uic -o DlgRef_Skeleton_QTD.cxx -impl DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui + +#uic -o DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui +#uic -o DlgRef_1Sel_QTD.cxx -impl DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui + +#uic -o DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui +#uic -o DlgRef_1Sel1Spin_QTD.cxx -impl DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui + +#uic -o DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui +#uic -o DlgRef_1Sel1Spin1Check_QTD.cxx -impl DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui + +#uic -o DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui +#uic -o DlgRef_1Sel2Spin_QTD.cxx -impl DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui + +#uic -o DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui +#uic -o DlgRef_1Sel3Spin_QTD.cxx -impl DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui + +#uic -o DlgRef_1Sel4Spin_QTD.h DlgRef_1Sel4Spin_QTD.ui +#uic -o DlgRef_1Sel4Spin_QTD.cxx -impl DlgRef_1Sel4Spin_QTD.h DlgRef_1Sel4Spin_QTD.ui + +#uic -o DlgRef_1Sel5Spin_QTD.h DlgRef_1Sel5Spin_QTD.ui +#uic -o DlgRef_1Sel5Spin_QTD.cxx -impl DlgRef_1Sel5Spin_QTD.h DlgRef_1Sel5Spin_QTD.ui + +#uic -o DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui +#uic -o DlgRef_1Sel1Check_QTD.cxx -impl DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui + +#uic -o DlgRef_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui +#uic -o DlgRef_1Sel3Check_QTD.cxx -impl DlgRef_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui + +#uic -o DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui +#uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui + +#uic -o DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui +#uic -o DlgRef_2Sel_QTD.cxx -impl DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui + +#uic -o DlgRef_2Sel1Spin_QTD.h DlgRef_2Sel1Spin_QTD.ui +#uic -o DlgRef_2Sel1Spin_QTD.cxx -impl DlgRef_2Sel1Spin_QTD.h DlgRef_2Sel1Spin_QTD.ui + +#uic -o DlgRef_2Sel1Spin2Check_QTD.h DlgRef_2Sel1Spin2Check_QTD.ui +#uic -o DlgRef_2Sel1Spin2Check_QTD.cxx -impl DlgRef_2Sel1Spin2Check_QTD.h DlgRef_2Sel1Spin2Check_QTD.ui + +#uic -o DlgRef_2Sel2Spin_QTD.h DlgRef_2Sel2Spin_QTD.ui +#uic -o DlgRef_2Sel2Spin_QTD.cxx -impl DlgRef_2Sel2Spin_QTD.h DlgRef_2Sel2Spin_QTD.ui + +#uic -o DlgRef_2Sel2Spin1Check_QTD.h DlgRef_2Sel2Spin1Check_QTD.ui +#uic -o DlgRef_2Sel2Spin1Check_QTD.cxx -impl DlgRef_2Sel2Spin1Check_QTD.h DlgRef_2Sel2Spin1Check_QTD.ui + +#uic -o DlgRef_2Sel3Spin_QTD.h DlgRef_2Sel3Spin_QTD.ui +#uic -o DlgRef_2Sel3Spin_QTD.cxx -impl DlgRef_2Sel3Spin_QTD.h DlgRef_2Sel3Spin_QTD.ui + +#uic -o DlgRef_2Sel4Spin1Check_QTD.h DlgRef_2Sel4Spin1Check_QTD.ui +#uic -o DlgRef_2Sel4Spin1Check_QTD.cxx -impl DlgRef_2Sel4Spin1Check_QTD.h DlgRef_2Sel4Spin1Check_QTD.ui + +#uic -o DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui +#uic -o DlgRef_4Sel1List_QTD.cxx -impl DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui + +#uic -o DlgRef_3Sel_QTD.h DlgRef_3Sel_QTD.ui +#uic -o DlgRef_3Sel_QTD.cxx -impl DlgRef_3Sel_QTD.h DlgRef_3Sel_QTD.ui + +#uic -o DlgRef_3Sel4Spin2Check_QTD.h DlgRef_3Sel4Spin2Check_QTD.ui +#uic -o DlgRef_3Sel4Spin2Check_QTD.cxx -impl DlgRef_3Sel4Spin2Check_QTD.h DlgRef_3Sel4Spin2Check_QTD.ui + +#uic -o DlgRef_1Spin_QTD.h DlgRef_1Spin_QTD.ui +#uic -o DlgRef_1Spin_QTD.cxx -impl DlgRef_1Spin_QTD.h DlgRef_1Spin_QTD.ui + +#uic -o DlgRef_2Spin_QTD.h DlgRef_2Spin_QTD.ui +#uic -o DlgRef_2Spin_QTD.cxx -impl DlgRef_2Spin_QTD.h DlgRef_2Spin_QTD.ui + +#uic -o DlgRef_3Spin_QTD.h DlgRef_3Spin_QTD.ui +#uic -o DlgRef_3Spin_QTD.cxx -impl DlgRef_3Spin_QTD.h DlgRef_3Spin_QTD.ui + +#uic -o DlgRef_3Spin1Check_QTD.h DlgRef_3Spin1Check_QTD.ui +#uic -o DlgRef_3Spin1Check_QTD.cxx -impl DlgRef_3Spin1Check_QTD.h DlgRef_3Spin1Check_QTD.ui + +#uic -o DlgRef_3Sel3Spin1Check_QTD.h DlgRef_3Sel3Spin1Check_QTD.ui +#uic -o DlgRef_3Sel3Spin1Check_QTD.cxx -impl DlgRef_3Sel3Spin1Check_QTD.h DlgRef_3Sel3Spin1Check_QTD.ui + +#uic -o DlgRef_6Sel_QTD.h DlgRef_6Sel_QTD.ui +#uic -o DlgRef_6Sel_QTD.cxx -impl DlgRef_6Sel_QTD.h DlgRef_6Sel_QTD.ui + +uic -o DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui +uic -o DlgRef_3Check_QTD.cxx -impl DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx new file mode 100644 index 000000000..82fa8a094 --- /dev/null +++ b/src/EntityGUI/EntityGUI.cxx @@ -0,0 +1,679 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : EntityGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "EntityGUI.h" +#include "GeometryGUI.h" +#include "GEOM_AssemblyBuilder.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewManager.h" +//#include "SVTK_ViewModel.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_Tools.h" +//#include "SALOMEGUI_ImportOperation.h" + +#include +#include +#include + +#include "EntityGUI_SketcherDlg.h" // Sketcher +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +#include "utilities.h" + +using namespace boost; +using namespace std; + +EntityGUI* EntityGUI::myGUIObject = 0; + +//======================================================================= +// function : GetEntityGUI() +// purpose : Get the only EntityGUI object [ static ] +//======================================================================= +EntityGUI* EntityGUI::GetEntityGUI( GeometryGUI* parent ) +{ + if ( myGUIObject == 0 ) { + // init EntityGUI only once + myGUIObject = new EntityGUI( parent ); + } + return myGUIObject; +} + +//======================================================================= +// function : EntityGUI() +// purpose : Constructor +//======================================================================= +EntityGUI::EntityGUI( GeometryGUI* parent ) : GEOMGUI( parent ) +{ + myGeomBase = new GEOMBase(); + myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGen() ); + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); +} + + +//======================================================================= +// function : ~EntityGUI() +// purpose : Destructor +//======================================================================= +EntityGUI::~EntityGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +{ + getGeometryGUI()->EmitSignalDeactivateDialog(); + QDialog* aDlg = NULL; + + switch (theCommandID) + { + case 404: // SKETCHER + getGeometryGUI()->ActiveWorkingPlane(); + aDlg = new EntityGUI_SketcherDlg(getGeometryGUI(), parent, ""); + break; + case 407: // EXPLODE : use ic + aDlg = new EntityGUI_SubShapeDlg(parent, ""); + break; + default: + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + if ( aDlg ) + aDlg->show(); + + return true; +} + + +//======================================================================= +// function : OnSketchEnd() +// purpose : +//======================================================================= +void EntityGUI::OnSketchEnd(const char *Cmd) +{ + /* QAD_Application::getDesktop()->putInfo("Create sketch functionality is NOT implemented in new GEOM kernel + (no such Corba interface method). Waiting for SRN to create it..."); + + try { + GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + SalomeApp_Tools::QtCatchCorbaException(S_ex); + } + */ + return; +} + + +//===================================================================================== +// function : DisplaySimulationShape() +// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape +//===================================================================================== +void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2) +{ + //NRI DEBUG : 14/02/2002 + if( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) + return; + + OCCViewer_Viewer* v3d = + ((OCCViewer_ViewManager*)(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()))->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + try { + if(!S1.IsNull()) { + /* erase any previous */ + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape1->Set(S1); + mySimulationShape1->SetColor(Quantity_NOC_RED); + + ic->Deactivate(mySimulationShape1); + ic->Display(mySimulationShape1, Standard_False); + mySimulationShape1->UnsetColor(); + } + if(!S2.IsNull()) { + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2->Set(S2); + mySimulationShape2->SetColor(Quantity_NOC_VIOLET); + + ic->Deactivate(mySimulationShape2); + ic->Display(mySimulationShape2, Standard_False); + mySimulationShape2->UnsetColor(); + } + ic->UpdateCurrentViewer(); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape "); + } + return; +} + + +//================================================================================== +// function : EraseSimulationShape() +// purpose : Clears the display of 'mySimulationShape' a pure graphical shape +//================================================================================== +void EntityGUI::EraseSimulationShape() +{ + // get all view windows at the desktop + QPtrList aWndLst = SUIT_Session::session()->activeApplication()->desktop()->windows(); + //get all view windows, which belong to the active study + QPtrList aWndLstAS; + SUIT_ViewWindow* vw; + for ( vw = aWndLst.first(); vw; vw = aWndLst.next() ) + if ( vw->getViewManager()->study() == SUIT_Session::session()->activeApplication()->activeStudy() ) + aWndLstAS.append( vw ); + + for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) { + if ( vw->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(vw->getViewManager()))->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + ic->UpdateCurrentViewer(); + } + } +} + +//===================================================================================== +// function : SObjectExist() +// purpose : +//===================================================================================== +bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR) +{ + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) ); + _PTR(SObject) RefSO; + _PTR(GenericAttribute) anAttr; + for(; it->More();it->Next()) { + _PTR(SObject) SO ( it->Value() ); + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + if(strcmp( anIOR->Value().c_str(), IOR ) == 0) + return true; + } + if(SO->ReferencedObject(RefSO)) { + if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + if(strcmp(anIOR->Value().c_str(), IOR) == 0) + return true; + } + } + } + return false; +} + + +//===================================================================================== +// function : OnSubShapeGetAll() +// purpose : Explode a shape in all sub shapes with a SubShapeType +//===================================================================================== +bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) +{ + SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ..."); + /* + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributePixMap_var aPixmap; + + // We create a sub object for each sub shape as attribute of the main object + // Each sub object contains list (length=1) containing its index in the main shape + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; + GEOM::GEOM_Shape_var aResult; + + try { + listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType); + if(listGeomShapes->length() < 1) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + } + catch(const SALOME::SALOME_Exception& S_ex) { + SalomeApp_Tools::QtCatchCorbaException(S_ex); + } + + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + TopoDS_Shape mainShape; + bool main = false; + while(!main) { + if(aShape->IsMainShape()) { + mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + main = true; + } + else + aShape = myGeom->GetIORFromString(aShape->MainName()); + } + + // Loop on each sub shape created + // int i = 1 ; index for the nameType + for(int j=0; jlength(); j++) { + // Get each sub shape extracted CORBA and OCC + aResult = listGeomShapes[j] ; + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + + if (S.IsNull()) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + + // Set the nameType of sub shape + char* nameG = (char *)malloc(20); + Standard_CString Type; + if(myGeomBase->GetShapeTypeString(S, Type)) { + aResult->NameType(Type); + sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType)); + } + else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); + } + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + + bool allreadyexist = false; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + MESSAGE ("SO->_is_nil() " << SO->_is_nil()) + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + MESSAGE(" Type " << S.ShapeType()) + if (S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap()) + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + + aResult->StudyShapeId(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + aResult->StudyShapeId(SO->GetID()); + } + } + + result->setIO(IO); + result->setName(nameG); + if(!allreadyexist) + ic->Display(result); + + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + SVTK_ViewFrame* vf = dynamic_cast( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame() ); + SVTK_RenderWindowInteractor* myRenderInter= vf ? vf->getRWInteractor() : 0; + + int themode = myRenderInter->GetDisplayMode(); + vtkRenderer *theRenderer = vf->getRenderer(); + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + } + } + + if(!allreadyexist) { + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IO); + GActor->setName(nameG); + theRenderer->AddActor(GActor); + renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + } + + // commit transaction + op->finish(); + + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + */ + return true; +} + + +//===================================================================================== +// function : OnSubShapeGetSelected() +// purpose : +//===================================================================================== +bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ..."); + // //* Test the type of viewer */ +// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) +// return false; + +// SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); +// SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); +// if(theObj->_is_nil()) { +// QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); +// return false; +// } + +// OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); +// Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + +// if( myUseLocalContext == false ) { +// /* local context is from DialogBox */ +// MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; +// return false ; +// } + +// GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); +// TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + +// TopoDS_Shape mainShape; +// bool main = false; +// while(!main) { +// if(aShape->IsMainShape()) { +// mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); +// main = true; +// } +// else +// aShape = myGeom->GetIORFromString(aShape->MainName()); +// } + +// GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; +// ic->InitSelected(); +// int nbSelected = ic->NbSelected(); +// ListOfID->length(nbSelected); + +// TopoDS_Compound compound; +// ic->InitSelected(); /* to init again */ +// BRep_Builder B; +// B.MakeCompound(compound); + +// int i = 0; +// /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ +// /* the compound is homogenous by selection */ +// while(ic->MoreSelected()) { +// int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType); +// ListOfID[i] = index; +// B.Add(compound, ic->SelectedShape()); +// i++; +// ic->NextSelected(); +// } + +// /* Test if user has selected sub shapes */ +// if(ListOfID->length() < 1) +// return false; + +// GEOM::GEOM_Shape_var aResult; +// try { +// aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID); +// } +// catch (const SALOME::SALOME_Exception& S_ex) { +// SalomeApp_Tools::QtCatchCorbaException(S_ex); +// } + +// /* local context from DialogBox */ +// ic->CloseLocalContext(aLocalContextId); +// myUseLocalContext = false ; + +// char* nameG = (char *)malloc(20); +// Standard_CString Type; + +// Handle(GEOM_AISShape) result; +// Handle(GEOM_InteractiveObject) IO; + +// if(nbSelected == 1) { +// TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType)); +// if(Exp.More()) { +// if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) { +// aResult->NameType(Type); +// sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType)); +// } +// else { +// aResult->NameType(tr("GEOM_SHAPE")); +// sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); +// } +// result = new GEOM_AISShape(Exp.Current(), nameG); +// IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); +// } +// } +// else { +// if ( myGeomBase->GetShapeTypeString(compound,Type)) { +// aResult->NameType(Type); +// sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++); +// } else { +// aResult->NameType(tr("GEOM_SHAPE")); +// sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++); +// } +// result = new GEOM_AISShape(compound, nameG); +// IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); +// } + +// SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + +// /* open transaction */ +// QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); +// op->start(); + +// SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); +// SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); +// SALOMEDS::GenericAttribute_var anAttr; +// SALOMEDS::AttributeName_var aName; +// SALOMEDS::AttributeIOR_var anIOR; +// SALOMEDS::AttributePixMap_var aPixmap; + +// bool allreadyexist = false; + +// if(SO->_is_nil()) { +// SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); +// anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); +// anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); +// anIOR->SetValue(aResult->Name()); +// anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); +// aName = SALOMEDS::AttributeName::_narrow(anAttr); +// aName->SetValue(result->getName()); + +// anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); +// aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); +// if(result->Shape().ShapeType() == TopAbs_COMPOUND) +// aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); +// else if(result->Shape().ShapeType() == TopAbs_COMPSOLID) +// aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); +// else if(result->Shape().ShapeType() == TopAbs_SOLID) +// aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); +// else if(result->Shape().ShapeType() == TopAbs_SHELL) +// aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); +// else if(result->Shape().ShapeType() == TopAbs_FACE) +// aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); +// else if(result->Shape().ShapeType() == TopAbs_WIRE) +// aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); +// else if(result->Shape().ShapeType() == TopAbs_EDGE) +// aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); +// else if(result->Shape().ShapeType() == TopAbs_VERTEX) +// aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + +// SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); +// aStudyBuilder->Addreference(newObj1, newObj); + +// IO->setEntry(newObj->GetID()); +// aResult->StudyShapeId(newObj->GetID()); +// } +// else { +// allreadyexist = true; +// if(!this->SObjectExist(theObj, aResult->Name())) { +// SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); +// aStudyBuilder->Addreference(newObj1, SO); + +// IO->setEntry(SO->GetID()); +// aResult->StudyShapeId(SO->GetID()); +// } +// } + +// /* commit transaction */ +// op->finish(); + +// result->setIO(IO); +// result->setName(nameG); + +// if(!allreadyexist) +// ic->Display(result); + +// DisplayGUI* myDisplayGUI = new DisplayGUI(); +// myDisplayGUI->OnDisplayAll(true); + +// QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); +// QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WNT + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) + { + return EntityGUI::GetEntityGUI( parent ); + } +} diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.cxx b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx new file mode 100644 index 000000000..86fc4303d --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx @@ -0,0 +1,122 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Thu Aug 12 19:03:19 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Sel_QTD::EntityGUI_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Sel_QTD" ); + resize( 329, 112 ); + setCaption( trUtf8( "EntityGUI_1Sel_QTD" ) ); + EntityGUI_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + QSpacerItem* spacer = new QSpacerItem( 0, 163, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer, 2, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout3->addWidget( buttonApply, 0, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonRedo = new QPushButton( GroupBox1, "buttonRedo" ); + buttonRedo->setText( trUtf8( "Redo" ) ); + + Layout2->addWidget( buttonRedo, 0, 1 ); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 0, 0 ); + + Layout3->addLayout( Layout2, 1, 0 ); + + Layout4->addLayout( Layout3, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 180, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 1, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + LineEdit1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, LineEdit1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout4->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout4, 0, 0 ); + + EntityGUI_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Sel_QTD::~EntityGUI_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.h b/src/EntityGUI/EntityGUI_1Sel_QTD.h new file mode 100644 index 000000000..2888d93e4 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.h @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SEL_QTD_H +#define ENTITYGUI_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class EntityGUI_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonApply; + QPushButton* buttonRedo; + QPushButton* buttonUndo; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* EntityGUI_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout4; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_1SEL_QTD_H diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.cxx b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx new file mode 100644 index 000000000..1fcef95bf --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx @@ -0,0 +1,116 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: Fri Jul 30 16:05:59 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Spin_QTD::EntityGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Spin_QTD" ); + resize( 255, 112 ); + setCaption( trUtf8( "EntityGUI_1Spin_QTD" ) ); + EntityGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + Layout4->addLayout( Layout1, 0, 0 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonRedo = new QPushButton( GroupBox1, "buttonRedo" ); + buttonRedo->setText( trUtf8( "Redo" ) ); + + Layout2->addWidget( buttonRedo, 0, 1 ); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 0, 0 ); + + Layout3->addLayout( Layout2, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout3->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer_2, 2, 0 ); + + Layout4->addLayout( Layout3, 0, 1 ); + + GroupBox1Layout->addLayout( Layout4, 0, 0 ); + + EntityGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Spin_QTD::~EntityGUI_1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.h b/src/EntityGUI/EntityGUI_1Spin_QTD.h new file mode 100644 index 000000000..7b26931fb --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.h @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: Fri Jul 30 16:05:59 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SPIN_QTD_H +#define ENTITYGUI_1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QPushButton* buttonRedo; + QPushButton* buttonUndo; + QPushButton* buttonApply; + + +protected: + QGridLayout* EntityGUI_1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout4; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout2; +}; + +#endif // ENTITYGUI_1SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.cxx b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx new file mode 100644 index 000000000..ec8ed7648 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx @@ -0,0 +1,127 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_2Spin_QTD::EntityGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_2Spin_QTD" ); + resize( 255, 112 ); + setCaption( trUtf8( "EntityGUI_2Spin_QTD" ) ); + EntityGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + Layout4->addLayout( Layout1, 0, 0 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer_2, 2, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 0, 0 ); + + buttonRedo = new QPushButton( GroupBox1, "buttonRedo" ); + buttonRedo->setText( trUtf8( "Redo" ) ); + + Layout2->addWidget( buttonRedo, 0, 1 ); + + Layout3->addLayout( Layout2, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout3->addWidget( buttonApply, 0, 0 ); + + Layout4->addLayout( Layout3, 0, 1 ); + + GroupBox1Layout->addLayout( Layout4, 0, 0 ); + + EntityGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_2Spin_QTD::~EntityGUI_2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.h b/src/EntityGUI/EntityGUI_2Spin_QTD.h new file mode 100644 index 000000000..bdd3c0737 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.h @@ -0,0 +1,68 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_2SPIN_QTD_H +#define ENTITYGUI_2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_2Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QPushButton* buttonUndo; + QPushButton* buttonRedo; + QPushButton* buttonApply; + + +protected: + QGridLayout* EntityGUI_2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout4; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout2; +}; + +#endif // ENTITYGUI_2SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.cxx b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx new file mode 100644 index 000000000..9734557a1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx @@ -0,0 +1,138 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_3Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_3Spin_QTD::EntityGUI_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_3Spin_QTD" ); + resize( 255, 125 ); + setCaption( trUtf8( "EntityGUI_3Spin_QTD" ) ); + EntityGUI_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout3->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 121, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer, 2, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 0, 0 ); + + buttonRedo = new QPushButton( GroupBox1, "buttonRedo" ); + buttonRedo->setText( trUtf8( "Redo" ) ); + + Layout2->addWidget( buttonRedo, 0, 1 ); + + Layout3->addLayout( Layout2, 1, 0 ); + + Layout4->addLayout( Layout3, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + Layout4->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout4, 0, 0 ); + + EntityGUI_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_3Spin_QTD::~EntityGUI_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.h b/src/EntityGUI/EntityGUI_3Spin_QTD.h new file mode 100644 index 000000000..8ddcb62b1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.h @@ -0,0 +1,70 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_3Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_3SPIN_QTD_H +#define ENTITYGUI_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonApply; + QPushButton* buttonUndo; + QPushButton* buttonRedo; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + + +protected: + QGridLayout* EntityGUI_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout4; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_3SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.cxx b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx new file mode 100644 index 000000000..762940e84 --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx @@ -0,0 +1,149 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_4Spin_QTD::EntityGUI_4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_4Spin_QTD" ); + resize( 255, 154 ); + setCaption( trUtf8( "EntityGUI_4Spin_QTD" ) ); + EntityGUI_4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_4Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonRedo = new QPushButton( GroupBox1, "buttonRedo" ); + buttonRedo->setText( trUtf8( "Redo" ) ); + + Layout2->addWidget( buttonRedo, 0, 1 ); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 0, 0 ); + + Layout3->addLayout( Layout2, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 45, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout3->addItem( spacer, 2, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout3->addWidget( buttonApply, 0, 0 ); + + Layout4->addLayout( Layout3, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 4, 1 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox4, 3, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout1->addWidget( TextLabel4, 3, 0 ); + + Layout4->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout4, 0, 0 ); + + EntityGUI_4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_4Spin_QTD::~EntityGUI_4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.h b/src/EntityGUI/EntityGUI_4Spin_QTD.h new file mode 100644 index 000000000..2ac171b9b --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.h @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: Fri Jul 30 16:06:00 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_4SPIN_QTD_H +#define ENTITYGUI_4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonRedo; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QSpinBox* SpinBox3; + QSpinBox* SpinBox2; + QLabel* TextLabel2; + QSpinBox* SpinBox4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel4; + + +protected: + QGridLayout* EntityGUI_4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout4; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_4SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.cxx b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx new file mode 100644 index 000000000..55a724512 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx @@ -0,0 +1,99 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir1_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir1_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir1_QTD::EntityGUI_Dir1_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir1_QTD" ); + resize( 131, 123 ); + setCaption( trUtf8( "EntityGUI_Dir1_QTD" ) ); + EntityGUI_Dir1_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir1_QTDLayout"); + + GroupDir1 = new QButtonGroup( this, "GroupDir1" ); + GroupDir1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDir1->sizePolicy().hasHeightForWidth() ) ); + GroupDir1->setTitle( trUtf8( "Direction" ) ); + GroupDir1->setColumnLayout(0, Qt::Vertical ); + GroupDir1->layout()->setSpacing( 6 ); + GroupDir1->layout()->setMargin( 11 ); + GroupDir1Layout = new QGridLayout( GroupDir1->layout() ); + GroupDir1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir12 = new QRadioButton( GroupDir1, "RB_Dir12" ); + RB_Dir12->setText( trUtf8( "Perpendicular" ) ); + + Layout1->addWidget( RB_Dir12, 1, 0 ); + + RB_Dir13 = new QRadioButton( GroupDir1, "RB_Dir13" ); + RB_Dir13->setText( trUtf8( "Tangent" ) ); + + Layout1->addWidget( RB_Dir13, 2, 0 ); + + RB_Dir11 = new QRadioButton( GroupDir1, "RB_Dir11" ); + RB_Dir11->setText( trUtf8( "Angle" ) ); + + Layout1->addWidget( RB_Dir11, 0, 0 ); + + RB_Dir14 = new QRadioButton( GroupDir1, "RB_Dir14" ); + RB_Dir14->setText( trUtf8( "VX-VY" ) ); + + Layout1->addWidget( RB_Dir14, 3, 0 ); + + GroupDir1Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir1_QTDLayout->addWidget( GroupDir1, 0, 0 ); + + // tab order + setTabOrder( RB_Dir11, RB_Dir12 ); + setTabOrder( RB_Dir12, RB_Dir13 ); + setTabOrder( RB_Dir13, RB_Dir14 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir1_QTD::~EntityGUI_Dir1_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.h b/src/EntityGUI/EntityGUI_Dir1_QTD.h new file mode 100644 index 000000000..8652c68e0 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.h @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR1_QTD_H +#define ENTITYGUI_DIR1_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir1_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir1_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir1_QTD(); + + QButtonGroup* GroupDir1; + QRadioButton* RB_Dir12; + QRadioButton* RB_Dir13; + QRadioButton* RB_Dir11; + QRadioButton* RB_Dir14; + + +protected: + QGridLayout* EntityGUI_Dir1_QTDLayout; + QGridLayout* GroupDir1Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR1_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.cxx b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx new file mode 100644 index 000000000..5db7d306f --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx @@ -0,0 +1,95 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir2_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir2_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir2_QTD::EntityGUI_Dir2_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir2_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Dir2_QTD" ) ); + EntityGUI_Dir2_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir2_QTDLayout"); + + GroupDir2 = new QButtonGroup( this, "GroupDir2" ); + GroupDir2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDir2->sizePolicy().hasHeightForWidth() ) ); + GroupDir2->setTitle( trUtf8( "Direction" ) ); + GroupDir2->setColumnLayout(0, Qt::Vertical ); + GroupDir2->layout()->setSpacing( 6 ); + GroupDir2->layout()->setMargin( 11 ); + GroupDir2Layout = new QGridLayout( GroupDir2->layout() ); + GroupDir2Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir22 = new QRadioButton( GroupDir2, "RB_Dir22" ); + RB_Dir22->setText( trUtf8( "X" ) ); + + Layout1->addWidget( RB_Dir22, 1, 0 ); + + RB_Dir23 = new QRadioButton( GroupDir2, "RB_Dir23" ); + RB_Dir23->setText( trUtf8( "Y" ) ); + + Layout1->addWidget( RB_Dir23, 2, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + RB_Dir21 = new QRadioButton( GroupDir2, "RB_Dir21" ); + RB_Dir21->setText( trUtf8( "Length" ) ); + + Layout1->addWidget( RB_Dir21, 0, 0 ); + + GroupDir2Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir2_QTDLayout->addWidget( GroupDir2, 0, 0 ); + + // tab order + setTabOrder( RB_Dir21, RB_Dir22 ); + setTabOrder( RB_Dir22, RB_Dir23 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir2_QTD::~EntityGUI_Dir2_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.h b/src/EntityGUI/EntityGUI_Dir2_QTD.h new file mode 100644 index 000000000..55dae2004 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.h @@ -0,0 +1,59 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR2_QTD_H +#define ENTITYGUI_DIR2_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir2_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir2_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir2_QTD(); + + QButtonGroup* GroupDir2; + QRadioButton* RB_Dir22; + QRadioButton* RB_Dir23; + QRadioButton* RB_Dir21; + + +protected: + QGridLayout* EntityGUI_Dir2_QTDLayout; + QGridLayout* GroupDir2Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR2_QTD_H diff --git a/src/EntityGUI/EntityGUI_Point_QTD.cxx b/src/EntityGUI/EntityGUI_Point_QTD.cxx new file mode 100644 index 000000000..0d2680e7a --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.cxx @@ -0,0 +1,93 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Point_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Point_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Point_QTD::EntityGUI_Point_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Point_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Point_QTD" ) ); + EntityGUI_Point_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Point_QTDLayout"); + + GroupPoint = new QButtonGroup( this, "GroupPoint" ); + GroupPoint->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupPoint->sizePolicy().hasHeightForWidth() ) ); + GroupPoint->setTitle( trUtf8( "Point" ) ); + GroupPoint->setColumnLayout(0, Qt::Vertical ); + GroupPoint->layout()->setSpacing( 6 ); + GroupPoint->layout()->setMargin( 11 ); + GroupPointLayout = new QGridLayout( GroupPoint->layout() ); + GroupPointLayout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Point2 = new QRadioButton( GroupPoint, "RB_Point2" ); + RB_Point2->setText( trUtf8( "Relative" ) ); + + Layout1->addWidget( RB_Point2, 1, 0 ); + + RB_Point1 = new QRadioButton( GroupPoint, "RB_Point1" ); + RB_Point1->setText( trUtf8( "Absolute" ) ); + + Layout1->addWidget( RB_Point1, 0, 0 ); + + RB_Point3 = new QRadioButton( GroupPoint, "RB_Point3" ); + RB_Point3->setText( trUtf8( "Selection" ) ); + + Layout1->addWidget( RB_Point3, 2, 0 ); + + GroupPointLayout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Point_QTDLayout->addWidget( GroupPoint, 0, 0 ); + + // tab order + setTabOrder( RB_Point1, RB_Point2 ); + setTabOrder( RB_Point2, RB_Point3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Point_QTD::~EntityGUI_Point_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Point_QTD.h b/src/EntityGUI/EntityGUI_Point_QTD.h new file mode 100644 index 000000000..14e7b37d6 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.h @@ -0,0 +1,59 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_POINT_QTD_H +#define ENTITYGUI_POINT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Point_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Point_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Point_QTD(); + + QButtonGroup* GroupPoint; + QRadioButton* RB_Point2; + QRadioButton* RB_Point1; + QRadioButton* RB_Point3; + + +protected: + QGridLayout* EntityGUI_Point_QTDLayout; + QGridLayout* GroupPointLayout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_POINT_QTD_H diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..65e0b2444 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx @@ -0,0 +1,195 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Skeleton_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +EntityGUI_Skeleton_QTD::EntityGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "EntityGUI_Skeleton_QTD" ); + resize( 317, 276 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "EntityGUI_Skeleton_QTD" ) ); + EntityGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "EntityGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupVal = new QGroupBox( this, "GroupVal" ); + GroupVal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupVal->sizePolicy().hasHeightForWidth() ) ); + GroupVal->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupVal, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "Element Type" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "Segment" ) ); + Layout2->addWidget( RadioButton1 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "Arc" ) ); + Layout2->addWidget( RadioButton2 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupDest = new QGroupBox( this, "GroupDest" ); + GroupDest->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest->sizePolicy().hasHeightForWidth() ) ); + GroupDest->setTitle( trUtf8( "Destination" ) ); + GroupDest->setColumnLayout(0, Qt::Vertical ); + GroupDest->layout()->setSpacing( 6 ); + GroupDest->layout()->setMargin( 11 ); + GroupDestLayout = new QGridLayout( GroupDest->layout() ); + GroupDestLayout->setAlignment( Qt::AlignTop ); + + Layout5 = new QGridLayout( 0, 1, 1, 0, 6, "Layout5"); + + GroupDest1 = new QButtonGroup( GroupDest, "GroupDest1" ); + GroupDest1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest1->sizePolicy().hasHeightForWidth() ) ); + GroupDest1->setTitle( trUtf8( "Type" ) ); + GroupDest1->setColumnLayout(0, Qt::Vertical ); + GroupDest1->layout()->setSpacing( 6 ); + GroupDest1->layout()->setMargin( 11 ); + GroupDest1Layout = new QGridLayout( GroupDest1->layout() ); + GroupDest1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + RB_Dest2 = new QRadioButton( GroupDest1, "RB_Dest2" ); + RB_Dest2->setText( trUtf8( "Direction" ) ); + + Layout4->addWidget( RB_Dest2, 0, 1 ); + + RB_Dest1 = new QRadioButton( GroupDest1, "RB_Dest1" ); + RB_Dest1->setText( trUtf8( "Point" ) ); + + Layout4->addWidget( RB_Dest1, 0, 0 ); + + GroupDest1Layout->addLayout( Layout4, 0, 0 ); + + Layout5->addMultiCellWidget( GroupDest1, 0, 0, 0, 1 ); + + GroupDest2 = new QButtonGroup( GroupDest, "GroupDest2" ); + GroupDest2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest2->sizePolicy().hasHeightForWidth() ) ); + GroupDest2->setTitle( trUtf8( "" ) ); + GroupDest2->setColumnLayout(0, Qt::Vertical ); + GroupDest2->layout()->setSpacing( 6 ); + GroupDest2->layout()->setMargin( 11 ); + GroupDest2Layout = new QGridLayout( GroupDest2->layout() ); + GroupDest2Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest2, 1, 0 ); + + GroupDest3 = new QButtonGroup( GroupDest, "GroupDest3" ); + GroupDest3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest3->sizePolicy().hasHeightForWidth() ) ); + GroupDest3->setTitle( trUtf8( "" ) ); + GroupDest3->setColumnLayout(0, Qt::Vertical ); + GroupDest3->layout()->setSpacing( 6 ); + GroupDest3->layout()->setMargin( 11 ); + GroupDest3Layout = new QGridLayout( GroupDest3->layout() ); + GroupDest3Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest3, 1, 1 ); + + GroupDestLayout->addLayout( Layout5, 0, 0 ); + + Layout1->addWidget( GroupDest, 1, 0 ); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonEnd = new QPushButton( GroupButtons, "buttonEnd" ); + buttonEnd->setText( trUtf8( "End Sketch" ) ); + Layout3->addWidget( buttonEnd ); + + buttonClose = new QPushButton( GroupButtons, "buttonClose" ); + buttonClose->setText( trUtf8( "Close Sketch" ) ); + Layout3->addWidget( buttonClose ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + Layout1->addWidget( GroupButtons, 3, 0 ); + + EntityGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); + + // tab order + setTabOrder( RadioButton1, RadioButton2 ); + setTabOrder( RadioButton2, RB_Dest1 ); + setTabOrder( RB_Dest1, RB_Dest2 ); + setTabOrder( RB_Dest2, buttonEnd ); + setTabOrder( buttonEnd, buttonClose ); + setTabOrder( buttonClose, buttonCancel ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Skeleton_QTD::~EntityGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.h b/src/EntityGUI/EntityGUI_Skeleton_QTD.h new file mode 100644 index 000000000..df965cddc --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.h @@ -0,0 +1,80 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:07 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_SKELETON_QTD_H +#define ENTITYGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class EntityGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + EntityGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~EntityGUI_Skeleton_QTD(); + + QGroupBox* GroupVal; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupDest; + QButtonGroup* GroupDest1; + QRadioButton* RB_Dest2; + QRadioButton* RB_Dest1; + QButtonGroup* GroupDest2; + QButtonGroup* GroupDest3; + QGroupBox* GroupButtons; + QPushButton* buttonEnd; + QPushButton* buttonClose; + QPushButton* buttonCancel; + + +protected: + QGridLayout* EntityGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; + QGridLayout* GroupDestLayout; + QGridLayout* Layout5; + QGridLayout* GroupDest1Layout; + QGridLayout* Layout4; + QGridLayout* GroupDest2Layout; + QGridLayout* GroupDest3Layout; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; +}; + +#endif // ENTITYGUI_SKELETON_QTD_H diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx new file mode 100644 index 000000000..0e6a141d5 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -0,0 +1,1406 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : EntityGUI_SketcherDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_SketcherDlg.h" +#include "Sketcher_Profile.hxx" +#include "GEOM_Displayer.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : EntityGUI_SketcherDlg() +// purpose : Constructs a EntityGUI_SketcherDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myIsAllAdded( false ), + GEOMBase_Helper( dynamic_cast( parent ) ), + myGeometryGUI( GUI ) +{ + myGeometryGUI->SetActiveDialogBox(this); + + if ( !name ) setName("EntityGUI_SketcherDlg"); + + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonEnd->setText(tr("GEOM_BUT_END_SKETCH")); + buttonClose->setText(tr("GEOM_BUT_CLOSE_SKETCH")); + + GroupVal->close(TRUE); + GroupDest2->close(TRUE); + GroupDest3->close(TRUE); + + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_UNDO"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REDO"))); + + setCaption(tr("GEOM_SKETCHER_TITLE")); + + GroupConstructors->setTitle(tr("GEOM_SKETCHER_EL")); + RadioButton1->setText(tr("GEOM_SKETCHER_SEGMENT")); + RadioButton2->setText(tr("GEOM_SKETCHER_ARC")); + GroupDest->setTitle(tr("GEOM_SKETCHER_DEST")); + GroupDest1->setTitle(tr("GEOM_SKETCHER_TYPE")); + RB_Dest1->setText(tr("GEOM_SKETCHER_POINT")); + RB_Dest2->setText(tr("GEOM_SKETCHER_DIR")); + + /***************************************************************/ + GroupPt = new EntityGUI_Point_QTD(GroupDest, "GroupPt"); + GroupPt->GroupPoint->setTitle(tr("GEOM_SKETCHER_POINT")); + GroupPt->RB_Point1->setText(tr("GEOM_SKETCHER_ABS")); + GroupPt->RB_Point2->setText(tr("GEOM_SKETCHER_REL")); + GroupPt->RB_Point3->setText(tr("GEOM_SKETCHER_SEL")); + + GroupD1 = new EntityGUI_Dir1_QTD(GroupDest, "GroupD1"); + GroupD1->GroupDir1->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD1->RB_Dir11->setText(tr("GEOM_SKETCHER_ANGLE")); + GroupD1->RB_Dir12->setText(tr("GEOM_SKETCHER_PER")); + GroupD1->RB_Dir13->setText(tr("GEOM_SKETCHER_TAN")); + GroupD1->RB_Dir14->setText(tr("GEOM_SKETCHER_VXVY")); + + GroupD2 = new EntityGUI_Dir2_QTD(GroupDest, "GroupD2"); + GroupD2->GroupDir2->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD2->RB_Dir21->setText(tr("GEOM_SKETCHER_LENGTH")); + GroupD2->RB_Dir22->setText(tr("GEOM_SKETCHER_X")); + GroupD2->RB_Dir23->setText(tr("GEOM_SKETCHER_Y")); + + Group1Sel = new EntityGUI_1Sel_QTD(this, "Group1Sel"); + Group1Sel->TextLabel1->setText(tr("GEOM_SKETCHER_POINT2")); + Group1Sel->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Sel->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group1Sel->PushButton1->setPixmap(image0); + Group1Sel->buttonUndo->setPixmap(image1); + Group1Sel->buttonRedo->setPixmap(image2); + Group1Sel->LineEdit1->setReadOnly( true ); + + Group1Spin = new EntityGUI_1Spin(this, "Group1Spin"); + Group1Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group1Spin->buttonUndo->setPixmap(image1); + Group1Spin->buttonRedo->setPixmap(image2); + + Group2Spin = new EntityGUI_2Spin(this, "Group2Spin"); + Group2Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group2Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group2Spin->buttonUndo->setPixmap(image1); + Group2Spin->buttonRedo->setPixmap(image2); + + Group3Spin = new EntityGUI_3Spin(this, "Group3Spin"); + Group3Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group3Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group3Spin->buttonUndo->setPixmap(image1); + Group3Spin->buttonRedo->setPixmap(image2); + + Group4Spin = new EntityGUI_4Spin(this, "Group4Spin"); + Group4Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group4Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group4Spin->buttonUndo->setPixmap(image1); + Group4Spin->buttonRedo->setPixmap(image2); + + Layout5->addMultiCellWidget(GroupPt, 1, 1, 0, 1); + Layout5->addWidget(GroupD1, 1, 0); + Layout5->addWidget(GroupD2, 1, 1); + + Layout1->addWidget(Group1Sel, 2, 0); + Layout1->addWidget(Group1Spin, 2, 0); + Layout1->addWidget(Group2Spin, 2, 0); + Layout1->addWidget(Group3Spin, 2, 0); + Layout1->addWidget(Group4Spin, 2, 0); + /***************************************************************/ + + /* signals and slots connections */ + connect(buttonEnd, SIGNAL(clicked()), this, SLOT(ClickOnEnd())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnEnd())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + + connect(Group1Sel->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Sel->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group1Sel->buttonRedo, SIGNAL(clicked()), this, SLOT(ClickOnRedo())); + connect(Group1Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group1Spin->buttonRedo, SIGNAL(clicked()), this, SLOT(ClickOnRedo())); + connect(Group2Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group2Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group2Spin->buttonRedo, SIGNAL(clicked()), this, SLOT(ClickOnRedo())); + connect(Group3Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group3Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group3Spin->buttonRedo, SIGNAL(clicked()), this, SLOT(ClickOnRedo())); + connect(Group4Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group4Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group4Spin->buttonRedo, SIGNAL(clicked()), this, SLOT(ClickOnRedo())); + + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(TypeClicked(int))); + connect(GroupDest1, SIGNAL(clicked(int)), this, SLOT(DestClicked(int))); + connect(GroupPt->GroupPoint, SIGNAL(clicked(int)), this, SLOT(PointClicked(int))); + connect(GroupD1->GroupDir1, SIGNAL(clicked(int)), this, SLOT(Dir1Clicked(int))); + connect(GroupD2->GroupDir2, SIGNAL(clicked(int)), this, SLOT(Dir2Clicked(int))); + + connect(Group1Sel->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1Sel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DS, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DS, SLOT(SetStep(double))); + + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + Init(); +} + + +//================================================================================= +// function : ~EntityGUI_SketcherDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() +{ + myGeometryGUI->SetActiveDialogBox( 0 ); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = Group1Sel->LineEdit1; + myCommand.append( "Sketcher" ); + myUndoCommand.append( "Sketcher" ); + + mySketchState = FIRST_POINT; + globalSelection( GEOM_POINT ); + + myLastX1 = 0.0; + myLastY1 = 0.0; + myLastX2 = 0.0; + myLastY2 = 0.0; + + /* Get setting of step value from file configuration */ + double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); + + /* min, max, step and decimals for spin boxes */ + Group1Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group4Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 0.1, 3); + Group4Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 0.1, 3); + Group4Spin->SpinBox_DZ->RangeStepAndValidator(-999999.999, 999999.999, step, 3); + Group4Spin->SpinBox_DS->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + + /* displays Dialog */ + GroupConstructors->setEnabled(false); + GroupDest1->setEnabled(false); + setEnabledUndo(false); + setEnabledRedo(false); + + RadioButton1->setChecked(true); + + resize( 0, 0 ); + TypeClicked(0); + + GEOMBase_Helper::displayPreview(); +} + + +//================================================================================= +// function : InitClick() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::InitClick() +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + Group1Sel->hide(); + Group1Spin->hide(); + Group2Spin->hide(); + Group3Spin->hide(); + Group4Spin->hide(); + + resize(0, 0); +} + + +//================================================================================= +// function : TypeClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::TypeClicked(int constructorId) +{ + myConstructorId = constructorId; + if ( myConstructorId == 0 ) // SEGMENT + { + GroupD2->setEnabled(true); + RB_Dest1->setEnabled(true); + RB_Dest1->setChecked(true); + DestClicked(1); + } + else if ( myConstructorId == 1 ) // ARC + { + GroupD2->setEnabled(false); + RB_Dest1->setEnabled(false); + RB_Dest2->setChecked(true); + DestClicked(0); + } +} + + +//================================================================================= +// function : DestClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::DestClicked( int constructorId ) +{ + GroupPt->hide(); + GroupD1->hide(); + GroupD2->hide(); + + if ( constructorId == 1 ) + { // Point + GroupPt->RB_Point1->setChecked(true); + GroupPt->show(); + PointClicked(1); // XY + } + else if ( constructorId == 0 ) + { // Direction + GroupD1->RB_Dir11->setChecked(true); + GroupD1->show(); + GroupD2->show(); + Dir1Clicked(2); // Angle + } +} + + +//================================================================================= +// function : PointClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::PointClicked(int constructorId) +{ + InitClick(); + + if ( myConstructorId == 0 ) + { // SEGMENT + if ( constructorId == 1 ) + { // XY + mySketchType = PT_ABS; + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); + myX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myX); + myY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview(); + } + else if ( constructorId == 0 ) + { // DXDY + mySketchType = PT_RELATIVE; + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); + myDX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myDY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + + GEOMBase_Helper::displayPreview(); + } + else if ( constructorId == 2 ) + { // Selection + mySketchType = PT_SEL; + myEditCurrentArgument = Group1Sel->LineEdit1; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + Group1Sel->show(); + Group1Sel->buttonApply->setFocus(); + SelectionIntoArgument(); + } + } +} + + +//================================================================================= +// function : Dir1Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir1Clicked(int constructorId) +{ + myConstructorDirId = constructorId; + GroupD2->RB_Dir21->setChecked(true); + Dir2Clicked(2); +} + + +//================================================================================= +// function : Dir2Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) +{ + InitClick(); + myAngle = 0.0; + + if ( myConstructorId == 0 ) + { // SEGMENT + myX = 0.0; + myY = 0.0; + myLength = 100.0; + if ( myConstructorDirId == 2 ) + { // Angle + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group2Spin->SpinBox_DX->SetValue(myAngle); + Group2Spin->buttonApply->setFocus(); + Group2Spin->show(); + + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group2Spin->SpinBox_DY->SetValue(myLength); + } + else if ( constructorId == 0 ) + { // X + mySketchType = DIR_ANGLE_X; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_X3")); + Group2Spin->SpinBox_DY->SetValue(myX); + } + else if ( constructorId == 1 ) + { // Y + mySketchType = DIR_ANGLE_Y; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y3")); + Group2Spin->SpinBox_DY->SetValue(myY); + } + } + else if ( myConstructorDirId == 0 ) + { // Perpendicular + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_PER_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if ( constructorId == 0 ) + { // X + mySketchType = DIR_PER_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if ( constructorId == 1 ) + { // Y + mySketchType = DIR_PER_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if ( myConstructorDirId == 1 ) + { // Tangent + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_TAN_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if ( constructorId == 0 ) + { // X + mySketchType = DIR_TAN_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if ( constructorId == 1 ) + { // Y + mySketchType = DIR_TAN_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if ( myConstructorDirId == 3 ) + { // DXDY + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 0.1, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 0.1, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + myDX = 0.0; + Group3Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group3Spin->SpinBox_DY->SetValue(myDY); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_DXDY_LENGTH; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group3Spin->SpinBox_DZ->SetValue(myLength); + } + else if ( constructorId == 0 ) + { // X + mySketchType = DIR_DXDY_X; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_X3")); + Group3Spin->SpinBox_DZ->SetValue(myX); + } + else if ( constructorId == 1 ) + { // Y + mySketchType = DIR_DXDY_Y; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_Y3")); + Group3Spin->SpinBox_DZ->SetValue(myY); + } + } + } + else if ( myConstructorId == 1 ) + { // ARC + if ( myConstructorDirId == 2 ) + { // Angle + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->SpinBox_DX->SetValue(myAngle); + myRadius = 100.0; + Group3Spin->SpinBox_DY->SetValue(myRadius); + myLength = 30.0; + Group3Spin->SpinBox_DZ->SetValue(myLength); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + } + } + else if ( myConstructorDirId == 0 ) + { // Perpendicular + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_PER_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if ( myConstructorDirId == 1 ) + { // Tangent + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_TAN_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 100., 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999999.999, 999999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if ( myConstructorDirId == 3 ) + { // DXDY + if ( constructorId == 2 ) + { // Length + mySketchType = DIR_DXDY_LENGTH; + Group4Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group4Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + Group4Spin->TextLabel3->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group4Spin->TextLabel4->setText(tr("GEOM_SKETCHER_ANGLE2")); + myDX = 0.0; + Group4Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group4Spin->SpinBox_DY->SetValue(myDY); + myRadius = 100.0; + Group4Spin->SpinBox_DZ->SetValue(myRadius); + myLength = 30.0; + Group4Spin->SpinBox_DS->SetValue(myLength); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); + } + } + } + + GEOMBase_Helper::displayPreview(); +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnCancel() +{ + close(); +} + + +//================================================================================= +// function : ClickOnEnd() +// purpose : connected to buttonEnd AND buttonClose +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnEnd() +{ + if ( sender() == buttonClose ) + { + // Verify validity of commands + if ( myCommand.count() <= 2 ) + { + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), + tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) ); + return; + } + + QString Command = myCommand.join( "" ) + GetNewCommand(); + Sketcher_Profile aProfile (Command.ascii()); + + Command = myCommand.join( "" ); + aProfile = Sketcher_Profile(Command.ascii()); + TopoDS_Shape myShape; + if ( aProfile.IsDone() ) + myShape = aProfile.GetShape(); + + if(myShape.ShapeType() != TopAbs_VERTEX) + myCommand.append( ":WW" ); + } + else + myIsAllAdded = true; + + if( myCommand.size() > 2 ) + if( !onAccept() ) + return; + + close(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool EntityGUI_SketcherDlg::ClickOnApply() +{ + myCommand.append( GetNewCommand() ); + mySketchState = NEXT_POINT; + + myUndoCommand.clear(); + myUndoCommand.append( "Sketcher" ); + + GroupConstructors->setEnabled(true); + GroupDest1->setEnabled(true); + setEnabledUndo(true); + setEnabledRedo(false); + + GEOMBase_Helper::displayPreview(); + + return true; +} + +//================================================================================= +// function : ClickOnUndo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnUndo() +{ + myUndoCommand.append( myCommand.last() ); + myCommand.pop_back(); + + if(myCommand.count() == 1) { + mySketchState = FIRST_POINT; + + RadioButton1->setChecked(true); + TypeClicked(0); + + GroupConstructors->setEnabled(false); + GroupDest1->setEnabled(false); + setEnabledUndo(false); + } + + setEnabledRedo(true); + + GEOMBase_Helper::displayPreview(); +} + +//================================================================================= +// function : ClickOnRedo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnRedo() +{ + myCommand.append( myUndoCommand.last() ); + myUndoCommand.pop_back(); + + mySketchState = NEXT_POINT; + + GroupConstructors->setEnabled(true); + GroupDest1->setEnabled(true); + setEnabledUndo(true); + + if(myUndoCommand.count() == 1) + setEnabledRedo(false); + + GEOMBase_Helper::displayPreview(); +} + +//================================================================================= +// function : setEnabledUndo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::setEnabledUndo(bool value) +{ + Group1Sel->buttonUndo->setEnabled(value); + Group1Spin->buttonUndo->setEnabled(value); + Group2Spin->buttonUndo->setEnabled(value); + Group3Spin->buttonUndo->setEnabled(value); + Group4Spin->buttonUndo->setEnabled(value); +} + +//================================================================================= +// function : setEnabledRedo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::setEnabledRedo(bool value) +{ + Group1Sel->buttonRedo->setEnabled(value); + Group1Spin->buttonRedo->setEnabled(value); + Group2Spin->buttonRedo->setEnabled(value); + Group3Spin->buttonRedo->setEnabled(value); + Group4Spin->buttonRedo->setEnabled(value); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed +//================================================================================= +void EntityGUI_SketcherDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + myX = myLastX1; + myY = myLastY1; + + int nbSel = IObjectCount(); + if ( nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1 ) + { + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_VERTEX ) ) { + gp_Trsf aTrans; + gp_Ax3 aWPlane = myGeometryGUI->GetWorkingPlane(); + + aTrans.SetTransformation(aWPlane); + BRepBuilderAPI_Transform aTransformation(aShape, aTrans, Standard_False); + aShape = aTransformation.Shape(); + + gp_Pnt aPnt; + if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) { + myX = aPnt.X(); + myY = aPnt.Y(); + Group1Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } + } + } + } + + GEOMBase_Helper::displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::SetEditCurrentArgument() +{ + if ( sender() == Group1Sel->PushButton1 ) + { + myEditCurrentArgument = Group1Sel->LineEdit1; + myEditCurrentArgument->setFocus(); + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::LineEditReturnPressed() +{ + if ( sender() == Group1Sel->LineEdit1 ) + { + myEditCurrentArgument = Group1Sel->LineEdit1; + + /* User name of object input management */ + /* If successfull the selection is changed and signal emitted... */ + /* so SelectionIntoArgument() is automatically called. */ + const QString objectUserName = myEditCurrentArgument->text(); + QWidget* thisWidget = (QWidget*)this; + if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO())) + myEditCurrentArgument->setText(objectUserName); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::DeactivateActiveDialog() +{ + //myGeometryGUI->SetState( -1 ); + + setEnabled( false ); + globalSelection(); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + myGeometryGUI->SetActiveDialogBox(0); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ActivateThisDialog() +{ + myGeometryGUI->EmitSignalDeactivateDialog(); + setEnabled(true); + myGeometryGUI->SetActiveDialogBox((QDialog*)this); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + //myGeometryGUI->SetState( 0 ); + globalSelection( GEOM_POINT ); + + myEditCurrentArgument = Group1Sel->LineEdit1; + myEditCurrentArgument->setFocus(); + + GEOMBase_Helper::displayPreview(); +} + + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::closeEvent(QCloseEvent* e) +{ + //myGeometryGUI->SetState( -1 ); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + QDialog::closeEvent( e ); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + Standard_Real vx, vy, vz, vs; + vx = vy = vz = vs = 0.0; + + if ( send == Group1Spin->SpinBox_DX) + { + vx = newValue; + } + else if ( send == Group2Spin->SpinBox_DX ) + { + vx = newValue; + vy = Group2Spin->SpinBox_DY->GetValue(); + } + else if ( send == Group2Spin->SpinBox_DY) + { + vx = Group2Spin->SpinBox_DX->GetValue(); + vy = newValue; + } + else if ( send == Group3Spin->SpinBox_DX) + { + vx = newValue; + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if ( send == Group3Spin->SpinBox_DY) + { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if ( send == Group3Spin->SpinBox_DZ) + { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = newValue; + } + else if ( send == Group4Spin->SpinBox_DX) + { + vx = newValue; + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( send == Group4Spin->SpinBox_DY) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( send == Group4Spin->SpinBox_DZ) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = newValue; + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if ( send == Group4Spin->SpinBox_DS) + { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = newValue; + } + + if ( myConstructorId == 0 ) + { // SEGMENT + if ( mySketchType == PT_ABS) + { + myX = vx; + myY = vy; + } + else if ( mySketchType == PT_RELATIVE) + { + myDX = vx; + myDY = vy; + } + else if ( mySketchType == DIR_ANGLE_LENGTH) + { + myAngle = vx; + myLength = vy; + } + else if ( mySketchType == DIR_ANGLE_X) + { + myAngle = vx; + myX = vy; + } + else if ( mySketchType == DIR_ANGLE_Y) + { + myAngle = vx; + myY = vy; + } + else if ( mySketchType == DIR_PER_LENGTH) + { + myLength = vx; + } + else if ( mySketchType == DIR_PER_X) + { + myX = vx; + } + else if ( mySketchType == DIR_PER_Y) + { + myY = vx; + } + else if ( mySketchType == DIR_TAN_LENGTH) + { + myLength = vx; + } + else if ( mySketchType == DIR_TAN_X) + { + myX = vx; + } + else if ( mySketchType == DIR_TAN_Y) + { + myY = vx; + } + else if ( mySketchType == DIR_DXDY_LENGTH) + { + myDX = vx; + myDY = vy; + myLength = vz; + } + else if ( mySketchType == DIR_DXDY_X) + { + myDX = vx; + myDY = vy; + myX = vz; + } + else if ( mySketchType == DIR_DXDY_Y) + { + myDX = vx; + myDY = vy; + myY = vz; + } + } + else if ( myConstructorId == 1 ) + { // ARC + if ( mySketchType == DIR_ANGLE_LENGTH) + { + myAngle = vx; + myRadius = vy; + myLength = vz; + } + else if ( mySketchType == DIR_PER_LENGTH) + { + myRadius = vx; + myLength = vy; + } + else if ( mySketchType == DIR_TAN_LENGTH) + { + myRadius = vx; + myLength = vy; + } + else if ( mySketchType == DIR_DXDY_LENGTH) + { + myDX = vx; + myDY = vy; + myRadius = vz; + myLength = vs; + } + } + + GEOMBase_Helper::displayPreview(); +} + + +//================================================================================= +// function : GetNewCommand() +// purpose : Build the new command with context +//================================================================================= +QString EntityGUI_SketcherDlg::GetNewCommand() +{ + QString myNewCommand = ":"; + if ( mySketchState == FIRST_POINT ) { + if ( mySketchType == PT_ABS || mySketchType == PT_SEL) + myNewCommand = myNewCommand + "F " + QString::number(myX) + " " + QString::number(myY); + if ( mySketchType == PT_RELATIVE) + myNewCommand = myNewCommand + "F " + QString::number(myDX) + " " + QString::number(myDY); + return myNewCommand; + } + + if ( myConstructorId == 0 ) + { // SEGMENT + if ( mySketchType == PT_ABS || mySketchType == PT_SEL) + myNewCommand = myNewCommand + "TT " + QString::number(myX) + " " + QString::number(myY); + if ( mySketchType == PT_RELATIVE) + myNewCommand = myNewCommand + "T " + QString::number(myDX) + " " + QString::number(myDY); + if ( mySketchType == DIR_ANGLE_LENGTH) + { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if ( mySketchType == DIR_ANGLE_X) + { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if ( mySketchType == DIR_ANGLE_Y) + { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if ( mySketchType == DIR_PER_LENGTH) + { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if ( mySketchType == DIR_PER_X) + { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if ( mySketchType == DIR_PER_Y) + { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if ( mySketchType == DIR_TAN_LENGTH) + myNewCommand = myNewCommand + "L " + QString::number(myLength); + if ( mySketchType == DIR_TAN_X) + myNewCommand = myNewCommand + "IX " + QString::number(myX); + if ( mySketchType == DIR_TAN_Y) + myNewCommand = myNewCommand + "IY " + QString::number(myY); + if ( mySketchType == DIR_DXDY_LENGTH) + { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if ( mySketchType == DIR_DXDY_X) + { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if ( mySketchType == DIR_DXDY_Y) + { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + } + else if ( myConstructorId == 1 ) + { // ARC + if ( mySketchType == DIR_ANGLE_LENGTH) + { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if ( mySketchType == DIR_PER_LENGTH) + { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if ( mySketchType == DIR_TAN_LENGTH) + { + myNewCommand = myNewCommand + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if ( mySketchType == DIR_DXDY_LENGTH) + { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + } + return myNewCommand; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation() +{ + return getGeomEngine()->GetICurvesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool EntityGUI_SketcherDlg::isValid( QString& msg ) +{ + return true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) +{ + if(mySketchState == FIRST_POINT) { + myLastX2 = myX; + myLastY2 = myY; + } + else { + //Test if the current point is the same as the last one + TopoDS_Shape myShape1, myShape2; + + //Last Shape + QString Command1 = myCommand.join( "" ); + Sketcher_Profile aProfile1 (Command1.ascii()); + if(aProfile1.IsDone()) + myShape1 = aProfile1.GetShape(); + + //Current Shape + QString Command2 = Command1 + GetNewCommand(); + Sketcher_Profile aProfile2 (Command2.ascii()); + if(aProfile2.IsDone()) + myShape2 = aProfile2.GetShape(); + + if(myShape2.IsNull()) { + //the current point is the same as the last one + myLastX2 = myLastX1; + myLastY2 = myLastY1; + } + else { + TopoDS_Vertex V1, V2; + gp_Pnt pt; + if(myShape1.ShapeType() == TopAbs_VERTEX) { + //the last shape is the first point + pt = BRep_Tool::Pnt(TopoDS::Vertex(myShape1)); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + } + else { + TopExp::Vertices(TopoDS::Wire(myShape1), V1, V2); + pt = BRep_Tool::Pnt(V2); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + } + TopExp::Vertices(TopoDS::Wire(myShape2), V1, V2); + pt = BRep_Tool::Pnt(V2); + myLastX2 = pt.X(); + myLastY2 = pt.Y(); + } + } + + QString cmd; + if( ( mySketchState != FIRST_POINT && myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) { + cmd = myCommand.join( "" ); + + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(false); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(false); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(false); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(false); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(false); + Group4Spin->buttonApply->setFocus(); + } + } + else { + cmd = myCommand.join( "" ) + GetNewCommand(); + + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(true); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(true); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(true); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(true); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(true); + Group4Spin->buttonApply->setFocus(); + } + } + + gp_Ax3 myWPlane = myGeometryGUI->GetWorkingPlane(); + GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble; + WPlane->length(9); + WPlane[0] = myWPlane.Location().X(); + WPlane[1] = myWPlane.Location().Y(); + WPlane[2] = myWPlane.Location().Z(); + + WPlane[3] = myWPlane.Direction().X(); + WPlane[4] = myWPlane.Direction().Y(); + WPlane[5] = myWPlane.Direction().Z(); + + WPlane[6] = myWPlane.XDirection().X(); + WPlane[7] = myWPlane.XDirection().Y(); + WPlane[8] = myWPlane.XDirection().Z(); + + GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.latin1(), WPlane ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + +//================================================================ +// Function : displayPreview +// Purpose : Method for displaying preview of resulting shape +// Redefined from GEOMBase_Helper. +//================================================================ +void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, + const bool append, + const bool activate, + const bool update, + const double lineWidth ) +{ + // Set color for preview shape + getDisplayer()->SetColor( Quantity_NOC_RED ); + + // set width of displayed shape + getDisplayer()->SetWidth( lineWidth ); + + // Disable activation of selection + getDisplayer()->SetToActivate( activate ); + + // Make a reference to GEOM_Object + getDisplayer()->SetName( myGeometryGUI->getApp()->orb()->object_to_string( object ) ); + + // Create wire from applayed object + TopoDS_Shape anApplyedWire, aLastSegment; + if ( !createShapes( object, anApplyedWire, aLastSegment ) ) + return; + + // Build prs + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); + if ( aPrs != 0 && !aPrs->IsNull() ) + GEOMBase_Helper::displayPreview( aPrs, append, update ); + + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + aPrs = getDisplayer()->BuildPrs( aLastSegment ); + if ( aPrs != 0 && !aPrs->IsNull() ) + GEOMBase_Helper::displayPreview( aPrs, append, update ); + + getDisplayer()->UnsetName(); + + // Enable activation of displayed objects + getDisplayer()->SetToActivate( true ); +} + +//================================================================ +// Function : createShapes +// Purpose : Create applyed wire, and last segment from entry object +//================================================================ +bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, + TopoDS_Shape& theApplyedWire, + TopoDS_Shape& theLastSegment ) +{ + TopoDS_Shape aShape; + if ( !GEOMBase::GetShape( theObject, aShape ) || + aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX ) + return false; + + if ( Group1Sel->isVisible() && !Group1Sel->buttonApply->isEnabled() || + Group1Spin->isVisible() && !Group1Spin->buttonApply->isEnabled() || + Group2Spin->isVisible() && !Group2Spin->buttonApply->isEnabled() || + Group3Spin->isVisible() && !Group3Spin->buttonApply->isEnabled() || + Group4Spin->isVisible() && !Group4Spin->buttonApply->isEnabled() ) + { + theApplyedWire = aShape; + return true; + } + + BRepBuilderAPI_MakeWire aBuilder; + TopExp_Explorer anExp( aShape, TopAbs_EDGE ); + while( 1 ) + { + TopoDS_Shape anEdge = anExp.Current(); + anExp.Next(); + if ( anExp.More() ) // i.e. non-last edge + aBuilder.Add( TopoDS::Edge( anEdge ) ); + else + { + theLastSegment = anEdge; + break; + } + } + + if ( aBuilder.IsDone() ) + theApplyedWire = aBuilder.Shape(); + + return true; +} + + + + + + + + diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx new file mode 100644 index 000000000..27c0b6c87 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -0,0 +1,596 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : EntityGUI_SubShapeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "EntityGUI_SubShapeDlg.h" +#include "GEOM_Displayer.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "OCCViewer_ViewModel.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include +#include +#include +#include + +#include +#include +#include + +//================================================================================= +// class : EntityGUI_SubShapeDlg +// purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SUBSHAPE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SUB_SHAPE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Check1List_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE")); + GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~EntityGUI_SubShapeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_SubShapeDlg::~EntityGUI_SubShapeDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + myObject = GEOM::GEOM_Object::_nil(); + + myWithShape = true; + + /* type for sub shape selection */ + GroupPoints->ComboBox1->insertItem("Compound"); + GroupPoints->ComboBox1->insertItem("Compsolid"); + GroupPoints->ComboBox1->insertItem("Solid"); + GroupPoints->ComboBox1->insertItem("Shell"); + GroupPoints->ComboBox1->insertItem("Face"); + GroupPoints->ComboBox1->insertItem("Wire"); + GroupPoints->ComboBox1->insertItem("Edge"); + GroupPoints->ComboBox1->insertItem("Vertex"); + GroupPoints->ComboBox1->insertItem("Shape"); + + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) + GroupPoints->CheckButton1->setEnabled(false); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + updateButtonState(); + + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool EntityGUI_SubShapeDlg::ClickOnApply() +{ + SUIT_Session::session()->activeApplication()->putInfo(tr("")); + + /* Explode all sub shapes */ + if( isAllSubShapes() ) { + /* More than 30 subshapes : ask confirmation */ + unsigned int nb = NumberOfSubShapes(myShape, shapeType()); + if(nb > 30) { + const QString caption = tr("GEOM_CONFIRM"); + const QString text = tr("GEOM_CONFIRM_INFO").arg(nb); + const QString button0 = tr("GEOM_BUT_EXPLODE"); + const QString button1 = tr("GEOM_BUT_CANCEL"); + + if(QMessageBox::warning(this, caption, text, button0, button1) != 0) + return false; /* aborted */ + } + } + + return onAccept(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void EntityGUI_SubShapeDlg::SelectionIntoArgument() +{ + if ( !isAllSubShapes() ) + return; + + ResetStateOfDialog(); + + QString aString = ""; /* name of selection */ + + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); + if( nbSel != 1 ) + return; + + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = firstIObject(); + if ( !IO->hasEntry() ) + { + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); + updateButtonState(); + return; + } + + if ( !myGeomBase->GetTopoFromSelection( selectedIO(), S ) || + S.IsNull() || + S.ShapeType() == TopAbs_VERTEX ) + { + updateButtonState(); + return; + } + + + Standard_Boolean testResult; + myObject = GEOMBase::ConvertIOinGEOMObject( IO, testResult ); + if ( !testResult || myObject->_is_nil() ) + { + updateButtonState(); + return; + } + + myShape = S; + GroupPoints->LineEdit1->setText( aString ); + + + int SelectedShapeType = GroupPoints->ComboBox1->currentItem(); + int count = GroupPoints->ComboBox1->count(); + + if ( myWithShape ) + count = count - 1; + + int i = 0; + // Solving PAL5590 + if ( myShape.ShapeType() == TopAbs_COMPOUND ) { + unsigned int nb = NumberOfSubShapes(myShape, TopAbs_COMPOUND); + if (nb > 0) + i++; + } + while ( i <= myShape.ShapeType()) + { + GroupPoints->ComboBox1->removeItem( 0 ); + i++; + } + + if ( myShape.ShapeType() == TopAbs_COMPOUND ) + { + if ( myWithShape == false ) + { + GroupPoints->ComboBox1->insertItem( "Shape" ); + myWithShape = true; + } + } + else + { + if ( myWithShape == true ) + { + GroupPoints->ComboBox1->removeItem( GroupPoints->ComboBox1->count() - 1 ); + myWithShape = false; + } + } + + int count1 = GroupPoints->ComboBox1->count(); + if ( myWithShape ) + count1 = count1 - 1; + + if ( SelectedShapeType > myShape.ShapeType() ) + { + if ( SelectedShapeType == 8 ) + { + if ( myShape.ShapeType() != TopAbs_COMPOUND ) + { + GroupPoints->ComboBox1->setCurrentItem( 0 ); + ComboTextChanged(); + } + } + else + GroupPoints->ComboBox1->setCurrentItem(count1 - count + SelectedShapeType); + } + else + { + GroupPoints->ComboBox1->setCurrentItem( 0 ); + ComboTextChanged(); + } + + updateButtonState(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::SetEditCurrentArgument() +{ + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + + GroupPoints->CheckButton1->setChecked( FALSE ); + SubShapeToggled(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + SetEditCurrentArgument(); + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::DeactivateActiveDialog() +{ + if(GroupConstructors->isEnabled()) { + GEOMBase_Skeleton::DeactivateActiveDialog(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + SubShapeToggled(); + updateButtonState(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + ActivateThisDialog(); +} + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : Completely reset the state of method including local context +//================================================================================= +void EntityGUI_SubShapeDlg::ResetStateOfDialog() +{ + myObject = GEOM::GEOM_Object::_nil(); + myShape.Nullify(); + myEditCurrentArgument->setText(""); + + int SelectedShapeType = GroupPoints->ComboBox1->currentItem(); + int count = GroupPoints->ComboBox1->count(); + if ( myWithShape ) + count = count - 1; + + /* type for sub shape selection */ + GroupPoints->ComboBox1->clear(); + GroupPoints->ComboBox1->insertItem("Compound"); + GroupPoints->ComboBox1->insertItem("Compsolid"); + GroupPoints->ComboBox1->insertItem("Solid"); + GroupPoints->ComboBox1->insertItem("Shell"); + GroupPoints->ComboBox1->insertItem("Face"); + GroupPoints->ComboBox1->insertItem("Wire"); + GroupPoints->ComboBox1->insertItem("Edge"); + GroupPoints->ComboBox1->insertItem("Vertex"); + GroupPoints->ComboBox1->insertItem("Shape"); + + myWithShape = true; + + GroupPoints->ComboBox1->setCurrentItem( 8 - count + SelectedShapeType ); + ComboTextChanged(); + + updateButtonState(); +} + + +//================================================================================= +// function : SubShapeToggled() +// purpose : Allow user selection of all or only selected sub shapes +// : Called when 'CheckButton1' state change +//================================================================================= +void EntityGUI_SubShapeDlg::SubShapeToggled() +{ + if ( isAllSubShapes() ) + globalSelection( GEOM_ALLSHAPES ); + else + localSelection( myObject, shapeType() ); +} + + +//================================================================================= +// function : ComboTextChanged() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ComboTextChanged() +{ + /* Select sub shapes mode not checked */ + updateButtonState(); + SubShapeToggled(); +} + + +//================================================================================= +// function : NumberOfSubShapes() +// purpose : +//================================================================================= +unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes (const TopoDS_Shape& S, + const int shapeType) const +{ + if (S.IsNull()) + return 0; + + unsigned int index = 0; + TopTools_MapOfShape M; + + if (S.ShapeType() == TopAbs_COMPOUND && + (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(shapeType) == TopAbs_COMPSOLID || + TopAbs_ShapeEnum(shapeType) == TopAbs_COMPOUND)) { + TopoDS_Iterator It (S, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + if (M.Add(It.Value())) { + if (TopAbs_ShapeEnum(shapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(shapeType) == It.Value().ShapeType()) { + index++; + } + } + } + } else { + TopExp_Explorer Exp (S, TopAbs_ShapeEnum(shapeType)); + for (; Exp.More(); Exp.Next()) { + if (M.Add(Exp.Current())) { + index++; + } + } + } + + M.Clear(); + return index; +} + +//================================================================================= +// function : updateButtonState +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::updateButtonState() +{ + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || + myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND ) { + GroupPoints->CheckButton1->setChecked( FALSE ); + GroupPoints->CheckButton1->setEnabled( FALSE ); + } + else + GroupPoints->CheckButton1->setEnabled( TRUE ); +} + +//================================================================================= +// function : isAllSubShapes +// purpose : +//================================================================================= +bool EntityGUI_SubShapeDlg::isAllSubShapes() const +{ + return !GroupPoints->CheckButton1->isChecked() || !GroupPoints->CheckButton1->isEnabled(); +} + +//================================================================================= +// function : shapeType +// purpose : +//================================================================================= +int EntityGUI_SubShapeDlg::shapeType() const +{ + int type = GroupPoints->ComboBox1->currentItem(); + + if (myObject->_is_nil()) + return type; + + // Solving PAL5590 + type += myShape.ShapeType() + 1; + if (myShape.ShapeType() == TopAbs_COMPOUND && + NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) { + type--; + } + + return type; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr EntityGUI_SubShapeDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool EntityGUI_SubShapeDlg::isValid( QString& msg ) +{ + bool isOk = false; + if ( !myObject->_is_nil() ) { + if ( isAllSubShapes() ) + isOk = true; + else if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) { + TColStd_IndexedMapOfInteger aMapIndex; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + isOk = aMapIndex.Extent() > 0; + if ( !isOk ) + msg += tr( "NO_SUBSHAPES_SELECTED" ); + } + } + } + return isOk; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool EntityGUI_SubShapeDlg::execute( ObjectList& objects ) +{ + GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow( + getOperation() )->MakeExplode( myObject, shapeType(), false ); + + if ( !aList->length() ) + return false; + + // Throw away sub-shapes not selected by user if not in preview mode + // and manual selection is active + if ( !isAllSubShapes() ) + { + if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) { + TColStd_IndexedMapOfInteger aMapIndex; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + + GEOM::GEOM_ILocalOperations_var aLocOp = + getGeomEngine()->GetILocalOperations( getStudyId() ); + + for ( int i = 0, n = aList->length(); i < n; i++ ) + if ( aMapIndex.Contains( aLocOp->GetSubShapeIndex( myObject, aList[i] ) ) ) + objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); + } + } + } + else + for ( int i = 0, n = aList->length(); i < n; i++ ) + objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); + + return objects.size(); +} + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// ( called with addInStudy method ) +//================================================================ +GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather( GEOM::GEOM_Object_ptr ) +{ + return myObject; +} + +const char* EntityGUI_SubShapeDlg::getNewObjectName() const +{ + return ""; +} diff --git a/src/EntityGUI/UIFiles/ui_to_cxx b/src/EntityGUI/UIFiles/ui_to_cxx new file mode 100755 index 000000000..a430c4c4b --- /dev/null +++ b/src/EntityGUI/UIFiles/ui_to_cxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#!/bin/sh + +uic -o EntityGUI_Skeleton_QTD.h EntityGUI_Skeleton_QTD.ui +uic -o EntityGUI_Skeleton_QTD.cxx -impl EntityGUI_Skeleton_QTD.h EntityGUI_Skeleton_QTD.ui + +uic -o EntityGUI_Point_QTD.h EntityGUI_Point_QTD.ui +uic -o EntityGUI_Point_QTD.cxx -impl EntityGUI_Point_QTD.h EntityGUI_Point_QTD.ui + +uic -o EntityGUI_Dir1_QTD.h EntityGUI_Dir1_QTD.ui +uic -o EntityGUI_Dir1_QTD.cxx -impl EntityGUI_Dir1_QTD.h EntityGUI_Dir1_QTD.ui + +uic -o EntityGUI_Dir2_QTD.h EntityGUI_Dir2_QTD.ui +uic -o EntityGUI_Dir2_QTD.cxx -impl EntityGUI_Dir2_QTD.h EntityGUI_Dir2_QTD.ui + +uic -o EntityGUI_1Spin_QTD.h EntityGUI_1Spin_QTD.ui +uic -o EntityGUI_1Spin_QTD.cxx -impl EntityGUI_1Spin_QTD.h EntityGUI_1Spin_QTD.ui + +uic -o EntityGUI_2Spin_QTD.h EntityGUI_2Spin_QTD.ui +uic -o EntityGUI_2Spin_QTD.cxx -impl EntityGUI_2Spin_QTD.h EntityGUI_2Spin_QTD.ui + +uic -o EntityGUI_3Spin_QTD.h EntityGUI_3Spin_QTD.ui +uic -o EntityGUI_3Spin_QTD.cxx -impl EntityGUI_3Spin_QTD.h EntityGUI_3Spin_QTD.ui + +uic -o EntityGUI_4Spin_QTD.h EntityGUI_4Spin_QTD.ui +uic -o EntityGUI_4Spin_QTD.cxx -impl EntityGUI_4Spin_QTD.h EntityGUI_4Spin_QTD.ui + +uic -o EntityGUI_1Sel_QTD.h EntityGUI_1Sel_QTD.ui +uic -o EntityGUI_1Sel_QTD.cxx -impl EntityGUI_1Sel_QTD.h EntityGUI_1Sel_QTD.ui diff --git a/src/GEOM/GEOM_Application.cxx b/src/GEOM/GEOM_Application.cxx new file mode 100644 index 000000000..3e8c0b222 --- /dev/null +++ b/src/GEOM/GEOM_Application.cxx @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include +#include + +//======================================================================= +//function : GEOM_Application +//purpose : +//======================================================================= + +GEOM_Application::GEOM_Application() +{ +} + + +//======================================================================= +//function : Formats +//purpose : +//======================================================================= + +void GEOM_Application::Formats(TColStd_SequenceOfExtendedString& Formats) +{ + Formats.Append(TCollection_ExtendedString ("SALOME_GEOM")); +} + + +//======================================================================= +//function : ResourcesName +//purpose : +//======================================================================= + +Standard_CString GEOM_Application::ResourcesName() +{ + return Standard_CString ("GEOMDS_Resources"); +} + + + + + diff --git a/src/GEOM/GEOM_Application.hxx b/src/GEOM/GEOM_Application.hxx new file mode 100644 index 000000000..be419c3c2 --- /dev/null +++ b/src/GEOM/GEOM_Application.hxx @@ -0,0 +1,108 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOM_Application.hxx +// Module : GEOM + +#ifndef _GEOM_Application_HeaderFile +#define _GEOM_Application_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_Application_HeaderFile +#include +#endif + +#ifndef _TDocStd_Application_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif +class TColStd_SequenceOfExtendedString; + + +class GEOM_Application : public TDocStd_Application { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT GEOM_Application(); +Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; +Standard_EXPORT Standard_CString ResourcesName() ; +Standard_EXPORT ~GEOM_Application(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOM_Application_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOM/GEOM_Application.ixx b/src/GEOM/GEOM_Application.ixx new file mode 100644 index 000000000..557602753 --- /dev/null +++ b/src/GEOM/GEOM_Application.ixx @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOM_Application.ixx +// Module : GEOM + +#include "GEOM_Application.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +GEOM_Application::~GEOM_Application() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOM_Application_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application); + static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application); + static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_Application", + sizeof(GEOM_Application), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +// DownCast method +// allow safe downcasting + + +const Handle(GEOM_Application) Handle(GEOM_Application)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_Application) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_Application))) { + _anOtherObject = Handle(GEOM_Application)((Handle(GEOM_Application)&)AnObject); + } + } + + return _anOtherObject ; +} + + +const Handle(Standard_Type)& GEOM_Application::DynamicType() const +{ + return STANDARD_TYPE(GEOM_Application) ; +} +Standard_Boolean GEOM_Application::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(GEOM_Application) == AType || TDocStd_Application::IsKind(AType)); +} +Handle_GEOM_Application::~Handle_GEOM_Application() {} diff --git a/src/GEOM/GEOM_Application.jxx b/src/GEOM/GEOM_Application.jxx new file mode 100644 index 000000000..c7d06c2ef --- /dev/null +++ b/src/GEOM/GEOM_Application.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOM_Application.jxx +// Module : GEOM + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _GEOM_Application_HeaderFile +#include "GEOM_Application.hxx" +#endif diff --git a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx new file mode 100644 index 000000000..b0d7ed87e --- /dev/null +++ b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx @@ -0,0 +1,105 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile +#define _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_Standard_Transient_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class TCollection_AsciiString; +class Standard_Transient; +class GEOM_DataMapOfAsciiStringTransient; +class GEOM_DataMapNodeOfDataMapOfAsciiStringTransient; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient : public TCollection_BasicMapIterator { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient(); +Standard_EXPORT GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient(const GEOM_DataMapOfAsciiStringTransient& aMap); +Standard_EXPORT void Initialize(const GEOM_DataMapOfAsciiStringTransient& aMap) ; +Standard_EXPORT const TCollection_AsciiString& Key() const; +Standard_EXPORT const Handle_Standard_Transient& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx new file mode 100644 index 000000000..c27bdb66c --- /dev/null +++ b/src/GEOM/GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif +#ifndef _Standard_Transient_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapOfAsciiStringTransient_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif + + +#define TheKey TCollection_AsciiString +#define TheKey_hxx +#define TheItem Handle_Standard_Transient +#define TheItem_hxx +#define Hasher TCollection_AsciiString +#define Hasher_hxx +#define TCollection_DataMapNode GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_Type_() GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_() +#define TCollection_DataMap GEOM_DataMapOfAsciiStringTransient +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx new file mode 100644 index 000000000..164c30048 --- /dev/null +++ b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx @@ -0,0 +1,142 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#define _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif + +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif +#ifndef _Handle_Standard_Transient_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class Standard_Transient; +class TCollection_AsciiString; +class GEOM_DataMapOfAsciiStringTransient; +class GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient; + + +class GEOM_DataMapNodeOfDataMapOfAsciiStringTransient : public TCollection_MapNode { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +GEOM_DataMapNodeOfDataMapOfAsciiStringTransient(const TCollection_AsciiString& K,const Handle(Standard_Transient)& I,const TCollection_MapNodePtr& n); + TCollection_AsciiString& Key() const; + Handle_Standard_Transient& Value() const; +Standard_EXPORT ~GEOM_DataMapNodeOfDataMapOfAsciiStringTransient(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TCollection_AsciiString myKey; +Handle_Standard_Transient myValue; + + +}; + +#define TheKey TCollection_AsciiString +#define TheKey_hxx +#define TheItem Handle_Standard_Transient +#define TheItem_hxx +#define Hasher TCollection_AsciiString +#define Hasher_hxx +#define TCollection_DataMapNode GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_Type_() GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_() +#define TCollection_DataMap GEOM_DataMapOfAsciiStringTransient +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx new file mode 100644 index 000000000..4494e4121 --- /dev/null +++ b/src/GEOM/GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx @@ -0,0 +1,104 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_Transient_HeaderFile +#include +#endif +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapOfAsciiStringTransient_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif +GEOM_DataMapNodeOfDataMapOfAsciiStringTransient::~GEOM_DataMapNodeOfDataMapOfAsciiStringTransient() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_DataMapNodeOfDataMapOfAsciiStringTransient", + sizeof(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient) Handle(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient))) { + _anOtherObject = Handle(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient)((Handle(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient::DynamicType() const +{ + return STANDARD_TYPE(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient) ; +} +Standard_Boolean GEOM_DataMapNodeOfDataMapOfAsciiStringTransient::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient::~Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient() {} +#define TheKey TCollection_AsciiString +#define TheKey_hxx +#define TheItem Handle_Standard_Transient +#define TheItem_hxx +#define Hasher TCollection_AsciiString +#define Hasher_hxx +#define TCollection_DataMapNode GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_Type_() GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_() +#define TCollection_DataMap GEOM_DataMapOfAsciiStringTransient +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx b/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx new file mode 100644 index 000000000..007e0c365 --- /dev/null +++ b/src/GEOM/GEOM_DataMapOfAsciiStringTransient.hxx @@ -0,0 +1,137 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_DataMapOfAsciiStringTransient_HeaderFile +#define _GEOM_DataMapOfAsciiStringTransient_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_Standard_Transient_HeaderFile +#include +#endif +#ifndef _Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TCollection_AsciiString; +class Standard_Transient; +class GEOM_DataMapNodeOfDataMapOfAsciiStringTransient; +class GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOM_DataMapOfAsciiStringTransient : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT GEOM_DataMapOfAsciiStringTransient(const Standard_Integer NbBuckets = 1); +Standard_EXPORT GEOM_DataMapOfAsciiStringTransient& Assign(const GEOM_DataMapOfAsciiStringTransient& Other) ; + GEOM_DataMapOfAsciiStringTransient& operator =(const GEOM_DataMapOfAsciiStringTransient& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~GEOM_DataMapOfAsciiStringTransient() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const TCollection_AsciiString& K,const Handle(Standard_Transient)& I) ; +Standard_EXPORT Standard_Boolean IsBound(const TCollection_AsciiString& K) const; +Standard_EXPORT Standard_Boolean UnBind(const TCollection_AsciiString& K) ; +Standard_EXPORT const Handle_Standard_Transient& Find(const TCollection_AsciiString& K) const; + const Handle_Standard_Transient& operator()(const TCollection_AsciiString& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_Standard_Transient& ChangeFind(const TCollection_AsciiString& K) ; + Handle_Standard_Transient& operator()(const TCollection_AsciiString& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT GEOM_DataMapOfAsciiStringTransient(const GEOM_DataMapOfAsciiStringTransient& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx b/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx new file mode 100644 index 000000000..3512cdda9 --- /dev/null +++ b/src/GEOM/GEOM_DataMapOfAsciiStringTransient_0.cxx @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif +#ifndef _Standard_Transient_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif +#ifndef _GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_HeaderFile +#include +#endif + + +#define TheKey TCollection_AsciiString +#define TheKey_hxx +#define TheItem Handle_Standard_Transient +#define TheItem_hxx +#define Hasher TCollection_AsciiString +#define Hasher_hxx +#define TCollection_DataMapNode GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient +#define TCollection_DataMapNode_Type_() GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_() +#define TCollection_DataMap GEOM_DataMapOfAsciiStringTransient +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx new file mode 100644 index 000000000..c6ca2f493 --- /dev/null +++ b/src/GEOM/GEOM_Engine.cxx @@ -0,0 +1,651 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include "GEOM_Engine.hxx" + +#include "GEOM_Solver.hxx" +#include "GEOM_Function.hxx" +#include "GEOM_ISubShape.hxx" +#include "GEOM_SubShapeDriver.hxx" +#include "GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx" +#include "GEOM_PythonDump.hxx" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +static GEOM_Engine* TheEngine = NULL; + +static TCollection_AsciiString BuildIDFromObject(Handle(GEOM_Object)& theObject) +{ + TCollection_AsciiString anID(theObject->GetDocID()), anEntry; + TDF_Tool::Entry(theObject->GetEntry(), anEntry); + anID+=(TCollection_AsciiString("_")+anEntry); + return anID; +} + +static TCollection_AsciiString BuildID(Standard_Integer theDocID, char* theEntry) +{ + TCollection_AsciiString anID(theDocID); + anID+=(TCollection_AsciiString("_")+theEntry); + return anID; +} + +static Standard_Integer ExtractDocID(TCollection_AsciiString& theID) +{ + TCollection_AsciiString aDocID = theID.Token("_"); + if(aDocID.Length() < 1) return -1; + return aDocID.IntegerValue(); +} + +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed); + +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); + +//============================================================================= +/*! + * GetEngine + */ +//============================================================================= +GEOM_Engine* GEOM_Engine::GetEngine() { return TheEngine; } + + +//============================================================================= +/*! + * SetEngine + */ +//============================================================================= +void GEOM_Engine::SetEngine(GEOM_Engine* theEngine) { TheEngine = theEngine; } + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +GEOM_Engine::GEOM_Engine() +{ + TFunction_DriverTable::Get()->AddDriver(GEOM_Object::GetSubShapeID(), new GEOM_SubShapeDriver()); + + _OCAFApp = new GEOM_Application(); + _UndoLimit = 10; +} + +//============================================================================= +/*! + * GetDocument + */ +//============================================================================= +Handle(TDocStd_Document) GEOM_Engine::GetDocument(int theDocID) +{ + Handle(TDocStd_Document) aDoc; + if(!_mapIDDocument.IsBound(theDocID)) { + _OCAFApp->NewDocument("SALOME_GEOM", aDoc); + aDoc->SetUndoLimit(_UndoLimit); + _mapIDDocument.Bind(theDocID, aDoc); + TDataStd_Integer::Set(aDoc->Main(), theDocID); + } + + return Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); +} + +//============================================================================= +/*! + * GetDocID + */ +//============================================================================= +int GEOM_Engine::GetDocID(Handle(TDocStd_Document) theDocument) +{ + if(theDocument.IsNull()) return -1; + for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next()) + if(anItr.Value() == theDocument) return anItr.Key(); + + return -1; + +} + +//============================================================================= +/*! + * GetObject + */ +//============================================================================= +Handle(GEOM_Object) GEOM_Engine::GetObject(int theDocID, char* theEntry) +{ + TCollection_AsciiString anID = BuildID(theDocID, theEntry); + if(_objects.IsBound(anID)) return Handle(GEOM_Object)::DownCast(_objects(anID)); + + TDF_Label aLabel; + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + TDF_Tool::Label(aDoc->Main().Data(), theEntry, aLabel, Standard_True); + Handle(GEOM_Object) anObject = new GEOM_Object(aLabel); + + _objects.Bind(anID, anObject); + + return anObject; +} + +//============================================================================= +/*! + * AddObject + */ +//============================================================================= +Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) +{ + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); + + TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main()); + Handle(GEOM_Object) anObject = new GEOM_Object(aChild, theType); + + //Put an object in the map of created objects + TCollection_AsciiString anID = BuildIDFromObject(anObject); + if(_objects.IsBound(anID)) _objects.UnBind(anID); + _objects.Bind(anID, anObject); + + return anObject; +} + +//============================================================================= +/*! + * AddSubShape + */ +//============================================================================= +Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation) +{ + if(theMainShape.IsNull() || theIndices.IsNull()) return NULL; + + Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID()); + Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); + + TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main()); + + Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction(); + Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type + Handle(GEOM_Function) aFunction = anObject->AddFunction(GEOM_Object::GetSubShapeID(), 1); + + GEOM_ISubShape aSSI(aFunction); + aSSI.SetMainShape(aMainShape); + aSSI.SetIndices(theIndices); + + try { + GEOM_Solver aSolver (GEOM_Engine::GetEngine()); + if (!aSolver.ComputeFunction(aFunction)) { + MESSAGE("GEOM_Engine::AddSubShape Error: Can't build a sub shape"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + MESSAGE("GEOM_Engine::AddSubShape Error: " << aFail->GetMessageString()); + return NULL; + } + + //Put an object in the map of created objects + TCollection_AsciiString anID = BuildIDFromObject(anObject); + if(_objects.IsBound(anID)) _objects.UnBind(anID); + _objects.Bind(anID, anObject); + + GEOM::TPythonDump pd (aFunction); + + if (isStandaloneOperation) { + pd << anObject << " = geompy.GetSubShape(" << theMainShape << ", ["; + Standard_Integer i = theIndices->Lower(), up = theIndices->Upper(); + for (; i <= up - 1; i++) { + pd << theIndices->Value(i) << ", "; + } + pd << theIndices->Value(up) << "])"; + } + else + pd << "None"; + + return anObject; +} + +//============================================================================= +/*! + * RemoveObject + */ +//============================================================================= +bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) +{ + if(!theObject) return false; + + //Remove an object from the map of available objects + TCollection_AsciiString anID = BuildIDFromObject(theObject); + if(_objects.IsBound(anID)) _objects.UnBind(anID); + + int nb = theObject->GetNbFunctions(); + Handle(TDataStd_TreeNode) aNode; + for(int i = 1; i<=nb; i++) { + Handle(GEOM_Function) aFunction = theObject->GetFunction(i); + if(aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) + aNode->Remove(); + } + + TDF_Label aLabel = theObject->GetEntry(); + aLabel.ForgetAllAttributes(Standard_True); + + theObject.Nullify(); + + return true; +} + +//============================================================================= +/*! + * Undo + */ +//============================================================================= +void GEOM_Engine::Undo(int theDocID) +{ + GetDocument(theDocID)->Undo(); +} + +//============================================================================= +/*! + * Redo + */ +//============================================================================= +void GEOM_Engine::Redo(int theDocID) +{ + GetDocument(theDocID)->Redo(); +} + +//============================================================================= +/*! + * Save + */ +//============================================================================= +bool GEOM_Engine::Save(int theDocID, char* theFileName) +{ + if(!_mapIDDocument.IsBound(theDocID)) return false; + Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); + + _OCAFApp->SaveAs(aDoc, theFileName); + + return true; +} + +//============================================================================= +/*! + * Load + */ +//============================================================================= +bool GEOM_Engine::Load(int theDocID, char* theFileName) +{ + Handle(TDocStd_Document) aDoc; + if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) { + return false; + } + + aDoc->SetUndoLimit(_UndoLimit); + + if(_mapIDDocument.IsBound(theDocID)) _mapIDDocument.UnBind(theDocID); + _mapIDDocument.Bind(theDocID, aDoc); + + TDataStd_Integer::Set(aDoc->Main(), theDocID); + + return true; +} + +//============================================================================= +/*! + * Close + */ +//============================================================================= +void GEOM_Engine::Close(int theDocID) +{ + if(_mapIDDocument.IsBound(theDocID)) { + Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID)); + + //Remove all GEOM Objects associated to the given document + TColStd_SequenceOfAsciiString aSeq; + GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects); + for(; It.More(); It.Next()) { + TCollection_AsciiString anObjID(It.Key()); + Standard_Integer anID = ExtractDocID(anObjID); + if(theDocID == anID) aSeq.Append(It.Key()); + } + for(Standard_Integer i=1; i<=aSeq.Length(); i++) _objects.UnBind(aSeq.Value(i)); + + _mapIDDocument.UnBind(theDocID); + _OCAFApp->Close(aDoc); + aDoc.Nullify(); + } +} + +//============================================================================= +/*! + * DumpPython + */ +//============================================================================= +TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript) +{ + TCollection_AsciiString aScript; + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + + if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); + + aScript = "import geompy\n"; + aScript += "import math\n\n"; + aScript += "def RebuildData(theStudy):"; + aScript += "\n\tgeompy.init_geom(theStudy)"; + + Standard_Integer posToInertGlobalVars = aScript.Length() + 1; + + Handle(TDataStd_TreeNode) aNode, aRoot; + Handle(GEOM_Function) aFunction; + TColStd_MapOfTransient aMap; + + if(aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { + TDataStd_ChildNodeIterator Itr(aRoot); + for(; Itr.More(); Itr.Next()) { + aNode = Itr.Value(); + aFunction = GEOM_Function::GetFunction(aNode->Label()); + if(aFunction.IsNull()) { + cout << "Null function !!!!" << endl; + continue; + } + ProcessFunction(aFunction, aScript, aMap); + } + } + + Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry; + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt; + // build maps entry <-> studyEntry + for (anEntryToNameIt.Initialize( theObjectNames ); + anEntryToNameIt.More(); + anEntryToNameIt.Next()) + { + const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); + // look for an object by entry + TDF_Label L; + TDF_Tool::Label( aDoc->GetData(), aEntry, L ); + if ( L.IsNull() ) continue; + Handle(GEOM_Object) obj = GEOM_Object::GetObject( L ); + // fill maps + if ( !obj.IsNull() ) { + TCollection_AsciiString aStudyEntry (obj->GetAuxData()); + aEntry2StEntry.Bind( aEntry, aStudyEntry); + aStEntry2Entry.Bind( aStudyEntry, aEntry ); + } + } + + Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript); + Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length(); + Resource_DataMapOfAsciiStringAsciiString aNameToEntry, anEntryToBadName; + + //Replace entries by the names + TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"), + allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); + if(aLen == 0) anUpdatedScript = aScript; + + for(Standard_Integer i = 1; i <= aLen; i+=2) { + anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1); + anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1)); + if(theObjectNames.IsBound(anEntry)) { + aName = theObjectNames.Find(anEntry); + // check validity of aName + bool isValidName = true; + if ( aName.IsIntegerValue() ) { // aName must not start with a digit + aName.Insert( 1, 'a' ); + isValidName = false; + } + int p, p2=1; // replace not allowed chars + while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) { + aName.SetValue(p, '_'); + p2=p; + isValidName = false; + } + if ( aNameToEntry.IsBound( aName ) && anEntry != aNameToEntry( aName )) + { // diff objects have same name - make a new name by appending a digit + TCollection_AsciiString aName2; + Standard_Integer i = 0; + do { + aName2 = aName + "_" + ++i; + } while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 )); + aName = aName2; + isValidName = false; + } + if ( !isValidName ) { + if ( isPublished ) + anEntryToBadName.Bind( anEntry, theObjectNames.Find(anEntry) ); + theObjectNames( anEntry ) = aName; + } + } + else { + do { + aName = aBaseName + TCollection_AsciiString(++objectCounter); + } while(aNameToEntry.IsBound(aName)); + theObjectNames.Bind(anEntry, aName); + } + aNameToEntry.Bind(aName, anEntry); // to detect same name of diff objects + + anUpdatedScript += aName; + aStart = aSeq->Value(i+1) + 1; + } + + //Add final part of the script + if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); + + // Make script to publish in study + if ( isPublished ) + { + map< int, string > anEntryToCommandMap; // sort publishing commands by object entry + for (anEntryToNameIt.Initialize( theObjectNames ); + anEntryToNameIt.More(); + anEntryToNameIt.Next()) + { + const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); + const TCollection_AsciiString& aName = anEntryToNameIt.Value(); + if ( !aEntry2StEntry.IsBound( aEntry )) + continue; // was not published + TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry; + + // find a father entry + const TCollection_AsciiString& aStudyEntry = aEntry2StEntry( aEntry ); + TCollection_AsciiString aFatherStudyEntry = + aStudyEntry.SubString( 1, aStudyEntry.SearchFromEnd(":") - 1 ); + if ( aStEntry2Entry.IsBound( aFatherStudyEntry )) + aFatherEntry = aStEntry2Entry( aFatherStudyEntry ); + + // make a command + if ( !aFatherEntry.IsEmpty() && theObjectNames.IsBound( aFatherEntry )) { + aCommand += "addToStudyInFather( "; + aCommand += theObjectNames( aFatherEntry ) + ", "; + } + else + aCommand += "addToStudy( "; + if ( anEntryToBadName.IsBound( aEntry )) + aCommand += aName + ", \"" + anEntryToBadName( aEntry ) + "\" )"; + else + aCommand += aName + ", \"" + aName + "\" )"; + + // bind a command to the last digit of the entry + int tag = + aEntry.SubString( aEntry.SearchFromEnd(":")+1, aEntry.Length() ).IntegerValue(); + anEntryToCommandMap.insert( make_pair( tag, aCommand.ToCString() )); + } + + // add publishing commands to the script + map< int, string >::iterator anEntryToCommand = anEntryToCommandMap.begin(); + for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand ) { + anUpdatedScript += (char*)anEntryToCommand->second.c_str(); + } + } + + anUpdatedScript += "\n\tpass\n"; + aValidScript = true; + + // fill _studyEntry2NameMap and build globalVars + TCollection_AsciiString globalVars; + _studyEntry2NameMap.Clear(); + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString aStEntryToEntryIt; + for (aStEntryToEntryIt.Initialize( aStEntry2Entry ); + aStEntryToEntryIt.More(); + aStEntryToEntryIt.Next() ) + { + const TCollection_AsciiString & name = theObjectNames( aStEntryToEntryIt.Value() ); + _studyEntry2NameMap.Bind (aStEntryToEntryIt.Key(), name ); + if ( !globalVars.IsEmpty() ) + globalVars += ", "; + globalVars += name; + } + if ( !globalVars.IsEmpty() ) { + globalVars.Insert( 1, "\n\tglobal " ); + anUpdatedScript.Insert( posToInertGlobalVars, globalVars ); + } + + return anUpdatedScript; +} + +//======================================================================= +//function : GetDumpName +//purpose : +//======================================================================= + +const char* GEOM_Engine::GetDumpName (const char* theStudyEntry) const +{ + if ( _studyEntry2NameMap.IsBound( (char*)theStudyEntry )) + return _studyEntry2NameMap( (char*)theStudyEntry ).ToCString(); + + return NULL; +} + +//======================================================================= +//function : GetAllDumpNames +//purpose : +//======================================================================= + +Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const +{ + Handle(TColStd_HSequenceOfAsciiString) aRetSeq = new TColStd_HSequenceOfAsciiString; + + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString it (_studyEntry2NameMap); + for (; it.More(); it.Next()) { + aRetSeq->Append(it.Value()); + } + + return aRetSeq; +} + + +//=========================================================================== +// Internal functions +//=========================================================================== +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed) +{ + if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return; + +/* + TDF_LabelSequence aSeq; + theFunction->GetDependency(aSeq); + Standard_Integer aLen = aSeq.Length(); + for(Standard_Integer i = 1; i<= aLen; i++) { + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i)); + if(aFunction.IsNull()) continue; + ProcessFunction(aFunction, theScript, theProcessed); + } +*/ + + TCollection_AsciiString aDescr = theFunction->GetDescription(); + if(aDescr.Length() == 0) { + //cout << "Warning: the function has no description" << endl; + return; + } + //Check if its internal function which doesn't requires dumping + if(aDescr == "None") return; + + theScript += "\n\t"; + theScript += aDescr; + + theProcessed.Add(theFunction); + return; +} + +//============================================================================= +/*! + * FindEntries: Returns a sequence of start/end positions of entries in the string + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString) +{ + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + Standard_Integer aLen = theString.Length(); + Standard_Boolean isFound = Standard_False; + + char* arr = theString.ToCString(); + Standard_Integer i = 0, j; + + while(i < aLen) { + int c = (int)arr[i]; + j = i+1; + if(c >= 48 && c <= 57) { //Is digit? + + isFound = Standard_False; + while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry + c = (int)arr[j++]; + if(c == 58) isFound = Standard_True; + } + + if(isFound && arr[j-2] != 58) { // last char should be a diggit + aSeq->Append(i+1); // +1 because AsciiString starts from 1 + aSeq->Append(j-1); + } + } + + i = j; + } + + return aSeq; +} diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx new file mode 100644 index 000000000..c9cd626b9 --- /dev/null +++ b/src/GEOM/GEOM_Engine.hxx @@ -0,0 +1,106 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_Engine_HXX_ +#define _GEOM_Engine_HXX_ + +#include "GEOM_Application.hxx" +#include "GEOM_Object.hxx" +#include "GEOM_DataMapOfAsciiStringTransient.hxx" + +#include +#include +#include +#include +#include + +class GEOM_Engine +{ + public: + Standard_EXPORT GEOM_Engine(); + Standard_EXPORT ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); } + + //Retuns the engine + Standard_EXPORT static GEOM_Engine* GetEngine(); + + //Returns the OCAF document by its ID, if document doesn't exists it will be created + Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID); + + //Returns the ID of the given OCAF document + Standard_EXPORT int GetDocID(Handle(TDocStd_Document) theDocument); + + //Returns the OCAF appliaction + Standard_EXPORT Handle(TDocStd_Application) GetApplication() { return _OCAFApp; } + + //Returns a pointer to GEOM_Object defined by a document and the entry + Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry); + + //Adds a new object of the type theType in the OCAF document + Standard_EXPORT Handle(GEOM_Object) AddObject(int theDocID, int theType); + + //Removes the object from the OCAF document + Standard_EXPORT bool RemoveObject(Handle(GEOM_Object) theObject); + + //Saves the OCAF document with ID = theDocID with file with name theFileName + Standard_EXPORT bool Save(int theDocID, char* theFileName); + + //Loads the OCAF document into the application and assigns to it an ID = theDocID + Standard_EXPORT bool Load(int theDocID, char* theFileName); + + //Closes the document with ID = theDocID + Standard_EXPORT void Close(int theDocID); + + //Sets the number of Undos (default value = 10) + Standard_EXPORT void SetUndoLimit(int theLimit) { _UndoLimit = theLimit; } + + //Applies an Undo to document with ID = theDocID + Standard_EXPORT void Undo(int theDocID); + + //Applies an Redo to document with ID = theDocID + Standard_EXPORT void Redo(int theDocID); + + //Adds a new sub shape object of the MainShape object + Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation = false); + + Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript); + + Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const; + + Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const; + + protected: + Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine); + + private: + + Handle(GEOM_Application) _OCAFApp; + Interface_DataMapOfIntegerTransient _mapIDDocument; + int _UndoLimit; + GEOM_DataMapOfAsciiStringTransient _objects; + + Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap; +}; + +#endif diff --git a/src/GEOM/GEOM_Function.cxx b/src/GEOM/GEOM_Function.cxx new file mode 100644 index 000000000..6069db298 --- /dev/null +++ b/src/GEOM/GEOM_Function.cxx @@ -0,0 +1,700 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +#define ARGUMENT_LABEL 1 +#define RESULT_LABEL 2 +#define DESCRIPTION_LABEL 3 +#define HISTORY_LABEL 4 + +#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL)) +#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition)) +#define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2)) + +//======================================================================= +//function : GetFunctionTreeID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Function::GetFunctionTreeID() +{ + static Standard_GUID aFunctionTreeID("FF1BBB00-5D14-4df2-980B-3A668264EA16"); + return aFunctionTreeID; +} + + +//======================================================================= +//function : GetDependencyID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Function::GetDependencyID() +{ + static Standard_GUID aDependencyID("E2620650-2354-41bd-8C2C-210CFCD00948"); + return aDependencyID; +} + +//============================================================================= +/*! + * GetFunction: + */ +//============================================================================= +Handle(GEOM_Function) GEOM_Function::GetFunction(const TDF_Label& theEntry) +{ + if(!theEntry.IsAttribute(TFunction_Function::GetID())) return NULL; + + return new GEOM_Function(theEntry); +} + +//============================================================================= +/*! + * Constructor: + */ +//============================================================================= +GEOM_Function::GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType) +: _label(theEntry) +{ + TFunction_Function::Set(theEntry, theGUID); + TDataStd_Integer::Set(theEntry, theType); + + //Add function to a function tree + Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theEntry.Data()); + Handle(TDataStd_TreeNode) aRoot, aNode; + if(!aDoc->Main().FindAttribute(GetFunctionTreeID(), aRoot)) + aRoot = TDataStd_TreeNode::Set(aDoc->Main(), GetFunctionTreeID()); + + aNode = TDataStd_TreeNode::Set(theEntry, GetFunctionTreeID()); + aRoot->Append(aNode); +} + +//============================================================================= +/*! + * GetOwner + */ +//============================================================================= +TDF_Label GEOM_Function::GetOwnerEntry() +{ + TDF_Label aFather = _label.Father(); + while(!aFather.IsRoot()) { + if(aFather.IsAttribute(GEOM_Object::GetObjectID())) return aFather; + aFather = aFather.Father(); + } + + return TDF_Label(); +} + +//============================================================================= +/*! + * GetType + */ +//============================================================================= +int GEOM_Function::GetType() +{ + _isDone = false; + Handle(TDataStd_Integer) aType; + if(!_label.FindAttribute(TDataStd_Integer::GetID(), aType)) return 0; + _isDone = true; + return aType->Get(); +} + +//============================================================================= +/*! + * GetValue + */ +//============================================================================= +TopoDS_Shape GEOM_Function::GetValue() +{ + _isDone = false; + + TopoDS_Shape aShape; + TDF_Label aLabel = GetOwnerEntry(); + if(aLabel.IsRoot()) return aShape; + Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel); + if(anObject.IsNull()) return aShape; + if(!anObject->IsMainShape()) { + try { + GEOM_Solver aSolver(GEOM_Engine::GetEngine()); + if (!aSolver.ComputeFunction(this)) { + MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape"); + return aShape; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString()); + return aShape; + } + } + + TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL); + Handle(TNaming_NamedShape) aNS; + if(!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape; + + aShape = aNS->Get(); + + _isDone = true; + return aShape; +} + +//============================================================================= +/*! + * GetValue + */ +//============================================================================= +void GEOM_Function::SetValue(TopoDS_Shape& theShape) +{ + _isDone = false; + TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL); + TNaming_Builder aBuilder(aResultLabel); + + aBuilder.Generated(theShape); + + _isDone = true; +} + +//============================================================================= +/*! + * GetDriverGUID + */ +//============================================================================= +Standard_GUID GEOM_Function::GetDriverGUID() +{ + Handle(TFunction_Function) aFunction; + if(!_label.FindAttribute(TFunction_Function::GetID(), aFunction)) { + return TDF::LowestID(); + } + + return aFunction->GetDriverGUID(); +} + +//============================================================================= +/*! + * GetDescription + */ +//============================================================================= +TCollection_AsciiString GEOM_Function::GetDescription() +{ + Handle(TDataStd_Comment) aComment; + TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL); + if(!aChild.FindAttribute(TDataStd_Comment::GetID(), aComment)) return TCollection_AsciiString(); + TCollection_AsciiString aDescr(aComment->Get()); + return aDescr; +} + +//============================================================================= +/*! + * SetDescription + */ +//============================================================================= +void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription) +{ + TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL); + Handle(TDataStd_Comment) aComment = + TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription)); +} + +//============================================================================= +/*! + * SetReal + */ +//============================================================================= +void GEOM_Function::SetReal(int thePosition, double theValue) +{ + _isDone = false; + if(thePosition <= 0) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + TDataStd_Real::Set(anArgLabel, theValue); + _isDone = true; +} + +//============================================================================= +/*! + * SetRealArray + */ +//============================================================================= +void GEOM_Function::SetRealArray (int thePosition, + const Handle(TColStd_HArray1OfReal)& theArray) +{ + _isDone = false; + if(thePosition <= 0) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + Handle(TDataStd_RealArray) anAttr = + TDataStd_RealArray::Set(anArgLabel, theArray->Lower(), theArray->Upper()); + anAttr->ChangeArray(theArray); + _isDone = true; +} + +//============================================================================= +/*! + * GetReal + */ +//============================================================================= +double GEOM_Function::GetReal(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return 0.0; + Handle(TDataStd_Real) aReal; + TDF_Label anArgLabel = ARGUMENT(thePosition); + if(!anArgLabel.FindAttribute(TDataStd_Real::GetID(), aReal)) return 0.0; + + _isDone = true; + return aReal->Get(); +} + +//============================================================================= +/*! + * GetRealArray + */ +//============================================================================= +Handle(TColStd_HArray1OfReal) GEOM_Function::GetRealArray(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return NULL; + Handle(TDataStd_RealArray) aRealArray; + TDF_Label anArgLabel = ARGUMENT(thePosition); + if(!anArgLabel.FindAttribute(TDataStd_RealArray::GetID(), aRealArray)) return NULL; + + _isDone = true; + return aRealArray->Array(); +} + +//============================================================================= +/*! + * SetInteger + */ +//============================================================================= +void GEOM_Function::SetInteger(int thePosition, int theValue) +{ + _isDone = false; + if(thePosition <= 0) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + TDataStd_Integer::Set(anArgLabel, theValue); + _isDone = true; +} + +//============================================================================= +/*! + * SetIntegerArray + */ +//============================================================================= +void GEOM_Function::SetIntegerArray (int thePosition, + const Handle(TColStd_HArray1OfInteger)& theArray) +{ + _isDone = false; + if(thePosition <= 0) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + Handle(TDataStd_IntegerArray) anAttr = + TDataStd_IntegerArray::Set(anArgLabel, theArray->Lower(), theArray->Upper()); + anAttr->ChangeArray(theArray); + _isDone = true; +} + +//============================================================================= +/*! + * GetInteger + */ +//============================================================================= +int GEOM_Function::GetInteger(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return 0; + Handle(TDataStd_Integer) anInteger; + TDF_Label anArgLabel = ARGUMENT(thePosition); + if(!anArgLabel.FindAttribute(TDataStd_Integer::GetID(), anInteger)) return 0; + + _isDone = true; + return anInteger->Get(); +} + +//============================================================================= +/*! + * GetIntegerArray + */ +//============================================================================= +Handle(TColStd_HArray1OfInteger) GEOM_Function::GetIntegerArray(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return 0; + Handle(TDataStd_IntegerArray) anIntegerArray; + TDF_Label anArgLabel = ARGUMENT(thePosition); + if(!anArgLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) return 0; + + _isDone = true; + return anIntegerArray->Array(); +} + +//============================================================================= +/*! + * SetString + */ +//============================================================================= +void GEOM_Function::SetString(int thePosition, const TCollection_AsciiString& theValue) +{ + _isDone = false; + if(thePosition <= 0) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + TDataStd_Comment::Set(anArgLabel, theValue); + _isDone = true; +} + +//============================================================================= +/*! + * GetString + */ +//============================================================================= +TCollection_AsciiString GEOM_Function::GetString(int thePosition) +{ + _isDone = false; + TCollection_AsciiString aRes; + if(thePosition <= 0) return aRes; + Handle(TDataStd_Comment) aString; + TDF_Label anArgLabel = ARGUMENT(thePosition); + if(!anArgLabel.FindAttribute(TDataStd_Comment::GetID(), aString)) return aRes; + + _isDone = true; + aRes = TCollection_AsciiString(aString->Get()); + return aRes; +} + +//============================================================================= +/*! + * SetReference + */ +//============================================================================= +void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference) +{ + _isDone = false; + if(thePosition <= 0) return; + if(theReference.IsNull()) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + TDF_Reference::Set(anArgLabel, theReference->GetEntry()); + TDataStd_UAttribute::Set(anArgLabel, GetDependencyID()); + _isDone = true; + return; +} + +//============================================================================= +/*! + * GetReference + */ +//============================================================================= +Handle(GEOM_Function) GEOM_Function::GetReference(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return NULL; + TDF_Label anArgLabel = ARGUMENT(thePosition); + Handle(TDF_Reference) aRef; + if(!anArgLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL; + + _isDone = true; + return GetFunction(aRef->Get()); +} + + +//============================================================================= +/*! + * SetStringArray + */ +//============================================================================= +void GEOM_Function::SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray) +{ + _isDone = false; + if(thePosition <= 0 || theArray.IsNull()) return; + TDF_Label anArgLabel = ARGUMENT(thePosition); + + Handle(TDataStd_ExtStringArray) anArray = new TDataStd_ExtStringArray; + anArray->ChangeArray(theArray); + anArgLabel.AddAttribute(anArray); + + _isDone = true; +} + + +//============================================================================= +/*! + * GetStringArray + */ +//============================================================================= +Handle(TColStd_HArray1OfExtendedString) GEOM_Function::GetStringArray(int thePosition) +{ + _isDone = false; + if(thePosition <= 0) return NULL; + TDF_Label anArgLabel = ARGUMENT(thePosition); + Handle(TDataStd_ExtStringArray) anArray; + if(!anArgLabel.FindAttribute(TDataStd_ExtStringArray::GetID(), anArray)) return NULL; + + _isDone = true; + return anArray->Array(); +} + +//======================================================================= +//function : GetReferencesTreeID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Function::GetReferencesTreeID() +{ + static Standard_GUID aReferencesTreeID("FF1BBB10-5D14-4df2-980B-3A668264EA16"); + return aReferencesTreeID; +} + +//============================================================================= +/*! + * SetReferenceList + */ +//============================================================================= +void GEOM_Function::SetReferenceList (int thePosition, + const Handle(TColStd_HSequenceOfTransient)& theRefList) +{ + _isDone = false; + if(thePosition <= 0) return; + + // parent label for the list of references + TDF_Label anArgLabel = ARGUMENT(thePosition); + anArgLabel.ForgetAllAttributes(); + + // set TreeNode on the parent label + Handle(TDataStd_TreeNode) aRoot, aNode; + aRoot = TDataStd_TreeNode::Set(anArgLabel, GetReferencesTreeID()); + + // store references on sub-labels of the parent label + Handle(GEOM_Function) aFunc; + Standard_Integer ind, len = theRefList->Length(); + for (ind = 1; ind <= len; ind++) { + aFunc = Handle(GEOM_Function)::DownCast(theRefList->Value(ind)); + if (aFunc.IsNull()) continue; + TDF_Label anArgLabel_i = SUB_ARGUMENT(thePosition, ind); + TDF_Reference::Set(anArgLabel_i, aFunc->GetEntry()); + TDataStd_UAttribute::Set(anArgLabel_i, GetDependencyID()); + + // set TreeNode on the child label + aNode = TDataStd_TreeNode::Set(anArgLabel_i, GetReferencesTreeID()); + aRoot->Append(aNode); + } + + _isDone = true; + return; +} + +//============================================================================= +/*! + * GetReferenceList + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosition) +{ + Handle(TColStd_HSequenceOfTransient) aResult = new TColStd_HSequenceOfTransient; + _isDone = false; + if(thePosition <= 0) return aResult; + + // parent label for the list of references + TDF_Label anArgLabel = ARGUMENT(thePosition); + Handle(TDF_Reference) aRef; + + // get TreeNode on the parent label + Handle(TDataStd_TreeNode) aRoot, aNode; + if(!anArgLabel.FindAttribute(GetReferencesTreeID(), aRoot)) + return aResult; + + // get references, stored on sub-labels of the parent label + TDF_Label aLabel_i; + TDataStd_ChildNodeIterator anIter (aRoot); + for (; anIter.More(); anIter.Next()) { + aNode = anIter.Value(); + aLabel_i = aNode->Label(); + if (!aLabel_i.FindAttribute(TDF_Reference::GetID(), aRef)) continue; + Handle(GEOM_Function) aFunc_i = GetFunction(aRef->Get()); + if (aFunc_i.IsNull()) continue; + aResult->Append(aFunc_i); + } + + _isDone = true; + return aResult; +} + +//============================================================================= +/*! + * SetShape + */ +//============================================================================= +//void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape) +//{ +// _isDone = false; +// if(thePosition <= 0 || theShape.IsNull()) return; +// +// TDF_Label anArgLabel = ARGUMENT(thePosition); +// TNaming_Builder aBuilder(anArgLabel); +// aBuilder.Generated(theShape); +// +// _isDone = true; +// return; +//} +// +//============================================================================= +/*! + * GetShape + */ +//============================================================================= +//TopoDS_Shape GEOM_Function::GetShape(int thePosition) +//{ +// _isDone = false; +// TopoDS_Shape aShape; +// if(thePosition <= 0) return aShape; +// +// TDF_Label anArgLabel = ARGUMENT(thePosition); +// Handle(TNaming_NamedShape) aNS; +// if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape; +// +// aShape = aNS->Get(); +// _isDone = true; +// return aShape; +//} + + +//============================================================================= +/*! + * GetDependency + */ +//============================================================================= +void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq) +{ + TDF_ChildIterator anIterator(ARGUMENTS, Standard_True); + for(; anIterator.More(); anIterator.Next()) { + if(anIterator.Value().IsAttribute(GetDependencyID())) theSeq.Append(anIterator.Value()); + } +} + +//============================================================================= +/*! + * GetHistoryEntry + */ +//============================================================================= +TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create) +{ + return _label.FindChild(HISTORY_LABEL, create); +} + +//============================================================================= +/*! + * GetArgumentHistoryEntry + */ +//============================================================================= +TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry, + const Standard_Boolean create) +{ + TColStd_ListOfInteger anArgumentRefTags; + TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags); + Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent(); + + TDF_Label aHistoryLabel = GetHistoryEntry(create); + if (aHistoryLabel.IsNull()) + return aHistoryLabel; + Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1; + + Standard_Integer itag; + TDF_Label aHistoryCurLabel = aHistoryLabel; + TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags); + for (itag = 1; itag <= aHistoryLabelPos; itag++) { + aListIter.Next(); + } + for (; itag <= anArgumentRefLabelPos; itag++) { + aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create); + if (aHistoryCurLabel.IsNull()) + return aHistoryCurLabel; + aListIter.Next(); + } + + return aHistoryCurLabel; +} + +//======================================================================= +//function : GEOM_Function_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function", + sizeof(GEOM_Function), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_Function) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_Function))) { + _anOtherObject = Handle(GEOM_Function)((Handle(GEOM_Function)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOM/GEOM_Function.hxx b/src/GEOM/GEOM_Function.hxx new file mode 100644 index 000000000..4eb5b760e --- /dev/null +++ b/src/GEOM/GEOM_Function.hxx @@ -0,0 +1,270 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_Function_HeaderFile +#define _GEOM_Function_HeaderFile + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TDF_Label_HeaderFile +#include +#endif +#ifndef _TDF_LabelSequence_HeaderFile +#include +#endif +#ifndef _TColStd_HArray1OfExtendedString_HeaderFile +#include +#endif + +class Handle_TColStd_HArray1OfReal; +class Handle_TColStd_HArray1OfInteger; +class Handle_TColStd_HSequenceOfTransient; +class Handle_TColStd_HArray1OfExtendedString; + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class GEOM_Function; + +#include + + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function); + +class Handle(GEOM_Function) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOM_Function)():Handle(MMgt_TShared)() {} + Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(GEOM_Function)& operator=(const Handle(GEOM_Function)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_Function)& operator=(const GEOM_Function* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_Function* operator->() + { + return (GEOM_Function *)ControlAccess(); + } + + GEOM_Function* operator->() const + { + return (GEOM_Function *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_Function)() {}; + + Standard_EXPORT static const Handle(GEOM_Function) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOM_Function : public MMgt_TShared +{ + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); } + + +private: + GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; } + +public: + + //Returns a GUID for a function tree + Standard_EXPORT static const Standard_GUID& GetFunctionTreeID(); + + //Returns the ID which is associated with a reference to another function + Standard_EXPORT static const Standard_GUID& GetDependencyID(); + + //Finds and returns a function located on a label theEntry + Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry); + + + Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType); + Standard_EXPORT ~GEOM_Function() {;} + + Standard_EXPORT TDF_Label GetOwnerEntry(); + + //Access to properties + + //Returns a result of the function built by the function Driver + Standard_EXPORT TopoDS_Shape GetValue(); + + //Sets the function result + Standard_EXPORT void SetValue(TopoDS_Shape& theShape); + + //Returns a function entry in the OCAF document + Standard_EXPORT TDF_Label& GetEntry() { return _label; } + + //Returns the type of the function + Standard_EXPORT int GetType(); + + //Returns a function Driver GUID + Standard_EXPORT Standard_GUID GetDriverGUID(); + + //Returns aPython description of the function + Standard_EXPORT TCollection_AsciiString GetDescription(); + + //Sets aPython description of the function + Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription); + + //Access to arguments + + //Sets a real argument at position thePosition + Standard_EXPORT void SetReal(int thePosition, double theValue); + + //Returns a real argument at position thePosition + Standard_EXPORT double GetReal(int thePosition); + + //Sets a real array argument at position thePosition + Standard_EXPORT void SetRealArray(int thePosition, const Handle(TColStd_HArray1OfReal)& theArray); + + //Returns a real array argument at position thePosition + Standard_EXPORT Handle(TColStd_HArray1OfReal) GetRealArray(int thePosition); + + //Sets an integer argument at position thePosition + Standard_EXPORT void SetInteger(int thePosition, int theValue); + + //Returns an integer argument at position thePosition + Standard_EXPORT int GetInteger(int thePosition); + + //Sets an integer array argument at position thePosition + Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray); + + //Returns an integer array argument at position thePosition + Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition); + + //Sets a reference to other function argument at position thePosition + Standard_EXPORT void SetReference(int thePosition, Handle(GEOM_Function) theReference); + + //Sets a string argument at position thePosition + Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue); + + //Returns a string argument at position thePosition + Standard_EXPORT TCollection_AsciiString GetString(int thePosition); + + //Returns a reference to other function argument at position thePosition + Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition); + + //Set an array of ExtendedString + Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray); + + //Returns the array of ExtendedString + Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition); + + //Returns a GUID for a references tree + Standard_EXPORT static const Standard_GUID& GetReferencesTreeID(); + + //Sets a list of references to other function arguments at position thePosition + Standard_EXPORT void SetReferenceList (int thePosition, + const Handle(TColStd_HSequenceOfTransient)& theRefList); + + //Returns a list of references to other function arguments at position thePosition + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); + + //Sets a TopoDS_Shape argument at position thePosition + //void SetShape(int thePosition, const TopoDS_Shape& theShape); + + //Returns a TopoDS_Shape argument at position thePosition + //TopoDS_Shape GetShape(int thePosition); + + //Returns true if the last method succided + Standard_EXPORT bool IsDone() { return _isDone; } + + //Returns a sequence of the external dependencies of this function + Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq); + + //Returns top label of this function's history tree + Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True); + + //Returns history label, corresponding to the label, + //on which a reference on argument is stored + Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry, + const Standard_Boolean create = Standard_True); + +private: + + + TDF_Label _label; + bool _isDone; +}; + +#endif diff --git a/src/GEOM/GEOM_IOperations.cxx b/src/GEOM/GEOM_IOperations.cxx new file mode 100644 index 000000000..f922ee164 --- /dev/null +++ b/src/GEOM/GEOM_IOperations.cxx @@ -0,0 +1,103 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +GEOM_IOperations::GEOM_IOperations(GEOM_Engine* theEngine, int theDocID) +: _engine(theEngine), _docID(theDocID) +{ + _solver = new GEOM_Solver(theEngine); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOM_IOperations::~GEOM_IOperations() +{ + delete _solver; + MESSAGE("GEOM_IOperations::~GEOM_IOperations"); +} + + +//============================================================================= +/*! + * StartOperation + */ +//============================================================================= +void GEOM_IOperations::StartOperation() +{ + Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID); + if(aDoc->GetUndoLimit() > 0) + aDoc->NewCommand(); +} + + //============================================================================= + /*! + * FinishOperation + */ +//============================================================================= +void GEOM_IOperations::FinishOperation() +{ + Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID); + if(aDoc->GetUndoLimit() > 0) + aDoc->CommitCommand(); +} + +//============================================================================= +/*! + * AbortOperation + */ +//============================================================================= +void GEOM_IOperations::AbortOperation() +{ + Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID); + aDoc->AbortCommand(); +} + + +//============================================================================= +/*! + * IsDone + */ +//============================================================================= +bool GEOM_IOperations::IsDone() +{ + return (_errorCode == OK); +} + + diff --git a/src/GEOM/GEOM_IOperations.hxx b/src/GEOM/GEOM_IOperations.hxx new file mode 100644 index 000000000..5a14ae83a --- /dev/null +++ b/src/GEOM/GEOM_IOperations.hxx @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IOperations_HXX_ +#define _GEOM_IOperations_HXX_ + +#include "GEOM_Engine.hxx" +#include +#include +#include "GEOM_Object.hxx" +#include "GEOM_Solver.hxx" + +#define OK "PAL_NO_ERROR" +#define KO "PAL_NOT_DONE_ERROR" +#define ALREADY_PRESENT "PAL_ELEMENT_ALREADY_PRESENT" +#define NOT_EXISTS "PAL_ELEMENT_DOES_NOT_EXISTS" +#define INVALID_TYPE "INVALID_TYPE_OF_ELEMENT" + +class GEOM_IOperations +{ + public: + Standard_EXPORT GEOM_IOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOM_IOperations(); + + //Starts a new operation (opens a tansaction) + Standard_EXPORT void StartOperation(); + + //Finishes the previously started operation (closes the transaction) + Standard_EXPORT void FinishOperation(); + + //Aborts the operation + Standard_EXPORT void AbortOperation(); + + //Returns true if the last operation succided + Standard_EXPORT bool IsDone(); + + //Sets Not done error code + Standard_EXPORT void SetNotDone() { _errorCode = KO; } + + //Sets an error code of the operation + Standard_EXPORT void SetErrorCode(const TCollection_AsciiString& theErrorCode) { + _errorCode = theErrorCode; + } + + //Returns an error code of the last operatioin + Standard_EXPORT char* GetErrorCode() { + return _errorCode.ToCString(); + } + + //Returns a pointer to GEOM_Engine which this operation interface is associated + Standard_EXPORT GEOM_Engine* GetEngine() { return _engine; } + + //Return a pointer to Solver associated with this operation interface + Standard_EXPORT GEOM_Solver* GetSolver() { return _solver; } + + //Returns an ID of the OCAF document where this operation stores the data + Standard_EXPORT int GetDocID() { return _docID; } + + private: + + TCollection_AsciiString _errorCode; + GEOM_Engine* _engine; + GEOM_Solver* _solver; + int _docID; + +}; + +#endif diff --git a/src/GEOM/GEOM_ISubShape.hxx b/src/GEOM/GEOM_ISubShape.hxx new file mode 100644 index 000000000..76113bb7b --- /dev/null +++ b/src/GEOM/GEOM_ISubShape.hxx @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// NOTE: This is an intreface to a function for the Shapes +// (Wire, Face, Shell, Solid and Compound) creation. + + +#include "GEOM_Function.hxx" + +#include "TColStd_HSequenceOfTransient.hxx" +#include "TColStd_HArray1OfInteger.hxx" + +#define SHAPE_ARG_MAIN_SHAPE 1 +#define SHAPE_ARG_INDICES 2 +#define SHAPE_ARG_SORTED 3 + +class GEOM_ISubShape +{ + public: + + GEOM_ISubShape(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetMainShape(Handle(GEOM_Function) theRefBase) + { _func->SetReference(SHAPE_ARG_MAIN_SHAPE, theRefBase); } + + Handle(GEOM_Function) GetMainShape() { return _func->GetReference(SHAPE_ARG_MAIN_SHAPE); } + + void SetIndices(const Handle(TColStd_HArray1OfInteger)& theIndices) + { _func->SetIntegerArray(SHAPE_ARG_INDICES, theIndices); } + + Handle(TColStd_HArray1OfInteger) GetIndices() + { return _func->GetIntegerArray(SHAPE_ARG_INDICES); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOM/GEOM_Object.cxx b/src/GEOM/GEOM_Object.cxx new file mode 100644 index 000000000..f386840bb --- /dev/null +++ b/src/GEOM/GEOM_Object.cxx @@ -0,0 +1,425 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TYPE 2 +#define FUNCTION_LABEL(theNb) (_label.FindChild(1).FindChild((theNb))) +#define FREE_LABEL 3 + +//======================================================================= +//function : GetObjectID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Object::GetObjectID() +{ + static Standard_GUID anObjectID("FF1BBB01-5D14-4df2-980B-3A668264EA16"); + return anObjectID; +} + +//======================================================================= +//function : GetSubShapeID +//purpose : +//======================================================================= +const Standard_GUID& GEOM_Object::GetSubShapeID() +{ + static Standard_GUID anObjectID("FF1BBB68-5D14-4df2-980B-3A668264EA16"); + return anObjectID; +} + +//============================================================================= +/*! + * GetObject + */ +//============================================================================= +Handle(GEOM_Object) GEOM_Object::GetObject(TDF_Label& theLabel) +{ + if (!theLabel.IsAttribute(GetObjectID())) return NULL; + + TCollection_AsciiString anEntry; + TDF_Tool::Entry(theLabel, anEntry); + + Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theLabel.Data()); + if(aDoc.IsNull()) return NULL; + + Handle(TDataStd_Integer) anID; + if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return NULL; + + + GEOM_Engine* anEngine= GEOM_Engine::GetEngine(); + if(anEngine == NULL) return NULL; + return anEngine->GetObject(anID->Get(), anEntry.ToCString()); +} + +//============================================================================= +/*! + * GetReferencedObject + */ +//============================================================================= +Handle(GEOM_Object) GEOM_Object::GetReferencedObject(TDF_Label& theLabel) +{ + Handle(TDF_Reference) aRef; + if (!theLabel.FindAttribute(TDF_Reference::GetID(), aRef)) return NULL; + + // Get TreeNode of a referenced function + Handle(TDataStd_TreeNode) aT, aFather; + if (!TDataStd_TreeNode::Find(aRef->Get(), aT)) return NULL; + + // Get TreeNode of Object of the referenced function + aFather = aT->Father(); + if (aFather.IsNull()) return NULL; + + // Get label of the referenced object + TDF_Label aLabel = aFather->Label(); + + + return GEOM_Object::GetObject(aLabel); +} + +//============================================================================= +/*! + * Constructor: private + */ +//============================================================================= +GEOM_Object::GEOM_Object(TDF_Label& theEntry) +: _label(theEntry), _ior("") +{ + if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root)) + _root = TDataStd_TreeNode::Set(theEntry); +} + +//============================================================================= +/*! + * Constructor: public + */ +//============================================================================= +GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType) +: _label(theEntry), _ior("") +{ + theEntry.ForgetAllAttributes(Standard_True); + + if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root)) + _root = TDataStd_TreeNode::Set(theEntry); + + TDataStd_Integer::Set(theEntry.FindChild(TYPE), theType); + + TDataStd_UAttribute::Set(theEntry, GetObjectID()); +} + +//============================================================================= +/*! + * GetType + */ +//============================================================================= +int GEOM_Object::GetType() +{ + Handle(TDataStd_Integer) aType; + if(!_label.FindChild(TYPE).FindAttribute(TDataStd_Integer::GetID(), aType)) return -1; + + return aType->Get(); +} + +//============================================================================= +/*! + * SetType + */ +//============================================================================= +void GEOM_Object::SetType(int theType) +{ + TDataStd_Integer::Set(_label.FindChild(TYPE), theType); + return; +} + + +//============================================================================= +/*! + * GetDocID + */ +//============================================================================= +int GEOM_Object::GetDocID() +{ + Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data()); + if(aDoc.IsNull()) return -1; + + Handle(TDataStd_Integer) anID; + if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return -1; + + return anID->Get(); +} + + +//============================================================================= +/*! + * GetValue + */ +//============================================================================= +TopoDS_Shape GEOM_Object::GetValue() +{ + TopoDS_Shape aShape; + + Handle(GEOM_Function) aFunction = GetLastFunction(); + + if (!aFunction.IsNull()) + aShape = aFunction->GetValue(); + + return aShape; +} + +//============================================================================= +/*! + * SetName + */ +//============================================================================= +void GEOM_Object::SetName(const char* theName) +{ + TDataStd_Name::Set(_label, (char*)theName); +} + +//============================================================================= +/*! + * GetName + */ +//============================================================================= +char* GEOM_Object::GetName() +{ + Handle(TDataStd_Name) aNameAttr; + if(!_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) return NULL; + + TCollection_AsciiString aName(aNameAttr->Get()); + return aName.ToCString(); +} + +//============================================================================= +/*! + * SetAuxData + */ +//============================================================================= +void GEOM_Object::SetAuxData(const char* theData) +{ + TDataStd_Comment::Set(_label, (char*)theData); +} + +//============================================================================= +/*! + * GetAuxData + */ +//============================================================================= +TCollection_AsciiString GEOM_Object::GetAuxData() +{ + TCollection_AsciiString aData; + + Handle(TDataStd_Comment) aCommentAttr; + if (_label.FindAttribute(TDataStd_Comment::GetID(), aCommentAttr)) + aData = aCommentAttr->Get(); + + return aData; +} + + +//============================================================================= +/*! + * IsSubShape + */ +//============================================================================= +bool GEOM_Object::IsMainShape() +{ + Handle(GEOM_Function) aFunction = GetFunction(1); + if(aFunction == NULL || aFunction->GetDriverGUID() != GetSubShapeID()) return true; + return false; +} + + +//============================================================================= +/*! + * AddFunction + */ +//============================================================================= +Handle(GEOM_Function) GEOM_Object::AddFunction(const Standard_GUID& theGUID, int theFunctionType) +{ + Standard_Integer nb = GetNbFunctions(); + if(nb == 1 && theGUID == GetSubShapeID()) return NULL; //It's impossible to add a function to sub shape + nb++; + TDF_Label aChild = FUNCTION_LABEL(nb); + + Handle(TDataStd_TreeNode) aNode = TDataStd_TreeNode::Set(aChild); + _root->Append(aNode); + + Handle(GEOM_Function) aFunction = new GEOM_Function(aChild, theGUID, theFunctionType); + + return aFunction; + +} + +//============================================================================= +/*! + * GetNbFunctions + */ +//============================================================================= +int GEOM_Object::GetNbFunctions() +{ + Standard_Integer nb = 0; + for(TDataStd_ChildNodeIterator CI(_root); CI.More(); CI.Next()) nb++; + return nb; +} + +//============================================================================= +/*! + * GetFunction + */ +//============================================================================= +Handle(GEOM_Function) GEOM_Object::GetFunction(int theFunctionNumber) +{ + TDF_Label aChild = FUNCTION_LABEL(theFunctionNumber); + return GEOM_Function::GetFunction(aChild); +} + +//============================================================================= +/*! + * GetlastFunction + */ +//============================================================================= +Handle(GEOM_Function) GEOM_Object::GetLastFunction() +{ + Standard_Integer nb = GetNbFunctions(); + if(nb) return GetFunction(nb); + + return NULL; +} + + +//============================================================================= +/*! + * GetAllDependency + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOM_Object::GetAllDependency() +{ + Handle(TColStd_HSequenceOfTransient) anArray; + TDF_LabelSequence aSeq; + Standard_Integer nb = GetNbFunctions(); + if(nb == 0) return anArray; + for(Standard_Integer i=1; i<=nb; i++) { + Handle(GEOM_Function) aFunction = GetFunction(i); + if(aFunction.IsNull()) continue; + aFunction->GetDependency(aSeq); + } + + Standard_Integer aLength = aSeq.Length(); + if(aLength > 0) { + anArray = new TColStd_HSequenceOfTransient; + for(Standard_Integer j =1; j<=aLength; j++) + anArray->Append(GetReferencedObject(aSeq(j))); + } + + return anArray; +} + +//============================================================================= +/*! + * GetLastDependency + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOM_Object::GetLastDependency() +{ + Handle(TColStd_HSequenceOfTransient) anArray; + Handle(GEOM_Function) aFunction = GetLastFunction(); + if (aFunction.IsNull()) return anArray; + + TDF_LabelSequence aSeq; + aFunction->GetDependency(aSeq); + Standard_Integer aLength = aSeq.Length(); + if (aLength > 0) { + anArray = new TColStd_HSequenceOfTransient; + for (Standard_Integer i = 1; i <= aLength; i++) + anArray->Append(GetReferencedObject(aSeq(i))); + } + + return anArray; +} + +//============================================================================= +/*! + * GetFreeLabel + */ +//============================================================================= +TDF_Label GEOM_Object::GetFreeLabel() +{ + return _label.FindChild(FREE_LABEL); +} + +//======================================================================= +//function : GEOM_Object_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOM_Object_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_Object", + sizeof(GEOM_Object), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOM_Object) Handle(GEOM_Object)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_Object) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_Object))) { + _anOtherObject = Handle(GEOM_Object)((Handle(GEOM_Object)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOM/GEOM_Object.hxx b/src/GEOM/GEOM_Object.hxx new file mode 100644 index 000000000..b512abfe9 --- /dev/null +++ b/src/GEOM/GEOM_Object.hxx @@ -0,0 +1,256 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOM_Object_HeaderFile +#define _GEOM_Object_HeaderFile + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TDF_Label_HeaderFile +#include +#endif +#ifndef _TColStd_HSequenceOfTransient_HeaderFile +#include +#endif +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif + +class Handle_TColStd_HSequenceOfTransient; +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class GEOM_Object; + + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Object); + +class Handle(GEOM_Object) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOM_Object)():Handle(MMgt_TShared)() {} + Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(GEOM_Object)& operator=(const Handle(GEOM_Object)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_Object)& operator=(const GEOM_Object* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_Object* operator->() + { + return (GEOM_Object *)ControlAccess(); + } + + GEOM_Object* operator->() const + { + return (GEOM_Object *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_Object)() {}; + + Standard_EXPORT static const Handle(GEOM_Object) DownCast(const Handle(Standard_Transient)& AnObject); +}; + + + +#include +#include +#include "GEOM_Function.hxx" +#include "GEOM_Engine.hxx" + + +class GEOM_Object : public MMgt_TShared +{ + friend class GEOM_Engine; + + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); } + + private: + GEOM_Object(TDF_Label& theLabel); + + public: + Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType); + Standard_EXPORT ~GEOM_Object() {;} + + //Finds a GEOM_Object on the label theLabel + Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel); + + //Finds a GEOM_Object by a reference, stored on the label theLabel + Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel); + + //Returns a GEOM_Object common GUID + Standard_EXPORT static const Standard_GUID& GetObjectID(); + + //Returns a GUID associated with a sub shape object + Standard_EXPORT static const Standard_GUID& GetSubShapeID(); + + //########################################################### + //Access to properties + //########################################################### + + //Returns a TreeNode that presents a root of a function tree for this GEOM_Object + Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; } + + //Returns a label of this GEOM_Object + Standard_EXPORT TDF_Label GetEntry() { return _label; } + + //Returns a type of this GEOM_Object (GEOM_POINT, GEOM_VECTOR...) + Standard_EXPORT int GetType(); + + //Sets the type of this GEOM_Object + Standard_EXPORT void SetType(int theType); + + //Returns an ID of the OCAF document where this GEOM_Object is stored + Standard_EXPORT int GetDocID(); + + //Returns a value (as TopoDS_Shape) of this GEOM_Object + Standard_EXPORT TopoDS_Shape GetValue(); + + //Sets a name of this GEOM_Object + Standard_EXPORT void SetName(const char* theName); + + //Returns a name of this GEOM_Object + Standard_EXPORT char* GetName(); + + //Sets an auxiliary data + Standard_EXPORT void SetAuxData(const char* theData); + + //Returns an auxiliary data + Standard_EXPORT TCollection_AsciiString GetAuxData(); + + //########################################################### + // Sub shape methods + //########################################################### + + //Returns false if the object is a sub shape of another object + Standard_EXPORT bool IsMainShape(); + + //########################################################### + // CORBA related methods + //########################################################### + + //Sets an IOR of CORBA GEOM_Object_i which refers to this object + Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; } + + //Returns an IOR of CORBA GEOM_Object_i which refers to this object + Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; } + + //########################################################### + //Functions methods + //########################################################### + + //Adds a function with a driver GUID = theGUID and a type theFunctionType to the function tree of this GEOM_Object + Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType); + + //Returns a number of functions of this GEOM_Object + Standard_EXPORT int GetNbFunctions(); + + //Returns a function with given number theFunctionNumber + Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber); + + //Return the last function of this GEOM_Object + Standard_EXPORT Handle(GEOM_Function) GetLastFunction(); + + //Returns all dependencies of the object + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency(); + + //Returns the dependencies of the last function + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency(); + + //########################################################### + // Internal methods + //########################################################### + + //Returns a label which could be used to store some additional data + Standard_EXPORT TDF_Label GetFreeLabel(); + + + private: + + Handle(TDataStd_TreeNode) _root; + TDF_Label _label; + TCollection_AsciiString _ior; +}; + +#endif diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx new file mode 100644 index 000000000..86c576c64 --- /dev/null +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -0,0 +1,99 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "GEOM_PythonDump.hxx" + +#include + +namespace GEOM +{ + size_t TPythonDump::myCounter = 0; + + TPythonDump::TPythonDump (Handle(GEOM_Function)& theFunction, bool theAppend) + { + myFunction = theFunction; + myCounter++; + myAppend = theAppend; + } + + TPythonDump::~TPythonDump() + { + if (--myCounter == 0) { + TCollection_AsciiString aDescr; + if ( myAppend ) + aDescr = myFunction->GetDescription() + "\n\t"; + aDescr += (char *)myStream.str().c_str(); + myFunction->SetDescription( aDescr ); + } + } + +// TPythonDump::operator TCollection_AsciiString () const +// { +// if (myCounter == 1) { +// return TCollection_AsciiString ((char *)myStream.str().c_str()); +// } +// return TCollection_AsciiString (); +// } + + TPythonDump& TPythonDump::operator<< (long int theArg) + { + myStream<GetEntry(), anEntry); + myStream << anEntry.ToCString(); + return *this; + } +} diff --git a/src/GEOM/GEOM_PythonDump.hxx b/src/GEOM/GEOM_PythonDump.hxx new file mode 100644 index 000000000..0288f4b1a --- /dev/null +++ b/src/GEOM/GEOM_PythonDump.hxx @@ -0,0 +1,56 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef _GEOM_PYTHONDUMP_HXX_ +#define _GEOM_PYTHONDUMP_HXX_ + +#include + +#include "GEOM_Object.hxx" +#include "GEOM_Function.hxx" + +#include + +namespace GEOM +{ + class TPythonDump + { + std::ostringstream myStream; + static size_t myCounter; + bool myAppend; + + Handle(GEOM_Function) myFunction; + + public: + Standard_EXPORT TPythonDump (Handle(GEOM_Function)& theFunction, bool theAppend=false); + Standard_EXPORT virtual ~TPythonDump(); + +// operator TCollection_AsciiString () const; + + Standard_EXPORT TPythonDump& operator<< (long int theArg); + Standard_EXPORT TPythonDump& operator<< (int theArg); + Standard_EXPORT TPythonDump& operator<< (double theArg); + Standard_EXPORT TPythonDump& operator<< (float theArg); + Standard_EXPORT TPythonDump& operator<< (const void* theArg); + Standard_EXPORT TPythonDump& operator<< (const char* theArg); + Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_Object)& theObject); + }; +} + +#endif diff --git a/src/GEOM/GEOM_Solver.cxx b/src/GEOM/GEOM_Solver.cxx new file mode 100644 index 000000000..6b680f8cd --- /dev/null +++ b/src/GEOM/GEOM_Solver.cxx @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include "GEOM_Solver.hxx" +#include +#include +#include +#include +#include +#include "GEOM_Function.hxx" +#include + +//============================================================================= +/*! + * Update + */ +//============================================================================= +bool GEOM_Solver::Update(int theDocID, TDF_LabelSequence& theSeq) +{ + return false; +} + +//============================================================================= +/*! + * UpdateObject + */ +//============================================================================= +bool GEOM_Solver::UpdateObject(Handle(GEOM_Object) theObject, TDF_LabelSequence& theSeq) +{ + return false; +} + +//============================================================================= +/*! + * ComputeFunction + */ +//============================================================================= +bool GEOM_Solver::ComputeFunction(Handle(GEOM_Function) theFunction) +{ + if(theFunction == NULL) return false; + Standard_GUID aGUID = theFunction->GetDriverGUID(); + + Handle(TFunction_Driver) aDriver; + if(!TFunction_DriverTable::Get()->FindDriver(aGUID, aDriver)) return false; + + aDriver->Init(theFunction->GetEntry()); + + TFunction_Logbook aLog; + if(aDriver->Execute(aLog) == 0) return false; + + return true; +} diff --git a/src/GEOM/GEOM_Solver.hxx b/src/GEOM/GEOM_Solver.hxx new file mode 100644 index 000000000..e0ea881f8 --- /dev/null +++ b/src/GEOM/GEOM_Solver.hxx @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_Solver_HXX_ +#define _GEOM_Solver_HXX_ + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include "GEOM_Function.hxx" + +#include + +class GEOM_Solver +{ + public: + Standard_EXPORT GEOM_Solver(GEOM_Engine* theEngine) :_engine(theEngine) {} + Standard_EXPORT ~GEOM_Solver() {} + + //Update the values of all GEOM_Object in the document theDocID, theSeq will contain a list of touched labels + //Note: not Implemented + Standard_EXPORT bool Update(int theDocID, TDF_LabelSequence& theSeq); + + //Updates a value of theObject, theSeq will contain a list of touched labels + //Note: not implemented + Standard_EXPORT bool UpdateObject(Handle(GEOM_Object) theObject, TDF_LabelSequence& theSeq); + + //Recomputes a function + Standard_EXPORT bool ComputeFunction(Handle(GEOM_Function) theFunction); + + private: + + GEOM_Engine* _engine; + +}; + +#endif diff --git a/src/GEOM/GEOM_SubShapeDriver.cxx b/src/GEOM/GEOM_SubShapeDriver.cxx new file mode 100644 index 000000000..f33df3046 --- /dev/null +++ b/src/GEOM/GEOM_SubShapeDriver.cxx @@ -0,0 +1,170 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + + +//======================================================================= +//function : GEOM_SubShapeDriver +//purpose : +//======================================================================= +GEOM_SubShapeDriver::GEOM_SubShapeDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOM_SubShapeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOM_ISubShape aCI (aFunction); + + TDF_Label aLabel = aCI.GetMainShape()->GetOwnerEntry(); + if (aLabel.IsRoot()) return 0; + Handle(GEOM_Object) anObj = GEOM_Object::GetObject(aLabel); + if (anObj.IsNull()) return 0; + TopoDS_Shape aMainShape = anObj->GetValue(); + if (aMainShape.IsNull()) return 0; + + Handle(TColStd_HArray1OfInteger) anIndices = aCI.GetIndices(); + if (anIndices.IsNull() || anIndices->Length() <= 0) return 0; + + BRep_Builder B; + TopoDS_Compound aCompound; + TopoDS_Shape aShape; + + if (anIndices->Length() == 1 && anIndices->Value(1) == -1) { //The empty subshape + B.MakeCompound(aCompound); + aShape = aCompound; + + } else { + + TopTools_IndexedMapOfShape aMapOfShapes; + TopExp::MapShapes(aMainShape, aMapOfShapes); + + if (anIndices->Length() > 1) { + + B.MakeCompound(aCompound); + + for (int i = anIndices->Lower(); i<= anIndices->Upper(); i++) { + if (aMapOfShapes.Extent() < anIndices->Value(i)) + Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); + TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i)); + if (aSubShape.IsNull()) continue; + B.Add(aCompound,aSubShape); + } + + aShape = aCompound; + + } else { + + if (aMapOfShapes.Extent() < anIndices->Value(1)) + Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); + aShape = aMapOfShapes.FindKey(anIndices->Value(1)); + } + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOM_SubShapeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOM_SubShapeDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOM_SubShapeDriver", + sizeof(GEOM_SubShapeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOM_SubShapeDriver) Handle(GEOM_SubShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOM_SubShapeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOM_SubShapeDriver))) { + _anOtherObject = Handle(GEOM_SubShapeDriver)((Handle(GEOM_SubShapeDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOM/GEOM_SubShapeDriver.hxx b/src/GEOM/GEOM_SubShapeDriver.hxx new file mode 100644 index 000000000..a32a96cdd --- /dev/null +++ b/src/GEOM/GEOM_SubShapeDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ShapeDriver.ixx +// Module : GEOM + +#ifndef _GEOM_SubShapeDriver_HeaderFile +#define _GEOM_SubShapeDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOM_SubShapeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_SubShapeDriver); + +class Handle(GEOM_SubShapeDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOM_SubShapeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOM_SubShapeDriver)(const Handle(GEOM_SubShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOM_SubShapeDriver)(const GEOM_SubShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOM_SubShapeDriver)& operator=(const Handle(GEOM_SubShapeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_SubShapeDriver)& operator=(const GEOM_SubShapeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_SubShapeDriver* operator->() + { + return (GEOM_SubShapeDriver *)ControlAccess(); + } + + GEOM_SubShapeDriver* operator->() const + { + return (GEOM_SubShapeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_SubShapeDriver)() {}; + + Standard_EXPORT static const Handle(GEOM_SubShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOM_SubShapeDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOM_SubShapeDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOM_SubShapeDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOM_SubShapeDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_SubShapeDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_SubShapeDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOM/Handle_GEOM_Application.hxx b/src/GEOM/Handle_GEOM_Application.hxx new file mode 100644 index 000000000..520dc194a --- /dev/null +++ b/src/GEOM/Handle_GEOM_Application.hxx @@ -0,0 +1,96 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : Handle_GEOM_Application.hxx +// Module : GEOM + +#ifndef _Handle_GEOM_Application_HeaderFile +#define _Handle_GEOM_Application_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TDocStd_Application_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TDocStd_Application); +class GEOM_Application; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SimpleOCAF_Application); + +class Handle(GEOM_Application) : public Handle(TDocStd_Application) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(GEOM_Application)():Handle(TDocStd_Application)() {} + Handle(GEOM_Application)(const Handle(GEOM_Application)& aHandle) : Handle(TDocStd_Application)(aHandle) + { + } + + Handle(GEOM_Application)(const GEOM_Application* anItem) : Handle(TDocStd_Application)((TDocStd_Application *)anItem) + { + } + + Handle(GEOM_Application)& operator=(const Handle(GEOM_Application)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOM_Application)& operator=(const GEOM_Application* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOM_Application* operator->() + { + return (GEOM_Application *)ControlAccess(); + } + + GEOM_Application* operator->() const + { + return (GEOM_Application *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOM_Application)(); + + Standard_EXPORT static const Handle(GEOM_Application) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOM/Makefile.in b/src/GEOM/Makefile.in new file mode 100644 index 000000000..ca263cd97 --- /dev/null +++ b/src/GEOM/Makefile.in @@ -0,0 +1,59 @@ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets + +LIB = libGEOMbasic.la +LIB_SRC = GEOM_Application.cxx \ + GEOM_Engine.cxx \ + GEOM_Function.cxx \ + GEOM_Object.cxx \ + GEOM_IOperations.cxx \ + GEOM_Solver.cxx \ + GEOM_SubShapeDriver.cxx \ + GEOM_PythonDump.cxx \ + GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx \ + GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx \ + GEOM_DataMapOfAsciiStringTransient_0.cxx + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +# header files +EXPORT_HEADERS= GEOM_Application.hxx \ + Handle_GEOM_Application.hxx \ + GEOM_Engine.hxx \ + GEOM_Function.hxx \ + GEOM_Object.hxx \ + GEOM_IOperations.hxx \ + GEOM_ISubShape.hxx \ + GEOM_Solver.hxx \ + GEOM_PythonDump.hxx \ + GEOM_DataMapOfAsciiStringTransient.hxx \ + Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_OCAF) $(CAS_OCAFVIS) + + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ + diff --git a/src/GEOMAlgo/BlockFix.cdl b/src/GEOMAlgo/BlockFix.cdl new file mode 100644 index 000000000..3fab40f93 --- /dev/null +++ b/src/GEOMAlgo/BlockFix.cdl @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: BlockFix.cdl +-- Created: Tue Dec 7 11:59:05 2004 +-- Author: Pavel Durandin +-- +---Copyright: Open CASCADE SA 2004 + + + + +package BlockFix + +uses + + TColStd, + gp, + Geom, + Geom2d, + GeomAbs, + TopLoc, + TopoDS, + BRepTools, + TopTools, + ShapeBuild + +is + + class SphereSpaceModifier; + + class UnionFaces; + + class UnionEdges; + + class BlockFixAPI; + ---Purpose: API class to perform the fixing of the + -- block + + class PeriodicSurfaceModifier; + + class CheckTool; + + RotateSphereSpace (S: Shape from TopoDS; Tol: Real) + returns Shape from TopoDS; + + FixRanges (S: Shape from TopoDS; Tol: Real) + returns Shape from TopoDS; + ---Purpose: checking and fixing cases where parametric + -- boundaries of face based on periodic surface are not + -- contained in the range of this surface. + +end BlockFix; diff --git a/src/GEOMAlgo/BlockFix.cxx b/src/GEOMAlgo/BlockFix.cxx new file mode 100644 index 000000000..11c973a18 --- /dev/null +++ b/src/GEOMAlgo/BlockFix.cxx @@ -0,0 +1,215 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BlockFix.cxx +// Created: Tue Dec 7 11:59:05 2004 +// Author: Pavel DURANDIN +// Copyright: Open CASCADE SA 2004 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + + +//======================================================================= +//function : FixResult +//purpose : auxilary +//======================================================================= +static void FixResult(const TopoDS_Shape& result, + Handle(ShapeBuild_ReShape)& Context, + const Standard_Real Tol) +{ + for (TopExp_Explorer ex_f(result,TopAbs_FACE); ex_f.More(); ex_f.Next()) { + TopoDS_Shape aShape = Context->Apply(ex_f.Current().Oriented(TopAbs_FORWARD)); + // face coud not be dropped or splitted on this step + TopoDS_Face aFace = TopoDS::Face(aShape); + TopLoc_Location L; + Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L); + + if( Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || + Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ) { + + Standard_Integer nbWires = 0; + for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) { + nbWires++; + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()), + aFace, + Precision::Confusion()); + sfw->FixReorder(); + if(sfw->StatusReorder ( ShapeExtend_FAIL )) + continue; + + sfw->SetPrecision(2.*Tol); + sfw->FixShifted(); + + Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE ); + isDone |= sfw->FixDegenerated(); + + // remove degenerated edges from not degenerated points + ShapeAnalysis_Edge sae; + Handle(ShapeExtend_WireData) sewd = sfw->WireData(); + Standard_Integer i; + for( i = 1; i<=sewd->NbEdges();i++) { + TopoDS_Edge E = sewd->Edge(i); + if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aFace)) { + sewd->Remove(i); + isDone = Standard_True; + i--; + } + } + + //isDone |= sfw->FixLacking(); // commented by skl 22.03.2005 (PAL8395) + + // remove neighbour seam edges + if(isDone) { + for( i = 1; iNbEdges();i++) { + if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) { + isDone = Standard_True; + sewd->Remove(i); + sewd->Remove(i); + i--; + } + } + if(sewd->IsSeam(1) && sewd->IsSeam(sewd->NbEdges())) { + sewd->Remove(1); + sewd->Remove(sewd->NbEdges()); + } + } + + + if(isDone) { + TopoDS_Wire ResWire = sfw->Wire(); + Context->Replace(ex_w.Current(), ResWire); + }; + } + // Implement fix orientation in case of several wires + if(nbWires > 1) { + TopoDS_Face aFixedFace = TopoDS::Face(Context->Apply(aFace)); + Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFixedFace); + if(sff->FixOrientation()) + Context->Replace(aFixedFace,sff->Face()); + } + + } + } +} + + + + + +//======================================================================= +//function : ConvertToAnalytical +//purpose : +//======================================================================= + +TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S, + const Standard_Real Tol) +{ + + // Create a modification description + Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier; + SR->SetTolerance(Tol); + + TopTools_DataMapOfShapeShape context; + BRepTools_Modifier MD; + TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD ); + + Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape; + FixResult(result,RS,Tol); + result = RS->Apply(result); + + ShapeFix_Edge sfe; + for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(exp.Current()); + sfe.FixVertexTolerance (E); + } + + ShapeFix::SameParameter(result,Standard_False); + return result; +} + + +//======================================================================= +//function : FixRanges +//purpose : +//======================================================================= + +TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S, + const Standard_Real Tol) +{ + // Create a modification description + Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier; + SR->SetTolerance(Tol); + + TopTools_DataMapOfShapeShape context; + BRepTools_Modifier MD; + TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD ); + + Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape; + FixResult(result,RS,Tol); + result = RS->Apply(result); + + ShapeFix_Edge sfe; + for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(exp.Current()); + sfe.FixVertexTolerance (E); + } + + ShapeFix::SameParameter(result,Standard_False); + + return result; +} diff --git a/src/GEOMAlgo/BlockFix.jxx b/src/GEOMAlgo/BlockFix.jxx new file mode 100644 index 000000000..16e91bb0d --- /dev/null +++ b/src/GEOMAlgo/BlockFix.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _BlockFix_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl b/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl new file mode 100644 index 000000000..fc1e28f62 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.cdl @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: BlockFix_BlockFixAPI.cdl +-- Created: Tue Dec 7 17:56:09 2004 +-- Author: Pavel Durandin +-- +---Copyright: Open CASCADE SA 2004 + +class BlockFixAPI from BlockFix inherits TShared from MMgt + + ---Purpose: + +uses + + Shape from TopoDS, + ReShape from ShapeBuild + +is + Create returns BlockFixAPI from BlockFix; + ---Purpose: Empty constructor + + SetShape(me: mutable; Shape: Shape from TopoDS); + ---Purpose: Sets the shape to be operated on + ---C++: inline + + Perform(me: mutable); + ---Purpose: + + Shape(me) returns Shape from TopoDS; + ---Purpose: Returns resulting shape. + ---C++: inline + + Context(me:mutable) returns ReShape from ShapeBuild; + ---Purpose: Returns modifiable context for storing the + -- mofifications + ---C++: inline + ---C++: return & + + Tolerance (me:mutable) returns Real; + ---Purpose: Returns modifiable tolerance of recognition + ---C++: inline + ---C++: return & + +fields + + myContext : ReShape from ShapeBuild; + myShape : Shape from TopoDS; + myTolerance : Real from Standard; + +end BlockFixAPI from BlockFix; diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx new file mode 100644 index 000000000..41677111c --- /dev/null +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.cxx @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BlockFix_BlockFixAPI.cxx +// Created: Tue Dec 7 11:59:05 2004 +// Author: Pavel DURANDIN +// Copyright: Open CASCADE SA 2004 + + +#include +#include +#include +#include +#include + +//======================================================================= +//function : ShapeConvert_CanonicAPI +//purpose : +//======================================================================= + +BlockFix_BlockFixAPI::BlockFix_BlockFixAPI() +{ + myTolerance = Precision::Confusion(); +} + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +void BlockFix_BlockFixAPI::Perform() +{ + + // processing spheres with degenerativities + TopoDS_Shape aShape = Shape(); + myShape = BlockFix::RotateSphereSpace(aShape,myTolerance); + + // faces unification + BlockFix_UnionFaces aFaceUnifier; + aFaceUnifier.GetTolerance() = myTolerance; + TopoDS_Shape aResult; + aResult = aFaceUnifier.Perform(myShape); + + + BlockFix_UnionEdges anEdgeUnifier; + myShape = anEdgeUnifier.Perform(aResult,myTolerance); + + TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance); + myShape = aRes; + +} diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx new file mode 100644 index 000000000..b1415ecd4 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _ShapeBuild_ReShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _BlockFix_BlockFixAPI_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx b/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx new file mode 100644 index 000000000..77841f932 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_BlockFixAPI.lxx @@ -0,0 +1,61 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + +inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape) +{ + myShape = Shape; +} + +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + +inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const +{ + return myShape; +} + +//======================================================================= +//function : Context +//purpose : +//======================================================================= + +inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context() +{ + return myContext; +} + +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= + +inline Standard_Real& BlockFix_BlockFixAPI::Tolerance() +{ + return myTolerance; +} + diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cdl b/src/GEOMAlgo/BlockFix_CheckTool.cdl new file mode 100644 index 000000000..b4875d806 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_CheckTool.cdl @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: BlockFix_CheckTool.cdl +-- Created: Fri Dec 17 10:36:58 2004 +-- Author: Sergey KUUL +-- +---Copyright: Open CASCADE SA 2004 + +class CheckTool from BlockFix + + ---Purpose: + +uses + + Shape from TopoDS, + SequenceOfShape from TopTools + +is + + Create returns CheckTool from BlockFix; + ---Purpose: Empty constructor + + SetShape(me: in out; aShape: Shape from TopoDS); + + Perform(me: in out); + ---Purpose: + + NbPossibleBlocks(me) returns Integer; + + PossibleBlock(me; num: Integer) returns Shape from TopoDS; + + DumpCheckResult(me; S : in out OStream); + ---Purpose: Dumps results of checking + + +fields + + myShape : Shape from TopoDS; + myHasCheck : Boolean; + myNbSolids : Integer; + myNbBlocks : Integer; + myPossibleBlocks : SequenceOfShape from TopTools; + myNbDegen : Integer; + myNbUF : Integer; + myNbUE : Integer; + myNbUFUE : Integer; + myBadRanges : Integer; + +end CheckTool; diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cxx b/src/GEOMAlgo/BlockFix_CheckTool.cxx new file mode 100644 index 000000000..6348ffc07 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_CheckTool.cxx @@ -0,0 +1,260 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BlockFix_CheckTool.cxx +// Created: 17.12.04 11:15:25 +// Author: Sergey KUUL +// Copyright: Open CASCADE SA 2004 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//======================================================================= +//function : BlockFix_CheckTool() +//purpose : Constructor +//======================================================================= + +BlockFix_CheckTool::BlockFix_CheckTool( ) +{ + myHasCheck = Standard_False; + myPossibleBlocks.Clear(); +} + + +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= + +void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape) +{ + myHasCheck = Standard_False; + myShape = aShape; + myPossibleBlocks.Clear(); +} + + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +void BlockFix_CheckTool::Perform() +{ + myNbSolids=0; + myNbBlocks=0; + myNbDegen=0; + myNbUF=0; + myNbUE=0; + myNbUFUE=0; + TopExp_Explorer exps; + for(exps.Init(myShape, TopAbs_SOLID); exps.More(); exps.Next()) { + TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + myNbSolids++; + Standard_Boolean IsBlock=Standard_True; + Standard_Boolean MayBeUF=Standard_False; + Standard_Boolean MayBeUE=Standard_False; + Standard_Integer nf=0; + TopExp_Explorer expf; + for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) nf++; + + if(nf<6) { + IsBlock=Standard_False; + } + else if(nf>6) { + IsBlock=Standard_False; + // check faces unification + TopTools_SequenceOfShape faces; + for( expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { + TopoDS_Face aFace = TopoDS::Face(expf.Current()); + faces.Append(aFace); + } + Standard_Boolean HasFacesForUnification = Standard_False; + for(Standard_Integer i=1; i0 ) { + IsBlock=Standard_False; + myNbDegen++; + myPossibleBlocks.Append(aSolid); + continue; + } + if(nbe<24) + IsBlock=Standard_False; + if(nbe>24) { + IsBlock=Standard_False; + // check edges unification + // creating map of edge faces + TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces; + TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces); + for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) { + TopoDS_Face aFace = TopoDS::Face(expf.Current()); + TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges; + for(expe.Init(aFace,TopAbs_EDGE); expe.More(); expe.Next()) { + TopoDS_Edge edge = TopoDS::Edge(expe.Current()); + if(!aMapEdgeFaces.Contains(edge)) continue; + const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); + TopTools_ListIteratorOfListOfShape anIter(aList); + for( ; anIter.More(); anIter.Next()) { + TopoDS_Face face = TopoDS::Face(anIter.Value()); + if(face.IsSame(aFace)) continue; + if(aMapFacesEdges.Contains(face)) { + aMapFacesEdges.ChangeFromKey(face).Append(edge); + } + else { + TopTools_ListOfShape ListEdges; + ListEdges.Append(edge); + aMapFacesEdges.Add(face,ListEdges); + } + } + } + Standard_Integer i=1; + for(; i<=aMapFacesEdges.Extent(); i++) { + const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i); + if(ListEdges.Extent()>1) break; + } + if(i<=aMapFacesEdges.Extent()) { + MayBeUE=Standard_True; + break; + } + } + } + + if(IsBlock) + myNbBlocks++; + else { + if(MayBeUF) { + myPossibleBlocks.Append(aSolid); + if(MayBeUE) + myNbUFUE++; + else + myNbUF++; + } + else if(MayBeUE) { + myNbUE++; + myPossibleBlocks.Append(aSolid); + } + } + + } + + myHasCheck = Standard_True; +} + + +//======================================================================= +//function : NbPossibleBlocks +//purpose : +//======================================================================= + +Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const +{ + return myPossibleBlocks.Length(); +} + + +//======================================================================= +//function : PossibleBlock +//purpose : +//======================================================================= + +TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const +{ + TopoDS_Shape res; + if( num>0 && num<=myPossibleBlocks.Length() ) + res = myPossibleBlocks.Value(num); + return res; +} + + +//======================================================================= +//function : DumpCheckResult +//purpose : +//======================================================================= + +void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const +{ + if(!myHasCheck) + S<<"Check not performed!"<IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { + Handle(Geom_TrimmedCurve) tc = + Handle(Geom_TrimmedCurve)::DownCast(c3d1); + c3d1 = tc->BasisCurve(); + } + TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1)); + Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2); + if(c3d2.IsNull()) break; + while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { + Handle(Geom_TrimmedCurve) tc = + Handle(Geom_TrimmedCurve)::DownCast(c3d2); + c3d2 = tc->BasisCurve(); + } + if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) { + // union lines + Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1); + Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2); + gp_Dir Dir1 = L1->Position().Direction(); + gp_Dir Dir2 = L2->Position().Direction(); + if(!Dir1.IsEqual(Dir2,Precision::Angular())) continue; + // can union lines => create new edge + TopoDS_Vertex V1 = sae.FirstVertex(edge1); + gp_Pnt PV1 = BRep_Tool::Pnt(V1); + TopoDS_Vertex V2 = sae.LastVertex(edge2); + gp_Pnt PV2 = BRep_Tool::Pnt(V2); + gp_Vec Vec(PV1,PV2); + Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec)); + Standard_Real dist = PV1.Distance(PV2); + Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist); + TopoDS_Edge E; + B.MakeEdge (E,tc,Precision::Confusion()); + B.Add (E,V1); B.Add (E,V2); + B.UpdateVertex(V1, 0., E, 0.); + B.UpdateVertex(V2, dist, E, 0.); + ShapeFix_Edge sfe; + sfe.FixAddPCurve(E,aFace,Standard_False); + sfe.FixSameParameter(E); + aChain.Remove(j); + aChain.SetValue(j,E); + j--; + } + if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) { + // union circles + Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(c3d1); + Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2); + gp_Pnt P01 = C1->Location(); + gp_Pnt P02 = C2->Location(); + if(P01.Distance(P02)>Precision::Confusion()) continue; + // can union circles => create new edge + TopoDS_Vertex V1 = sae.FirstVertex(edge1); + gp_Pnt PV1 = BRep_Tool::Pnt(V1); + TopoDS_Vertex V2 = sae.LastVertex(edge2); + gp_Pnt PV2 = BRep_Tool::Pnt(V2); + TopoDS_Vertex VM = sae.LastVertex(edge1); + gp_Pnt PVM = BRep_Tool::Pnt(VM); + GC_MakeCircle MC(PV1,PVM,PV2); + Handle(Geom_Circle) C = MC.Value(); + gp_Pnt P0 = C->Location(); + gp_Dir D1(gp_Vec(P0,PV1)); + gp_Dir D2(gp_Vec(P0,PV2)); + Standard_Real fpar = C->XAxis().Direction().Angle(D1); + Standard_Real lpar = C->XAxis().Direction().Angle(D2); + Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar); + TopoDS_Edge E; + B.MakeEdge (E,tc,Precision::Confusion()); + B.Add (E,V1); B.Add (E,V2); + B.UpdateVertex(V1, fpar, E, 0.); + B.UpdateVertex(V2, lpar, E, 0.); + ShapeFix_Edge sfe; + sfe.FixAddPCurve(E,aFace,Standard_False); + sfe.FixSameParameter(E); + aChain.Remove(j); + aChain.SetValue(j,E); + j--; + } + } + if(j1) { + // second step: union edges with various curves + cout<<"can not make analitical union => make approximation"<Apply(Shape); + + // processing each solid + TopExp_Explorer exps; + for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { + TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + + TopTools_IndexedMapOfShape ChangedFaces; + + // creating map of edge faces + TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces; + TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces); + + Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape; + TopoDS_Shape aRes = aSolid; + aRes = aContext->Apply(aSolid); + + // processing each face + TopExp_Explorer exp; + for(exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) { + TopoDS_Face aFace = + TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD))); + TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges; + + for(TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) { + TopoDS_Edge edge = TopoDS::Edge(expe.Current()); + if(!aMapEdgeFaces.Contains(edge)) continue; + const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); + TopTools_ListIteratorOfListOfShape anIter(aList); + for( ; anIter.More(); anIter.Next()) { + TopoDS_Face face = TopoDS::Face(anIter.Value()); + TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value())); + if(face1.IsSame(aFace)) continue; + if(aMapFacesEdges.Contains(face)) { + aMapFacesEdges.ChangeFromKey(face).Append(edge); + } + else { + TopTools_ListOfShape ListEdges; + ListEdges.Append(edge); + aMapFacesEdges.Add(face,ListEdges); + } + } + } + + for(Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) { + const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i); + TopTools_SequenceOfShape SeqEdges; + TopTools_ListIteratorOfListOfShape anIter(ListEdges); + for( ; anIter.More(); anIter.Next()) { + SeqEdges.Append(anIter.Value()); + } + if(SeqEdges.Length()==1) continue; + TopoDS_Edge E; + if( MergeEdges(SeqEdges,aFace,Tol,E) ) { + // now we have only one edge - aChain.Value(1) + // we have to replace old ListEdges with this new edge + aContext->Replace(SeqEdges(1),E); + for(Standard_Integer j=2; j<=SeqEdges.Length(); j++) { + aContext->Remove(SeqEdges(j)); + } + TopoDS_Face tmpF = TopoDS::Face(exp.Current()); + if( !ChangedFaces.Contains(tmpF) ) + ChangedFaces.Add(tmpF); + tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i)); + if( !ChangedFaces.Contains(tmpF) ) + ChangedFaces.Add(tmpF); + } + } + + } // end processing each face + + // fix changed faces and replace them in the local context + for(Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) { + TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i))); + Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace); + sff->SetContext(myContext); + sff->SetPrecision(myTolerance); + sff->SetMinTolerance(myTolerance); + sff->SetMaxTolerance(Max(1.,myTolerance*1000.)); + sff->Perform(); + aContext->Replace(aFace,sff->Face()); + } + + if(ChangedFaces.Extent()>0) { + // fix changed shell and replace it in the local context + TopoDS_Shape aRes1 = aContext->Apply(aRes); + TopExp_Explorer expsh; + for(expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) { + TopoDS_Shell aShell = TopoDS::Shell(expsh.Current()); + Handle(ShapeFix_Shell) sfsh = new ShapeFix_Shell; + sfsh->FixFaceOrientation(aShell); + aContext->Replace(aShell,sfsh->Shell()); + } + TopoDS_Shape aRes2 = aContext->Apply(aRes1); + // put new solid into global context + myContext->Replace(aSolid,aRes2); + } + + } // end processing each solid + + aResult = myContext->Apply(Shape); + return aResult; +} diff --git a/src/GEOMAlgo/BlockFix_UnionEdges.jxx b/src/GEOMAlgo/BlockFix_UnionEdges.jxx new file mode 100644 index 000000000..073b6d865 --- /dev/null +++ b/src/GEOMAlgo/BlockFix_UnionEdges.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _ShapeBuild_ReShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _BlockFix_UnionEdges_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cdl b/src/GEOMAlgo/BlockFix_UnionFaces.cdl new file mode 100644 index 000000000..8ed27cdae --- /dev/null +++ b/src/GEOMAlgo/BlockFix_UnionFaces.cdl @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: BlockFix_UnionFaces.cdl +-- Created: Tue Dec 7 17:15:42 2004 +-- Author: Pavel Durandin +-- +---Copyright: Open CASCADE SA 2004 + + +class UnionFaces from BlockFix + +uses + + Face from TopoDS, + Shape from TopoDS + +is + + Create returns UnionFaces from BlockFix; + ---Purpose: Empty constructor + + GetTolerance(me: in out) returns Real; + ---Purpose: Returns modifiable tolerance + ---C++: return& + + Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS; + ---Purpose: Performs the unification of the fsces + -- whith the same geometry + + IsSameDomain(me; aFace : Face from TopoDS; + aChekedFace: Face from TopoDS) + returns Boolean is virtual; + ---Purpose: Returns true is surfaces have same geometrically domain + -- with given tolerance + + MovePCurves(me; aTarget: in out Face from TopoDS; + aSource: Face from TopoDS) + is virtual; + ---Purpose: Creates pcurves on aTarget face for each edge from + -- aSource one. + +fields + + myTolerance: Real; + +end; + + diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.cxx b/src/GEOMAlgo/BlockFix_UnionFaces.cxx new file mode 100644 index 000000000..3f6c5220b --- /dev/null +++ b/src/GEOMAlgo/BlockFix_UnionFaces.cxx @@ -0,0 +1,531 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BlockFix_UnionFaces.cxx +// Created: Tue Dec 7 17:15:42 2004 +// Author: Pavel DURANDIN +// Open CASCADE SA 2004 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +//======================================================================= +//function : BlockFix_UnionFaces +//purpose : +//======================================================================= + +BlockFix_UnionFaces::BlockFix_UnionFaces() + : myTolerance(Precision::Confusion()) +{ +} + + +//======================================================================= +//function : GetTolearnce +//purpose : +//======================================================================= + +Standard_Real& BlockFix_UnionFaces::GetTolerance() +{ + return myTolerance; +} + + +//======================================================================= +//function : AddOrdinaryEdges +//purpose : auxilary +//======================================================================= +// adds edges from the shape to the sequence +// seams and equal edges are dropped +// Returns true if one of original edges dropped +static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, + const TopoDS_Shape aShape, + Standard_Integer& anIndex) +{ + //map of edges + TopTools_MapOfShape aNewEdges; + //add edges without seams + for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) { + TopoDS_Shape edge = exp.Current(); + if(aNewEdges.Contains(edge)) + aNewEdges.Remove(edge); + else + aNewEdges.Add(edge); + } + + Standard_Boolean isDropped = Standard_False; + //merge edges and drop seams + for(Standard_Integer i = 1; i <= edges.Length(); i++) { + TopoDS_Shape current = edges(i); + if(aNewEdges.Contains(current)) { + + aNewEdges.Remove(current); + edges.Remove(i); + i--; + + if(!isDropped) { + isDropped = Standard_True; + anIndex = i; + } + } + } + + //add edges to the sequemce + for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next()) + edges.Append(anIter.Key()); + + return isDropped; +} + + +//======================================================================= +//function : ClearRts +//purpose : auxilary +//======================================================================= +static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface) +{ + if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { + Handle(Geom_RectangularTrimmedSurface) rts = + Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface); + return rts->BasisSurface(); + } + return aSurface; +} + + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) +{ + Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape; + TopoDS_Shape aResShape = myContext->Apply(Shape); + + // processing each solid + TopExp_Explorer exps; + for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { + TopoDS_Solid aSolid = TopoDS::Solid(exps.Current()); + + // creating map of edge faces + TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces; + TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces); + + // map of processed shapes + TopTools_MapOfShape aProcessed; + + Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape; + + Standard_Integer NbModif=0; + Standard_Boolean hasFailed = Standard_False; + Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.),0.1); + // processing each face + TopExp_Explorer exp; + //for( exp.Init(Shape, TopAbs_FACE); exp.More(); exp.Next()) { + for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { + TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD)); + + if(aProcessed.Contains(aFace)) + continue; + + Standard_Integer dummy; + TopTools_SequenceOfShape edges; + AddOrdinaryEdges(edges,aFace,dummy); + + TopTools_SequenceOfShape faces; + faces.Append(aFace); + + //surface and location to construct result + TopLoc_Location aBaseLocation; + Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation); + aBaseSurface = ClearRts(aBaseSurface); + + // find adjacent faces to union + Standard_Integer i; + for( i = 1; i <= edges.Length(); i++) { + TopoDS_Edge edge = TopoDS::Edge(edges(i)); + if(BRep_Tool::Degenerated(edge)) + continue; + + const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); + TopTools_ListIteratorOfListOfShape anIter(aList); + for( ; anIter.More(); anIter.Next()) { + TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD)); + if(anCheckedFace.IsSame(aFace)) + continue; + + if(aProcessed.Contains(anCheckedFace)) + continue; + + if(IsSameDomain(aFace,anCheckedFace)) { + + if(aList.Extent() != 2) { + // non mainfold case is not processed + continue; + } + + // replacing pcurves + TopoDS_Face aMockUpFace; + BRep_Builder B; + B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.); + MovePCurves(aMockUpFace,anCheckedFace); + + if(AddOrdinaryEdges(edges,aMockUpFace,dummy)) { + // sequence edges is modified + i = dummy; + } + + faces.Append(anCheckedFace); + aProcessed.Add(anCheckedFace); + break; + } + } + } + + // all faces collected in the sequence. Perform union of faces + if(faces.Length() > 1) { + NbModif++; + TopoDS_Face aResult; + BRep_Builder B; + B.MakeFace(aResult,aBaseSurface,aBaseLocation,0); + Standard_Integer nbWires = 0; + + // connecting wires + while(edges.Length()>0) { + + Standard_Boolean isEdge3d = Standard_False; + nbWires++; + TopTools_MapOfShape aVertices; + TopoDS_Wire aWire; + B.MakeWire(aWire); + + TopoDS_Edge anEdge = TopoDS::Edge(edges(1)); + edges.Remove(1); + + isEdge3d |= !BRep_Tool::Degenerated(anEdge); + B.Add(aWire,anEdge); + TopoDS_Vertex V1,V2; + TopExp::Vertices(anEdge,V1,V2); + aVertices.Add(V1); + aVertices.Add(V2); + + Standard_Boolean isNewFound = Standard_False; + do { + isNewFound = Standard_False; + for(Standard_Integer j = 1; j <= edges.Length(); j++) { + anEdge = TopoDS::Edge(edges(j)); + TopExp::Vertices(anEdge,V1,V2); + if(aVertices.Contains(V1) || aVertices.Contains(V2)) { + isEdge3d |= !BRep_Tool::Degenerated(anEdge); + aVertices.Add(V1); + aVertices.Add(V2); + B.Add(aWire,anEdge); + edges.Remove(j); + j--; + isNewFound = Standard_True; + } + } + } while (isNewFound); + + // sorting eny type of edges + aWire = TopoDS::Wire(aContext->Apply(aWire)); + + TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD))); + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion()); + sfw->FixReorder(); + Standard_Boolean isDegRemoved = Standard_False; + if(!sfw->StatusReorder ( ShapeExtend_FAIL )) { + // clear degenerated edges if at least one with 3d curve exist + if(isEdge3d) { + Handle(ShapeExtend_WireData) sewd = sfw->WireData(); + for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) { + TopoDS_Edge E = sewd->Edge(j); + if(BRep_Tool::Degenerated(E)) { + sewd->Remove(j); + isDegRemoved = Standard_True; + j--; + } + } + } + sfw->FixShifted(); + if(isDegRemoved) + sfw->FixDegenerated(); + } + TopoDS_Wire aWireFixed = sfw->Wire(); + aContext->Replace(aWire,aWireFixed); + // add resulting wire + if(isEdge3d) { + B.Add(aResult,aWireFixed); + } + else { + // sorting edges + Handle(ShapeExtend_WireData) sbwd = sfw->WireData(); + Standard_Integer nbEdges = sbwd->NbEdges(); + // sort degenerated edges and create one edge instead of several ones + ShapeAnalysis_WireOrder sawo(Standard_False, 0); + ShapeAnalysis_Edge sae; + Standard_Integer aLastEdge = nbEdges; + for(Standard_Integer j = 1; j <= nbEdges; j++) { + Standard_Real f,l; + //smh protection on NULL pcurve + Handle(Geom2d_Curve) c2d; + if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) { + aLastEdge--; + continue; + } + sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY()); + } + sawo.Perform(); + + // constructind one degenerative edge + gp_XY aStart, anEnd, tmp; + Standard_Integer nbFirst = sawo.Ordered(1); + TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD)); + ShapeBuild_Edge sbe; + TopoDS_Vertex aDummyV; + TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV); + sawo.XY(nbFirst,aStart,tmp); + sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd); + + gp_XY aVec = anEnd-aStart; + Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart)); + + B.UpdateEdge(E,aLine,tmpF,0.); + B.Range(E,tmpF,0.,aVec.Modulus()); + Handle(Geom_Curve) C3d; + B.UpdateEdge(E,C3d,0.); + B.Degenerated(E,Standard_True); + TopoDS_Wire aW; + B.MakeWire(aW); + B.Add(aW,E); + B.Add(aResult,aW); + } + + } + + // perform substitution of face + aContext->Replace(aContext->Apply(aFace),aResult); + + + ShapeFix_Face sff (aResult); + //Intializing by tolerances + sff.SetPrecision(myTolerance); + sff.SetMinTolerance(tol); + sff.SetMaxTolerance(Max(1.,myTolerance*1000.)); + //Setting modes + sff.FixOrientationMode() = 0; + //sff.FixWireMode() = 0; + sff.SetContext(aContext); + // Applying the fixes + sff.Perform(); + if(sff.Status(ShapeExtend_FAIL)) + hasFailed = Standard_True; + + // breaking down to several faces + TopoDS_Shape theResult = aContext->Apply(aResult); + for(TopExp_Explorer aFaceExp(theResult,TopAbs_FACE);aFaceExp.More();aFaceExp.Next()) { + TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD)); + Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 ); + grid->SetValue ( 1, 1, aBaseSurface ); + Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid ); + ShapeFix_ComposeShell CompShell; + CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision + CompShell.SetContext( aContext ); + + TopTools_SequenceOfShape parts; + ShapeFix_SequenceOfWireSegment wires; + for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) { + Handle(ShapeExtend_WireData) sbwd = + new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() )); + ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED ); + wires.Append(seg); + } + + CompShell.DispatchWires ( parts,wires ); + for (Standard_Integer j=1; j <= parts.Length(); j++ ) { + ShapeFix_Face aFixOrient(TopoDS::Face(parts(j))); + aFixOrient.SetContext(aContext); + aFixOrient.FixOrientation(); + } + + TopoDS_Shape CompRes; + if ( faces.Length() !=1 ) { + TopoDS_Shell S; + B.MakeShell ( S ); + for ( i=1; i <= parts.Length(); i++ ) + B.Add ( S, parts(i) ); + CompRes = S; + } + else CompRes = parts(1); + + aContext->Replace(aCurrent,CompRes); + } + + // remove the remaining faces + for(i = 2; i <= faces.Length(); i++) + aContext->Remove(faces(i)); + } + } + + //TopoDS_Shape aResult = Shape; + if(NbModif>0) { + TopoDS_Shape aResult = aSolid; + if(!hasFailed) { + aResult = aContext->Apply(aSolid); + + ShapeFix_Edge sfe; + for(exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(exp.Current()); + sfe.FixVertexTolerance (E); + // ptv add fix same parameter + sfe.FixSameParameter(E, myTolerance); + } + + myContext->Replace(aSolid,aResult); + } + } +// else { + for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) { + TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD)); + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire; + sfw->SetContext(myContext); + sfw->SetPrecision(myTolerance); + sfw->SetMinTolerance(myTolerance); + sfw->SetMaxTolerance(Max(1.,myTolerance*1000.)); + sfw->SetFace(aFace); + for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) { + TopoDS_Wire wire = TopoDS::Wire ( iter.Value() ); + sfw->Load(wire); + sfw->FixReorder(); + sfw->FixShifted(); + } + } +// } + + } // end processing each solid + + aResShape = myContext->Apply(Shape); + return aResShape; +} + + +//======================================================================= +//function : IsSameDomain +//purpose : +//======================================================================= + +Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace, + const TopoDS_Face& aCheckedFace) const +{ + //checking the same handless + TopLoc_Location L1, L2; + Handle(Geom_Surface) S1, S2; + + S1 = BRep_Tool::Surface(aFace,L1); + S2 = BRep_Tool::Surface(aCheckedFace,L2); + + return (S1 == S2 && L1 == L2); +} + + +//======================================================================= +//function : MovePCurves +//purpose : +//======================================================================= + +void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget, + const TopoDS_Face& aSource) const +{ + BRep_Builder B; + for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) { + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()), + aTarget, Precision::Confusion()); + sfw->FixReorder(); + Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL ); + sfw->FixEdgeCurves(); + if(isReoredFailed) + continue; + + sfw->FixShifted(); + sfw->FixDegenerated(); + + // remove degenerated edges from not degenerated points + ShapeAnalysis_Edge sae; + Handle(ShapeExtend_WireData) sewd = sfw->WireData(); + for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) { + TopoDS_Edge E = sewd->Edge(i); + if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) { + sewd->Remove(i); + i--; + } + } + + TopoDS_Wire ResWire = sfw->Wire(); + B.Add(aTarget,ResWire); + } +} + diff --git a/src/GEOMAlgo/BlockFix_UnionFaces.jxx b/src/GEOMAlgo/BlockFix_UnionFaces.jxx new file mode 100644 index 000000000..d8f13abda --- /dev/null +++ b/src/GEOMAlgo/BlockFix_UnionFaces.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _BlockFix_UnionFaces_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl new file mode 100755 index 000000000..40a2084be --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -0,0 +1,124 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo.cdl +-- Created: Sat Dec 04 12:36:22 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +package GEOMAlgo + + ---Purpose: + +uses + TCollection, + TColStd, + Geom, + Bnd, + gp, + GeomAdaptor, + TopAbs, + TopoDS, + TopTools, + IntTools, + BOPTools, + BOP + +is + -- enumerations + -- + enumeration State is + ST_UNKNOWN, + ST_IN, + ST_OUT, + ST_ON, + ST_ONIN, + ST_ONOUT, + ST_INOUT + end State; + -- + -- classes + -- + deferred class Algo; + deferred class ShapeAlgo; + -- + -- gluer + class Gluer; + class GlueAnalyser; + class CoupleOfShapes; + class PassKey; + class PassKeyMapHasher; + class PassKeyShape; + class SurfaceTools; + class Tools; + + -- + -- finder on + deferred class ShapeSolid; + class WireSolid; + class ShellSolid; + class VertexSolid; + class SolidSolid; + class FinderShapeOn; + -- + class FinderShapeOn1; + class StateCollector; + -- + -- instantiations + class IndexedDataMapOfPassKeyShapeListOfShape + instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, + ListOfShape from TopTools, + PassKeyMapHasher from GEOMAlgo); + + class IndexedDataMapOfShapeBox + instantiates IndexedDataMap from TCollection (Shape from TopoDS, + Box from Bnd, + ShapeMapHasher from TopTools); + class IndexedDataMapOfIntegerShape + instantiates IndexedDataMap from TCollection (Integer from Standard, + Shape from TopoDS, + MapIntegerHasher from TColStd); + + class ListOfCoupleOfShapes + instantiates List from TCollection (CoupleOfShapes from GEOMAlgo); + + + class IndexedDataMapOfShapeState + instantiates IndexedDataMap from TCollection (Shape from TopoDS, + State from TopAbs, + ShapeMapHasher from TopTools); +-- + class ListOfPnt + instantiates List from TCollection (Pnt from gp); + +-- class IndexedDataMapOfPassKeyInteger +-- instantiates IndexedDataMap from TCollection (PassKeyRoot from GEOMAlgo, +-- Integer from Standard, +-- PassKeyMapHasher from GEOMAlgo); + + + class DataMapOfPassKeyInteger + instantiates DataMap from TCollection (PassKey from GEOMAlgo, + Integer from Standard, + PassKeyMapHasher from GEOMAlgo); + + +end GEOMAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cdl b/src/GEOMAlgo/GEOMAlgo_Algo.cdl new file mode 100755 index 000000000..d8cd5b175 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Algo.cdl @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_Algo.cdl +-- Created: Sat Dec 04 12:37:56 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +deferred class Algo from GEOMAlgo + + ---Purpose: + +--uses +--raises + +is + Initialize + returns Algo from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Algo();" + + Perform(me:out) + is deferred; + + CheckData(me:out) + is virtual protected; + + CheckResult(me:out) + is virtual protected; + + ErrorStatus (me) + returns Integer from Standard; + + WarningStatus (me) + returns Integer from Standard; + +fields + myErrorStatus : Integer from Standard is protected; + myWarningStatus : Integer from Standard is protected; + +end Algo; diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.cxx b/src/GEOMAlgo/GEOMAlgo_Algo.cxx new file mode 100755 index 000000000..8f4aecacb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Algo.cxx @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_Algo.cxx +// Created: Sat Dec 04 12:39:47 2004 +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +// function: +// purpose: +//======================================================================= + GEOMAlgo_Algo::GEOMAlgo_Algo() +: + myErrorStatus(1), + myWarningStatus(0) +{} +//======================================================================= +// function: ~ +// purpose: +//======================================================================= + GEOMAlgo_Algo::~GEOMAlgo_Algo() +{ +} +//======================================================================= +// function: CheckData +// purpose: +//======================================================================= + void GEOMAlgo_Algo::CheckData() +{ + myErrorStatus=0; +} +//======================================================================= +// function: CheckResult +// purpose: +//======================================================================= + void GEOMAlgo_Algo::CheckResult() +{ + myErrorStatus=0; +} +//======================================================================= +// function: ErrorStatus +// purpose: +//======================================================================= + Standard_Integer GEOMAlgo_Algo::ErrorStatus()const +{ + return myErrorStatus; +} +//======================================================================= +// function: WarningStatus +// purpose: +//======================================================================= + Standard_Integer GEOMAlgo_Algo::WarningStatus()const +{ + return myWarningStatus; +} +// myErrorStatus +// +// 1 - object is just initialized diff --git a/src/GEOMAlgo/GEOMAlgo_Algo.jxx b/src/GEOMAlgo/GEOMAlgo_Algo.jxx new file mode 100644 index 000000000..58dc7b7aa --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Algo.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_Algo_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl new file mode 100644 index 000000000..d607e55c4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cdl @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_CoupleOfShapes.cdl +-- Created: Wed Dec 15 13:00:10 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class CoupleOfShapes from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns CoupleOfShapes from GEOMAlgo; + + SetShapes(me:out; + aS1: Shape from TopoDS; + aS2: Shape from TopoDS); + + SetShape1(me:out; + aS1: Shape from TopoDS); + + SetShape2(me:out; + aS2: Shape from TopoDS); + + Shapes(me; + aS1:out Shape from TopoDS; + aS2:out Shape from TopoDS); + + Shape1(me) + returns Shape from TopoDS; + ---C++:return const & + + Shape2(me) + returns Shape from TopoDS; + ---C++:return const & + +fields + + myShape1: Shape from TopoDS is protected; + myShape2: Shape from TopoDS is protected; + +end CoupleOfShapes; diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx new file mode 100644 index 000000000..20b103c7d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.cxx @@ -0,0 +1,84 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_CoupleOfShapes.cxx +// Created: Wed Dec 15 13:03:52 2004 +// Author: Peter KURNEV +// + + +#include +//======================================================================= +//function : GEOMAlgo_CoupleOfShapes +//purpose : +//======================================================================= +GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() +{} +//======================================================================= +//function : SetShapes +//purpose : +//======================================================================= +void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + myShape1=aS1; + myShape2=aS2; +} +//======================================================================= +//function : Shapes +//purpose : +//======================================================================= +void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1, + TopoDS_Shape& aS2)const +{ + aS1=myShape1; + aS2=myShape2; +} +//======================================================================= +//function : SetShape1 +//purpose : +//======================================================================= +void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1) +{ + myShape1=aS1; +} +//======================================================================= +//function : SetShape2 +//purpose : +//======================================================================= +void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2) +{ + myShape2=aS2; +} +//======================================================================= +//function : Shape1 +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const +{ + return myShape1; +} +//======================================================================= +//function : Shape2 +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const +{ + return myShape2; +} diff --git a/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx new file mode 100644 index 000000000..9b4972d64 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_CoupleOfShapes.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl new file mode 100644 index 000000000..7dff18472 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cdl @@ -0,0 +1,115 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_FinderShapeOn.cdl +-- Created: Tue Jan 11 14:35:52 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class FinderShapeOn from GEOMAlgo + inherits ShapeAlgo from GEOMAlgo + + ---Purpose: + +uses + Surface from Geom, + ShapeEnum from TopAbs, + ListOfShape from TopTools, + DataMapOfShapeShape from TopTools, + Shape from TopoDS, + State from GEOMAlgo, + IndexedDataMapOfShapeState from GEOMAlgo + +--raises + +is + Create + returns FinderShapeOn from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();" + + Perform(me:out) + is redefined; + + SetSurface(me:out; + aS:Surface from Geom); + + SetShapeType(me:out; + aST:ShapeEnum from TopAbs); + + SetState(me:out; + aSF:State from GEOMAlgo); + + Surface(me) + returns Surface from Geom; + ---C++: return const & + + ShapeType(me) + returns ShapeEnum from TopAbs; + + State(me) + returns State from GEOMAlgo; + + Shapes(me) + returns ListOfShape from TopTools; + ---C++: return const & + + -- + -- protected methods + -- + CheckData(me:out) + is redefined protected; + + MakeArgument1(me:out) + is protected; + + MakeArgument2(me:out) + is protected; + + Find(me:out) + is protected; + + Find(me:out; + aS:Shape from TopoDS) + is protected; + + FindVertices(me:out) + is protected; + + CopySource(myclass; + aS :Shape from TopoDS; + aImages : out DataMapOfShapeShape from TopTools; + aOriginals: out DataMapOfShapeShape from TopTools; + aSC : out Shape from TopoDS); + + + +fields + mySurface : Surface from Geom is protected; + myShapeType : ShapeEnum from TopAbs is protected; + myState : State from GEOMAlgo is protected; + myArg1 : Shape from TopoDS is protected; + myArg2 : Shape from TopoDS is protected; + myLS : ListOfShape from TopTools is protected; + myImages : DataMapOfShapeShape from TopTools is protected; + myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; + myIsAnalytic : Boolean from Standard is protected; + +end FinderShapeOn; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx new file mode 100644 index 000000000..50e94384a --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx @@ -0,0 +1,547 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_FinderShapeOn.cxx +// Created: Tue Jan 11 14:44:31 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_FinderShapeOn +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn() +: + GEOMAlgo_ShapeAlgo() +{ + myTolerance=0.0001; + myShapeType=TopAbs_VERTEX; + myState=GEOMAlgo_ST_UNKNOWN; + myIsAnalytic=Standard_True; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn() +{ +} +//======================================================================= +//function : SetSurface +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS) +{ + mySurface=aS; +} +//======================================================================= +//function : Surface +//purpose : +//======================================================================= +const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const +{ + return mySurface; +} +//======================================================================= +//function : SetShapeType +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType) +{ + myShapeType=aType; +} +//======================================================================= +//function : ShapeType +//purpose : +//======================================================================= +TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const +{ + return myShapeType; +} +//======================================================================= +//function : SetState +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState) +{ + myState=aState; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= +GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const +{ + return myState; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const +{ + Standard_Boolean bIsConformState; + Standard_Integer i, aNb; + TopAbs_State aSt; + TopTools_ListOfShape* pL; + // + pL=(TopTools_ListOfShape*) &myLS; + pL->Clear(); + // + aNb=myMSS.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=myMSS.FindKey(i); + aSt=myMSS.FindFromIndex(i); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (bIsConformState) { + pL->Append(aS); + } + } + return myLS; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + myLS.Clear(); + myMSS.Clear(); + // + if (!myResult.IsNull()){ + myResult.Nullify(); + } + // + CheckData(); + if(myErrorStatus) { + return; + } + // + myIsAnalytic=GEOMAlgo_SurfaceTools::IsAnalytic(mySurface); + // + MakeArgument1(); + if(myErrorStatus) { + return; + } + // + if (myIsAnalytic && myShapeType==TopAbs_VERTEX) { + FindVertices(); + return; + } + // + MakeArgument2(); + if(myErrorStatus) { + return; + } + // + Find(); + if(myErrorStatus || myWarningStatus) { + return; + } + // +} +//======================================================================= +//function : FindVertices +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::FindVertices() +{ + Standard_Integer i, aNb, iErr; + TopAbs_State aSt; + TopAbs_Orientation aOr; + gp_Pnt aP; + TopTools_IndexedMapOfShape aM; + // + TopExp::MapShapes(myArg1, TopAbs_FACE, aM); + const TopoDS_Face& aF=TopoDS::Face(aM(1)); + aOr=aF.Orientation(); + // + aM.Clear(); + TopExp::MapShapes(myShape, myShapeType, aM); + aNb=aM.Extent(); + if (!aNb) { + myWarningStatus=10; // No found subshapes of type myShapeType + return; + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + const TopoDS_Vertex& aV=TopoDS::Vertex(aS); + aP=BRep_Tool::Pnt(aV); + iErr=GEOMAlgo_SurfaceTools::GetState(aP, mySurface, myTolerance, aSt); + if (aOr==TopAbs_REVERSED) { + aSt=GEOMAlgo_SurfaceTools::ReverseState(aSt); + } + myMSS.Add(aS, aSt); + } +} +//======================================================================= +//function : Find +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Find() +{ + Standard_Integer i, aNb; + Standard_Boolean bICS; + TopTools_IndexedMapOfShape aM; + // + TopExp::MapShapes(myArg2, myShapeType, aM); + // + aNb=aM.Extent(); + if (!aNb) { + myWarningStatus=10; // No found subshapes of type myShapeType + return; + } + // + bICS=GEOMAlgo_Tools::IsCompositeShape(myArg2); + if (!bICS || myIsAnalytic) { + TopoDS_Compound aCmp; + BRep_Builder aBB; + // + aBB.MakeCompound(aCmp); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aSi=aM(i); + aBB.Add(aCmp, aSi); + } + // + aM.Clear(); + aM.Add(aCmp); + aNb=1; + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + Find(aS); + if (myErrorStatus) { + return; + } + } +} +//======================================================================= +//function : Find +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsDone; + Standard_Integer i, iErr; + TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON}; + TopTools_ListIteratorOfListOfShape aIt; + BOPTools_DSFiller aDF; + // + // 1. Prepare DSFiller + aDF.SetShapes (myArg1, aS); + bIsDone=aDF.IsDone(); + if (!bIsDone) { + myErrorStatus=30; // wrong args are used for DSFiller + return; + } + aDF.Perform(); + bIsDone=aDF.IsDone(); + if (!bIsDone) { + myErrorStatus=31; // DSFiller failed + return; + } + // + // 2. Find shapes + GEOMAlgo_ShapeSolid* pSS; + GEOMAlgo_VertexSolid aVXS; + GEOMAlgo_WireSolid aWRS; + GEOMAlgo_ShellSolid aSHS; + GEOMAlgo_SolidSolid aSLS; + // + pSS=NULL; + // + switch (myShapeType) { + case TopAbs_VERTEX: + pSS=&aVXS; + break; + case TopAbs_EDGE: + pSS=&aWRS; + break; + case TopAbs_FACE: + pSS=&aSHS; + break; + case TopAbs_SOLID: + aSLS.SetShape2(myArg2); + pSS=&aSLS; + break; + default: + myErrorStatus=12; // unallowed subshape type + return; + } + // + pSS->SetFiller(aDF); + pSS->Perform(); + iErr=pSS->ErrorStatus(); + if (iErr) { + myErrorStatus=32; // builder ShapeSolid failed + return; + } + // + for (i=0; i<3; ++i) { + const TopTools_ListOfShape& aLS=pSS->Shapes(aSts[i]); + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSImage=aIt.Value(); + if (myImages.IsBound(aSImage)) { + const TopoDS_Shape& aSx=myImages.Find(aSImage); + myMSS.Add(aSx, aSts[i]); + } + else { + myErrorStatus=33;// can not find original shape + return; + } + } + } +} +//======================================================================= +//function : MakeArgument1 +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::MakeArgument1() +{ + myErrorStatus=0; + // + Standard_Integer i, aNb; + TopAbs_ShapeEnum aType; + BRepLib_FaceError aFErr; + BRepLib_MakeFace aMF; + TopTools_IndexedMapOfShape aM; + BRep_Builder aBB; + TopoDS_Face aFace; + TopoDS_Shell aSh; + TopoDS_Solid aSd; + // + // Argument 1 + if (!myIsAnalytic) { + aMF.Init(mySurface, Standard_True); + aFErr=aMF.Error(); + if (aFErr!=BRepLib_FaceDone) { + myErrorStatus=20; // can not build the face + return; + } + // + const TopoDS_Shape& aF=aMF.Shape(); + aFace=TopoDS::Face(aF); + // + // update tolerances + aM.Add(aF); + TopExp::MapShapes(aF, TopAbs_VERTEX, aM); + TopExp::MapShapes(aF, TopAbs_EDGE, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=aM(i); + aType=aS.ShapeType(); + switch (aType) { + case TopAbs_VERTEX: { + const TopoDS_Vertex& aVx=TopoDS::Vertex(aS); + aBB.UpdateVertex(aVx, myTolerance); + } + break; + case TopAbs_EDGE: { + const TopoDS_Edge& aEx=TopoDS::Edge(aS); + aBB.UpdateEdge(aEx, myTolerance); + } + break; + case TopAbs_FACE: { + const TopoDS_Face& aFx=TopoDS::Face(aS); + aBB.UpdateFace(aFx, myTolerance); + } + break; + default: + break; + } + } + } // + else { + aBB.MakeFace(aFace, mySurface, myTolerance); + } + // + // make solid + aBB.MakeShell(aSh); + aBB.Add(aSh, aFace); + aBB.MakeSolid(aSd); + aBB.Add(aSd, aSh); + myArg1=aSd; +} +//======================================================================= +//function : MakeArgument2 +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::MakeArgument2() +{ + myErrorStatus=0; + // + TopoDS_Shape aSC; + TopTools_DataMapOfShapeShape aOriginals; + // + myImages.Clear(); + // + GEOMAlgo_FinderShapeOn::CopySource(myShape, myImages, aOriginals, aSC); + // + myArg2=aSC; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::CheckData() +{ + myErrorStatus=0; + // + if(mySurface.IsNull()) { + myErrorStatus=10; // mySurface=NULL + return; + } + // + if (myShape.IsNull()) { + myErrorStatus=11; // myShape=NULL + return; + } + // + if (!(myShapeType==TopAbs_VERTEX || + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed subshape type + return; + } + // + if (myState==GEOMAlgo_ST_UNKNOWN || + myState==GEOMAlgo_ST_INOUT) { + myErrorStatus=13; // unallowed state type + return; + } +} +// +//======================================================================= +//function : CopySource +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE, + TopTools_DataMapOfShapeShape& aImages, + TopTools_DataMapOfShapeShape& aOriginals, + TopoDS_Shape& aEx) +{ + Standard_Boolean bFree; + TopAbs_ShapeEnum aType; + Standard_Integer aR; + BRep_Builder BB; + TopoDS_Iterator aIt; + // + aType=aE.ShapeType(); + // + if (aOriginals.IsBound(aE)) { + aEx=aOriginals.ChangeFind(aE); + return; + } + else { + aEx=aE.EmptyCopied(); + aOriginals.Bind(aE, aEx); + aImages.Bind(aEx, aE); + } + // + aR=(Standard_Integer)aType+1; + if (aR>TopAbs_VERTEX) { + return; + } + // + bFree=aEx.Free(); + aEx.Free(Standard_True); + // + aType=(TopAbs_ShapeEnum) aR; + // + aIt.Initialize(aE);//, Standard_False); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aV=aIt.Value(); + TopoDS_Shape aVx; + // + CopySource (aV, aImages, aOriginals, aVx); + // + aVx.Orientation(aV.Orientation()); + BB.Add(aEx, aVx); + } + // + aEx.Free(bFree); +} + +// +// myErrorStatus : +// +// 10 -mySurface=NULL +// 11 -myShape=NULL +// 12 -unallowed type of subshapes +// 13 -unallowed state +// 20 -can not build the face +// 30 -wrong args are used for DSFiller +// 31 -DSFiller failed +// 32 -builder ShapeSolid failed +// 33 -can not find original shape +// +// myWarningStatus +// +// 10 -subshapes of type myShapeType can not be fond in myShape + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx new file mode 100644 index 000000000..99b4e86f3 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.jxx @@ -0,0 +1,34 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl new file mode 100644 index 000000000..46ee5fad9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cdl @@ -0,0 +1,143 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_FinderShapeOn1.cdl +-- Created: Fri Mar 4 10:26:54 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class FinderShapeOn1 from GEOMAlgo + inherits ShapeAlgo from GEOMAlgo + + ---Purpose: + +uses + Surface from Geom, + Surface from GeomAdaptor, + + ShapeEnum from TopAbs, + State from TopAbs, + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + + State from GEOMAlgo, + ListOfPnt from GEOMAlgo, + IndexedDataMapOfShapeState from GEOMAlgo + +--raises + +is + Create + returns FinderShapeOn1 from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn1();" + + SetSurface(me:out; + aS:Surface from Geom); + + SetShapeType(me:out; + aST:ShapeEnum from TopAbs); + + SetState(me:out; + aSF:State from GEOMAlgo); + + SetNbPntsMin(me:out; + aNb:Integer from Standard); + + NbPntsMin(me) + returns Integer from Standard; + + SetNbPntsMax(me:out; + aNb:Integer from Standard); + + NbPntsMax(me) + returns Integer from Standard; + + Surface(me) + returns Surface from Geom; + ---C++: return const & + + ShapeType(me) + returns ShapeEnum from TopAbs; + + State(me) + returns State from GEOMAlgo; + + Perform(me:out) + is redefined; + + Shapes(me) + returns ListOfShape from TopTools; + ---C++: return const & + -- + -- protected methods + -- + CheckData(me:out) + is redefined protected; + + ProcessVertices(me:out) + is protected; + + ProcessEdges(me:out) + is protected; + + ProcessFaces(me:out) + is protected; + + ProcessSolids(me:out) + is protected; + + InnerPoints(me:out; + aF :Face from TopoDS; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + InnerPoints(me:out; + aE :Edge from TopoDS; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + InnerPoints(me:out; + aE :Edge from TopoDS; + aNbPnts: Integer from Standard; + aLP:out ListOfPnt from GEOMAlgo) + is protected; + + MSS (me) + returns IndexedDataMapOfShapeState from GEOMAlgo; + ---C++:return const & + + GetPointState(me:out; aP: Pnt from gp) + returns State from TopAbs is virtual protected; + +fields + mySurface : Surface from Geom is protected; + myShapeType : ShapeEnum from TopAbs is protected; + myState : State from GEOMAlgo is protected; + myNbPntsMin : Integer from Standard is protected; + myNbPntsMax : Integer from Standard is protected; + -- + myGAS : Surface from GeomAdaptor is protected; + myLS : ListOfShape from TopTools is protected; + -- + myMSS : IndexedDataMapOfShapeState from GEOMAlgo is protected; + +end FinderShapeOn1; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx new file mode 100644 index 000000000..c58cccefb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx @@ -0,0 +1,854 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_FinderShapeOn1.cxx +// Created: Fri Mar 4 10:31:06 2005 +// Author: Peter KURNEV +// + + +#include +#include + + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + + +//======================================================================= +//function : GEOMAlgo_FinderShapeOn1 +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn1::GEOMAlgo_FinderShapeOn1() +: + GEOMAlgo_ShapeAlgo() +{ + myTolerance=0.0001; + myShapeType=TopAbs_VERTEX; + myState=GEOMAlgo_ST_UNKNOWN; + myNbPntsMin=3; + myNbPntsMax=0; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_FinderShapeOn1::~GEOMAlgo_FinderShapeOn1() +{ +} +//======================================================================= +//function : SetSurface +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::SetSurface(const Handle(Geom_Surface)& aS) +{ + mySurface=aS; +} +//======================================================================= +//function : Surface +//purpose : +//======================================================================= +const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn1::Surface() const +{ + return mySurface; +} +//======================================================================= +//function : SetShapeType +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::SetShapeType(const TopAbs_ShapeEnum aType) +{ + myShapeType=aType; +} +//======================================================================= +//function : ShapeType +//purpose : +//======================================================================= +TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn1::ShapeType()const +{ + return myShapeType; +} +//======================================================================= +//function : SetState +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::SetState(const GEOMAlgo_State aState) +{ + myState=aState; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= +GEOMAlgo_State GEOMAlgo_FinderShapeOn1::State() const +{ + return myState; +} +//======================================================================= +//function : SetNbPntsMin +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::SetNbPntsMin(const Standard_Integer aNb) +{ + myNbPntsMin=aNb; +} +//======================================================================= +//function : NbPntsMin +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMin()const +{ + return myNbPntsMin; +} +//======================================================================= +//function : SetNbPntsMax +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::SetNbPntsMax(const Standard_Integer aNb) +{ + myNbPntsMax=aNb; +} +//======================================================================= +//function : NbPntsMax +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_FinderShapeOn1::NbPntsMax()const +{ + return myNbPntsMax; +} +//======================================================================= +// function: MSS +// purpose: +//======================================================================= +const GEOMAlgo_IndexedDataMapOfShapeState& GEOMAlgo_FinderShapeOn1::MSS() const +{ + return myMSS; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn1::Shapes() const +{ + Standard_Integer i, aNb; + TopTools_ListOfShape* pL; + // + pL=(TopTools_ListOfShape*) &myLS; + pL->Clear(); + // + aNb=myMSS.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=myMSS.FindKey(i); + if (aS.ShapeType()==myShapeType) { + pL->Append(aS); + } + } + return myLS; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + myLS.Clear(); + myMSS.Clear(); + // + CheckData(); + if(myErrorStatus) { + return; + } + // + // 1 + ProcessVertices(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_VERTEX) { + return; + } + // + // 2 + ProcessEdges(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_EDGE) { + return; + } + // + // 3 + ProcessFaces(); + if(myErrorStatus) { + return; + } + if (myShapeType==TopAbs_FACE) { + return; + } + // + // 4 + ProcessSolids(); + // +} +//======================================================================= +//function : ProcessVertices +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::ProcessVertices() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState; + Standard_Integer i, aNb; + gp_Pnt aP; + TopTools_IndexedMapOfShape aM; + TopAbs_State aSt; + // + TopExp::MapShapes(myShape, TopAbs_VERTEX, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aM(i)); + aP=BRep_Tool::Pnt(aV); + // + aSt = GetPointState( aP ); + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + // + if (myShapeType==TopAbs_VERTEX){ + if (bIsConformState) { + myMSS.Add(aV, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aV, aSt); + } + } +} +//======================================================================= +//function : ProcessEdges +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::ProcessEdges() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState, bIsToBreak; + Standard_Integer i, aNb, iCnt; + TopAbs_State aSt; + TopTools_IndexedMapOfShape aM; + TopExp_Explorer aExp; + GEOMAlgo_ListIteratorOfListOfPnt aIt; + GeomAbs_SurfaceType aType1; + // + aType1=myGAS.GetType(); + // + TopExp::MapShapes(myShape, TopAbs_EDGE, aM); + aNb=aM.Extent(); + for (i=1; i<=aNb; ++i) { + GEOMAlgo_ListOfPnt aLP; + GEOMAlgo_StateCollector aSC; + // + const TopoDS_Edge& aE=TopoDS::Edge(aM(i)); + // + aExp.Init(aE, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aV=aExp.Current(); + // + bIsConformState=myMSS.Contains(aV); + if (!bIsConformState) { + break;// vertex has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aV); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // vertex has non-conformed state,skip edge + } + // + if (BRep_Tool::Degenerated(aE)) { + myMSS.Add(aE, aSt); + continue; + } + // + if (myState==GEOMAlgo_ST_ON && aType1==GeomAbs_Sphere) { + Standard_Real aT1, aT2; + Handle(Geom_Curve) aC; + GeomAdaptor_Curve aGAC; + GeomAbs_CurveType aType2; + // + aC=BRep_Tool::Curve(aE, aT1, aT2); + aGAC.Load(aC); + // + aType2=aGAC.GetType(); + if (aType2==GeomAbs_Line) { + continue; + } + } + // + InnerPoints(aE, aLP); + if (myErrorStatus) { + return; + } + // + bIsConformState=Standard_True; + aIt.Initialize(aLP); + for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { + if (myNbPntsMax) { + if (iCnt > myNbPntsMax) { + break; + } + } + // + const gp_Pnt& aP=aIt.Value(); + aSt = GetPointState( aP ); + bIsToBreak=aSC.AppendState(aSt); + if (bIsToBreak) { + break; + } + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (myShapeType==TopAbs_EDGE) { + if (bIsConformState) { + myMSS.Add(aE, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aE, aSt); + } + } // for (i=1; i<=aNb; ++i) next edge +} +//======================================================================= +//function : ProcessFaces +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::ProcessFaces() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState, bIsToBreak; + Standard_Integer i, aNbF, iCnt; + TopAbs_State aSt; + TopTools_IndexedMapOfShape aM; + TopExp_Explorer aExp; + GEOMAlgo_ListIteratorOfListOfPnt aIt; + GeomAbs_SurfaceType aType1, aType2; + // + aType1=myGAS.GetType(); + // + TopExp::MapShapes(myShape, TopAbs_FACE, aM); + aNbF=aM.Extent(); + for (i=1; i<=aNbF; ++i) { + GEOMAlgo_StateCollector aSC; + GEOMAlgo_ListOfPnt aLP; + // + const TopoDS_Face& aF=TopoDS::Face(aM(i)); + // + if (myState==GEOMAlgo_ST_ON) { + Handle(Geom_Surface) aS; + GeomAdaptor_Surface aGAS; + // + aS=BRep_Tool::Surface(aF); + aGAS.Load(aS); + aType2=aGAS.GetType(); + if (aType2!=aType1) { + continue; + } + } + // + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aE=aExp.Current(); + bIsConformState=myMSS.Contains(aE); + if (!bIsConformState) { + break;// edge has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aE); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // edge has non-conformed state,skip face + } + // + InnerPoints(aF, aLP); + if (myErrorStatus) { + return; + } + // + bIsConformState=Standard_True; + aIt.Initialize(aLP); + for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { + if (myNbPntsMax) { + if (iCnt > myNbPntsMax) { + break; + } + } + // + const gp_Pnt& aP=aIt.Value(); + aSt = GetPointState( aP ); + bIsToBreak=aSC.AppendState(aSt); + if (bIsToBreak) { + break; + } + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (myShapeType==TopAbs_FACE) { + if (bIsConformState) { + myMSS.Add(aF, aSt); + } + } + else if (bIsConformState || aSt==TopAbs_ON) { + myMSS.Add(aF, aSt); + } + }// for (i=1; i<=aNb; ++i) next face +} +//======================================================================= +//function : ProcessSolids +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::ProcessSolids() +{ + myErrorStatus=0; + // + Standard_Boolean bIsConformState; + Standard_Integer i, aNbS, j, aNbF; + TopTools_IndexedMapOfShape aM, aMF; + TopAbs_State aSt; + // + TopExp::MapShapes(myShape, TopAbs_SOLID, aM); + aNbS=aM.Extent(); + for (i=1; i<=aNbS; ++i) { + GEOMAlgo_StateCollector aSC; + // + const TopoDS_Shape& aSd=aM(i); + aMF.Clear(); + TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + aNbF=aMF.Extent(); + for (j=1; j<=aNbF; ++j) { + const TopoDS_Shape& aF=aMF(j); + bIsConformState=myMSS.Contains(aF); + if (!bIsConformState) { + break;// face has non-conformed state + } + else { + aSt=myMSS.FindFromKey(aF); + aSC.AppendState(aSt); + } + } + // + if (!bIsConformState) { + continue; // face has non-conformed state,skip solid + } + // + aSt=aSC.State(); + // + bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); + if (bIsConformState) { + myMSS.Add(aSd, aSt); + } + } +} +// +//======================================================================= +//function : InnerPoints +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, + GEOMAlgo_ListOfPnt& aLP) +{ + myErrorStatus=0; + // + Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNbMax, aNb; + Standard_Integer iCnt, *pIds; + TopLoc_Location aLoc; + Handle(Poly_Triangulation) aTRF; + TColStd_MapOfInteger aMBN; + GEOMAlgo_DataMapOfPassKeyInteger aMPKI; + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger aIt; + gp_Pnt aP, aP1, aP2; + // + aLP.Clear(); + // + aTRF=BRep_Tool::Triangulation(aF, aLoc); + if (aTRF.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + // + const gp_Trsf& aTrsf=aLoc.Transformation(); + const Poly_Array1OfTriangle& aTrs=aTRF->Triangles(); + const TColgp_Array1OfPnt& aNodes=aTRF->Nodes(); + // + // map link/nbtriangles + j1=aTrs.Lower(); + j2=aTrs.Upper(); + for (j=j1; j<=j2; ++j) { + const Poly_Triangle& aTr=aTrs(j); + aTr.Get(n[0], n[1], n[2]); + n[3]=n[0]; + for (k=0; k<3; ++k) { + GEOMAlgo_PassKey aPK; + // + aPK.SetIds(n[k], n[k+1]); + if (aMPKI.IsBound(aPK)) { + Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); + ++iCntX; + } + else { + aMPKI.Bind(aPK, 1); + } + } + } + // + // boundary nodes aMBN + aNbLinks=aMPKI.Extent(); + aIt.Initialize(aMPKI); + for (; aIt.More(); aIt.Next()) { + iCnt=aIt.Value(); + if (iCnt==1) { + const GEOMAlgo_PassKey& aPK=aIt.Key(); + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + for (k=1; k<3; ++k) { + aNx=*(pIds+aNbMax-k); + aMBN.Add(aNx); + } + } + } + // + // inner nodes=all_nodes - boundary_nodes + j1=aNodes.Lower(); + j2=aNodes.Upper(); + for (j=j1; j<=j2; ++j) { + if (!aMBN.Contains(j)) { + aP=aNodes(j).Transformed(aTrsf); + aLP.Append(aP); + } + } + // + aNb=aLP.Extent(); + // + if (!aNb && myNbPntsMin) { + // try to fill it yourself + Standard_Boolean bIsDone; + Standard_Integer aN1, aN2; + Handle(Geom_Surface) aS; + GeomAdaptor_Surface aGAS; + GeomAbs_SurfaceType aType; + // + aS=BRep_Tool::Surface(aF); + aGAS.Load(aS); + aType=aGAS.GetType(); + if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) { + // inner links + aNbLinks=aMPKI.Extent(); + aIt.Initialize(aMPKI); + for (; aIt.More(); aIt.Next()) { + iCnt=aIt.Value(); + if (iCnt>1) { + // take the first having occured inner link + // and discretize it + const GEOMAlgo_PassKey& aPK=aIt.Key(); + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + aN1=*(pIds+aNbMax-1); + aN2=*(pIds+aNbMax-2); + aP1=aNodes(aN1).Transformed(aTrsf); + aP2=aNodes(aN2).Transformed(aTrsf); + // + if (aType==GeomAbs_Cylinder) { + Standard_Real aTolSM; + gp_Cylinder aCyl; + // + aTolSM=1.523e-6;//~1.-cos(0.1 deg) + aCyl=aGAS.Cylinder(); + if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { + continue; + } + } + // + BRepLib_MakeEdge aBME(aP1, aP2); + bIsDone=aBME.IsDone(); + if (!bIsDone) { + myErrorStatus=30; //can not obtain the line fron the link + return; + } + // + const TopoDS_Shape& aSx=aBME.Shape(); + const TopoDS_Edge& aE=TopoDS::Edge(aSx); + // + InnerPoints(aE, myNbPntsMin, aLP); + break; + }// if (iCnt>1) + }// for (; aIt.More(); aIt.Next()) + }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) + }// if (!aNb && myNbPntsMin) { +} +//======================================================================= +//function : InnerPoints +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, + GEOMAlgo_ListOfPnt& aLP) +{ + myErrorStatus=0; + // + Standard_Integer j, aNbNodes, aIndex, aNb; + Handle(Poly_PolygonOnTriangulation) aPTE; + Handle(Poly_Triangulation) aTRE; + TopLoc_Location aLoc; + gp_Pnt aP; + // + aLP.Clear(); + BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc); + if (aTRE.IsNull() || aPTE.IsNull()) { + myErrorStatus=20; // no triangulation found + return; + } + // + const gp_Trsf& aTrsf=aLoc.Transformation(); + const TColgp_Array1OfPnt& aNodes=aTRE->Nodes(); + // + aNbNodes=aPTE->NbNodes(); + const TColStd_Array1OfInteger& aInds=aPTE->Nodes(); + for (j=2; jD0(aT, aP); + aLP.Append(aP); + } +} + +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_FinderShapeOn1::CheckData() +{ + myErrorStatus=0; + // + if(mySurface.IsNull()) { + myErrorStatus=10; // mySurface=NULL + return; + } + // + if (myShape.IsNull()) { + myErrorStatus=11; // myShape=NULL + return; + } + // + if (!(myShapeType==TopAbs_VERTEX || + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed subshape type + return; + } + // + if (myState==GEOMAlgo_ST_UNKNOWN || + myState==GEOMAlgo_ST_INOUT) { + myErrorStatus=13; // unallowed state type + return; + } + // + GeomAbs_SurfaceType aType; + // + myGAS.Load(mySurface); + aType=myGAS.GetType(); + if (!(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere)) { + myErrorStatus=14; // unallowed surface type + } +} + +//======================================================================= +//function : GetPointState +//purpose : +//======================================================================= + +TopAbs_State GEOMAlgo_FinderShapeOn1::GetPointState(const gp_Pnt& aP) +{ + TopAbs_State aSt; + GEOMAlgo_SurfaceTools::GetState(aP, myGAS, myTolerance, aSt); + return aSt; +} + + +// +// myErrorStatus : +// +// 10 -mySurface=NULL +// 11 -myShape=NULL +// 12 -unallowed type of subshapes +// 13 -unallowed state +// 14 -unallowed surface type +// 15 -unallowed surface type +// 20- no triangulation found +// 30- can not obtain the line from the link + + +/* +// Chronometer +#include +#include + +Standard_STATIC(OSD_Chronometer, x_S_Chrono); +static void x_StartChrono(); +static void x_StopChrono(); +static Standard_Boolean x_IsToShow(); +// +//======================================================================= +//function : x_StartChrono +//purpose : +//======================================================================= +void x_StartChrono() +{ + if (x_IsToShow()){ + x_S_Chrono().Reset(); + x_S_Chrono().Start(); + } +} +//======================================================================= +//function : x_StopChrono +//purpose : +//======================================================================= +void x_StopChrono() +{ + if (x_IsToShow()){ + Standard_Real Chrono; + x_S_Chrono().Stop(); + x_S_Chrono().Show(Chrono); + printf(" Tps: %lf\n", Chrono); + //cout << "Tps: " << Chrono << endl; + } +} +//======================================================================= +//function : x_IsToShow +//purpose : +//======================================================================= +Standard_Boolean x_IsToShow() +{ + Standard_Boolean bFlag=Standard_False; + // + char *xr=getenv ("STDCHRONO"); + if (xr!=NULL){ + if (!strcmp (xr, "yes")) { + bFlag=!bFlag; + } + } + return bFlag; +} +*/ diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx new file mode 100644 index 000000000..7d0c6f819 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.hxx @@ -0,0 +1,149 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_FinderShapeOn1_HeaderFile +#define _GEOMAlgo_FinderShapeOn1_HeaderFile + +#ifndef _Handle_Geom_Surface_HeaderFile +#include +#endif +#ifndef _TopAbs_ShapeEnum_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_State_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _GeomAdaptor_Surface_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile +#include +#endif +class Geom_Surface; +class TopTools_ListOfShape; +class TopoDS_Face; +class GEOMAlgo_ListOfPnt; +class TopoDS_Edge; +class GEOMAlgo_IndexedDataMapOfShapeState; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class GEOMAlgo_FinderShapeOn1 : public GEOMAlgo_ShapeAlgo { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT GEOMAlgo_FinderShapeOn1(); +Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn1(); +Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ; +Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ; +Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ; +Standard_EXPORT void SetNbPntsMin(const Standard_Integer aNb) ; +Standard_EXPORT Standard_Integer NbPntsMin() const; +Standard_EXPORT void SetNbPntsMax(const Standard_Integer aNb) ; +Standard_EXPORT Standard_Integer NbPntsMax() const; +Standard_EXPORT const Handle_Geom_Surface& Surface() const; +Standard_EXPORT TopAbs_ShapeEnum ShapeType() const; +Standard_EXPORT GEOMAlgo_State State() const; +Standard_EXPORT virtual void Perform() ; +Standard_EXPORT const TopTools_ListOfShape& Shapes() const; +Standard_EXPORT const GEOMAlgo_IndexedDataMapOfShapeState& MSS() const; + + + + + +protected: + + // Methods PROTECTED + // +Standard_EXPORT virtual void CheckData() ; +Standard_EXPORT void ProcessVertices() ; +Standard_EXPORT void ProcessEdges() ; +Standard_EXPORT void ProcessFaces() ; +Standard_EXPORT void ProcessSolids() ; +Standard_EXPORT void InnerPoints(const TopoDS_Face& aF,GEOMAlgo_ListOfPnt& aLP) ; +Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,GEOMAlgo_ListOfPnt& aLP) ; +Standard_EXPORT void InnerPoints(const TopoDS_Edge& aE,const Standard_Integer aNbPnts,GEOMAlgo_ListOfPnt& aLP) ; +Standard_EXPORT virtual TopAbs_State GetPointState(const gp_Pnt& aP) ; + + + // Fields PROTECTED + // +Handle_Geom_Surface mySurface; +TopAbs_ShapeEnum myShapeType; +GEOMAlgo_State myState; +Standard_Integer myNbPntsMin; +Standard_Integer myNbPntsMax; +GeomAdaptor_Surface myGAS; +TopTools_ListOfShape myLS; +GEOMAlgo_IndexedDataMapOfShapeState myMSS; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx new file mode 100644 index 000000000..f04afdb05 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.jxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ListOfPnt_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeState_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_FinderShapeOn1_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx new file mode 100644 index 000000000..9b1b67fda --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.cxx @@ -0,0 +1,143 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMAlgo_FinderShapeOnQuad.cxx +// Created : Mon Oct 17 17:31:45 2005 +// Author : Edward AGAPOV (eap) + +#include "GEOMAlgo_FinderShapeOnQuad.hxx" +#include "GEOMAlgo_SurfaceTools.hxx" + +#include +#include +#include + + +GEOMAlgo_FinderShapeOnQuad::GEOMAlgo_FinderShapeOnQuad(const gp_Pnt & theTopLeftPoint, + const gp_Pnt & theTopRigthPoint, + const gp_Pnt & theBottomLeftPoint, + const gp_Pnt & theBottomRigthPoint) +{ + myPoints.resize(6); + myPoints[0] = theTopLeftPoint ; + myPoints[1] = theTopRigthPoint ; + myPoints[2] = theBottomRigthPoint; + myPoints[3] = theBottomLeftPoint ; + myPoints[4] = myPoints[0]; + myPoints[5] = myPoints[1]; + + // Find plane normal defined by corner points, it will be used to define a plane + // for each quadrangle side. + myQuadNormal.SetCoord (0,0,0); + for ( int i = 1; i <= 4; ++i ) + myQuadNormal += gp_Vec( myPoints[i], myPoints[i+1] ) ^ gp_Vec( myPoints[i], myPoints[i-1] ); + //std::cout< point2 vector + gp_Vec aSideVec( myPoints[ i ], myPoints[ i + 1 ]); + //std::cout<<" Y Vec : "<Axis().Direction(); + gp_Vec aSideVec = myQuadNormal ^ aSideNorm; + gp_Vec c1p ( myPoints[i], aP ); + gp_Vec pc2 ( aP, myPoints[i+1] ); + if ( aSideVec * c1p >= 0. && aSideVec * pc2 >= 0. ) + return TopAbs_ON; + // consider to be IN (???????????) + //nbIn += myConcaveSide[i] ? 0.5 : 1.0; + } + } + Standard_Real inThreshold = myPlanes.size(); // usually 4.0 + if ( myConcaveQuad ) + inThreshold = 2.5; // 1.0 + 1.0 + 0.5 + + if ( nbIn >= inThreshold ) + return TopAbs_IN; + + return TopAbs_OUT; +} + diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx new file mode 100644 index 000000000..6f00989de --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOnQuad.hxx @@ -0,0 +1,59 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMAlgo_FinderShapeOnQuad.hxx +// Created : Mon Oct 17 17:15:59 2005 +// Author : Edward AGAPOV (eap) + +#ifndef GEOMAlgo_FinderShapeOnQuad_HeaderFile +#define GEOMAlgo_FinderShapeOnQuad_HeaderFile + +#include "GEOMAlgo_FinderShapeOn1.hxx" + +#include + +#include + + +class GEOMAlgo_FinderShapeOnQuad: public GEOMAlgo_FinderShapeOn1 +{ +public: + + GEOMAlgo_FinderShapeOnQuad(const gp_Pnt & theTopLeftPoint, + const gp_Pnt & theTopRigthPoint, + const gp_Pnt & theBottomLeftPoint, + const gp_Pnt & theBottomRigthPoint); + +protected: + + virtual void CheckData() ; + + virtual TopAbs_State GetPointState(const gp_Pnt& aP) ; + +private: + + bool myConcaveQuad; + vector myConcaveSide; + vector myPoints; + vector myPlanes; + gp_Vec myQuadNormal; +}; +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl new file mode 100644 index 000000000..47c563ffd --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cdl @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_GlueAnalyser.cdl +-- Created: Wed Dec 15 11:03:03 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class GlueAnalyser from GEOMAlgo + inherits Gluer from GEOMAlgo + ---Purpose: + +uses + ShapeEnum from TopAbs, + ListOfShape from TopTools, + ListOfCoupleOfShapes from GEOMAlgo + +--raises + +is + Create + returns GlueAnalyser from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();" + + Perform(me:out) + is redefined; + + HasSolidsToGlue(me) + returns Boolean from Standard; + + SolidsToGlue(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++:return const & + + HasSolidsAlone(me) + returns Boolean from Standard; + + SolidsAlone(me) + returns ListOfShape from TopTools; + ---C++:return const & + + DetectVertices(me:out) + is protected; + + DetectEdges(me:out) + is protected; + + DetectFaces(me:out) + is protected; + + DetectShapes(me:out; + aType:ShapeEnum from TopAbs) + is protected; + + DetectSolids (me:out) + is protected; + + + +fields + mySolidsToGlue : ListOfCoupleOfShapes from GEOMAlgo is protected; + mySolidsAlone : ListOfShape from TopTools is protected; + +end GlueAnalyser; diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx new file mode 100644 index 000000000..39e60a0d2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.cxx @@ -0,0 +1,458 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_GlueDetector.cxx +// Created: Wed Dec 15 11:08:09 2004 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_GlueAnalyser::GEOMAlgo_GlueAnalyser() +: + GEOMAlgo_Gluer() +{} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_GlueAnalyser::~GEOMAlgo_GlueAnalyser() +{} +//======================================================================= +//function : HasSolidsToGlue +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsToGlue()const +{ + return !mySolidsToGlue.IsEmpty(); +} +//======================================================================= +//function : HasSolidsAlone +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsAlone()const +{ + return !mySolidsAlone.IsEmpty(); +} +//======================================================================= +//function : SolidsToGlue +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_GlueAnalyser::SolidsToGlue()const +{ + return mySolidsToGlue; +} +//======================================================================= +//function : SolidsAlone +//purpose : +//======================================================================= + const TopTools_ListOfShape& GEOMAlgo_GlueAnalyser::SolidsAlone()const +{ + return mySolidsAlone; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + // + mySolidsToGlue.Clear(); + mySolidsAlone.Clear(); + // + CheckData(); + if (myErrorStatus) { + return; + } + // + InnerTolerance(); + if (myErrorStatus) { + return; + } + // + DetectVertices(); + if (myErrorStatus) { + return; + } + // + DetectEdges(); + if (myErrorStatus) { + return; + } + // + DetectFaces(); + if (myErrorStatus) { + return; + } + // + DetectSolids(); + if (myErrorStatus) { + return; + } +} +//======================================================================= +//function : DetectVertices +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::DetectVertices() +{ + myErrorStatus=0; + // + Standard_Integer j, i, aNbV, aIndex, aNbVSD; + TColStd_ListIteratorOfListOfInteger aIt; + Handle(Bnd_HArray1OfBox) aHAB; + Bnd_BoundSortBox aBSB; + TopoDS_Shape aSTmp, aVF; + TopoDS_Vertex aVnew; + TopTools_IndexedMapOfShape aMV, aMVProcessed; + TopTools_ListIteratorOfListOfShape aItS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; + GEOMAlgo_IndexedDataMapOfShapeBox aMSB; + // + TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV); + aNbV=aMV.Extent(); + if (!aNbV) { + myErrorStatus=2; // no vertices in source shape + return; + } + // + aHAB=new Bnd_HArray1OfBox(1, aNbV); + // + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + Bnd_Box aBox; + // + aBox.SetGap(myTol); + BRepBndLib::Add(aV, aBox); + aHAB->SetValue(i, aBox); + aMIS.Add(i, aV); + aMSB.Add(aV, aBox); + } + // + aBSB.Initialize(aHAB); + // + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + // + if (aMVProcessed.Contains(aV)) { + continue; + } + // + const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); + const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV); + aNbVSD=aLI.Extent(); + if (!aNbVSD) { + myErrorStatus=3; // it must not be + return; + } + // + // Images + TopTools_ListOfShape aLVSD; + // + aIt.Initialize(aLI); + for (j=0; aIt.More(); aIt.Next(), ++j) { + aIndex=aIt.Value(); + const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); + if(!j) { + aVF=aVx; + } + aLVSD.Append(aVx); + aMVProcessed.Add(aVx); + } + myImages.Bind(aVF, aLVSD); + } + // Origins + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + // + aItS.Initialize(aLVSD); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aVSD=aItS.Value(); + if (!myOrigins.IsBound(aVSD)) { + myOrigins.Bind(aVSD, aV); + } + } + } +} +//======================================================================= +//function : DetectFaces +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::DetectFaces() +{ + DetectShapes(TopAbs_FACE); +} +//======================================================================= +//function : DetectEdges +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::DetectEdges() +{ + DetectShapes(TopAbs_EDGE); +} +//======================================================================= +//function : DetectShapes +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::DetectShapes(const TopAbs_ShapeEnum aType) +{ + myErrorStatus=0; + // + Standard_Integer i, aNbF, aNbSDF, iErr; + TopoDS_Shape aNewShape; + TopTools_IndexedMapOfShape aMF; + TopTools_ListIteratorOfListOfShape aItS; + GEOMAlgo_PassKeyShape aPKF; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; + // + TopExp::MapShapes(myShape, aType, aMF); + // + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aS=aMF(i); + // + aPKF.Clear(); + if (aType==TopAbs_FACE) { + const TopoDS_Face& aF=TopoDS::Face(aS); + FacePassKey(aF, aPKF); + } + else if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE=TopoDS::Edge(aS); + EdgePassKey(aE, aPKF); + } + // + if (myErrorStatus) { + return; + } + // + if (aMPKLF.Contains(aPKF)) { + TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF); + aLSDF.Append(aS); + } + else { + TopTools_ListOfShape aLSDF; + // + aLSDF.Append(aS); + aMPKLF.Add(aPKF, aLSDF); + } + } + // check geometric coincidence + if (myCheckGeometry) { + iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX + if (iErr) { + myErrorStatus=200; + return; + } + } + // + // Images/Origins + aNbF=aMPKLF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopTools_ListOfShape& aLSDF=aMPKLF(i); + aNbSDF=aLSDF.Extent(); + if (!aNbSDF) { + myErrorStatus=4; // it must not be + } + // + const TopoDS_Shape& aS1=aLSDF.First(); + aNewShape=aS1; + // + myImages.Bind(aNewShape, aLSDF); + // origins + aItS.Initialize(aLSDF); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aFSD=aItS.Value(); + if (!myOrigins.IsBound(aFSD)) { + myOrigins.Bind(aFSD, aNewShape); + } + } + } +} +//======================================================================= +//function : DetectSolids +//purpose : +//======================================================================= + void GEOMAlgo_GlueAnalyser::DetectSolids() +{ + myErrorStatus=0; + // + Standard_Integer i, aNbF, aNbS, aNbC, aNbX; + TopoDS_Compound aCmp; + BRep_Builder aBB; + TopTools_IndexedDataMapOfShapeListOfShape aMFS; + TopTools_IndexedMapOfShape aMx, aMS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLS; + GEOMAlgo_PassKeyShape aPKSx; + GEOMAlgo_CoupleOfShapes aCS; + // + aBB.MakeCompound(aCmp); + // + TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); + // + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aIm=aItIm.Key(); + if (aIm.ShapeType()!=TopAbs_FACE) { + continue; + } + // + const TopTools_ListOfShape& aLF=aItIm.Value(); + aNbF=aLF.Extent(); + if (aNbF!=2) { + continue; + } + // + TopoDS_Shape aSx[2], aFx[2]; + // + aFx[0]=aLF.First(); + aFx[1]=aLF.Last(); + for (i=0; i<2; ++i) { + if (!aMFS.Contains(aFx[i])) { + continue;// it must not be so + } + // + const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aFx[i]); + aNbS=aLS.Extent(); + if (aNbS!=1) { + continue; + } + aSx[i]=aLS.First(); + } + // + if (aSx[0].IsNull() || aSx[1].IsNull()) { + continue; + } + // + aPKSx.Clear(); + aPKSx.SetIds(aSx[0], aSx[1]); + // + if (!aMPKLS.Contains(aPKSx)) { + TopTools_ListOfShape aLSx; + // + aLSx.Append(aSx[0]); + aLSx.Append(aSx[1]); + // + aMPKLS.Add(aPKSx, aLSx); + } + } + // + mySolidsToGlue.Clear(); + mySolidsAlone.Clear(); + + // + aNbC=aMPKLS.Extent(); + if (!aNbC) { + return; + } + // + for (i=1; i<=aNbC; ++i) { + const TopTools_ListOfShape& aLSx=aMPKLS(i); + const TopoDS_Shape& aSx1=aLSx.First(); + const TopoDS_Shape& aSx2=aLSx.Last(); + aCS.SetShape1(aSx1); + aCS.SetShape2(aSx2); + mySolidsToGlue.Append(aCS); + // + if (!aMx.Contains(aSx1)) { + aBB.Add(aCmp, aSx1); + aMx.Add(aSx1); + } + if (!aMx.Contains(aSx2)) { + aBB.Add(aCmp, aSx2); + aMx.Add(aSx2); + } + } + myResult=aCmp; + // + // check alone solids + TopExp::MapShapes(myShape, TopAbs_SOLID, aMS); + // + aNbX=aMx.Extent(); + for (i=1; i<=aNbX; ++i) { + const TopoDS_Shape& aSx=aMx(i); + if (!aMS.Contains(aSx)) { + mySolidsAlone.Append(aSx); + } + } +} + +/* +// A + // Make vertices + aMV.Clear(); + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + aMV.Add(aV); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + MakeVertex(aLVSD, aVnew);//ZZ + myImages.Bind(aVnew, aLVSD); + } + // + aNbV=aMV.Extent(); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + myImages.UnBind(aV); + } + // + */ diff --git a/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx new file mode 100644 index 000000000..e1a2e8298 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_GlueAnalyser.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_GlueAnalyser_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer.cdl new file mode 100755 index 000000000..aa1be90b4 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cdl @@ -0,0 +1,160 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_Gluer.cdl +-- Created: Sat Dec 04 12:41:32 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Gluer from GEOMAlgo + inherits ShapeAlgo from GEOMAlgo + + ---Purpose: + +uses + ShapeEnum from TopAbs, + Shape from TopoDS, + Edge from TopoDS, + Face from TopoDS, + Vertex from TopoDS, + ListOfShape from TopTools, + DataMapOfShapeShape from TopTools, + DataMapOfShapeListOfShape from TopTools, + Context from IntTools, + PassKeyShape from GEOMAlgo + +--raises + +is + Create + returns Gluer from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Gluer();" + + SetCheckGeometry (me:out; + aFlag:Boolean from Standard); + + CheckGeometry (me) + returns Boolean from Standard; + + Perform(me:out) + is redefined; + + AloneShapes(me) + returns Integer from Standard; + + --modified by NIZNHY-PKV Fri Jan 21 14:16:58 2005f- + Modified(me:out; + S : Shape from TopoDS) + returns ListOfShape from TopTools; + ---C++: return const & + + Generated(me:out; + S : Shape from TopoDS) + returns ListOfShape from TopTools; + ---C++: return const & + + IsDeleted (me:out; + S : Shape from TopoDS) + returns Boolean from Standard; + --modified by NIZNHY-PKV Fri Jan 21 14:17:04 2005t + + CheckData(me:out) + is redefined protected; + + CheckResult (me:out) + is redefined protected; + + MakeVertices(me:out) + is protected; + + MakeEdges(me:out) + is protected; + + MakeFaces(me:out) + is protected; + + MakeShapes(me:out; + aType:ShapeEnum from TopAbs) + is protected; + + MakeShells(me:out) + is protected; + + MakeSolids(me:out) + is protected; + + InnerTolerance(me:out) + is protected; + + EdgePassKey(me:out; + aE:Edge from TopoDS; + aPK:out PassKeyShape from GEOMAlgo) + is protected; + + FacePassKey(me:out; + aF:Face from TopoDS; + aPK:out PassKeyShape from GEOMAlgo) + is protected; + + MakeVertex(me:out; + aLV : ListOfShape from TopTools; + aNewV: out Vertex from TopoDS) + is protected; + MakeEdge(me:out; + aEdge : Edge from TopoDS; + aNewEdge: out Edge from TopoDS) + is protected; + + MakeFace(me:out; + aFace : Face from TopoDS; + aNewEdge: out Face from TopoDS) + is protected; + + IsToReverse(me:out; + aFR : Face from TopoDS; + aF : Face from TopoDS) + returns Boolean from Standard + is protected; + + HasNewSubShape(me; + aS : Shape from TopoDS) + returns Boolean from Standard + is protected; +-- + Images(me) + returns DataMapOfShapeListOfShape from TopTools; + ---C++:return const & + + Origins(me) + returns DataMapOfShapeShape from TopTools; + ---C++:return const & + +fields + myCheckGeometry : Boolean from Standard is protected; + myTol : Real from Standard is protected; + myImages : DataMapOfShapeListOfShape from TopTools is protected; + myOrigins : DataMapOfShapeShape from TopTools is protected; + myNbAlone : Integer from Standard is protected; +---- + myGenerated : ListOfShape from TopTools is protected; +---- + +end Gluer; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx new file mode 100755 index 000000000..ab898a706 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -0,0 +1,1008 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_Gluer.cxx +// Created: Sat Dec 04 12:45:53 2004 +// Author: Peter KURNEV +// + + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +// + +static + void GetSubShapes(const TopoDS_Shape& aS, + TopTools_IndexedMapOfShape& aMSS); + +//======================================================================= +//function : GEOMAlgo_Gluer +//purpose : +//======================================================================= +GEOMAlgo_Gluer::GEOMAlgo_Gluer() +: + GEOMAlgo_ShapeAlgo() +{ + myTolerance=0.0001; + myTol=myTolerance; + myCheckGeometry=Standard_True; + myNbAlone=0; +} +//======================================================================= +//function : ~GEOMAlgo_Gluer +//purpose : +//======================================================================= +GEOMAlgo_Gluer::~GEOMAlgo_Gluer() +{ +} +//======================================================================= +//function : SetCheckGeometry +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::SetCheckGeometry(const Standard_Boolean aFlag) +{ + myCheckGeometry=aFlag; +} +//======================================================================= +//function : CheckGeometry +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const +{ + return myCheckGeometry; +} +//======================================================================= +//function : AloneShapes +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_Gluer::AloneShapes()const +{ + return myNbAlone; +} +//======================================================================= +//function : Images +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer::Images()const +{ + return myImages; +} +//======================================================================= +//function : Origins +//purpose : +//======================================================================= +const TopTools_DataMapOfShapeShape& GEOMAlgo_Gluer::Origins()const +{ + return myOrigins; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::Perform() +{ + myErrorStatus=0; + myWarningStatus=0; + // + Standard_Integer i; + const Standard_Integer aNb=8; + void (GEOMAlgo_Gluer::* pF[aNb])()={ + &GEOMAlgo_Gluer::CheckData, &GEOMAlgo_Gluer::InnerTolerance, + &GEOMAlgo_Gluer::MakeVertices, &GEOMAlgo_Gluer::MakeEdges, + &GEOMAlgo_Gluer::MakeFaces, &GEOMAlgo_Gluer::MakeShells, + &GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::CheckResult + }; + // + for (i=0; i*pF[i])(); + if (myErrorStatus) { + return; + } + } +} +//======================================================================= +//function : MakeVertices +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeVertices() +{ + myErrorStatus=0; + // + Standard_Integer j, i, aNbV, aIndex, aNbVSD; + TColStd_ListIteratorOfListOfInteger aIt; + Handle(Bnd_HArray1OfBox) aHAB; + Bnd_BoundSortBox aBSB; + TopoDS_Shape aSTmp, aVF; + TopoDS_Vertex aVnew; + TopTools_IndexedMapOfShape aMV, aMVProcessed; + TopTools_ListIteratorOfListOfShape aItS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + TopTools_DataMapOfShapeListOfShape aMVV; + GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; + GEOMAlgo_IndexedDataMapOfShapeBox aMSB; + // + TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV); + aNbV=aMV.Extent(); + if (!aNbV) { + myErrorStatus=2; // no vertices in source shape + return; + } + // + aHAB=new Bnd_HArray1OfBox(1, aNbV); + // + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + Bnd_Box aBox; + // + aBox.SetGap(myTol); + BRepBndLib::Add(aV, aBox); + aHAB->SetValue(i, aBox); + aMIS.Add(i, aV); + aMSB.Add(aV, aBox); + } + // + aBSB.Initialize(aHAB); + // + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + // + if (aMVProcessed.Contains(aV)) { + continue; + } + // + const Bnd_Box& aBoxV=aMSB.FindFromKey(aV); + const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV); + aNbVSD=aLI.Extent(); + if (!aNbVSD) { + myErrorStatus=3; // it must not be + return; + } + // + // Images + // + TopTools_ListOfShape aLVSD; + // + aIt.Initialize(aLI); + for (j=0; aIt.More(); aIt.Next(), ++j) { + aIndex=aIt.Value(); + const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex); + if(!j) { + aVF=aVx; + } + aLVSD.Append(aVx); + aMVProcessed.Add(aVx); + } + // + myImages.Bind(aVF, aLVSD); + } + // + // Make new vertices + aMV.Clear(); + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + aNbVSD=aLVSD.Extent(); + if (aNbVSD>1) { + aMV.Add(aV); + MakeVertex(aLVSD, aVnew); + aMVV.Bind(aVnew, aLVSD); + } + } + // + // UnBind old vertices + aNbV=aMV.Extent(); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Shape& aV=aMV(i); + myImages.UnBind(aV); + } + // + // Bind new vertices + aItIm.Initialize(aMVV); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + myImages.Bind(aV, aLVSD); + } + // + // Origins + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aV=aItIm.Key(); + const TopTools_ListOfShape& aLVSD=aItIm.Value(); + // + aItS.Initialize(aLVSD); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aVSD=aItS.Value(); + if (!myOrigins.IsBound(aVSD)) { + myOrigins.Bind(aVSD, aV); + } + } + } +} +//======================================================================= +//function : MakeSolids +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeSolids() +{ + myErrorStatus=0; + // + Standard_Integer aNbS; + TopAbs_Orientation anOr; + TopoDS_Compound aCmp; + TopoDS_Solid aNewSolid; + TopTools_IndexedMapOfShape aMS; + TopExp_Explorer aExpS, aExp; + BRep_Builder aBB; + // + aBB.MakeCompound(aCmp); + // + aNbS=aMS.Extent(); + aExpS.Init(myShape, TopAbs_SOLID); + for (; aExpS.More(); aExpS.Next()) { + const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current()); + if (aMS.Contains(aSolid)) { + continue; + } + aMS.Add(aSolid); + // + anOr=aSolid.Orientation(); + // + aBB.MakeSolid(aNewSolid); + aNewSolid.Orientation(anOr); + // + aExp.Init(aSolid, TopAbs_SHELL); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aShell=aExp.Current(); + const TopoDS_Shape& aShellR=myOrigins.Find(aShell); + aBB.Add(aNewSolid, aShellR); + } + // + TopTools_ListOfShape aLS; + // + aLS.Append(aSolid); + myImages.Bind(aNewSolid, aLS); + myOrigins.Bind(aSolid, aNewSolid); + // + aBB.Add(aCmp, aNewSolid); + } + // + myResult=aCmp; + // + aNbS=aMS.Extent(); + if (aNbS) { + Standard_Real aTol=1.e-7; + BOP_CorrectTolerances::CorrectCurveOnSurface(myResult); + } +} +//======================================================================= +//function : MakeShells +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeShells() +{ + myErrorStatus=0; + // + Standard_Boolean bIsToReverse; + Standard_Integer i, aNbS; + TopAbs_Orientation anOr; + TopoDS_Shell aNewShell; + TopoDS_Face aFR; + TopTools_IndexedMapOfShape aMS; + TopExp_Explorer aExp; + BRep_Builder aBB; + // + TopExp::MapShapes(myShape, TopAbs_SHELL, aMS); + // + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shell& aShell=TopoDS::Shell(aMS(i)); + anOr=aShell.Orientation(); + // + aBB.MakeShell(aNewShell); + aNewShell.Orientation(anOr); + aExp.Init(aShell, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Face& aF=TopoDS::Face(aExp.Current()); + aFR=TopoDS::Face(myOrigins.Find(aF)); + if (aFR.IsSame(aF)) { + aBB.Add(aNewShell, aF); + continue; + } + bIsToReverse=IsToReverse(aFR, aF); + if (bIsToReverse) { + aFR.Reverse(); + } + aBB.Add(aNewShell, aFR); + } + // + TopTools_ListOfShape aLS; + // + aLS.Append(aShell); + myImages.Bind(aNewShell, aLS); + myOrigins.Bind(aShell, aNewShell); + } +} +//======================================================================= +//function : MakeFaces +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeFaces() +{ + MakeShapes(TopAbs_FACE); +} +//======================================================================= +//function : MakeEdges +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeEdges() +{ + MakeShapes(TopAbs_EDGE); +} +//======================================================================= +//function : MakeShapes +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) +{ + myErrorStatus=0; + // + Standard_Boolean bHasNewSubShape; + Standard_Integer i, aNbF, aNbSDF, iErr; + TopoDS_Shape aNewShape; + TopTools_IndexedMapOfShape aMF; + TopTools_ListIteratorOfListOfShape aItS; + GEOMAlgo_PassKeyShape aPKF; + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF; + // + TopExp::MapShapes(myShape, aType, aMF); + // + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aS=aMF(i); + // + aPKF.Clear(); + if (aType==TopAbs_FACE) { + const TopoDS_Face& aF=TopoDS::Face(aS); + FacePassKey(aF, aPKF); + } + else if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE=TopoDS::Edge(aS); + EdgePassKey(aE, aPKF); + } + // + if (myErrorStatus) { + return; + } + // + if (aMPKLF.Contains(aPKF)) { + TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF); + aLSDF.Append(aS); + } + else { + TopTools_ListOfShape aLSDF; + // + aLSDF.Append(aS); + aMPKLF.Add(aPKF, aLSDF); + } + } + // check geometric coincidence + if (myCheckGeometry) { + iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); + if (iErr) { + myErrorStatus=200; + return; + } + } + // + // Images/Origins + // + aNbF=aMPKLF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopTools_ListOfShape& aLSDF=aMPKLF(i); + aNbSDF=aLSDF.Extent(); + if (!aNbSDF) { + myErrorStatus=4; // it must not be + } + // + const TopoDS_Shape& aS1=aLSDF.First(); + // + bHasNewSubShape=Standard_True; + // prevent creation of a new shape if there are not + // new subshapes of aSS among the originals + if (aNbSDF==1) { + bHasNewSubShape=HasNewSubShape(aS1); + if (!bHasNewSubShape) { + aNewShape=aS1; + aNewShape.Orientation(TopAbs_FORWARD); + } + } + // + if (bHasNewSubShape) { + if (aType==TopAbs_FACE) { + TopoDS_Face aNewFace; + // + const TopoDS_Face& aF1=TopoDS::Face(aS1); + MakeFace(aF1, aNewFace); + aNewShape=aNewFace; + } + else if (aType==TopAbs_EDGE) { + TopoDS_Edge aNewEdge; + // + const TopoDS_Edge& aE1=TopoDS::Edge(aS1); + MakeEdge(aE1, aNewEdge); + aNewShape=aNewEdge; + } + } + // + myImages.Bind(aNewShape, aLSDF); + // origins + aItS.Initialize(aLSDF); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aFSD=aItS.Value(); + if (!myOrigins.IsBound(aFSD)) { + myOrigins.Bind(aFSD, aNewShape); + } + } + } +} +//======================================================================= +//function : CheckResult +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::CheckResult() +{ + myErrorStatus=0; + // + if (myResult.IsNull()) { + myErrorStatus=6; + return; + } + // + Standard_Boolean bFound; + Standard_Integer i, j, aNbS, aNbFS, aNbSx; + TopTools_IndexedMapOfShape aMS, aMFS; + TopTools_IndexedDataMapOfShapeListOfShape aMFR; + // + TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFR); + TopExp::MapShapes(myResult, TopAbs_SOLID, aMS); + // + + myNbAlone=0; + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSolid=aMS(i); + // + aMFS.Clear(); + TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS); + // + bFound=Standard_False; + aNbFS=aMFS.Extent(); + for (j=1; j<=aNbFS; ++j) { + const TopoDS_Shape& aFS=aMFS(j); + if (aMFR.Contains(aFS)) { + const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS); + aNbSx=aLSx.Extent(); + if (aNbSx==2) { + bFound=!bFound; + break; + } + } + } + // + if (!bFound) { + myWarningStatus=1; + ++myNbAlone; + //break; + } + } +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::CheckData() +{ + myErrorStatus=0; + // + if (myShape.IsNull()) { + myErrorStatus=5; + return; + } +} +//======================================================================= +//function : InnerTolerance +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::InnerTolerance() +{ + myErrorStatus=0; + // + /* + Standard_Integer i; + Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh; + Bnd_Box aBox; + // + BRepBndLib::Add(myShape, aBox); + aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]); + // + dHmin=aX[0][1]-aX[0][0]; + for (i=1; i<3; ++i) { + dH=aX[i][1]-aX[i][0]; + if (dHaTolTresh) { + myTol=aTolTresh; + } + */ + myTol=myTolerance; +} +//======================================================================= +//function : FacePassKey +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, + GEOMAlgo_PassKeyShape& aPK) +{ + Standard_Integer i, aNbE, aNbMax; + TopTools_ListOfShape aLE; + TopTools_IndexedMapOfShape aME; + // + TopExp::MapShapes(aF, TopAbs_EDGE, aME); + aNbE=aME.Extent(); + aNbMax=aPK.NbMax(); + if (!aNbE || aNbE>aNbMax) { + myErrorStatus=101; // temprorary + return; + } + // + for (i=1; i<=aNbE; ++i) { + const TopoDS_Shape& aE=aME(i); + if (!myOrigins.IsBound(aE)) { + myErrorStatus=102; + return; + } + const TopoDS_Shape& aER=myOrigins.Find(aE); + aLE.Append(aER); + } + aPK.SetIds(aLE); +} +//======================================================================= +//function : EdgePassKey +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, + GEOMAlgo_PassKeyShape& aPK) +{ + TopoDS_Vertex aV1, aV2; + // + TopExp::Vertices(aE, aV1, aV2); + // + if (!myOrigins.IsBound(aV1) || !myOrigins.IsBound(aV2) ) { + myErrorStatus=100; + return; + } + const TopoDS_Shape& aVR1=myOrigins.Find(aV1); + const TopoDS_Shape& aVR2=myOrigins.Find(aV2); + aPK.SetIds(aVR1, aVR2); +} +//======================================================================= +//function : MakeVertex +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, + TopoDS_Vertex& aNewVertex) +{ + Standard_Integer aNbV; + Standard_Real aTolV, aD, aDmax; + gp_XYZ aGC; + gp_Pnt aP3D, aPGC; + TopoDS_Vertex aVx; + BRep_Builder aBB; + TopTools_ListIteratorOfListOfShape aIt; + // + aNbV=aLV.Extent(); + if (!aNbV) { + return; + } + // + // center of gravity + aGC.SetCoord(0.,0.,0.); + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + aVx=TopoDS::Vertex(aIt.Value()); + aP3D=BRep_Tool::Pnt(aVx); + aGC+=aP3D.XYZ(); + } + aGC/=(Standard_Real)aNbV; + aPGC.SetXYZ(aGC); + // + // tolerance value + aDmax=-1.; + aIt.Initialize(aLV); + for (; aIt.More(); aIt.Next()) { + aVx=TopoDS::Vertex(aIt.Value()); + aP3D=BRep_Tool::Pnt(aVx); + aTolV=BRep_Tool::Tolerance(aVx); + aD=aPGC.Distance(aP3D)+aTolV; + if (aD>aDmax) { + aDmax=aD; + } + } + // + aBB.MakeVertex (aNewVertex, aPGC, aDmax); +} +//======================================================================= +//function : MakeEdge +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, + TopoDS_Edge& aNewEdge) +{ + myErrorStatus=0; + // + Standard_Boolean bIsDE; + Standard_Real aT1, aT2; + TopoDS_Vertex aV1, aV2, aVR1, aVR2; + TopoDS_Edge aEx; + // + bIsDE=BRep_Tool::Degenerated(aE); + // + aEx=aE; + aEx.Orientation(TopAbs_FORWARD); + // + TopExp::Vertices(aEx, aV1, aV2); + // + aT1=BRep_Tool::Parameter(aV1, aEx); + aT2=BRep_Tool::Parameter(aV2, aEx); + // + aVR1=TopoDS::Vertex(myOrigins.Find(aV1)); + aVR1.Orientation(TopAbs_FORWARD); + aVR2=TopoDS::Vertex(myOrigins.Find(aV2)); + aVR2.Orientation(TopAbs_REVERSED); + // + if (bIsDE) { + Standard_Real aTol; + BRep_Builder aBB; + TopoDS_Edge E; + TopAbs_Orientation anOrE; + // + anOrE=aE.Orientation(); + aTol=BRep_Tool::Tolerance(aE); + // + E=aEx; + E.EmptyCopy(); + // + aBB.Add (E, aVR1); + aBB.Add (E, aVR2); + aBB.Range(E, aT1, aT2); + aBB.Degenerated(E, Standard_True); + aBB.UpdateEdge(E, aTol); + // + aNewEdge=E; + } + // + else { + BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); + } +} +// +//======================================================================= +//function : MakeFace +//purpose : +//======================================================================= +void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, + TopoDS_Face& aNewFace) +{ + myErrorStatus=0; + // + Standard_Boolean bIsToReverse, bIsUPeriodic; + Standard_Real aTol, aUMin, aUMax, aVMin, aVMax; + TopoDS_Edge aER; + TopoDS_Wire newWire; + TopoDS_Face aFFWD, newFace; + TopLoc_Location aLoc; + Handle(Geom_Surface) aS; + Handle(Geom2d_Curve) aC2D; + TopExp_Explorer aExpW, aExpE; + BRep_Builder aBB; + // + aFFWD=aF; + aFFWD.Orientation(TopAbs_FORWARD); + // + aS=BRep_Tool::Surface(aFFWD, aLoc); + bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS); + aTol=BRep_Tool::Tolerance(aFFWD); + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + // + aBB.MakeFace (newFace, aS, aLoc, aTol); + // + aExpW.Init(aFFWD, TopAbs_WIRE); + for (; aExpW.More(); aExpW.Next()) { + aBB.MakeWire(newWire); + const TopoDS_Wire& aW=TopoDS::Wire(aExpW.Current()); + aExpE.Init(aW, TopAbs_EDGE); + for (; aExpE.More(); aExpE.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current()); + aER=TopoDS::Edge(myOrigins.Find(aE)); + // + aER.Orientation(TopAbs_FORWARD); + if (!BRep_Tool::Degenerated(aER)) { + // build p-curve + if (bIsUPeriodic) { + GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); + } + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); + + // orient image + bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext); + if (bIsToReverse) { + aER.Reverse(); + } + } + else { + aER.Orientation(aE.Orientation()); + } + // + aBB.Add(newWire, aER); + } + //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f + // + TopTools_ListOfShape aLW; + // + aLW.Append(aW); + myImages.Bind(newWire, aLW); + myOrigins.Bind(aW, newWire); + // + //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t + aBB.Add(newFace, newWire); + } + aNewFace=newFace; +} +//======================================================================= +//function : IsToReverse +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, + const TopoDS_Face& aF) +{ + Standard_Boolean bRet; + Standard_Real aT, aT1, aT2, aTR, aScPr; + TopExp_Explorer aExp; + Handle(Geom_Curve)aC3D; + gp_Pnt aP; + gp_Dir aDNF, aDNFR; + // + bRet=Standard_False; + // + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); + // + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE)); + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + aC3D->D0(aT, aP); + myContext.ProjectPointOnEdge(aP, aER, aTR); + // + BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF); + if (aF.Orientation()==TopAbs_REVERSED) { + aDNF.Reverse(); + } + // + BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR); + if (aFR.Orientation()==TopAbs_REVERSED) { + aDNFR.Reverse(); + } + // + aScPr=aDNF*aDNFR; + return (aScPr<0.); + } + return bRet; +} +//======================================================================= +//function : HasNewSubShape +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const +{ + Standard_Boolean bRet; + Standard_Integer i, aNbSS; + TopTools_IndexedMapOfShape aMSS; + // + GetSubShapes(aS, aMSS); + // + bRet=Standard_False; + aNbSS=aMSS.Extent(); + for (i=1; i<=aNbSS; ++i) { + const TopoDS_Shape& aSS=aMSS(i); + if (aSS.ShapeType()==TopAbs_WIRE) { + continue; + } + // + bRet=!myOrigins.IsBound(aSS); + if (bRet) { + return bRet; + } + // + const TopoDS_Shape& aSSIm=myOrigins.Find(aSS); + bRet=!aSSIm.IsSame(aSS); + if (bRet) { + return bRet; + } + } + return bRet; +} +//======================================================================= +//function : GetSubShapes +//purpose : +//======================================================================= +void GetSubShapes(const TopoDS_Shape& aS, + TopTools_IndexedMapOfShape& aMSS) +{ + Standard_Integer aR; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + // + aType=aS.ShapeType(); + aR=(Standard_Integer)aType+1; + if (aR>TopAbs_VERTEX) { + return; + } + // + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSS=aIt.Value(); + aMSS.Add(aSS); + GetSubShapes(aSS, aMSS); + } +} +//======================================================================= +//function : Modified +//purpose : +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) +{ + TopAbs_ShapeEnum aType; + // + myGenerated.Clear(); + // + aType=aS.ShapeType(); + if (aType==TopAbs_VERTEX || + aType==TopAbs_EDGE || + aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_FACE || + aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft + if(myOrigins.IsBound(aS)) { + const TopoDS_Shape& aSnew=myOrigins.Find(aS); + if (!aSnew.IsSame(aS)) { + myGenerated.Append(aSnew); + } + } + } + // + return myGenerated; +} +//======================================================================= +//function : Generated +//purpose : +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& ) +{ + myGenerated.Clear(); + return myGenerated; +} +//======================================================================= +//function : IsDeleted +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS) +{ + Standard_Boolean bRet=Standard_False; + // + const TopTools_ListOfShape& aL=Modified(aS); + bRet=!aL.IsEmpty(); + // + return bRet; +} +// +// ErrorStatus +// +// 1 - the object is just initialized +// 2 - no vertices found in source shape +// 3 - nb same domain vertices for the vertex Vi =0 +// 4 - nb same domain edges(faces) for the edge Ei(face Fi) =0 +// 5 - source shape is Null +// 6 - result shape is Null +// 101 - nb edges > PassKey.NbMax() in FacesPassKey() +// 102 - the edge Ei can not be found in myOrigins Map +// 100 - the vertex Vi can not be found in myOrigins Map +// +// WarningStatus +// +// 1 - some shapes can not be glued by faces +// diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.jxx b/src/GEOMAlgo/GEOMAlgo_Gluer.jxx new file mode 100644 index 000000000..cb259d79b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.jxx @@ -0,0 +1,46 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Gluer_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cdl b/src/GEOMAlgo/GEOMAlgo_PassKey.cdl new file mode 100755 index 000000000..f400e8638 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.cdl @@ -0,0 +1,100 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_PassKey.cdl +-- Created: +-- Author: Peter KURNEV +-- +---Copyright: + + +class PassKey from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS, + ListOfInteger from TColStd + +--raises + +is + Create + returns PassKey from GEOMAlgo; + + Assign(me:out; + Other : PassKey from GEOMAlgo) + returns PassKey from GEOMAlgo; + ---C++: alias operator = + ---C++: return & +-- + SetIds(me:out; + aI1 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard); + + SetIds(me:out; + aI1 :Integer from Standard; + aI2 :Integer from Standard; + aI3 :Integer from Standard; + aI4 :Integer from Standard); + + SetIds(me:out; + aLS :ListOfInteger from TColStd); + + NbMax(me) + returns Integer from Standard; + + Clear(me:out); + + Compute(me:out); + + IsEqual(me; + aOther:PassKey from GEOMAlgo) + returns Boolean from Standard; + + Key(me) + returns Address from Standard; + + HashCode(me; + Upper : Integer from Standard) + returns Integer from Standard; + + Id(me; + aIndex: Integer from Standard) + returns Integer from Standard; + + + Dump(me); + +fields + + myNbIds: Integer from Standard is protected; + myNbMax: Integer from Standard is protected; + mySum : Integer from Standard is protected; + myIds : Integer from Standard [8] is protected; + +end PassKey; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKey.cxx b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx new file mode 100755 index 000000000..c072b7027 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKey.cxx @@ -0,0 +1,305 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_PassKey.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include + +#ifdef WNT +#pragma warning( disable : 4101) +#endif + +static + void SortShell(const int n, int* a); +static + Standard_Integer NormalizedId(const Standard_Integer aId, + const Standard_Integer aDiv); + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_PassKey::GEOMAlgo_PassKey() +{ + Clear(); +} +//======================================================================= +//function :Assign +//purpose : +//======================================================================= + GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& anOther) +{ + myNbIds=anOther.myNbIds; + myNbMax=anOther.myNbMax; + mySum=anOther.mySum; + memcpy(myIds, anOther.myIds, sizeof(myIds)); + return *this; +} +//======================================================================= +//function :Clear +//purpose : +//======================================================================= + void GEOMAlgo_PassKey::Clear() +{ + Standard_Integer i; + // + myNbIds=0; + myNbMax=8; + mySum=0; + for (i=0; i myNbMax) { + return; + } + // + myNbIds=aNb; + mySum=0; + i=myNbMax-myNbIds; + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next(), ++i) { + anId=aIt.Value(); + myIds[i]=anId; + aIdN=NormalizedId(anId, myNbIds); + mySum+=aIdN; + } + // + Compute(); +} +//======================================================================= +//function :Id +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex)const +{ + if (aIndex < 0 || aIndex >= myNbMax) { + return 0; + } + return myIds[aIndex]; +} +//======================================================================= +//function :NbMax +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKey::NbMax()const +{ + return myNbMax; +} +//======================================================================= +//function :Compute +//purpose : +//======================================================================= + void GEOMAlgo_PassKey::Compute() +{ + SortShell(myNbIds, myIds+myNbMax-myNbIds); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& anOther) const +{ + Standard_Integer iIsEqual; + Standard_Boolean bIsEqual; + // + iIsEqual=memcmp(myIds, anOther.myIds, sizeof(myIds)); + bIsEqual=Standard_False; + if (!iIsEqual) { + bIsEqual=!bIsEqual; + } + return bIsEqual; +} +//======================================================================= +//function :Key +//purpose : +//======================================================================= + Standard_Address GEOMAlgo_PassKey::Key()const +{ + return (Standard_Address)myIds; +} +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer Upper) const +{ + //return (mySum % Upper); + return ::HashCode(mySum, Upper); +} +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + void GEOMAlgo_PassKey::Dump()const +{ + Standard_Integer i; + // + printf(" PassKey: {"); + for (i=0; iaTresh) { + aIdRet=aId%aTresh; + } + return aIdRet; +} +//======================================================================= +// function: SortShell +// purpose : +//======================================================================= +void SortShell(const int n, int* a) +{ + int x, nd, i, j, l, d=1; + // + while(d<=n) { + d*=2; + } + // + while (d) { + d=(d-1)/2; + // + nd=n-d; + for (i=0; i -1) goto m30; + }//if (a[l] < a[j]){ + }//for (i=0; i +#endif +#ifndef _GEOMAlgo_PassKey_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl new file mode 100755 index 000000000..7928f94c2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cdl @@ -0,0 +1,48 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_PassKeyMapHasher.cdl +-- Created: +-- Author: Peter KURNEV +-- +---Copyright: + + +class PassKeyMapHasher from GEOMAlgo + + ---Purpose: + +uses + PassKey from GEOMAlgo + +--raises + +is + HashCode(myclass; + aPKey : PassKey from GEOMAlgo; + Upper : Integer from Standard) + returns Integer from Standard; + + + IsEqual(myclass; + aPKey1 : PassKey from GEOMAlgo; + aPKey2 : PassKey from GEOMAlgo) + returns Boolean from Standard; + +end PassKeyMapHasher; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx new file mode 100755 index 000000000..6f95f979a --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.cxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_PassKeyMapHasher.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_PassKeyMapHasher::HashCode(const GEOMAlgo_PassKey& aPKey, + const Standard_Integer Upper) +{ + return aPKey.HashCode(Upper); +} +//======================================================================= +//function :IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_PassKeyMapHasher::IsEqual(const GEOMAlgo_PassKey& aPKey1, + const GEOMAlgo_PassKey& aPKey2) +{ + return aPKey1.IsEqual(aPKey2); +} diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx new file mode 100644 index 000000000..15e5c9eaf --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyMapHasher.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_PassKey_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl new file mode 100755 index 000000000..8094fb6c2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cdl @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_PassKeyShape.cdl +-- Created: +-- Author: Peter KURNEV +-- +---Copyright: + + +class PassKeyShape from GEOMAlgo + inherits PassKey from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS, + ListOfShape from TopTools + +--raises + +is + Create + returns PassKeyShape from GEOMAlgo; + + SetIds(me:out; + aS :Shape from TopoDS); + + SetIds(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS); + + SetIds(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS); + + SetIds(me:out; + aS1 :Shape from TopoDS; + aS2 :Shape from TopoDS; + aS3 :Shape from TopoDS; + aS4 :Shape from TopoDS); + + SetIds(me:out; + aLS :ListOfShape from TopTools); + + +fields + myUpper : Integer from Standard is protected; + +end PassKeyShape; diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx new file mode 100755 index 000000000..b85dbd00d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx @@ -0,0 +1,131 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_PassKeyShape.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +#include +#include + +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape() +: + GEOMAlgo_PassKey() +{ + myUpper=432123; + GEOMAlgo_PassKey::Clear(); +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1) + +{ + Standard_Integer anId1; + // + anId1=aS1.HashCode(myUpper); + GEOMAlgo_PassKey::SetIds(anId1); +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2) +{ + Standard_Integer anId1, anId2; + // + anId1=aS1.HashCode(myUpper); + anId2=aS2.HashCode(myUpper); + // + GEOMAlgo_PassKey::SetIds(anId1, anId2); +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3) +{ + Standard_Integer anId1, anId2, anId3; + // + anId1=aS1.HashCode(myUpper); + anId2=aS2.HashCode(myUpper); + anId3=aS3.HashCode(myUpper); + // + GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3); +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1, + const TopoDS_Shape& aS2, + const TopoDS_Shape& aS3, + const TopoDS_Shape& aS4) +{ + Standard_Integer anId1, anId2, anId3, anId4; + // + anId1=aS1.HashCode(myUpper); + anId2=aS2.HashCode(myUpper); + anId3=aS3.HashCode(myUpper); + anId4=aS4.HashCode(myUpper); + // + GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3, anId4); +} +//======================================================================= +//function :SetIds +//purpose : +//======================================================================= + void GEOMAlgo_PassKeyShape::SetIds(const TopTools_ListOfShape& aLS) +{ + Standard_Integer anId; + TopTools_ListIteratorOfListOfShape aIt; + TColStd_ListOfInteger aLI; + // + //aNb=aLS.Extent(); + //if (aNb<1 || aNb > myNbMax) { + // return; + //} + // + //myNbIds=aNb; + //mySum=0; + //i=myNbMax-myNbIds; + + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + anId=aS.HashCode(myUpper); + aLI.Append(anId); + } + GEOMAlgo_PassKey::SetIds(aLI); +} diff --git a/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx new file mode 100644 index 000000000..a29e7ff8f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_PassKeyShape.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl new file mode 100644 index 000000000..0cb903d7d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cdl @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_ShapeAlgo.cdl +-- Created: Tue Dec 7 12:05:19 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +deferred class ShapeAlgo from GEOMAlgo + inherits Algo from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS, + Context from IntTools + +--raises + +is + Initialize + returns ShapeAlgo from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeAlgo();" + + SetShape(me:out; + aS:Shape from TopoDS); + + SetTolerance(me:out; + aT:Real from Standard); + + Shape(me) + returns Shape from TopoDS; + ---C++:return const & + + Tolerance(me) + returns Real from Standard; + + Result(me) + returns Shape from TopoDS; + ---C++:return const & + +fields + myShape : Shape from TopoDS is protected; + myTolerance : Real from Standard is protected; + myResult : Shape from TopoDS is protected; + myContext : Context from IntTools is protected; + +end ShapeAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx new file mode 100644 index 000000000..201b5cd30 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_ShapeAlgo.cxx +// Created: Tue Dec 7 12:06:54 2004 +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : GEOMAlgo_ShapeAlgo +//purpose : +//======================================================================= +GEOMAlgo_ShapeAlgo::GEOMAlgo_ShapeAlgo() +: + GEOMAlgo_Algo() +{ + myTolerance=0.0001; +} + +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_ShapeAlgo::~GEOMAlgo_ShapeAlgo() +{ +} +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= +void GEOMAlgo_ShapeAlgo::SetShape(const TopoDS_Shape& aS) +{ + myShape=aS; +} +//======================================================================= +//function : Shape +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Shape()const +{ + return myShape; +} +//======================================================================= +//function : SetTolerance +//purpose : +//======================================================================= +void GEOMAlgo_ShapeAlgo::SetTolerance(const Standard_Real aT) +{ + myTolerance=aT; +} +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= +Standard_Real GEOMAlgo_ShapeAlgo::Tolerance()const +{ + return myTolerance; +} +//======================================================================= +//function : Result +//purpose : +//======================================================================= +const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Result()const +{ + return myResult; +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx new file mode 100644 index 000000000..e3304cad7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl new file mode 100644 index 000000000..45f86b4d1 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cdl @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_ShapeSolid.cdl +-- Created: Thu Jan 13 12:44:07 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +deferred class ShapeSolid from GEOMAlgo + inherits Algo from GEOMAlgo + + ---Purpose: + +uses + State from TopAbs, + ListOfShape from TopTools, + PDSFiller from BOPTools, + DSFiller from BOPTools +--raises + +is + Initialize + returns ShapeSolid from GEOMAlgo; + + + SetFiller(me:out; + aDSF:DSFiller from BOPTools); + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();" + + + Shapes(me; + aState:State from TopAbs) + returns ListOfShape from TopTools; + ---C++: return const & + + BuildResult (me:out) + is deferred protected; + + Prepare(me:out) + is deferred protected; + +fields + myLSIN : ListOfShape from TopTools is protected; + myLSOUT : ListOfShape from TopTools is protected; + myLSON : ListOfShape from TopTools is protected; + myRank : Integer from Standard is protected; + myDSFiller : PDSFiller from BOPTools is protected; + +end ShapeSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx new file mode 100644 index 000000000..87a0de87c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.cxx @@ -0,0 +1,80 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_ShapeSolid.cxx +// Created: Thu Jan 13 12:54:48 2005 +// Author: Peter KURNEV +// + + +#include + +#include +#include + +//======================================================================= +//function : GEOMAlgo_ShapeSolid +//purpose : +//======================================================================= +GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid() +: + GEOMAlgo_Algo(), + myRank(0), + myDSFiller(NULL) +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : SetFiller +//purpose : +//======================================================================= +void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller) +{ + myDSFiller=(BOPTools_DSFiller*) &aDSFiller; +} +//======================================================================= +// function: Shapes +// purpose: +//======================================================================= +const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const TopAbs_State aState) const +{ + const TopTools_ListOfShape *pL; + // + switch (aState) { + case TopAbs_IN: + pL=&myLSIN; + break; + case TopAbs_OUT: + pL=&myLSOUT; + break; + case TopAbs_ON: + pL=&myLSON; + break; + default: + pL=&myLSON; + break; + } + return *pL; +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx new file mode 100644 index 000000000..2b5222ad5 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSolid.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _BOPTools_DSFiller_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl new file mode 100644 index 000000000..01c1c1c1c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cdl @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_ShellSolid.cdl +-- Created: Wed Jan 12 12:45:20 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class ShellSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + ---Purpose: + +--uses +--raises + +is + Create + returns ShellSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + + DetectSDFaces(me:out) + is protected; + +--fields + +end ShellSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx new file mode 100644 index 000000000..a92f8a776 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx @@ -0,0 +1,369 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_ShellSolid.cxx +// Created: Wed Jan 12 12:49:45 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_ShellSolid +//purpose : +//======================================================================= +GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_ShellSolid::~GEOMAlgo_ShellSolid() +{ +} +//======================================================================= +// function: +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + // + myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2; + BuildResult(); + } + catch (Standard_Failure) { + myErrorStatus=12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::Prepare() +{ + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + // + // 1 States + BOPTools_SolidStateFiller aStateFiller(aPaveFiller); + aStateFiller.Do(); + // + // 2 Project section edges on corresp. faces -> P-Curves on edges. + BOPTools_PCurveMaker aPCurveMaker(aPaveFiller); + aPCurveMaker.Do(); + // + // 3. Degenerated Edges Processing + BOPTools_DEProcessor aDEProcessor(aPaveFiller); + aDEProcessor.Do(); + // + // 4. Detect Same Domain Faces + DetectSDFaces(); +} +//================================================================================= +// function: BuildResult +// purpose: +//================================================================================= +void GEOMAlgo_ShellSolid::BuildResult() +{ + Standard_Boolean bIsTouchCase; + Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1; + Standard_Integer nE, nF, aNbPB, iBeg, iEnd; + BooleanOperations_StateOfShape aState; + TopExp_Explorer anExp; + TopAbs_ShapeEnum aType; + gp_Pnt2d aP2D; + gp_Pnt aP3D; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool(); + BOPTools_InterferencePool* pInterfPool=(BOPTools_InterferencePool*) &anInterfPool; + BOPTools_CArray1OfSSInterference& aFFs=pInterfPool->SSInterferences(); + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool(); + // + // 1. process pf non-interferring faces + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_FACE) { + continue; + } + // + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i)); + aState=aDS.GetState(i); + if (aState==BooleanOperations_IN) { + myLSIN.Append(aF1); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aF1); + } + } + // + // 2. process pf interferred faces + aNbFFs=aFFs.Extent(); + for (i=1; i<=aNbFFs; ++i) { + BOPTools_SSInterference& aFFi=aFFs(i); + // + nF1=aFFi.Index1(); + nF2=aFFi.Index2(); + iRank1=aDS.Rank(nF1); + nF=(iRank1==myRank) ? nF1 : nF2; + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF)); + // + bIsTouchCase=aFFi.IsTangentFaces(); + // + if (bIsTouchCase) { + myLSON.Append(aF1); + continue; + } + // + // Has section edges ? + aNbS=0; + BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves(); + aNbCurves=aBCurves.Length(); + for (j=1; j<=aNbCurves; j++) { + BOPTools_Curve& aBC=aBCurves(j); + const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks(); + aNbS=aSectEdges.Extent(); + if (aNbS) { + break; + } + } + // + if (aNbS) { // it has + continue; + } + // + anExp.Init(aF1, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current()); + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + nE=aDS.ShapeIndex(aE, myRank); + const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE)); + aNbPB=aLPB.Extent(); + // + if (aNbPB<2) { + nSp=nE; + if (aNbPB) { + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + } + const TopoDS_Shape& aSp=aDS.Shape(nSp); + // + aState=aDS.GetState(nSp); + if (aState==BooleanOperations_IN) { + myLSIN.Append(aF1); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aF1); + } + else if (aState==BooleanOperations_ON) { + Standard_Real aTol; + TopAbs_State aSt; + // + //const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1)); + //aTol=BRep_Tool::Tolerance(aF2); + aTol=1.e-7; + // + BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D); + const TopoDS_Solid& aRefSolid=(myRank==1) ? + TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object()); + // + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller; + IntTools_Context& aCtx=pPF->ChangeContext(); + // + BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aRefSolid); + aSC.Perform(aP3D, aTol); + aSt=aSC.State(); + if (aSt==TopAbs_IN) { + myLSIN.Append(aF1); + } + else if (aSt==TopAbs_OUT) { + myLSOUT.Append(aF1); + } + } + break; + } // if (aNbPB<2) { + } //for (; anExp.More(); anExp.Next()) + } +} +//======================================================================= +// function: DetectSDFaces +// purpose: +//======================================================================= +void GEOMAlgo_ShellSolid::DetectSDFaces() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences(); + // + Standard_Boolean bFlag; + Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag; + gp_Dir aDNF1, aDNF2; + + aNb=aFFs.Extent(); + for (i=1; i<=aNb; i++) { + bFlag=Standard_False; + + BOPTools_SSInterference& aFF=aFFs(i); + + nF1=aFF.Index1(); + nF2=aFF.Index2(); + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2)); + // + // iSenseFlag; + const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks(); + aNbSps=aLPB.Extent(); + + if (!aNbSps) { + continue; + } + + const BOPTools_PaveBlock& aPB=aLPB.First(); + const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge())); + + BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1); + BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2); + iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2); + // + if (iSenseFlag==1 || iSenseFlag==-1) { + // + // + TopoDS_Face aF1FWD=aF1; + aF1FWD.Orientation (TopAbs_FORWARD); + + BOP_WireEdgeSet aWES (aF1FWD); + BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller); + aWESFiller.SetSenseFlag(iSenseFlag); + aWESFiller.SetOperation(BOP_COMMON); + aWESFiller.Do(aWES); + + BOP_FaceBuilder aFB; + aFB.Do(aWES); + const TopTools_ListOfShape& aLF=aFB.NewFaces(); + + iZone=0; + TopTools_ListIteratorOfListOfShape anIt(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aFR=anIt.Value(); + + if (aFR.ShapeType()==TopAbs_FACE) { + const TopoDS_Face& aFaceResult=TopoDS::Face(aFR); + // + Standard_Boolean bIsValidIn2D, bNegativeFlag; + bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag); + if (bIsValidIn2D) { + //if(CheckSameDomainFaceInside(aFaceResult, aF2)) { + iZone=1; + break; + //} + } + // + } + } + + if (iZone) { + bFlag=Standard_True; + aFF.SetStatesMap(aWESFiller.StatesMap()); + } + + }// if (iSenseFlag) + + aFF.SetTangentFacesFlag(bFlag); + aFF.SetSenseFlag (iSenseFlag); + }// end of for (i=1; i<=aNb; i++) +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx new file mode 100644 index 000000000..0e6c4944f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_ShellSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl new file mode 100644 index 000000000..693d4590e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cdl @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_SolidSolid.cdl +-- Created: Wed Jan 26 12:05:14 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class SolidSolid from GEOMAlgo + inherits ShellSolid from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns SolidSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_SolidSolid();" + + Perform (me:out) + is redefined; + + BuildResult (me:out) + is redefined protected; + + SetShape2 (me:out; + aS: Shape from TopoDS); + + Shape2 (me) + returns Shape from TopoDS; + ---C++: return const & + +fields + myS2: Shape from TopoDS is protected; + +end SolidSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx new file mode 100644 index 000000000..c0e99a259 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SolidSolid.cxx @@ -0,0 +1,201 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_SolidSolid.cxx +// Created: Wed Jan 26 12:06:26 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +//======================================================================= +//function : GEOMAlgo_SolidSolid +//purpose : +//======================================================================= +GEOMAlgo_SolidSolid::GEOMAlgo_SolidSolid() +: + GEOMAlgo_ShellSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_SolidSolid::~GEOMAlgo_SolidSolid() +{ +} +//======================================================================= +// function: SetShape2 +// purpose: +//======================================================================= +void GEOMAlgo_SolidSolid::SetShape2(const TopoDS_Shape& aS2) +{ + myS2=aS2; +} +//======================================================================= +// function: Shape2 +// purpose: +//======================================================================= +const TopoDS_Shape& GEOMAlgo_SolidSolid::Shape2()const +{ + return myS2; +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_SolidSolid::Perform() +{ + myErrorStatus=0; + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + // + myRank=2; + BuildResult(); + } + catch (Standard_Failure) { + myErrorStatus=12; + } +} +//================================================================================= +// function: BuildResult +// purpose: +//================================================================================= +void GEOMAlgo_SolidSolid::BuildResult() +{ + myErrorStatus=0; + // + Standard_Integer i, j, aNbF, aNbS; + Standard_Integer aNbFIN, aNbFOUT, aNbFON, aNbFINTR; + TopAbs_State aState; + TopTools_ListIteratorOfListOfShape aIt; + TopTools_IndexedMapOfShape aMF, aMS; + GEOMAlgo_IndexedDataMapOfShapeState aMFS; + // + // 1. classify the faces + GEOMAlgo_ShellSolid::BuildResult(); + // + // 2. fill Shape-State map + aIt.Initialize(myLSIN); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_IN); + } + aIt.Initialize(myLSOUT); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_OUT); + } + aIt.Initialize(myLSON); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFS.Add(aF, TopAbs_ON); + } + myLSIN.Clear(); + myLSON.Clear(); + myLSOUT.Clear(); + // + // 3. fill states for solids + TopExp::MapShapes(myS2, TopAbs_SOLID, aMS); + // + aNbS=aMS.Extent(); + for (i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSolid=aMS(i); + // + aMF.Clear(); + TopExp::MapShapes(aSolid, TopAbs_FACE, aMF); + // + aNbFIN=0; + aNbFOUT=0; + aNbFON=0; + aNbFINTR=0; + // + aNbF=aMF.Extent(); + for(j=1; j +#endif +#ifndef _GEOMAlgo_SolidSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl b/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl new file mode 100644 index 000000000..70065fe5b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_StateCollector.cdl @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_StateCollector.cdl +-- Created: Thu Mar 10 09:39:25 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class StateCollector from GEOMAlgo + + ---Purpose: + +uses + State from TopAbs + +--raises + +is + Create + returns StateCollector from GEOMAlgo; + + AppendState(me:out; + aSt:State from TopAbs) + returns Boolean from Standard; + + State(me) + returns State from TopAbs; + +fields + myCounter:Integer from Standard[3]; + +end StateCollector; diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx b/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx new file mode 100644 index 000000000..5281aced7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_StateCollector.cxx @@ -0,0 +1,90 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_StateCollector.cxx +// Created: Thu Mar 10 09:42:11 2005 +// Author: Peter KURNEV +// + + +#include + +//======================================================================= +//function : GEOMAlgo_StateCollector +//purpose : +//======================================================================= +GEOMAlgo_StateCollector::GEOMAlgo_StateCollector() +{ + myCounter[0]=0; + myCounter[1]=0; + myCounter[2]=0; +} +//======================================================================= +//function : AppendState +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) +{ + Standard_Boolean bIsToBreak; + // + switch(aSt) { + case TopAbs_IN: + ++myCounter[0]; + break; + case TopAbs_OUT: + ++myCounter[1]; + break; + case TopAbs_ON: + ++myCounter[2]; + break; + default: + break; + } + bIsToBreak=(myCounter[0] && myCounter[1]); + // + return bIsToBreak; +} +//======================================================================= +//function : State +//purpose : +//======================================================================= +TopAbs_State GEOMAlgo_StateCollector::State()const +{ + TopAbs_State aSt; + // + aSt=TopAbs_UNKNOWN; + // + if (myCounter[0] && myCounter[1]) { + return aSt; + } + // + else if (myCounter[0] && myCounter[2]>=0) { + aSt=TopAbs_IN; + } + // + else if (myCounter[1] && myCounter[2]>=0) { + aSt=TopAbs_OUT; + } + // + else if (!myCounter[0] && !myCounter[1] && myCounter[2]) { + aSt=TopAbs_ON; + } + // + return aSt; +} diff --git a/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx b/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx new file mode 100644 index 000000000..40d7d3ab6 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_StateCollector.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_StateCollector_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl new file mode 100644 index 000000000..d812ff075 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cdl @@ -0,0 +1,97 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_SurfaceTools.cdl +-- Created: Thu Jan 27 11:03:49 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class SurfaceTools from GEOMAlgo + + ---Purpose: + +uses + Pnt from gp, + Pln from gp, + Cylinder from gp, + Sphere from gp, + Surface from Geom, + Surface from GeomAdaptor, + State from TopAbs, + State from GEOMAlgo + +--raises + +is + + + IsAnalytic(myclass; + aS:Surface from Geom) + returns Boolean from Standard; + + IsCoaxial(myclass; + aP1 : Pnt from gp; + aP2 : Pnt from gp; + aCyl : Cylinder from gp; + aTol : Real from Standard) + returns Boolean from Standard; + + IsConformState(myclass; + aST1:State from TopAbs; + aST2:State from GEOMAlgo) + returns Boolean from Standard; + + GetState(myclass; + aP:Pnt from gp; + aS:Surface from GeomAdaptor; + aTol:Real from Standard; + aSt:out State from TopAbs) + returns Integer from Standard; + + GetState(myclass; + aP:Pnt from gp; + aS:Surface from Geom; + aTol:Real from Standard; + aSt:out State from TopAbs) + returns Integer from Standard; + + Distance(myclass; + aP:Pnt from gp; + aPln:Pln from gp) + returns Real from Standard; + + Distance(myclass; + aP:Pnt from gp; + aCyl:Cylinder from gp) + returns Real from Standard; + + Distance(myclass; + aP:Pnt from gp; + aSph:Sphere from gp) + returns Real from Standard; + + ReverseState(myclass; + aSt: State from TopAbs) + returns State from TopAbs; + +--fields + +end SurfaceTools; diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx new file mode 100644 index 000000000..436d05f1d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx @@ -0,0 +1,268 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_SurfaceTools.cxx +// Created: Thu Jan 27 11:05:16 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +//======================================================================= +//function : GetState +//purpose : +//======================================================================= + Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, + const GeomAdaptor_Surface& aGAS, + const Standard_Real aTol, + TopAbs_State& aState) +{ + Standard_Integer iErr; + Standard_Real aDp, aR; + GeomAbs_SurfaceType aType; + gp_Sphere aSph; + gp_Cylinder aCyl; + gp_Pln aPln; + // + iErr=0; + aState=TopAbs_UNKNOWN; + // + aType=aGAS.GetType(); + switch (aType) { + case GeomAbs_Plane: + aPln=aGAS.Plane(); + aR=0.; + aDp=GEOMAlgo_SurfaceTools::Distance(aP, aPln); + break; + + case GeomAbs_Cylinder: + aCyl=aGAS.Cylinder(); + aR=aCyl.Radius(); + aDp=GEOMAlgo_SurfaceTools::Distance(aP, aCyl); + break; + + case GeomAbs_Sphere: + aSph=aGAS.Sphere(); + aR=aSph.Radius(); + aDp=GEOMAlgo_SurfaceTools::Distance(aP, aSph); + break; + + default: + iErr=1; // unprocessed surface type + break; + } + // + if (!iErr) { + aState=TopAbs_ON; + if (aDp>aR+aTol) { + aState=TopAbs_OUT; + } + else if (aDp aTol) { + return bRet; + } + // + return !bRet; +} +//======================================================================= +//function : IsAnalytic +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf) +{ + Standard_Boolean bRet; + GeomAbs_SurfaceType aType; + GeomAdaptor_Surface aGAS; + // + aGAS.Load(aSurf); + aType=aGAS.GetType(); + bRet=(aType==GeomAbs_Plane || + aType==GeomAbs_Cylinder || + aType==GeomAbs_Sphere); + return bRet; +} +//======================================================================= +//function : IsConformState +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1, + const GEOMAlgo_State aST2) +{ + Standard_Boolean bRet=Standard_False; + // + switch (aST2) { + case GEOMAlgo_ST_IN: + if (aST1==TopAbs_IN) { + bRet=!bRet; + } + break; + case GEOMAlgo_ST_OUT: + if (aST1==TopAbs_OUT) { + bRet=!bRet; + } + break; + case GEOMAlgo_ST_ON: + if (aST1==TopAbs_ON) { + bRet=!bRet; + } + break; + case GEOMAlgo_ST_ONIN: + if (aST1==TopAbs_ON || aST1==TopAbs_IN) { + bRet=!bRet; + } + break; + case GEOMAlgo_ST_ONOUT: + if (aST1==TopAbs_ON || aST1==TopAbs_OUT) { + bRet=!bRet; + } + break; + default: + break; + } + return bRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx new file mode 100644 index 000000000..34238e42b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.jxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _gp_Cylinder_HeaderFile +#include +#endif +#ifndef _GeomAdaptor_Surface_HeaderFile +#include +#endif +#ifndef _gp_Pln_HeaderFile +#include +#endif +#ifndef _gp_Sphere_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_SurfaceTools_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cdl b/src/GEOMAlgo/GEOMAlgo_Tools.cdl new file mode 100644 index 000000000..4981d93bf --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cdl @@ -0,0 +1,113 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_Tools.cdl +-- Created: Mon Dec 6 11:26:02 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Tools from GEOMAlgo + + ---Purpose: + +uses + Pnt from gp, + Surface from Geom, + ShapeEnum from TopAbs, + Edge from TopoDS, + Face from TopoDS, + Shape from TopoDS, + ListOfShape from TopTools, + IndexedDataMapOfShapeListOfShape from TopTools, + Context from IntTools, + IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo + +--raises + +is + IsCompositeShape(myclass; + aS :Shape from TopoDS) + returns Boolean from Standard; + + RefineSDShapes(myclass; + aMSD:out IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo; + aTol:Real from Standard; + aCtx:out Context from IntTools) + returns Integer from Standard; + + FindSDShapes(myclass; + aLE :ListOfShape from TopTools; + aTol:Real from Standard; + aMEE:out IndexedDataMapOfShapeListOfShape from TopTools; + aCtx:out Context from IntTools) + returns Integer from Standard; + + FindSDShapes(myclass; + aE1 :Shape from TopoDS; + aLE :ListOfShape from TopTools; + aTol :Real from Standard; + aLESD :out ListOfShape from TopTools; + aCtx :out Context from IntTools) + returns Integer from Standard; + + ProjectPointOnShape(myclass; + aP1: Pnt from gp; + aS :Shape from TopoDS; + aP2:out Pnt from gp; + aCtx :out Context from IntTools) + returns Boolean from Standard; + + PointOnShape(myclass; + aS :Shape from TopoDS; + aP3D:out Pnt from gp); + + PointOnEdge(myclass; + aE :Edge from TopoDS; + aP3D:out Pnt from gp); + + PointOnEdge(myclass; + aE :Edge from TopoDS; + aT :Real from Standard; + aP3D:out Pnt from gp); + + PointOnFace(myclass; + aF :Face from TopoDS; + aP3D:out Pnt from gp); + + PointOnFace(myclass; + aF :Face from TopoDS; + aU :Real from Standard; + aV :Real from Standard; + aP3D:out Pnt from gp); + + RefinePCurveForEdgeOnFace (myclass; + aE : Edge from TopoDS; + aF : Face from TopoDS; + aU1 : Real from Standard; + aU2 : Real from Standard); + + IsUPeriodic(myclass; + aS:Surface from Geom) + returns Boolean from Standard; + +--fields + +end Tools; diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.cxx b/src/GEOMAlgo/GEOMAlgo_Tools.cxx new file mode 100644 index 000000000..6f4696463 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Tools.cxx @@ -0,0 +1,457 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_Tools.cxx +// Created: Mon Dec 6 11:35:29 2004 +// Author: Peter KURNEV +// + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +static + void GetCount(const TopoDS_Shape& aS, + Standard_Integer& iCnt); + +//======================================================================= +//function : IsCompositeShape +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Tools::IsCompositeShape(const TopoDS_Shape& aS) +{ + Standard_Boolean bRet; + Standard_Integer iCnt; + TopoDS_Iterator aIt; + // + iCnt=0; + GetCount(aS, iCnt); + bRet=(iCnt>1); + // + return bRet; +} + +//======================================================================= +//function : GetCount +//purpose : +//======================================================================= +void GetCount(const TopoDS_Shape& aS, + Standard_Integer& iCnt) +{ + TopoDS_Iterator aIt; + TopAbs_ShapeEnum aTS; + // + aTS=aS.ShapeType(); + // + if (aTS==TopAbs_SHAPE) { + return; + } + if (aTS!=TopAbs_COMPOUND) { + ++iCnt; + return; + } + // + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSx=aIt.Value(); + GetCount(aSx, iCnt); + } +} + +//======================================================================= +//function : RefineSDShapes +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_Tools::RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape &aMPKLE, + const Standard_Real aTol, + IntTools_Context& aCtx) +{ + Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd; + TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd; + // + iErr=1; + // + aNbE=aMPKLE.Extent(); + for (i=1; i<=aNbE; ++i) { + TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i); + // + aMEE.Clear(); + iErr=GEOMAlgo_Tools::FindSDShapes(aLSDE, aTol, aMEE, aCtx); + if (iErr) { + return iErr; + } + // + aNbEE=aMEE.Extent(); + if (aNbEE==1) { + continue; // nothing to do + } + // + for (j=1; j<=aNbEE; ++j) { + TopTools_ListOfShape& aLEE=aMEE.ChangeFromIndex(j); + // + if (j==1) { + aLSDE.Clear(); + aLSDE.Append(aLEE); + } + else { + const TopoDS_Shape& aE1=aLEE.First(); + aMEToAdd.Add(aE1, aLEE); + } + } + } + // + aNbToAdd=aMEToAdd.Extent(); + if (!aNbToAdd) { + return aNbToAdd; + } + // + for (i=1; i<=aNbToAdd; ++i) { + GEOMAlgo_PassKeyShape aPKE1; + // + const TopoDS_Shape& aE1=aMEToAdd.FindKey(i); + const TopTools_ListOfShape& aLE=aMEToAdd(i); + // + aPKE1.SetIds(aE1); + aMPKLE.Add(aPKE1, aLE); + } + // + return 0; +} +//======================================================================= +//function : FindSDShapes +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopTools_ListOfShape& aLE, + const Standard_Real aTol, + TopTools_IndexedDataMapOfShapeListOfShape& aMEE, + IntTools_Context& aCtx) +{ + Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr; + TopTools_ListOfShape aLESD; + TopTools_ListIteratorOfListOfShape aIt, aIt1; + TopTools_IndexedMapOfShape aMProcessed; + TopAbs_ShapeEnum aType; + // + aNbE=aLE.Extent(); + if (!aNbE) { + return 3; // Err + } + //modified by NIZNHY-PKV Thu Dec 30 10:56:52 2004 f + if (aNbE==1) { + return 0; // Nothing to do + } + //modified by NIZNHY-PKV Thu Dec 30 10:56:56 2004 t + // + while(1) { + aNbEProcessed=aMProcessed.Extent(); + if (aNbEProcessed==aNbE) { + break; + } + // + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + // + if (aMProcessed.Contains(aS)) { + continue; + } + // + //modified by NIZNHY-PKV Thu Dec 30 10:57:01 2004 f + aType=aS.ShapeType(); + if (aType==TopAbs_EDGE) { + const TopoDS_Edge& aE=TopoDS::Edge(aS); + if (BRep_Tool::Degenerated(aE)) { + aMProcessed.Add(aE); + continue; + } + } + //modified by NIZNHY-PKV Thu Dec 30 10:57:03 2004 t + // + aLESD.Clear(); + iErr=GEOMAlgo_Tools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx); + if (iErr) { + return 2; // Err + } + // + aNbESD=aLESD.Extent(); + if (!aNbESD) { + return 1; // Err + } + // + aMEE.Add(aS, aLESD); + // + aIt1.Initialize(aLESD); + for (; aIt1.More(); aIt1.Next()) { + const TopoDS_Shape& aE1=aIt1.Value(); + aMProcessed.Add(aE1); + } + } + } + return 0; +} +//======================================================================= +//function : FindSDShapes +//purpose : +//======================================================================= +Standard_Integer GEOMAlgo_Tools::FindSDShapes(const TopoDS_Shape& aE1, + const TopTools_ListOfShape& aLE, + const Standard_Real aTol, + TopTools_ListOfShape& aLESD, + IntTools_Context& aCtx) +{ + Standard_Boolean bIsDone; + Standard_Real aTol2, aD2; + gp_Pnt aP1, aP2; + TopTools_ListIteratorOfListOfShape aIt; + // + aTol2=aTol*aTol; + GEOMAlgo_Tools::PointOnShape(aE1, aP1); + // + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE2=aIt.Value(); + if (aE2.IsSame(aE1)) { + aLESD.Append(aE2); + } + else { + bIsDone=GEOMAlgo_Tools::ProjectPointOnShape(aP1, aE2, aP2, aCtx); + if (!bIsDone) { + return 1; + } + aD2=aP1.SquareDistance(aP2); + if(aD2D0(aU, aV, aP3D); +} +//======================================================================= +//function : PointOnEdge +//purpose : +//======================================================================= +void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, + gp_Pnt& aP3D) +{ + Standard_Real aTx, aT1, aT2; + // + BRep_Tool::Curve(aE, aT1, aT2); + aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + GEOMAlgo_Tools::PointOnEdge(aE, aTx, aP3D); +} +//======================================================================= +//function : PointOnEdge +//purpose : +//======================================================================= +void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE, + const Standard_Real aT, + gp_Pnt& aP3D) +{ + Standard_Real aT1, aT2; + Handle(Geom_Curve) aC3D; + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + aC3D->D0(aT, aP3D); +} +//======================================================================= +//function : RefinePCurveForEdgeOnFace +//purpose : +//======================================================================= +void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Standard_Real aUMin, + const Standard_Real aUMax) +{ + Standard_Real aT1, aT2, aTx, aUx, aTol, aTwoPI; + gp_Pnt2d aP2D; + Handle(Geom_Surface) aS; + Handle(Geom2d_Curve) aC2D; + BRep_Builder aBB; + // + aTwoPI=PI+PI; + // + aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2); + if (!aC2D.IsNull()) { + if (BRep_Tool::IsClosed(aE, aF)) { + return; + } + aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + aC2D->D0(aTx, aP2D); + aUx=aP2D.X(); + if (aUx < aUMin || aUx > aUMax) { + // need to rebuild + Handle(Geom2d_Curve) aC2Dx; + // + aTol=BRep_Tool::Tolerance(aE); + aBB.UpdateEdge(aE, aC2Dx, aF, aTol); + } + } +} +//======================================================================= +//function : IsUPeriodic +//purpose : +//======================================================================= +Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS) +{ + Standard_Boolean bRet; + GeomAbs_SurfaceType aType; + GeomAdaptor_Surface aGAS; + // + aGAS.Load(aS); + aType=aGAS.GetType(); + bRet=(aType==GeomAbs_Cylinder|| + aType==GeomAbs_Cone || + aType==GeomAbs_Sphere); + // + return bRet; +} diff --git a/src/GEOMAlgo/GEOMAlgo_Tools.jxx b/src/GEOMAlgo/GEOMAlgo_Tools.jxx new file mode 100644 index 000000000..51a85dfd9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Tools.jxx @@ -0,0 +1,49 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile +#include +#endif +#ifndef _IntTools_Context_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _Geom_Surface_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Tools_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl new file mode 100644 index 000000000..588e8d851 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cdl @@ -0,0 +1,51 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_VertexSolid.cdl +-- Created: Wed Jan 12 16:34:53 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class VertexSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + + ---Purpose: + +--uses +--raises + +is + Create + returns VertexSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + +--fields + +end VertexSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx new file mode 100644 index 000000000..349f1498c --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx @@ -0,0 +1,238 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_VertexSolid.cxx +// Created: Wed Jan 12 16:36:40 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_VertexSolid +//purpose : +//======================================================================= +GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid() +{ +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + Standard_Integer aNbF; + TopTools_IndexedMapOfShape aM; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const TopoDS_Shape& aObj=aDS.Object(); + // + TopExp::MapShapes(aObj, TopAbs_FACE, aM); + aNbF=aM.Extent(); + myRank=(aNbF) ? 2 : 1; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + BuildResult(); + } + // + catch (Standard_Failure) { + myErrorStatus = 12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::Prepare() +{ + Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound; + Standard_Real aTol; + TopAbs_State aSt; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + gp_Pnt aP3D; + // + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS; + const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool(); + BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP; + BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences(); + const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller(); + BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF; + IntTools_Context& aCtx=pPF->ChangeContext(); + // + const TopoDS_Shape& aObj=aDS.Object(); + const TopoDS_Shape& aTool=aDS.Tool(); + // + const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); + const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool; + // + BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i)); + // + aState=aDS.GetState(i); + if (aState==BooleanOperations_ON || + aState==BooleanOperations_IN || + aState==BooleanOperations_OUT) { + continue; + } + // + iFound=0; + aNbVV=aVVs.Extent(); + for (j=1; j<=aNbVV; ++j) { + BOPTools_VVInterference& aVV=aVVs(j); + aVV.Indices(n1, n2); + if (n1==i || n2==i) { + pDS->SetState (n1, BooleanOperations_ON); + pDS->SetState (n2, BooleanOperations_ON); + iFound=1; + break; + } + } + if (iFound) { + continue; + } + // + aP3D=BRep_Tool::Pnt(aV); + aTol=1.E-7; + aSC.Perform(aP3D, aTol); + aSt=aSC.State(); + if (aSt==TopAbs_IN) { + pDS->SetState (i, BooleanOperations_IN); + } + else if (aSt==TopAbs_OUT) { + pDS->SetState (i, BooleanOperations_OUT); + } + } +} +//======================================================================= +// function: BuildResult +// purpose: +//======================================================================= +void GEOMAlgo_VertexSolid::BuildResult() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + // + Standard_Integer i, iBeg, iEnd; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + // + myLSIN.Clear(); + myLSOUT.Clear(); + myLSON.Clear(); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (myRank==2) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType!=TopAbs_VERTEX) { + continue; + } + const TopoDS_Shape& aV=aDS.Shape(i); + aState=aDS.GetState(i); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aV); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aV); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aV); + } + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx new file mode 100644 index 000000000..c9137f862 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_VertexSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl b/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl new file mode 100644 index 000000000..f55158a97 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cdl @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: GEOMAlgo_WireSolid.cdl +-- Created: Wed Jan 12 10:17:00 2005 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2005 + + +class WireSolid from GEOMAlgo + inherits ShapeSolid from GEOMAlgo + ---Purpose: + +--uses +--raises + +is + Create + returns WireSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WireSolid();" + + Perform (me:out) + is redefined; + + Prepare(me:out) + is redefined protected; + + BuildResult (me:out) + is redefined protected; + +--fields + +end WireSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx new file mode 100644 index 000000000..306fe56be --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx @@ -0,0 +1,171 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: GEOMAlgo_WireSolid.cxx +// Created: Wed Jan 12 10:19:31 2005 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GEOMAlgo_WireSolid +//purpose : +//======================================================================= +GEOMAlgo_WireSolid::GEOMAlgo_WireSolid() +: + GEOMAlgo_ShapeSolid() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid() +{ +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::Perform() +{ + myErrorStatus=0; + // + try { + if (myDSFiller==NULL) { + myErrorStatus=10; + return; + } + if(!myDSFiller->IsDone()) { + myErrorStatus=11; + return; + } + // + Standard_Boolean bIsNewFiller; + // + bIsNewFiller=myDSFiller->IsNewFiller(); + + if (bIsNewFiller) { + Prepare(); + myDSFiller->SetNewFiller(!bIsNewFiller); + } + BuildResult(); + } + // + catch (Standard_Failure) { + myErrorStatus= 12; + } +} +//======================================================================= +// function: Prepare +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::Prepare() +{ + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + // + BOPTools_WireStateFiller aStateFiller(aPaveFiller); + aStateFiller.Do(); + // +} +//======================================================================= +// function: BuildResult +// purpose: +//======================================================================= +void GEOMAlgo_WireSolid::BuildResult() +{ + const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); + const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller(); + const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool(); + // + Standard_Integer i, aNbPB, nSp, iBeg, iEnd; + TopAbs_ShapeEnum aType; + BooleanOperations_StateOfShape aState; + // + myLSIN.Clear(); + myLSOUT.Clear(); + myLSON.Clear(); + // + iBeg=1; + iEnd=aDS.NumberOfShapesOfTheObject(); + if (aDS.Tool().ShapeType()==TopAbs_WIRE) { + iBeg=iEnd+1; + iEnd=aDS.NumberOfSourceShapes(); + } + // + for (i=iBeg; i<=iEnd; ++i) { + aType=aDS.GetShapeType(i); + if (aType==TopAbs_EDGE) { + const TopoDS_Shape& aE=aDS.Shape(i); + const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i)); + aNbPB=aLPB.Extent(); + // + if (!aNbPB) { + aState=aDS.GetState(i); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } + } + // + else if (aNbPB==1) { + const BOPTools_PaveBlock& aPB=aLPB.First(); + nSp=aPB.Edge(); + const TopoDS_Shape& aSp=aDS.Shape(nSp); + aState=aDS.GetState(nSp); + // + if (aState==BooleanOperations_IN) { + myLSIN.Append(aE); + } + else if (aState==BooleanOperations_OUT) { + myLSOUT.Append(aE); + } + else if (aState==BooleanOperations_ON) { + myLSON.Append(aE); + } + } + } + } +} diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx new file mode 100644 index 000000000..16961833e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _GEOMAlgo_WireSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/Makefile.in b/src/GEOMAlgo/Makefile.in new file mode 100644 index 000000000..d250da21c --- /dev/null +++ b/src/GEOMAlgo/Makefile.in @@ -0,0 +1,111 @@ +# GEOM GEOMAlgo : tools for Glue Faces algorithm +# +# Copyright (C) 2004 CEA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Julia DOROVSKIKH +# Module : GEOM +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# Libraries targets +LIB = libGEOMAlgo.la +LIB_SRC = \ + BlockFix.cxx \ + BlockFix_BlockFixAPI.cxx \ + BlockFix_CheckTool.cxx \ + BlockFix_PeriodicSurfaceModifier.cxx \ + BlockFix_SphereSpaceModifier.cxx \ + BlockFix_UnionEdges.cxx \ + BlockFix_UnionFaces.cxx \ + GEOMAlgo_Algo.cxx \ + GEOMAlgo_CoupleOfShapes.cxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_DataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_FinderShapeOn1.cxx \ + GEOMAlgo_FinderShapeOnQuad.cxx \ + GEOMAlgo_GlueAnalyser.cxx \ + GEOMAlgo_Gluer.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx \ + GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx \ + GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ + GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx \ + GEOMAlgo_IndexedDataMapOfShapeState_0.cxx \ + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx \ + GEOMAlgo_ListIteratorOfListOfPnt_0.cxx \ + GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx \ + GEOMAlgo_ListNodeOfListOfPnt_0.cxx \ + GEOMAlgo_ListOfCoupleOfShapes_0.cxx \ + GEOMAlgo_ListOfPnt_0.cxx \ + GEOMAlgo_PassKey.cxx \ + GEOMAlgo_PassKeyMapHasher.cxx \ + GEOMAlgo_PassKeyShape.cxx \ + GEOMAlgo_ShapeAlgo.cxx \ + GEOMAlgo_StateCollector.cxx \ + GEOMAlgo_SurfaceTools.cxx \ + GEOMAlgo_Tools.cxx + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# header files +EXPORT_HEADERS = \ + BlockFix_BlockFixAPI.hxx \ + BlockFix_BlockFixAPI.lxx \ + BlockFix_CheckTool.hxx \ + Handle_BlockFix_BlockFixAPI.hxx \ + GEOMAlgo_Algo.hxx \ + GEOMAlgo_CoupleOfShapes.hxx \ + GEOMAlgo_GlueAnalyser.hxx \ + GEOMAlgo_Gluer.hxx \ + GEOMAlgo_FinderShapeOn1.hxx \ + GEOMAlgo_FinderShapeOnQuad.hxx \ + GEOMAlgo_IndexedDataMapOfShapeState.hxx \ + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \ + GEOMAlgo_ListOfCoupleOfShapes.hxx \ + GEOMAlgo_ShapeAlgo.hxx \ + GEOMAlgo_State.hxx \ + Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ + Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx + +# idl files +EXPORT_IDLS= + + +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(CAS_LDPATH) -lTKBO -L${KERNEL_ROOT_DIR}/lib/salome + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx new file mode 100644 index 000000000..049432031 --- /dev/null +++ b/src/GEOMBase/GEOMBase.cxx @@ -0,0 +1,981 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "GEOMBase.h" +#include "GeometryGUI.h" +#include "GEOMBase_aParameterDlg.h" + +#include "GEOM_Client.hxx" + +//// SALOME Includes +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +#include "SALOME_LifeCycleCORBA.hxx" + +#include "GEOM_AssemblyBuilder.h" +#include "GEOM_Actor.h" +#include "SVTK_RenderWindowInteractor.h" +#include "SVTK_ViewModel.h" +#include "SVTK_ViewWindow.h" +#include "OCCViewer_ViewPort3d.h" +#include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewWindow.h" + +#include "SALOME_ListIO.hxx" +#include "SALOME_ListIteratorOfListIO.hxx" +#include "GEOM_AISTrihedron.hxx" + +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "SUIT_MessageBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" + +// // Open CASCADE Includes +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "GEOMImpl_Types.hxx" + +using namespace std; + +#include "SALOMEDSClient.hxx" + + +//======================================================================= +// function : GEOMBase() +// purpose : Constructor +//======================================================================= +GEOMBase::GEOMBase() +{ +} + + +//======================================================================= +// function : ~GEOMBase() +// purpose : Destructor +//======================================================================= +GEOMBase::~GEOMBase() +{ +} + +//===================================================================================== +// function : GetShapeFromIOR() +// purpose : exist also as static method ! +//===================================================================================== +TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) +{ + TopoDS_Shape result; + if(IOR.stripWhiteSpace().isEmpty()) + return result; + + CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object((char*)(IOR.latin1())); + if(CORBA::is_nil(obj)) + return result; + GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj ); + if (GeomObject->_is_nil()) + return result; + + result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject); + return result; +} + + +//===================================================================================== +// function : GetIndex() +// purpose : Get the index of a sub shape in a main shape : index start at 1 +//===================================================================================== +int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int /*ShapeType*/) +{ + if(shape.IsNull() || subshape.IsNull()) + return -1; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(shape, anIndices); + if(anIndices.Contains(subshape)) return anIndices.FindIndex(subshape); + + return -1; +} + + +//======================================================================= +// function : GetTopoFromSelection() +// purpose : Define tds from a single selection and retuen true +//======================================================================= +bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds) +{ + if(aList.Extent() != 1) + return false; + + Handle(SALOME_InteractiveObject) IO = aList.First(); + /* case SObject */ + if(IO->hasEntry()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if( obj ) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + tds = GetShapeFromIOR(anIOR->Value().c_str()); + if(tds.IsNull()) + return false; + else + return true; + } + } + } + + return false; +} + +//======================================================================= +// function : GetNameOfSelectedIObjects() +// purpose : Define the name geom++ or other name of mono or multi sel. +//======================================================================= +int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, + QString& theName, + const bool theShapesOnly ) +{ + if ( !theShapesOnly ) + { + int nbSel = aList.Extent(); + if ( nbSel == 1 ) + { + Handle(SALOME_InteractiveObject) anIObj = aList.First(); + if(anIObj->hasEntry()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return nbSel; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) ); + + _PTR(GenericAttribute) anAttr; + + if ( obj && obj->FindAttribute( anAttr, "AttributeName") ) + { + _PTR(AttributeName) aNameAttr ( anAttr ); + theName = aNameAttr->Value().c_str(); + } + } + } + else + theName = QObject::tr("%1_objects").arg(nbSel); + + return nbSel; + } + else + { + GEOM::ListOfGO anObjs; + ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); + if ( anObjs.length() == 1 ) { + theName = GetName( anObjs[ 0 ] ); + } + else + theName = QString( "%1_objects" ).arg( anObjs.length() ); + + return anObjs.length(); + } +} + + +//================================================================================= +// function : GetShapeTypeString() +// purpose : for a single shape +//================================================================================= +bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString) +{ + if(aShape.IsNull()) { + aTypeString = "aNullShape"; + return false; + } + switch(aShape.ShapeType()) + { + case TopAbs_COMPOUND: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND")); + return true; + } + case TopAbs_COMPSOLID: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID")) ; + return true ; + } + case TopAbs_SOLID: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID")) ; + return true ; + } + case TopAbs_SHELL: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL")) ; + return true ; + } + case TopAbs_FACE: + { + BRepAdaptor_Surface surf(TopoDS::Face(aShape)); + if(surf.GetType() == GeomAbs_Plane) { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE")); + return true; + } + else if(surf.GetType() == GeomAbs_Cylinder) { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER")); + return true; + } + else if(surf.GetType() == GeomAbs_Sphere) { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE")); + return true ; + } + else if(surf.GetType() == GeomAbs_Torus) { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS")); + return true ; + } + else if(surf.GetType() == GeomAbs_Cone) { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE")); + return true ; + } + else { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE")); + return true; + } + } + case TopAbs_WIRE: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE")); + return true; + } + case TopAbs_EDGE: + { + BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); + if(curv.GetType() == GeomAbs_Line) { + if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) + aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE")); + else + aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE")); + return true; + } + else if(curv.GetType() == GeomAbs_Circle) { + if(curv.IsClosed()) + aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE")); + else + aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC")); + return true; + } + else { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE")); + return true; + } + } + case TopAbs_VERTEX: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX")); + return true; + } + case TopAbs_SHAPE: + { + aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE")); + return true; + } + } + return false; +} + + +//======================================================================= +// function : ConvertIORinGEOMAISShape() +// purpose : +//======================================================================= +Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Standard_Boolean& testResult, bool onlyInActiveView) +{ + Handle(GEOM_AISShape) resultShape; + testResult = false; + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return resultShape; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !anObj ) + return resultShape; + + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if(aSh->hasIO()) { + Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); + if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { + if(!onlyInActiveView || + it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { + testResult = true; + resultShape = aSh; + return resultShape; + } + } + } + } + ite.Next(); + } + } + } + return resultShape; +} + + +//======================================================================= +// function : ConvertIORinGEOMActor() +// purpose : +//======================================================================= +GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) +{ + testResult = false; + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM_Actor::New(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !anObj ) + return GEOM_Actor::New(); + + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == SVTK_Viewer::Type()) { + SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( it.current() ); + if( !aVTKViewWindow ) + continue; + vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if( ac->IsA("GEOM_Actor")) { + GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); + if(anActor->hasIO()) { + Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(anActor->getIO()); + if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { + if(!onlyInActiveView || + it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { + testResult = true; + return anActor; + } + } + } + } + ac = theActors->GetNextActor(); + } + } + } + testResult = false; + return GEOM_Actor::New(); +} + +//======================================================================= +// function : GetAIS() +// purpose : +//======================================================================= +Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveObject)& theIO, + const bool isOnlyInActiveView ) +{ + if ( theIO.IsNull() || !theIO->hasEntry() ) + return Handle(AIS_InteractiveObject)(); + + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type()) + continue; + Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive aList; + anIC->DisplayedObjects( aList ); + anIC->ObjectsInCollector( aList ); + + AIS_ListIteratorOfListOfInteractive anIter( aList ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(SALOME_InteractiveObject) anObj = + Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() ); + + if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 ) + { + if( isOnlyInActiveView ) + { + if ( it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) + return anIter.Value(); + } + else + return anIter.Value(); + } + } + } + + return Handle(AIS_InteractiveObject)(); +} + + +//======================================================================= +// function : ConvertIOinGEOMAISShape() +// purpose : +//======================================================================= +Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) +{ + Handle(GEOM_AISShape) res; + + if ( !IO->hasEntry() ) + { + testResult = false; + return res; + } + + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) + { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) + { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if( aSh->hasIO() ) + { + if( strcmp( aSh->getIO()->getEntry(), IO->getEntry() ) == 0 ) + { + if(onlyInActiveView) + { + if(it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) + { + testResult = true; + return aSh; + } + } + else + { + testResult = true; + return aSh; + } + } + } + } + ite.Next(); + } + } + } + testResult = false; + return res; +} + + +//======================================================================= +// function : ConvertIOinGEOMShape() +// purpose : +//======================================================================= +GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) +{ + GEOM::GEOM_Object_var aShape; + testResult = false; + + /* case SObject */ + if(IO->hasEntry()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM::GEOM_Object::_nil(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if(obj) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + aShape = GeometryGUI::GetGeomGen()->GetIORFromString(anIOR->Value().c_str()); + if(!CORBA::is_nil(aShape)) + testResult = true; + return aShape._retn(); + } + } + } + return GEOM::GEOM_Object::_nil(); +} + + +//======================================================================= +// function : ConvertListOfIOInListOfIOR() +// purpose : +//======================================================================= +void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR) +{ + int nbSel = aList.Extent(); + listIOR.length(nbSel); + int j=0; + SALOME_ListIteratorOfListIO It(aList); + SalomeApp_Study* appStudy = dynamic_cast + ( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return; + _PTR(Study) aStudy = appStudy->studyDS(); + + for (int i=0; It.More(); It.Next(), i++) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if (IObject->hasEntry()) { + _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR (anAttr); + //CORBA::Object_var theObj = dynamic_cast + // (aStudy.get())->ConvertIORToObject(anIOR->Value()); + CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj); + if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) { + listIOR[j] = CORBA::string_dup(anIOR->Value().c_str()); + j++; + } + } + } + } + listIOR.length(j); +} + + +//======================================================================= +// function : ConvertIOinGEOMObject() +// purpose : +//======================================================================= +GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO, + Standard_Boolean& theResult ) +{ + theResult = Standard_False; + GEOM::GEOM_Object_var aReturnObject; + if ( !theIO.IsNull() ) + { + const char* anEntry = theIO->getEntry(); + + SalomeApp_Study* appStudy = dynamic_cast + ( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM::GEOM_Object::_nil(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) ); + + if (aSObj) + { + aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); + theResult = !CORBA::is_nil( aReturnObject ); + } + } + return aReturnObject._retn(); +} + + +//======================================================================= +// function : ConvertListOfIOInListOfGO() +// purpose : +//======================================================================= +void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, + GEOM::ListOfGO& theListGO, + const bool theShapesOnly ) +{ + int nbSel = theList.Extent(); + theListGO.length( nbSel ); + SALOME_ListIteratorOfListIO anIter( theList ); + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return; + _PTR(Study) aStudy = appStudy->studyDS(); + + int j = 0; + for ( int i=0; anIter.More(); anIter.Next(), i++ ) + { + Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); + _PTR(SObject) aSObj ( aStudy->FindObjectID( anIObj->getEntry() ) ); + + if ( aSObj ) + { + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); + if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) ) + theListGO[ j++ ] = aGeomObj; + } + } + + theListGO.length( j ); +} + +//================================================================================= +// function : CreateArrowForLinearEdge() +// purpose : Create a cone topology to be used to display an arrow in the middle +// : of an edge showing its orientation. (For simulation and Viewer OCC only) +//================================================================================= +bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) +{ + if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE) + return false; + + OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort(); + Handle( V3d_View) view3d = vp3d->getView(); + Standard_Real Width, Height; + view3d->Size(Width, Height); + const Standard_Real aHeight = (Width + Height) / 50.0; + + try { + Standard_Real first, last; + Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); + if(!curv->IsCN(1)) + return false; + + const Standard_Real param = (first+last) / 2.0; + gp_Pnt middleParamPoint; + gp_Vec V1; + curv->D1( param, middleParamPoint, V1); + if(V1.Magnitude() < Precision::Confusion()) + return false; + + /* Topology orientation not geom orientation */ + if(tds.Orientation() == TopAbs_REVERSED) + V1 *= -1.0; + + gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); + const Standard_Real radius1 = aHeight / 5.0; + if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { + ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); + return true; + } + } + catch(Standard_Failure) { + // OCC failures are hard to catch in GUI. + // This because of the position for #include that is very critic to find + // in SALOME environment : compilation error ! + } + return false; +} + + +//================================================================================= +// function : VertexToPoint() +// purpose : If S can be converted in a gp_Pnt returns true and the result is P +//================================================================================= +bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) +{ + if(S.IsNull() || S.ShapeType() != TopAbs_VERTEX) + return false; + P = BRep_Tool::Pnt(TopoDS::Vertex(S)); + return true; +} + + +//================================================================================= +// function : GetBipointDxDyDz() +// purpose : +//================================================================================= +void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) +{ + dx = P2.X() - P1.X(); + dy = P2.Y() - P1.Y(); + dz = P2.Z() - P1.Z(); + return; +} + + +//================================================================================= +// function : LinearEdgeExtremities() +// purpose : If S can be converted in a linear edge and if initial an final points +// : distance is sufficient, returns true else returns false. +// : Resulting points are respectively P1 and P2 +//================================================================================= +bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) +{ + if(S.IsNull() || S.ShapeType() != TopAbs_EDGE) + return false; + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + if(curv.GetType() != GeomAbs_Line) + return false; + + curv.D0(curv.FirstParameter(), P1); + curv.D0(curv.LastParameter(), P2); + + if(P1.Distance(P2) <= Precision::Confusion()) + return false; + + return true; +} + + +//======================================================================= +// function : Parameter() +// purpose : return a parameter (float) from a dialog box +// +// avalue1 : is a float or integer used as a default value displayed +// aTitle1 : is the title for aValue1 +// aTitle : is the main title +// bottom : maximum value to be entered +// top : minimum value to be entered +// decimals : number of decimals +//======================================================================= +double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals) +{ + GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(), + aTitle, TRUE, 0, bottom, top, decimals); + int r = Dialog->exec(); + float X = 0.0; + if(r == QDialog::Accepted) { + res = Standard_True; + X = Dialog->getValue(); + } + else + res = Standard_False; + delete Dialog; + return X; +} + + +//======================================================================= +// function : SelectionByNameInDialogs() +// purpose : Called when user has entered a name of object in a LineEdit. +// : The selection is changed. Dialog box will receive the +// : corresponding signal to manage this event. +//======================================================================= +bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList) +{ + /* Find SObject with name in component GEOM */ + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) ST = appStudy->studyDS(); + + std::vector<_PTR(SObject)> listSO; + listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM"); + + if(listSO.size() < 1) { + const QString caption = QObject::tr("GEOM_WRN_WARNING"); + const QString text = QObject::tr("GEOM_NAME_INCORRECT"); + const QString button0 = QObject::tr("GEOM_BUT_OK"); + SUIT_MessageBox::error1(aWidget, caption, text, button0); + return false; + } + /* More than one object with same name */ + if(listSO.size() > 1) { + const QString caption = QObject::tr("GEOM_WRN_WARNING"); + const QString text = QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); + const QString button0 = QObject::tr("GEOM_BUT_OK") ; + SUIT_MessageBox::error1(aWidget, caption, text, button0) ; + listSO.clear(); + return false; + } + + _PTR(SObject) theObj ( listSO[0] ); + /* Create a SALOME_InteractiveObject with a SALOME::SObject */ + char* aCopyobjectUserName = CORBA::string_dup(objectUserName); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName); + delete(aCopyobjectUserName); + + /* Add as a selected object */ + /* Clear any previous selection : */ + /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ + // Sel->ClearIObjects(); //mzn + // Sel->AddIObject(SI); //mzn + return true; +} + + +//======================================================================= +// function : DefineDlgPosition() +// purpose : Define x and y the default position for a dialog box +//======================================================================= +bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) +{ + /* Here the position is on the bottom right corner - 10 */ + SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop(); + x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); + y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); + return true; +} + + +//======================================================================= +// function : GetDefaultName() +// purpose : Generates default names +//======================================================================= +QString GEOMBase::GetDefaultName(const QString& theOperation) +{ + QString aName = ""; + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return aName; + _PTR(Study) aStudy = appStudy->studyDS(); + + int aNumber = 0; + _PTR(SObject) obj; + do + { + aName = theOperation+"_"+QString::number(++aNumber); + obj = aStudy->FindObject(aName.latin1()); + } + while (obj); + + return aName; +} + + +//======================================================================= +// function : ShowErrorMessage() +// purpose : Shows message box with error code and comment +//======================================================================= +void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment) +{ + QString anErrorCode(theErrorCode); + QString aComment(theComment); + + QString aText = ""; + if (!anErrorCode.isEmpty()) + aText.append("\n" + QObject::tr(anErrorCode)); + if (!aComment.isEmpty()) + aText.append("\n" + QString(theComment)); + + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); +} + + +//======================================================================= +// function : GetObjectFromIOR() +// purpose : returns a GEOM_Object by given IOR (string) +//======================================================================= +GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const char* theIOR ) +{ + GEOM::GEOM_Object_var anObject; + if ( theIOR == NULL || strlen( theIOR ) == 0 ) + return anObject._retn(); // returning nil object + + anObject = GEOM::GEOM_Object::_narrow( SalomeApp_Application::orb()->string_to_object( theIOR ) ); + return anObject._retn(); +} + +//======================================================================= +// function : GetIORFromObject() +// purpose : returns IOR of a given GEOM_Object +//======================================================================= +char* GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) +{ + if ( CORBA::is_nil( theObject ) ) + return NULL; + + return SalomeApp_Application::orb()->object_to_string( theObject ); +} + +//======================================================================= +// function : GetShape() +// purpose : returns a TopoDS_Shape stored in GEOM_Object +//======================================================================= +bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType ) +{ + if ( !CORBA::is_nil( theObject ) ) + { + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObject ); + if ( !aTopoDSShape.IsNull() && ( theType == TopAbs_SHAPE || theType == aTopoDSShape.ShapeType() ) ) + { + theShape = aTopoDSShape; + return true; + } + } + return false; +} + +//======================================================================= +// function : GetName() +// purpose : Get name of object +//======================================================================= +QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) +{ + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + + if ( appStudy ) + { + string anIOR = SalomeApp_Application::orb()->object_to_string( theObj ); + if ( anIOR != "" ) + { + _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) ); + + _PTR(GenericAttribute) anAttr; + + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) + { + _PTR(AttributeName) aNameAttr ( anAttr ); + return QString( aNameAttr->Value().c_str() ); + } + } + } + + return QString(""); +} + +bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj ) +{ + return !theObj->_is_nil() && theObj->IsShape(); +} diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx new file mode 100755 index 000000000..f48979a4e --- /dev/null +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -0,0 +1,974 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_Helper.cxx +// Author : Sergey ANIKIN +// Module : GEOM +// $Header$ + +#include + +#include "GEOMBase_Helper.h" +#include "GEOMBase.h" +#include "GEOM_Operation.h" +#include "GeometryGUI.h" +#include "GEOM_Displayer.h" +#include "GEOMImpl_Types.hxx" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +using namespace std; + +#include + + +//================================================================ +// Function : getActiveView +// Purpose : Get active view window, returns 0 if no open study frame +//================================================================ +static SUIT_ViewWindow* getActiveView() +{ + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if ( activeStudy ) + return SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + return 0; +} + + +//================================================================ +// Function : getGeomEngine +// Purpose : Static method +//================================================================ +GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine() +{ + return GeometryGUI::GetGeomGen(); +} + +//================================================================ +// Function : GEOMBase_Helper +// Purpose : +//================================================================ +GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) + : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) +{ +} + +//================================================================ +// Function : ~GEOMBase_Helper +// Purpose : +//================================================================ +GEOMBase_Helper::~GEOMBase_Helper() +{ + if ( !SUIT_Session::session()->activeApplication()->desktop() ) + return; + + if ( myPreview.size() ) + erasePreview(); + if ( hasCommand() ) + abortCommand(); + + globalSelection( GEOM_ALLOBJECTS, true ); + + delete myDisplayer; +} + +//================================================================ +// Function : display +// Purpose : +//================================================================ +void GEOMBase_Helper::display( const ObjectList& objList, const bool updateView ) +{ + ObjectList::const_iterator it; + for ( it = objList.begin(); it != objList.end(); it++ ) { + display( *it, false ); + } + if ( !objList.empty() && updateView ) + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : display +// Purpose : Display object. +// Important : Object must be already in study +//================================================================ +void GEOMBase_Helper::display( GEOM::GEOM_Object_ptr object, const bool updateView ) +{ + // Unset color of shape ( this color may be set during preview displaying ) + // Default color will be used + getDisplayer()->UnsetColor(); + getDisplayer()->UnsetWidth(); + + // Enable activisation of selection + getDisplayer()->SetToActivate( true ); + + // Display object + getDisplayer()->Display( object, updateView ); +} + +//================================================================ +// Function : erase +// Purpose : +//================================================================ +void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView ) +{ + ObjectList::const_iterator it = objList.begin(); + for ( ; it != objList.end(); it++ ) { + erase( *it, false ); + } + if ( !objList.empty() && updateView ) + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : erase +// Purpose : +//================================================================ +void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView ) +{ + if ( !object->_is_nil() ) { + string entry = getEntry( object ); + getDisplayer()->Erase( new SALOME_InteractiveObject( + entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ) ) ), true, updateView ); + } +} + +//================================================================ +// Function : redisplay +// Purpose : +//================================================================ +void GEOMBase_Helper::redisplay( const ObjectList& objList, + const bool withChildren, + const bool updateView ) +{ + ObjectList::const_iterator it = objList.begin(); + for ( ; it != objList.end(); it++ ) { + redisplay( *it, withChildren, false ); + } + if ( !objList.empty() && updateView ) + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : redisplay +// Purpose : +//================================================================ +void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, + const bool withChildren, + const bool updateView ) +{ + if ( !object->_is_nil() ) { + // Unset color of shape ( this color may be set during preview displaying ) + // Default color will be used + getDisplayer()->UnsetColor(); + getDisplayer()->UnsetWidth(); + + // Enable activisation of selection + getDisplayer()->SetToActivate( true ); + + string entry = getEntry( object ); + getDisplayer()->Redisplay(new SALOME_InteractiveObject + (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object))), false); + } + + if ( withChildren ) { + SalomeApp_Study* aDoc = getStudy(); + if ( aDoc && aDoc->studyDS() ) { + _PTR(Study) aStudy = aDoc->studyDS(); + _PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object))); + if ( aSObj ) { + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); + for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow + (GeometryGUI::ClientSObjectToObject(anIt->Value())); + if ( !CORBA::is_nil( aChild ) ) { + if ( !aChild->_is_nil() ) { + string entry = getEntry( aChild ); + getDisplayer()->Redisplay( new SALOME_InteractiveObject( + entry.c_str(), "GEOM", strdup( GEOMBase::GetName( aChild ) ) ), false ); + } + } + } + } + } + } + + if ( updateView ) + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : displayPreview +// Purpose : Method for displaying preview based on execute() results +//================================================================ +void GEOMBase_Helper::displayPreview( const bool activate, + const bool update, + const bool toRemoveFromEngine, + const double lineWidth ) +{ + isPreview = true; + QString msg; + if ( !isValid( msg ) ) + { + erasePreview( update ); + isPreview = false; + return; + } + + erasePreview( false ); + + try { + SUIT_OverrideCursor wc; + ObjectList objects; + if ( !execute( objects ) || !getOperation()->IsDone() ) { + wc.suspend(); + } + else { + for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) + { + displayPreview( *it, true, activate, false, lineWidth ); + if ( toRemoveFromEngine ) + getGeomEngine()->RemoveObject( *it ); + } + } + } + catch( const SALOME::SALOME_Exception& e ) { + SalomeApp_Tools::QtCatchCorbaException( e ); + } + + isPreview = false; + + if ( update ) + updateViewer(); +} + +//================================================================ +// Function : displayPreview +// Purpose : Method for displaying preview of resulting shape +//================================================================ +void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, + const bool append, + const bool activate, + const bool update, + const double lineWidth ) +{ + // Set color for preview shape + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + + // set width of displayed shape + getDisplayer()->SetWidth( lineWidth ); + + // Disable activation of selection + getDisplayer()->SetToActivate( activate ); + + // Make a reference to GEOM_Object + getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) ); + + // Build prs + SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object ); + if ( aPrs == 0 || aPrs->IsNull() ) + return; + + // Display prs + displayPreview( aPrs, append, update ); + + getDisplayer()->UnsetName(); + + // Enable activation of displayed objects + getDisplayer()->SetToActivate( true ); +} + +//================================================================ +// Function : displayPreview +// Purpose : Method for displaying arbitrary preview objects (not limited to shapes) +//================================================================ +void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs, + const bool append, + const bool update ) +{ + if ( !append ) + erasePreview( false ); + + // remember current view frame to make correct erase preview later + myViewWindow = getActiveView(); + + if ( myViewWindow == 0 ) + return; + + // Display prs + SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() || + aViewManager->getType() == SVTK_Viewer::Type() ) + { + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView) + aView->Display( prs ); + } + + // Add prs to the preview list + myPreview.push_back( (SALOME_Prs*)prs ); + + // Update viewer + if ( update ) + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : erasePreview +// Purpose : +//================================================================ +void GEOMBase_Helper::erasePreview( const bool update ) +{ + // check view frame where the preview was displayed + bool vfOK = checkViewWindow() && myViewWindow; + // Iterate through presentations and delete them + for ( PrsList::iterator anIter = myPreview.begin(); anIter != myPreview.end(); ++anIter ) { + if ( vfOK ) + { + SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() || + aViewManager->getType() == SVTK_Viewer::Type() ) + { + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView) + aView->Erase( *anIter, true ); + } + } + delete *anIter; + } + myPreview.clear(); + + // Update viewer + if ( update ) + updateViewer(); +} + +//================================================================ +// Function : localSelection +// Purpose : Activate selection of objects of a given type +// IMPORTANT : Works after localSelection( ... ) method call only +//================================================================ +void GEOMBase_Helper::activate( const int theType ) +{ + if (!getStudy()) return; + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SComponent) aGeom ( aStudy->FindComponent( "GEOM" ) ); + if ( !aGeom ) + return; + + SALOME_ListIO aList; + _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( aGeom ) ); + for ( ; anIter->More(); anIter->Next() ) + { + _PTR(SObject) aSO ( anIter->Value() ); + if ( aSO ) + { + _PTR(SObject) aRefSO; + if ( !aSO->ReferencedObject( aRefSO ) ) + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow + (GeometryGUI::ClientSObjectToObject(aSO)); + if ( !anObj->_is_nil() && anObj->GetType() == theType ) + aList.Append( new SALOME_InteractiveObject( aSO->GetID().c_str(), "GEOM", aSO->GetName().c_str()) ); + } + } + } + + getDisplayer()->LocalSelection( aList, 0 ); +} + +//================================================================ +// Function : localSelection +// Purpose : Activate selection of subshapes in accordance with mode +// theMode is from TopAbs_ShapeEnum +//================================================================ +void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode ) +{ + SALOME_ListIO aListOfIO; + + ObjectList::const_iterator anIter = theObjs.begin(); + for ( ; anIter != theObjs.end(); ++anIter ) + { + GEOM::GEOM_Object_ptr anObj = *anIter; + if ( anObj->_is_nil() ) + continue; + string aEntry = getEntry( anObj ); + if ( aEntry != "" ) + aListOfIO.Append( new SALOME_InteractiveObject( + aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ) ) ) ); + } + + getDisplayer()->LocalSelection( aListOfIO, theMode ); +} + +//================================================================ +// Function : localSelection +// Purpose : Activate selection of subshapes in accordance with mode +// theMode is from TopAbs_ShapeEnum +//================================================================ +void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode ) +{ + // If object is null local selection for all objects is activated + if ( obj->_is_nil() ) { + getDisplayer()->LocalSelection( Handle(SALOME_InteractiveObject)(), mode ); + return; + } + + ObjectList objList; + objList.push_back( obj ); + localSelection( objList, mode ); +} + + +//================================================================ +// Function : globalSelection +// Purpose : Activate selection of subshapes. Set selection filters +// in accordance with mode. theMode is from GEOMImpl_Types +//================================================================ +void GEOMBase_Helper::globalSelection( const int theMode, const bool update ) +{ + getDisplayer()->GlobalSelection( theMode, update ); +} + +//================================================================ +// Function : globalSelection +// Purpose : Activate selection of subshapes. Set selection filters +// in accordance with mode. theMode is from GEOMImpl_Types +//================================================================ +void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes, + const bool update ) +{ + getDisplayer()->GlobalSelection( theModes, update ); +} + +//================================================================ +// Function : addInStudy +// Purpose : Add object in study +//================================================================ +void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theName ) +{ + if ( !hasCommand() ) + return; + + _PTR(Study) aStudy = getStudy()->studyDS(); + if ( !aStudy || theObj->_is_nil() ) + return; + + GEOM::GEOM_Object_ptr aFatherObj = getFather( theObj ); + + getGeomEngine()->AddInStudy(GeometryGUI::ClientStudyToStudy(aStudy), + theObj, theName, aFatherObj); +} + +//================================================================ +// Function : updateObjBrowser +// Purpose : Update object browser +//================================================================ +void GEOMBase_Helper::updateObjBrowser() const +{ + SalomeApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); + if (app) { + CAM_Module* module = app->module( "Geometry" ); + SalomeApp_Module* appMod = dynamic_cast( module ); + if ( appMod ) { + appMod->updateObjBrowser( true ); + } + } +} + +//================================================================ +// Function : updateViewer +// Purpose : Update active 3D view +//================================================================ +void GEOMBase_Helper::updateViewer() +{ + getDisplayer()->UpdateViewer(); +} + +//================================================================ +// Function : getStudyId +// Purpose : Get study Id +//================================================================ +int GEOMBase_Helper::getStudyId() const +{ + int anId = -1; + if ( getStudy() ) + anId = getStudy()->id(); + return anId; +} + +//================================================================ +// Function : getStudy +// Purpose : Returns the active study. It is recommended to use +// this method instead of direct desktop->getActiveStudy() calls +//================================================================ +SalomeApp_Study* GEOMBase_Helper::getStudy() const +{ + SUIT_Desktop* aDesktop = getDesktop(); + if (!aDesktop) + return 0; + + QPtrList anAppList = SUIT_Session::session()->applications(); + + SUIT_Application* anApp = 0; + for ( QPtrListIterator it( anAppList ); it.current() ; ++it ) + { + anApp = it.current(); + if ( anApp->desktop() == aDesktop ) + break; + } + + return dynamic_cast(anApp->activeStudy()); +} + +//================================================================ +// Function : getEntry +// Purpose : +//================================================================ +char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const +{ + SalomeApp_Study* study = getStudy(); + if ( study ) { + string IOR = GEOMBase::GetIORFromObject( object); + if ( IOR != "" ) { + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) { + return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString(); + } + } + } + return ""; +} + +//================================================================ +// Function : getDisplayer +// Purpose : +//================================================================ +GEOM_Displayer* GEOMBase_Helper::getDisplayer() +{ + if ( !myDisplayer ) + myDisplayer = new GEOM_Displayer( getStudy() ); + return myDisplayer; +} + +//================================================================ +// Function : clearShapeBuffer +// Purpose : +//================================================================ +void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) +{ + if ( CORBA::is_nil( theObj ) ) + return; + + string IOR = SalomeApp_Application::orb()->object_to_string( theObj ); + TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) ); + GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); + + if ( !getStudy() || !getStudy()->studyDS() ) + return; + + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !aSObj ) + return; + + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); + for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + _PTR(GenericAttribute) anAttr; + if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { + _PTR(AttributeIOR) anIOR ( anAttr ); + TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); + GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); + } + } +} + +//================================================================ +// Function : openCommand +// Purpose : +//================================================================ +bool GEOMBase_Helper::openCommand() +{ + bool res = false; + if ( !getStudy() || hasCommand() ) + return res; + + GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() ); + if ( !anOp->_is_nil() ) { + myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() ); + myCommand->start(); + res = true; + } + + return res; +} + +//================================================================ +// Function : abortCommand +// Purpose : +//================================================================ +bool GEOMBase_Helper::abortCommand() +{ + if ( !hasCommand() ) + return false; + + myCommand->abort(); + myCommand = 0; + + return true; +} + +//================================================================ +// Function : commitCommand +// Purpose : +//================================================================ +bool GEOMBase_Helper::commitCommand( const char* ) +{ + if ( !hasCommand() ) + return false; + + myCommand->commit(); + myCommand = 0; + + return true; +} + +//================================================================ +// Function : hasCommand +// Purpose : +//================================================================ +bool GEOMBase_Helper::hasCommand() const +{ + return (bool)myCommand; +} + +//================================================================ +// Function : getOperation +// Purpose : +//================================================================ +GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation() +{ + if ( myOperation->_is_nil() ) + myOperation = createOperation(); + + return myOperation; +} + + + +//================================================================ +// Function : checkViewWindow +// Purpose : +//================================================================ +bool GEOMBase_Helper::checkViewWindow() +{ + if ( myViewWindow ){ + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) + { + if ( myViewWindow == it.current() ) + return true; + } + } + myViewWindow = 0; + return false; +} + +//================================================================ +// Function : onAccept +// Purpose : This method should be called from dialog's slots onOk() and onApply() +// It perfroms user input validation, then it +// performs a proper operation and manages transactions, etc. +//================================================================ +bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) +{ + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); + if ( aLocked ) { + MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); + SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + return false; + } + + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return false; + } + + erasePreview( false ); + + try { + if ( ( !publish && !useTransaction ) || openCommand() ) { + SUIT_OverrideCursor wc; + SUIT_Session::session()->activeApplication()->putInfo( "" ); + ObjectList objects; + if ( !execute( objects ) || !getOperation()->IsDone() ) { + wc.suspend(); + abortCommand(); + showError(); + } + else { + const int nbObjs = objects.size(); + bool withChildren = false; + for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { + if ( publish ) { + QString aName(""); + if ( nbObjs > 1 ) + aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) ); + else { + aName = getNewObjectName(); + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if ( aName.isEmpty() ) + aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); + } + addInStudy( *it, aName.latin1() ); + withChildren = false; + display( *it, false ); + } + else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client + // before redisplay + clearShapeBuffer( *it ); + withChildren = true; + redisplay( *it, withChildren, false ); + } + } + + if ( nbObjs ) { + commitCommand(); + updateObjBrowser(); + SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + } + else + abortCommand(); + } + } + } + catch( const SALOME::SALOME_Exception& e ) { + SalomeApp_Tools::QtCatchCorbaException( e ); + abortCommand(); + } + + updateViewer(); + + return true; +} + + +//================================================================ +// Function : showError +// Purpose : Shows a message box with infromation about an error taken from getOperation()->GetErrorCode() +//================================================================ +void GEOMBase_Helper::showError() +{ + QString msg; + if ( !getOperation()->_is_nil() ) + msg = QObject::tr( getOperation()->GetErrorCode() ); + + if ( msg.isEmpty() ) + msg = QObject::tr( "GEOM_PRP_ABORT" ); + + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr( "GEOM_ERROR_STATUS" ), + msg, + QObject::tr( "BUT_OK" ) ); +} + +//================================================================ +// Function : showError +// Purpose : Shows a error message followed by +//================================================================ +void GEOMBase_Helper::showError( const QString& msg ) +{ + QString str( QObject::tr( "GEOM_INCORRECT_INPUT" ) ); + if ( !msg.isEmpty() ) + str += "\n" + msg; + SUIT_MessageBox::error1(SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), str, QObject::tr( "BUT_OK" ) ); +} + +////////////////////////////////////////////////////////////////// +// Virtual methods to be redefined in dialogs +////////////////////////////////////////////////////////////////// + +//================================================================ +// Function : createOperation +// Purpose : Redefine this method to return proper IOperation reference +//================================================================ +GEOM::GEOM_IOperations_ptr GEOMBase_Helper::createOperation() +{ + GEOM::GEOM_IOperations_var aNilOp; + return aNilOp._retn(); +} + +//================================================================ +// Function : isValid +// Purpose : Called by onAccept(). Redefine this method to check validity of user input in dialog boxes. +//================================================================ +bool GEOMBase_Helper::isValid( QString& ) +{ + return true; +} + +//================================================================ +// Function : execute +// Purpose : This method is called by onAccept(). +// It should perform the required operation and put all new or modified objects into +// argument.Should return if some error occurs during its execution. +//================================================================ +bool GEOMBase_Helper::execute( ObjectList& objects ) +{ + return false; +} + +//================================================================ +// Function : getFather +// Purpose : This method is called by addInStudy(). It should return a father object +// for or a nil reference if should be published +// as a top-level object. +//================================================================ +GEOM::GEOM_Object_ptr GEOMBase_Helper::getFather( GEOM::GEOM_Object_ptr theObj ) +{ + return GEOM::GEOM_Object::_nil(); +} + +//================================================================ +// Function : getNewObjectName +// Purpose : Redefine this method to return proper name for a new object +//================================================================ +const char* GEOMBase_Helper::getNewObjectName() const +{ + return ""; +} + +//================================================================ +// Function : getPrefix +// Purpose : Get prefix for name of created object +//================================================================ +QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const +{ + if ( !myPrefix.isEmpty() || theObj->_is_nil() ) + return myPrefix; + + TopoDS_Shape aShape; + if ( !GEOMBase::GetShape( theObj, aShape ) ) + return ""; + + long aType = aShape.ShapeType(); + + switch ( aType ) + { + case TopAbs_VERTEX : return QObject::tr( "GEOM_VERTEX" ); + case TopAbs_EDGE : return QObject::tr( "GEOM_EDGE" ); + case TopAbs_WIRE : return QObject::tr( "GEOM_WIRE" ); + case TopAbs_FACE : return QObject::tr( "GEOM_FACE" ); + case TopAbs_SHELL : return QObject::tr( "GEOM_SHELL" ); + case TopAbs_SOLID : return QObject::tr( "GEOM_SOLID" ); + case TopAbs_COMPSOLID: return QObject::tr( "GEOM_COMPOUNDSOLID" ); + case TopAbs_COMPOUND : return QObject::tr( "GEOM_COMPOUND" ); + default : return ""; + } +} + +//================================================================ +// Function : selectedIO +// Purpose : Return the list of selected SALOME_InteractiveObject's +//================================================================ +const SALOME_ListIO& GEOMBase_Helper::selectedIO() +{ + mySelected.Clear(); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) + aSelMgr->selectedObjects( mySelected ); + } + + return mySelected; +} + +//================================================================ +// Function : IObjectCount +// Purpose : Return the number of selected objects +//================================================================ +int GEOMBase_Helper::IObjectCount() +{ + return selectedIO().Extent(); +} + +//================================================================ +// Function : firstIObject +// Purpose : Return the first selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) GEOMBase_Helper::firstIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Function : lastIObject +// Purpose : Return the last selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) GEOMBase_Helper::lastIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Function : getDesktop +// Purpose : Returns myDesktop field. Initialized in constructor, usually as dynamic_cast(parentWidget()) +//================================================================ +SUIT_Desktop* GEOMBase_Helper::getDesktop() const +{ + return myDesktop; +} + diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx new file mode 100644 index 000000000..84760134d --- /dev/null +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -0,0 +1,219 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_Skeleton.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "GEOMBase_Skeleton.h" +#include "GeometryGUI.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +using namespace std; + +//================================================================================= +// class : GEOMBase_Skeleton() +// purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, bool modal, WFlags fl) + :DlgRef_Skeleton_QTD( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ) +{ + if (!name) + setName("GEOMBase_Skeleton"); + + buttonCancel->setText(tr("GEOM_BUT_CLOSE")); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonApply->setText(tr("GEOM_BUT_APPLY")); + + GroupMedium->close(TRUE); + resize(0, 0); + + Init(); +} + + +//================================================================================= +// function : ~GEOMBase_Skeleton() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMBase_Skeleton::~GEOMBase_Skeleton() +{ + if (myGeomGUI) + myGeomGUI->SetActiveDialogBox( 0 ); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::Init() +{ + myGeomGUI = 0; + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + { + SalomeApp_Module* module = dynamic_cast(app->loadModule("Geometry")); + if (module) + myGeomGUI = dynamic_cast(module); + } + + /* init variables */ + myGeomBase = new GEOMBase(); // SAN -- TO BE REMOVED !!! + myGeomGUI->SetActiveDialogBox(this); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + if (myGeomGUI) + { + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + } + + /* Move widget on the botton right corner of main widget */ +// int x, y; +// myGeomBase->DefineDlgPosition( this, x, y ); + + /* displays Dialog */ + RadioButton1->setChecked(TRUE); + RadioButton4->hide(); + + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::ClickOnCancel() +{ + close(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::LineEditReturnPressed() +{ + if ( !myEditCurrentArgument ) + return; + + /* User name of object input management */ + /* If successfull the selection is changed and signal emitted... */ + /* so SelectionIntoArgument() is automatically called. */ + const QString objectUserName = myEditCurrentArgument->text(); + QWidget* thisWidget = (QWidget*)this; + + if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO())) + myEditCurrentArgument->setText(objectUserName); + + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::DeactivateActiveDialog() +{ + this->setEnabled(false); + globalSelection(); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + if (myGeomGUI) myGeomGUI->SetActiveDialogBox(0); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + if (myGeomGUI) myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled(true); + if (myGeomGUI) myGeomGUI->SetActiveDialogBox((QDialog*)this); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : same than click on cancel button +//================================================================================= +void GEOMBase_Skeleton::closeEvent(QCloseEvent* e) +{ + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if(app) { + disconnect( app->selectionMgr(), 0, this, 0); + app->updateActions(); + } + QDialog::closeEvent( e ); +} + +//================================================================================= +// function : initName() +// purpose : initialize the Name field with a string "thePrefix_X" (Vertex_3) +//================================================================================= +void GEOMBase_Skeleton::initName( const char* thePrefix ) +{ + if ( thePrefix ) + setPrefix( thePrefix ); + ResultName->setText( GEOMBase::GetDefaultName( getPrefix() ) ); +} + +//================================================================================= +// function : getNewObjectName() +// purpose : returns contents of Name field +//================================================================================= +const char* GEOMBase_Skeleton::getNewObjectName() const +{ + return ResultName->text(); +} + +//================================================================================= +// function : getConstructorId() +// purpose : +//================================================================================= +int GEOMBase_Skeleton::getConstructorId() const +{ + if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL ) + return GroupConstructors->id( GroupConstructors->selected() ); + return -1; +} diff --git a/src/GEOMBase/Makefile.in b/src/GEOMBase/Makefile.in new file mode 100644 index 000000000..260845ed6 --- /dev/null +++ b/src/GEOMBase/Makefile.in @@ -0,0 +1,71 @@ +# GEOM GEOMBASE : +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libGEOMBase.la + +# header files +EXPORT_HEADERS= GEOMBase.h \ + GEOMBase_Skeleton.h \ + GEOMBase_Helper.h \ + GEOM_Operation.h + +LIB_SRC = GEOMBase.cxx \ + GEOMBase_Skeleton.cxx \ + GEOMBase_aParameterDlg.cxx \ + GEOMBase_Helper.cxx \ + GEOM_Operation.cxx + +LIB_MOC = \ + GEOMBase_Skeleton.h \ + GEOMBase_aParameterDlg.h + +LIB_CLIENT_IDL = SALOME_Exception.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_GenericObj.idl \ + GEOM_Gen.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome + +LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome -lDlgRef -lGEOM -lsuit -lOCCViewer -lVTKViewer $(CAS_LDPATH) -lTKPrim + +@CONCLUDE@ diff --git a/src/GEOMClient/Makefile.in b/src/GEOMClient/Makefile.in new file mode 100644 index 000000000..eb7281a67 --- /dev/null +++ b/src/GEOMClient/Makefile.in @@ -0,0 +1,62 @@ +# GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Patrick GOLDBRONN (CEA) +# Module : GEOM +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS = \ + GEOM_Client.hxx + +# Libraries targets + +LIB = libGEOMClient.la +LIB_SRC = GEOM_Client.cxx +LIB_SERVER_IDL = \ + SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl SALOME_GenericObj.idl \ + GEOM_Gen.idl + +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(CAS_TKTopAlgo) -L${KERNEL_ROOT_DIR}/lib/salome + + +@CONCLUDE@ + diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx new file mode 100644 index 000000000..2dc864ac5 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_EdgeFilter.h" + +#include +#include +#include +#include + +//======================================================================= +// function : GEOM_EdgeFilter +// purpose : +//======================================================================= +GEOM_EdgeFilter::GEOM_EdgeFilter( SalomeApp_Study* study, const int kind ) +: GEOM_SelectionFilter( study ), +myKind( kind ) +{ + add( TopAbs_EDGE ); +} + +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_EdgeFilter::~GEOM_EdgeFilter() +{ +} + +//======================================================================= +// function : isShapeOk +// purpose : +//======================================================================= +bool GEOM_EdgeFilter::isShapeOk( const TopoDS_Shape& theShape ) const +{ + if ( !theShape.IsNull() && theShape.ShapeType() == TopAbs_EDGE ) + { + BRepAdaptor_Curve aCurve( TopoDS::Edge( theShape ) ); + GeomAbs_CurveType aType = aCurve.GetType(); + + switch ( myKind ) + { + case StdSelect_AnyEdge: return Standard_True; + case StdSelect_Line: return ( aType == GeomAbs_Line ); + case StdSelect_Circle: return ( aType == GeomAbs_Circle ); + } + } + return false; +} + diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.h b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h new file mode 100644 index 000000000..e59406349 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.h @@ -0,0 +1,39 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_EDGEFILTER_H +#define GEOM_EDGEFILTER_H + +#include "GEOM_SelectionFilter.h" + +class Standard_EXPORT GEOM_EdgeFilter : public GEOM_SelectionFilter +{ +public: + GEOM_EdgeFilter( SalomeApp_Study* study, const int kind ); + ~GEOM_EdgeFilter(); + +protected: + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + int myKind; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx new file mode 100644 index 000000000..5d4ddb468 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_FaceFilter.h" + +#include +#include +#include +#include + +//======================================================================= +// function : GEOM_FaceFilter +// purpose : +//======================================================================= +GEOM_FaceFilter::GEOM_FaceFilter( SalomeApp_Study* study, const int kind ) +: GEOM_SelectionFilter( study ), +myKind( kind ) +{ + add( TopAbs_FACE ); +} + +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_FaceFilter::~GEOM_FaceFilter() +{ +} + +//======================================================================= +// function : isShapeOk +// purpose : +//======================================================================= +bool GEOM_FaceFilter::isShapeOk( const TopoDS_Shape& theShape ) const +{ + if ( !theShape.IsNull() && theShape.ShapeType() == TopAbs_FACE ) + { + BRepAdaptor_Surface aSurf( TopoDS::Face( theShape ) ); + GeomAbs_SurfaceType aType = aSurf.GetType(); + + switch ( myKind ) + { + case StdSelect_AnyFace: return Standard_True; + case StdSelect_Plane: return ( aType == GeomAbs_Plane ); + case StdSelect_Cylinder: return ( aType == GeomAbs_Cylinder); + case StdSelect_Sphere: return ( aType == GeomAbs_Sphere); + case StdSelect_Torus: return ( aType == GeomAbs_Torus); + case StdSelect_Revol: return ( aType == GeomAbs_Cylinder || + aType == GeomAbs_Cone || + aType == GeomAbs_Torus || + aType == GeomAbs_Sphere || + aType == GeomAbs_SurfaceOfRevolution ); + case StdSelect_Cone: return ( aType == GeomAbs_Cone); + } + } + return false; +} + diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.h b/src/GEOMFiltersSelection/GEOM_FaceFilter.h new file mode 100644 index 000000000..affe68a3a --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.h @@ -0,0 +1,39 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_FACEFILTER_H +#define GEOM_FACEFILTER_H + +#include "GEOM_SelectionFilter.h" + +class Standard_EXPORT GEOM_FaceFilter : public GEOM_SelectionFilter +{ +public: + GEOM_FaceFilter( SalomeApp_Study* study, const int kind ); + ~GEOM_FaceFilter(); + +protected: + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + int myKind; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx new file mode 100644 index 000000000..d9045576b --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx @@ -0,0 +1,95 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_LogicalFilter.h" + +//======================================================================= +// function : GEOM_LogicalFilter +// purpose : +//======================================================================= +GEOM_LogicalFilter::GEOM_LogicalFilter( const QPtrList& lst, const int op ) +: SUIT_SelectionFilter() +{ + setFilters( lst ); + setOperation( op ); +} + +//======================================================================= +// function : ~GEOM_LogicalFilter +// purpose : +//======================================================================= +GEOM_LogicalFilter::~GEOM_LogicalFilter() +{ +} + +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_LogicalFilter::isOk( const SUIT_DataOwner* owner ) const +{ + GEOM_LogicalFilter* non_const_this = (GEOM_LogicalFilter*)this; + for ( SUIT_SelectionFilter* filter = non_const_this->myFilters.first(); filter; filter = non_const_this->myFilters.next() ) + { + if ( myOperation == LO_OR && filter->isOk( owner ) ) + return true; + if ( myOperation == LO_AND && !filter->isOk( owner ) ) + return false; + if ( myOperation == LO_NOT ) + return !filter->isOk( owner ); + } + + return ( myOperation != LO_OR ); +} + +//======================================================================= +// function : setFilters +// purpose : +//======================================================================= +void GEOM_LogicalFilter::setFilters( const QPtrList& lst ) +{ + myFilters = lst; +} + +//======================================================================= +// function : setOperation +// purpose : +//======================================================================= +void GEOM_LogicalFilter::setOperation( const int op ) +{ + myOperation = op; +} + +//======================================================================= +// function : getFilters +// purpose : +//======================================================================= +QPtrList GEOM_LogicalFilter::getFilters() const +{ + return myFilters; +} + +//======================================================================= +// function : getOperation +// purpose : +//======================================================================= +int GEOM_LogicalFilter::getOperation() const +{ + return myOperation; +} diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.h b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h new file mode 100644 index 000000000..3b23884f7 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.h @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_LOGICALFILTER_H +#define GEOM_LOGICALFILTER_H + +#include +#include + +#include + +class Standard_EXPORT GEOM_LogicalFilter : public SUIT_SelectionFilter +{ +public: + enum { LO_OR, LO_AND, LO_NOT, LO_UNDEFINED }; + +public: + GEOM_LogicalFilter( const QPtrList& lst, const int op ); + ~GEOM_LogicalFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + + void setFilters( const QPtrList& lst ); + void setOperation( const int ); + QPtrList getFilters() const; + int getOperation() const; + +private: + QPtrList myFilters; + int myOperation; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx new file mode 100644 index 000000000..5599a1524 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_OCCFilter.h" + +#include +#include + +#include + +#include +#include + +IMPLEMENT_STANDARD_HANDLE(GEOM_OCCFilter, SelectMgr_Filter) +IMPLEMENT_STANDARD_RTTIEXT(GEOM_OCCFilter, SelectMgr_Filter) + +//======================================================================= +// function : GEOM_OCCFilter +// purpose : +//======================================================================= +GEOM_OCCFilter::GEOM_OCCFilter( LightApp_SelectionMgr* theSelMgr ) + : SelectMgr_Filter() +{ + mySelMgr = theSelMgr; +} + +//======================================================================= +// function : ~GEOM_OCCFilter +// purpose : +//======================================================================= +GEOM_OCCFilter::~GEOM_OCCFilter() +{ +} + +//======================================================================= +// function : IsOk +// purpose : +//======================================================================= +Standard_Boolean GEOM_OCCFilter::IsOk( const Handle(SelectMgr_EntityOwner)& anObj ) const +{ + Handle(AIS_InteractiveObject) anAIS = Handle(AIS_InteractiveObject)::DownCast( anObj->Selectable() ); + if ( anAIS.IsNull() || !anAIS->HasOwner() ) + return false; + + Handle(SALOME_InteractiveObject) anIO = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner()); + if ( anIO.IsNull() ) return false; + + return mySelMgr->isOk( new LightApp_DataOwner( QString( anIO->getEntry() ) ) ); +} diff --git a/src/GEOMFiltersSelection/GEOM_OCCFilter.h b/src/GEOMFiltersSelection/GEOM_OCCFilter.h new file mode 100644 index 000000000..c9080f297 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_OCCFilter.h @@ -0,0 +1,48 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_OCCFILTER_H +#define GEOM_OCCFILTER_H + +#include + +#include + +class LightApp_SelectionMgr; + +class GEOM_OCCFilter : public SelectMgr_Filter +{ +public: + Standard_EXPORT GEOM_OCCFilter( LightApp_SelectionMgr* theSelMgr); + Standard_EXPORT ~GEOM_OCCFilter(); + + Standard_EXPORT virtual Standard_Boolean IsOk( const Handle(SelectMgr_EntityOwner)& anObj ) const; + +private: + LightApp_SelectionMgr* mySelMgr; + +public: + + DEFINE_STANDARD_RTTI(GEOM_OCCFilter); + +}; + +DEFINE_STANDARD_HANDLE(GEOM_OCCFilter, SelectMgr_Filter) + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx new file mode 100644 index 000000000..a6d1b734b --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_PreviewFilter.h" + +#include + +//======================================================================= +// function : GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_PreviewFilter::GEOM_PreviewFilter( SalomeApp_Study* study ) +: SalomeApp_Filter( study ) +{ +} + +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_PreviewFilter::~GEOM_PreviewFilter() +{ +} + +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_PreviewFilter::isOk( const SUIT_DataOwner* sOwner ) const +{ + const LightApp_DataOwner* owner = dynamic_cast ( sOwner ); + return ( owner && strstr( owner->entry(), "TEMP" ) ); +} + diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.h b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h new file mode 100644 index 000000000..d8e037bcc --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.h @@ -0,0 +1,35 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_PREVIEW_FILTER_H +#define GEOM_PREVIEW_FILTER_H + +#include +#include + +class Standard_EXPORT GEOM_PreviewFilter : public SalomeApp_Filter +{ +public: + GEOM_PreviewFilter( SalomeApp_Study* study ); + ~GEOM_PreviewFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx new file mode 100644 index 000000000..5066277c1 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.cxx @@ -0,0 +1,195 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_SelectionFilter.h" + +#include "GEOM_Client.hxx" + +#include +#include +#include + +#include + +#include + +#include + + +//======================================================================= +// function : GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_SelectionFilter::GEOM_SelectionFilter( SalomeApp_Study* study, const bool theAll ) + : SalomeApp_Filter(study) +{ + myAll = theAll; +} + +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_SelectionFilter::~GEOM_SelectionFilter() +{ +} + +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const +{ + GEOM::GEOM_Object_var obj = getObject( sOwner ); + if ( !CORBA::is_nil( obj ) && obj->IsShape() ) + { + if ( isAll() ) + return true; + + TopoDS_Shape shape; + if ( getShape( obj, shape ) ) + return contains( shape.ShapeType() ) && isShapeOk( shape ); + } + return false; +} + +//======================================================================= +// function : getObject +// purpose : +//======================================================================= +GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject( const SUIT_DataOwner* sOwner, const bool extractReference ) const +{ + GEOM::GEOM_Object_var anObj; + + const LightApp_DataOwner* owner = dynamic_cast(sOwner); + SalomeApp_Study* appStudy = getStudy(); + if (owner && appStudy) + { + _PTR(Study) study = appStudy->studyDS(); + QString entry = owner->entry(); + + _PTR(SObject) aSO (study->FindObjectID(entry.latin1())), aRefSO; + if( extractReference && aSO && aSO->ReferencedObject( aRefSO ) ) + aSO = aRefSO; + + if (aSO) { + std::string aValue = aSO->GetIOR(); + if (strcmp(aValue.c_str(), "") != 0) { + CORBA::ORB_ptr anORB = SalomeApp_Application::orb(); + CORBA::Object_var aCorbaObj = anORB->string_to_object(aValue.c_str()); + anObj = GEOM::GEOM_Object::_narrow(aCorbaObj); + } + } + } + + if (!CORBA::is_nil(anObj)) + return anObj._retn(); + + return GEOM::GEOM_Object::_nil(); +} + +//======================================================================= +// function : getShape +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::getShape (const GEOM::GEOM_Object_ptr& theObject, + TopoDS_Shape& theShape) const +{ + if ( !CORBA::is_nil( theObject ) ) + { + SalomeApp_Application* app = dynamic_cast + ( SUIT_Session::session()->activeApplication() ); + if ( app ) + { + SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); + static GEOM::GEOM_Gen_var geomGen; + if(CORBA::is_nil( geomGen )) { + Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + geomGen = GEOM::GEOM_Gen::_narrow( comp ); + } + if ( !CORBA::is_nil( geomGen ) ) + { + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); + + if ( !aTopoDSShape.IsNull() ) + { + theShape = aTopoDSShape; + return true; + } + } + } + } + return false; +} + +//======================================================================= +// function : contains +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::contains( const int type ) const +{ + return myTypes.contains( type ); +} + +//======================================================================= +// function : add +// purpose : +//======================================================================= +void GEOM_SelectionFilter::add( const int type ) +{ + if ( !contains( type ) ) + myTypes.append( type ); +} + +//======================================================================= +// function : remove +// purpose : +//======================================================================= +void GEOM_SelectionFilter::remove( const int type ) +{ + if ( contains( type ) ) + myTypes.remove( type ); +} + +//======================================================================= +// function : setAll +// purpose : +//======================================================================= +void GEOM_SelectionFilter::setAll( const bool all ) +{ + myAll = all; +} + +//======================================================================= +// function : isAll +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isAll() const +{ + return myAll; +} + +//======================================================================= +// function : isShapeOk +// purpose : +//======================================================================= +bool GEOM_SelectionFilter::isShapeOk( const TopoDS_Shape& ) const +{ + return true; +} diff --git a/src/GEOMFiltersSelection/GEOM_SelectionFilter.h b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h new file mode 100644 index 000000000..2682a4ec5 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_SelectionFilter.h @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_SELECTIONFILTER_H +#define GEOM_SELECTIONFILTER_H + +#include + +#include + +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class Standard_EXPORT GEOM_SelectionFilter : public SalomeApp_Filter +{ +public: + GEOM_SelectionFilter( SalomeApp_Study* study, const bool theAll = false ); + ~GEOM_SelectionFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + +protected: + GEOM::GEOM_Object_ptr getObject( const SUIT_DataOwner*, const bool = true ) const; + bool getShape( const GEOM::GEOM_Object_ptr&, TopoDS_Shape& ) const; + + bool contains( const int ) const; + void add( const int ); + void remove( const int ); + + void setAll( const bool ); + bool isAll() const; + + bool isShapeOk( const TopoDS_Shape& ) const; + +private: + QValueList myTypes; + bool myAll; + +}; + +#endif diff --git a/src/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx b/src/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx new file mode 100644 index 000000000..f074982a9 --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_ShapeTypeFilter.cxx @@ -0,0 +1,168 @@ +// GEOM GEOMFiltersSelection : filter selector for the viewer +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOM_ShapeTypeFilter.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#include + +#include "GEOM_ShapeTypeFilter.ixx" +#include "SALOME_InteractiveObject.hxx" +#include "GEOM_Client.hxx" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +#include + +//======================================================================= +// function : getShape() +// purpose : returns a TopoDS_Shape stored in GEOM_Object +//======================================================================= +static bool getShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theShape ) +{ + if ( !CORBA::is_nil( theObject ) ) + { + static GEOM::GEOM_Gen_var myGeom; + if(CORBA::is_nil(myGeom) { + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", "GEOM" ); + myGeom = GEOM::GEOM_Gen::_narrow( comp ); + } + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( myGeom, theObject ); + + if ( !aTopoDSShape.IsNull() ) + { + theShape = aTopoDSShape; + return true; + } + } + return false; +} + +//======================================================================= +// function : ConvertIOinGEOMObject() +// purpose : +//======================================================================= +static GEOM::GEOM_Object_ptr convertIOinGEOMObject( + const Handle(SALOME_InteractiveObject)& theIO, Standard_Boolean& theResult ) +{ + theResult = Standard_False; + GEOM::GEOM_Object_var aReturnObject; + if ( !theIO.IsNull() ) + { + const char* anEntry = theIO->getEntry(); + SALOMEDS::SObject_var aSObj = + QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->FindObjectID( anEntry ); + if ( !CORBA::is_nil( aSObj ) ) + { + aReturnObject = GEOM::GEOM_Object::_narrow( aSObj->GetObject() ); + theResult = !CORBA::is_nil( aReturnObject ); + } + } + return aReturnObject._retn(); +} + +//======================================================================= +// function : ShapeTypeFilter +// purpose : +//======================================================================= +GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter( const TopAbs_ShapeEnum theShapeType, + const bool theIsAll ) +{ + myIsAll = theIsAll; + myShapeTypes.Add( theShapeType ); + myTypeFilter = new SALOME_TypeFilter( "GEOM" ); +} + +//======================================================================= +// function : ShapeTypeFilter +// purpose : +//======================================================================= +GEOM_ShapeTypeFilter::GEOM_ShapeTypeFilter( const TColStd_MapOfInteger& theShapeTypes, + const bool theIsAll ) +{ + myIsAll = theIsAll; + myShapeTypes = theShapeTypes; + myTypeFilter = new SALOME_TypeFilter( "GEOM" ); +} + +//======================================================================= +// function : IsOk +// purpose : +//======================================================================= +Standard_Boolean GEOM_ShapeTypeFilter::IsOk( + const Handle(SALOME_InteractiveObject)& anObj ) const +{ + if ( !myTypeFilter->IsOk(anObj) ) + return Standard_False; + + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_ptr aGeomObj = convertIOinGEOMObject( anObj, aResult ); + if ( !CORBA::is_nil( aGeomObj ) && aResult && aGeomObj->IsShape() ) + { + if ( myIsAll ) + return true; + TopoDS_Shape aShape; + if ( getShape( aGeomObj, aShape ) ) + { + if ( myShapeTypes.Contains( aShape.ShapeType() ) ) + return IsShapeOk( aShape ); + } + } + return Standard_False; +} + +//======================================================================= +// function : IsShapeOk +// purpose : +//======================================================================= +Standard_Boolean GEOM_ShapeTypeFilter::IsShapeOk( const TopoDS_Shape& ) const +{ + return Standard_True; +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx new file mode 100644 index 000000000..2379d012a --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_TypeFilter.h" + +//======================================================================= +// function : GEOM_TypeFilter +// purpose : +//======================================================================= +GEOM_TypeFilter::GEOM_TypeFilter( SalomeApp_Study* study, const int type, const bool isShapeType ) +:GEOM_SelectionFilter( study ), + myType( type ), + myIsShapeType(isShapeType) +{ +} + +//======================================================================= +// function : ~GEOM_TypeFilter +// purpose : +//======================================================================= +GEOM_TypeFilter::~GEOM_TypeFilter() +{ +} + +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const +{ + GEOM::GEOM_Object_var obj = getObject( sOwner ); + if ( !CORBA::is_nil( obj ) ) + { + if (!myIsShapeType) + return obj->GetType() == type(); + else + return obj->GetShapeType() == type(); + } + + return false; +} + +//======================================================================= +// function : type +// purpose : +//======================================================================= +int GEOM_TypeFilter::type() const +{ + return myType; +} diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.h b/src/GEOMFiltersSelection/GEOM_TypeFilter.h new file mode 100644 index 000000000..4b938547f --- /dev/null +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.h @@ -0,0 +1,44 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOM_TYPEFILTER_H +#define GEOM_TYPEFILTER_H + +#include "GEOM_SelectionFilter.h" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class Standard_EXPORT GEOM_TypeFilter : public GEOM_SelectionFilter +{ +public: + GEOM_TypeFilter(SalomeApp_Study* study, const int type, const bool isShapeType = false ); + ~GEOM_TypeFilter(); + + virtual bool isOk( const SUIT_DataOwner* ) const; + + int type() const; + +private: + int myType; + bool myIsShapeType; +}; + +#endif diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.cxx b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx new file mode 100644 index 000000000..c0868ae60 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.cxx @@ -0,0 +1,286 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOMGUI_OCCSelector.h" + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================ +// Function : GEOMGUI_OCCSelector +// Purpose : +//================================================================ +GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) +: LightApp_OCCSelector( viewer, mgr ) +{ +} + +//================================================================ +// Function : ~GEOMGUI_OCCSelector +// Purpose : +//================================================================ +GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector() +{ +} + +//================================================================ +// Function : getSelection +// Purpose : +//================================================================ +void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const +{ + OCCViewer_Viewer* vw = viewer(); + if ( !vw ) + return; + + Handle(AIS_InteractiveContext) ic = vw->getAISContext(); + + if ( ic->HasOpenedContext() ) + { + for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() ) + { + Handle(SelectMgr_EntityOwner) anOwner = ic->SelectedOwner(); + if ( anOwner.IsNull() ) + continue; + + Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() ); + + QString entryStr = entry( io ); + int index = -1; + + if ( anOwner->ComesFromDecomposition() ) // == Local Selection + { + TopoDS_Shape subShape = anOwner->Shape(); + Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast( io ); + if ( !aisShape.IsNull() ) + { + TopoDS_Shape bigShape = aisShape->Shape(); + + TopTools_IndexedMapOfShape subShapes; + TopExp::MapShapes( bigShape, subShapes ); + index = subShapes.FindIndex( subShape ); + } + } + + if ( !entryStr.isEmpty() ) + { + LightApp_DataOwner* owner; + if ( index > -1 ) // Local Selection + owner = new LightApp_DataSubOwner( entryStr, index ); + else // Global Selection + owner = new LightApp_DataOwner( entryStr ); + + aList.append( SUIT_DataOwnerPtr( owner ) ); + } + } + } + else + { + for ( ic->InitCurrent(); ic->MoreCurrent(); ic->NextCurrent() ) + { + Handle(AIS_InteractiveObject) io = ic->Current(); + + QString entryStr = entry( io ); + + if ( !entryStr.isEmpty() ) + { + LightApp_DataOwner* owner = new LightApp_DataOwner( entryStr ); + aList.append( SUIT_DataOwnerPtr( owner ) ); + } + } + } +} + +//================================================================ +// Function : getEntityOwners +// Purpose : +//================================================================ +static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, + const Handle(AIS_InteractiveContext)& theIC, + SelectMgr_IndexedMapOfOwner& theMap ) +{ + if ( theObj.IsNull() || theIC.IsNull() ) + return; + + TColStd_ListOfInteger modes; + theIC->ActivatedModes( theObj, modes ); + + TColStd_ListIteratorOfListOfInteger itr( modes ); + for (; itr.More(); itr.Next() ) { + int m = itr.Value(); + if ( !theObj->HasSelection( m ) ) + continue; + + Handle(SelectMgr_Selection) sel = theObj->Selection( m ); + + for ( sel->Init(); sel->More(); sel->Next() ) { + Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive(); + if ( entity.IsNull() ) + continue; + + Handle(SelectMgr_EntityOwner) owner = + Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); + if ( !owner.IsNull() ) + theMap.Add( owner ); + } + } +} + +//================================================================ +// Function : setSelection +// Purpose : +//================================================================ +void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) +{ + OCCViewer_Viewer* vw = viewer(); + if ( !vw ) + return; + + Handle(AIS_InteractiveContext) ic = vw->getAISContext(); + +#ifndef WNT + NCollection_DataMap indexesMap; // "entry - list_of_int" map for LOCAL selection +#else + NCollection_DataMap indexesMap; // "entry - list_of_int" map for LOCAL selection +#endif + QMap globalSelMap; // only Key=entry from this map is used. value(int) is NOT used at all. + SelectMgr_IndexedMapOfOwner ownersmap; // map of owners to be selected + + AIS_ListOfInteractive aDispList; + ic->DisplayedObjects( aDispList ); + + // build a map of data owner indexes to be selected. + // "entry - to - list_of_ids" map + for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) + { + const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); + if ( subOwner ) + { + QString entry = subOwner->entry(); +#ifndef WNT + if ( indexesMap.IsBound( TCollection_AsciiString((char*)entry.latin1()))) +#else + if ( indexesMap.IsBound( (char*)entry.latin1())) +#endif + { + TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind((char*)entry.latin1()); + subIndexes.Add( subOwner->index() ); + //indexesMap.replace( entry, subIndexes ); + } + else + { + TColStd_IndexedMapOfInteger subIndexes; + subIndexes.Add( subOwner->index() ); + indexesMap.Bind((char*)entry.latin1(), subIndexes); + } + } + else // the owner is NOT a sub owner, maybe it is a DataOwner == GLOBAL selection + { + const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); + if ( owner ) + { + globalSelMap[owner->entry()] = 1; + } + } + } + + // get all owners. Fill "entry - list_of_owners" map. + for ( AIS_ListIteratorOfListOfInteractive it( aDispList ); it.More(); it.Next() ) + { + Handle(AIS_InteractiveObject) io = it.Value(); + QString entryStr = entry( io ); + if ( !entryStr.isEmpty() ) + { + //EntryToListOfOwnerMap entryOwnersMap; // "entry - list_of_owners" map. temporary use. + SelectMgr_IndexedMapOfOwner owners; + getEntityOwners( io, ic, owners ); // get all owners + + for ( int i = 1, n = owners.Extent(); i <= n; i++ ) + { + Handle(SelectMgr_EntityOwner) anOwner = owners( i ); + if ( anOwner.IsNull() || !anOwner->HasShape() ) + continue; + + // GLOBAL selection + if ( !anOwner->ComesFromDecomposition() && globalSelMap.contains( entryStr ) ) + { + ownersmap.Add( anOwner ); + } + // LOCAL selection + else + { + Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast( io ); + + if ( !aisShape.IsNull() && indexesMap.IsBound( (char*)entryStr.latin1() ) ) + { + TopoDS_Shape shape = aisShape->Shape(); + TopTools_IndexedMapOfShape aMapOfShapes; + TopExp::MapShapes( shape, aMapOfShapes ); + const TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind((char*)entryStr.latin1()); + + const TopoDS_Shape& aSubShape = anOwner->Shape(); + int aSubShapeId = aMapOfShapes.FindIndex( aSubShape ); + + // check if the "sub_shape_index" is found in the "map of indexes for this entry", + // which was passes in the parameter + if ( subIndexes.Contains( aSubShapeId ) ) + { + ownersmap.Add( anOwner ); + } + } + } // end of local selection + } // end of for(owners) + }// end of if(entry) + }// end of for(AIS_all_ios) + + vw->unHighlightAll( false ); + + // DO the selection + for ( int i = 1, n = ownersmap.Extent(); i <= n; i++ ) + { + Handle(SelectMgr_EntityOwner) owner = ownersmap( i ); + if ( owner->State() ) + continue; + + if ( ic->HasOpenedContext() ) + ic->AddOrRemoveSelected( owner, false ); + else + ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false ); + } + + vw->update(); +} diff --git a/src/GEOMGUI/GEOMGUI_OCCSelector.h b/src/GEOMGUI/GEOMGUI_OCCSelector.h new file mode 100644 index 000000000..e891c60ad --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_OCCSelector.h @@ -0,0 +1,37 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef GEOMGUI_OCCSELECTOR_H +#define GEOMGUI_OCCSELECTOR_H + +#include + +class GEOMGUI_OCCSelector : public LightApp_OCCSelector +{ +public: + GEOMGUI_OCCSelector( OCCViewer_Viewer*, SUIT_SelectionMgr* ); + virtual ~GEOMGUI_OCCSelector(); + +protected: + virtual void getSelection( SUIT_DataOwnerPtrList& ) const; + virtual void setSelection( const SUIT_DataOwnerPtrList& ); + +}; + +#endif diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx new file mode 100644 index 000000000..87cc9d630 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -0,0 +1,203 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOMGUI_Selection.h" + +#include "GeometryGUI.h" +#include "GEOM_Displayer.h" + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include "GEOMImpl_Types.hxx" + +// OCCT Includes +#include +#include +#include + +// VTK Includes +#include + +GEOMGUI_Selection::GEOMGUI_Selection() +{ +} + +GEOMGUI_Selection::~GEOMGUI_Selection() +{ +} + +QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const +{ + if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() ); + + return LightApp_Selection::globalParam( p ); +} + +QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const +{ +// if ( p == "isVisible" ) return QtxValue( isVisible( ind ) ); +// parameter isVisible is calculated in base SalomeApp_Selection +// else + if( p == "type" ) + return QtxValue( typeName( ind ) ); + else if ( p == "displaymode" ) + return QtxValue( displayMode( ind ) ); + else + return LightApp_Selection::param( ind, p ); +} + +QString GEOMGUI_Selection::typeName( const int index ) const +{ + if ( isComponent( index ) ) + return "Component"; + GEOM::GEOM_Object_var anObj = getObject( index ); + if ( !CORBA::is_nil( anObj ) ) { + const int aGeomType = anObj->GetType(); + if ( aGeomType == GEOM_GROUP ) + return "Group"; + else + return "Shape"; + } + return "Unknown"; +} + +bool GEOMGUI_Selection::isVisible( const int index ) const +{ + GEOM::GEOM_Object_var obj = getObject( index ); + SALOME_View* view = GEOM_Displayer::GetActiveView(); + if ( !CORBA::is_nil( obj ) && view ) { + Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).latin1(), "GEOM", "TEMP_IO" ); + return view->isVisible( io ); + } + return false; +} + +QString GEOMGUI_Selection::displayMode( const int index ) const +{ + SALOME_View* view = GEOM_Displayer::GetActiveView(); + QString viewType = activeViewType(); + if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { + SALOME_Prs* prs = view->CreatePrs( entry( index ) ); + if ( prs ) { + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC + SOCC_Prs* occPrs = (SOCC_Prs*) prs; + AIS_ListOfInteractive lst; + occPrs->GetObjects( lst ); + if ( lst.Extent() ) { + Handle(AIS_InteractiveObject) io = lst.First(); + if ( !io.IsNull() ) { + int dm = io->DisplayMode(); + if ( dm == AIS_WireFrame ) + return "Wireframe"; + else if ( dm == AIS_Shaded ) + return "Shading"; + else { // return default display mode of AIS_InteractiveContext + OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*) SUIT_Session::session()->activeApplication()->desktop( + )->activeWindow()->getViewManager()->getViewModel(); + Handle(AIS_InteractiveContext) ic = occViewer->getAISContext(); + dm = ic->DisplayMode(); + if ( dm == AIS_WireFrame ) + return "Wireframe"; + else if ( dm == AIS_Shaded ) + return "Shading"; + } + } + } + } + else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; + if ( lst ) { + lst->InitTraversal(); + vtkActor* actor = lst->GetNextActor(); + if ( actor ) { + SALOME_Actor* salActor = dynamic_cast( actor ); + if ( salActor ) { + int dm = salActor->getDisplayMode(); + if ( dm == 0 ) + return "Wireframe"; + else if ( dm == 1 ) + return "Shading"; + } // if ( salome actor ) + } // if ( actor ) + } // if ( lst == vtkPrs->GetObjects() ) + } // if VTK + } + } + return ""; +} + +bool GEOMGUI_Selection::isComponent( const int index ) const +{ + SalomeApp_Study* appStudy = dynamic_cast + (SUIT_Session::session()->activeApplication()->activeStudy()); + + if ( appStudy && index >= 0 && index < count() ) { + _PTR(Study) study = appStudy->studyDS(); + QString anEntry = entry( index ); + + if ( study && !anEntry.isNull() ) { + _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) ); + if ( aSO && aSO->GetFatherComponent() ) + return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR(); + } + } + return false; +} + +GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const +{ + SalomeApp_Study* appStudy = dynamic_cast + (SUIT_Session::session()->activeApplication()->activeStudy()); + + if (appStudy && index >= 0 && index < count()) { + _PTR(Study) study = appStudy->studyDS(); + QString anEntry = entry(index); + + if (study && !anEntry.isNull()) { + _PTR(SObject) aSO (study->FindObjectID(anEntry.latin1())); + if (aSO) { + CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSO); + return GEOM::GEOM_Object::_narrow(anObj); + } + } + } + return GEOM::GEOM_Object::_nil(); +} diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h new file mode 100644 index 000000000..fe7a6bc9a --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -0,0 +1,55 @@ +// GEOMGUI_Selection +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMGUI_Selection.h +// Author : Alexander SOLOVYOV +// Module : GUI +// $Header$ + +#ifndef GEOMGUI_SELECTION_HeaderFile +#define GEOMGUI_SELECTION_HeaderFile + +#include + +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +class GEOMGUI_Selection : public LightApp_Selection +{ +public: + GEOMGUI_Selection(); + virtual ~GEOMGUI_Selection(); + + virtual QtxValue param( const int, const QString& ) const; + virtual QtxValue globalParam( const QString& ) const; + +private: + bool isVisible( const int ) const; + QString typeName( const int ) const; + QString displayMode( const int ) const; + + bool isComponent( const int ) const; + GEOM::GEOM_Object_ptr getObject( const int ) const; +}; + +#endif diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx new file mode 100644 index 000000000..def483eb2 --- /dev/null +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -0,0 +1,1101 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOM_Displayer.cxx +// Author : Vadim SANDLER +// Module : GEOM +// $Header$ + +#include "GEOM_Displayer.h" + +#include "GeometryGUI.h" + +#include "GEOM_TypeFilter.h" +#include "GEOM_EdgeFilter.h" +#include "GEOM_FaceFilter.h" +#include "GEOM_PreviewFilter.h" +#include "GEOM_LogicalFilter.h" +#include "GEOM_OCCFilter.h" + +#include "GEOM_Actor.h" +#include "GEOM_AssemblyBuilder.h" +#include "GEOM_AISShape.hxx" +#include "GEOM_AISTrihedron.hxx" +#include "GEOM_VTKTrihedron.hxx" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include + +// OCCT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK Includes +#include + +// STL Includes +#include + +// CORBA Headers +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) + +#include "GEOMImpl_Types.hxx" + +using namespace std; + +//================================================================ +// Function : getActiveStudy +// Purpose : Get active study, returns 0 if no open study frame +//================================================================ +static inline SalomeApp_Study* getActiveStudy() +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + return ( SalomeApp_Study* )app->activeStudy(); + return 0; +} + +//================================================================ +// Function : getTopAbsMode +// Purpose : Get TopAbs_ShapeEnum value corresponding to the +// one from GEOMImpl_Types.h +//================================================================ +static inline int getTopAbsMode( const int implType ) +{ + switch ( implType ) + { + case GEOM_COMPOUND : return TopAbs_COMPOUND; + case GEOM_SOLID : return TopAbs_SOLID; + case GEOM_SHELL : return TopAbs_SHELL; + case GEOM_FACE : return TopAbs_FACE; + case GEOM_WIRE : return TopAbs_WIRE; + case GEOM_EDGE : return TopAbs_EDGE; + case GEOM_POINT : return TopAbs_VERTEX; + default : return -1; + } +} + +//================================================================ +// Function : getFilter +// Purpose : Get filter corresponding to the type of object +// from GEOMImpl_Types.h +//================================================================ +SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) +{ + SUIT_SelectionFilter* aFilter; + + int aTopAbsMode = getTopAbsMode( theMode ); + if ( aTopAbsMode != -1 ) + aFilter = new GEOM_TypeFilter( getStudy(), aTopAbsMode, true ); //@ aFilter = new GEOM_TypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode ); + else + switch ( theMode ) + { + case GEOM_LINE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Line ); break; + case GEOM_CIRCLE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Circle ); break; + + case GEOM_PLANE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Plane ); break; + case GEOM_CYLINDER : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cylinder ); break; + case GEOM_SPHERE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Sphere ); break; + case GEOM_TORUS : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Torus ); break; + case GEOM_REVOLUTION: aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Revol ); break; + case GEOM_CONE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break; + + case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter( getStudy() ); break; + + case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break; + case GEOM_ALLGEOM : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break; + + default : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break; + } + + return aFilter; +} + +//================================================================ +// Function : getEntry +// Purpose : +//================================================================ +static string getEntry( GEOM::GEOM_Object_ptr object ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + { + string IOR = app->orb()->object_to_string( object ); + if ( IOR != "" ) + { + SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) + return SO->GetID(); + } + } + return ""; +} + +//================================================================ +// Function : getName +// Purpose : +//================================================================ +static string getName( GEOM::GEOM_Object_ptr object ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + { + string IOR = app->orb()->object_to_string( object ); + if ( IOR != "" ) + { + SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); + _PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) ); + + _PTR(GenericAttribute) anAttr; + + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) + { + _PTR(AttributeName) aNameAttr( anAttr ); + return aNameAttr->Value(); + } + } + } + + return ""; +} + +//================================================================= +/*! + * GEOM_Displayer::GEOM_Displayer + * Constructor + */ +//================================================================= +GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) +{ + if( st ) + myApp = dynamic_cast( st->application() ); + else + myApp = 0; + + /* Shading Color */ + SUIT_Session* session = SUIT_Session::session(); + SUIT_ResourceMgr* resMgr = session->resourceMgr(); + + QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ); + myShadingColor = SalomeApp_Tools::color( col ); + + myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); + + myColor = -1; + // This color is used for shape displaying. If it is equal -1 then + // default color is used. + + myWidth = -1; + myType = -1; + + myToActivate = true; + // This parameter is used for activisation/deactivisation of objects to be displayed + + myViewFrame = 0; +} + +//================================================================= +/*! + * GEOM_Displayer::~GEOM_Displayer + * Destructor + */ +//================================================================= +GEOM_Displayer::~GEOM_Displayer() +{ +} + +//================================================================= +/*! + * GEOM_Displayer::Display + * Display interactive object in the current viewer + */ +//================================================================= +void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer, + SALOME_View* theViewFrame ) +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + if ( vf ) + { + SALOME_Prs* prs = buildPresentation( theIO->getEntry(), vf ); + + if ( prs ) + { + vf->BeforeDisplay( this ); + vf->Display( prs ); + vf->AfterDisplay( this ); + + if ( updateViewer ) + vf->Repaint(); + + delete prs; // delete presentation because displayer is its owner + } + } +} + +//================================================================= +/*! + * GEOM_Displayer::Display + * This overloaded Display() method can be useful for operations + * not using dialog boxes. + */ +//================================================================= +void GEOM_Displayer::Display( GEOM::GEOM_Object_ptr theObj, const bool updateViewer ) +{ + if ( theObj->_is_nil() ) + return; + + string entry = getEntry( theObj ); + if ( entry != "" ) { + Display(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()), + updateViewer); + } +} + +//================================================================= +/*! + * GEOM_Displayer::Erase + * Erase interactive object in the current viewer + */ +//================================================================= +void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO, + const bool forced, + const bool updateViewer, + SALOME_View* theViewFrame ) +{ + if ( theIO.IsNull() ) + return; + + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + + if ( vf ) { + SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() ); + if ( prs ) { + vf->Erase( prs, forced ); + if ( updateViewer ) + vf->Repaint(); + delete prs; // delete presentation because displayer is its owner + } + } +} + +//================================================================= +/*! + * GEOM_Displayer::Erase + * Erase geometry object in the current viewer + */ +//================================================================= +void GEOM_Displayer::Erase( GEOM::GEOM_Object_ptr theObj, + const bool forced, + const bool updateViewer ) +{ + string entry = getEntry( theObj ); + if ( entry != "" ) + { + Erase(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()), + forced, updateViewer); + } +} + +//================================================================= +/*! + * GEOM_Displayer::Redisplay + * Redisplay (erase and then display again) interactive object + * in the current viewer + */ +//================================================================= +void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer ) +{ + // Remove the object permanently ( == true) + SUIT_Session* ses = SUIT_Session::session(); + SUIT_Application* app = ses->activeApplication(); + if ( app ) + { + SUIT_Desktop* desk = app->desktop(); + QPtrList wnds = desk->windows(); + SUIT_ViewWindow* wnd; + for ( wnd = wnds.first(); wnd; wnd = wnds.next() ) + { + SUIT_ViewManager* vman = wnd->getViewManager(); + if ( vman ) + { + SUIT_ViewModel* vmodel = vman->getViewModel(); + if ( vmodel ) + { + SALOME_View* view = dynamic_cast(vmodel); + if ( view ) + { + if ( view->isVisible( theIO ) || view == GetActiveView() ) + { + Erase( theIO, true, false, view ); + Display( theIO, updateViewer, view ); + } + } + } + } + } + } +} + +//================================================================= +/*! + * GEOM_Displayer::Display + * Calls Display() method for each object in the given list + */ +//================================================================= +void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateViewer ) +{ + SALOME_ListIteratorOfListIO Iter( theIOList ); + for ( ; Iter.More(); Iter.Next() ) { + Display( Iter.Value(), false ); + } + if ( updateViewer ) + UpdateViewer(); +} + +//================================================================= +/*! + * GEOM_Displayer::Erase + * Calls Erase() method for each object in the given list + */ +//================================================================= +void GEOM_Displayer::Erase( const SALOME_ListIO& theIOList, + const bool forced, + const bool updateViewer ) +{ + SALOME_ListIteratorOfListIO Iter( theIOList ); + for ( ; Iter.More(); Iter.Next() ) + Erase( Iter.Value(), forced, false ); + + if ( updateViewer ) + UpdateViewer(); +} + +//================================================================= +/*! + * GEOM_Displayer::Redisplay + * Calls Redisplay() method for each object in the given list + */ +//================================================================= +void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, const bool updateViewer ) +{ + SALOME_ListIteratorOfListIO Iter( theIOList ); + for ( ; Iter.More(); Iter.Next() ) + Redisplay( Iter.Value(), false ); + + if ( updateViewer ) + UpdateViewer(); +} + +//================================================================= +/*! + * GEOM_Displayer::Update + * Update OCC presentaion + * [ Reimplemented from SALOME_Displayer ] + */ +//================================================================= +void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) +{ + SOCC_Prs* occPrs = dynamic_cast( prs ); + if ( !occPrs ) + return; + + if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE ) + { + TopoDS_Face aFace = TopoDS::Face( myShape ); + Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); + if ( !aPlane.IsNull() ) + { + gp_Ax3 aPos = aPlane->Pln().Position(); + Handle(Geom_Axis2Placement) aPlc = new Geom_Axis2Placement( aPos.Ax2() ); + + Handle(GEOM_AISTrihedron) aTrh; + + if ( occPrs->IsNull() ) + { + aTrh = new GEOM_AISTrihedron( aPlc ); + + if ( HasColor() ) + aTrh->SetColor( (Quantity_NameOfColor)GetColor() ); + + if ( HasWidth() ) + aTrh->SetWidth( GetWidth() ); + + if ( !myIO.IsNull() ) + { + aTrh->setIO( myIO ); + aTrh->SetOwner( myIO ); + } + + occPrs->AddObject( aTrh ); + } + else + { + AIS_ListOfInteractive aList; + occPrs->GetObjects( aList ); + AIS_ListIteratorOfListOfInteractive anIter( aList ); + for ( ; anIter.More(); anIter.Next() ) + { + aTrh = Handle(GEOM_AISTrihedron)::DownCast( anIter.Value() ); + if ( !aTrh.IsNull() ) + { + aTrh->SetComponent( aPlc ); + aTrh->SetToUpdate(); + } + } + } + + occPrs->SetToActivate( ToActivate() ); + } + } + else + { + // if presentation is empty we try to create new one + if ( occPrs->IsNull() ) + { + if ( !myShape.IsNull() ) + { + Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" ); + // Temporary staff: vertex must be infinite for correct visualization + AISShape->SetInfiniteState( myShape.Infinite() || myShape.ShapeType() == TopAbs_VERTEX ); + + // Setup shape properties here ..., e.g. display mode, color, transparency, etc + AISShape->SetDisplayMode( myDisplayMode ); + AISShape->SetShadingColor( myShadingColor ); + + if ( HasColor() ) + { + AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); + if ( myShape.ShapeType() == TopAbs_VERTEX ) + { + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); + anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); + AISShape->Attributes()->SetPointAspect( anAspect ); + } + } + + if ( HasWidth() ) + AISShape->SetWidth( GetWidth() ); + + if ( !myIO.IsNull() ) + { + AISShape->setIO( myIO ); + AISShape->SetOwner( myIO ); + } + else if ( !myName.empty() ) + { + // Workaround to allow selection of temporary objects + static int tempId = 0; + char buf[50]; + sprintf( buf, "TEMP_%d", tempId++ ); + Handle( SALOME_InteractiveObject ) anObj = + new SALOME_InteractiveObject( buf, "GEOM", myName.c_str() ); + AISShape->setIO( anObj ); + AISShape->SetOwner( anObj ); + } + // AISShape->SetName(???); ??? necessary to set name ??? + occPrs->AddObject( AISShape ); + + // In accordance with ToActivate() value object will be activated/deactivated + // when it will be displayed + occPrs->SetToActivate( ToActivate() ); + } + } + // if presentation is found -> set again shape for it + else + { + if ( !myShape.IsNull() ) + { + AIS_ListOfInteractive IOList; + occPrs->GetObjects( IOList ); + AIS_ListIteratorOfListOfInteractive Iter( IOList ); + for ( ; Iter.More(); Iter.Next() ) + { + Handle(GEOM_AISShape) AISShape = Handle(GEOM_AISShape)::DownCast( Iter.Value() ); + if ( AISShape.IsNull() ) + continue; + if ( AISShape->Shape() != myShape ) + { + AISShape->Set( myShape ); + AISShape->UpdateSelection(); + AISShape->SetToUpdate(); + } + if ( !myIO.IsNull() ) + { + AISShape->setIO( myIO ); + AISShape->SetOwner( myIO ); + } + } + } + } + } +} + +//================================================================= +/*! + * GEOM_Displayer::Update + * Update VTK presentaion + * [ Reimplemented from SALOME_Displayer ] + */ +//================================================================= +void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) +{ + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + if ( !vtkPrs || myShape.IsNull() ) + return; + + vtkActorCollection* theActors = 0; + + if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE ) + { + myToActivate = false; + GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New(); + + if ( HasColor() ) + { + Quantity_Color aColor( (Quantity_NameOfColor)GetColor() ); + aTrh->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() ); + } + + Handle(Geom_Plane) aPlane = + Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( TopoDS::Face( myShape ) ) ); + if ( aPlane.IsNull() ) + return; + + gp_Ax2 anAx2 = aPlane->Pln().Position().Ax2(); + aTrh->SetPlacement( new Geom_Axis2Placement( anAx2 ) ); + +// if ( SVTK_Viewer* vf = dynamic_cast( GetActiveView() ) ) +// aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); + + vtkPrs->AddObject( aTrh ); + + theActors = vtkActorCollection::New(); + theActors->AddItem( aTrh ); + } + else + theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True ); + + theActors->InitTraversal(); + + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + + vtkProperty* aProp = 0; + + if ( HasColor() || HasWidth() ) + { + aProp = vtkProperty::New(); + aProp->SetRepresentationToWireframe(); + } + + if ( HasColor() ) + { + Quantity_Color aColor( (Quantity_NameOfColor)GetColor() ); + aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() ); + } + + if ( HasWidth() ) + { + aProp->SetLineWidth( GetWidth() ); + } + + while ( anActor != NULL ) + { + SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor ); + + GActor->setIO( myIO ); + + if ( aProp ) + { + GActor->SetProperty( aProp ); + GActor->SetPreviewProperty( aProp ); + + GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( anActor ); + if ( aGeomGActor != 0 ) + { + aGeomGActor->SetShadingProperty( aProp ); + aGeomGActor->SetWireframeProperty( aProp ); + } + } + + if ( myToActivate ) + GActor->PickableOn(); + else + GActor->PickableOff(); + + vtkPrs->AddObject( GActor ); + + anActor = (vtkActor*)theActors->GetNextActor(); + } + + if ( aProp ) + aProp->Delete(); + + theActors->Delete(); +} + +//================================================================= +/*! + * GEOM_Displayer::BuildPrs + * Build presentation accordint to the current viewer type + */ +//================================================================= +SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) +{ + if ( theObj->_is_nil() ) + return 0; + + myViewFrame = GetActiveView(); + if ( myViewFrame == 0 ) + return 0; + + SALOME_Prs* aPrs = myViewFrame->CreatePrs(); + if ( aPrs == 0 ) + return 0; + + internalReset(); + setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) ); + myType = theObj->GetType(); + + // Update presentation + UpdatePrs( aPrs ); + + return aPrs; +} + +//================================================================= +/*! + * GEOM_Displayer::BuildPrs + * Build presentation accordint to the current viewer type + */ +//================================================================= +SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) +{ + myViewFrame = GetActiveView(); + if ( theShape.IsNull() || myViewFrame == 0 ) + return 0; + + SALOME_Prs* aPrs = myViewFrame->CreatePrs(); + if ( aPrs == 0 ) + return 0; + + internalReset(); + setShape( theShape ); + myType = -1; + + UpdatePrs( aPrs ); + + return aPrs; +} + +//================================================================= +/*! + * GEOM_Displayer::buildPresentation + * Builds/finds object's presentation for the current viewer + * Calls corresponding Update() method by means of double dispatch + * [ internal ] + */ +//================================================================= +SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, + SALOME_View* theViewFrame ) +{ + SALOME_Prs* prs = 0; + internalReset(); + + myViewFrame = theViewFrame ? theViewFrame : GetActiveView(); + + if ( myViewFrame ) + { + prs = LightApp_Displayer::buildPresentation( entry, theViewFrame ); + if ( prs ) + { + Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject(); + theIO->setEntry( entry.latin1() ); + if ( !theIO.IsNull() ) + { + // set interactive object + setIO( theIO ); + // Find SOBject (because shape should be published previously) + SUIT_Session* session = SUIT_Session::session(); + SUIT_Application* app = session->activeApplication(); + if ( app ) + { + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + if ( study ) + { + _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); + if ( SO ) + { + // get CORBA reference to data object + CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); + if ( !CORBA::is_nil( object ) ) + { + // downcast to GEOM object + GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); + if ( !GeomObject->_is_nil() ) + { + // finally set shape + setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); + myType = GeomObject->GetType(); + } + } + } + } + } + } + UpdatePrs( prs ); // Update presentation by using of the double dispatch + } + } + return prs; +} + +//================================================================= +/*! + * GEOM_Displayer::internalReset + * Resets internal data + * [internal] + */ +//================================================================= +void GEOM_Displayer::internalReset() +{ + myIO.Nullify(); + myShape.Nullify(); +} + +//================================================================= +/*! + * GEOM_Displayer::LocalSelection + * Activate selection of CAD shapes with activisation of selection + * of their sub-shapes (with opened local context for OCC viewer) + */ +//================================================================= +void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return; + + LightApp_SelectionMgr* sm = app->selectionMgr(); + + // remove all filters from selection + sm->clearFilters(); + + SALOME_View* vf = GetActiveView(); + if ( vf ) + { + SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() ); + vf->LocalSelection( prs, theMode ); + delete prs; // delete presentation because displayer is its owner + } +} + +//================================================================= +/*! + * GEOM_Displayer::globalSelection + * Activate selection of CAD shapes without activisation of selection + * of their sub-shapes (without opened local context for OCC viewer) + */ +//================================================================= +void GEOM_Displayer::GlobalSelection( const int theMode, const bool update ) +{ + TColStd_MapOfInteger aModes; + aModes.Add( theMode ); + GlobalSelection( aModes, update ); +} + +//================================================================= +/*! + * GEOM_Displayer::globalSelection + * Activate selection of CAD shapes without activisation of selection + * of their sub-shapes (without opened local context for OCC viewer) + */ +//================================================================= +void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, + const bool update ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return; + + SALOME_View* vf = GetActiveView(); + if ( vf == 0 ) + return; + + // Close local context + vf->GlobalSelection( update ); + + // Set selection filters in accordance with current mode + LightApp_SelectionMgr* sm = app->selectionMgr(); + if ( !sm ) + return; + + // Remove from selection temporary objects if necessary + if ( !theModes.Contains( GEOM_PREVIEW ) ) + clearTemporary( sm ); + + //@ aSel->ClearIndex(); + + sm->clearFilters(); + + // Remove filters from AIS_InteractiveContext + Handle(AIS_InteractiveContext) ic; + SOCC_Viewer* viewer = dynamic_cast( vf ); + if ( viewer ) + { + ic = viewer->getAISContext(); + if ( !ic.IsNull() ) + ic->RemoveFilters(); + } + + if ( theModes.Contains( GEOM_ALLOBJECTS ) ) + return; + + SUIT_SelectionFilter* aFilter; + if ( theModes.Extent() == 1 ) + { + int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key(); + aFilter = getFilter( aMode ); + } + else if ( theModes.Extent() > 1 ) + { + TColStd_MapOfInteger aTopAbsModes; + TColStd_MapIteratorOfMapOfInteger anIter( theModes ); + QPtrList aListOfFilters; + for ( ; anIter.More(); anIter.Next() ) + { + SUIT_SelectionFilter* aFilter = getFilter( anIter.Key() ); + if ( aFilter ) + aListOfFilters.append( aFilter ); + } + + aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); + } + else + return; + + if ( aFilter ) + { + sm->installFilter( aFilter ); + if ( !ic.IsNull() ) + { + Handle(GEOM_OCCFilter) anOCCFilter = new GEOM_OCCFilter( sm ); + ic->AddFilter( anOCCFilter ); + } + } +} + +//================================================================= +/*! + * GEOM_Displayer::LocalSelection + * Activate selection of CAD shapes with activisation of selection + * of their sub-shapes (with opened local context for OCC viewer) + */ +//================================================================= +void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode ) +{ + SALOME_ListIteratorOfListIO Iter( theIOList ); + for ( ; Iter.More(); Iter.Next() ) + LocalSelection( Iter.Value(), theMode ); +} + +//================================================================= +/*! + * GEOM_Displayer::BeforeDisplay + * Called before displaying of pars. Close local context + * [ Reimplemented from SALOME_Displayer ] + */ +//================================================================= +void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCViewType& ) +{ + SOCC_Viewer* vf = dynamic_cast( v ); + if ( vf ) + { + Handle(AIS_InteractiveContext) ic = vf->getAISContext(); + if ( !ic.IsNull() ) + { + if ( ic->HasOpenedContext() ) + ic->CloseAllContexts(); + } + } +} + +void GEOM_Displayer::AfterDisplay( SALOME_View*, const SALOME_OCCViewType& ) +{ +} + + +//================================================================= +/*! + * GEOM_Displayer::SetColor + * Set color for shape displaying. If it is equal -1 then default color is used. + * Available values are from Quantity_NameOfColor enumeration + */ +//================================================================= +void GEOM_Displayer::SetColor( const int color ) +{ + myColor = color; +} + +int GEOM_Displayer::GetColor() const +{ + return myColor; +} + +bool GEOM_Displayer::HasColor() const +{ + return myColor != -1; +} + +void GEOM_Displayer::UnsetColor() +{ + myColor = -1; +} + +//================================================================= +/*! + * GEOM_Displayer::SetWidth + * Set width of shape displaying. If it is equal -1 then default width is used. + */ +//================================================================= +void GEOM_Displayer::SetWidth( const double width ) +{ + myWidth = width; +} + +double GEOM_Displayer::GetWidth() const +{ + return myWidth; +} + +bool GEOM_Displayer::HasWidth() const +{ + return myWidth != -1; +} + +void GEOM_Displayer::UnsetWidth() +{ + myWidth = -1; +} + +//================================================================= +/*! + * GEOM_Displayer::SetToActivate + * This method is used for activisation/deactivisation of objects to be displayed + */ +//================================================================= +void GEOM_Displayer::SetToActivate( const bool toActivate ) +{ + myToActivate = toActivate; +} +bool GEOM_Displayer::ToActivate() const +{ + return myToActivate; +} + +//================================================================= +/*! + * GEOM_Displayer::clearTemporary + * Removes from selection temporary objects + */ +//================================================================= +void GEOM_Displayer::clearTemporary( LightApp_SelectionMgr* theSelMgr ) +{ + SALOME_ListIO selected, toSelect; + theSelMgr->selectedObjects( selected ); + + for ( SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) { + Handle(SALOME_InteractiveObject) io = it.Value(); + if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 ) + toSelect.Append( it.Value() ); + } + + theSelMgr->setSelectedObjects( toSelect, true ); +} + +void GEOM_Displayer::SetName( const char* theName ) +{ + myName = theName; +} + +void GEOM_Displayer::UnsetName() +{ + myName = ""; +} + +SalomeApp_Study* GEOM_Displayer::getStudy() const +{ + return dynamic_cast( myApp->activeStudy() ); +} + +void GEOM_Displayer::setIO( const Handle(SALOME_InteractiveObject)& theIO ) +{ + myIO = theIO; +} + +void GEOM_Displayer::setShape( const TopoDS_Shape& theShape ) +{ + myShape = theShape; +} + +bool GEOM_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& viewer_type ) const +{ + return viewer_type==SOCC_Viewer::Type() || viewer_type==SVTK_Viewer::Type(); +} diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h new file mode 100644 index 000000000..d1af6d1f0 --- /dev/null +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -0,0 +1,191 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOM_Displayer.h +// Author : Vadim SANDLER +// Module : GEOM +// $Header$ + +#if !defined (__GEOM_DISPLAYER_H) +#define __GEOM_DISPLAYER_H + +#include "SALOME_Prs.h" +#include "SALOME_InteractiveObject.hxx" +#include "SALOME_ListIO.hxx" +#include +#include +#include + +#include + +#include +#include CORBA_CLIENT_HEADER(GEOM_Gen) + +#define GEOM_ALLOBJECTS -1 // Selection of all objects is activated +#define GEOM_PREVIEW -2 // Definition for preview selection +#define GEOM_ALLSHAPES -3 // Selection of all shapes is activated +#define GEOM_ALLGEOM -4 // Selection of all geom objects is activated + +typedef std::list ObjectList; + +class TColStd_MapOfInteger; +class LightApp_SelectionMgr; +class SalomeApp_Study; +class SalomeApp_Application; +class SUIT_SelectionFilter; +//class SALOME_Selection; + +//#ifdef WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define GEOMGUI_WNT_EXPORT __declspec( dllexport ) +#else +#define GEOMGUI_WNT_EXPORT +#endif + +class GEOMGUI_WNT_EXPORT GEOM_Displayer : public LightApp_Displayer +{ + +public: + /* Constructor */ + GEOM_Displayer( SalomeApp_Study* app ); + /* Destructor */ + virtual ~GEOM_Displayer(); + + virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const; + + /* Display/Erase object methods */ + void Display ( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer = true, + SALOME_View* theViewFrame = 0 ); + + // This overloaded Display() method can be useful for operations + // not using dialog boxes. + void Display ( GEOM::GEOM_Object_ptr theObj, + const bool updateViewer = true ); + + void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer = true ); + + void Erase ( const Handle(SALOME_InteractiveObject)& theIO, + const bool forced = false, + const bool updateViewer = true, + SALOME_View* theViewFrame = 0 ); + + void Erase ( GEOM::GEOM_Object_ptr theObj, + const bool forced = false, + const bool updateViewer = true ); + + /* Display/Erase list of objects methods */ + + void Display ( const SALOME_ListIO& theIOList, + const bool updateViewer = true ); + + void Erase ( const SALOME_ListIO& theIOList, + const bool forced = false, + const bool updateViewer = true ); + + void Redisplay ( const SALOME_ListIO& theIOList, + const bool updateViewer = true ); + + /* build presentation accordint to the current viewer type*/ + SALOME_Prs* BuildPrs ( GEOM::GEOM_Object_ptr ); + SALOME_Prs* BuildPrs ( const TopoDS_Shape& ); + + /* Set color for shape displaying. If it is equal -1 then default color is used. + Available values are from Quantity_NameOfColor enumeration */ + void SetColor ( const int ); + void UnsetColor(); + int GetColor () const; + bool HasColor () const; + + /* Set width for shape displaying. If it is equal -1 then default width is used. */ + void SetWidth ( const double ); + void UnsetWidth(); + double GetWidth () const; + bool HasWidth () const; + + + /* Sets name - for temporary objects only */ + void SetName( const char* theName ); + void UnsetName(); + + /* Reimplemented from SALOME_Displayer */ + virtual void Update( SALOME_OCCPrs* ); + virtual void Update( SALOME_VTKPrs* ); + virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ); + virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ); + + /* This methos is used for activisation/deactivisation of objects to be displayed*/ + void SetToActivate( const bool ); + bool ToActivate() const; + + /* Activate/Deactivate selection*/ + void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int ); + void LocalSelection( const SALOME_ListIO& theIOList, const int ); + void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); + void GlobalSelection( const TColStd_MapOfInteger&, const bool = false ); + + SalomeApp_Study* getStudy() const; + +protected: + /* internal methods */ + /* Builds presentation accordint to the current viewer type */ + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); + + /* Sets interactive object */ + void setIO( const Handle(SALOME_InteractiveObject)& theIO ); + + /* Sets shape */ + void setShape( const TopoDS_Shape& theShape ); + + /* Resets internal data */ + void internalReset(); + + void clearTemporary( LightApp_SelectionMgr* theSelMgr ); + + SUIT_SelectionFilter* getFilter( const int theMode ); + +protected: + Handle(SALOME_InteractiveObject) myIO; + TopoDS_Shape myShape; + string myName; + int myType; + SALOME_View* myViewFrame; + + // Attributes + Quantity_Color myShadingColor; + int myColor; + double myWidth; + bool myToActivate; + int myDisplayMode; + +private: + SalomeApp_Application* myApp; +}; + +#endif // __GEOM_DISPLAYER_H + diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po new file mode 100644 index 000000000..4dcf34b03 --- /dev/null +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -0,0 +1,2898 @@ +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. translating +# from French to English, "Foo::Bar" would be translated to "Pub", +# not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" +"PO-Revision-Date: 2003-10-27 17:32+0100\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +# +#============================================================================== +# + +#Button Apply +msgid "GEOM_BUT_APPLY" +msgstr "&Apply" + +#Button Close +msgid "GEOM_BUT_CLOSE" +msgstr "&Close" + +#Button Cancel +msgid "GEOM_BUT_CANCEL" +msgstr "&Cancel" + +#Button Ok +msgid "GEOM_BUT_OK" +msgstr "O&k" + +#Button Yes +msgid "GEOM_BUT_YES" +msgstr "&Yes" + +#Button No +msgid "GEOM_BUT_NO" +msgstr "&No" + +#Button Help +msgid "GEOM_BUT_HELP" +msgstr "&Help" + +#Button Explode +msgid "GEOM_BUT_EXPLODE" +msgstr "&Explode" + +# +#============================================================================== +# + +#: GeometryGUI.cxx:563 +msgid "GEOM_INF_LOADED" +msgstr "File %1 loaded." + +# +#============================================================================== +# + +#: GeometryGUI.cxx:3069 +msgid "GEOM_PRP_COMMAND" +msgstr "No command associated with this id = %1." + +#: GeometryGUI.cxx:4977 +msgid "GEOM_PRP_ABORT" +msgstr "Operation aborted" + +#: GeometryGUI.cxx:5058 +msgid "GEOM_PRP_DONE" +msgstr "Operation done" + +#: GeometryGUI.cxx:3717 +msgid "GEOM_PRP_LOADING" +msgstr "Loading %1 ..." + +#: GeometryGUI.cxx:1412 +msgid "GEOM_PRP_NULLSHAPE" +msgstr "Error, null or inappropriate shape !" + +#: GeometryGUI.cxx:5072 +msgid "GEOM_PRP_READY" +msgstr "Ready" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_SELECT_SUBSHAPES" +msgstr "Select Sub Shapes" + +msgid "GEOM_PRP_EXPORT" +msgstr "Exporting geometry to %1 ..." + +msgid "GEOM_CONFIRM" +msgstr "Confirm operation" + +msgid "GEOM_CONFIRM_INFO" +msgstr "Shape contains %1 sub shapes !" + + +msgid "GEOM_PRP_NOT_FOR_VTK_VIEWER" +msgstr "Not allowed in VTK viewer" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_SHAPE_IN_STUDY" +msgstr "Main shape must be in the study before" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_SELECT_EDGE" +msgstr "Select edges and click on Apply" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_SELECT_FACE" +msgstr "Select faces to suppress and click on Ok/Apply" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_SELECT_FIRST" +msgstr "Select main shape first" + +#: GeometryGUI.cxx:1690 +msgid "GEOM_PRP_MIN_DIST" +msgstr "Min Distance not computed" + +msgid "GEOM_STUDY_LOCKED" +msgstr "The active study is locked and therefore cannot be modified" + +# +#============================================================================== +# + +#: GeometryGUI.cxx:3698 +msgid "GEOM_MEN_ALL_FILES" +msgstr "All Files ( * )" + +#: GeometryGUI.cxx:4389 +msgid "GEOM_MEN_ANGLE" +msgstr "Angle :" + +#: GeometryGUI.cxx:3941 +msgid "GEOM_MEN_COMPONENT" +msgstr "Geometry" + +#: GeometryGUI.cxx:4389 +msgid "GEOM_MEN_ENTER_ANGLE" +msgstr "Enter An Angle In Degrees" + +#: GeometryGUI.cxx:3758 +msgid "GEOM_MEN_EXPORT" +msgstr "Export" + +#: GeometryGUI.cxx:3648 +msgid "GEOM_MEN_IMPORT" +msgstr "Import" + +#: GeometryGUI.cxx:2931 +msgid "GEOM_MEN_ISOS" +msgstr "Select Number Of Isos" + +#: GeometryGUI.cxx:4278 +msgid "GEOM_MEN_POPUP_NAME" +msgstr "%1 Objects" + +#: GeometryGUI.cxx:4414 +msgid "GEOM_MEN_SKETCHER_X" +msgstr "Enter a length to set X" + +#: GeometryGUI.cxx:4438 +msgid "GEOM_MEN_SKETCHER_Y" +msgstr "Enter a length to set Y" + +#: GeometryGUI.cxx:2898 +msgid "GEOM_MEN_TRANSPARENCY" +msgstr "Transparency" + +#: GeometryGUI.cxx:4413 +msgid "GEOM_MEN_X" +msgstr "X :" + +#: GeometryGUI.cxx:4437 +msgid "GEOM_MEN_Y" +msgstr "Y :" + +#: GeometryGUI_NbIsosDlg.cxx:36 +msgid "GEOM_MEN_ISOU" +msgstr "Isos u :" + +#: GeometryGUI_NbIsosDlg.cxx:53 +msgid "GEOM_MEN_ISOV" +msgstr "Isos v :" + +#: GeometryGUI_TransparencyDlg.cxx:31 +msgid "GEOM_MEN_TRANSPARENCY_LABEL" +msgstr "Transparency :" + +msgid "GEOM_MEN_STEP_LABEL" +msgstr "Step :" + +msgid "GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE" +msgstr "Identical names : select by mouse !" + +msgid "GEOM_NAME_INCORRECT" +msgstr "Object name not found" + +msgid "GEOM_INCORRECT_INPUT" +msgstr "Incorrect input data!" + +# +#============================================================================== +# + +#: GeometryGUI.cxx:892 +msgid "GEOM_WRN_RADIUS_NULL" +msgstr "Radius is null" + +#: GeometryGUI.cxx:3854 +msgid "GEOM_WRN_WARNING" +msgstr "Warning" + +#: GeometryGUI.cxx:3854 +msgid "GEOM_REALLY_DELETE" +msgstr "Do you really want to delete object(s) ?" + +# +#============================================================================== +# + +#Object +msgid "GEOM_OBJECT" +msgstr "Object" + +#Main object +msgid "GEOM_MAIN_OBJECT" +msgstr "Main Object" + +#Tool object +msgid "GEOM_TOOL_OBJECT" +msgstr "Tool Object" + +#Base Object +msgid "GEOM_BASE_OBJECT" +msgstr "Base Object" + +#Path Object +msgid "GEOM_PATH_OBJECT" +msgstr "Path Object" + +#Objects +msgid "GEOM_OBJECTS" +msgstr "Objects" + +#Object i +msgid "GEOM_OBJECT_I" +msgstr "Object %1" + +#Object and result +msgid "GEOM_OBJECT_RESULT" +msgstr "Object And Result" + +#Point +msgid "GEOM_POINT" +msgstr "Point" + +#Base point +msgid "GEOM_BASE_POINT" +msgstr "Base Point" + +#Center Point +msgid "GEOM_CENTER_POINT" +msgstr "Center Point" + +#Diagonal Points +msgid "GEOM_DIAGONAL_POINTS" +msgstr "Diagonal Points" + +#Central Point +msgid "GEOM_CENTRAL_POINT" +msgstr "Central Point" + +#Points +msgid "GEOM_POINTS" +msgstr "Points" + +#Point i +msgid "GEOM_POINT_I" +msgstr "Point %1" + +#Arguments +msgid "GEOM_ARGUMENTS" +msgstr "Arguments" + +#Center +msgid "GEOM_CENTER" +msgstr "Center" + +#Radius +msgid "GEOM_RADIUS" +msgstr "Radius :" + +#Radius i +msgid "GEOM_RADIUS_I" +msgstr "Radius %1 :" + +#Height +msgid "GEOM_HEIGHT" +msgstr "Height :" + +#Length +msgid "GEOM_LENGTH" +msgstr "Length is :" + +#Weight +msgid "GEOM_WEIGHT" +msgstr "Weight :" + +#Coordinates +msgid "GEOM_COORDINATES" +msgstr "Coordinates" + +#Coor. +msgid "GEOM_COOR" +msgstr "Coord. :" + +#Reverse +msgid "GEOM_REVERSE" +msgstr "Reverse" + +#Reverse U +msgid "GEOM_REVERSE_U" +msgstr "Reverse U" + +#Reverse V +msgid "GEOM_REVERSE_V" +msgstr "Reverse V" + +#Angle +msgid "GEOM_ANGLE" +msgstr "Angle :" + +#Axis +msgid "GEOM_AXIS" +msgstr "Axis" + +#Matrix +msgid "GEOM_MATRIX" +msgstr "Matrix :" + +#Vector Length +msgid "GEOM_VECTOR_LENGTH" +msgstr "Vector Length :" + +#Reverse Vector +msgid "GEOM_REVERSE_VECTOR" +msgstr "Reverse Vector" + +#Point Mirror +msgid "GEOM_POINT_MIRROR" +msgstr "Point Mirror" + +#Axe Mirror +msgid "GEOM_AXE_MIRROR" +msgstr "Axe Mirror" + +#Plane Mirror +msgid "GEOM_PLANE_MIRROR" +msgstr "Plane Mirror" + +#Face Selection +msgid "GEOM_FACE_SELECTION" +msgstr "Face Selection" + +#Base +msgid "GEOM_BASE" +msgstr "Base" + +#Water Density +msgid "GEOM_WATER_DENSITY" +msgstr "Water Density :" + +#Meshing Deflection +msgid "GEOM_MESHING_DEFLECTION" +msgstr "Meshing Deflect. :" + +#Dimensions +msgid "GEOM_DIMENSIONS" +msgstr "Dimensions" + +#Precision +msgid "GEOM_PRECISION" +msgstr "Precision :" + +#Selection +msgid "GEOM_SELECTION" +msgstr "Selection" + +#Nb. Times +msgid "GEOM_NB_TIMES" +msgstr "Nb. Times :" + +#Nb. Times U +msgid "GEOM_NB_TIMES_U" +msgstr "Nb. Times U :" + +#Nb. Times V +msgid "GEOM_NB_TIMES_V" +msgstr "Nb. Times V :" + +#Step +msgid "GEOM_STEP" +msgstr "Step :" + +#Step V +msgid "GEOM_STEP_V" +msgstr "Step V :" + +#Step U +msgid "GEOM_STEP_U" +msgstr "Step U :" + +# +#============================================================================== +# + +#Partition +msgid "GEOM_PARTITION" +msgstr "Partition" + +#Half-space partition +msgid "GEOM_PARTITION_HALFSPACE" +msgstr "Half-space partition" + +#Tolerance +msgid "GEOM_TOLERANCE" +msgstr "Tolerance" + +#Orientation +msgid "GEOM_ORIENTATION" +msgstr "Orientation" + +#Pipe +msgid "GEOM_PIPE" +msgstr "Pipe" + +#Revolution +msgid "GEOM_REVOLUTION" +msgstr "Revolution" + +#Rotation +msgid "GEOM_ROTATION" +msgstr "Rotation" + +#Archimede +msgid "GEOM_ARCHIMEDE" +msgstr "Archimede" + +#Common +msgid "GEOM_COMMON" +msgstr "Common" + +#Cut +msgid "GEOM_CUT" +msgstr "Cut" + +#Distance +msgid "GEOM_DISTANCE" +msgstr "Distance" + +#Filling +msgid "GEOM_FILLING" +msgstr "Filling" + +#Fuse +msgid "GEOM_FUSE" +msgstr "Fuse" + +#Scale +msgid "GEOM_SCALE" +msgstr "Scale" + +#Position +msgid "GEOM_POSITION" +msgstr "Location" + +#Offset +msgid "GEOM_OFFSET" +msgstr "Offset" + +#Section +msgid "GEOM_SECTION" +msgstr "Section" + +#Sewing +msgid "GEOM_SEWING" +msgstr "Sewing" + +#Translation +msgid "GEOM_TRANSLATION" +msgstr "Translation" + +#Working Plane +msgid "GEOM_WPLANE" +msgstr "Working Plane" + +#Mirror +msgid "GEOM_MIRROR" +msgstr "Mirror" + +#Prism +msgid "GEOM_PRISM" +msgstr "Prism" + +#Sub Shapes +msgid "GEOM_SUB_SHAPE" +msgstr "Sub Shapes" + +#Supress Face +msgid "GEOM_SUPRESSFACE" +msgstr "Supress Face" + +#Fillet +msgid "GEOM_FILLET" +msgstr "Fillet" + +#Chamfer +msgid "GEOM_CHAMFER" +msgstr "Chamfer" + +#Check Shape +msgid "GEOM_CHECK_SHAPE" +msgstr "Check Shape" + +#Check Blocks Compound +msgid "GEOM_CHECK_BLOCKS_COMPOUND" +msgstr "Check Blocks Compound" + +#Check Blocks Compound Errors +msgid "GEOM_CHECK_BLOCKS_COMPOUND_ERRORS" +msgstr "Errors" + +#Check Blocks Compound Errors +msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_NO_ERRORS" +msgstr "The Compound of Blocks has no errors" + +msgid "GEOM_CHECK_BLOCKS_COMPOUND_HAS_ERRORS" +msgstr "The Compound of Blocks has errors" + +#Check Blocks Compound SubShapes +msgid "GEOM_CHECK_BLOCKS_COMPOUND_SUBSHAPES" +msgstr "Incriminated Sub-Shapes" + +#Whatis +msgid "GEOM_WHATIS" +msgstr "Whatis" + +#Bounding Box +msgid "GEOM_BNDBOX" +msgstr "Bounding Box" + +#Center Of Mass +msgid "GEOM_CMASS" +msgstr "Center Of Mass" + +#Basic Properties +msgid "GEOM_PROPERTIES" +msgstr "Basic Properties" + +#Multi-Translation +msgid "GEOM_MULTITRANSLATION" +msgstr "Multi-Translation" + +#Multi-Rotation +msgid "GEOM_MULTIROTATION" +msgstr "Multi-Rotation" + +# +#============================================================================== +# + +#Arc +msgid "GEOM_ARC" +msgstr "Arc" + +#Box +msgid "GEOM_BOX" +msgstr "Box" + +#Circle +msgid "GEOM_CIRCLE" +msgstr "Circle" + +#Ellipse +msgid "GEOM_ELLIPSE" +msgstr "Ellipse" + +msgid "GEOM_ELLIPSE_TITLE" +msgstr "Ellipse Construction" + +#Radius major +msgid "GEOM_RADIUS_MAJOR" +msgstr "Major radius :" + +#Radius minor +msgid "GEOM_RADIUS_MINOR" +msgstr "Minor radius :" + +#Compound +msgid "GEOM_COMPOUND" +msgstr "Compound" + +#CompSolid +msgid "GEOM_COMPOUNDSOLID" +msgstr "CompSolid" + +#Cone +msgid "GEOM_CONE" +msgstr "Cone" + +#Cylinder +msgid "GEOM_CYLINDER" +msgstr "Cylinder" + +#Edge +msgid "GEOM_EDGE" +msgstr "Edge" + +#Face +msgid "GEOM_FACE" +msgstr "Face" + +#Faces +msgid "GEOM_FACES" +msgstr "Faces" + +#Line +msgid "GEOM_LINE" +msgstr "Line" + +#Plane +msgid "GEOM_PLANE" +msgstr "Plane" + +#Shape +msgid "GEOM_SHAPE" +msgstr "Shape" + +#Shell +msgid "GEOM_SHELL" +msgstr "Shell" + +#Shells +msgid "GEOM_SHELLS" +msgstr "Shells" + +#Solid +msgid "GEOM_SOLID" +msgstr "Solid" + +#Sphere +msgid "GEOM_SPHERE" +msgstr "Sphere" + +#Conical Face +msgid "GEOM_SURFCONE" +msgstr "Conical Face" + +#Cylindrical Face +msgid "GEOM_SURFCYLINDER" +msgstr "Cylindrical Face" + +#Spherical Face +msgid "GEOM_SURFSPHERE" +msgstr "Spherical Face" + +#Toroidal Face +msgid "GEOM_SURFTORUS" +msgstr "Toroidal Face" + +#Torus +msgid "GEOM_TORUS" +msgstr "Torus" + +#Vector +msgid "GEOM_VECTOR" +msgstr "Vector" + +#Vector U +msgid "GEOM_VECTOR_U" +msgstr "Vector U" + +#Vector V +msgid "GEOM_VECTOR_V" +msgstr "Vector V" + +#Vertex +msgid "GEOM_VERTEX" +msgstr "Vertex" + +#Wire +msgid "GEOM_WIRE" +msgstr "Wire" + +#Wire(s) +msgid "GEOM_WIRES" +msgstr "Wire(s)" + +#Wires +msgid "GEOM_WIREZ" +msgstr "Wires" + +msgid "GEOM_IMPORT" +msgstr "Imported_Shape" + +#Parameter +msgid "GEOM_PARAMETER" +msgstr "Parameter :" + +# +#============================================================================== +# + +#Min +msgid "GEOM_MIN" +msgstr "Min :" + +#Max +msgid "GEOM_MAX" +msgstr "Max :" + +#X +msgid "GEOM_X" +msgstr "X :" + +#Y +msgid "GEOM_Y" +msgstr "Y :" + +#Z +msgid "GEOM_Z" +msgstr "Z :" + +#DX +msgid "GEOM_DX" +msgstr "Dx :" + +#DY +msgid "GEOM_DY" +msgstr "Dy :" + +#DZ +msgid "GEOM_DZ" +msgstr "Dz :" + +#D1 +msgid "GEOM_D1" +msgstr "D1 :" + +#D2 +msgid "GEOM_D2" +msgstr "D2 :" + +# +#============================================================================== +# + +#: GeometryGUI.cxx +msgid "GEOM_STEP_TITLE" +msgstr "Step value for GUI constructions" + +#: GeometryGUI_ArcDlg.cxx:45 +msgid "GEOM_ARC_TITLE" +msgstr "Arc Construction" + +#: GeometryGUI_ArchimedeDlg.cxx:55 +msgid "GEOM_ARCHIMEDE_TITLE" +msgstr "Archimede Construction" + +#: GeometryGUI_BndBoxDlg.cxx:59 +msgid "GEOM_BNDBOX_TITLE" +msgstr "Bounding Box Informations" + +#: GeometryGUI_BndBoxDlg.cxx:82 +msgid "GEOM_BNDBOX_OBJDIM" +msgstr "Object And Its Dimensions" + +#: GeometryGUI_BoxDlg.cxx:50 +msgid "GEOM_BOX_TITLE" +msgstr "Box Construction" + +#: GeometryGUI_BoxDlg.cxx:50 +msgid "GEOM_BOX_OBJ" +msgstr "Dimensions At Origin" + +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "GEOM_CHAMFER_TITLE" +msgstr "Chamfer Construction" + +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "GEOM_CHAMFER_ALL" +msgstr "Chamfer On Whole Shape" + +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "GEOM_CHAMFER_EDGES" +msgstr "Chamfer On Edges From Shape" + +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "GEOM_CHAMFER_FACES" +msgstr "Chamfer On Faces From Shape" + +#: GeometryGUI_CircleDlg.cxx:48 +msgid "GEOM_CIRCLE_TITLE" +msgstr "Circle Construction" + +#: GeometryGUI_CenterMassDlg.cxx:77 +msgid "GEOM_CMASS_TITLE" +msgstr "Center Of Mass Construction" + +msgid "GEOM_PLANE_SIZE" +msgstr "Size of plane :" + +#: GeometryGUI_CommonDlg.cxx:47 +msgid "GEOM_COMMON_TITLE" +msgstr "BOOLEAN : Common Of Two Objects" + +#: GeometryGUI_CompoundDlg.cxx:44 +msgid "GEOM_COMPOUND_TITLE" +msgstr "Create A Compound" + +#: GeometryGUI_ConeDlg.cxx:49 +msgid "GEOM_CONE_TITLE" +msgstr "Cone Construction" + +#: GeometryGUI_CutDlg.cxx:48 +msgid "GEOM_CUT_TITLE" +msgstr "BOOLEAN : Cut Of Two Objects" +# +#: GeometryGUI_CylinderDlg.cxx:47 +msgid "GEOM_CYLINDER_TITLE" +msgstr "Cylinder Construction" + +#: GeometryGUI_CheckShape.cxx:60 +msgid "GEOM_CHECK_TITLE" +msgstr "Check Shape Informations" + +#: MeasureGUI_CheckCompoundOfBlocks.cxx:61 +msgid "GEOM_CHECK_COMPOUND_BLOCKS_TITLE" +msgstr "Check Blocks Compound" + +#: GeometryGUI_CheckShape.cxx:83 +msgid "GEOM_CHECK_INFOS" +msgstr "Object And Its Topological Informations" + +#: GeometryGUI_DistanceDlg.cxx:57 +msgid "GEOM_MINDIST_TITLE" +msgstr "Minimun Distance Between Two Objects" + +#: GeometryGUI_DistanceDlg.cxx:57 +msgid "GEOM_MINDIST_OBJ" +msgstr "Objects And Results" + +#: GeometryGUI_EdgeDlg.cxx:47 +msgid "GEOM_EDGE_TITLE" +msgstr "Create An Edge" + +#: GeometryGUI_FilletDlg.cxx:58 +msgid "GEOM_FILLET_TITLE" +msgstr "Fillet Construction" + +#: GeometryGUI_FilletDlg.cxx:58 +msgid "GEOM_FILLET_ALL" +msgstr "Fillet On Whole Shape" + +#: GeometryGUI_FilletDlg.cxx:58 +msgid "GEOM_FILLET_EDGES" +msgstr "Fillet On Edges From Shape" + +#: GeometryGUI_FilletDlg.cxx:58 +msgid "GEOM_FILLET_FACES" +msgstr "Fillet On Faces From Shape" + +#: GeometryGUI_FaceDlg.cxx:49 +msgid "GEOM_FACE_TITLE" +msgstr "Create A Face" + +#: GeometryGUI_FaceDlg.cxx:78 +msgid "GEOM_FACE_FFW" +msgstr "Face from a wire" + +#: GeometryGUI_FaceDlg.cxx:103 +msgid "GEOM_FACE_OPT" +msgstr "Try to create a planar face" + +#: GeometryGUI_FillingDlg.cxx:53 +msgid "GEOM_FILLING_TITLE" +msgstr "Filling Surface With Curves" + +#: GeometryGUI_FillingDlg.cxx:112 +msgid "GEOM_FILLING_ARG" +msgstr "Arguments And Parameters" + +#: GeometryGUI_FillingDlg.cxx:128 +msgid "GEOM_FILLING_MIN_DEG" +msgstr "Min deg" + +#: GeometryGUI_FillingDlg.cxx:142 +msgid "GEOM_FILLING_MAX_DEG" +msgstr "Max deg" + +#: GeometryGUI_FillingDlg.cxx:150 +msgid "GEOM_FILLING_TOL_2D" +msgstr "Tol. 2D :" + +#: GeometryGUI_FillingDlg.cxx:170 +msgid "GEOM_FILLING_COMPOUND" +msgstr "Curves Comp." + +#: GeometryGUI_FillingDlg.cxx:184 +msgid "GEOM_FILLING_TOL_3D" +msgstr "Tol. 3D :" + +#: GeometryGUI_FillingDlg.cxx:192 +msgid "GEOM_FILLING_NB_ITER" +msgstr "Nb. Iter :" + +#: GeometryGUI_FuseDlg.cxx:48 +msgid "GEOM_FUSE_TITLE" +msgstr "BOOLEAN : Fuse Two Objects" + +#: GeometryGUI_InertiaDlg.cxx:42 +msgid "GEOM_INERTIA_TITLE" +msgstr "Calculs Of Inertia" + +#: GeometryGUI_InertiaDlg.cxx:50 +msgid "GEOM_INERTIA_CONSTR" +msgstr "Matrix And Moments Of Inertia" + +#: GeometryGUI_InertiaDlg.cxx:100 +msgid "GEOM_INERTIA_I" +msgstr "%1:1 :" + +#: GeometryGUI_InertiaDlg.cxx:182 +msgid "GEOM_INERTIA_IXYZ" +msgstr "IX & IY & IZ :" + +#: GeometryGUI_LineDlg.cxx:50 +msgid "GEOM_LINE_TITLE" +msgstr "Line Construction" + +#: GeometryGUI_MaxToleranceDlg.cxx:53 +msgid "GEOM_TOLERANCE_TITLE" +msgstr "Maximum Tolerance" + +#: GeometryGUI_MaxToleranceDlg.cxx:84 +msgid "GEOM_TOLERANCE_CONSTR" +msgstr "Object And Its Tolerances" + +#: GeometryGUI_MaxToleranceDlg.cxx:121 +msgid "GEOM_TOLERANCE_FACE" +msgstr "Face :" + +#: GeometryGUI_MaxToleranceDlg.cxx:138 +msgid "GEOM_TOLERANCE_EDGE" +msgstr "Edge :" + +#: GeometryGUI_MaxToleranceDlg.cxx:155 +msgid "GEOM_TOLERANCE_VERTEX" +msgstr "Vertex :" + +#: GeometryGUI_MirrorDlg.cxx:52 +msgid "GEOM_MIRROR_TITLE" +msgstr "Mirror An Object" + +#: GeometryGUI_OrientationDlg.cxx:46 +msgid "GEOM_ORIENTATION_TITLE" +msgstr "Change Orientation" + +#: GeometryGUI_OrientationDlg.cxx:134 +msgid "GEOM_ORIENTATION_OPT" +msgstr "Reverse orientation with normal vectors simulation" + +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "GEOM_PARTITION_TITLE" +msgstr "Partition Of Object With Tool" + +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "GEOM_KEEP_OBJECT" +msgstr "Keep Object" + +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "GEOM_PARTITION_ORIENTATION" +msgstr "Change Orientation" + +#: GeometryGUI_PartitionDlg.cxx:45 +msgid "SUPPRESS_RESULT" +msgstr "Suppress Result" + +msgid "GEOM_REMOVE_WEBS" +msgstr "Remove webs" + +msgid "GEOM_SET_MATERIALS" +msgstr "Set materials" + +#: OperationGUI_MaterialDlg.cxx:45 +msgid "GEOM_MATERIAL_TITLE" +msgstr "Define materials for Dominant Fuse" + +msgid "GEOM_MATERIAL_SHAPE" +msgstr "Shapes" + +msgid "GEOM_MATERIAL_MATERIAL" +msgstr "Material" + +msgid "GEOM_MATERIAL_ID" +msgstr "Material ID:" + +msgid "GEOM_MATERIAL_SET" +msgstr "<< Set" + +#: GeometryGUI_PipeDlg.cxx:47 +msgid "GEOM_PIPE_TITLE" +msgstr "Pipe Construction" + +#: GeometryGUI_PointDlg.cxx:52 +msgid "GEOM_POINT_TITLE" +msgstr "Point Construction" + +#: GeometryGUI_PlaneDlg.cxx:60 +msgid "GEOM_PLANE_TITLE" +msgstr "Plane Construction" + +#: GeometryGUI_PlaneDlg.cxx:172 +msgid "GEOM_PLANE_PVC" +msgstr "Point + Coordinate Vector" + +#: GeometryGUI_PlaneDlg.cxx:133 +msgid "GEOM_PLANE_PV" +msgstr "Point + Vector" + +#: GeometryGUI_PrismDlg.cxx:54 +msgid "GEOM_PRISM_TITLE" +msgstr "Prism Construction" + +#: GeometryGUI_PrismDlg.cxx:83 +msgid "GEOM_PRISM_BSV" +msgstr "Base Shape + Vector" + +#: GeometryGUI_PropertiesDlg.cxx:56 +msgid "GEOM_PROPERTIES_TITLE" +msgstr "Basic Properties Informations" + +#: GeometryGUI_PropertiesDlg.cxx:78 +msgid "GEOM_PROPERTIES_CONSTR" +msgstr "Object And Its Properties" + +#: GeometryGUI_PropertiesDlg.cxx:114 +msgid "GEOM_PROPERTIES_SURFACE" +msgstr "Surface is :" + +#: GeometryGUI_PropertiesDlg.cxx:120 +msgid "GEOM_PROPERTIES_VOLUME" +msgstr "Volume is :" + +#: GeometryGUI_RevolDlg.cxx:49 +msgid "GEOM_REVOLUTION_TITLE" +msgstr "Construction By Revolution" + +#: GeometryGUI_RotationDlg.cxx:51 +msgid "GEOM_ROTATION_TITLE" +msgstr "Rotation Of An Object" + +#: GeometryGUI_ScaleDlg.cxx:52 +msgid "GEOM_SCALE_TITLE" +msgstr "Scale An Object" + +#: GeometryGUI_PositionDlg.cxx:52 +msgid "GEOM_POSITION_TITLE" +msgstr "Modify the Location of an Object" + +#: GeometryGUI_PositionDlg.cxx:52 +msgid "GEOM_START_LCS" +msgstr "Start LCS" + +#: GeometryGUI_PositionDlg.cxx:52 +msgid "GEOM_END_LCS" +msgstr "End LCS" + +#: GeometryGUI_OffsetDlg.cxx:53 +msgid "GEOM_OFFSET_TITLE" +msgstr "Offset Surface" + +#: GeometryGUI_ScaleDlg.cxx:117 +msgid "GEOM_SCALE_FACTOR" +msgstr "Scale Factor :" + +#: GeometryGUI_SectionDlg.cxx:50 +msgid "GEOM_SECTION_TITLE" +msgstr "BOOLEAN : Section Of Two Objects" + +#: GeometryGUI_SewingDlg.cxx:48 +msgid "GEOM_SEWING_TITLE" +msgstr "Topological sewing" + +#: GeometryGUI_ShellDlg.cxx:53 +msgid "GEOM_SHELL_TITLE" +msgstr "Shell Construction" + +#: GeometryGUI_SolidDlg.cxx:74 +msgid "GEOM_SOLID_TITLE" +msgstr "Solid Construction" + +#: GeometryGUI_SphereDlg.cxx:50 +msgid "GEOM_SPHERE_TITLE" +msgstr "Sphere Construction" + +#: GeometryGUI_SphereDlg.cxx:113 +msgid "GEOM_SPHERE_CR" +msgstr "Center + Radius" + +#: GeometryGUI_SphereDlg.cxx:146 +msgid "GEOM_SPHERE_RO" +msgstr "Radius At Origin" + +#: GeometryGUI_SubShapeDlg.cxx:55 +msgid "GEOM_SUBSHAPE_TITLE" +msgstr "Sub Shapes Selection" + +#: GeometryGUI_SubShapeDlg.cxx:131 +msgid "GEOM_SUBSHAPE_TYPE" +msgstr "Sub Shapes Type :" + +#: GeometryGUI_SubShapeDlg.cxx:137 +msgid "GEOM_SUBSHAPE_SELECT" +msgstr "Select Sub Shapes" + +msgid "EntityGUI_SubShapeDlg::NO_SUBSHAPES_SELECTED" +msgstr "Please, select one or more sub-shapes" + +#: GeometryGUI_TorusDlg.cxx:51 +msgid "GEOM_TORUS_TITLE" +msgstr "Torus Construction" + +#: GeometryGUI_SuppressFacesDlg.cxx:103 +msgid "GEOM_SUPRESSFACE_TITLE" +msgstr "Suppress Faces In An Object" + +#: GeometryGUI_SuppressFacesDlg.cxx:164 +msgid "GEOM_SUPRESSFACE_SELECT" +msgstr "Select Faces To Suppress" + +#: GeometryGUI_TranslationDlg.cxx:78 +msgid "GEOM_TRANSLATION_COOR" +msgstr "Translation With Coordinates" + +msgid "GEOM_TRANSPARENCY_TITLE" +msgstr "Transparency" + +msgid "GEOM_TRANSPARENCY_OPAQUE" +msgstr "Opaque" + +msgid "GEOM_TRANSPARENCY_TRANSPARENT" +msgstr "Transparent" + +msgid "GEOM_SUPPRESSHOLE_TITLE" +msgstr "Suppress holes" + +msgid "GEOM_SUPPRESSHOLE_SELECTFACE" +msgstr "Select the face with hole" + +msgid "GEOM_SUPPRESSHOLE_SELECTWIRE" +msgstr "Select wire on face" + +msgid "GEOM_SUPPRESSHOLE_SELECTFACE_END" +msgstr "Select end face (if hole traversing)" + +msgid "GEOM_SUPPRESSHOLE_SELECTWIRE_END" +msgstr "Select end wire (if hole traversing)" + +msgid "GEOM_SUPPRESSHOLE_FACE_SHELL" +msgstr "Face or shell" + +msgid "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" +msgstr "Select hole(s) on the face" + +#: GeometryGUI_TranslationDlg.cxx:56 +msgid "GEOM_TRANSLATION_TITLE" +msgstr "Translation Of An Object" + +#: GeometryGUI_VectorDlg.cxx:54 +msgid "GEOM_VECTOR_TITLE" +msgstr "Vector Construction" + +#: GeometryGUI_WhatisDlg.cxx:63 +msgid "GEOM_WHATIS_TITLE" +msgstr "Whatis Informations" + +#: GeometryGUI_WhatisDlg.cxx:86 +msgid "GEOM_WHATIS_OBJECT" +msgstr "Object And Its Topological Informations" + +#: GeometryGUI_WireDlg.cxx:46 +msgid "GEOM_WIRE_TITLE" +msgstr "Create A Wire" + +#: GeometryGUI_WireDlg.cxx:103 +msgid "GEOM_WIRE_CONNECT" +msgstr "Wire creation from wires/edges connected" + +#: GeometryGUI_WorkingPlaneDlg.cxx:50 +msgid "GEOM_WPLANE_TITLE" +msgstr "Working Plane Selection" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_FACE" +msgstr "Plane Or Planar Face" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_VECTOR" +msgstr "Select 2 vectors" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_VX" +msgstr "Vector X" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_VZ" +msgstr "Vector Z" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_ORIGIN" +msgstr "Select a plane" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_OYZ" +msgstr "OYZ" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_OZX" +msgstr "OZX" + +#: GeometryGUI_WorkingPlaneDlg.cxx:107 +msgid "GEOM_WPLANE_OXY" +msgstr "OXY" + +#: GeometryGUI_multiTranslationDlg.cxx:107 +msgid "GEOM_MULTITRANSLATION_TITLE" +msgstr "Multi-Translation" + +#: GeometryGUI_multiTranslationDlg.cxx:107 +msgid "GEOM_MULTITRANSLATION_SIMPLE" +msgstr "Multi Translation Simple" + +#: GeometryGUI_multiTranslationDlg.cxx:107 +msgid "GEOM_MULTITRANSLATION_DOUBLE" +msgstr "Multi Translation Double" + +#: GeometryGUI_multiRotationDlg.cxx:107 +msgid "GEOM_MULTIROTATION_TITLE" +msgstr "Multi-Rotation" + +#: GeometryGUI_multiRotationDlg.cxx:107 +msgid "GEOM_MULTIROTATION_SIMPLE" +msgstr "Multi Rotation Simple" + +#: GeometryGUI_multiRotationDlg.cxx:107 +msgid "GEOM_MULTIROTATION_DOUBLE" +msgstr "Multi Rotation Double" + +msgid "GEOM_PARAM_POINT" +msgstr "Parametric point" + +msgid "GEOM_REF_POINT" +msgstr "Point with reference" + +# +#============================================================================== +# + +#: GeometryGUI.cxx:4613 +msgid "GEOM_MEN_WIREFRAME" +msgstr "Wireframe" + +#: GeometryGUI.cxx:4613 +msgid "GEOM_MEN_SHADING" +msgstr "\nShading" + +msgid "GEOM_RECONSTRUCTION_LIMIT" +msgstr "Reconstruction Limit" + +msgid "GEOM_SUPPRESS_RESULT" +msgstr "Suppress Result" + +msgid "GEOM_SUPPRESS_RESULT_INSIDE" +msgstr "Inside" + +msgid "GEOM_SUPPRESS_RESULT_OUTSIDE" +msgstr "Outside" + +msgid "GEOM_RECONSTRUCTION_LIMIT_SHAPE" +msgstr "Shape" +msgid "GEOM_RECONSTRUCTION_LIMIT_SOLID" +msgstr "Solid" +msgid "GEOM_RECONSTRUCTION_LIMIT_SHELL" +msgstr "Shell" +msgid "GEOM_RECONSTRUCTION_LIMIT_FACE" +msgstr "Face" +msgid "GEOM_RECONSTRUCTION_LIMIT_WIRE" +msgstr "Wire" +msgid "GEOM_RECONSTRUCTION_LIMIT_EDGE" +msgstr "Edge" +msgid "GEOM_RECONSTRUCTION_LIMIT_VERTEX" +msgstr "Vertex" + +msgid "GEOM_SPLINE_TITLE" +msgstr "Spline Construction" +msgid "GEOM_SPLINE" +msgstr "Spline" +msgid "GEOM_BEZIER" +msgstr "Bezier" +msgid "GEOM_INTERPOL" +msgstr "Interpolation" + +# +#============================================================================== +# + +msgid "GEOM_SKETCHER_EL" +msgstr "Element Type" + +msgid "GEOM_BUT_CLOSE_SKETCH" +msgstr "Sketch Closure" + +msgid "GEOM_BUT_END_SKETCH" +msgstr "Sketch Validation" + +msgid "GEOM_SKETCHER_TITLE" +msgstr "Sketch Construction" + +msgid "GEOM_SKETCHER_POINT" +msgstr "Point" + +msgid "GEOM_SKETCHER_SEGMENT" +msgstr "Segment" + +msgid "GEOM_SKETCHER_ARC" +msgstr "Arc" + +msgid "GEOM_SKETCHER_DIR" +msgstr "Direction" + +msgid "GEOM_SKETCHER_POINT2" +msgstr "Point :" + +msgid "GEOM_SKETCHER_DEST" +msgstr "Destination" + +msgid "GEOM_SKETCHER_ABS" +msgstr "Absolute" + +msgid "GEOM_SKETCHER_REL" +msgstr "Relative" + +msgid "GEOM_SKETCHER_SEL" +msgstr "Selection" + +msgid "GEOM_SKETCHER_ANGLE" +msgstr "Angle" + +msgid "GEOM_SKETCHER_PER" +msgstr "Perpendicular" + +msgid "GEOM_SKETCHER_TAN" +msgstr "Tangent" + +msgid "GEOM_SKETCHER_VXVY" +msgstr "VX-VY" + +msgid "GEOM_SKETCHER_LENGTH" +msgstr "Length" + +msgid "GEOM_SKETCHER_X" +msgstr "X" + +msgid "GEOM_SKETCHER_Y" +msgstr "Y" + +msgid "GEOM_SKETCHER_X2" +msgstr "X :" + +msgid "GEOM_SKETCHER_Y2" +msgstr "Y :" + +msgid "GEOM_SKETCHER_X3" +msgstr "Abs. X :" + +msgid "GEOM_SKETCHER_Y3" +msgstr "Abs. Y :" + +msgid "GEOM_SKETCHER_DX2" +msgstr "DX :" + +msgid "GEOM_SKETCHER_DY2" +msgstr "DY :" + +msgid "GEOM_SKETCHER_VX2" +msgstr "VX :" + +msgid "GEOM_SKETCHER_VY2" +msgstr "VY :" + +msgid "GEOM_SKETCHER_LENGTH2" +msgstr "Length :" + +msgid "GEOM_SKETCHER_ANGLE2" +msgstr "Angle :" + +msgid "GEOM_SKETCHER_RADIUS2" +msgstr "Radius :" + +msgid "GEOM_SKETCHER_UNDO" +msgstr "Undo" + +msgid "GEOM_SKETCHER_APPLY" +msgstr "Apply" + +msgid "GEOM_SKETCHER_VALUES" +msgstr "Values" + +msgid "GEOM_SKETCHER_TYPE" +msgstr "Type" + +msgid "EntityGUI_SketcherDlg::CANNOT_CLOSE" +msgstr "It is impossible to close sketch\nNumber of sketch points too small" + +msgid "GEOM_FILLET_ABORT" +msgstr "Fillet can't be computed with radius %1" + +msgid "GEOM_CHAMFER_ABORT" +msgstr "Chamfer can't be computed with %1 and %2" + +msgid "GEOM_3_POINTS" +msgstr "3 points" + +msgid "GEOM_POINT1" +msgstr "Point 1" + +msgid "GEOM_POINT2" +msgstr "Point 2" + +msgid "GEOM_POINT3" +msgstr "Point 3" + +msgid "GEOM_CREATE_COPY" +msgstr "Create a copy" + +msgid "GEOM_CREATE_SINGLE_SOLID" +msgstr "Create a single solid" + +msgid "GEOM_ERROR" +msgstr "Error" + +msgid "GEOM_ERROR_STATUS" +msgstr "Operation status" + +msgid "GEOM_ELLIPSE_ERROR_1" +msgstr "Error creating ellipse. Reason: minor radius is greater than major radius." + +msgid "GEOM_CURVE" +msgstr "Curve" + +msgid "GEOM_POLYLINE" +msgstr "Polyline" + +msgid "GEOM_NODES" +msgstr "Nodes" + +msgid "GEOM_CURVE_TITLE" +msgstr "Curve Construction" + +# ShapeProcessDlg.cxx +msgid "GEOM_SHAPEPROCESS_TITLE" +msgstr "Shape Processing" + +msgid "GEOM_SHAPES" +msgstr "Shapes" + +msgid "GEOM_SELECTED_OBJECTS" +msgstr "Selected objects" + +msgid "GEOM_OPERATIONS" +msgstr "Operations" + +msgid "GEOM_PARAMETERS" +msgstr "Parameters" + +msgid "GEOM_FixShape" +msgstr "FixShape" + +msgid "GEOM_FixFaceSize" +msgstr "FixFaceSize" + +msgid "GEOM_DropSmallEdges" +msgstr "DropSmallEdges" + +msgid "GEOM_SplitAngle" +msgstr "SplitAngle" + +msgid "GEOM_SplitClosedFaces" +msgstr "SplitClosedFaces" + +msgid "GEOM_SplitContinuity" +msgstr "SplitContinuity" + +msgid "GEOM_BSplineRestriction" +msgstr "BSplineRestriction" + +msgid "GEOM_ToBezier" +msgstr "ToBezier" + +msgid "GEOM_SameParameter" +msgstr "SameParameter" + +msgid "GEOM_3D_TOLERANCE" +msgstr "3D tolerance" + +msgid "GEOM_MAX_3D_TOLERANCE" +msgstr "Max 3D tolerance" + +msgid "GEOM_MAX_TOLERANCE" +msgstr "Max tolerance" + +msgid "GEOM_ANGLE_1" +msgstr "Angle" + +msgid "GEOM_NUM_SPLIT_POINTS" +msgstr "Number of splitting points" + +msgid "GEOM_SURFACE_CONTINUTY" +msgstr "Surface continuity" + +msgid "GEOM_CURVE_CONTINUTY" +msgstr "Curve continuity" + +msgid "GEOM_SURFACE_MODE" +msgstr "Surface mode" + +msgid "GEOM_3D_CURVE_MODE" +msgstr "3D curve mode" + +msgid "GEOM_2D_CURVE_MODE" +msgstr "2D curve mode" + +msgid "GEOM_2D_TOLERANCE" +msgstr "2D tolerance" + +msgid "GEOM_REQUIRED_DEGREE" +msgstr "Required degree" + +msgid "GEOM_REQUIRED_NUM_SEGMENTS" +msgstr "Required number of segments" + +msgid "GEOM_3D_CONTINUTY" +msgstr "3D continuity" + +msgid "GEOM_2D_CONTINUTY" +msgstr "2D continuity" + +msgid "GEOM_CLOSECONTOUR_TITLE" +msgstr "Close contour" + +msgid "GEOM_ERR_LIB_NOT_FOUND" +msgstr "GUI library corresponding to the user action can not be found or loaded" + +msgid "OperationGUI_ChamferDlg::FACE_1" +msgstr "Face 1" + +msgid "OperationGUI_ChamferDlg::FACE_2" +msgstr "Face 2" + +msgid "OperationGUI_ChamferDlg::SELECTED_FACES" +msgstr "Selected faces" + +msgid "OperationGUI_ChamferDlg::D" +msgstr "D" + +msgid "OperationGUI_FilletDlg::SELECTED_EDGES" +msgstr "Selected edges" + +msgid "OperationGUI_FilletDlg::SELECTED_FACES" +msgstr "Selected faces" + +msgid "GEOM_REMOVE_INTERNAL_WIRES_TITLE" +msgstr "Suppress internal wires" + +msgid "GEOM_INTERNAL_WIRES" +msgstr "Internal wires" + +msgid "GEOM_SELECTED_FACE" +msgstr "Selected face" + +msgid "GEOM_REMOVE_ALL_INT_WIRES" +msgstr "Remove all internal wires" + +msgid "GEOM_REMOVE_HOLES_TITLE" +msgstr "Suppress holes" + +msgid "GEOM_SELECTED_SHAPE" +msgstr "Selected shape" + +msgid "GEOM_REMOVE_ALL_HOLES" +msgstr "Remove all holes" + +msgid "GEOM_HOLES" +msgstr "Holes" + +msgid "GEOM_WIRES_TO_REMOVE" +msgstr "Wires to remove" + +msgid "GEOM_DETECT" +msgstr "Detect" + +msgid "GEOM_FREE_BOUNDARIES" +msgstr "Free boundaries" + +msgid "GEOM_FREE_FACES" +msgstr "Free faces" + +msgid "GEOM_BY_PARAMETER" +msgstr "By parameter" + +msgid "GEOM_BY_LENGTH" +msgstr "By length" + +msgid "GEOM_DIVIDE_EDGE_TITLE" +msgstr "Addition of point" + +msgid "GEOM_ADD_POINT" +msgstr "Add point" + +msgid "GEOM_VALUE" +msgstr "Value" + +msgid "GEOM_MARKER_TITLE" +msgstr "Create marker" + +msgid "GEOM_MARKER" +msgstr "Marker" + +msgid "GEOM_TRIHEDRON" +msgstr "Trihedron" + +msgid "GEOM_FREE_BOUNDS_MSG" +msgstr "Number of free boundaries detected: %1 (%2 closed, %3 open)" + +msgid "GEOM_FREE_BOUNDS_ERROR" +msgstr "Object is not selected" + +msgid "GEOM_FREE_BOUNDS_TLT" +msgstr "Free boundary detection" + +msgid "RepairGUI_FreeBoundDlg::CAPTION" +msgstr "Check free boundaries" + +msgid "RepairGUI_FreeBoundDlg::FREE_BOUND" +msgstr "Free boundaries" + +msgid "RepairGUI_FreeBoundDlg::NUMBER_CLOSED" +msgstr "Number of closed free boundaries: " + +msgid "RepairGUI_FreeBoundDlg::NUMBER_OPEN" +msgstr "Number of open free boundaries: " + +msgid "RepairGUI_ShapeProcessDlg::ERROR_NO_OPERATORS" +msgstr "Please, select at least one Shape Process operation to proceed." + +msgid "RepairGUI_ShapeProcessDlg::ERROR_NO_OBJECTS" +msgstr "Please, select a geometrical object for Shape Processing." + +msgid "RepairGUI_ShapeProcessDlg::TIME_CONSUMING" +msgstr "Enabling this option may result in a very time-consuming operation for some input shapes.\nWould you like to continue?" + +msgid "MeasureGUI_PointDlg::POINT" +msgstr "Point" + +msgid "MeasureGUI_PointDlg::X" +msgstr "X" + +msgid "MeasureGUI_PointDlg::Y" +msgstr "Y" + +msgid "MeasureGUI_PointDlg::Z" +msgstr "Z" + +msgid "MeasureGUI_PointDlg::CAPTION" +msgstr "Point Coordinates" + +msgid "MeasureGUI_PointDlg::COORDINATES" +msgstr "Point and its coordinates" + +msgid "GroupGUI_GroupDlg::CREATE_GROUP_TITLE" +msgstr "Create Group" + +msgid "GroupGUI_GroupDlg::EDIT_GROUP_TITLE" +msgstr "Edit Group" + +msgid "GroupGUI_GroupDlg::SHAPE_TYPE" +msgstr "Shape Type" + +msgid "GroupGUI_GroupDlg::GROUP_NAME" +msgstr "Group Name" + +msgid "GroupGUI_GroupDlg::MAIN_SUB_SHAPES" +msgstr "Main Shape And Sub-Shapes" + +msgid "GroupGUI_GroupDlg::MAIN_SHAPE" +msgstr "Main Shape" + +msgid "GroupGUI_GroupDlg::SELECT_SUB_SHAPES" +msgstr "Select Sub-Shapes" + +msgid "GroupGUI_GroupDlg::SELECT_ALL" +msgstr "Select All" + +msgid "GroupGUI_GroupDlg::ADD" +msgstr "Add" + +msgid "GroupGUI_GroupDlg::REMOVE" +msgstr "Remove" + +msgid "GroupGUI_GroupDlg::GROUP_PREFIX" +msgstr "Group" + +msgid "GroupGUI_GroupDlg::EMPTY_NAME" +msgstr "Please, specify a non-empty group name" + +msgid "GroupGUI_GroupDlg::NO_MAIN_OBJ" +msgstr "Please, select a main shape" + +msgid "GroupGUI_GroupDlg::NO_GROUP" +msgstr "Please, select a group to edit" + +msgid "GroupGUI_GroupDlg::EMPTY_LIST" +msgstr "Please, select one or more sub-shapes to put into the group" + +msgid "GroupGUI::NO_GROUP" +msgstr "Please, select a group to edit" + +msgid "_S_" +msgstr "(s)" + +### BlocksGUI ### + +msgid "WRN_NOT_IMPLEMENTED" +msgstr "Sorry, this functionality is not yet implemented" + +### BlocksGUI_TrsfDlg ### + +msgid "BlocksGUI_TrsfDlg::FACE_1" +msgstr "Face 1" + +msgid "BlocksGUI_TrsfDlg::FACE_2" +msgstr "Face 2" + +msgid "BlocksGUI_TrsfDlg::FACE_1U" +msgstr "Face 1 U" + +msgid "BlocksGUI_TrsfDlg::FACE_2U" +msgstr "Face 2 U" + +msgid "BlocksGUI_TrsfDlg::FACE_1V" +msgstr "Face 1 V" + +msgid "BlocksGUI_TrsfDlg::FACE_2V" +msgstr "Face 2 V" + +msgid "GEOM_BLOCK_MULTITRSF_TITLE" +msgstr "Block Multi-Transformation" + +msgid "GEOM_BLOCK_MULTITRSF" +msgstr "Block Multi-Transformation" + +msgid "GEOM_BLOCK_MULTITRSF_SIMPLE" +msgstr "Multi-Transformation Simple" + +msgid "GEOM_BLOCK_MULTITRSF_DOUBLE" +msgstr "Multi-Transformation Double" + +### BlocksGUI_QuadFaceDlg ### + +msgid "BlocksGUI_QuadFaceDlg::VERTEX_1" +msgstr "Vertex 1" + +msgid "BlocksGUI_QuadFaceDlg::VERTEX_2" +msgstr "Vertex 2" + +msgid "BlocksGUI_QuadFaceDlg::VERTEX_3" +msgstr "Vertex 3" + +msgid "BlocksGUI_QuadFaceDlg::VERTEX_4" +msgstr "Vertex 4" + +msgid "BlocksGUI_QuadFaceDlg::EDGE_1" +msgstr "Edge 1" + +msgid "BlocksGUI_QuadFaceDlg::EDGE_2" +msgstr "Edge 2" + +msgid "BlocksGUI_QuadFaceDlg::EDGE_3" +msgstr "Edge 3" + +msgid "BlocksGUI_QuadFaceDlg::EDGE_4" +msgstr "Edge 4" + +msgid "GEOM_QUAD_FACE_TITLE" +msgstr "Quadrangle Face Construction" + +msgid "GEOM_QUAD_FACE" +msgstr "Quadrangle Face" + +### BlocksGUI_BlockDlg ### + +msgid "BlocksGUI_BlockDlg::FACE_1" +msgstr "Face 1" + +msgid "BlocksGUI_BlockDlg::FACE_2" +msgstr "Face 2" + +msgid "BlocksGUI_BlockDlg::FACE_3" +msgstr "Face 3" + +msgid "BlocksGUI_BlockDlg::FACE_4" +msgstr "Face 4" + +msgid "BlocksGUI_BlockDlg::FACE_5" +msgstr "Face 5" + +msgid "BlocksGUI_BlockDlg::FACE_6" +msgstr "Face 6" + +msgid "GEOM_BLOCK_TITLE" +msgstr "Hexahedral Solid Construction" + +msgid "GEOM_BLOCK" +msgstr "Hexahedral Solid" + +#============================================================================== + +msgid "BasicGUI_MarkerDlg::CAPTION" +msgstr "Local CS Construction" + +msgid "BasicGUI_MarkerDlg::LOCALCS" +msgstr "Local coordinate system" + +msgid "BasicGUI_MarkerDlg::ORIGIN" +msgstr "Coordinates of origin" + +msgid "BasicGUI_MarkerDlg::XDIR" +msgstr "X axis direction" + +msgid "BasicGUI_MarkerDlg::YDIR" +msgstr "Y axis direction" + +msgid "BasicGUI_MarkerDlg::DX" +msgstr "Dx" + +msgid "BasicGUI_MarkerDlg::DY" +msgstr "Dy" + +msgid "BasicGUI_MarkerDlg::DZ" +msgstr "Dz" + +msgid "BasicGUI_MarkerDlg::LCS_NAME" +msgstr "LocalCS" + +msgid "BasicGUI_MarkerDlg::VEC_PARALLEL" +msgstr "Coordinate system axes cannot be parallel" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +======= + +### BlocksGUI_ExplodeDlg ### + +msgid "BlocksGUI_ExplodeDlg::NB_FACES_MIN" +msgstr "Min. nb. faces" + +msgid "BlocksGUI_ExplodeDlg::NB_FACES_MAX" +msgstr "Max. nb. faces" + +msgid "GEOM_BLOCK_EXPLODE_TITLE" +msgstr "Sub Blocks Selection" + +msgid "GEOM_BLOCK_EXPLODE" +msgstr "Sub Blocks" + +msgid "GEOM_NB_BLOCKS_NO_OTHERS" +msgstr "There are %1 specified blocks and NO other solids" + +msgid "GEOM_NB_BLOCKS_SOME_OTHERS" +msgstr "There are %1 specified blocks and some other solids" + +msgid "ShHealOper_NotError_msg" +msgstr "Shape Healing algorithm has done no modification of the original shape" + +msgid "ShHealOper_InvalidParameters_msg" +msgstr "Incorrect parameters for Shape Healing algorithm" + +msgid "ShHealOper_ErrorExecution_msg" +msgstr "Shape Healing algorithm failed" + +msgid "GEOM_GLUE_TITLE" +msgstr "Glue faces" + +msgid "GEOM_GLUE" +msgstr "Glue" + +msgid "GEOM_FREE_FACES_TITLE" +msgstr "Free faces" + +### New object names for RepairGUI ### +msgid "SEWING_NEW_OBJ_NAME" +msgstr "Sewing" + +msgid "DEVIDE_EDGE_NEW_OBJECT_NAME" +msgstr "NewObject" + +msgid "CLOSE_CONTOUR_NEW_OBJ_NAME" +msgstr "CloseContour" + +msgid "REMOVE_HOLES_NEW_OBJ_NAME" +msgstr "SupressHoles" + +msgid "GLUE_NEW_OBJ_NAME" +msgstr "Glue" + +msgid "REMOVE_INT_WIRES_NEW_OBJ_NAME" +msgstr "RemoveIntWires" + +msgid "PROCESS_SHAPE_NEW_OBJ_NAME" +msgstr "ProcessShape" + +msgid "SUPRESS_FACE_NEW_OBJ_NAME" +msgstr "SupressFaces" + +msgid "NON_GEOM_OBJECTS_SELECTED" +msgstr "There are objects selected which do not belong to %1 component." + +msgid "GEOM_PROPAGATE_TITLE" +msgstr "Propagate" + +msgid "GEOM_PROPAGATE" +msgstr "Propagate" + +### Menu of GEOM module ### +msgid "MEN_FILE" +msgstr "File" + +msgid "TOP_IMPORT" +msgstr "Import geometry from BREP file" + +msgid "MEN_IMPORT" +msgstr "Import..." + +msgid "STB_IMPORT" +msgstr "Import geometry from BREP file" + +msgid "TOP_EXPORT" +msgstr "Export geometry to BREP file" + +msgid "MEN_EXPORT" +msgstr "Export..." + +msgid "STB_EXPORT" +msgstr "Export geometry to BREP file" + +msgid "MEN_EDIT" +msgstr "Edit" + +msgid "TOP_DELETE" +msgstr "Delete object" + +msgid "MEN_DELETE" +msgstr "Delete" + +msgid "STB_DELETE" +msgstr "Delete object" + +msgid "MEN_NEW_ENTITY" +msgstr "New Entity" + +msgid "MEN_BASIC" +msgstr "Basic" + +msgid "TOP_POINT" +msgstr "Create a point" + +msgid "MEN_POINT" +msgstr "Point" + +msgid "STB_POINT" +msgstr "Create a point" + +msgid "TOP_LINE" +msgstr "Create a line" + +msgid "MEN_LINE" +msgstr "Line" + +msgid "STB_LINE" +msgstr "Create a line" + +msgid "TOP_CIRCLE" +msgstr "Create a circle" + +msgid "MEN_CIRCLE" +msgstr "Circle" + +msgid "STB_CIRCLE" +msgstr "Create a circle" + +msgid "TOP_ELLIPSE" +msgstr "Create an ellipse" + +msgid "MEN_ELLIPSE" +msgstr "Ellipse" + +msgid "STB_ELLIPSE" +msgstr "Create an ellipse" + +msgid "TOP_ARC" +msgstr "Create an arc" + +msgid "MEN_ARC" +msgstr "Arc" + +msgid "STB_ARC" +msgstr "Create an arc" + +msgid "TOP_CURVE" +msgstr "Create a curve" + +msgid "MEN_CURVE" +msgstr "Curve" + +msgid "STB_CURVE" +msgstr "Create a curve" + +msgid "TOP_VECTOR" +msgstr "Create a vector" + +msgid "MEN_VECTOR" +msgstr "Vector" + +msgid "STB_VECTOR" +msgstr "Create a vector" + +msgid "TOP_PLANE" +msgstr "Create a plane" + +msgid "MEN_PLANE" +msgstr "Plane" + +msgid "STB_PLANE" +msgstr "Create a plane" + +msgid "TOP_WORK_PLANE" +msgstr "Create a working plane" + +msgid "MEN_WORK_PLANE" +msgstr "Working plane" + +msgid "STB_WORK_PLANE" +msgstr "Create a working plane" + +msgid "TOP_LOCAL_CS" +msgstr "Create a local coordinate system" + +msgid "MEN_LOCAL_CS" +msgstr "Local coordinate system" + +msgid "STB_LOCAL_CS" +msgstr "Create a local coordinate system" + +msgid "MEN_PRIMITIVES" +msgstr "Primitives" + +msgid "TOP_BOX" +msgstr "Create a box" + +msgid "MEN_BOX" +msgstr "Box" + +msgid "STB_BOX" +msgstr "Create a box" + +msgid "TOP_CYLINDER" +msgstr "Create a cylinder" + +msgid "MEN_CYLINDER" +msgstr "Cylinder" + +msgid "STB_CYLINDER" +msgstr "Create a cylinder" + +msgid "TOP_SPHERE" +msgstr "Create a sphere" + +msgid "MEN_SPHERE" +msgstr "Sphere" + +msgid "STB_SPHERE" +msgstr "Create a sphere" + +msgid "TOP_TORUS" +msgstr "Create a torus" + +msgid "MEN_TORUS" +msgstr "Torus" + +msgid "STB_TORUS" +msgstr "Create a torus" + +msgid "TOP_CONE" +msgstr "Create a cone" + +msgid "MEN_CONE" +msgstr "Cone" + +msgid "STB_CONE" +msgstr "Create a cone" + +msgid "MEN_GENERATION" +msgstr "Generation" + +msgid "TOP_EXTRUSION" +msgstr "Create an extrusion" + +msgid "MEN_EXTRUSION" +msgstr "Extrusion" + +msgid "STB_EXTRUSION" +msgstr "Create an extrusion" + +msgid "TOP_REVOLUTION" +msgstr "Create a revolution" + +msgid "MEN_REVOLUTION" +msgstr "Revolution" + +msgid "STB_REVOLUTION" +msgstr "Create a revolution" + +msgid "TOP_FILLING" +msgstr "Create a filling" + +msgid "MEN_FILLING" +msgstr "Filling" + +msgid "STB_FILLING" +msgstr "Create a filling" + +msgid "TOP_PIPE" +msgstr "Create a pipe" + +msgid "MEN_PIPE" +msgstr "Pipe" + +msgid "STB_PIPE" +msgstr "Create a pipe" + +msgid "MEN_GROUP" +msgstr "Group" + +msgid "TOP_GROUP_CREATE" +msgstr "Create a group" + +msgid "MEN_GROUP_CREATE" +msgstr "Create" + +msgid "STB_GROUP_CREATE" +msgstr "Create a group" + +msgid "TOP_GROUP_EDIT" +msgstr "Edit a group" + +msgid "MEN_GROUP_EDIT" +msgstr "Edit" + +msgid "STB_GROUP_EDIT" +msgstr "Edit a group" + +msgid "MEN_BLOCKS" +msgstr "Blocks" + +msgid "TOP_Q_FACE" +msgstr "Quadrangle Face" + +msgid "MEN_Q_FACE" +msgstr "Quadrangle Face" + +msgid "STB_Q_FACE" +msgstr "Quadrangle Face" + +msgid "TOP_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "MEN_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "STB_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "TOP_SKETCH" +msgstr "Sketch" + +msgid "MEN_SKETCH" +msgstr "Sketch" + +msgid "STB_SKETCH" +msgstr "Sketch" + +msgid "TOP_EXPLODE" +msgstr "Explode" + +msgid "MEN_EXPLODE" +msgstr "Explode" + +msgid "STB_EXPLODE" +msgstr "Explode" + +msgid "MEN_BUILD" +msgstr "Build" + +msgid "TOP_EDGE" +msgstr "Build an edge" + +msgid "MEN_EDGE" +msgstr "Edge" + +msgid "STB_EDGE" +msgstr "Build an edge" + +msgid "TOP_WIRE" +msgstr "Build a wire" + +msgid "MEN_WIRE" +msgstr "Wire" + +msgid "STB_WIRE" +msgstr "Build a wire" + +msgid "TOP_FACE" +msgstr "Build a face" + +msgid "MEN_FACE" +msgstr "Face" + +msgid "STB_FACE" +msgstr "Build a face" + +msgid "TOP_SHELL" +msgstr "Build a shell" + +msgid "MEN_SHELL" +msgstr "Shell" + +msgid "STB_SHELL" +msgstr "Build a shell" + +msgid "TOP_SOLID" +msgstr "Build a solid" + +msgid "MEN_SOLID" +msgstr "Solid" + +msgid "STB_SOLID" +msgstr "Build a solid" + +msgid "TOP_COMPOUND" +msgstr "Build a compound" + +msgid "MEN_COMPOUND" +msgstr "Compound" + +msgid "STB_COMPOUND" +msgstr "Build a compound" + +msgid "MEN_OPERATIONS" +msgstr "Operations" + +msgid "MEN_BOOLEAN" +msgstr "Boolean" + +msgid "TOP_FUSE" +msgstr "Fuse" + +msgid "MEN_FUSE" +msgstr "Fuse" + +msgid "STB_FUSE" +msgstr "Fuse" + +msgid "TOP_COMMON" +msgstr "Common" + +msgid "MEN_COMMON" +msgstr "Common" + +msgid "STB_COMMON" +msgstr "Common" + +msgid "TOP_CUT" +msgstr "Cut" + +msgid "MEN_CUT" +msgstr "Cut" + +msgid "STB_CUT" +msgstr "Cut" + +msgid "TOP_SECTION" +msgstr "Section" + +msgid "MEN_SECTION" +msgstr "Section" + +msgid "STB_SECTION" +msgstr "Section" + +msgid "MEN_TRANSFORMATION" +msgstr "Transformation" + +msgid "TOP_TRANSLATION" +msgstr "Translation" + +msgid "MEN_TRANSLATION" +msgstr "Translation" + +msgid "STB_TRANSLATION" +msgstr "Translation" + +msgid "TOP_ROTATION" +msgstr "Rotation" + +msgid "MEN_ROTATION" +msgstr "Rotation" + +msgid "STB_ROTATION" +msgstr "Rotation" + +msgid "TOP_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "MEN_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "STB_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "TOP_MIRROR" +msgstr "Mirror image" + +msgid "MEN_MIRROR" +msgstr "Mirror image" + +msgid "STB_MIRROR" +msgstr "Mirror image" + +msgid "TOP_SCALE" +msgstr "Scale transform" + +msgid "MEN_SCALE" +msgstr "Scale transform" + +msgid "STB_SCALE" +msgstr "Scale transform" + +msgid "TOP_OFFSET" +msgstr "Offset surface" + +msgid "MEN_OFFSET" +msgstr "Offset surface" + +msgid "STB_OFFSET" +msgstr "Offset surface" + +msgid "TOP_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "MEN_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "STB_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "TOP_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "MEN_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "STB_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "TOP_PARTITION" +msgstr "Partition" + +msgid "MEN_PARTITION" +msgstr "Partition" + +msgid "STB_PARTITION" +msgstr "Partition" + +msgid "TOP_ARCHIMEDE" +msgstr "Archimede" + +msgid "MEN_ARCHIMEDE" +msgstr "Archimede" + +msgid "STB_ARCHIMEDE" +msgstr "Archimede" + +msgid "TOP_FILLET" +msgstr "Fillet" + +msgid "MEN_FILLET" +msgstr "Fillet" + +msgid "STB_FILLET" +msgstr "Fillet" + +msgid "TOP_CHAMFER" +msgstr "Chamfer" + +msgid "MEN_CHAMFER" +msgstr "Chamfer" + +msgid "STB_CHAMFER" +msgstr "Chamfer" + +msgid "TOP_CLIPPING" +msgstr "Clipping range" + +msgid "MEN_CLIPPING" +msgstr "Clipping range" + +msgid "STB_CLIPPING" +msgstr "Clipping range" + +msgid "TOP_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "MEN_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "STB_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "TOP_EXPLODE_BLOCKS" +msgstr "Explode on Blocks" + +msgid "MEN_EXPLODE_BLOCKS" +msgstr "Explode on Blocks" + +msgid "STB_EXPLODE_BLOCKS" +msgstr "Explode on Blocks" + +msgid "TOP_PROPAGATE" +msgstr "Propagate" + +msgid "MEN_PROPAGATE" +msgstr "Propagate" + +msgid "STB_PROPAGATE" +msgstr "Propagate" + +msgid "MEN_REPAIR" +msgstr "Repair" + +msgid "TOP_SHAPE_PROCESS" +msgstr "Perform shape processing" + +msgid "MEN_SHAPE_PROCESS" +msgstr "Shape processing" + +msgid "STB_SHAPE_PROCESS" +msgstr "Perform shape processing " + +msgid "TOP_SUPPRESS_FACES" +msgstr "Perform suppress faces" + +msgid "MEN_SUPPRESS_FACES" +msgstr "Suppress faces" + +msgid "STB_SUPPRESS_FACES" +msgstr "Perform suppress faces" + +msgid "TOP_CLOSE_CONTOUR" +msgstr "Perform close contour" + +msgid "MEN_CLOSE_CONTOUR" +msgstr "Close contour" + +msgid "STB_CLOSE_CONTOUR" +msgstr "Perform close contour" + +msgid "TOP_SUPPRESS_INT_WIRES" +msgstr "Perform suppress internal wires" + +msgid "MEN_SUPPRESS_INT_WIRES" +msgstr "Suppress internal wires" + +msgid "STB_SUPPRESS_INT_WIRES" +msgstr "Perform suppress internal wires" + +msgid "TOP_SUPPERSS_HOLES" +msgstr "Perform suppress holes" + +msgid "MEN_SUPPERSS_HOLES" +msgstr "Suppress holes" + +msgid "STB_SUPPERSS_HOLES" +msgstr "Perform suppress holes" + +msgid "TOP_SEWING" +msgstr "Perform sewing" + +msgid "MEN_SEWING" +msgstr "Sewing" + +msgid "STB_SEWING" +msgstr "Perform sewing" + +msgid "TOP_GLUE_FACES" +msgstr "Perform glue faces" + +msgid "MEN_GLUE_FACES" +msgstr "Glue faces" + +msgid "STB_GLUE_FACES" +msgstr "Perform glue faces" + +msgid "TOP_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "MEN_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "STB_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "TOP_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "MEN_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "STB_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "TOP_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "MEN_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "STB_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "MEN_MEASURES" +msgstr "Measures" + +msgid "TOP_POINT_COORDS" +msgstr "Point coordinates" + +msgid "MEN_POINT_COORDS" +msgstr "Point coordinates" + +msgid "STB_POINT_COORDS" +msgstr "Point coordinates" + +msgid "TOP_BASIC_PROPS" +msgstr "Basic properties" + +msgid "MEN_BASIC_PROPS" +msgstr "Basic properties" + +msgid "STB_BASIC_PROPS" +msgstr "Basic properties" + +msgid "TOP_MASS_CENTER" +msgstr "Compute center of mass" + +msgid "MEN_MASS_CENTER" +msgstr "Center of mass" + +msgid "STB_MASS_CENTER" +msgstr "Compute center of mass" + +msgid "TOP_INERTIA" +msgstr "Compute intertia" + +msgid "MEN_INERTIA" +msgstr "Inertia" + +msgid "STB_INERTIA" +msgstr "Compute intertia" + +msgid "MEN_DIMENSIONS" +msgstr "Dimensions" + +msgid "TOP_BND_BOX" +msgstr "Compute bounding box" + +msgid "MEN_BND_BOX" +msgstr "Bounding box" + +msgid "STB_BND_BOX" +msgstr "Compute bounding box" + +msgid "TOP_MIN_DIST" +msgstr "Compute minimum distance" + +msgid "MEN_MIN_DIST" +msgstr "Min distance" + +msgid "STB_MIN_DIST" +msgstr "Compute minimum distance" + +msgid "TOP_TOLERANCE" +msgstr "Compute tolerance" + +msgid "MEN_TOLERANCE" +msgstr "Compute tolerance" + +msgid "STB_TOLERANCE" +msgstr "Compute tolerance" + +msgid "TOP_WHAT_IS" +msgstr "What is" + +msgid "MEN_WHAT_IS" +msgstr "What is" + +msgid "STB_WHAT_IS" +msgstr "What is" + +msgid "TOP_CHECK" +msgstr "Check" + +msgid "MEN_CHECK" +msgstr "Check" + +msgid "STB_CHECK" +msgstr "Check" + +msgid "TOP_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "MEN_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "STB_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "MEN_TOOLS" +msgstr "Tools" + +msgid "TOP_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "MEN_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "STB_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "MEN_PREFERENCES" +msgstr "Preferences" + +msgid "MEN_PREFERENCES_GEOM" +msgstr "Geometry" + +msgid "TOP_SHADING_COLOR" +msgstr "Set shading color" + +msgid "MEN_SHADING_COLOR" +msgstr "Shading color" + +msgid "STB_SHADING_COLOR" +msgstr "Set shading color" + +msgid "TOP_ISOS" +msgstr "Set number of isolines" + +msgid "MEN_ISOS" +msgstr "Isos" + +msgid "STB_ISOS" +msgstr "Set number of isolines" + +msgid "TOP_STEP_VALUE" +msgstr "Set step value" + +msgid "MEN_STEP_VALUE" +msgstr "Step value" + +msgid "STB_STEP_VALUE" +msgstr "Set step value" + +msgid "MEN_VIEW" +msgstr "View" + +msgid "MEN_DISPLAY_MODE" +msgstr "Display mode" + +msgid "TOP_SHADING" +msgstr "Shading" + +msgid "MEN_SHADING" +msgstr "Shading" + +msgid "MEN_WIREFRAME" +msgstr "Wireframe" + +msgid "STB_SHADING" +msgstr "Shading" + +msgid "TOP_DISPLAY_ALL" +msgstr "Display all" + +msgid "MEN_DISPLAY_ALL" +msgstr "Display all" + +msgid "STB_DISPLAY_ALL" +msgstr "Display all" + +msgid "TOP_ERASE_ALL" +msgstr "Erase all" + +msgid "MEN_ERASE_ALL" +msgstr "Erase all" + +msgid "STB_ERASE_ALL" +msgstr "Erase all" + +msgid "TOP_DISPLAY" +msgstr "Display" + +msgid "MEN_DISPLAY" +msgstr "Display" + +msgid "STB_DISPLAY" +msgstr "Display" + +msgid "TOP_DISPLAY_ONLY" +msgstr "Display only" + +msgid "MEN_DISPLAY_ONLY" +msgstr "Display only" + +msgid "STB_DISPLAY_ONLY" +msgstr "Display only" + +msgid "TOP_ERASE" +msgstr "Erase" + +msgid "MEN_ERASE" +msgstr "Erase" + +msgid "STB_ERASE" +msgstr "Erase" + +msgid "TOP_POP_RENAME" +msgstr "Rename" + +msgid "MEN_POP_RENAME" +msgstr "Rename" + +msgid "STB_POP_RENAME" +msgstr "Rename" + +msgid "TOP_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "MEN_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "STB_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "TOP_POP_SHADING" +msgstr "Shading" + +msgid "MEN_POP_SHADING" +msgstr "Shading" + +msgid "STB_POP_SHADING" +msgstr "Shading" + +msgid "TOP_POP_COLOR" +msgstr "Color" + +msgid "MEN_POP_COLOR" +msgstr "Color" + +msgid "STB_POP_COLOR" +msgstr "Color" + +msgid "TOP_POP_TRANSPARENCY" +msgstr "Transparency" + +msgid "MEN_POP_TRANSPARENCY" +msgstr "Transparency" + +msgid "STB_POP_TRANSPARENCY" +msgstr "Transparency" + +msgid "TOP_POP_ISOS" +msgstr "Isolines" + +msgid "MEN_POP_ISOS" +msgstr "Isos" + +msgid "STB_POP_ISOS" +msgstr "Isolines" + +msgid "TOP_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "MEN_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "STB_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "TOOL_BASIC" +msgstr "Basic" + +msgid "TOOL_PRIMITIVES" +msgstr "Primitives" + +msgid "TOOL_BOOLEAN" +msgstr "Boolean operations" + +msgid "TOOL_GENERATION" +msgstr "Generation" + +msgid "TOOL_TRANSFORMATION" +msgstr "Transformation" + +msgid "TLT_RENAME" +msgstr "Rename" + +msgid "NAME_LBL" +msgstr "Name: " + +msgid "GEOM_ERR_GET_ENGINE" +msgstr "Failed to obtain GEOM Engine component. Reload Geometry module and try again." + +msgid "PREF_GROUP_OCCVIEWER" +msgstr "OCC Viewer 3d" + +msgid "PREF_GROUP_GENERAL" +msgstr "General" + +msgid "PREF_SHADING_COLOR" +msgstr "Default shading color" + +msgid "PREF_STEP_VALUE" +msgstr "Step value for spin boxes" + +msgid "PREF_DISPLAY_MODE" +msgstr "Default display mode" + +msgid "PREF_TAB_SETTINGS" +msgstr "Settings" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx new file mode 100644 index 000000000..04cf3d313 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -0,0 +1,1648 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "GeometryGUI.h" +#include "GEOMGUI_OCCSelector.h" +#include "GEOMGUI_Selection.h" +#include "GEOM_Displayer.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// External includes +#include +#include + +#include +#include +#include + +#include + +#include +#include + + +extern "C" { + Standard_EXPORT CAM_Module* createModule() { + return new GeometryGUI(); + } +} + + + +GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil(); + +GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen() { return GeometryGUI::myComponentGeom; } + +bool GeometryGUI::InitGeomGen() +{ + GeometryGUI aGG; + if( CORBA::is_nil( myComponentGeom ) ) return false; + return true; +} + +//======================================================================= +// function : ClientSObjectToObject +// purpose : +//======================================================================= +CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject) +{ + _PTR(GenericAttribute) anAttr; + CORBA::Object_var anObj; + try { + std::string aValue = theSObject->GetIOR(); + if (strcmp(aValue.c_str(), "") != 0) { + CORBA::ORB_ptr anORB = SalomeApp_Application::orb(); + anObj = anORB->string_to_object(aValue.c_str()); + } + } catch(...) { + INFOS("ClientSObjectToObject - Unknown exception was occured!!!"); + } + return anObj._retn(); +} + +//======================================================================= +// function : ClientStudyToStudy +// purpose : +//======================================================================= +SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy) +{ + SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); + CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager"); + SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject); + int aStudyID = theStudy->StudyId(); + SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID); + return aDSStudy._retn(); +} + +//================================================================================= +// class : CustomItem +// purpose : Set Font to a text. +//================================================================================= +class CustomItem : public QCustomMenuItem +{ +public: + CustomItem(const QString& s, const QFont& f) : myString(s), myFont(f) {} + ~CustomItem() {} + + void paint(QPainter* p, const QColorGroup& cg, bool act, bool /*enabled*/, int x, int y, int w, int h) + { + p->save(); + p->fillRect( x, y, w, h, act ? cg.highlight() : cg.mid() ); + p->setPen( act ? cg.highlightedText() : cg.buttonText() ); + p->setFont( myFont ); + p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString ); + p->restore(); + } + + QSize sizeHint() + { + return QFontMetrics( myFont ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString ); + } + + bool fullSpan() const + { + return true; + } + +private: + QString myString; + QFont myFont; +}; + +//======================================================================= +// function : GeometryGUI::GeometryGUI() +// purpose : Constructor +//======================================================================= +GeometryGUI::GeometryGUI() : + SalomeApp_Module( "GEOM" ) +{ + if ( CORBA::is_nil( myComponentGeom ) ) + { + SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() ); + Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + myComponentGeom = GEOM::GEOM_Gen::_narrow( comp ); + } + + myState = -1; + myActiveDialogBox = 0; + myFatherior = ""; + + gp_Pnt origin = gp_Pnt(0., 0., 0.); + gp_Dir direction = gp_Dir(0., 0., 1.); + myWorkingPlane = gp_Ax3(origin, direction); + + myOCCSelectors.setAutoDelete( true ); + myVTKSelectors.setAutoDelete( true ); + + myDisplayer = 0; +} + +//======================================================================= +// function : GeometryGUI::~GeometryGUI() +// purpose : Destructor +//======================================================================= +GeometryGUI::~GeometryGUI() +{ +} + +//======================================================================= +// function : GeometryGUI::getLibrary() +// purpose : get or load GUI library by name [ internal ] +//======================================================================= +typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* ); +GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) +{ + if ( !myGUIMap.contains( libraryName ) ) { + // try to load library if it is not loaded yet + QCString libs; +#ifndef WNT + if( ( libs = getenv( "LD_LIBRARY_PATH" ) ) ) { + QStringList dirList = QStringList::split( ":", libs, false ); // skip empty entries +#else + if( ( libs = getenv( "PATH" ) ) ) { + QStringList dirList = QStringList::split( ";", libs, false ); // skip empty entries +#endif + for( int i = dirList.count()-1; i >= 0; i-- ) { + QString dir = dirList[ i ]; + QFileInfo fi( Qtx::addSlash( dirList[ i ] ) + libraryName ); + if( fi.exists() ) { + OSD_SharedLibrary aSharedLibrary( (char*)fi.fileName().latin1() ); + bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY ); + if( !res ) { + MESSAGE( "Can't open library : " << aSharedLibrary.DlError() ); + continue; // continue search further + } + OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" ); + if ( osdF != NULL ) { + LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF; + GEOMGUI* libGUI = (*func)(this); + if ( libGUI ) { + myGUIMap[ libraryName ] = libGUI; + break; // found and loaded! + } + } + } + } + } + } + if ( myGUIMap.contains( libraryName ) ) + // library is successfully loaded + return myGUIMap[ libraryName ]; + return 0; +} + +//======================================================================= +// function : GeometryGUI::ActiveWorkingPlane() +// purpose : Activate Working Plane View +//======================================================================= +void GeometryGUI::ActiveWorkingPlane() +{ + gp_Dir DZ = myWorkingPlane.Direction(); + gp_Dir DY = myWorkingPlane.YDirection(); + + SUIT_ViewWindow* window = application()->desktop()->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + + if( ViewOCC ) { + OCCViewer_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + Handle(V3d_View) view3d = vw->getViewPort()->getView(); + + view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z()); + view3d->SetUp(DY.X(), DY.Y(), DY.Z()); + + vw->onViewFitAll(); + } + } + else if( ViewVTK ) { + SVTK_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + vtkCamera* camera = vw->getRenderer()->GetActiveCamera(); + + camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z()); + camera->SetViewUp(DY.X(), DY.Y(), DY.Z()); + camera->SetFocalPoint(0,0,0); + + vw->onFitAll(); + } + } +} + +//======================================================================= +// function : GeometryGUI::SetActiveDialogBox() +// purpose : Set active dialog box +//======================================================================= +void GeometryGUI::SetActiveDialogBox( QDialog* aDlg ) +{ + myActiveDialogBox = (QDialog*)aDlg; +} + +//======================================================================= +// function : GeometryGUI::EmitSignalDeactivateDialog() +// purpose : Emit a signal to deactivate the active dialog Box +//======================================================================= +void GeometryGUI::EmitSignalDeactivateDialog() +{ + emit SignalDeactivateActiveDialog(); +} + +//======================================================================= +// function : GeometryGUI::EmitSignalCloseAllDialogs() +// purpose : Emit a signal to close all non modal dialogs box +//======================================================================= +void GeometryGUI::EmitSignalCloseAllDialogs() +{ + emit SignalCloseAllDialogs(); +} + +//======================================================================= +// function : GeometryGUI::EmitSignalDefaultStepValueChanged() +// purpose : Emit a signal to inform that default real spin box step has +// been changed +//======================================================================= +void GeometryGUI::EmitSignalDefaultStepValueChanged(double newVal) +{ + emit SignalDefaultStepValueChanged(newVal); +} + +//======================================================================= +// function : GeometryGUI::OnGUIEvent() +// purpose : common slot for all menu/toolbar actions +//======================================================================= +void GeometryGUI::OnGUIEvent() +{ + const QObject* obj = sender(); + if ( !obj || !obj->inherits( "QAction" ) ) + return; + int id = actionId((QAction*)obj); + if ( id != -1 ) + OnGUIEvent( id ); +} + +//======================================================================= +// function : GeometryGUI::OnGUIEvent() +// purpose : manage all events on GUI [static] +//======================================================================= +void GeometryGUI::OnGUIEvent( int id ) +{ + SUIT_Desktop* desk = application()->desktop(); + + // check type of the active viewframe + SUIT_ViewWindow* window = desk->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + // if current viewframe is not of OCC and not of VTK type - return immediately + // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example) + bool NotViewerDependentCommand = ( id == 901 || id == 216 || id == 213 ); + if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommand ) + return; + + // fix for IPAL9103, point 2 + if ( CORBA::is_nil( GetGeomGen() ) ) { + SUIT_MessageBox::error1( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_GET_ENGINE" ), tr( "GEOM_BUT_OK" ) ); + return; + } + + GEOMGUI* library = 0; + // try to get-or-load corresponding GUI library + if( id == 111 || // MENU FILE - IMPORT BREP + id == 112 || // MENU FILE - IMPORT IGES + id == 113 || // MENU FILE - IMPORT STEP + id == 121 || // MENU FILE - EXPORT BREP + id == 122 || // MENU FILE - EXPORT IGES + id == 123 || // MENU FILE - EXPORT STEP + id == 31 || // MENU EDIT - COPY + id == 33 || // MENU EDIT - DELETE + id == 411 || // MENU SETTINGS - ADD IN STUDY + id == 412 || // MENU SETTINGS - SHADING COLOR + id == 413 || // MENU SETTINGS - ISOS + id == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + id == 5103 || // MENU TOOLS - CHECK GEOMETRY + id == 8032 || // POPUP VIEWER - COLOR + id == 8033 || // POPUP VIEWER - TRANSPARENCY + id == 8034 || // POPUP VIEWER - ISOS + id == 804 || // POPUP VIEWER - ADD IN STUDY + id == 901 || // OBJECT BROWSER - RENAME + id == 9024 ) { // OBJECT BROWSER - OPEN + //cout << "id " << id << " received" << endl; +#ifndef WNT + library = getLibrary( "libGEOMToolsGUI.so" ); +#else + library = getLibrary( "GEOMToolsGUI.dll" ); +#endif + } + else if( id == 211 || // MENU VIEW - WIREFRAME/SHADING + id == 212 || // MENU VIEW - DISPLAY ALL + id == 213 || // MENU VIEW - DISPLAY ONLY + id == 214 || // MENU VIEW - ERASE ALL + id == 215 || // MENU VIEW - ERASE + id == 216 || // MENU VIEW - DISPLAY + id == 80311 || // POPUP VIEWER - WIREFRAME + id == 80312 ) { // POPUP VIEWER - SHADING +#ifndef WNT + library = getLibrary( "libDisplayGUI.so" ); +#else + library = getLibrary( "DisplayGUI.dll" ); +#endif + } + else if( id == 4011 || // MENU BASIC - POINT + id == 4012 || // MENU BASIC - LINE + id == 4013 || // MENU BASIC - CIRCLE + id == 4014 || // MENU BASIC - ELLIPSE + id == 4015 || // MENU BASIC - ARC + id == 4016 || // MENU BASIC - VECTOR + id == 4017 || // MENU BASIC - PLANE + id == 4018 || // MENU BASIC - WPLANE + id == 4019 || // MENU BASIC - CURVE + id == 4020 ) { // MENU BASIC - REPAIR +#ifndef WNT + library = getLibrary( "libBasicGUI.so" ); +#else + library = getLibrary( "BasicGUI.dll" ); +#endif + } + else if( id == 4021 || // MENU PRIMITIVE - BOX + id == 4022 || // MENU PRIMITIVE - CYLINDER + id == 4023 || // MENU PRIMITIVE - SPHERE + id == 4024 || // MENU PRIMITIVE - TORUS + id == 4025 ) { // MENU PRIMITIVE - CONE +#ifndef WNT + library = getLibrary( "libPrimitiveGUI.so" ); +#else + library = getLibrary( "PrimitiveGUI.dll" ); +#endif + } + else if( id == 4031 || // MENU GENERATION - PRISM + id == 4032 || // MENU GENERATION - REVOLUTION + id == 4033 || // MENU GENERATION - FILLING + id == 4034 ) { // MENU GENERATION - PIPE +#ifndef WNT + library = getLibrary( "libGenerationGUI.so" ); +#else + library = getLibrary( "GenerationGUI.dll" ); +#endif + } + else if( id == 404 || // MENU ENTITY - SKETCHER + id == 407 ) { // MENU ENTITY - EXPLODE +#ifndef WNT + library = getLibrary( "libEntityGUI.so" ); +#else + library = getLibrary( "EntityGUI.dll" ); +#endif + } + else if( id == 4081 || // MENU BUILD - EDGE + id == 4082 || // MENU BUILD - WIRE + id == 4083 || // MENU BUILD - FACE + id == 4084 || // MENU BUILD - SHELL + id == 4085 || // MENU BUILD - SOLID + id == 4086 ) { // MENU BUILD - COMPUND +#ifndef WNT + library = getLibrary( "libBuildGUI.so" ); +#else + library = getLibrary( "BuildGUI.dll" ); +#endif + } + else if( id == 5011 || // MENU BOOLEAN - FUSE + id == 5012 || // MENU BOOLEAN - COMMON + id == 5013 || // MENU BOOLEAN - CUT + id == 5014 ) { // MENU BOOLEAN - SECTION +#ifndef WNT + library = getLibrary( "libBooleanGUI.so" ); +#else + library = getLibrary( "BooleanGUI.dll" ); +#endif + } + else if( id == 5021 || // MENU TRANSFORMATION - TRANSLATION + id == 5022 || // MENU TRANSFORMATION - ROTATION + id == 5023 || // MENU TRANSFORMATION - LOCATION + id == 5024 || // MENU TRANSFORMATION - MIRROR + id == 5025 || // MENU TRANSFORMATION - SCALE + id == 5026 || // MENU TRANSFORMATION - OFFSET + id == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION + id == 5028 ) { // MENU TRANSFORMATION - MULTI-ROTATION +#ifndef WNT + library = getLibrary( "libTransformationGUI.so" ); +#else + library = getLibrary( "TransformationGUI.dll" ); +#endif + } + else if( id == 503 || // MENU OPERATION - PARTITION + id == 504 || // MENU OPERATION - ARCHIMEDE + id == 505 || // MENU OPERATION - FILLET + id == 506 || // MENU OPERATION - CHAMFER + id == 507 ) { // MENU OPERATION - CLIPPING RANGE +#ifndef WNT + library = getLibrary( "libOperationGUI.so" ); +#else + library = getLibrary( "OperationGUI.dll" ); +#endif + } + else if( id == 601 || // MENU REPAIR - SEWING + id == 603 || // MENU REPAIR - SUPPRESS FACES + id == 604 || // MENU REPAIR - SUPPRESS HOLE + id == 605 || // MENU REPAIR - SHAPE PROCESSING + id == 606 || // MENU REPAIR - CLOSE CONTOUR + id == 607 || // MENU REPAIR - REMOVE INTERNAL WIRES + id == 608 || // MENU REPAIR - ADD POINT ON EDGE + id == 609 || // MENU REPAIR - FREE BOUNDARIES + id == 610 || // MENU REPAIR - FREE FACES + id == 602 ) { // MENU REPAIR - GLUE FACES +#ifndef WNT + library = getLibrary( "libRepairGUI.so" ); +#else + library = getLibrary( "RepairGUI.dll" ); +#endif + } + else if( id == 701 || // MENU MEASURE - PROPERTIES + id == 702 || // MENU MEASURE - CDG + id == 703 || // MENU MEASURE - INERTIA + id == 7041 || // MENU MEASURE - BOUNDING BOX + id == 7042 || // MENU MEASURE - MIN DISTANCE + id == 705 || // MENU MEASURE - TOLERANCE + id == 706 || // MENU MEASURE - WHATIS + id == 707 || // MENU MEASURE - CHECK + id == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS + id == 708 ) { // MENU MEASURE - POINT COORDINATES +#ifndef WNT + library = getLibrary( "libMeasureGUI.so" ); +#else + library = getLibrary( "MeasureGUI.dll" ); +#endif + } + else if( id == 800 || // MENU GROUP - CREATE + id == 8001 || // POPUP MENU - CREATE GROUP + id == 801 ) { // MENU GROUP - EDIT +#ifndef WNT + library = getLibrary( "libGroupGUI.so" ); +#else + library = getLibrary( "GroupGUI.dll" ); +#endif + } + else if( id == 9999 || // MENU BLOCKS - HEXAHEDRAL SOLID + id == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION + id == 9997 || // MENU BLOCKS - QUADRANGLE FACE + id == 99991 || // MENU BLOCKS - PROPAGATE + id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS +#ifndef WNT + library = getLibrary( "libBlocksGUI.so" ); +#else + library = getLibrary( "BlocksGUI.dll" ); +#endif + } + + // call method of corresponding GUI library + if ( library ) + library->OnGUIEvent( id, desk ); + else + SUIT_MessageBox::error1( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) ); +} + + +//================================================================================= +// function : GeometryGUI::OnKeyPress() +// purpose : Called when any key is pressed by user [static] +//================================================================================= +bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win ) +{ + GUIMap::Iterator it; + bool bOk = true; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win ); + return bOk; +} + + +//================================================================================= +// function : GeometryGUI::OnMouseMove() +// purpose : Manages mouse move events [static] +//================================================================================= +bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win ) +{ + GUIMap::Iterator it; + bool bOk = true; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win ); + return bOk; +} + + +//================================================================================= +// function : GeometryGUI::0nMousePress() +// purpose : Manage mouse press events [static] +//================================================================================= +bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win ) +{ + GUIMap::Iterator it; + // OnMousePress() should return false if this event should be processed further + // (see OCCViewer_Viewer3d::onMousePress() for explanation) + bool processed = false; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win ); + return processed; +} + +/* +static void UpdateVtkSelection() +{ + QPtrList winList = application()->desktop()->windows(); + SUIT_ViewWindow* win = 0; + for ( win = winList.first(); win; win = winList.next() ) { + if ( win->getViewManager()->getTypeView() == VIEW_VTK ) { + SVTK_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + SVTK_RenderWindowInteractor* anInteractor = vw->getRWInteractor(); + anInteractor->SetSelectionProp(); + anInteractor->SetSelectionTolerance(); + SVTK_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME(); + if (aStyle) { + aStyle->setPreselectionProp(); + } + } + } + } +} + +//================================================================================= +// function : GeometryGUI::SetSettings() +// purpose : Called when GEOM module is activated [static] +//================================================================================= +bool GeometryGUI::SetSettings() +{ + QMenuBar* Mb = parent->getMainMenuBar(); + SUIT_Study* ActiveStudy = application()->activeStudy(); + +// Wireframe or Shading + int DisplayMode = 0; + SUIT_ViewWindow* window = application()->desktop()->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == VIEW_OCC ); + bool ViewVTK = ( window && window->getViewManager()->getType() == VIEW_VTK ); + if ( ViewOCC ) { + OCCViewer_ViewManager* vm = dynamic_cast( window->getViewManager() ); + if ( vm ) { + Handle(AIS_InteractiveContext) ic = vm->getOCCViewer()->getAISContext(); + DisplayMode = ic->DisplayMode(); + } + } + else if ( ViewVTK ) { + SVTK_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + SVTK_RenderWindowInteractor* myRenderInter = vw->getRWInteractor(); + DisplayMode = myRenderInter->GetDisplayMode(); + } + } + + if( DisplayMode == 1 ) + getApp()-> + Mb->changeItem( 211, tr( "GEOM_MEN_WIREFRAME" ) ); + else + Mb->changeItem( 211, tr( "GEOM_MEN_SHADING" ) ); + + + // Add in Study - !!!ALWAYS TRUE!!! /////// VSR : TO BE REMOVED + QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); + int Settings_AddInStudy; + // if(!AddInStudy.isEmpty()) + // Settings_AddInStudy = AddInStudy.toInt(); + // else + + Settings_AddInStudy = 1; + Mb->setItemChecked(411, Settings_AddInStudy); + + // step value + QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + if(S.isEmpty()) + QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100"); + + // isos + int count = ActiveStudy->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); + QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + if(!IsoU.isEmpty()) + ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); + if(!IsoV.isEmpty()) + ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); + } + } + + setActionsEnabled(); + + // PAL5356: update VTK selection + ::UpdateVtkSelection(); + bool bOk = true; + GUIMap::Iterator it; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + bOk = bOk && it.data()->SetSettings( parent ); + + // MZN: Enable/disable "Clipping range" menu item(from GEOM_CLIPPING variable) + if (getenv( "GEOM_CLIPPING" ) == NULL) + { + QMenuItem* mi = Mb->findItem(50); + if (mi && mi->popup()) + mi->popup()->removeItem(507); + } + + return bOk; +} +*/ + +//======================================================================= +// function : createGeomAction +// purpose : +//======================================================================= +void GeometryGUI::createGeomAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) +{ + QIconSet icon; + QWidget* parent = application()->desktop(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QPixmap pix; + if ( icon_id.length() ) + pix = resMgr->loadPixmap( "GEOM", tr( icon_id ) ); + else + pix = resMgr->loadPixmap( "GEOM", tr( QString( "ICO_" )+po_id ), false ); + if ( !pix.isNull() ) + icon = QIconSet( pix ); + + QString tooltip = tr( QString( "TOP_" )+po_id ), + menu = tr( QString( "MEN_" )+po_id ), + status_bar = tr( QString( "STB_" )+po_id ); + + createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); +} + + + +//======================================================================= +// function : GeometryGUI::Deactivate() +// purpose : Called when GEOM module is deactivated [ static ] +//======================================================================= +void GeometryGUI::initialize( CAM_Application* app ) +{ + SalomeApp_Module::initialize( app ); + + // ----- create actions -------------- + + createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) ); + createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) ); + + createGeomAction( 33, "DELETE" ); + + createGeomAction( 4011, "POINT" ); + createGeomAction( 4012, "LINE" ); + createGeomAction( 4013, "CIRCLE" ); + createGeomAction( 4014, "ELLIPSE" ); + createGeomAction( 4015, "ARC" ); + createGeomAction( 4019, "CURVE" ); + createGeomAction( 4016, "VECTOR" ); + createGeomAction( 4017, "PLANE" ); + createGeomAction( 4018, "WORK_PLANE" ); + createGeomAction( 4020, "LOCAL_CS" ); + + createGeomAction( 4021, "BOX" ); + createGeomAction( 4022, "CYLINDER" ); + createGeomAction( 4023, "SPHERE" ); + createGeomAction( 4024, "TORUS" ); + createGeomAction( 4025, "CONE" ); + + createGeomAction( 4031, "EXTRUSION" ); + createGeomAction( 4032, "REVOLUTION" ); + createGeomAction( 4033, "FILLING" ); + createGeomAction( 4034, "PIPE" ); + + createGeomAction( 800, "GROUP_CREATE" ); + createGeomAction( 801, "GROUP_EDIT" ); + + createGeomAction( 9997, "Q_FACE" ); + createGeomAction( 9999, "HEX_SOLID" ); + + createGeomAction( 404, "SKETCH" ); + createGeomAction( 407, "EXPLODE" ); + + createGeomAction( 4081, "EDGE" ); + createGeomAction( 4082, "WIRE" ); + createGeomAction( 4083, "FACE" ); + createGeomAction( 4084, "SHELL" ); + createGeomAction( 4085, "SOLID" ); + createGeomAction( 4086, "COMPOUND" ); + + createGeomAction( 5011, "FUSE" ); + createGeomAction( 5012, "COMMON" ); + createGeomAction( 5013, "CUT" ); + createGeomAction( 5014, "SECTION" ); + + createGeomAction( 5021, "TRANSLATION" ); + createGeomAction( 5022, "ROTATION" ); + createGeomAction( 5023, "MODIFY_LOCATION" ); + createGeomAction( 5024, "MIRROR" ); + createGeomAction( 5025, "SCALE" ); + createGeomAction( 5026, "OFFSET" ); + createGeomAction( 5027, "MUL_TRANSLATION" ); + createGeomAction( 5028, "MUL_ROTATION" ); + + createGeomAction( 503, "PARTITION" ); + createGeomAction( 504, "ARCHIMEDE" ); + createGeomAction( 505, "FILLET" ); + createGeomAction( 506, "CHAMFER" ); + //createGeomAction( 507, "CLIPPING" ); + + createGeomAction( 9998, "MUL_TRANSFORM" ); + createGeomAction( 9995, "EXPLODE_BLOCKS" ); + createGeomAction( 99991, "PROPAGATE" ); + + createGeomAction( 601, "SEWING" ); + createGeomAction( 602, "GLUE_FACES" ); + createGeomAction( 603, "SUPPRESS_FACES" ); + createGeomAction( 604, "SUPPERSS_HOLES" ); + createGeomAction( 605, "SHAPE_PROCESS" ); + createGeomAction( 606, "CLOSE_CONTOUR" ); + createGeomAction( 607, "SUPPRESS_INT_WIRES" ); + createGeomAction( 608, "POINT_ON_EDGE" ); + createGeomAction( 609, "CHECK_FREE_BNDS" ); + createGeomAction( 610, "CHECK_FREE_FACES" ); + + createGeomAction( 708, "POINT_COORDS" ); + createGeomAction( 701, "BASIC_PROPS" ); + createGeomAction( 702, "MASS_CENTER" ); + createGeomAction( 703, "INERTIA" ); + createGeomAction( 7041, "BND_BOX" ); + createGeomAction( 7042, "MIN_DIST" ); + + createGeomAction( 705, "TOLERANCE" ); + createGeomAction( 706, "WHAT_IS" ); + createGeomAction( 707, "CHECK" ); + createGeomAction( 7072, "CHECK_COMPOUND" ); + + createGeomAction( 5103, "CHECK_GEOMETRY" ); + + createGeomAction( 412, "SHADING_COLOR" ); + createGeomAction( 413, "ISOS" ); + createGeomAction( 414, "STEP_VALUE" ); + + createGeomAction( 211, "SHADING" ); + createGeomAction( 212, "DISPLAY_ALL" ); + createGeomAction( 214, "ERASE_ALL" ); + createGeomAction( 216, "DISPLAY" ); + createGeomAction( 213, "DISPLAY_ONLY" ); + createGeomAction( 215, "ERASE" ); + + createGeomAction( 901, "POP_RENAME" ); + createGeomAction( 80311, "POP_WIREFRAME", "", 0, true ); + createGeomAction( 80312, "POP_SHADING", "", 0, true ); + createGeomAction( 8032, "POP_COLOR" ); + createGeomAction( 8033, "POP_TRANSPARENCY" ); + createGeomAction( 8034, "POP_ISOS" ); + createGeomAction( 8001, "POP_CREATE_GROUP" ); + + // make wireframe-shading items to be exclusive (only one at a time is selected) + //QActionGroup* dispModeGr = new QActionGroup( this, "", true ); + //dispModeGr->add( action( 80311 ) ); + //dispModeGr->add( action( 80312 ) ); + // ---- create menu -------------------------- + + int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 ); + createMenu( separator(), fileId, 10 ); + createMenu( 111, fileId, 10 ); + createMenu( 121, fileId, 10 ); + createMenu( separator(), fileId, -1 ); + + int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 ); + createMenu( 33, editId, -1 ); + + int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 ); + + int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 ); + createMenu( 4011, basicId, -1 ); + createMenu( 4012, basicId, -1 ); + createMenu( 4013, basicId, -1 ); + createMenu( 4014, basicId, -1 ); + createMenu( 4015, basicId, -1 ); + createMenu( 4019, basicId, -1 ); + createMenu( separator(), basicId, -1 ); + createMenu( 4016, basicId, -1 ); + createMenu( 4017, basicId, -1 ); + createMenu( 4018, basicId, -1 ); + createMenu( 4020, basicId, -1 ); + + int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 ); + createMenu( 4021, primId, -1 ); + createMenu( 4022, primId, -1 ); + createMenu( 4023, primId, -1 ); + createMenu( 4024, primId, -1 ); + createMenu( 4025, primId, -1 ); + + int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 ); + createMenu( 4031, genId, -1 ); + createMenu( 4032, genId, -1 ); + createMenu( 4033, genId, -1 ); + createMenu( 4034, genId, -1 ); + createMenu( separator(), newEntId, -1 ); + + int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 ); + createMenu( 800, groupId, -1 ); + createMenu( 801, groupId, -1 ); + createMenu( separator(), newEntId, -1 ); + + int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 ); + createMenu( 9997, blocksId, -1 ); + createMenu( 9999, blocksId, -1 ); + + createMenu( separator(), newEntId, -1 ); + createMenu( 404, newEntId, -1 ); + createMenu( separator(), newEntId, -1 ); + createMenu( 407, newEntId, -1 ); + + int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 ); + createMenu( 4081, buildId, -1 ); + createMenu( 4082, buildId, -1 ); + createMenu( 4083, buildId, -1 ); + createMenu( 4084, buildId, -1 ); + createMenu( 4085, buildId, -1 ); + createMenu( 4086, buildId, -1 ); + + int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 ); + + int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 ); + createMenu( 5011, boolId, -1 ); + createMenu( 5012, boolId, -1 ); + createMenu( 5013, boolId, -1 ); + createMenu( 5014, boolId, -1 ); + + int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 ); + createMenu( 5021, transId, -1 ); + createMenu( 5022, transId, -1 ); + createMenu( 5023, transId, -1 ); + createMenu( 5024, transId, -1 ); + createMenu( 5025, transId, -1 ); + createMenu( 5026, transId, -1 ); + createMenu( separator(), transId, -1 ); + createMenu( 5027, transId, -1 ); + createMenu( 5028, transId, -1 ); + + createMenu( 503, operId, -1 ); + createMenu( 504, operId, -1 ); + createMenu( separator(), operId, -1 ); + createMenu( 505, transId, -1 ); + createMenu( 506, transId, -1 ); + //createMenu( 507, transId, -1 ); + + int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 ); + createMenu( 9998, blockId, -1 ); + createMenu( 9995, blockId, -1 ); + createMenu( 99991, blockId, -1 ); + + int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 ); + createMenu( 605, repairId, -1 ); + createMenu( 603, repairId, -1 ); + createMenu( 606, repairId, -1 ); + createMenu( 607, repairId, -1 ); + createMenu( 604, repairId, -1 ); + createMenu( 601, repairId, -1 ); + createMenu( 602, repairId, -1 ); + createMenu( 608, repairId, -1 ); + createMenu( 609, repairId, -1 ); + createMenu( 610, repairId, -1 ); + + int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 ); + createMenu( 708, measurId, -1 ); + createMenu( 701, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( 702, measurId, -1 ); + createMenu( 703, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + + int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 ); + createMenu( 7041, dimId, -1 ); + createMenu( 7042, dimId, -1 ); + createMenu( separator(), measurId, -1 ); + + createMenu( 705, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( 706, measurId, -1 ); + createMenu( 707, measurId, -1 ); + createMenu( 7072, measurId, -1 ); + + int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 ); + createMenu( separator(), toolsId, -1 ); + createMenu( 5103, toolsId, -1 ); + + //int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 50 ); + //createMenu( separator(), prefId, -1 ); + //int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 ); + //createMenu( 412, geomId, -1 ); + //createMenu( 413, geomId, -1 ); + //createMenu( 414, geomId, -1 ); + //createMenu( separator(), prefId, -1 ); + + int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 ); + createMenu( separator(), viewId, -1 ); + + int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 ); + createMenu( 211, dispmodeId, -1 ); + + createMenu( separator(), viewId, -1 ); + createMenu( 212, viewId, -1 ); + createMenu( 214, viewId, -1 ); + createMenu( separator(), viewId, -1 ); + +/* + PAL9111: + because of these items are accessible through object browser and viewers + we have removed they from main menu + + createMenu( 216, viewId, -1 ); + createMenu( 213, viewId, -1 ); + createMenu( 215, viewId, -1 ); +*/ + + // ---- create toolbars -------------------------- + + int basicTbId = createTool( tr( "TOOL_BASIC" ) ); + createTool( 4011, basicTbId ); + createTool( 4012, basicTbId ); + createTool( 4013, basicTbId ); + createTool( 4014, basicTbId ); + createTool( 4015, basicTbId ); + createTool( 4019, basicTbId ); + createTool( 4016, basicTbId ); + createTool( 4017, basicTbId ); + createTool( 4018, basicTbId ); + createTool( 4020, basicTbId ); + + int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); + createTool( 4021, primTbId ); + createTool( 4022, primTbId ); + createTool( 4023, primTbId ); + createTool( 4024, primTbId ); + createTool( 4025, primTbId ); + + int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); + createTool( 5011, boolTbId ); + createTool( 5012, boolTbId ); + createTool( 5013, boolTbId ); + createTool( 5014, boolTbId ); + + int genTbId = createTool( tr( "TOOL_GENERATION" ) ); + createTool( 4031, genTbId ); + createTool( 4032, genTbId ); + createTool( 4033, genTbId ); + createTool( 4034, genTbId ); + + int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) ); + createTool( 5021, transTbId ); + createTool( 5022, transTbId ); + createTool( 5023, transTbId ); + createTool( 5024, transTbId ); + createTool( 5025, transTbId ); + createTool( 5026, transTbId ); + createTool( separator(), transTbId ); + createTool( 5027, transTbId ); + createTool( 5028, transTbId ); + + QtxPopupMgr* mgr = popupMgr(); + mgr->insert( action( 901 ), -1, -1 ); // rename + mgr->setRule( action( 901 ), "$type in {'Shape' 'Group'} and selcount=1", true ); + mgr->insert( action( 8001 ), -1, -1 ); // create group + mgr->setRule( action( 8001 ), "client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true", true ); + mgr->insert( action( 801 ), -1, -1 ); // edit group + mgr->setRule( action( 801 ), "client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true", true ); + mgr->insert( separator(), -1, -1 ); // ----------- + dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu + mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe + mgr->setRule( action( 80311 ), "(client='OCCViewer' or client='VTKViewer') and selcount>0 and isVisible", true ); + mgr->setRule( action( 80311 ), "(client='OCCViewer' or client='VTKViewer') and displaymode='Wireframe'", false ); + mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading + mgr->setRule( action( 80312 ), "(client='OCCViewer' or client='VTKViewer') and selcount>0 and isVisible", true ); + mgr->setRule( action( 80312 ), "(client='OCCViewer' or client='VTKViewer') and displaymode='Shading'", false ); + mgr->insert( separator(), -1, -1 ); // ----------- + mgr->insert( action( 8032 ), -1, -1 ); // color + mgr->setRule( action( 8032 ), "(client='OCCViewer' or client='VTKViewer') and selcount>0 and isVisible", true ); + mgr->insert( action( 8033 ), -1, -1 ); // transparency + mgr->setRule( action( 8033 ), "(client='OCCViewer' or client='VTKViewer') and selcount>0 and isVisible", true ); + mgr->insert( action( 8034 ), -1, -1 ); // isos + mgr->setRule( action( 8034 ), "client='OCCViewer' and selcount>0 and isVisible", true ); + mgr->insert( separator(), -1, -1 ); // ----------- + + + + QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ", + onlyComponent = "((type='Component') and selcount=1)", + rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")", + types = "'Shape' 'Group'"; + + mgr->insert( action( 216 ), -1, -1 ); // display + mgr->setRule( action( 216 ), rule.arg( types ).arg( "not isVisible" ), true ); + + mgr->insert( action( 215 ), -1, -1 ); // erase + mgr->setRule( action( 215 ), rule.arg( types ).arg( "isVisible" ), true ); + + mgr->insert( action( 214 ), -1, -1 ); // erase All + mgr->setRule( action( 214 ), "client='OCCViewer' or client='VTKViewer'", true ); + + mgr->insert( action( 213 ), -1, -1 ); // display only + mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), true ); + mgr->insert( separator(), -1, -1 ); + + mgr->hide( mgr->actionId( action( myEraseAll ) ) ); +} + +//======================================================================= +// function : GeometryGUI::Deactivate() +// purpose : Called when GEOM module is deactivated [ static ] +//======================================================================= +bool GeometryGUI::activateModule( SUIT_Study* study ) +{ + if ( CORBA::is_nil( myComponentGeom ) ) + return false; + + bool res = SalomeApp_Module::activateModule( study ); + + if ( !res ) + return false; + + setMenuShown( true ); + setToolShown( true ); + + connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + connect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); + connect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) ); + + GUIMap::Iterator it; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + it.data()->activate( application()->desktop() ); + + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + SUIT_ViewManager* vm; + ViewManagerList OCCViewManagers, VTKViewManagers; + application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers ); + for ( vm = OCCViewManagers.first(); vm; vm = OCCViewManagers.next() ) + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + application()->viewManagers( SVTK_Viewer::Type(), VTKViewManagers ); + for ( vm = VTKViewManagers.first(); vm; vm = VTKViewManagers.next() ) + myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); + + // disable OCC selectors + getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) + sr->setEnabled(true); + + // disable VTK selectors + getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + for ( LightApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() ) + sr->setEnabled(true); + + return true; +} + + +//======================================================================= +// function : GeometryGUI::Deactivate() +// purpose : Called when GEOM module is deactivated [ static ] +//======================================================================= +bool GeometryGUI::deactivateModule( SUIT_Study* study ) +{ + setMenuShown( false ); + setToolShown( false ); + + disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + disconnect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); + disconnect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) ); + + EmitSignalCloseAllDialogs(); + + GUIMap::Iterator it; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + it.data()->deactivate(); + + myOCCSelectors.clear(); + getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() ); + + myVTKSelectors.clear(); + getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() ); + + return SalomeApp_Module::deactivateModule( study ); +} + +//================================================================================= +// function : GeometryGUI::DefinePopup() +// purpose : Called from desktop to define popup menu [static] +//================================================================================= +/* +void GeometryGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) +{ + QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); + SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); + + theObject = ""; + theContext = ""; + + if ( theParent == "Viewer" ) { + if ( Sel->IObjectCount() == 0 ) + theContext = "NothingSelected"; + } + + if ( Sel->IObjectCount() == 1 ) { + Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); + if( IO->hasEntry() ) { + SALOMEDS::SObject_var sobj = ActiveStudy->getStudyDocument()->FindObjectID( IO->getEntry() ); + if ( !sobj->_is_nil() ) { + SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent(); + if ( !strcmp(scomp->GetID(), IO->getEntry() ) ) { + // component is selected + theObject = "Component"; + } + else { + GEOM::GEOM_Object_var aGObj = GEOM::GEOM_Object::_narrow( sobj->GetObject() ); + if ( !CORBA::is_nil( aGObj ) ) { + switch( aGObj->GetType() ) { + case GEOM_GROUP: + theObject = "Group"; + break; + default: + theObject = "Shape"; + break; + } + } + } + } + } + } +} + +//================================================================================= +// function : GeometryGUI::CustomPopup() +// purpose : Called from desktop to create popup menu [static] +//================================================================================= +bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject) +{ + GeometryGUI* geomGUI = GetGeomGUI(); + + // Deactivate any non modal dialog box to get the neutral point + geomGUI->EmitSignalDeactivateDialog(); + QAD_Study* anActiveStudy = parent->getActiveStudy(); + QAD_StudyFrame* aStudyFrame = anActiveStudy->getActiveStudyFrame(); + QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame(); + SALOME_Selection* Sel = SALOME_Selection::Selection(anActiveStudy->getSelection()); + QString parentComponent = ((SALOMEGUI_Desktop*)parent)->getComponentFromSelection(); + bool isOCCViewer = aViewFrame->getTypeView() == VIEW_OCC; + bool isVTKViewer = aViewFrame->getTypeView() == VIEW_VTK; + int aDisplayMode = 0; + QString objectName; + + if ( aViewFrame->getTypeView() == VIEW_OCC ) + aDisplayMode = ((OCCViewer_ViewFrame*)aViewFrame)->getViewer()->getAISContext()->DisplayMode(); + else if ( aViewFrame->getTypeView() == VIEW_VTK ) + aDisplayMode = (dynamic_cast( aViewFrame )->getRWInteractor()->GetDisplayMode(); + + int nbSel = Sel->IObjectCount(); + + if( nbSel == 0 ) { + ////// NOTHING SELECTED + popup->clear(); + } + else if ( nbSel == 1 ) { + ////// SINGLE OBJECT SELECTION + if ( parentComponent != parent->getActiveComponent() ) { + ////// selected object does not belong to GEOM module: + // remove all commands except Display/Erase... + while ( 1 ) { + int id = popup->idAt( 0 ); + if ( id <= QAD_TopLabel_Popup_ID ) + popup->removeItemAt( 0 ); + else + break; + } + } + else { + ////// selected object belong to the GEOM module + // get interactive object + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + objectName = IObject->getName(); + // if object has entry get SObject + SALOMEDS::SObject_var SO; + if ( IObject->hasEntry() ) + SO = anActiveStudy->getStudyDocument()->FindObjectID( IObject->getEntry() ); + + if ( theObject == "Component" ) { + ////// menu for component + if ( !isOCCViewer && !isVTKViewer ) { + popup->removeItem( QAD_DisplayOnly_Popup_ID ); + popup->removeItem( QAD_Display_Popup_ID ); + popup->removeItem( QAD_Erase_Popup_ID ); + } + } + else { + ////// not component (should be shape) + if ( IObject->hasEntry() ) /////// VSR : TO BE REMOVED + popup->removeItem( 804 ); // "Add in Study" + + // Here could be analysis of the geom shape's type + // ... // + + SALOMEDS::GenericAttribute_var aTmpAttr; + if( SO->_is_nil() || SO->GetFatherComponent()->FindAttribute( aTmpAttr, "AttributeIOR") ) + popup->removeItem( 9024 ); // "Open" /////// VSR : TO BE REMOVED + + if ( !isOCCViewer && theParent == "ObjectBrowser" ) { + if ( theObject == "Shape" ) + popup->removeItem( 800 ); // Create Group + else if ( theObject == "Group" ) + popup->removeItem( 801 ); // Edit Group + } + + if ( isOCCViewer || isVTKViewer ) { + ////// current viewer is OCC or VTK + SALOME_Prs* prs = aViewFrame->CreatePrs( IObject->getEntry() ); + if ( aViewFrame->isVisible( IObject ) ) { + ////// object is already displayed in the viewer + popup->removeItem( QAD_Display_Popup_ID ); + if ( isOCCViewer ) { + ////// OCC viewer only + OCCViewer_Prs* occPrs = dynamic_cast( prs ); + if ( occPrs && !occPrs->IsNull() ) { + AIS_ListOfInteractive ioList; + occPrs->GetObjects( ioList ); + QMenuItem* mi = popup->findItem( 803 ); + if ( mi && mi->popup() ) { + if ( ioList.First()->DisplayMode() == 0 ) + mi->popup()->setItemChecked( 80311, true ); // "Wireframe" + else if ( ioList.First()->DisplayMode() == 1 ) + mi->popup()->setItemChecked( 80312, true ); // "Shading" + else if ( ioList.First()->DisplayMode() < 0 ) + mi->popup()->setItemChecked( aDisplayMode == 0 ? 80311 : 80312 , true ); // "Wireframe" or "Shading" + } + } + } + else { + ////// VTK viewer only + popup->removeItem( 8034 ); // "Isos" + SVTK_Prs* vtkPrs = dynamic_cast( prs ); + if ( vtkPrs && !vtkPrs->IsNull() ) { + vtkActorCollection* actorList = vtkPrs->GetObjects(); + actorList->InitTraversal(); + SALOME_Actor* ac = SALOME_Actor::SafeDownCast( actorList->GetNextActor() ); + QMenuItem* mi = popup->findItem( 803 ); + if ( ac && mi && mi->popup() ) { + if ( ac->getDisplayMode() == 0 ) + mi->popup()->setItemChecked( 80311, true ); // "Wireframe" + else if ( ac->getDisplayMode() == 1 ) + mi->popup()->setItemChecked( 80312, true ); // "Shading" + else + mi->popup()->setItemChecked( aDisplayMode == 0 ? 80311 : 80312 , true ); // "Wireframe" or "Shading" + } + } + } + } + else { + ////// object is not yet displayed in the viewer + popup->removeItem( 803 ); // "Display Mode" + popup->removeItem( 8032 ); // "Color" + popup->removeItem( 8033 ); // "Transparency" + popup->removeItem( 8034 ); // "Isos" + popup->removeItem( QAD_Erase_Popup_ID ); + } + delete prs; + } + else { + ////// other viewer type (neither OCC nor VTK) + popup->removeItem( 803 ); // "Display Mode" + popup->removeItem( 8032 ); // "Color" + popup->removeItem( 8033 ); // "Transparency" + popup->removeItem( 8034 ); // "Isos" + popup->removeItem( QAD_Display_Popup_ID ); + popup->removeItem( QAD_DisplayOnly_Popup_ID ); + popup->removeItem( QAD_Erase_Popup_ID ); + } + } + } + } + else { + ////// MULTIPLE SELECTION + if ( parentComponent != parent->getActiveComponent() ) { + ////// not GEOM module objects or objects belong to different modules + // remove all commands except Display/Erase... + while ( 1 ) { + int id = popup->idAt( 0 ); + if ( id <= QAD_TopLabel_Popup_ID ) + popup->removeItemAt( 0 ); + else + break; + } + if ( parentComponent.isNull() ) { + ////// objects belong to different modules + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + } + else { + objectName = tr( "GEOM_MEN_POPUP_NAME" ).arg( nbSel ); + } + } + else { + ////// all selected objects belong to GEOM module + popup->removeItem( 901 ); // "Rename" + + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + bool isComponent = false; + bool needOpen = false; + bool needDisplay = false; + bool needErase = false; + int needToPublish = 0; + + for( ;It.More();It.Next() ) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + + if ( aViewFrame->isVisible( anIObject ) ) + needErase = true; + else + needDisplay = true; + + if( anIObject->hasEntry() ) { + needToPublish = -1; /////// VSR : TO BE REMOVED + SALOMEDS::SObject_var obj = anActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() ); + SALOMEDS::GenericAttribute_var aTmpAttr; + if ( !obj->_is_nil() && !obj->GetFatherComponent()->FindAttribute( aTmpAttr, "AttributeIOR" ) ) + needOpen = true; /////// VSR : TO BE REMOVED + if ( !obj->_is_nil() && QString( obj->GetID() ) == QString( obj->GetFatherComponent()->GetID() ) ) + isComponent = true; + } + else { + if ( needToPublish != -1 ) needToPublish = 1; + } + } + if( needOpen || ( !isOCCViewer && !isVTKViewer ) ) { + ////// Data is not loaded yet or current viewer is neither OCC nor VTK + popup->removeItem( 803 ); // "Display Mode" + popup->removeItem( 8032 ); // "Color" + popup->removeItem( 8033 ); // "Transparency" + popup->removeItem( 8034 ); // "Isos" + popup->removeItem( 804 ); // "Add in Study" + popup->removeItem( QAD_DisplayOnly_Popup_ID ); + popup->removeItem( QAD_Display_Popup_ID ); + popup->removeItem( QAD_Erase_Popup_ID ); + } + else { + popup->removeItem( 9024 ); // "Open" + if ( needToPublish <= 0 ) + popup->removeItem( 804 ); // "Add in Study" + + if( isComponent ) { + popup->removeItem( 803 ); // "Display Mode" + popup->removeItem( 8032 ); // "Color" + popup->removeItem( 8033 ); // "Transparency" + popup->removeItem( 8034 ); // "Isos" + popup->removeItem( QAD_DisplayOnly_Popup_ID ); + } + + if ( !needDisplay ) + popup->removeItem( QAD_Display_Popup_ID ); + if ( !needErase ) + popup->removeItem( QAD_Erase_Popup_ID ); + if ( !isOCCViewer ) + popup->removeItem( 8034 ); // "Isos" + } + } + } + + // check popup for unnecessary separators + QAD_Tools::checkPopup( popup ); + // find popup menu's TopLabel item (with title) + int topItem = popup->indexOf( QAD_TopLabel_Popup_ID ); + if ( topItem >= 0 ) { + // remove popup menu's title item + popup->removeItem( QAD_TopLabel_Popup_ID ); + if ( theParent == "Viewer" && !objectName.isEmpty() && popup->count() > 0 ) { + // set bold font for popup menu's title + QFont f = popup->font(); f.setBold( TRUE ); + popup->removeItem( QAD_TopLabel_Popup_ID ); + popup->insertItem( new CustomItem( objectName, f ), QAD_TopLabel_Popup_ID, topItem ); + } + } + + return false; +} + +*/ + +//======================================================================= +// function : GeometryGUI::BuildPresentation() +// purpose : +//======================================================================= +void GeometryGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& io, SUIT_ViewWindow* win ) +{ + //GEOM_Displayer().Display( io, false, win ); +} + +//======================================================================= +// function : setCommandsEnabled() +// purpose : update menu items' status - disable non-OCC-viewer-compatible actions +//======================================================================= +void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) +{ + if ( !win ) + return; + + const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() ); +// const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() ); + + // disable non-OCC viewframe menu commands +// action( 404 )->setEnabled( ViewOCC ); // SKETCHER + action( 603 )->setEnabled( ViewOCC ); // SuppressFace + action( 604 )->setEnabled( ViewOCC ); // SuppressHole + action( 606 )->setEnabled( ViewOCC ); // CloseContour + action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires + action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge +// action( 609 )->setEnabled( ViewOCC ); // Free boundaries + action( 413 )->setEnabled( ViewOCC ); // Isos Settings + + action( 800 )->setEnabled( ViewOCC ); // Create Group + action( 801 )->setEnabled( ViewOCC ); // Edit Group + + action( 9998 )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION +} + +void GeometryGUI::windows( QMap& mappa ) const +{ + mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); + mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); +} + +void GeometryGUI::viewManagers( QStringList& lst ) const +{ + lst.append( OCCViewer_Viewer::Type() ); +} + +void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) +{ + if ( vm->getType() == OCCViewer_Viewer::Type() ) + { + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + + // disable OCC selectors + getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) + sr->setEnabled(true); + } + else if ( vm->getType() == SVTK_Viewer::Type() ) + { + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); + + // disable VTK selectors + getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + for ( LightApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() ) + sr->setEnabled(true); + } +} + +void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) +{ + SUIT_ViewModel* viewer = vm->getViewModel(); + if ( vm->getType() == OCCViewer_Viewer::Type() ) + { + for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) + if ( sr->viewer() == viewer ) + { + myOCCSelectors.remove( sr ); + break; + } + } + if ( vm->getType() == SVTK_Viewer::Type() ) + { + for ( LightApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() ) + if ( sr->viewer() == viewer ) + { + myVTKSelectors.remove( sr ); + break; + } + } +} + +QString GeometryGUI::engineIOR() const +{ + if ( !CORBA::is_nil( GetGeomGen() ) ) + return QString( getApp()->orb()->object_to_string( GetGeomGen() ) ); + return QString( "" ); +} + +LightApp_Selection* GeometryGUI::createSelection() const +{ + return new GEOMGUI_Selection(); +} + +void GeometryGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& title ) +{ + SalomeApp_Module::contextMenuPopup( client, menu, title ); + SALOME_ListIO lst; + getApp()->selectionMgr()->selectedObjects( lst ); + if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) { + Handle(SALOME_InteractiveObject) io = lst.First(); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + _PTR(Study) study = appStudy->studyDS(); + _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); + if ( obj ) + title = QString( obj->GetName().c_str() ); + } +} + +void GeometryGUI::createPreferences() +{ + int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) ); + + int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId ); + addPreference( tr( "PREF_SHADING_COLOR" ), genGroup, + LightApp_Preferences::Color, "Geometry", "shading_color" ); + int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup, + LightApp_Preferences::Selector, "Geometry", "display_mode" ); + + setPreferenceProperty( genGroup, "columns", 1 ); + + setPreferenceProperty( step, "min", 0.001 ); + setPreferenceProperty( step, "max", 10000 ); + setPreferenceProperty( step, "precision", 3 ); + + // Set property for default display mode + QStringList aModesList; + aModesList.append( tr("MEN_WIREFRAME") ); + aModesList.append( tr("MEN_SHADING") ); + + QValueList anIndexesList; + anIndexesList.append(0); + anIndexesList.append(1); + + setPreferenceProperty( dispmode, "strings", aModesList ); + setPreferenceProperty( dispmode, "indexes", anIndexesList ); +} + +void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) +{ +} + +LightApp_Displayer* GeometryGUI::displayer() +{ + if( !myDisplayer ) + myDisplayer = new GEOM_Displayer( dynamic_cast( getApp()->activeStudy() ) ); + return myDisplayer; +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h new file mode 100644 index 000000000..57f0d6542 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI.h @@ -0,0 +1,192 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef GEOMETRYGUI_H +#define GEOMETRYGUI_H + +#include "SalomeApp_Module.h" + +#include "GEOMGUI.h" +#include "GEOM_Client.hxx" +#include "SALOME_InteractiveObject.hxx" + +#include "SALOMEDSClient.hxx" + +// QT Includes +#include + +// OCCT Includes +#include + +// IDL headers +#include "SALOMEconfig.h" +#include CORBA_CLIENT_HEADER(SALOMEDS) + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//#if defined WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif + +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define GEOMGUI_WNT_EXPORT __declspec( dllexport ) +#else +#define GEOMGUI_WNT_EXPORT +#endif + +typedef QMap GUIMap; + +class QDialog; +class QPopupMenu; +class GEOMGUI_OCCSelector; +class LightApp_VTKSelector; +class LightApp_Selection; +class SUIT_ViewManager; + +//================================================================================= +// class : GeometryGUI +// purpose : +//================================================================================= +class GEOMGUI_WNT_EXPORT GeometryGUI : public SalomeApp_Module +{ + Q_OBJECT; + +public: + // Constructor + GeometryGUI(); + + // Destructor + ~GeometryGUI(); + + virtual LightApp_Displayer* displayer(); + virtual void initialize( CAM_Application* ); + virtual QString engineIOR() const; + + static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts + + static GEOM::GEOM_Gen_var GetGeomGen();// { return GeometryGUI::myComponentGeom; } + + static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); + static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy); + + GEOM_Client& GetShapeReader() { return myShapeReader; } + Standard_CString& GetFatherior() { return myFatherior; } + //void SetState( const int state ) { myState = state; } + //int GetState() const { return myState; } + + // Get active dialog box + QDialog* GetActiveDialogBox(){ return myActiveDialogBox; } + // Set active dialog box + void SetActiveDialogBox( QDialog* aDlg ); + + // Non modal dialog boxes management + void EmitSignalDeactivateDialog(); + void EmitSignalCloseAllDialogs(); + void EmitSignalDefaultStepValueChanged( double newVal ); + + void OnGUIEvent( int id ); + + virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* ); + virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* ); + +// virtual bool SetSettings(); +// virtual void SupportedViewType ( int* buffer, int bufferSize ); + virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 ); + +// virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject); +// virtual bool CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, +// const QString& theParent, const QString& theObject ); + + // The Working Plane management + void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; } + gp_Ax3 GetWorkingPlane() { return myWorkingPlane; } + void ActiveWorkingPlane(); + + virtual void windows( QMap& ) const; + virtual void viewManagers( QStringList& ) const; + + virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual void createPreferences(); + virtual void preferencesChanged( const QString&, const QString& ); + + +public slots: + virtual bool deactivateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); + +private slots: + void OnGUIEvent(); + void onViewManagerAdded( SUIT_ViewManager* ); + void onViewManagerRemoved( SUIT_ViewManager* ); + void onWindowActivated( SUIT_ViewWindow* ); + +signals : + void SignalDeactivateActiveDialog(); + void SignalCloseAllDialogs(); + void SignalDefaultStepValueChanged( double newVal ); + +protected: + virtual LightApp_Selection* createSelection() const; + +private: + GEOMGUI* getLibrary( const QString& libraryName ); + void createGeomAction( const int id, const QString& po_id, + const QString& icon_id = QString(""), + const int key = 0, const bool toggle = false ); + void createPopupItem( const int, const QString& clients, const QString& types, + const bool isSingle = false, const int isVisible = -1, + const bool isExpandAll = false, const bool isOCC = false, + const int parentId = -1 ); + +public: + static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!! +private: + GUIMap myGUIMap; // GUI libraries map + QDialog* myActiveDialogBox; // active dialog box + GEOM_Client myShapeReader; // geom shape reader + Standard_CString myFatherior; + int myState; // identify a method + gp_Ax3 myWorkingPlane; + QMap myRules; // popup rules + + QPtrList myOCCSelectors; + QPtrList myVTKSelectors; + + LightApp_Displayer* myDisplayer; + +friend class DisplayGUI; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx new file mode 100644 index 000000000..4b249d296 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx @@ -0,0 +1,152 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ArcDriver::GetID() +{ + static Standard_GUID aArcDriver("FF1BBB35-5D14-4df2-980B-3A668264EA16"); + return aArcDriver; +} + + +//======================================================================= +//function : GEOMImpl_ArcDriver +//purpose : +//======================================================================= +GEOMImpl_ArcDriver::GEOMImpl_ArcDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IArc aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == CIRC_ARC_THREE_PNT) { + Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); + Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); + Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); + TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue(); + TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue(); + TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && + aShapePnt2.ShapeType() == TopAbs_VERTEX && + aShapePnt3.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2)); + gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3)); + if (aP1.Distance(aP2) < gp::Resolution() || + aP1.Distance(aP3) < gp::Resolution() || + aP2.Distance(aP3) < gp::Resolution()) + Standard_ConstructionError::Raise("Arc creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) + Standard_ConstructionError::Raise("Arc creation aborted: points lay on one line"); + GC_MakeArcOfCircle arc (aP1, aP2, aP3); + aShape = BRepBuilderAPI_MakeEdge(arc).Edge(); + } + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ArcDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArcDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArcDriver", + sizeof(GEOMImpl_ArcDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ArcDriver) Handle(GEOMImpl_ArcDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ArcDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ArcDriver))) { + _anOtherObject = Handle(GEOMImpl_ArcDriver)((Handle(GEOMImpl_ArcDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.hxx b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx new file mode 100644 index 000000000..df27e163b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ArcDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ArcDriver_HeaderFile +#define _GEOMImpl_ArcDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ArcDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ArcDriver); + +class Handle(GEOMImpl_ArcDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ArcDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ArcDriver)(const Handle(GEOMImpl_ArcDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ArcDriver)(const GEOMImpl_ArcDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ArcDriver)& operator=(const Handle(GEOMImpl_ArcDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ArcDriver)& operator=(const GEOMImpl_ArcDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ArcDriver* operator->() + { + return (GEOMImpl_ArcDriver *)ControlAccess(); + } + + GEOMImpl_ArcDriver* operator->() const + { + return (GEOMImpl_ArcDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ArcDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ArcDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ArcDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ArcDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ArcDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ArcDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ArcDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ArcDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx new file mode 100644 index 000000000..ae6487e62 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx @@ -0,0 +1,187 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include "GEOMImpl_ArchimedeDriver.hxx" +#include "GEOMImpl_IArchimede.hxx" +#include "GEOMImpl_Types.hxx" + +#include "Archimede_VolumeSection.hxx" + +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +using namespace std; + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ArchimedeDriver::GetID() +{ + static Standard_GUID aArchimedeDriver("FF1BBB59-5D14-4df2-980B-3A668264EA16"); + return aArchimedeDriver; +} + + +//======================================================================= +//function : GEOMImpl_ArchimedeDriver +//purpose : +//======================================================================= + +GEOMImpl_ArchimedeDriver::GEOMImpl_ArchimedeDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ArchimedeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + Standard_Integer aType = aFunction->GetType(); + if (aType != ARCHIMEDE_TYPE) return 0; + + GEOMImpl_IArchimede IA (aFunction); + + Handle(GEOM_Function) aShapeFunction = IA.GetBasicShape(); + if (aShapeFunction.IsNull()) return 0; + TopoDS_Shape shape = aShapeFunction->GetValue(); + if(shape.IsNull()) return 0; + + Standard_Real aWaterDensity = IA.GetDensity(); + Standard_Real aWeight = IA.GetWeight(); + Standard_Real aMeshingDeflection = IA.GetDeflection(); + + double cste = -1; + if (aWaterDensity != 0.) + cste = aWeight/aWaterDensity; + else + return 0; + + gp_Dir direct (0.0, 0.0, 1.0); + gp_Pnt PosPlan (0.0, 0.0, 0.0); + Geom_Plane PP (PosPlan, direct); + Handle(Geom_Plane) P = Handle(Geom_Plane)::DownCast(PP.Copy()); + + gp_Dir Zdirection (0.0, 0.0, 1.0); + VolumeSection VOL (shape, aMeshingDeflection); + VOL.SetPlane(P); + Handle(Geom_RectangularTrimmedSurface) SurfaceTrimmee; + + if (Zdirection.IsEqual(direct, Precision::Angular()) == Standard_False) { + VOL.MakeRotation(direct); + } + + VOL.CenterOfGravity(); + SurfaceTrimmee = VOL.TrimSurf(); + Standard_Real Cote = VOL.Archimede(cste, aMeshingDeflection); + + if (Cote == -1) { + double Zmin,Zmax; + VOL.getZ(Zmin,Zmax); + double volume = VOL.CalculateVolume(Zmax) * aWaterDensity; + + char msg[100] = ""; + sprintf(msg, "shape sinks to the bottom : Weigth max = %.1f", volume); + + StdFail_NotDone::Raise(msg); + } + + SurfaceTrimmee = VOL.AjustePlan(SurfaceTrimmee,Cote,PosPlan); + if (Zdirection.IsEqual(direct,Precision::Angular()) == Standard_False) { + SurfaceTrimmee = VOL.InvMakeRotation(direct,SurfaceTrimmee); + } + + Standard_Real u1,u2,v1,v2; + SurfaceTrimmee->Bounds(u1,u2,v1,v2); + TopoDS_Face tirant = BRepBuilderAPI_MakeFace(SurfaceTrimmee, u1, u2, v1, v2); + + if (tirant.IsNull()) { + StdFail_NotDone::Raise("Failed to build secant face"); + } + + aFunction->SetValue(tirant); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ArchimedeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArchimedeDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArchimedeDriver", + sizeof(GEOMImpl_ArchimedeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_ArchimedeDriver) Handle(GEOMImpl_ArchimedeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ArchimedeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ArchimedeDriver))) { + _anOtherObject = Handle(GEOMImpl_ArchimedeDriver)((Handle(GEOMImpl_ArchimedeDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx new file mode 100644 index 000000000..ab15bfe18 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ArchimedeDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ArchimedeDriver_HeaderFile +#define _GEOMImpl_ArchimedeDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ArchimedeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ArchimedeDriver); + +class Handle(GEOMImpl_ArchimedeDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ArchimedeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ArchimedeDriver)(const Handle(GEOMImpl_ArchimedeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ArchimedeDriver)(const GEOMImpl_ArchimedeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ArchimedeDriver)& operator=(const Handle(GEOMImpl_ArchimedeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ArchimedeDriver)& operator=(const GEOMImpl_ArchimedeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ArchimedeDriver* operator->() + { + return (GEOMImpl_ArchimedeDriver *)ControlAccess(); + } + + GEOMImpl_ArchimedeDriver* operator->() const + { + return (GEOMImpl_ArchimedeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ArchimedeDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ArchimedeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ArchimedeDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ArchimedeDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ArchimedeDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ArchimedeDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ArchimedeDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ArchimedeDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx new file mode 100644 index 000000000..a73609e60 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx @@ -0,0 +1,1287 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define NBFACES 6 +#define NBEDGES 12 +#define NBVERTS 8 + +static Standard_Integer mod4 (Standard_Integer nb) +{ + if (nb <= 0) return nb + 4; + if (nb > 4) return nb - 4; + return nb; +} + +static Standard_Integer edge_id (const Standard_Integer theFaceID, + const Standard_Integer theEdgeNB) +{ + static Standard_Integer edge_ids[NBFACES][4] = { + { 1, 2, 3, 4 }, // face 1 + { 5, 6, 7, 8 }, // face 2 + { 9, 5, 10, 1 }, // face 3 + { 12, 7, 11, 3 }, // face 4 + { 4, 12, 8, 9 }, // face 5 + { 2, 11, 6, 10 } }; // face 6 + + return edge_ids[theFaceID - 1][theEdgeNB - 1]; +} + +static Standard_Integer side_edge_id (const Standard_Integer theEdgeNB) +{ + static Standard_Integer side_edge_ids[4] = {9, 10, 11, 12}; + + return side_edge_ids[theEdgeNB - 1]; +} + +static Standard_Integer vertex_id (const Standard_Integer theFaceID, + const Standard_Integer theVertexNB) +{ + static Standard_Integer vertex_ids[NBFACES][4] = { + { 1, 2, 3, 4 }, // face 1 + { 5, 6, 7, 8 }, // face 2 + { 1, 5, 6, 2 }, // face 3 + { 4, 8, 7, 3 }, // face 4 + { 1, 4, 8, 5 }, // face 5 + { 2, 3, 7, 6 } }; // face 6 + + return vertex_ids[theFaceID - 1][theVertexNB - 1]; +} + +static Standard_Integer vertex_id_edge (const Standard_Integer theEdgeID, // [1,12] + const Standard_Integer theVertexNB) // [1,2] +{ + static Standard_Integer vertex_ids_edge[NBEDGES][2] = { + {1, 2}, // edge 1 + {2, 3}, // edge 2 + {3, 4}, // edge 3 + {4, 1}, // edge 4 + {5, 6}, // edge 5 + {6, 7}, // edge 6 + {7, 8}, // edge 7 + {8, 5}, // edge 8 + {1, 5}, // edge 9 + {2, 6}, // edge 10 + {3, 7}, // edge 11 + {4, 8} }; // edge 12 + + return vertex_ids_edge[theEdgeID - 1][theVertexNB - 1]; +} + +static Standard_Integer face_id_edges (const Standard_Integer theEdge1ID, // [1,12] + const Standard_Integer theEdge2ID) // [1,12] +{ + static Standard_Integer face_ids_edges[NBEDGES][NBEDGES] = { + // 1 2 3 4 5 6 7 8 9 10 11 12 + { 0, 1, 1, 1, 3, 0, 0, 0, 3, 3, 0, 0 }, // edge 1 + { 1, 0, 1, 1, 0, 6, 0, 0, 0, 6, 6, 0 }, // edge 2 + { 1, 1, 0, 1, 0, 0, 4, 0, 0, 0, 4, 4 }, // edge 3 + { 1, 1, 1, 0, 0, 0, 0, 5, 5, 0, 0, 5 }, // edge 4 + { 3, 0, 0, 0, 0, 2, 2, 2, 3, 3, 0, 0 }, // edge 5 + { 0, 6, 0, 0, 2, 0, 2, 2, 0, 6, 6, 0 }, // edge 6 + { 0, 0, 4, 0, 2, 2, 0, 2, 0, 0, 4, 4 }, // edge 7 + { 0, 0, 0, 5, 2, 2, 2, 0, 5, 0, 0, 5 }, // edge 8 + { 3, 0, 0, 5, 3, 0, 0, 5, 0, 3, 0, 5 }, // edge 9 + { 3, 6, 0, 0, 3, 6, 0, 0, 3, 0, 6, 0 }, // edge 10 + { 0, 6, 4, 0, 0, 6, 4, 0, 0, 6, 0, 4 }, // edge 11 + { 0, 0, 4, 5, 0, 0, 4, 5, 5, 0, 4, 0 } }; // edge 12 + + return face_ids_edges[theEdge1ID - 1][theEdge2ID - 1]; +} + +static Standard_Integer edge_id_vertices (const Standard_Integer theVertex1ID, // [1,8] + const Standard_Integer theVertex2ID) // [1,8] +{ + static Standard_Integer edge_ids_vertices[NBVERTS][NBVERTS] = { + // 1 2 3 4 5 6 7 8 + { 0, 1, 0, 4, 9, 0, 0, 0}, // vertex 1 + { 1, 0, 2, 0, 0, 10, 0, 0}, // vertex 2 + { 0, 2, 0, 3, 0, 0, 11, 0}, // vertex 3 + { 4, 0, 3, 0, 0, 0, 0, 12}, // vertex 4 + { 9, 0, 0, 0, 0, 5, 0, 8}, // vertex 5 + { 0, 10, 0, 0, 5, 0, 6, 0}, // vertex 6 + { 0, 0, 11, 0, 0, 6, 0, 7}, // vertex 7 + { 0, 0, 0, 12, 8, 0, 7, 0} }; // vertex 8 + + return edge_ids_vertices[theVertex1ID - 1][theVertex2ID - 1]; +} + +static Standard_Integer edge_id_faces (const Standard_Integer theFace1ID, // [1,6] + const Standard_Integer theFace2ID) // [1,6] +{ + static Standard_Integer edge_ids_faces[NBFACES][NBFACES] = { + // 1 2 3 4 5 6 + { 0, 0, 1, 3, 4, 2 }, // face 1 + { 0, 0, 5, 7, 8, 6 }, // face 2 + { 1, 5, 0, 0, 9, 10 }, // face 3 + { 3, 7, 0, 0, 12, 11 }, // face 4 + { 4, 8, 9, 12, 0, 0 }, // face 5 + { 2, 6, 10, 11, 0, 0 } }; // face 6 + + return edge_ids_faces[theFace1ID - 1][theFace2ID - 1]; +} + +//======================================================================= +//function : GEOMImpl_Block6Explorer +//purpose : Constructor +//======================================================================= +GEOMImpl_Block6Explorer::GEOMImpl_Block6Explorer () + : myFaces(1,NBFACES), myEdges(1,NBEDGES), myVertices(1,NBVERTS) +{ +} + +//======================================================================= +//function : GetVertex +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_Block6Explorer::GetVertex (const Standard_Integer theVertexID) +{ + TopoDS_Shape aNullShape; + if (theVertexID < 1 || theVertexID > NBVERTS) return aNullShape; + return myVertices(theVertexID); +} + +//======================================================================= +//function : GetVertexID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetVertexID (const TopoDS_Shape& theVertex) +{ + for (Standard_Integer id = 1; id <= NBVERTS; id++) { + if (theVertex.IsSame(myVertices(id))) return id; + } + Standard_NoSuchObject::Raise("The Vertex does not belong to the Block"); + return 0; +} + +//======================================================================= +//function : GetVertexID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetVertexID (const Standard_Integer theFaceID, + const Standard_Integer theVertexNB) +{ + return vertex_id(theFaceID, theVertexNB); +} + +//======================================================================= +//function : GetVertexOnEdgeID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetVertexOnEdgeID + (const Standard_Integer theEdgeID, + const Standard_Integer theVertexNB) +{ + return vertex_id_edge(theEdgeID, theVertexNB); +} + +//======================================================================= +//function : GetEdge +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_Block6Explorer::GetEdge (const Standard_Integer theEdgeID, + const Standard_Boolean doMake) +{ + TopoDS_Shape aNullShape; + if (theEdgeID < 1 || theEdgeID > NBEDGES) return aNullShape; + if (myEdges(theEdgeID).IsNull() && doMake) { + // Create the required edge as a linear segment between + // corresponding vertices and put it in the Block's edges + BRepBuilderAPI_MakeEdge ME (TopoDS::Vertex(myVertices(vertex_id_edge(theEdgeID, 1))), + TopoDS::Vertex(myVertices(vertex_id_edge(theEdgeID, 2)))); + if (!ME.IsDone()) { + Standard_ConstructionError::Raise("Edge construction failed"); + } + myEdges(theEdgeID) = ME.Shape(); + } + + return myEdges(theEdgeID); +} + +//======================================================================= +//function : GetEdgeID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetEdgeID (const TopoDS_Shape& theEdge) +{ + for (Standard_Integer id = 1; id <= NBEDGES; id++) { + if (theEdge.IsSame(myEdges(id))) return id; + } + Standard_NoSuchObject::Raise("The Edge does not belong to the Block"); + return 0; +} + +//======================================================================= +//function : GetEdgeID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetEdgeID (const Standard_Integer theFaceID, + const Standard_Integer theEdgeNB) +{ + return edge_id(theFaceID, theEdgeNB); +} + +//======================================================================= +//function : FindEdgeID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::FindEdgeID (const Standard_Integer theVertex1ID, + const Standard_Integer theVertex2ID) +{ + return edge_id_vertices(theVertex1ID, theVertex2ID); +} + +//======================================================================= +//function : FindCommonEdgeID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::FindCommonEdgeID + (const Standard_Integer theFace1ID, + const Standard_Integer theFace2ID) +{ + return edge_id_faces(theFace1ID, theFace2ID); +} + +//======================================================================= +//function : GetFace +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_Block6Explorer::GetFace (const Standard_Integer theFaceID, + const Standard_Boolean doMake) +{ + TopoDS_Shape aNullShape; + if (theFaceID < 1 || theFaceID > NBFACES) return aNullShape; + + if (myFaces(theFaceID).IsNull() && doMake) { + + // Create the required face between + // corresponding edges and put it in the Block's faces + + TopoDS_Shape E1 = GetEdge(edge_id(theFaceID, 1), doMake); + TopoDS_Shape E2 = GetEdge(edge_id(theFaceID, 2), doMake); + TopoDS_Shape E3 = GetEdge(edge_id(theFaceID, 3), doMake); + TopoDS_Shape E4 = GetEdge(edge_id(theFaceID, 4), doMake); + + BRepBuilderAPI_MakeWire MW (TopoDS::Edge(E1), + TopoDS::Edge(E2), + TopoDS::Edge(E3), + TopoDS::Edge(E4)); + if (!MW.IsDone()) { + Standard_ConstructionError::Raise("Wire construction failed"); + } + TopoDS_Shape aFace; + MakeFace(MW, Standard_False, aFace); + if (aFace.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + myFaces(theFaceID) = aFace; + } + + return myFaces(theFaceID); +} + +//======================================================================= +//function : GetFaceID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetFaceID (const TopoDS_Shape& theFace) +{ + for (Standard_Integer id = 1; id <= NBFACES; id++) { + if (theFace.IsSame(myFaces(id))) return id; + } + Standard_NoSuchObject::Raise("The Face does not belong to the Block"); + return 0; +} + +//======================================================================= +//function : FindFaceID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::FindFaceID (const Standard_Integer theEdge1ID, + const Standard_Integer theEdge2ID) +{ + return face_id_edges(theEdge1ID, theEdge2ID); +} + +//======================================================================= +//function : GetOppositeFaceID +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::GetOppositeFaceID (const Standard_Integer theFaceID) +{ + Standard_Integer opp_face_id[NBFACES + 1] = { + 0, + 2, // to 1 face + 1, // to 2 face + 4, // to 3 face + 3, // to 4 face + 6, // to 5 face + 5}; // to 6 face + + return opp_face_id[theFaceID]; +} + +//======================================================================= +//function : IsSimilarFaces +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_Block6Explorer::IsSimilarFaces (const Standard_Integer theFace1ID, + const Standard_Integer theFace2ID, + const gp_Trsf theTransformation) +{ + Standard_Integer common_edge_id = FindCommonEdgeID(theFace1ID, theFace2ID); + + if (common_edge_id == 0) { // opposite faces + for (Standard_Integer id = 1; id <= 4; id++) { + TopoDS_Shape E1 = GetEdge(edge_id(theFace1ID, id)); + TopoDS_Shape E2 = GetEdge(edge_id(theFace2ID, id)); + + BRepBuilderAPI_Transform aTrsf (E1, theTransformation, Standard_False); + if (!IsSimilarEdges(aTrsf.Shape(), E2)) + return Standard_False; + } + } else { // the faces have common edge + TopTools_Array1OfShape aVerts1 (1,4); + TopTools_Array1OfShape aVerts2 (1,4); + + Standard_Integer common_vertex1 = GetVertexOnEdgeID(common_edge_id, 1); + Standard_Integer common_vertex2 = GetVertexOnEdgeID(common_edge_id, 2); + aVerts1(1) = myVertices(common_vertex1); + aVerts1(2) = myVertices(common_vertex2); + aVerts2(1) = myVertices(common_vertex1); + aVerts2(2) = myVertices(common_vertex2); + + Standard_Integer not_common_v11 = 0, not_common_v12 = 0; + Standard_Integer vnb, vid; + for (vnb = 1; vnb <= 4; vnb++) { + vid = GetVertexID(theFace1ID, vnb); + if (vid != common_vertex1 && FindEdgeID(vid, common_vertex1) == 0) { + not_common_v12 = vid; + } else { + if (vid != common_vertex2 && FindEdgeID(vid, common_vertex2) == 0) { + not_common_v11 = vid; + } + } + } + + Standard_Integer not_common_v21 = 0, not_common_v22 = 0; + for (vnb = 1; vnb <= 4; vnb++) { + vid = GetVertexID(theFace2ID, vnb); + if (vid != common_vertex1 && FindEdgeID(vid, common_vertex1) == 0) { + not_common_v22 = vid; + } else { + if (vid != common_vertex2 && FindEdgeID(vid, common_vertex2) == 0) { + not_common_v21 = vid; + } + } + } + aVerts1(3) = myVertices(not_common_v11); + aVerts1(4) = myVertices(not_common_v12); + aVerts2(3) = myVertices(not_common_v21); + aVerts2(4) = myVertices(not_common_v22); + + for (Standard_Integer id = 1; id <= 4; id++) { + BRepBuilderAPI_Transform aTrsf (aVerts1(id), theTransformation, Standard_False); + TopoDS_Vertex V1 = TopoDS::Vertex(aTrsf.Shape()); + TopoDS_Vertex V2 = TopoDS::Vertex(aVerts2(id)); + if (!BRepTools::Compare(V1, V2)) { + return Standard_False; + } + } + } + + return Standard_True; +} + +//============ Initialization methods =================================== + +//======================================================================= +//function : InitByBlock +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::InitByBlock (const TopoDS_Shape& theBlock) +{ + // 1. Find any one face of the block + TopExp_Explorer faces (theBlock, TopAbs_FACE); + if (!faces.More()) { + Standard_ConstructionError::Raise("The block has no faces"); + } + TopoDS_Shape aFirstFace = faces.Current(); + + // 2. Store all elements of the block relatively aFirstFace + InitByBlockAndFace(theBlock, aFirstFace); +} + +//======================================================================= +//function : InitByBlockAndFace +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::InitByBlockAndFace (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace) +{ + myFaces(1) = theFace; + + // 2. Get wire of the first face + TopExp_Explorer wires (myFaces(1), TopAbs_WIRE); + if (!wires.More()) { + Standard_ConstructionError::Raise("A face of the block has no wires"); + } + TopoDS_Shape aWire = wires.Current(); + wires.Next(); + if (wires.More()) { + Standard_ConstructionError::Raise("A face of the block has more than one wires"); + } + + // 3. Explore wire to init edges and vertices of the first face + BRepTools_WireExplorer aWE (TopoDS::Wire(aWire), TopoDS::Face(myFaces(1))); + Standard_Integer nb = 1; + for (; aWE.More(); aWE.Next(), nb++) { + if (nb > 4) { + Standard_ConstructionError::Raise("A face of the block has more than four edges"); + } + myEdges(edge_id(1, nb)) = aWE.Current(); + myVertices(vertex_id(1, nb)) = aWE.CurrentVertex(); + } + if (nb < 5) { + Standard_ConstructionError::Raise("A face of the block has less than four edges"); + } + + // 2. Store all other elements of the block + InitByBlockAndVertices (theBlock, + myVertices(vertex_id(1,1)), + myVertices(vertex_id(1,2)), + myVertices(vertex_id(1,3))); +} + +//======================================================================= +//function : InitByBlockAndEdges +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::InitByBlockAndEdges (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theEdge1, + const TopoDS_Shape& theEdge3) +{ + // 1. Store vertices and edges of the first face + + // 1.1. Store two given edges + myEdges(edge_id(1, 1)) = theEdge1; + myEdges(edge_id(1, 3)) = theEdge3; + + // 1.2. Find and store the first face + TopTools_IndexedDataMapOfShapeListOfShape MEF; + MapShapesAndAncestors(theBlock, TopAbs_EDGE, TopAbs_FACE, MEF); + if (MEF.Extent() != NBEDGES) { + Standard_TypeMismatch::Raise("Block has wrong number of edges"); + } + const TopTools_ListOfShape& aFacesOfE1 = MEF.FindFromKey(theEdge1); + const TopTools_ListOfShape& aFacesOfE3 = MEF.FindFromKey(theEdge3); + + Standard_Boolean isFound = Standard_False; + TopTools_ListIteratorOfListOfShape anIterF1 (aFacesOfE1); + for (; anIterF1.More() && !isFound; anIterF1.Next()) { + + TopTools_ListIteratorOfListOfShape anIterF3 (aFacesOfE3); + for (; anIterF3.More() && !isFound; anIterF3.Next()) { + + if (anIterF1.Value().IsSame(anIterF3.Value())) { + isFound = Standard_True; + + // Store the face, defined by two opposite edges + myFaces(1) = anIterF1.Value(); + } + } + } + if (!isFound) { + Standard_ConstructionError::Raise + ("Edges 1 and 2 do not belong to one face of the block"); + } + + // 1.3. Make vertices of the first edge the first and the + // second vertices of the first face. Order is free. + TopoDS_Edge E = TopoDS::Edge(theEdge1); + TopoDS_Vertex V1, V2; + TopExp::Vertices(E, V1, V2, Standard_True); + myVertices(vertex_id(1,1)) = V1; + myVertices(vertex_id(1,2)) = V2; + + // Init maps vertex->list_of_edges for the face + TopTools_IndexedDataMapOfShapeListOfShape M1; + MapShapesAndAncestors(myFaces(1), TopAbs_VERTEX, TopAbs_EDGE, M1); + if (M1.Extent() != 4) { + Standard_TypeMismatch::Raise("The first face of block has wrong number of vertices"); + } + + // 1.4. Find and store others elements of the first face + + // edges of the first vertex + TopoDS_Shape E1_f = M1.FindFromKey(V1).First(); + TopoDS_Shape E1_l = M1.FindFromKey(V1).Last(); + + if (E1_f.IsSame(theEdge1)) { + myEdges(edge_id(1, 4)) = E1_l; + } else { + myEdges(edge_id(1, 4)) = E1_f; + } + + // fourth vertex + TopoDS_Edge E4 = TopoDS::Edge(myEdges(edge_id(1, 4))); + TopoDS_Vertex V41, V42; + TopExp::Vertices(E4, V41, V42, Standard_True); + if (V41.IsSame(V1)) { + myVertices(vertex_id(1,4)) = V42; + } else { + myVertices(vertex_id(1,4)) = V41; + } + + // edges of the second vertex + TopoDS_Shape E2_f = M1.FindFromKey(V2).First(); + TopoDS_Shape E2_l = M1.FindFromKey(V2).Last(); + + if (E2_f.IsSame(theEdge1)) { + myEdges(edge_id(1, 2)) = E2_l; + } else { + myEdges(edge_id(1, 2)) = E2_f; + } + + // fird vertex + TopoDS_Edge E2 = TopoDS::Edge(myEdges(edge_id(1, 2))); + TopoDS_Vertex V21, V22; + TopExp::Vertices(E2, V21, V22, Standard_True); + if (V21.IsSame(V2)) { + myVertices(vertex_id(1,3)) = V22; + } else { + myVertices(vertex_id(1,3)) = V21; + } + + // 2. Store all other elements of the block + InitByBlockAndVertices (theBlock, + myVertices(vertex_id(1,1)), + myVertices(vertex_id(1,2)), + myVertices(vertex_id(1,3))); +} + +//======================================================================= +//function : InitByBlockAndVertices +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::InitByBlockAndVertices (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theVertex1, + const TopoDS_Shape& theVertex2, + const TopoDS_Shape& theVertex3) +{ + // Here we suppose, that vertices are ordered, i.e. exists edge between + // theVertex1 and theVertex2 and edge between theVertex2 and theVertex3 + + // 1. Store vertices and edges of the first face. + // If the first face is initialized, it means, that this + // method is called from another initialization method, and all + // vertices and edges of the first face are also initialized + if (myFaces(1).IsNull()) { + + // 1.1. Store first three vertices + myVertices(vertex_id(1, 1)) = theVertex1; + myVertices(vertex_id(1, 2)) = theVertex2; + myVertices(vertex_id(1, 3)) = theVertex3; + + // 1.2. Find and store the first face + TopTools_IndexedDataMapOfShapeListOfShape MVF; + MapShapesAndAncestors(theBlock, TopAbs_VERTEX, TopAbs_FACE, MVF); + if (MVF.Extent() != NBVERTS) { + Standard_TypeMismatch::Raise("Block has wrong number of vertices"); + } + const TopTools_ListOfShape& aFacesOfV1 = MVF.FindFromKey(theVertex1); + const TopTools_ListOfShape& aFacesOfV3 = MVF.FindFromKey(theVertex3); + + Standard_Boolean isFound = Standard_False; + TopTools_ListIteratorOfListOfShape anIterF1 (aFacesOfV1); + for (; anIterF1.More() && !isFound; anIterF1.Next()) { + + TopTools_ListIteratorOfListOfShape anIterF3 (aFacesOfV3); + for (; anIterF3.More() && !isFound; anIterF3.Next()) { + + if (anIterF1.Value().IsSame(anIterF3.Value())) { + isFound = Standard_True; + + // Store the face, defined by two opposite vertices + myFaces(1) = anIterF1.Value(); + } + } + } + if (!isFound) { + Standard_ConstructionError::Raise + ("Vertices 1 and 3 do not belong to one face of the block"); + } + + // Init maps vertex->list_of_edges for the face + TopTools_IndexedDataMapOfShapeListOfShape M1; + MapShapesAndAncestors(myFaces(1), TopAbs_VERTEX, TopAbs_EDGE, M1); + if (M1.Extent() != 4) { + Standard_TypeMismatch::Raise("The first face of block has wrong number of vertices"); + } + + // 1.3. Find and store edges and last vertex of the first face + const TopTools_ListOfShape& anEdgesOfV1 = M1.FindFromKey(theVertex1); + const TopTools_ListOfShape& anEdgesOfV2 = M1.FindFromKey(theVertex2); + const TopTools_ListOfShape& anEdgesOfV3 = M1.FindFromKey(theVertex3); + + TopTools_ListIteratorOfListOfShape anIterE2 (anEdgesOfV2); + for (; anIterE2.More(); anIterE2.Next()) { + + TopTools_ListIteratorOfListOfShape anIterE1 (anEdgesOfV1); + for (; anIterE1.More(); anIterE1.Next()) { + + if (anIterE1.Value().IsSame(anIterE2.Value())) { + // Store the first edge, defined by two vertices + myEdges(edge_id(1,1)) = anIterE1.Value(); + + } else { + // Store the last edge + myEdges(edge_id(1,4)) = anIterE1.Value(); + + // Find and store the last vertex + TopoDS_Edge E = TopoDS::Edge(myEdges(4)); + TopoDS_Vertex V1, V2; + TopExp::Vertices(E, V1, V2, Standard_True); + + if (V1.IsSame(theVertex1)) { + myVertices(vertex_id(1,4)) = V2; + } else { + myVertices(vertex_id(1,4)) = V1; + } + } + } + + TopTools_ListIteratorOfListOfShape anIterE3 (anEdgesOfV3); + for (; anIterE3.More(); anIterE3.Next()) { + + if (anIterE3.Value().IsSame(anIterE2.Value())) { + // Store the second edge, defined by two vertices + myEdges(edge_id(1,2)) = anIterE3.Value(); + + } else { + // Store the fird edge + myEdges(edge_id(1,3)) = anIterE3.Value(); + } + } + } + } + + // Init map vertex->list_of_edges for the block + TopTools_IndexedDataMapOfShapeListOfShape MB; + MapShapesAndAncestors(theBlock, TopAbs_VERTEX, TopAbs_EDGE, MB); + if (MB.Extent() != NBVERTS) { + Standard_TypeMismatch::Raise("Block has wrong number of vertices"); + } + + // 2. Store edges, linking the first face with the second one + // and vertices of the second face + TopTools_IndexedMapOfShape aFaceEdges; + TopExp::MapShapes(myFaces(1), TopAbs_EDGE, aFaceEdges); + + Standard_Integer i = 1; + for (; i <= 4; i++) { + // Get i-th vertex of the face 1 + TopoDS_Shape Vi = myVertices(vertex_id(1, i)); + if (!MB.Contains(Vi)) { + Standard_ConstructionError::Raise("Face does not belong to the block"); + } + + // Get list of block's edges, sharing this Vertex + const TopTools_ListOfShape& anEdgesOfVi = MB.FindFromKey(Vi); + TopTools_ListIteratorOfListOfShape anEdgesIter (anEdgesOfVi); + + // Get Edge (from the List), not belonging to the face 1 + Standard_Boolean isFound = Standard_False; + for (; anEdgesIter.More() && !isFound; anEdgesIter.Next()) { + if (!aFaceEdges.Contains(anEdgesIter.Value())) { + isFound = Standard_True; + + // Store the linking edge + TopoDS_Shape aLinkEdge = anEdgesIter.Value(); + myEdges(side_edge_id(i)) = aLinkEdge; + + // Get another vertex of the linking edge + TopoDS_Edge E = TopoDS::Edge(aLinkEdge); + TopoDS_Vertex V1, V2; + TopExp::Vertices(E, V1, V2, Standard_True); + + // Store the i-th vertex of the second (opposite to the first) face + if (V1.IsSame(Vi)) { + myVertices(vertex_id(2, i)) = V2; + } else { + myVertices(vertex_id(2, i)) = V1; + } + } + } + } + + // 3. Store edges of the second (opposite to the first) face + for (i = 1; i <= 4; i++) { + // Get i-th and (i+1)-th vertices of the face 2 + TopoDS_Shape Vi = myVertices(vertex_id(2, i)); + TopoDS_Shape Vj = myVertices(vertex_id(2, mod4(i + 1))); + + // Get list of block's edges, sharing Vi + const TopTools_ListOfShape& anEdgesOfVi = MB.FindFromKey(Vi); + // Get list of block's edges, sharing Vj + const TopTools_ListOfShape& anEdgesOfVj = MB.FindFromKey(Vj); + + // Get Edge (from the List), linking this vertex with the next one + Standard_Boolean isFound = Standard_False; + TopTools_ListIteratorOfListOfShape anEdgesIteri (anEdgesOfVi); + for (; anEdgesIteri.More() && !isFound; anEdgesIteri.Next()) { + + TopTools_ListIteratorOfListOfShape anEdgesIterj (anEdgesOfVj); + for (; anEdgesIterj.More() && !isFound; anEdgesIterj.Next()) { + + if (anEdgesIteri.Value().IsSame(anEdgesIterj.Value())) { + isFound = Standard_True; + + // Store the linking edge + myEdges(edge_id(2, i)) = anEdgesIteri.Value(); + } + } + } + } + + // 4. Store faces of the block + TopTools_IndexedDataMapOfShapeListOfShape MBE; + MapShapesAndAncestors(theBlock, TopAbs_EDGE, TopAbs_FACE, MBE); + if (MBE.Extent() != NBEDGES) { + Standard_TypeMismatch::Raise("Block has wrong number of edges"); + } + + for (i = 2; i <= NBFACES; i++) { + TopoDS_Shape Ei1 = myEdges(edge_id(i, 1)); + TopoDS_Shape Ei2 = myEdges(edge_id(i, 2)); + const TopTools_ListOfShape& aFacesOfEi1 = MBE.FindFromKey(Ei1); + const TopTools_ListOfShape& aFacesOfEi2 = MBE.FindFromKey(Ei2); + + Standard_Boolean isFound = Standard_False; + TopTools_ListIteratorOfListOfShape anIterEi1 (aFacesOfEi1); + for (; anIterEi1.More() && !isFound; anIterEi1.Next()) { + + TopTools_ListIteratorOfListOfShape anIterEi2 (aFacesOfEi2); + for (; anIterEi2.More() && !isFound; anIterEi2.Next()) { + + if (anIterEi1.Value().IsSame(anIterEi2.Value())) { + isFound = Standard_True; + + // Store the face, defined by two edges + myFaces(i) = anIterEi1.Value(); + } + } + } + } +} + +//======================================================================= +//function : InitByTwoFaces +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::InitByTwoFaces (const TopoDS_Shape& theFace1, + const TopoDS_Shape& theFace2) +{ + if (theFace1.IsSame(theFace2)) { + Standard_ConstructionError::Raise("The faces must be different"); + } + + // Add two given faces in the structure + myFaces(1) = theFace1; + myFaces(2) = theFace2; + + // Step 1. Order vertices (and edges) + + // 1.1. Ordered vertices and edges of the first face we put in + + // Get wire of the first face + TopExp_Explorer wires1 (myFaces(1), TopAbs_WIRE); + if (!wires1.More()) { + Standard_ConstructionError::Raise("A face for the block has no wires"); + } + TopoDS_Shape aWire1 = wires1.Current(); + wires1.Next(); + if (wires1.More()) { + Standard_ConstructionError::Raise("A face for the block has more than one wire"); + } + + BRepTools_WireExplorer aWE1 (TopoDS::Wire(aWire1), TopoDS::Face(myFaces(1))); + Standard_Integer nb; + for (nb = 1; aWE1.More(); aWE1.Next(), nb++) { + if (nb > 4) { + Standard_ConstructionError::Raise("A face for the block has more than four edges"); + } + myEdges(edge_id(1, nb)) = aWE1.Current(); + myVertices(vertex_id(1, nb)) = aWE1.CurrentVertex(); + } + if (nb < 5) { + Standard_ConstructionError::Raise("A face for the block has less than four edges"); + } + + // 1.2. Ordered vertices and edges of the second face we temporarily store + // in arrays, to find for them rigth location in on the Step 2. + + // declare arrays + TopTools_Array1OfShape aVertis2(1,4); // ordered vertices of the second face + TopTools_Array1OfShape anEdges2(1,4); // anEdges2(i) links aVertis2(i) and aVertis2(i+1) + + // Get wire of the second face + TopExp_Explorer wires2 (myFaces(2), TopAbs_WIRE); + if (!wires2.More()) { + Standard_ConstructionError::Raise("A face for the block has no wires"); + } + TopoDS_Shape aWire2 = wires2.Current(); + wires2.Next(); + if (wires2.More()) { + Standard_ConstructionError::Raise("A face for the block has more than one wire"); + } + + BRepTools_WireExplorer aWE2 (TopoDS::Wire(aWire2), TopoDS::Face(myFaces(2))); + for (nb = 1; aWE2.More(); aWE2.Next(), nb++) { + if (nb > 4) { + Standard_ConstructionError::Raise("A face for the block has more than four edges"); + } + anEdges2(nb) = aWE2.Current(); + aVertis2(nb) = aWE2.CurrentVertex(); + } + if (nb < 5) { + Standard_ConstructionError::Raise("A face for the block has less than four edges"); + } + + // Step 2. Find right place in for the , + // so as to minimize common length of linking edges + // between face 1 and face 2. + // Each linking edge (of four) will link vertices of the + // faces 1 and 2 with equal local numbers. + // The right place is defined by: + // - vertex , which will become the first vertex + // of the second face + // - orientation of relatively their future location + // in (s_min = 1 if direct, s_min = -1 if reversed) + Standard_Integer i_min = 0, s_min = 0; + + TColgp_Array1OfPnt aPnts1 (1,4); // points of the first face + aPnts1(1) = BRep_Tool::Pnt(TopoDS::Vertex(myVertices(vertex_id(1, 1)))); + aPnts1(2) = BRep_Tool::Pnt(TopoDS::Vertex(myVertices(vertex_id(1, 2)))); + aPnts1(3) = BRep_Tool::Pnt(TopoDS::Vertex(myVertices(vertex_id(1, 3)))); + aPnts1(4) = BRep_Tool::Pnt(TopoDS::Vertex(myVertices(vertex_id(1, 4)))); + + TColgp_Array1OfPnt aPnts2 (1,4); // points of the second face + aPnts2(1) = BRep_Tool::Pnt(TopoDS::Vertex(aVertis2(1))); + aPnts2(2) = BRep_Tool::Pnt(TopoDS::Vertex(aVertis2(2))); + aPnts2(3) = BRep_Tool::Pnt(TopoDS::Vertex(aVertis2(3))); + aPnts2(4) = BRep_Tool::Pnt(TopoDS::Vertex(aVertis2(4))); + + Standard_Real Dist_min = RealLast(); + // try all possible locations to find the best (with minimum sum distance) + Standard_Integer i = 1; + for (; i <= 4; i++) { + // try direct orientation + Standard_Real Dist_plus = aPnts1(1).Distance(aPnts2(i)) + + aPnts1(2).Distance(aPnts2(mod4(i + 1))) + + aPnts1(3).Distance(aPnts2(mod4(i + 2))) + + aPnts1(4).Distance(aPnts2(mod4(i + 3))); + if (Dist_plus < Dist_min) { + Dist_min = Dist_plus; + i_min = i; + s_min = 1; + } + + // try reversed orientation + Standard_Real Dist_minus = aPnts1(1).Distance(aPnts2(i)) + + aPnts1(2).Distance(aPnts2(mod4(i - 1))) + + aPnts1(3).Distance(aPnts2(mod4(i - 2))) + + aPnts1(4).Distance(aPnts2(mod4(i - 3))); + if (Dist_minus < Dist_min) { + Dist_min = Dist_minus; + i_min = i; + s_min = - 1; + } + } + + // 3. Put vertices and edges of the second face to they + // permanent location in and + for (i = 1; i <= 4; i++) { + Standard_Integer nb = mod4(i_min + s_min*(i - 1)); + + if (aPnts1(i).Distance(aPnts2(nb)) < Precision::Confusion()) { + Standard_ConstructionError::Raise("The faces are too close"); + } + + myVertices(vertex_id(2, i)) = aVertis2(nb); + + if (s_min == -1) nb = mod4(nb - 1); + myEdges(edge_id(2, i)) = anEdges2(nb); + } + + // 4. Generate side surface + if (!aWire1.Closed() || !aWire2.Closed()) { + // BRepOffsetAPI_ThruSections is not applicable on not closed wires + GetFace(3, Standard_True); + GetFace(4, Standard_True); + GetFace(5, Standard_True); + GetFace(6, Standard_True); + } else { + // try to build faces on native surfaces of edges or planar + Standard_Boolean tryThru = Standard_False; + for (Standard_Integer i = 3; i <= 6 && !tryThru; i++) { + Standard_Boolean doMake = Standard_True; + TopoDS_Shape E1 = GetEdge(edge_id(i, 1), doMake); + TopoDS_Shape E2 = GetEdge(edge_id(i, 2), doMake); + TopoDS_Shape E3 = GetEdge(edge_id(i, 3), doMake); + TopoDS_Shape E4 = GetEdge(edge_id(i, 4), doMake); + + BRepBuilderAPI_MakeWire MW (TopoDS::Edge(E1), + TopoDS::Edge(E2), + TopoDS::Edge(E3), + TopoDS::Edge(E4)); + if (!MW.IsDone()) { + Standard_ConstructionError::Raise("Wire construction failed"); + } + + BRepBuilderAPI_MakeFace MF (MW, Standard_False); + if (MF.IsDone()) { + myFaces(i) = MF.Shape(); + } else { + tryThru = Standard_True; + } + } + + // Build side surface by ThruSections algorithm + if (tryThru) { + BRepOffsetAPI_ThruSections THS; + THS.AddWire(TopoDS::Wire(aWire1)); + THS.AddWire(TopoDS::Wire(aWire2)); + THS.Build(); + if (!THS.IsDone()) { + StdFail_NotDone::Raise("Side surface generation failed"); + } + for (Standard_Integer i = 1; i <= 4; i++) { + // fill face + myFaces(i+2) = THS.GeneratedFace(myEdges(i)); + + // fill edge + Standard_Integer ee = side_edge_id(i); + TopTools_IndexedDataMapOfShapeListOfShape MVE; + MapShapesAndAncestors(myFaces(i+2), TopAbs_VERTEX, TopAbs_EDGE, MVE); + FindEdge(myEdges(ee), + myVertices(vertex_id_edge(ee, 1)), + myVertices(vertex_id_edge(ee, 2)), + MVE); + } + } + } +} + +//======================================================================= +//function : MapShapesAndAncestors +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::MapShapesAndAncestors (const TopoDS_Shape& S, + const TopAbs_ShapeEnum TS, + const TopAbs_ShapeEnum TA, + TopTools_IndexedDataMapOfShapeListOfShape& M) +{ + TopTools_ListOfShape empty; + TopTools_MapOfShape mapA; + + // visit ancestors + TopExp_Explorer exa (S,TA); + for (; exa.More(); exa.Next()) { + // visit shapes + const TopoDS_Shape& anc = exa.Current(); + if (mapA.Add(anc)) { + TopExp_Explorer exs (anc,TS); + TopTools_MapOfShape mapS; + for (; exs.More(); exs.Next()) { + if (mapS.Add(exs.Current())) { + Standard_Integer index = M.FindIndex(exs.Current()); + if (index == 0) index = M.Add(exs.Current(),empty); + M(index).Append(anc); + } + } + } + } + + // visit shapes not under ancestors + TopExp_Explorer ex (S,TS,TA); + for (; ex.More(); ex.Next()) { + Standard_Integer index = M.FindIndex(ex.Current()); + if (index == 0) index = M.Add(ex.Current(),empty); + } +} + +//======================================================================= +//function : IsSimilarEdges +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_Block6Explorer::IsSimilarEdges (const TopoDS_Shape& E1, + const TopoDS_Shape& E2) +{ + TopoDS_Edge E1e = TopoDS::Edge(E1); + TopoDS_Edge E2e = TopoDS::Edge(E2); + TopoDS_Vertex V11, V12, V21, V22; + TopExp::Vertices(E1e, V11, V12, Standard_True); + TopExp::Vertices(E2e, V21, V22, Standard_True); + if (BRepTools::Compare(V11, V21) && BRepTools::Compare(V12, V22)) + return Standard_True; + if (BRepTools::Compare(V11, V22) && BRepTools::Compare(V12, V21)) + return Standard_True; + + return Standard_False; +} + +//======================================================================= +//function : FindEdge +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::FindEdge + (TopoDS_Shape& theResult, + const TopoDS_Shape& V1, + const TopoDS_Shape& V2, + const TopTools_IndexedDataMapOfShapeListOfShape& MVE, + const Standard_Boolean findAll) +{ + Standard_Integer isFound = 0; + + const TopTools_ListOfShape& anEdgesOfV1 = MVE.FindFromKey(V1); + const TopTools_ListOfShape& anEdgesOfV2 = MVE.FindFromKey(V2); + + TopTools_ListIteratorOfListOfShape it1 (anEdgesOfV1); + for (; it1.More(); it1.Next()) { + TopTools_ListIteratorOfListOfShape it2 (anEdgesOfV2); + for (; it2.More(); it2.Next()) { + if (it1.Value().IsSame(it2.Value())) { + isFound++; + theResult = it1.Value(); + if (!findAll) return isFound; + } + } + } + + return isFound; +} + +//======================================================================= +//function : FindFace +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Block6Explorer::FindFace + (TopoDS_Shape& theResult, + const TopoDS_Shape& V1, + const TopoDS_Shape& V2, + const TopoDS_Shape& V3, + const TopoDS_Shape& V4, + const TopTools_IndexedDataMapOfShapeListOfShape& MVF, + const Standard_Boolean findAll) +{ + Standard_Integer isFound = Standard_False; + + const TopTools_ListOfShape& aFacesOfV1 = MVF.FindFromKey(V1); + const TopTools_ListOfShape& aFacesOfV2 = MVF.FindFromKey(V2); + const TopTools_ListOfShape& aFacesOfV3 = MVF.FindFromKey(V3); + const TopTools_ListOfShape& aFacesOfV4 = MVF.FindFromKey(V4); + + TopTools_ListIteratorOfListOfShape it1 (aFacesOfV1); + for (; it1.More(); it1.Next()) { + TopTools_ListIteratorOfListOfShape it2 (aFacesOfV2); + for (; it2.More(); it2.Next()) { + if (it1.Value().IsSame(it2.Value())) { + TopTools_ListIteratorOfListOfShape it3 (aFacesOfV3); + for (; it3.More(); it3.Next()) { + if (it1.Value().IsSame(it3.Value())) { + TopTools_ListIteratorOfListOfShape it4 (aFacesOfV4); + for (; it4.More(); it4.Next()) { + if (it1.Value().IsSame(it4.Value())) { + isFound++; + theResult = it1.Value(); + if (!findAll) return isFound; + } + } + } + } + } + } + } + + return isFound; +} + +//======================================================================= +//function : MakeFace +//purpose : +//======================================================================= +void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire, + const Standard_Boolean isPlanarWanted, + TopoDS_Shape& theResult) +{ + // try to build face on plane or on any surface under the edges of the wire + BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted); + if (MK.IsDone()) { + theResult = MK.Shape(); + return; + } + + if (!isPlanarWanted) { + // try to construct filling surface + BRepOffsetAPI_MakeFilling MF; + + Standard_Integer nbEdges = 0; + BRepTools_WireExplorer aWE (theWire); + for (; aWE.More(); aWE.Next(), nbEdges++) { + MF.Add(TopoDS::Edge(aWE.Current()), GeomAbs_C0); + } + + MF.Build(); + if (MF.IsDone()) { + // Result of filling + TopoDS_Shape aFace = MF.Shape(); + + // Update tolerance + Standard_Real aTol = MF.G0Error(); + + TColgp_Array1OfPnt aPnts (1,nbEdges); // points of the given wire + BRepTools_WireExplorer aWE1 (theWire); + Standard_Integer vi = 1; + for (; aWE1.More() && vi <= nbEdges; aWE1.Next(), vi++) { + aPnts(vi) = BRep_Tool::Pnt(TopoDS::Vertex(aWE1.CurrentVertex())); + } + + // Find maximum deviation in vertices + TopExp_Explorer exp (aFace, TopAbs_VERTEX); + TopTools_MapOfShape mapShape; + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aV = TopoDS::Vertex(exp.Current()); + Standard_Real aTolV = BRep_Tool::Tolerance(aV); + gp_Pnt aP = BRep_Tool::Pnt(aV); + Standard_Real min_dist = aP.Distance(aPnts(1)); + for (vi = 2; vi <= nbEdges; vi++) { + min_dist = Min(min_dist, aP.Distance(aPnts(vi))); + } + aTol = Max(aTol, aTolV); + aTol = Max(aTol, min_dist); + } + } + + if ((*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance() < aTol) { + (*((Handle(BRep_TFace)*)&aFace.TShape()))->Tolerance(aTol); + } + theResult = aFace; + } + } else { + // try to update wire tolerances to build a planar face + + // With OCCT6.0 or lower + + // Find a deviation + Standard_Real aToleranceReached, aTol; + BRepLib_FindSurface aFS; + aFS.Init(theWire, -1., isPlanarWanted); + aToleranceReached = aFS.ToleranceReached(); + aTol = aFS.Tolerance(); + + if (!aFS.Found()) { + aFS.Init(theWire, aToleranceReached, isPlanarWanted); + if (!aFS.Found()) return; + aToleranceReached = aFS.ToleranceReached(); + aTol = aFS.Tolerance(); + } + aTol = Max(1.2 * aToleranceReached, aTol); + + // Copy the wire, bacause it can be updated with very-very big tolerance here + BRepBuilderAPI_Copy aMC (theWire); + if (!aMC.IsDone()) return; + TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape()); + // Update tolerances to + BRep_Builder B; + for (TopExp_Explorer expE (aWire, TopAbs_EDGE); expE.More(); expE.Next()) { + TopoDS_Edge anE = TopoDS::Edge(expE.Current()); + B.UpdateEdge(anE, aTol); + } + for (TopExp_Explorer expV (aWire, TopAbs_VERTEX); expV.More(); expV.Next()) { + TopoDS_Vertex aV = TopoDS::Vertex(expV.Current()); + B.UpdateVertex(aV, aTol); + } + //BRepLib::UpdateTolerances(aWire); + // Build face + BRepBuilderAPI_MakeFace MK1 (aWire, isPlanarWanted); + if (MK1.IsDone()) { + theResult = MK1.Shape(); + return; + } + + // After migration on OCCT version higher than 6.0 + //BRepLib_MakeFace aBMF; + //aBMF.Init(theWire, isPlanarWanted, Standard_True); + //if (aBMF.Error() == BRepLib_FaceDone) { + // theResult = aBMF.Shape(); + // return; + //} + } +} diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx new file mode 100644 index 000000000..1cedbe1f3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.hxx @@ -0,0 +1,226 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_Block6Explorer.hxx +// Module : GEOMImpl + +#ifndef GEOMImpl_Block6Explorer_HeaderFile +#define GEOMImpl_Block6Explorer_HeaderFile + +#include +#include +#include +#include +#include + + // Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid + // Each face can be accessed by its global ID [1-6] + // Each edge can be accessed by its global ID [1-12] or by its local NB [1-4] inside certain face + // Each vertex can be accessed by its global ID [1-8] or by its local NB [1-4] inside certain face + // Numeration of the sub-shapes is defined in constructors, see they comments + // + // face 2 face 4 | 4 face 2 face | + // | / | \ | | + // \|/ |/_ | _\| \|/ | + // ' ' | ' ' | + // 8_______7__7 | 7__7_______8 | + // /| /| | |\ |\ | + // 8 12 6 11 | 11 6 12 8 | + // / | / | | | \ | \ | + // 5/______5__6/ | | | \6__5______\5 | + // face 5 ---> | | | | <--- 6 face | face 6 ---> | | | | <--- 5 face | + // | |__3__|____| | |____|__3__| | | + // | /4 | /3 | 3\ | 4\ | | + // | / | / | \ | \ | | + // 9 4 10 2 | 2 10 4 9 | + // |/__1______|/ | \|______1__\| | + // 1 2 | 2 1 | + // _. . | . ._ | + // /| /|\ | /|\ |\ | + // / | | | \ | + // 3 face 1 face | face 1 face 3 | + // | | + // Picture 1 (right orientation) | Picture 2 (left orientation) | + // | + // For the moment, the orientation of numbering is not controlled + + // Faces: 1 - bottom, 2 - top, 3 - front, 4 - back, 5 - left (right), 6 - right (left) + + // + // 4_______3__3 2 ______2__3 + // / / | | + // 4 2 1 3 + // / / | | + // 1/______1__2/ | | + // | | + // | __4______| + // face 2 face 4 1 4 + // | / + // \|/ |/_ + // ' ' + // 3 8_______7__7 3 + // /| /| /| /| + // 3 2 8 12 6 11 3 2 + // / | / | / | / | + // 4/ | 5/______5__6/ | 4/ | + // | | face 5 ---> | | | | <--- 6 face | | + // | | | |__3__|____| | | + // | /2 | /4 | /3 | /2 + // | / | / | / | / + // 4 1 9 4 10 2 4 1 + // |/ |/__1______|/ |/ + // 1 1 2 1 + // _. . + // /| /|\ + // / | + // 2 ______2__3 3 face 1 face + // | | + // | | __3_______ + // | | /4 /3 + // | | / / + // 1 3 4 2 + // | __4______| /__1______ / + // 1 4 1 2 + // + // Picture 3 (On periferal pictures the local + // numeration of edges and vertices is shown) + +class GEOMImpl_Block6Explorer +{ + public: + // ---------- PUBLIC METHODS ---------- + + GEOMImpl_Block6Explorer (); + // Constructor. + + // Initialization by existing solid, + // sub-elements regulate numeration + + void InitByBlock (const TopoDS_Shape& theBlock); + // Init by hexahedral solid. First face, edge and vertex is defined randomly + + void InitByBlockAndFace (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace); + // Constructor from hexahedral solid, making theFace the first face. + // First edge and vertex is defined randomly from theFace entities + + void InitByBlockAndEdges (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theEdge1, + const TopoDS_Shape& theEdge2); + // Init by hexahedral solid, making theEdge1 the first, theEdge2 the fird. + // First vertex is defined randomly from theEdge1 vertices + // (Picture 1 and Picture 2 shows two possible cases) + + void InitByBlockAndVertices (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theVertex1, + const TopoDS_Shape& theVertex2, + const TopoDS_Shape& theVertex3); + // Init by hexahedral solid, making theVertex1 the first, + // theVertex2 the second and theVertex3 the fird vertices. + + // Initialization by parts of solid to be built + + void InitByTwoFaces (const TopoDS_Shape& theFace1, + const TopoDS_Shape& theFace2); + // Init by two faces. TheFace1 will be the first, + // theFace2 will be the second. + // First edge and vertex is defined randomly from theFace1 entities. + + // Access to vertices + TopoDS_Shape GetVertex (const Standard_Integer theVertexID); // [1-8] + + Standard_Integer GetVertexID (const TopoDS_Shape& theVertex); + + Standard_Integer GetVertexID (const Standard_Integer theFaceID, // [1-6] + const Standard_Integer theVertexNB); // [1-4] + + Standard_Integer GetVertexOnEdgeID (const Standard_Integer theEdgeID, // [1-12] + const Standard_Integer theVertexNB); // [1-2] + + // Access to edges + TopoDS_Shape GetEdge (const Standard_Integer theEdgeID, // [1-12] + const Standard_Boolean doMake = Standard_False); + + Standard_Integer GetEdgeID (const TopoDS_Shape& theEdge); + + Standard_Integer GetEdgeID (const Standard_Integer theFaceID, // [1-6] + const Standard_Integer theEdgeNB); // [1-4] + + Standard_Integer FindEdgeID (const Standard_Integer theVertex1ID, + const Standard_Integer theVertex2ID); + + Standard_Integer FindCommonEdgeID (const Standard_Integer theFace1ID, + const Standard_Integer theFace2ID); + + // Access to faces + TopoDS_Shape GetFace (const Standard_Integer theFaceID, // [1-6] + const Standard_Boolean doMake = Standard_False); + + Standard_Integer GetFaceID (const TopoDS_Shape& theFace); + + Standard_Integer FindFaceID (const Standard_Integer theEdge1ID, + const Standard_Integer theEdge2ID); + + Standard_Integer GetOppositeFaceID (const Standard_Integer theFaceID); + + // Check Block + Standard_Boolean IsSimilarFaces (const Standard_Integer theFace1ID, + const Standard_Integer theFace2ID, + const gp_Trsf theTransformation); + // returns true, if theFace1, transformed + // by theTransformation, coincides with theFace2 + public: + // ---------- STATIC PUBLIC METHODS ---------- + static void MapShapesAndAncestors (const TopoDS_Shape& S, + const TopAbs_ShapeEnum TS, + const TopAbs_ShapeEnum TA, + TopTools_IndexedDataMapOfShapeListOfShape& M); + + static Standard_Boolean IsSimilarEdges (const TopoDS_Shape& E1, + const TopoDS_Shape& E2); + + static Standard_Integer FindEdge (TopoDS_Shape& theResult, + const TopoDS_Shape& V1, + const TopoDS_Shape& V2, + const TopTools_IndexedDataMapOfShapeListOfShape& MVE, + const Standard_Boolean findAll = Standard_False); + // returns number of found edges + + static Standard_Integer FindFace (TopoDS_Shape& theResult, + const TopoDS_Shape& V1, + const TopoDS_Shape& V2, + const TopoDS_Shape& V3, + const TopoDS_Shape& V4, + const TopTools_IndexedDataMapOfShapeListOfShape& MVF, + const Standard_Boolean findAll = Standard_False); + // returns number of found faces + + static void MakeFace (const TopoDS_Wire& theWire, + const Standard_Boolean isPlanarWanted, + TopoDS_Shape& theResult); + + private: + // ---------- PRIVATE FIELDS ---------- + + TopTools_Array1OfShape myFaces; + TopTools_Array1OfShape myEdges; + TopTools_Array1OfShape myVertices; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx new file mode 100644 index 000000000..e9ed601c2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -0,0 +1,1005 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "utilities.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_BlockDriver::GetID() +{ + static Standard_GUID aBlockDriver("FF1BBB67-5D14-4df2-980B-3A668264EA16"); + return aBlockDriver; +} + + +//======================================================================= +//function : GEOMImpl_BlockDriver +//purpose : +//======================================================================= +GEOMImpl_BlockDriver::GEOMImpl_BlockDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + BRep_Builder B; + + Standard_Real prec = Precision::Confusion(); + + Standard_Integer aNbSub = 0; + if (aType == BLOCK_COMPOUND_GLUE) { + + aNbSub = 1; + + } else if (aType == BLOCK_FACE_TWO_EDGES || + aType == BLOCK_TWO_FACES) { + + aNbSub = 2; + + } else if (aType == BLOCK_FACE_FOUR_PNT || + aType == BLOCK_FACE_FOUR_EDGES) { + + aNbSub = 4; + + } else if (aType == BLOCK_SIX_FACES) { + + aNbSub = 6; + + } else { + } + + if (aNbSub > 0) { + GEOMImpl_IBlocks aCI (aFunction); + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + Standard_Integer nbshapes = aShapes->Length(); + + if (nbshapes != aNbSub) { + Standard_TypeMismatch::Raise + ("Number of elements for object construction does not correspond to the used constructor"); + } + + TopTools_Array1OfShape anArgs (1, aNbSub); + Standard_Integer argi; + for (argi = 1; argi <= aNbSub; argi++) { + Handle(GEOM_Function) aRef = Handle(GEOM_Function)::DownCast(aShapes->Value(argi)); + TopoDS_Shape anArg = aRef->GetValue(); + if (anArg.IsNull()) { + Standard_NullObject::Raise("Null shape is given as argument"); + } + anArgs(argi) = anArg; + } + + if (aType == BLOCK_FACE_FOUR_EDGES) { + + // Make face from four edges + if (anArgs(1).ShapeType() != TopAbs_EDGE || anArgs(2).ShapeType() != TopAbs_EDGE || + anArgs(3).ShapeType() != TopAbs_EDGE || anArgs(4).ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise("Shape for face construction is not an edge"); + } + + // count corner vertices + TopTools_MapOfShape aVertMap; + for (Standard_Integer ii = 1; ii <= 4; ii++) { + TopoDS_Edge anEdge = TopoDS::Edge(anArgs(ii)); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anEdge, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_NullObject::Raise("Bad edge for face construction: vertex is not defined"); + } + if (BRepTools::Compare(V1,V2)) { + Standard_ConstructionError::Raise("Edge ends are too close"); + } + Standard_Boolean isCoin1 = Standard_False, isCoin2 = Standard_False; + TopTools_MapIteratorOfMapOfShape anIter (aVertMap); + for (; anIter.More(); anIter.Next()) { + TopoDS_Vertex V = TopoDS::Vertex(anIter.Key()); + if (BRepTools::Compare(V,V1)) isCoin1 = Standard_True; + if (BRepTools::Compare(V,V2)) isCoin2 = Standard_True; + } + if (!isCoin1) aVertMap.Add(V1); + if (!isCoin2) aVertMap.Add(V2); + } + if (aVertMap.Extent() != 4) { + Standard_ConstructionError::Raise("The edges must form a closed wire"); + } + + TopoDS_Edge anEdge1 = TopoDS::Edge(anArgs(1)); + TopoDS_Edge anEdge2 = TopoDS::Edge(anArgs(2)); + TopoDS_Edge anEdge3 = TopoDS::Edge(anArgs(3)); + TopoDS_Edge anEdge4 = TopoDS::Edge(anArgs(4)); + + // check, if anEdge1 has common/coincident vertex with anEdge2, + Standard_Boolean isConnected12 = Standard_False; + TopoDS_Vertex V11, V12, V21, V22; + TopExp::Vertices(anEdge1, V11, V12, Standard_True); + TopExp::Vertices(anEdge2, V21, V22, Standard_True); + if (BRepTools::Compare(V11,V21) || BRepTools::Compare(V11,V22) || + BRepTools::Compare(V12,V21) || BRepTools::Compare(V12,V22)) { + // the edges have common vertex + isConnected12 = Standard_True; + } + + // build wire in right order, corresponding to edges connexity + BRepBuilderAPI_MakeWire* MW; + if (isConnected12) + MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3, anEdge4); + else + MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge3, anEdge2, anEdge4); + + if (!MW->IsDone()) { + Standard_ConstructionError::Raise + ("Impossible to build a connected wire from the given edges"); + } + TopoDS_Wire aWire = *MW; + delete MW; + if (!aWire.Closed()) { + Standard_ConstructionError::Raise + ("Impossible to build a closed wire from the given edges"); + } + + // try to build face on the wire + GEOMImpl_Block6Explorer::MakeFace(aWire, Standard_False, aShape); + if (aShape.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + + } else if (aType == BLOCK_FACE_TWO_EDGES) { + + // Make face from two opposite edges + if (anArgs(1).ShapeType() != TopAbs_EDGE || + anArgs(2).ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise("Shape for face construction is not an edge"); + } + + TopoDS_Edge anEdge1 = TopoDS::Edge(anArgs(1)); + TopoDS_Edge anEdge2 = TopoDS::Edge(anArgs(2)); + + if (anEdge1.IsSame(anEdge2)) { + Standard_ConstructionError::Raise("The edges must be different"); + } + + // create two edges, linking ends of the given edges + TopoDS_Vertex V11, V12, V21, V22; + TopExp::Vertices(anEdge1, V11, V12, Standard_True); + TopExp::Vertices(anEdge2, V21, V22, Standard_True); + if (V11.IsNull() || V12.IsNull() || + V21.IsNull() || V22.IsNull()) { + Standard_NullObject::Raise("Bad edge for face construction: vertex is not defined"); + } + gp_Pnt P11 = BRep_Tool::Pnt(V11); + gp_Pnt P12 = BRep_Tool::Pnt(V12); + gp_Pnt P21 = BRep_Tool::Pnt(V21); + gp_Pnt P22 = BRep_Tool::Pnt(V22); + + if (P11.Distance(P21) < prec || P12.Distance(P22) < prec || + P11.Distance(P22) < prec || P12.Distance(P21) < prec) { + Standard_ConstructionError::Raise("Given edges have too close ends"); + } + + Standard_Real per11 = P11.Distance(P21) + P12.Distance(P22); + Standard_Real per12 = P11.Distance(P22) + P12.Distance(P21); + + TopoDS_Edge anEdge3; + TopoDS_Edge anEdge4; + if (per11 < per12) { + anEdge3 = BRepBuilderAPI_MakeEdge(V11, V21); + anEdge4 = BRepBuilderAPI_MakeEdge(V12, V22); + } else { + anEdge3 = BRepBuilderAPI_MakeEdge(V11, V22); + anEdge4 = BRepBuilderAPI_MakeEdge(V12, V21); + } + + // build a wire + BRepBuilderAPI_MakeWire MW (anEdge1, anEdge3, anEdge2, anEdge4); + if (!MW.IsDone()) { + Standard_ConstructionError::Raise("Wire construction failed"); + } + + // try to build face on the wire + GEOMImpl_Block6Explorer::MakeFace(MW, Standard_False, aShape); + if (aShape.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + + } else if (aType == BLOCK_FACE_FOUR_PNT) { + + // Make face from four corner vertices + if (anArgs(1).ShapeType() != TopAbs_VERTEX || + anArgs(2).ShapeType() != TopAbs_VERTEX || + anArgs(3).ShapeType() != TopAbs_VERTEX || + anArgs(4).ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise("Shape for face construction is not a vertex"); + } + + TopoDS_Vertex V1 = TopoDS::Vertex(anArgs(1)); + TopoDS_Vertex V2 = TopoDS::Vertex(anArgs(2)); + TopoDS_Vertex V3 = TopoDS::Vertex(anArgs(3)); + TopoDS_Vertex V4 = TopoDS::Vertex(anArgs(4)); + + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); + gp_Pnt P3 = BRep_Tool::Pnt(V3); + gp_Pnt P4 = BRep_Tool::Pnt(V4); + + if (P1.Distance(P2) < prec || P1.Distance(P3) < prec || + P1.Distance(P4) < prec || P2.Distance(P3) < prec || + P2.Distance(P4) < prec || P3.Distance(P4) < prec) { + Standard_ConstructionError::Raise("Four not coincident points must be given"); + } + + // calculate perimeters + Standard_Real per1234 = P1.Distance(P2) + P2.Distance(P3) + + P3.Distance(P4) + P4.Distance(P1); + Standard_Real per1243 = P1.Distance(P2) + P2.Distance(P4) + + P4.Distance(P3) + P3.Distance(P1); + Standard_Real per1324 = P1.Distance(P3) + P3.Distance(P2) + + P2.Distance(P4) + P4.Distance(P1); + + // order vertices + if (per1243 < per1234 && per1243 < per1324) { + TopoDS_Vertex Vtmp = V3; + V3 = V4; + V4 = Vtmp; + } else if (per1324 < per1234 && per1324 < per1243) { + TopoDS_Vertex Vtmp = V3; + V3 = V2; + V2 = Vtmp; + } else { + } + + // build wire + BRepBuilderAPI_MakePolygon aMkPoly (V1, V2, V3, V4, Standard_True); + if (!aMkPoly.IsDone()) { + Standard_ConstructionError::Raise("Polygon construction failed"); + } + + // try to build face on the wire + GEOMImpl_Block6Explorer::MakeFace(aMkPoly, Standard_False, aShape); + if (aShape.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + + } else if (aType == BLOCK_SIX_FACES || aType == BLOCK_TWO_FACES) { + + BRepTools_Quilt Glue; + + if (aType == BLOCK_SIX_FACES) { + + // Make block (hexahedral solid) from six faces + for (Standard_Integer ind = 1; ind <= nbshapes; ind++) { + if (anArgs(ind).ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Shape for block construction is not a face"); + } + Glue.Add(anArgs(ind)); + } + + } else { + + // Make block (hexahedral solid) from two opposite faces + if (anArgs(1).ShapeType() != TopAbs_FACE || + anArgs(2).ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Shape for block construction is not a face"); + } + + // Get wires of the given faces + TopExp_Explorer wires1 (anArgs(1), TopAbs_WIRE); + TopExp_Explorer wires2 (anArgs(2), TopAbs_WIRE); + if (!wires1.More() || !wires2.More()) { + Standard_ConstructionError::Raise("A face for the block has no wires"); + } + TopoDS_Shape aWire1 = wires1.Current(); + TopoDS_Shape aWire2 = wires2.Current(); + wires1.Next(); + wires2.Next(); + if (wires1.More() || wires2.More()) { + Standard_ConstructionError::Raise("A face for the block has more than one wire"); + } + + GEOMImpl_Block6Explorer aBlockTool; + aBlockTool.InitByTwoFaces(anArgs(1), anArgs(2)); + + // Construct the linking faces and add them in the gluing tool + Glue.Add(anArgs(1)); + Glue.Add(aBlockTool.GetFace(3, Standard_True)); + Glue.Add(aBlockTool.GetFace(4, Standard_True)); + Glue.Add(aBlockTool.GetFace(5, Standard_True)); + Glue.Add(aBlockTool.GetFace(6, Standard_True)); + Glue.Add(anArgs(2)); + } + + TopExp_Explorer exp (Glue.Shells(), TopAbs_SHELL); + Standard_Integer ish = 0; + TopTools_MapOfShape mapShape; + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + aShape = exp.Current(); + ish++; + } + } + + if (ish > 1) { + aShape = Glue.Shells(); + Standard_Real aTol = prec; // Precision::Confusion() + TopExp_Explorer expF (aShape, TopAbs_FACE); + TopTools_MapOfShape mapF; + TopoDS_Shell Shell; + B.MakeShell(Shell); + for (; expF.More(); expF.Next()) { + if (mapF.Add(expF.Current())) { + B.Add(Shell, expF.Current()); + Standard_Real aToler = BRep_Tool::Tolerance(TopoDS::Face(expF.Current())); + if (aToler > aTol) + aTol = aToler; + } + } + ShHealOper_Sewing aHealer (Shell, aTol); + if (aHealer.Perform()) + aShape = aHealer.GetResultShape(); + else + Standard_ConstructionError::Raise + ("Impossible to build a connected shell on the given faces"); + } + + if (aType == BLOCK_SIX_FACES) { + if (!aShape.Closed()) { + Standard_ConstructionError::Raise + ("Impossible to build a closed shell on the given faces"); + } + } + + TopoDS_Solid Sol; + B.MakeSolid(Sol); + B.Add(Sol, aShape); + BRepClass3d_SolidClassifier SC (Sol); + SC.PerformInfinitePoint(prec); + if (SC.State() == TopAbs_IN) { + B.MakeSolid(Sol); + B.Add(Sol, aShape.Reversed()); + } + aShape = Sol; + BRepLib::SameParameter(aShape, 1.E-5, Standard_True); + + } else if (aType == BLOCK_COMPOUND_GLUE) { + + // Make blocks compound from a compound + if (anArgs(1).ShapeType() != TopAbs_COMPOUND && + anArgs(2).ShapeType() != TopAbs_COMPSOLID) { + Standard_TypeMismatch::Raise("Not a compound given"); + } + + TopoDS_Shape aCompound = anArgs(1); + + // Glue coincident faces and edges (with Partition algorithm). + NMTAlgo_Splitter1 PS; + PS.AddShape(aCompound); + PS.Compute(); + PS.SetRemoveWebs(Standard_False); +// PS.Build(aCompound.ShapeType()); + PS.Build(TopAbs_SOLID); + + aShape = PS.Shape(); + } else { + } + + } else { // Multi-transformations and compound improving + + if (aType == BLOCK_REMOVE_EXTRA || + aType == BLOCK_COMPOUND_IMPROVE) { + + GEOMImpl_IBlockTrsf aCI (aFunction); + Handle(GEOM_Function) aRefShape = aCI.GetOriginal(); + TopoDS_Shape aBlockOrComp = aRefShape->GetValue(); + if (aBlockOrComp.IsNull()) { + Standard_NullObject::Raise("Null Shape given"); + } + + // 1. Improve solids with seam and/or degenerated edges + BlockFix_BlockFixAPI aTool; + //aTool.Tolerance() = toler; + aTool.SetShape(aBlockOrComp); + aTool.Perform(); + + if (aType == BLOCK_REMOVE_EXTRA) { + + aShape = aTool.Shape(); + if (aShape == aBlockOrComp) { + MESSAGE("No modifications have been done"); + } + + } else { // aType == BLOCK_COMPOUND_IMPROVE + + TopoDS_Shape aFixedExtra = aTool.Shape(); + + // 2. Separate non-blocks + TopTools_ListOfShape BLO; // All blocks from the given compound + TopTools_ListOfShape NOT; // Not blocks + TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges + GEOMImpl_IBlocksOperations::AddBlocksFrom(aFixedExtra, BLO, NOT, EXT); + + if (NOT.Extent() > 0) { + MESSAGE("Some non-blocks have been removed"); + } + + // 3. Warn about staying extra-edges + if (EXT.Extent() > 0) { + MESSAGE("Warning: Not all seam or degenerated edges was removed"); + } + + // ??? Throw away standalone blocks ??? + + // 4. Create compound of all blocks + TopoDS_Compound aComp; + BRep_Builder BB; + BB.MakeCompound(aComp); + TopTools_ListIteratorOfListOfShape BLOit (BLO); + for (; BLOit.More(); BLOit.Next()) { + BB.Add(aComp, BLOit.Value()); + } + + // 5. Glue Faces + aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion()); + } + + } else if (aType == BLOCK_MULTI_TRANSFORM_1D || + aType == BLOCK_MULTI_TRANSFORM_2D) { + + TopoDS_Shape aMulti; + GEOMImpl_IBlockTrsf aCI (aFunction); + Handle(GEOM_Function) aRefShape = aCI.GetOriginal(); + TopoDS_Shape aBlockIni = aRefShape->GetValue(); + if (aBlockIni.IsNull()) { + Standard_NullObject::Raise("Null Block"); + } + + // Copy block to avoid problems (PAL6706) + TColStd_IndexedDataMapOfTransientTransient aMap; + TopoDS_Shape aBlock; + TNaming_CopyShape::CopyTool(aBlockIni, aMap, aBlock); + + // Block tolerance in vertices + Standard_Real aTol = prec; + TopExp_Explorer expV (aBlock, TopAbs_VERTEX); + TopTools_MapOfShape mapShape; + for (; expV.More(); expV.Next()) { + if (mapShape.Add(expV.Current())) { + TopoDS_Vertex aV = TopoDS::Vertex(expV.Current()); + aTol = Max(BRep_Tool::Tolerance(aV), aTol); + } + } + + if (aType == BLOCK_MULTI_TRANSFORM_1D) { + // Retrieve a faces by Ids + Standard_Integer aFace1Id = aCI.GetFace1U(); + Standard_Integer aFace2Id = aCI.GetFace2U(); + TopoDS_Shape aFace1, aFace2; + if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1Id, aFace1)) { + Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id"); + } + if (aFace1.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face"); + } + + if (aFace2Id > 0) { + if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2Id, aFace2)) { + Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id"); + } + if (aFace2.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face"); + } + } + + Standard_Integer aNbIter = aCI.GetNbIterU(); + + MultiTransformate1D(aBlock, aFace1, aFace2, aNbIter, aMulti); + + } else { // aType == BLOCK_MULTI_TRANSFORM_2D + // Retrieve a faces by Ids + Standard_Integer aFace1UId = aCI.GetFace1U(); + Standard_Integer aFace2UId = aCI.GetFace2U(); + Standard_Integer aFace1VId = aCI.GetFace1V(); + Standard_Integer aFace2VId = aCI.GetFace2V(); + + TopoDS_Shape aFace1U, aFace2U, aFace1V, aFace2V; + if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1UId, aFace1U) || + !GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1VId, aFace1V)) { + Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id"); + } + + if (aFace1U.ShapeType() != TopAbs_FACE || + aFace1V.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face"); + } + + if (aFace2UId > 0) { + if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2UId, aFace2U)) { + Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id"); + } + + if (aFace2U.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face"); + } + } + + if (aFace2VId > 0) { + if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2VId, aFace2V)) { + Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id"); + } + + if (aFace2V.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face"); + } + } + + Standard_Integer aNbIterU = aCI.GetNbIterU(); + Standard_Integer aNbIterV = aCI.GetNbIterV(); + + MultiTransformate2D(aBlock, + aFace1U, aFace2U, aNbIterU, + aFace1V, aFace2V, aNbIterV, aMulti); + } + + if (aMulti.IsNull()) { + StdFail_NotDone::Raise("Multi-transformation failed"); + } + + // Glue faces of the multi-block + aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol); + + } else { // unknown function type + return 0; + } + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : MultiTransformate1D +//purpose : +//======================================================================= +void GEOMImpl_BlockDriver::MultiTransformate1D (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace1, + const TopoDS_Shape& theFace2, + const Standard_Integer theNbIter, + TopoDS_Shape& theResult) const +{ + // Construct Tool, where will be the first face, + // and a face, opposite to , will be the second face + GEOMImpl_Block6Explorer aBlockTool; + aBlockTool.InitByBlockAndFace(theBlock, theFace1); + + // Find IDs of the faces + Standard_Integer dir_face1 = 1, dir_face2 = 2; + if (!theFace2.IsNull()) { + dir_face2 = aBlockTool.GetFaceID(theFace2); + } + + // Find three pairs of points + Standard_Integer v11_id = 0, v12_id = 0, v13_id = 0; // vertices of the first face + Standard_Integer v21_id = 0, v22_id = 0, v23_id = 0; // vertices of the second face + + if (dir_face2 == 2) { // is opposite to + + // We will take vertices with equal local numbers on the faces, + // as the Block6Explorer gives equal local numbers + // to the linked vertices on the opposite faces, + // i.e. v1* is linked with the v2* by an edge: + + // _________ + // /|v23 /| + // / | / | dir_face1 - bottom + // / | / | + // /________ / | dir_face2 - top + // |v21 | |v22 | + // | |____|____| + // | / v13 | / + // | / | / + // | / | / + // |/________|/ + // v11 v12 + + v11_id = aBlockTool.GetVertexID(dir_face1, 1); + v12_id = aBlockTool.GetVertexID(dir_face1, 2); + v13_id = aBlockTool.GetVertexID(dir_face1, 4); + + v21_id = aBlockTool.GetVertexID(dir_face2, 1); + v22_id = aBlockTool.GetVertexID(dir_face2, 2); + v23_id = aBlockTool.GetVertexID(dir_face2, 4); + + } else { + + // _________ + // /| /| + // / | / | dir_face1 - bottom + // / | / | + // /________ / | dir_face2 - right (for example) + // | | |v23 | + // | |____|____| + // | / | /v12 = v22 (common_vertex2) + // | / | / + // | / | / + // |/________|/ + // v13 v11 = v21 (common_vertex1) + + Standard_Integer common_edge_id = aBlockTool.FindCommonEdgeID(dir_face1, dir_face2); + Standard_Integer common_vertex1 = aBlockTool.GetVertexOnEdgeID(common_edge_id, 1); + Standard_Integer common_vertex2 = aBlockTool.GetVertexOnEdgeID(common_edge_id, 2); + + Standard_Integer not_common_v1 = 0; + Standard_Integer vid = 1; + Standard_Boolean isFound = Standard_False; + while (!isFound && vid <= 4) { + not_common_v1 = aBlockTool.GetVertexID(dir_face1, vid); + isFound = (not_common_v1 != common_vertex2 && + aBlockTool.FindEdgeID(not_common_v1, common_vertex1) != 0); + vid++; + } + + Standard_Integer not_common_v2 = 0; + vid = 1; + isFound = Standard_False; + while (!isFound && vid <= 4) { + not_common_v2 = aBlockTool.GetVertexID(dir_face2, vid); + isFound = (not_common_v2 != common_vertex2 && + aBlockTool.FindEdgeID(not_common_v2, common_vertex1) != 0); + vid++; + } + + v11_id = common_vertex1; + v12_id = common_vertex2; + v13_id = not_common_v1; + + v21_id = common_vertex1; + v22_id = common_vertex2; + v23_id = not_common_v2; + } + + // Construct a transformation operator + TopoDS_Vertex V11 = TopoDS::Vertex(aBlockTool.GetVertex(v11_id)); + TopoDS_Vertex V12 = TopoDS::Vertex(aBlockTool.GetVertex(v12_id)); + TopoDS_Vertex V13 = TopoDS::Vertex(aBlockTool.GetVertex(v13_id)); + + TopoDS_Vertex V21 = TopoDS::Vertex(aBlockTool.GetVertex(v21_id)); + TopoDS_Vertex V22 = TopoDS::Vertex(aBlockTool.GetVertex(v22_id)); + TopoDS_Vertex V23 = TopoDS::Vertex(aBlockTool.GetVertex(v23_id)); + + // Axes of the first direction face + gp_Pnt P1 = BRep_Tool::Pnt(V11); + gp_Vec VecN1 (P1, BRep_Tool::Pnt(V12)); + gp_Vec VecX1 (P1, BRep_Tool::Pnt(V13)); + gp_Ax3 Ax1 (P1, VecN1, VecX1); + + // Axes of the second direction face + gp_Pnt P2 = BRep_Tool::Pnt(V21); + gp_Vec VecN2 (P2, BRep_Tool::Pnt(V22)); + gp_Vec VecX2 (P2, BRep_Tool::Pnt(V23)); + gp_Ax3 Ax2 (P2, VecN2, VecX2); + + gp_Trsf aTrsf; + aTrsf.SetDisplacement(Ax1, Ax2); + + // Check, that is similar to . + // Actually, we need only to check right position of one + // vertex, not involved into the transformation construction. + if (!aBlockTool.IsSimilarFaces(dir_face1, dir_face2, aTrsf)) { + Standard_ConstructionError::Raise("The direction faces are not similar"); + } + + // Perform multi-transformation + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound(aCompound); + + TopoDS_Shape aPrevShape = theBlock; + for (Standard_Integer i = 0; i < theNbIter; i++) { + B.Add(aCompound, aPrevShape); + BRepBuilderAPI_Transform aTransformation (aPrevShape, aTrsf, Standard_False); + aPrevShape = aTransformation.Shape(); + } + theResult = aCompound; +} + +//======================================================================= +//function : MultiTransformate2D +//purpose : +//======================================================================= +void GEOMImpl_BlockDriver::MultiTransformate2D (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace1U, + const TopoDS_Shape& theFace2U, + const Standard_Integer theNbIterU, + const TopoDS_Shape& theFace1V, + const TopoDS_Shape& theFace2V, + const Standard_Integer theNbIterV, + TopoDS_Shape& theResult) const +{ + // Construct Tool, where will be the first face, + // and a face, opposite to , will be the second face + GEOMImpl_Block6Explorer aBlockTool; + aBlockTool.InitByBlockAndFace(theBlock, theFace1U); + + gp_Trsf aTrsfU, aTrsfV; + gp_Ax3 Ax1V, Ax2V; + for (Standard_Integer uv = 1; uv <= 2; uv++) { + // U transformation + TopoDS_Shape theFace1 = theFace1U; + TopoDS_Shape theFace2 = theFace2U; + if (uv == 2) { + // V transformation + theFace1 = theFace1V; + theFace2 = theFace2V; + } + + // Find IDs of the faces + Standard_Integer dir_face1 = aBlockTool.GetFaceID(theFace1); + Standard_Integer dir_face2 = 0; + Standard_Integer opp_face1 = aBlockTool.GetOppositeFaceID(dir_face1); + if (theFace2.IsNull()) { + dir_face2 = opp_face1; + } else { + dir_face2 = aBlockTool.GetFaceID(theFace2); + } + + // Find three pairs of points + Standard_Integer v11_id = 0, v12_id = 0, v13_id = 0; // vertices of the first face + Standard_Integer v21_id = 0, v22_id = 0, v23_id = 0; // vertices of the second face + + if (dir_face2 == opp_face1) { // is opposite to + + // We will take vertices with equal local numbers on the faces, + // as the Block6Explorer gives equal local numbers + // to the linked vertices on the opposite faces, + // i.e. v1* is linked with the v2* by an edge: + + v11_id = aBlockTool.GetVertexID(dir_face1, 1); + v12_id = aBlockTool.GetVertexID(dir_face1, 2); + v13_id = aBlockTool.GetVertexID(dir_face1, 4); + + v21_id = aBlockTool.GetVertexID(dir_face2, 1); + v22_id = aBlockTool.GetVertexID(dir_face2, 2); + v23_id = aBlockTool.GetVertexID(dir_face2, 4); + + } else { + + Standard_Integer common_edge_id = aBlockTool.FindCommonEdgeID(dir_face1, dir_face2); + Standard_Integer common_vertex1 = aBlockTool.GetVertexOnEdgeID(common_edge_id, 1); + Standard_Integer common_vertex2 = aBlockTool.GetVertexOnEdgeID(common_edge_id, 2); + + Standard_Integer not_common_v1 = 0; + Standard_Integer vid = 1; + Standard_Boolean isFound = Standard_False; + while (!isFound && vid <= 4) { + not_common_v1 = aBlockTool.GetVertexID(dir_face1, vid); + isFound = (not_common_v1 != common_vertex2 && + aBlockTool.FindEdgeID(not_common_v1, common_vertex1) != 0); + vid++; + } + + Standard_Integer not_common_v2 = 0; + vid = 1; + isFound = Standard_False; + while (!isFound && vid <= 4) { + not_common_v2 = aBlockTool.GetVertexID(dir_face2, vid); + isFound = (not_common_v2 != common_vertex2 && + aBlockTool.FindEdgeID(not_common_v2, common_vertex1) != 0); + vid++; + } + + v11_id = common_vertex1; + v12_id = common_vertex2; + v13_id = not_common_v1; + + v21_id = common_vertex1; + v22_id = common_vertex2; + v23_id = not_common_v2; + } + + // Construct a transformation operator + TopoDS_Vertex V11 = TopoDS::Vertex(aBlockTool.GetVertex(v11_id)); + TopoDS_Vertex V12 = TopoDS::Vertex(aBlockTool.GetVertex(v12_id)); + TopoDS_Vertex V13 = TopoDS::Vertex(aBlockTool.GetVertex(v13_id)); + + TopoDS_Vertex V21 = TopoDS::Vertex(aBlockTool.GetVertex(v21_id)); + TopoDS_Vertex V22 = TopoDS::Vertex(aBlockTool.GetVertex(v22_id)); + TopoDS_Vertex V23 = TopoDS::Vertex(aBlockTool.GetVertex(v23_id)); + + // Axes of the first direction face + gp_Pnt P1 = BRep_Tool::Pnt(V11); + gp_Vec VecN1 (P1, BRep_Tool::Pnt(V12)); + gp_Vec VecX1 (P1, BRep_Tool::Pnt(V13)); + gp_Ax3 Ax1 (P1, VecN1, VecX1); + + // Axes of the second direction face + gp_Pnt P2 = BRep_Tool::Pnt(V21); + gp_Vec VecN2 (P2, BRep_Tool::Pnt(V22)); + gp_Vec VecX2 (P2, BRep_Tool::Pnt(V23)); + gp_Ax3 Ax2 (P2, VecN2, VecX2); + + gp_Trsf aTrsf; + aTrsf.SetDisplacement(Ax1, Ax2); + if (uv == 1) { + aTrsfU = aTrsf; + } else { + aTrsfV = aTrsf; + Ax1V = Ax1; + Ax2V = Ax2; + } + + // Check, that is similar to . + // Actually, we need only to check right position of one + // vertex, not involved into the transformation construction. + if (!aBlockTool.IsSimilarFaces(dir_face1, dir_face2, aTrsf)) { + Standard_ConstructionError::Raise("The direction faces are not similar"); + } + } + + // Perform multi-transformation + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound(aCompound); + + TopoDS_Shape aPrevShapeU = theBlock; + for (int i = 0; i < theNbIterU; i++) { + TopoDS_Shape aPrevShapeV = aPrevShapeU; + for (int j = 0; j < theNbIterV; j++) { + B.Add(aCompound, aPrevShapeV); + BRepBuilderAPI_Transform aTransformationV (aPrevShapeV, aTrsfV, Standard_False); + aPrevShapeV = aTransformationV.Shape(); + } + BRepBuilderAPI_Transform aTransformationU (aPrevShapeU, aTrsfU, Standard_False); + aPrevShapeU = aTransformationU.Shape(); + // Correction of the second transformation according to the first transformation + Ax1V.Transform(aTrsfU); + Ax2V.Transform(aTrsfU); + aTrsfV.SetDisplacement(Ax1V, Ax2V); + // Correction done + } + theResult = aCompound; +} + +//======================================================================= +//function : GEOMImpl_BlockDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_BlockDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BlockDriver", + sizeof(GEOMImpl_BlockDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_BlockDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BlockDriver))) { + _anOtherObject = Handle(GEOMImpl_BlockDriver)((Handle(GEOMImpl_BlockDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.hxx b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx new file mode 100644 index 000000000..ab3ea4dfe --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx @@ -0,0 +1,174 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_BlockDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_BlockDriver_HeaderFile +#define _GEOMImpl_BlockDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_BlockDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BlockDriver); + +class Handle(GEOMImpl_BlockDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_BlockDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_BlockDriver)(const Handle(GEOMImpl_BlockDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_BlockDriver)(const GEOMImpl_BlockDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_BlockDriver)& operator=(const Handle(GEOMImpl_BlockDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_BlockDriver)& operator=(const GEOMImpl_BlockDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_BlockDriver* operator->() + { + return (GEOMImpl_BlockDriver *)ControlAccess(); + } + + GEOMImpl_BlockDriver* operator->() const + { + return (GEOMImpl_BlockDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_BlockDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_BlockDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif +#include + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_BlockDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_BlockDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_BlockDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BlockDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BlockDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BlockDriver) == AType || TFunction_Driver::IsKind(AType)); } + +private: + void MultiTransformate1D (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace1, + const TopoDS_Shape& theFace2, + const Standard_Integer theNbIter, + TopoDS_Shape& theResult) const; + + void MultiTransformate2D (const TopoDS_Shape& theBlock, + const TopoDS_Shape& theFace1U, + const TopoDS_Shape& theFace2U, + const Standard_Integer theNbIterU, + const TopoDS_Shape& theFace1V, + const TopoDS_Shape& theFace2V, + const Standard_Integer theNbIterV, + TopoDS_Shape& theResult) const; + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx new file mode 100644 index 000000000..f427e61e8 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_BooleanDriver::GetID() +{ + static Standard_GUID aBooleanDriver("FF1BBB21-5D14-4df2-980B-3A668264EA16"); + return aBooleanDriver; +} + + +//======================================================================= +//function : GEOMImpl_BooleanDriver +//purpose : +//======================================================================= +GEOMImpl_BooleanDriver::GEOMImpl_BooleanDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IBoolean aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + Handle(GEOM_Function) aRefShape1 = aCI.GetShape1(); + Handle(GEOM_Function) aRefShape2 = aCI.GetShape2(); + TopoDS_Shape aShape1 = aRefShape1->GetValue(); + TopoDS_Shape aShape2 = aRefShape2->GetValue(); + if (!aShape1.IsNull() && !aShape2.IsNull()) { + if (aType == BOOLEAN_COMMON) { + BRepAlgoAPI_Common BO (aShape1, aShape2); +// BO.Build(); + if (!BO.IsDone()) { + StdFail_NotDone::Raise("Requested boolean operation can not be performed on the given shapes"); + } + aShape = BO.Shape(); + } else if (aType == BOOLEAN_CUT) { + BRepAlgoAPI_Cut BO (aShape1, aShape2); + if (!BO.IsDone()) { + StdFail_NotDone::Raise("Requested boolean operation can not be performed on the given shapes"); + } + aShape = BO.Shape(); + } else if (aType == BOOLEAN_FUSE) { + BRepAlgoAPI_Fuse BO (aShape1, aShape2); + if (!BO.IsDone()) { + StdFail_NotDone::Raise("Requested boolean operation can not be performed on the given shapes"); + } + aShape = BO.Shape(); + } else if (aType == BOOLEAN_SECTION) { + BRepAlgoAPI_Section BO (aShape1, aShape2); + if (!BO.IsDone()) { + StdFail_NotDone::Raise("Requested boolean operation can not be performed on the given shapes"); + } + aShape = BO.Shape(); + } else { + } + } + + if (aShape.IsNull()) return 0; + if (!BRepAlgo::IsValid(aShape)) { + Standard_ConstructionError::Raise("Boolean aborted : non valid shape result"); + } + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_BooleanDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BooleanDriver", + sizeof(GEOMImpl_BooleanDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_BooleanDriver) Handle(GEOMImpl_BooleanDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_BooleanDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BooleanDriver))) { + _anOtherObject = Handle(GEOMImpl_BooleanDriver)((Handle(GEOMImpl_BooleanDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx new file mode 100644 index 000000000..c65e964ee --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_BooleanDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_BooleanDriver_HeaderFile +#define _GEOMImpl_BooleanDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_BooleanDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BooleanDriver); + +class Handle(GEOMImpl_BooleanDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_BooleanDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_BooleanDriver)(const Handle(GEOMImpl_BooleanDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_BooleanDriver)(const GEOMImpl_BooleanDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_BooleanDriver)& operator=(const Handle(GEOMImpl_BooleanDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_BooleanDriver)& operator=(const GEOMImpl_BooleanDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_BooleanDriver* operator->() + { + return (GEOMImpl_BooleanDriver *)ControlAccess(); + } + + GEOMImpl_BooleanDriver* operator->() const + { + return (GEOMImpl_BooleanDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_BooleanDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_BooleanDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_BooleanDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_BooleanDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_BooleanDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BooleanDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BooleanDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx new file mode 100644 index 000000000..99e1ff87d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx @@ -0,0 +1,151 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_BoxDriver::GetID() +{ + static Standard_GUID aBoxDriver("FF1BBB13-5D14-4df2-980B-3A668264EA16"); + return aBoxDriver; +} + + +//======================================================================= +//function : GEOMImpl_BoxDriver +//purpose : +//======================================================================= +GEOMImpl_BoxDriver::GEOMImpl_BoxDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_BoxDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IBox aBI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == BOX_DX_DY_DZ) { + BRepPrimAPI_MakeBox MB (aBI.GetDX(), aBI.GetDY(), aBI.GetDZ()); + MB.Build(); + + if (!MB.IsDone()) { + StdFail_NotDone::Raise("Box with the given dimensions can not be computed"); + } + aShape = MB.Shape(); + } + else if (aType == BOX_TWO_PNT) { + Handle(GEOM_Function) aRefPoint1 = aBI.GetRef1(); + Handle(GEOM_Function) aRefPoint2 = aBI.GetRef2(); + TopoDS_Shape aShape1 = aRefPoint1->GetValue(); + TopoDS_Shape aShape2 = aRefPoint2->GetValue(); + if (aShape1.ShapeType() == TopAbs_VERTEX && + aShape2.ShapeType() == TopAbs_VERTEX) { + gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + BRepPrimAPI_MakeBox MB (P1,P2); + MB.Build(); + + if (!MB.IsDone()) { + StdFail_NotDone::Raise("Box can not be computed from the given point"); + } + aShape = MB.Shape(); + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_BoxDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_BoxDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BoxDriver", + sizeof(GEOMImpl_BoxDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_BoxDriver) Handle(GEOMImpl_BoxDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_BoxDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BoxDriver))) { + _anOtherObject = Handle(GEOMImpl_BoxDriver)((Handle(GEOMImpl_BoxDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.hxx b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx new file mode 100644 index 000000000..a7692f639 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_BoxDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_BoxDriver_HeaderFile +#define _GEOMImpl_BoxDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_BoxDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BoxDriver); + +class Handle(GEOMImpl_BoxDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_BoxDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_BoxDriver)(const Handle(GEOMImpl_BoxDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_BoxDriver)(const GEOMImpl_BoxDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_BoxDriver)& operator=(const Handle(GEOMImpl_BoxDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_BoxDriver)& operator=(const GEOMImpl_BoxDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_BoxDriver* operator->() + { + return (GEOMImpl_BoxDriver *)ControlAccess(); + } + + GEOMImpl_BoxDriver* operator->() const + { + return (GEOMImpl_BoxDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_BoxDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_BoxDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_BoxDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_BoxDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_BoxDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BoxDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BoxDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BoxDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx new file mode 100644 index 000000000..7cabd43cf --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx @@ -0,0 +1,248 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ChamferDriver::GetID() +{ + static Standard_GUID aChamferDriver("FF1BBB42-5D14-4df2-980B-3A668264EA16"); + return aChamferDriver; +} + + +//======================================================================= +//function : GEOMImpl_ChamferDriver +//purpose : +//======================================================================= +GEOMImpl_ChamferDriver::GEOMImpl_ChamferDriver() +{ +} + +//======================================================================= +//function : isGoodForChamfer +//purpose : +//======================================================================= +static Standard_Boolean isGoodForChamfer (const TopoDS_Shape& theShape) +{ + if (theShape.ShapeType() == TopAbs_SHELL || + theShape.ShapeType() == TopAbs_SOLID || + theShape.ShapeType() == TopAbs_COMPSOLID) { + return Standard_True; + } + + if (theShape.ShapeType() == TopAbs_COMPOUND) { + TopTools_MapOfShape mapShape; + TopoDS_Iterator It (theShape, Standard_False, Standard_False); + for (; It.More(); It.Next()) { + if (mapShape.Add(It.Value())) { + if (!isGoodForChamfer(It.Value())) { + return Standard_False; + } + } + } + return Standard_True; + } + + return Standard_False; +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IChamfer aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + + // Check the shape type. It have to be shell + // or solid, or compsolid, or compound of these shapes. + if (!isGoodForChamfer(aShapeBase)) { + StdFail_NotDone::Raise + ("Wrong shape. Must be shell or solid, or compsolid or compound of these shapes"); + } + + BRepFilletAPI_MakeChamfer fill (aShapeBase); + + if (aType == CHAMFER_SHAPE_ALL) { + // symmetric chamfer on all edges + double aD = aCI.GetD(); + TopTools_IndexedDataMapOfShapeListOfShape M; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M); + for (int i = 1; i <= M.Extent(); i++) { + TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); + TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); + if (!BRepTools::IsReallyClosed(E, F) && + !BRep_Tool::Degenerated(E) && + M.FindFromIndex(i).Extent() == 2) + fill.Add(aD, E, F); + } + } else if (aType == CHAMFER_SHAPE_EDGE) { + // chamfer on edges, common to two faces, with D1 on the first face + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + TopoDS_Shape aFace1, aFace2; + if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) && + GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2)) { + TopoDS_Face F = TopoDS::Face(aFace1); + + // fill map of edges of the second face + TopTools_MapOfShape aMap; + TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE); + for (; Exp2.More(); Exp2.Next()) { + aMap.Add(Exp2.Current()); + } + + // find edges of the first face, common with the second face + TopExp_Explorer Exp (aFace1, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (aMap.Contains(Exp.Current())) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) + fill.Add(aD1, aD2, E, F); + } + } + } + } else if (aType == CHAMFER_SHAPE_FACES) { + // chamfer on all edges of the selected faces, with D1 on the selected face + // (on first selected face, if the edge belongs to two selected faces) + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + int aLen = aCI.GetLength(); + int ind = 1; + TopTools_MapOfShape aMap; + TopTools_IndexedDataMapOfShapeListOfShape M; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M); + for (; ind <= aLen; ind++) + { + TopoDS_Shape aShapeFace; + if (GEOMImpl_ILocalOperations::GetSubShape + (aShapeBase, aCI.GetFace(ind), aShapeFace)) { + TopoDS_Face F = TopoDS::Face(aShapeFace); + TopExp_Explorer Exp (F, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (!aMap.Contains(Exp.Current())) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && + !BRep_Tool::Degenerated(E) && + M.FindFromKey(E).Extent() == 2) + fill.Add(aD1, aD2, E, F); + } + } + } + } + } else { + } + + fill.Build(); + if (!fill.IsDone()) { + StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters"); + } + aShape = fill.Shape(); + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ChamferDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ChamferDriver", + sizeof(GEOMImpl_ChamferDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ChamferDriver) Handle(GEOMImpl_ChamferDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ChamferDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ChamferDriver))) { + _anOtherObject = Handle(GEOMImpl_ChamferDriver)((Handle(GEOMImpl_ChamferDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx new file mode 100644 index 000000000..605683be8 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ChamferDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ChamferDriver_HeaderFile +#define _GEOMImpl_ChamferDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ChamferDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ChamferDriver); + +class Handle(GEOMImpl_ChamferDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ChamferDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ChamferDriver)(const Handle(GEOMImpl_ChamferDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ChamferDriver)(const GEOMImpl_ChamferDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ChamferDriver)& operator=(const Handle(GEOMImpl_ChamferDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ChamferDriver)& operator=(const GEOMImpl_ChamferDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ChamferDriver* operator->() + { + return (GEOMImpl_ChamferDriver *)ControlAccess(); + } + + GEOMImpl_ChamferDriver* operator->() const + { + return (GEOMImpl_ChamferDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ChamferDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ChamferDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ChamferDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ChamferDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ChamferDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ChamferDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ChamferDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx new file mode 100644 index 000000000..61dedcccc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -0,0 +1,174 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_CircleDriver::GetID() +{ + static Standard_GUID aCircleDriver("FF1BBB32-5D14-4df2-980B-3A668264EA16"); + return aCircleDriver; +} + + +//======================================================================= +//function : GEOMImpl_CircleDriver +//purpose : +//======================================================================= +GEOMImpl_CircleDriver::GEOMImpl_CircleDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICircle aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == CIRCLE_PNT_VEC_R) { + Handle(GEOM_Function) aRefPoint = aCI.GetCenter(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX && + aShapeVec.ShapeType() == TopAbs_EDGE) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + gp_Ax2 anAxes (aP, aV); + gp_Circ aCirc (anAxes, aCI.GetRadius()); + aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + } + } + } + else if (aType == CIRCLE_THREE_PNT) { + Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); + Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); + Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); + TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue(); + TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue(); + TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && + aShapePnt2.ShapeType() == TopAbs_VERTEX && + aShapePnt3.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2)); + gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3)); + if (aP1.Distance(aP2) < gp::Resolution() || + aP1.Distance(aP3) < gp::Resolution() || + aP2.Distance(aP3) < gp::Resolution()) + Standard_ConstructionError::Raise("Circle creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) + Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line"); + Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value(); + aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_CircleDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CircleDriver", + sizeof(GEOMImpl_CircleDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_CircleDriver) Handle(GEOMImpl_CircleDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_CircleDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CircleDriver))) { + _anOtherObject = Handle(GEOMImpl_CircleDriver)((Handle(GEOMImpl_CircleDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.hxx b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx new file mode 100644 index 000000000..c71752dbd --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_CircleDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_CircleDriver_HeaderFile +#define _GEOMImpl_CircleDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_CircleDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CircleDriver); + +class Handle(GEOMImpl_CircleDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_CircleDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_CircleDriver)(const Handle(GEOMImpl_CircleDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_CircleDriver)(const GEOMImpl_CircleDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_CircleDriver)& operator=(const Handle(GEOMImpl_CircleDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_CircleDriver)& operator=(const GEOMImpl_CircleDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_CircleDriver* operator->() + { + return (GEOMImpl_CircleDriver *)ControlAccess(); + } + + GEOMImpl_CircleDriver* operator->() const + { + return (GEOMImpl_CircleDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_CircleDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_CircleDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_CircleDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_CircleDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_CircleDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CircleDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CircleDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CircleDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.cxx b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx new file mode 100644 index 000000000..fa89e2c03 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx @@ -0,0 +1,185 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ConeDriver::GetID() +{ + static Standard_GUID aConeDriver("FF1BBB15-5D14-4df2-980B-3A668264EA16"); + return aConeDriver; +} + + +//======================================================================= +//function : GEOMImpl_ConeDriver +//purpose : +//======================================================================= +GEOMImpl_ConeDriver::GEOMImpl_ConeDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ConeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICone aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + gp_Pnt aP; + gp_Vec aV; + + Standard_Real aR1 = aCI.GetR1(); + Standard_Real aR2 = aCI.GetR2(); + + if (aType == CONE_R1_R2_H) { + aP = gp::Origin(); + aV = gp::DZ(); + + } else if (aType == CONE_PNT_VEC_R1_R2_H) { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.IsNull() || aShapeVec.IsNull()) { + Standard_NullObject::Raise + ("Cone creation aborted: point or vector is not defined"); + } + if (aShapePnt.ShapeType() != TopAbs_VERTEX || + aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Cone creation aborted: point or vector shapes has wrong type"); + } + + aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_NullObject::Raise + ("Cylinder creation aborted: vector is not defined"); + } + aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + + } else { + return 0; + } + + if (aCI.GetH() < 0.0) aV.Reverse(); + gp_Ax2 anAxes (aP, aV); + + TopoDS_Shape aShape; + // Cone does not work if same radius + if (fabs(aR1 - aR2) <= Precision::Confusion()) { + BRepPrimAPI_MakeCylinder MC (anAxes, (aR1 + aR2)/2.0, Abs(aCI.GetH())); + MC.Build(); + if (!MC.IsDone()) { + StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters"); + } + aShape = MC.Shape(); + } else { + BRepPrimAPI_MakeCone MC (anAxes, aCI.GetR1(), aCI.GetR2(), Abs(aCI.GetH())); + MC.Build(); + if (!MC.IsDone()) { + StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters"); + } + aShape = MC.Shape(); + } + if (aShape.IsNull()) return 0; + + log.SetTouched(Label()); + + aFunction->SetValue(aShape); + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ConeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ConeDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ConeDriver", + sizeof(GEOMImpl_ConeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ConeDriver) Handle(GEOMImpl_ConeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ConeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ConeDriver))) { + _anOtherObject = Handle(GEOMImpl_ConeDriver)((Handle(GEOMImpl_ConeDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.hxx b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx new file mode 100644 index 000000000..02cf07d6f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ConeDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ConeDriver_HeaderFile +#define _GEOMImpl_ConeDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ConeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ConeDriver); + +class Handle(GEOMImpl_ConeDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ConeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ConeDriver)(const Handle(GEOMImpl_ConeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ConeDriver)(const GEOMImpl_ConeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ConeDriver)& operator=(const Handle(GEOMImpl_ConeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ConeDriver)& operator=(const GEOMImpl_ConeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ConeDriver* operator->() + { + return (GEOMImpl_ConeDriver *)ControlAccess(); + } + + GEOMImpl_ConeDriver* operator->() const + { + return (GEOMImpl_ConeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ConeDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ConeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ConeDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ConeDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ConeDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ConeDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ConeDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ConeDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx new file mode 100644 index 000000000..f2abc002c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx @@ -0,0 +1,134 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_CopyDriver::GetID() +{ + static Standard_GUID aCopyDriver("FF1BBB53-5D14-4df2-980B-3A668264EA16"); + return aCopyDriver; +} + + +//======================================================================= +//function : GEOMImpl_CopyDriver +//purpose : +//======================================================================= +GEOMImpl_CopyDriver::GEOMImpl_CopyDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_CopyDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + Standard_Integer aType = aFunction->GetType(); + + GEOMImpl_ICopy aCI (aFunction); + TopoDS_Shape aCopy; + + if(aType == COPY_WITH_REF) { + + Handle(GEOM_Function) aRefFunction = aCI.GetOriginal(); + if (aRefFunction.IsNull()) return 0; + TopoDS_Shape anOriginal = aRefFunction->GetValue(); + + TColStd_IndexedDataMapOfTransientTransient aMap; + + TNaming_CopyShape::CopyTool(anOriginal, aMap, aCopy); + } + else if(aType == COPY_WITHOUT_REF) { + aCopy = aFunction->GetValue(); + } + + if (aCopy.IsNull()) return 0; + + aFunction->SetValue(aCopy); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_CopyDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_CopyDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CopyDriver", + sizeof(GEOMImpl_CopyDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_CopyDriver) Handle(GEOMImpl_CopyDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_CopyDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CopyDriver))) { + _anOtherObject = Handle(GEOMImpl_CopyDriver)((Handle(GEOMImpl_CopyDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx new file mode 100644 index 000000000..53d58aa7a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_CopyDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_CopyDriver_HeaderFile +#define _GEOMImpl_CopyDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_CopyDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CopyDriver); + +class Handle(GEOMImpl_CopyDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_CopyDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_CopyDriver)(const Handle(GEOMImpl_CopyDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_CopyDriver)(const GEOMImpl_CopyDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_CopyDriver)& operator=(const Handle(GEOMImpl_CopyDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_CopyDriver)& operator=(const GEOMImpl_CopyDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_CopyDriver* operator->() + { + return (GEOMImpl_CopyDriver *)ControlAccess(); + } + + GEOMImpl_CopyDriver* operator->() const + { + return (GEOMImpl_CopyDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_CopyDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_CopyDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_CopyDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_CopyDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_CopyDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CopyDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CopyDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CopyDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx new file mode 100644 index 000000000..baff87eea --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx @@ -0,0 +1,168 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_CylinderDriver::GetID() +{ + static Standard_GUID aCylinderDriver("FF1BBB14-5D14-4df2-980B-3A668264EA16"); + return aCylinderDriver; +} + + +//======================================================================= +//function : GEOMImpl_CylinderDriver +//purpose : +//======================================================================= +GEOMImpl_CylinderDriver::GEOMImpl_CylinderDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICylinder aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + gp_Pnt aP; + gp_Vec aV; + + if (aType == CYLINDER_R_H) { + aP = gp::Origin(); + aV = gp::DZ(); + } + else if (aType == CYLINDER_PNT_VEC_R_H) { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.IsNull() || aShapeVec.IsNull()) { + Standard_NullObject::Raise("Cylinder creation aborted: point or vector is not defined"); + } + if (aShapePnt.ShapeType() != TopAbs_VERTEX || + aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise("Cylinder creation aborted: point or vector shapes has wrong type"); + } + + aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_NullObject::Raise("Cylinder creation aborted: vector is not defined"); + } + aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + } + else { + return 0; + } + + if (aCI.GetH() < 0.0) aV.Reverse(); + gp_Ax2 anAxes (aP, aV); + + BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH())); + MC.Build(); + if (!MC.IsDone()) { + StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters"); + } + + TopoDS_Shape aShape = MC.Shape(); + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_CylinderDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_CylinderDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CylinderDriver", + sizeof(GEOMImpl_CylinderDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_CylinderDriver) Handle(GEOMImpl_CylinderDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_CylinderDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CylinderDriver))) { + _anOtherObject = Handle(GEOMImpl_CylinderDriver)((Handle(GEOMImpl_CylinderDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx new file mode 100644 index 000000000..ba55aac2b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_CylinderDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_CylinderDriver_HeaderFile +#define _GEOMImpl_CylinderDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_CylinderDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CylinderDriver); + +class Handle(GEOMImpl_CylinderDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_CylinderDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_CylinderDriver)(const Handle(GEOMImpl_CylinderDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_CylinderDriver)(const GEOMImpl_CylinderDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_CylinderDriver)& operator=(const Handle(GEOMImpl_CylinderDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_CylinderDriver)& operator=(const GEOMImpl_CylinderDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_CylinderDriver* operator->() + { + return (GEOMImpl_CylinderDriver *)ControlAccess(); + } + + GEOMImpl_CylinderDriver* operator->() const + { + return (GEOMImpl_CylinderDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_CylinderDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_CylinderDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_CylinderDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_CylinderDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_CylinderDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CylinderDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CylinderDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CylinderDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx new file mode 100644 index 000000000..fe5ddfe59 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx @@ -0,0 +1,144 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_EllipseDriver::GetID() +{ + static Standard_GUID aEllipseDriver("FF1BBB34-5D14-4df2-980B-3A668264EA16"); + return aEllipseDriver; +} + + +//======================================================================= +//function : GEOMImpl_EllipseDriver +//purpose : +//======================================================================= +GEOMImpl_EllipseDriver::GEOMImpl_EllipseDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IEllipse aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == ELLIPSE_PNT_VEC_RR) { + Handle(GEOM_Function) aRefPoint = aCI.GetCenter(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX && + aShapeVec.ShapeType() == TopAbs_EDGE) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + gp_Ax2 anAxes (aP, aV); + gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor()); + aShape = BRepBuilderAPI_MakeEdge(anEll).Edge(); + } + } + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_EllipseDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_EllipseDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_EllipseDriver", + sizeof(GEOMImpl_EllipseDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_EllipseDriver) Handle(GEOMImpl_EllipseDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_EllipseDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_EllipseDriver))) { + _anOtherObject = Handle(GEOMImpl_EllipseDriver)((Handle(GEOMImpl_EllipseDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx new file mode 100644 index 000000000..c1d16b9a6 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_EllipseDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_EllipseDriver_HeaderFile +#define _GEOMImpl_EllipseDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_EllipseDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_EllipseDriver); + +class Handle(GEOMImpl_EllipseDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_EllipseDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_EllipseDriver)(const Handle(GEOMImpl_EllipseDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_EllipseDriver)(const GEOMImpl_EllipseDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_EllipseDriver)& operator=(const Handle(GEOMImpl_EllipseDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_EllipseDriver)& operator=(const GEOMImpl_EllipseDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_EllipseDriver* operator->() + { + return (GEOMImpl_EllipseDriver *)ControlAccess(); + } + + GEOMImpl_EllipseDriver* operator->() const + { + return (GEOMImpl_EllipseDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_EllipseDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_EllipseDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_EllipseDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_EllipseDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_EllipseDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_EllipseDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_EllipseDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_EllipseDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx new file mode 100644 index 000000000..5898d9e1b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx @@ -0,0 +1,159 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#ifdef WNT +#include +#else +#include +#endif + +#ifdef WNT +#define LibHandle HMODULE +#define LoadLib( name ) LoadLibrary( name ) +#define GetProc GetProcAddress +#define UnLoadLib( handle ) FreeLibrary( handle ); +#else +#define LibHandle void* +#define LoadLib( name ) dlopen( name, RTLD_LAZY ) +#define GetProc dlsym +#define UnLoadLib( handle ) dlclose( handle ); +#endif + +typedef int (*funcPoint)(const TopoDS_Shape&, const TCollection_AsciiString&); + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ExportDriver::GetID() +{ + static Standard_GUID aExportDriver("FF1BBB58-5D14-4df2-980B-3A668264EA16"); + return aExportDriver; +} + + +//======================================================================= +//function : GEOMImpl_ExportDriver +//purpose : +//======================================================================= +GEOMImpl_ExportDriver::GEOMImpl_ExportDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ExportDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IImportExport aCI (aFunction); + + // retrieve the being exported shape + TopoDS_Shape aShape; + Handle(GEOM_Function) aRefFunction = aCI.GetOriginal(); + if (aRefFunction.IsNull()) return 0; + aShape = aRefFunction->GetValue(); + if (aShape.IsNull()) return 0; + // !!! set the result of function to be used by next operations + aFunction->SetValue(aShape); + + // retrieve the file and format names + TCollection_AsciiString aFileName = aCI.GetFileName(); + TCollection_AsciiString aLibName = aCI.GetPluginName(); + if (aFileName.IsEmpty() || aLibName.IsEmpty()) + return 0; + + // load plugin library + LibHandle anExportLib = LoadLib( aLibName.ToCString() ); + funcPoint fp = 0; + if ( anExportLib ) + fp = (funcPoint)GetProc( anExportLib, "Export" ); + + if ( !fp ) + return 0; + + // perform the export + int res = fp( aShape, aFileName ); + + // unload plugin library + UnLoadLib( anExportLib ); + if ( res ) + log.SetTouched(Label()); + + return res; +} + + +//======================================================================= +//function : GEOMImpl_ExportDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportDriver", + sizeof(GEOMImpl_ExportDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ExportDriver) Handle(GEOMImpl_ExportDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ExportDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ExportDriver))) { + _anOtherObject = Handle(GEOMImpl_ExportDriver)((Handle(GEOMImpl_ExportDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.hxx b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx new file mode 100644 index 000000000..0d46a94ac --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ExportDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ExportDriver_HeaderFile +#define _GEOMImpl_ExportDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ExportDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ExportDriver); + +class Handle(GEOMImpl_ExportDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ExportDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ExportDriver)(const Handle(GEOMImpl_ExportDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ExportDriver)(const GEOMImpl_ExportDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ExportDriver)& operator=(const Handle(GEOMImpl_ExportDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ExportDriver)& operator=(const GEOMImpl_ExportDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ExportDriver* operator->() + { + return (GEOMImpl_ExportDriver *)ControlAccess(); + } + + GEOMImpl_ExportDriver* operator->() const + { + return (GEOMImpl_ExportDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ExportDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ExportDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ExportDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ExportDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ExportDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ExportDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ExportDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ExportDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx new file mode 100644 index 000000000..3dbe9a461 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx @@ -0,0 +1,177 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_FilletDriver::GetID() +{ + static Standard_GUID aFilletDriver("FF1BBB41-5D14-4df2-980B-3A668264EA16"); + return aFilletDriver; +} + + +//======================================================================= +//function : GEOMImpl_FilletDriver +//purpose : +//======================================================================= +GEOMImpl_FilletDriver::GEOMImpl_FilletDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFillet aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + BRepFilletAPI_MakeFillet fill (aShapeBase); + + if (aType == FILLET_SHAPE_ALL) { + TopExp_Explorer Exp (aShapeBase, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + fill.Add(E); + } + } else if (aType == FILLET_SHAPE_EDGES) { + int aLen = aCI.GetLength(); + int ind = 1; + for (; ind <= aLen; ind++) { + TopoDS_Shape aShapeEdge; + if (GEOMImpl_ILocalOperations::GetSubShape + (aShapeBase, aCI.GetEdge(ind), aShapeEdge)) { + fill.Add(TopoDS::Edge(aShapeEdge)); + } + } + } else if (aType == FILLET_SHAPE_FACES) { + int aLen = aCI.GetLength(); + int ind = 1; + for (; ind <= aLen; ind++) { + TopoDS_Shape aShapeFace; + if (GEOMImpl_ILocalOperations::GetSubShape + (aShapeBase, aCI.GetFace(ind), aShapeFace)) { + TopExp_Explorer Exp (aShapeFace, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + fill.Add(TopoDS::Edge(Exp.Current())); + } + } + } + } else { + } + + for (int i = 1; i <= fill.NbContours(); i++) { + fill.SetRadius(aCI.GetR(), i, i); + } + fill.Build(); + if (!fill.IsDone()) { + StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius"); + } + aShape = fill.Shape(); + + if (aShape.IsNull()) return 0; + + // Check shape validity + BRepCheck_Analyzer ana (aShape, false); + if (!ana.IsValid()) { + StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result"); + } + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_FilletDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_FilletDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FilletDriver", + sizeof(GEOMImpl_FilletDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_FilletDriver) Handle(GEOMImpl_FilletDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_FilletDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FilletDriver))) { + _anOtherObject = Handle(GEOMImpl_FilletDriver)((Handle(GEOMImpl_FilletDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.hxx b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx new file mode 100644 index 000000000..5f9a6d2d1 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_FilletDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_FilletDriver_HeaderFile +#define _GEOMImpl_FilletDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_FilletDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FilletDriver); + +class Handle(GEOMImpl_FilletDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_FilletDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_FilletDriver)(const Handle(GEOMImpl_FilletDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_FilletDriver)(const GEOMImpl_FilletDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_FilletDriver)& operator=(const Handle(GEOMImpl_FilletDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_FilletDriver)& operator=(const GEOMImpl_FilletDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_FilletDriver* operator->() + { + return (GEOMImpl_FilletDriver *)ControlAccess(); + } + + GEOMImpl_FilletDriver* operator->() const + { + return (GEOMImpl_FilletDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_FilletDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_FilletDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_FilletDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_FilletDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_FilletDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FilletDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FilletDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FilletDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx new file mode 100644 index 000000000..c9771babe --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx @@ -0,0 +1,186 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_FillingDriver::GetID() +{ + static Standard_GUID aFillingDriver ("FF1BBB62-5D14-4df2-980B-3A668264EA16"); + return aFillingDriver; +} + + +//======================================================================= +//function : GEOMImpl_FillingDriver +//purpose : +//======================================================================= + +GEOMImpl_FillingDriver::GEOMImpl_FillingDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + if (aFunction.IsNull()) return 0; + + if (aFunction->GetType() != BASIC_FILLING) return 0; + + GEOMImpl_IFilling IF (aFunction); + Handle(GEOM_Function) aShapeFunction = IF.GetShape(); + if (aShapeFunction.IsNull()) return 0; + TopoDS_Shape aShape = aShapeFunction->GetValue(); + if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return 0; + + Standard_Integer mindeg = IF.GetMinDeg(); + Standard_Integer maxdeg = IF.GetMaxDeg(); + Standard_Real tol3d = IF.GetTol2D(); + Standard_Real tol2d = IF.GetTol3D(); + Standard_Integer nbiter = IF.GetNbIter(); + + if (mindeg > maxdeg) { + Standard_RangeError::Raise("Minimal degree can not be more than maximal degree"); + } + + /* we verify the contents of the shape */ + TopExp_Explorer Ex; + TopoDS_Shape Scurrent; + Standard_Real First, Last; + Handle(Geom_Curve) C; + GeomFill_SectionGenerator Section; + + Standard_Integer i = 0; + for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) { + Scurrent = Ex.Current() ; + if (Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return 0; + C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + C = new Geom_TrimmedCurve(C, First, Last); + Section.AddCurve(C); + i++; + } + + /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */ + Section.Perform(Precision::Confusion()); + Handle(GeomFill_Line) Line = new GeomFill_Line(i); + + GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */ + App.Perform(Line, Section); + + if (!App.IsDone()) return 0; + Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; + App.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots); + Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface + (App.SurfPoles(), App.SurfWeights(), App.SurfUKnots(), App.SurfVKnots(), + App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree()); + + if (GBS.IsNull()) return 0; + aShape = BRepBuilderAPI_MakeFace(GBS); + + /* We test the validity of resulting shape */ + if (!BRepAlgo::IsValid((aShape))) { + Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); + return 0; + } + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + return 1; +} + + +//======================================================================= +//function : GEOMImpl_FillingDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_FillingDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FillingDriver", + sizeof(GEOMImpl_FillingDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_FillingDriver) Handle(GEOMImpl_FillingDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_FillingDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FillingDriver))) { + _anOtherObject = Handle(GEOMImpl_FillingDriver)((Handle(GEOMImpl_FillingDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.hxx b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx new file mode 100644 index 000000000..a4d46e283 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_FillingDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_FillingDriver_HeaderFile +#define _GEOMImpl_FillingDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_FillingDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FillingDriver); + +class Handle(GEOMImpl_FillingDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_FillingDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_FillingDriver)(const Handle(GEOMImpl_FillingDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_FillingDriver)(const GEOMImpl_FillingDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_FillingDriver)& operator=(const Handle(GEOMImpl_FillingDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_FillingDriver)& operator=(const GEOMImpl_FillingDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_FillingDriver* operator->() + { + return (GEOMImpl_FillingDriver *)ControlAccess(); + } + + GEOMImpl_FillingDriver* operator->() const + { + return (GEOMImpl_FillingDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_FillingDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_FillingDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_FillingDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_FillingDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_FillingDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FillingDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FillingDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FillingDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx new file mode 100644 index 000000000..74ebd75c3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -0,0 +1,375 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +GEOMImpl_Gen::GEOMImpl_Gen() +{ + MESSAGE("GEOMImpl_Gen::GEOMImpl_Gen"); + _mapOfBasicOperations.clear(); + + // Basic elements + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PointDriver::GetID(), new GEOMImpl_PointDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_VectorDriver::GetID(), new GEOMImpl_VectorDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_LineDriver::GetID(), new GEOMImpl_LineDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PlaneDriver::GetID(), new GEOMImpl_PlaneDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MarkerDriver::GetID(), new GEOMImpl_MarkerDriver()); + + // Curves + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArcDriver::GetID(), new GEOMImpl_ArcDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CircleDriver::GetID(), new GEOMImpl_CircleDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_EllipseDriver::GetID(), new GEOMImpl_EllipseDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver()); + + // 3D Primitives + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ConeDriver::GetID(), new GEOMImpl_ConeDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CylinderDriver::GetID(), new GEOMImpl_CylinderDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PrismDriver::GetID(), new GEOMImpl_PrismDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeDriver::GetID(), new GEOMImpl_PipeDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RevolutionDriver::GetID(), new GEOMImpl_RevolutionDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SphereDriver::GetID(), new GEOMImpl_SphereDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TorusDriver::GetID(), new GEOMImpl_TorusDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FillingDriver::GetID(), new GEOMImpl_FillingDriver()); + + // Shapes Operations + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ShapeDriver::GetID(), new GEOMImpl_ShapeDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_GlueDriver::GetID(), new GEOMImpl_GlueDriver()); + + // Blocks Operations + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BlockDriver::GetID(), new GEOMImpl_BlockDriver()); + + // Boolean Operations, Partition + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BooleanDriver::GetID(), new GEOMImpl_BooleanDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PartitionDriver::GetID(), new GEOMImpl_PartitionDriver()); + + // Local Operations + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver()); + + // Geometrical Transformations, Offset, Scale + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_TranslateDriver::GetID(), new GEOMImpl_TranslateDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_RotateDriver::GetID(), new GEOMImpl_RotateDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MirrorDriver::GetID(), new GEOMImpl_MirrorDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_OffsetDriver::GetID(), new GEOMImpl_OffsetDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ScaleDriver::GetID(), new GEOMImpl_ScaleDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PositionDriver::GetID(), new GEOMImpl_PositionDriver()); + + // Insert Operations (Copy, Import/Export) + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_CopyDriver::GetID(), new GEOMImpl_CopyDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ImportDriver::GetID(), new GEOMImpl_ImportDriver()); + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportDriver::GetID(), new GEOMImpl_ExportDriver()); + + // Shape Healing + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_HealingDriver::GetID(), new GEOMImpl_HealingDriver()); + + // Measurements + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver()); + + SetEngine(this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GEOMImpl_Gen::~GEOMImpl_Gen() +{ + MESSAGE("GEOMImpl_Gen::~GEOMImpl_Gen"); + + std::map::iterator aBasicIter = _mapOfBasicOperations.begin(); + for (; aBasicIter != _mapOfBasicOperations.end(); aBasicIter++) + delete (*aBasicIter).second; + + std::map::iterator aTransformIter = _mapOfTransformOperations.begin(); + for (; aTransformIter != _mapOfTransformOperations.end(); aTransformIter++) + delete (*aTransformIter).second; + + std::map::iterator a3DPrimIter = _mapOf3DPrimOperations.begin(); + for (; a3DPrimIter != _mapOf3DPrimOperations.end(); a3DPrimIter++) + delete (*a3DPrimIter).second; + + std::map::iterator aShapesIter = _mapOfShapesOperations.begin(); + for (; aShapesIter != _mapOfShapesOperations.end(); aShapesIter++) + delete (*aShapesIter).second; + + std::map::iterator aBlocksIter = _mapOfBlocksOperations.begin(); + for (; aBlocksIter != _mapOfBlocksOperations.end(); aBlocksIter++) + delete (*aBlocksIter).second; + + std::map::iterator aBooleanIter = _mapOfBooleanOperations.begin(); + for (; aBooleanIter != _mapOfBooleanOperations.end(); aBooleanIter++) + delete (*aBooleanIter).second; + + std::map::iterator aHealingIter = _mapOfHealingOperations.begin(); + for (; aHealingIter != _mapOfHealingOperations.end(); aHealingIter++) + delete (*aHealingIter).second; + + std::map::iterator aCurvesIter = _mapOfCurvesOperations.begin(); + for (; aCurvesIter != _mapOfCurvesOperations.end(); aCurvesIter++) + delete (*aCurvesIter).second; + + std::map::iterator aLocalIter = _mapOfLocalOperations.begin(); + for (; aLocalIter != _mapOfLocalOperations.end(); aLocalIter++) + delete (*aLocalIter).second; + + std::map::iterator aInsertIter = _mapOfInsertOperations.begin(); + for (; aInsertIter != _mapOfInsertOperations.end(); aInsertIter++) + delete (*aInsertIter).second; + + std::map::iterator aMeasureIter = _mapOfMeasureOperations.begin(); + for (; aMeasureIter != _mapOfMeasureOperations.end(); aMeasureIter++) + delete (*aMeasureIter).second; + + std::map::iterator aGroupIter = _mapOfGroupOperations.begin(); + for (; aGroupIter != _mapOfGroupOperations.end(); aGroupIter++) + delete (*aGroupIter).second; +} + +//============================================================================= +/*! + * GetIBasicOperations + */ +//============================================================================= +GEOMImpl_IBasicOperations* GEOMImpl_Gen::GetIBasicOperations(int theDocID) +{ + if(_mapOfBasicOperations.find(theDocID) == _mapOfBasicOperations.end()) { + _mapOfBasicOperations[theDocID] = new GEOMImpl_IBasicOperations(this, theDocID); + } + + return _mapOfBasicOperations[theDocID]; +} + +//============================================================================= +/*! + * GetITransformOperations + */ +//============================================================================= +GEOMImpl_ITransformOperations* GEOMImpl_Gen::GetITransformOperations(int theDocID) +{ + if(_mapOfTransformOperations.find(theDocID) == _mapOfTransformOperations.end()) { + _mapOfTransformOperations[theDocID] = new GEOMImpl_ITransformOperations(this, theDocID); + } + + return _mapOfTransformOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIBooleanOperations + */ +//============================================================================= +GEOMImpl_IBooleanOperations* GEOMImpl_Gen::GetIBooleanOperations(int theDocID) +{ + if(_mapOfBooleanOperations.find(theDocID) == _mapOfBooleanOperations.end()) { + _mapOfBooleanOperations[theDocID] = new GEOMImpl_IBooleanOperations(this, theDocID); + } + + return _mapOfBooleanOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIHealingOperations + */ +//============================================================================= +GEOMImpl_IHealingOperations* GEOMImpl_Gen::GetIHealingOperations(int theDocID) +{ + if(_mapOfHealingOperations.find(theDocID) == _mapOfHealingOperations.end()) { + _mapOfHealingOperations[theDocID] = new GEOMImpl_IHealingOperations(this, theDocID); + } + + return _mapOfHealingOperations[theDocID]; +} + +//============================================================================= +/*! + * GetI3DPrimOperations + */ +//============================================================================= +GEOMImpl_I3DPrimOperations* GEOMImpl_Gen::GetI3DPrimOperations(int theDocID) +{ + if(_mapOf3DPrimOperations.find(theDocID) == _mapOf3DPrimOperations.end()) { + _mapOf3DPrimOperations[theDocID] = new GEOMImpl_I3DPrimOperations(this, theDocID); + } + + return _mapOf3DPrimOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIShapesOperations + */ +//============================================================================= +GEOMImpl_IShapesOperations* GEOMImpl_Gen::GetIShapesOperations(int theDocID) +{ + if(_mapOfShapesOperations.find(theDocID) == _mapOfShapesOperations.end()) { + _mapOfShapesOperations[theDocID] = new GEOMImpl_IShapesOperations(this, theDocID); + } + + return _mapOfShapesOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIBlocksOperations + */ +//============================================================================= +GEOMImpl_IBlocksOperations* GEOMImpl_Gen::GetIBlocksOperations(int theDocID) +{ + if(_mapOfBlocksOperations.find(theDocID) == _mapOfBlocksOperations.end()) { + _mapOfBlocksOperations[theDocID] = new GEOMImpl_IBlocksOperations(this, theDocID); + } + + return _mapOfBlocksOperations[theDocID]; +} + +//============================================================================= +/*! + * GetICurvesOperations + */ +//============================================================================= +GEOMImpl_ICurvesOperations* GEOMImpl_Gen::GetICurvesOperations(int theDocID) +{ + if(_mapOfCurvesOperations.find(theDocID) == _mapOfCurvesOperations.end()) { + _mapOfCurvesOperations[theDocID] = new GEOMImpl_ICurvesOperations(this, theDocID); + } + + return _mapOfCurvesOperations[theDocID]; +} + +//============================================================================= +/*! + * GetILocalOperations + */ +//============================================================================= +GEOMImpl_ILocalOperations* GEOMImpl_Gen::GetILocalOperations(int theDocID) +{ + if(_mapOfLocalOperations.find(theDocID) == _mapOfLocalOperations.end()) { + _mapOfLocalOperations[theDocID] = new GEOMImpl_ILocalOperations(this, theDocID); + } + + return _mapOfLocalOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIInsertOperations + */ +//============================================================================= +GEOMImpl_IInsertOperations* GEOMImpl_Gen::GetIInsertOperations(int theDocID) +{ + if(_mapOfInsertOperations.find(theDocID) == _mapOfInsertOperations.end()) { + _mapOfInsertOperations[theDocID] = new GEOMImpl_IInsertOperations(this, theDocID); + } + + return _mapOfInsertOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIMeasureOperations + */ +//============================================================================= +GEOMImpl_IMeasureOperations* GEOMImpl_Gen::GetIMeasureOperations(int theDocID) +{ + if(_mapOfMeasureOperations.find(theDocID) == _mapOfMeasureOperations.end()) { + _mapOfMeasureOperations[theDocID] = new GEOMImpl_IMeasureOperations(this, theDocID); + } + + return _mapOfMeasureOperations[theDocID]; +} + +//============================================================================= +/*! + * GetIGroupOperations + */ +//============================================================================= +GEOMImpl_IGroupOperations* GEOMImpl_Gen::GetIGroupOperations(int theDocID) +{ + if(_mapOfGroupOperations.find(theDocID) == _mapOfGroupOperations.end()) { + _mapOfGroupOperations[theDocID] = new GEOMImpl_IGroupOperations(this, theDocID); + } + + return _mapOfGroupOperations[theDocID]; +} diff --git a/src/GEOMImpl/GEOMImpl_Gen.hxx b/src/GEOMImpl/GEOMImpl_Gen.hxx new file mode 100644 index 000000000..5a303d8b3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Gen.hxx @@ -0,0 +1,92 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_GEN_HXX_ +#define _GEOMImpl_GEN_HXX_ + +#include + +#include "GEOMImpl_IBasicOperations.hxx" +#include "GEOMImpl_ITransformOperations.hxx" +#include "GEOMImpl_I3DPrimOperations.hxx" +#include "GEOMImpl_IShapesOperations.hxx" +#include "GEOMImpl_IBlocksOperations.hxx" +#include "GEOMImpl_IBooleanOperations.hxx" +#include "GEOMImpl_IHealingOperations.hxx" +#include "GEOMImpl_ICurvesOperations.hxx" +#include "GEOMImpl_ILocalOperations.hxx" +#include "GEOMImpl_IInsertOperations.hxx" +#include "GEOMImpl_IMeasureOperations.hxx" +#include "GEOMImpl_IGroupOperations.hxx" +#include "GEOM_Engine.hxx" + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +class SALOME_WNT_EXPORT GEOMImpl_Gen : public GEOM_Engine +{ + public: + GEOMImpl_Gen(); + ~GEOMImpl_Gen(); + + GEOMImpl_IBasicOperations* GetIBasicOperations(int theDocID); + + GEOMImpl_ITransformOperations* GetITransformOperations(int theDocID); + + GEOMImpl_I3DPrimOperations* GetI3DPrimOperations(int theDocID); + + GEOMImpl_IShapesOperations* GetIShapesOperations(int theDocID); + + GEOMImpl_IBlocksOperations* GetIBlocksOperations(int theDocID); + + GEOMImpl_IMeasureOperations* GetIMeasureOperations(int theDocID); + + GEOMImpl_IBooleanOperations* GetIBooleanOperations(int theDocID); + + GEOMImpl_ICurvesOperations* GetICurvesOperations(int theDocID); + + GEOMImpl_ILocalOperations* GetILocalOperations(int theDocID); + + GEOMImpl_IInsertOperations* GetIInsertOperations(int theDocID); + + GEOMImpl_IHealingOperations* GetIHealingOperations(int theDocID); + + GEOMImpl_IGroupOperations* GetIGroupOperations(int theDocID); + + private: + + std::map _mapOfBasicOperations; + std::map _mapOfTransformOperations; + std::map _mapOf3DPrimOperations; + std::map _mapOfShapesOperations; + std::map _mapOfBlocksOperations; + std::map _mapOfBooleanOperations; + std::map _mapOfHealingOperations; + std::map _mapOfCurvesOperations; + std::map _mapOfLocalOperations; + std::map _mapOfInsertOperations; + std::map _mapOfMeasureOperations; + std::map _mapOfGroupOperations; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx new file mode 100644 index 000000000..d8697f8bc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -0,0 +1,332 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include + +#include +#include + +#include + +#include "utilities.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define MSG_BAD_TOLERANCE "Tolerance is too big" +#define MSG_BAD_ARG_SHAPE "Argument shape is not a compound of hexahedral solids" + +//======================================================================= +//function : GEOMImpl_GlueDriver +//purpose : +//======================================================================= +GEOMImpl_GlueDriver::GEOMImpl_GlueDriver() +{ +} + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_GlueDriver::GetID() +{ + static Standard_GUID aGlueDriver("FF1BBB63-5D14-4df2-980B-3A668264EA16"); + return aGlueDriver; +} + +//======================================================================= +//function : GlueFacesWithWarnings +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + TCollection_AsciiString& theWarning) const +{ + Standard_Integer iErr, iWrn; + TopoDS_Shape aRes; + GEOMAlgo_Gluer aGluer; + + aGluer.SetShape(theShape); + aGluer.SetTolerance(theTolerance); + aGluer.SetCheckGeometry(Standard_True); + + aGluer.Perform(); + + iErr = aGluer.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 2: + Standard_Failure::Raise("No vertices found in source shape"); + break; + case 3: + case 4: + Standard_Failure::Raise(MSG_BAD_TOLERANCE " or " MSG_BAD_ARG_SHAPE); + break; + case 5: + Standard_Failure::Raise("Source shape is Null"); + break; + case 6: + Standard_Failure::Raise("Result shape is Null"); + break; + case 100: + Standard_Failure::Raise(MSG_BAD_TOLERANCE); + break; + case 101: + case 102: + Standard_Failure::Raise(MSG_BAD_ARG_SHAPE); + break; + case 200: + Standard_Failure::Raise("Error occured during check of geometric coincidence"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + iWrn = aGluer.WarningStatus(); + if (iWrn) { + switch (iWrn) { + case 1: + { + Standard_Integer nbAlone = aGluer.AloneShapes(); + theWarning = TCollection_AsciiString(nbAlone); + theWarning += " solid(s) can not be glued by faces"; + } + break; + default: + // description of all warnings see in GEOMAlgo_Gluer.cxx + theWarning = "Warning in GEOMAlgo_Gluer with code "; + theWarning += TCollection_AsciiString(iWrn); + break; + } + } + + aRes = aGluer.Result(); + + // Fill history to be used by GetInPlace functionality + TopTools_IndexedMapOfShape aResIndices; + TopExp::MapShapes(aRes, aResIndices); + + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + // history for all argument shapes + TDF_LabelSequence aLabelSeq; + aFunction->GetDependency(aLabelSeq); + Standard_Integer nbArg = aLabelSeq.Length(); + + for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) { + + TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); + + Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); + TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); + + TopTools_IndexedMapOfShape anArgumentIndices; + TopExp::MapShapes(anArgumentShape, anArgumentIndices); + Standard_Integer nbArgumentEntities = anArgumentIndices.Extent(); + + // Find corresponding label in history + TDF_Label anArgumentHistoryLabel = + aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True); + + for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) { + TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie); + const TopTools_ListOfShape& aModified = aGluer.Modified(anEntity); + Standard_Integer nbModified = aModified.Extent(); + + if (nbModified > 0) { + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); + Handle(TDataStd_IntegerArray) anAttr = + TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified); + + TopTools_ListIteratorOfListOfShape itM (aModified); + for (int im = 1; itM.More(); itM.Next(), ++im) { + int id = aResIndices.FindIndex(itM.Value()); + anAttr->SetValue(im, id); + } + } + } + } + + return aRes; +} + +//======================================================================= +//function : GlueFaces +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, + const Standard_Real theTolerance) +{ + Standard_Integer iErr, iWrn; + TopoDS_Shape aRes; + GEOMAlgo_Gluer aGluer; + + aGluer.SetShape(theShape); + aGluer.SetTolerance(theTolerance); + aGluer.SetCheckGeometry(Standard_True); + + aGluer.Perform(); + + iErr = aGluer.ErrorStatus(); + if (iErr) { + switch (iErr) { + case 2: + Standard_Failure::Raise("No vertices found in source shape"); + break; + case 5: + Standard_Failure::Raise("Source shape is Null"); + break; + case 6: + Standard_Failure::Raise("Result shape is Null"); + break; + case 200: + Standard_Failure::Raise("Error occured during check of geometric coincidence"); + break; + default: + { + // description of all errors see in GEOMAlgo_Gluer.cxx + TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code "); + aMsg += TCollection_AsciiString(iErr); + Standard_Failure::Raise(aMsg.ToCString()); + break; + } + } + return aRes; + } + + iWrn = aGluer.WarningStatus(); + if (iWrn) { + switch (iWrn) { + case 1: + MESSAGE("Some shapes can not be glued by faces"); + break; + default: + // description of all warnings see in GEOMAlgo_Gluer.cxx + MESSAGE("Warning in GEOMAlgo_Gluer with code " << iWrn); + break; + } + } + + aRes = aGluer.Result(); + + return aRes; +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IGlue aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + TCollection_AsciiString aWrn; + + if (aType == GLUE_FACES) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull()) { + Standard_NullObject::Raise("Shape for gluing is null"); + } + + Standard_Real tol3d = aCI.GetTolerance(); + aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn); + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + if (!aWrn.IsEmpty()) { + Standard_Failure::Raise(aWrn.ToCString()); + } + + return 1; +} + +//======================================================================= +//function : GEOMImpl_GlueDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_GlueDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_GlueDriver", + sizeof(GEOMImpl_GlueDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_GlueDriver) Handle(GEOMImpl_GlueDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_GlueDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_GlueDriver))) { + _anOtherObject = Handle(GEOMImpl_GlueDriver)((Handle(GEOMImpl_GlueDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx new file mode 100644 index 000000000..aaf8fae49 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -0,0 +1,166 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_GlueDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_GlueDriver_HeaderFile +#define _GEOMImpl_GlueDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_GlueDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_GlueDriver); + +class Handle(GEOMImpl_GlueDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_GlueDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_GlueDriver)(const Handle(GEOMImpl_GlueDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_GlueDriver)(const GEOMImpl_GlueDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_GlueDriver)& operator=(const Handle(GEOMImpl_GlueDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_GlueDriver)& operator=(const GEOMImpl_GlueDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_GlueDriver* operator->() + { + return (GEOMImpl_GlueDriver *)ControlAccess(); + } + + GEOMImpl_GlueDriver* operator->() const + { + return (GEOMImpl_GlueDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_GlueDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_GlueDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif +#include +#include + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_GlueDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_GlueDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_GlueDriver() {}; + +Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape, + const Standard_Real theTolerance); + +Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + TCollection_AsciiString& theWarning) const; + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_GlueDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_GlueDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_GlueDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx new file mode 100644 index 000000000..251a0a6c8 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -0,0 +1,425 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +//======================================================================= +//function : raiseNotDoneExeption +//purpose : global function: forms error message and raises exeption +//======================================================================= +void raiseNotDoneExeption( const int theErrorStatus ) +{ + switch ( theErrorStatus ) + { + case ShHealOper_NotError: StdFail_NotDone::Raise( "ShHealOper_NotError_msg" ); + case ShHealOper_InvalidParameters: StdFail_NotDone::Raise( "ShHealOper_InvalidParameters_msg" ); + case ShHealOper_ErrorExecution: + default: StdFail_NotDone::Raise( "ShHealOper_ErrorExecution_msg" ); + } +} + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_HealingDriver::GetID() +{ + static Standard_GUID aHealingDriver("FF1BBB61-5D14-4df2-980B-3A668264EA16"); + return aHealingDriver; +} + + +//======================================================================= +//function : GEOMImpl_HealingDriver +//purpose : +//======================================================================= + +GEOMImpl_HealingDriver::GEOMImpl_HealingDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + if (aFunction.IsNull()) return 0; + + GEOMImpl_IHealing HI (aFunction); + Standard_Integer aType = aFunction->GetType(); + Handle(GEOM_Function) anOriginalFunction = HI.GetOriginal(); + if (anOriginalFunction.IsNull()) return 0; + TopoDS_Shape aShape, anOriginalShape = anOriginalFunction->GetValue(); + if (anOriginalShape.IsNull()) return 0; + + switch (aType) + { + case SHAPE_PROCESS: + ShapeProcess(&HI, anOriginalShape, aShape); + break; + case SUPPRESS_FACES: + SuppressFaces(&HI, anOriginalShape, aShape); + break; + case CLOSE_CONTOUR: + CloseContour(&HI, anOriginalShape, aShape); + break; + case REMOVE_INT_WIRES: + RemoveIntWires(&HI, anOriginalShape, aShape); + break; + case FILL_HOLES: + RemoveHoles(&HI, anOriginalShape, aShape); + break; + case SEWING: + Sew(&HI, anOriginalShape, aShape); + break; + case DIVIDE_EDGE: + AddPointOnEdge(&HI, anOriginalShape, aShape); + break; + default: + return 0; + } + + if (aShape.IsNull()) + raiseNotDoneExeption( ShHealOper_ErrorExecution ); + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + return 1; +} + +//======================================================================= +//function : ShapeProcess +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::ShapeProcess (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Handle(TColStd_HArray1OfExtendedString) anOperators = theHI->GetOperators(); + Handle(TColStd_HArray1OfExtendedString) aParams = theHI->GetParameters(); + Handle(TColStd_HArray1OfExtendedString) aValues = theHI->GetValues(); + + if (anOperators.IsNull() || anOperators->Length() <= 0) + return Standard_False; + + Standard_Integer nbParams = 0, nbValues = 0; + if (!aParams.IsNull()) { + nbParams = aParams->Length(); + } + if (!aValues.IsNull()) { + nbValues = aValues->Length(); + } + if (nbParams != nbValues) + return Standard_False; + + ShHealOper_ShapeProcess aHealer; + TColStd_SequenceOfAsciiString anOperatorsAS, aParamsAS, aValuesAS; + int i; + for (i = 1; i <= anOperators->Length(); i++) + anOperatorsAS.Append(TCollection_AsciiString(anOperators->Value(i))); + + aHealer.SetOperators(anOperatorsAS); + + for (i = 1; i <= nbParams; i++) { + aHealer.SetParameter(TCollection_AsciiString(aParams->Value(i)), + TCollection_AsciiString(aValues->Value(i))); + } + + aHealer.Perform(theOriginalShape, theOutShape); + + if (!aHealer.isDone()) + raiseNotDoneExeption( ShHealOper_NotError ); + + return Standard_True; +} + +//======================================================================= +//function : SupressFaces +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::SuppressFaces (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Handle(TColStd_HArray1OfInteger) aFaces = theHI->GetFaces(); + + ShHealOper_RemoveFace aHealer (theOriginalShape); + + Standard_Boolean aResult = Standard_False; + if (aFaces.IsNull()) // remove all faces + { + aResult = aHealer.Perform(); + } else { + TopTools_SequenceOfShape aShapesFaces; + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(theOriginalShape, aShapes); + for (int i = 1; i <= aFaces->Length(); i++) { + int indexOfFace = aFaces->Value(i); + TopoDS_Shape aFace = aShapes.FindKey(indexOfFace); + aShapesFaces.Append(aFace); + } + + aResult = aHealer.Perform(aShapesFaces); + } + + if ( aResult ) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + +//======================================================================= +//function : CloseContour +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::CloseContour (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Standard_Boolean isByVertex = theHI->GetIsCommonVertex(); + Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires(); + + ShHealOper_CloseContour aHealer (theOriginalShape); + + Standard_Boolean aResult = Standard_False; + if ( aWires.IsNull() ) { + if ( theOriginalShape.ShapeType() == TopAbs_WIRE ) + aResult = aHealer.Perform(TopoDS::Wire(theOriginalShape), isByVertex, !isByVertex); + } + else { + TopTools_SequenceOfShape aShapesWires; + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(theOriginalShape, aShapes); + for (int i = 1; i <= aWires->Length(); i++) { + int indexOfWire = aWires->Value(i); + TopoDS_Shape aWire = aShapes.FindKey(indexOfWire); + aShapesWires.Append(aWire); + } + + aResult = aHealer.Perform( aShapesWires, isByVertex, !isByVertex ); + } + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + +//======================================================================= +//function : RemoveIntWires +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::RemoveIntWires (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires(); + + ShHealOper_RemoveInternalWires aHealer(theOriginalShape); + + Standard_Boolean aResult = Standard_False; + if (aWires.IsNull()) { // remove all faces + aResult = aHealer.Remove(); + } else { + TopTools_SequenceOfShape aShapesWires; + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(theOriginalShape, aShapes); + for (int i = 1; i <= aWires->Length(); i++) { + int indexOfWire = aWires->Value(i); + TopoDS_Shape aWire = aShapes.FindKey(indexOfWire); + aShapesWires.Append(aWire); + } + + aResult = aHealer.Remove(aShapesWires); + } + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + +//======================================================================= +//function : RemoveHoles +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::RemoveHoles (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires(); + + ShHealOper_FillHoles aHealer (theOriginalShape); + + Standard_Boolean aResult = Standard_False; + if (aWires.IsNull()) { // remove all faces + aResult = aHealer.Fill(); + } else { + TopTools_SequenceOfShape aShapesWires; + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(theOriginalShape, aShapes); + for (int i = 1; i <= aWires->Length(); i++) { + int indexOfWire = aWires->Value(i); + TopoDS_Shape aWire = aShapes.FindKey(indexOfWire); + aShapesWires.Append(aWire); + } + + aResult = aHealer.Fill(aShapesWires); + } + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + +//======================================================================= +//function : Sew +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Standard_Real aTol = theHI->GetTolerance(); + + ShHealOper_Sewing aHealer (theOriginalShape, aTol); + + Standard_Boolean aResult = aHealer.Perform(); + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + +//======================================================================= +//function : AddPointOnEdge +//purpose : +//======================================================================= +Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge (GEOMImpl_IHealing* theHI, + const TopoDS_Shape& theOriginalShape, + TopoDS_Shape& theOutShape) const +{ + Standard_Boolean isByParameter = theHI->GetIsByParameter(); + Standard_Integer anIndex = theHI->GetIndex(); + Standard_Real aValue = theHI->GetDevideEdgeValue(); + + ShHealOper_EdgeDivide aHealer (theOriginalShape); + + Standard_Boolean aResult = Standard_False; + if (anIndex == -1) { // apply algorythm for the whole shape which is EDGE + if (theOriginalShape.ShapeType() == TopAbs_EDGE) + aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter); + } else { + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes(theOriginalShape, aShapes); + TopoDS_Shape aEdgeShape = aShapes.FindKey(anIndex); + if (aEdgeShape.ShapeType() == TopAbs_EDGE) + aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter); + } + + if (aResult) + theOutShape = aHealer.GetResultShape(); + else + raiseNotDoneExeption( aHealer.GetErrorStatus() ); + + return aResult; +} + + +//======================================================================= +//function : GEOMImpl_HealingDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_HealingDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_HealingDriver", + sizeof(GEOMImpl_HealingDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_HealingDriver) Handle(GEOMImpl_HealingDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_HealingDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_HealingDriver))) { + _anOtherObject = Handle(GEOMImpl_HealingDriver)((Handle(GEOMImpl_HealingDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx new file mode 100644 index 000000000..eccf0acdc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx @@ -0,0 +1,171 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_HealingDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_HealingDriver_HeaderFile +#define _GEOMImpl_HealingDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_HealingDriver; + +class GEOMImpl_IHealing; +#include + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_HealingDriver); + +class Handle(GEOMImpl_HealingDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_HealingDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_HealingDriver)(const Handle(GEOMImpl_HealingDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_HealingDriver)(const GEOMImpl_HealingDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_HealingDriver)& operator=(const Handle(GEOMImpl_HealingDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_HealingDriver)& operator=(const GEOMImpl_HealingDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_HealingDriver* operator->() + { + return (GEOMImpl_HealingDriver *)ControlAccess(); + } + + GEOMImpl_HealingDriver* operator->() const + { + return (GEOMImpl_HealingDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_HealingDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_HealingDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_HealingDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_HealingDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_HealingDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_HealingDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } + +private: +Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean SuppressFaces ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean CloseContour ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean RemoveIntWires( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; +Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; + + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx new file mode 100644 index 000000000..266e4de26 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -0,0 +1,935 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations() +{ + MESSAGE("GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations"); +} + + +//============================================================================= +/*! + * MakeBoxDXDYDZ + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, double theDY, double theDZ) +{ + SetErrorCode(KO); + + //Add a new Box object + Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX); + + //Add a new Box function with DX_DY_DZ parameters + Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_DX_DY_DZ); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return NULL; + + GEOMImpl_IBox aBI (aFunction); + + aBI.SetDX(theDX); + aBI.SetDY(theDY); + aBI.SetDZ(theDZ); + + //Compute the box value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Box driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxDXDYDZ(" + << theDX << ", " << theDY << ", " << theDZ << ")"; + + SetErrorCode(OK); + return aBox; +} + + +//============================================================================= +/*! + * MakeBoxTwoPnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; + + //Add a new Box object + Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX); + + //Add a new Box function for creation a box relatively to two points + Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_TWO_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BoxDriver::GetID()) return aBox; + + GEOMImpl_IBox aBI (aFunction); + + Handle(GEOM_Function) aRefFunction1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRefFunction2 = thePnt2->GetLastFunction(); + + if (aRefFunction1.IsNull() || aRefFunction2.IsNull()) return aBox; + + aBI.SetRef1(aRefFunction1); + aBI.SetRef2(aRefFunction2); + + //Compute the Box value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Box driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxTwoPnt(" + << thePnt1 << ", " << thePnt2 << ")"; + + SetErrorCode(OK); + return aBox; +} + + +//============================================================================= +/*! + * MakeCylinderRH + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH) +{ + SetErrorCode(KO); + + //Add a new Cylinder object + Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER); + + //Add a new Cylinder function with R and H parameters + Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL; + + GEOMImpl_ICylinder aCI (aFunction); + + aCI.SetR(theR); + aCI.SetH(theH); + + //Compute the Cylinder value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Cylinder driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCylinder + << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")"; + + SetErrorCode(OK); + return aCylinder; +} + + +//============================================================================= +/*! + * MakeCylinderPntVecRH + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR, double theH) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Cylinder object + Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER); + + //Add a new Cylinder function for creation a cylinder relatively to point and vector + Handle(GEOM_Function) aFunction = + aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL; + + GEOMImpl_ICylinder aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetPoint(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetR(theR); + aCI.SetH(theH); + + //Compute the Cylinder value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Cylinder driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder(" + << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")"; + + SetErrorCode(OK); + return aCylinder; +} + + +//============================================================================= +/*! + * MakeConeR1R2H + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, double theR2, + double theH) +{ + SetErrorCode(KO); + + //Add a new Cone object + Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE); + + //Add a new Cone function with R and H parameters + Handle(GEOM_Function) aFunction = + aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_R1_R2_H); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL; + + GEOMImpl_ICone aCI (aFunction); + + aCI.SetR1(theR1); + aCI.SetR2(theR2); + aCI.SetH(theH); + + //Compute the Cone value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Cone driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeConeR1R2H(" + << theR1 << ", " << theR2 << ", " << theH << ")"; + + SetErrorCode(OK); + return aCone; +} + + +//============================================================================= +/*! + * MakeConePntVecR1R2H + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR1, double theR2, + double theH) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Cone object + Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE); + + //Add a new Cone function for creation a cone relatively to point and vector + Handle(GEOM_Function) aFunction = + aCone->AddFunction(GEOMImpl_ConeDriver::GetID(), CONE_PNT_VEC_R1_R2_H); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ConeDriver::GetID()) return NULL; + + GEOMImpl_ICone aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetPoint(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetR1(theR1); + aCI.SetR2(theR2); + aCI.SetH(theH); + + //Compute the Cone value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Cone driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeCone(" << thePnt + << ", " << theVec << ", " << theR1 << ", " << theR2 << ", " << theH << ")"; + + SetErrorCode(OK); + return aCone; +} + + +//============================================================================= +/*! + * MakeSphereR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR) +{ + SetErrorCode(KO); + + //Add a new Sphere object + Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE); + + //Add a new Sphere function with R parameter + Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL; + + GEOMImpl_ISphere aCI (aFunction); + + aCI.SetR(theR); + + //Compute the Sphere value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Sphere driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aSphere << " = geompy.MakeSphereR(" << theR << ")"; + + SetErrorCode(OK); + return aSphere; +} + + +//============================================================================= +/*! + * MakeSpherePntR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Object) thePnt, + double theR) +{ + SetErrorCode(KO); + + if (thePnt.IsNull()) return NULL; + + //Add a new Point object + Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE); + + //Add a new Sphere function for creation a sphere relatively to point + Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_PNT_R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SphereDriver::GetID()) return NULL; + + GEOMImpl_ISphere aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + + if (aRefPnt.IsNull()) return NULL; + + aCI.SetPoint(aRefPnt); + aCI.SetR(theR); + + //Compute the Sphere value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Sphere driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aSphere + << " = geompy.MakeSpherePntR(" << thePnt << ", " << theR << ")"; + + SetErrorCode(OK); + return aSphere; +} + + +//============================================================================= +/*! + * MakeTorusRR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR + (double theRMajor, double theRMinor) +{ + SetErrorCode(KO); + + //Add a new Torus object + Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS); + + //Add a new Torus function + Handle(GEOM_Function) aFunction = + anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_RR); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL; + + GEOMImpl_ITorus aCI (aFunction); + + aCI.SetRMajor(theRMajor); + aCI.SetRMinor(theRMinor); + + //Compute the Torus value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Torus driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorusRR(" + << theRMajor << ", " << theRMinor << ")"; + + SetErrorCode(OK); + return anEll; +} + +//============================================================================= +/*! + * MakeTorusPntVecRR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, + double theRMajor, double theRMinor) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Torus object + Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS); + + //Add a new Torus function + Handle(GEOM_Function) aFunction = + anEll->AddFunction(GEOMImpl_TorusDriver::GetID(), TORUS_PNT_VEC_RR); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TorusDriver::GetID()) return NULL; + + GEOMImpl_ITorus aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetCenter(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetRMajor(theRMajor); + aCI.SetRMinor(theRMinor); + + //Compute the Torus value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Torus driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorus(" << thePnt + << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + + SetErrorCode(OK); + return anEll; +} + + +//============================================================================= +/*! + * MakePrismVecH + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theVec, + double theH) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Prism object + Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM); + + //Add a new Prism function for creation a Prism relatively to vector + Handle(GEOM_Function) aFunction = + aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL; + + GEOMImpl_IPrism aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetVector(aRefVec); + aCI.SetH(theH); + + //Compute the Prism value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Prism driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH(" + << theBase << ", " << theVec << ", " << theH << ")"; + + SetErrorCode(OK); + return aPrism; +} + +//============================================================================= +/*! + * MakePrismTwoPnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt + (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL; + + //Add a new Prism object + Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM); + + //Add a new Prism function for creation a Prism relatively to two points + Handle(GEOM_Function) aFunction = + aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL; + + GEOMImpl_IPrism aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction(); + + if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetFirstPoint(aRefPnt1); + aCI.SetLastPoint(aRefPnt2); + + //Compute the Prism value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Prism driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism(" + << theBase << ", " << thePoint1 << ", " << thePoint2 << ")"; + + SetErrorCode(OK); + return aPrism; +} + + +//============================================================================= +/*! + * MakePipe + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePath) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || thePath.IsNull()) return NULL; + + //Add a new Pipe object + Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); + + //Add a new Pipe function + Handle(GEOM_Function) aFunction = + aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BASE_PATH); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL; + + GEOMImpl_IPipe aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefPath = thePath->GetLastFunction(); + + if (aRefBase.IsNull() || aRefPath.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetPath(aRefPath); + + //Compute the Pipe value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Pipe driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe(" + << theBase << ", " << thePath << ")"; + + SetErrorCode(OK); + return aPipe; +} + + +//============================================================================= +/*! + * MakeRevolutionAxisAngle + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theAxis, + double theAngle) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || theAxis.IsNull()) return NULL; + + //Add a new Revolution object + Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION); + + //Add a new Revolution function for creation a revolution relatively to axis + Handle(GEOM_Function) aFunction = + aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL; + + GEOMImpl_IRevolution aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction(); + + if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetAxis(aRefAxis); + aCI.SetAngle(theAngle); + + //Compute the Revolution value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Revolution driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution(" + << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + + SetErrorCode(OK); + return aRevolution; +} + + +//============================================================================= +/*! + * MakeSolidShell + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell) +{ + SetErrorCode(KO); + + if (theShell.IsNull()) return NULL; + + //Add a new Solid object + Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID); + + //Add a new Solid function for creation a solid from a shell + Handle(GEOM_Function) aFunction = + aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(GEOM_Function) aRefShell = theShell->GetLastFunction(); + + if (aRefShell.IsNull()) return NULL; + + aCI.SetBase(aRefShell); + + //Compute the Solid value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Solid driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")"; + + SetErrorCode(OK); + return aSolid; +} + +//============================================================================= +/*! + * MakeFilling + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling + (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, + double theTol2D, double theTol3D, int theNbIter) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new Filling object + Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING); + + //Add a new Filling function for creation a filling from a compound + Handle(GEOM_Function) aFunction = aFilling->AddFunction(GEOMImpl_FillingDriver::GetID(), BASIC_FILLING); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL; + + GEOMImpl_IFilling aFI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + + if (aRefShape.IsNull()) return NULL; + + aFI.SetShape(aRefShape); + aFI.SetMinDeg(theMinDeg); + aFI.SetMaxDeg(theMaxDeg); + aFI.SetTol2D(theTol2D); + aFI.SetTol3D(theTol3D); + aFI.SetNbIter(theNbIter); + + //Compute the Solid value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Filling driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + if (strcmp(aFail->GetMessageString(), "Geom_BSplineSurface") == 0) + SetErrorCode("B-Spline surface construction failed"); + else + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFilling << " = geompy.MakeFilling(" + << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " + << theTol2D << ", " << theTol3D << ", " << theNbIter << ")"; + + SetErrorCode(OK); + return aFilling; +} diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx new file mode 100644 index 000000000..2e3a5177b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_I3DPrimOperations_HXX_ +#define _GEOMImpl_I3DPrimOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include + +class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_I3DPrimOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_I3DPrimOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakeBoxDXDYDZ (double theDX, double theDY, double theDZ); + Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2); + + Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH); + Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR, double theH); + + Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH); + Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theR1, double theR2, double theH); + + Standard_EXPORT Handle(GEOM_Object) MakeSphereR (double theR); + Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR); + + Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor); + + Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theRMajor, double theRMinor); + + Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theVec, double theH); + + Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePath); + + Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theAxis, + double theAngle); + + Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); + + Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter); + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IArc.hxx b/src/GEOMImpl/GEOMImpl_IArc.hxx new file mode 100644 index 000000000..6ad13ca56 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IArc.hxx @@ -0,0 +1,46 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Arc creation. + + +#include "GEOM_Function.hxx" + +#define ARC_ARG_PI 1 +#define ARC_ARG_PC 2 +#define ARC_ARG_PE 3 + +class GEOMImpl_IArc +{ + public: + + GEOMImpl_IArc(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetPoint1(Handle(GEOM_Function) theP) { _func->SetReference(ARC_ARG_PI, theP); } + void SetPoint2(Handle(GEOM_Function) theP) { _func->SetReference(ARC_ARG_PC, theP); } + void SetPoint3(Handle(GEOM_Function) theP) { _func->SetReference(ARC_ARG_PE, theP); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(ARC_ARG_PI); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(ARC_ARG_PC); } + Handle(GEOM_Function) GetPoint3() { return _func->GetReference(ARC_ARG_PE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IArchimede.hxx b/src/GEOMImpl/GEOMImpl_IArchimede.hxx new file mode 100644 index 000000000..bf504973e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IArchimede.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Archimede operation. + + +#include "GEOM_Function.hxx" + +#define ARG_WEIGHT 1 +#define ARG_DENSITY 2 +#define ARG_DEFLECT 3 +#define ARG_SHAPE 4 + +class GEOMImpl_IArchimede +{ + public: + + GEOMImpl_IArchimede(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetWeight(Standard_Real theWeight) { _func->SetReal(ARG_WEIGHT, theWeight); } + + Standard_Real GetWeight() { return _func->GetReal(ARG_WEIGHT); } + + void SetDensity(Standard_Real theDensity) { _func->SetReal(ARG_DENSITY, theDensity); } + + Standard_Real GetDensity() { return _func->GetReal(ARG_DENSITY); } + + void SetDeflection(Standard_Real theDeflection) { _func->SetReal(ARG_DEFLECT, theDeflection); } + + Standard_Real GetDeflection() { return _func->GetReal(ARG_DEFLECT); } + + void SetBasicShape(Handle(GEOM_Function) theShape) { _func->SetReference(ARG_SHAPE, theShape); } + + Handle(GEOM_Function) GetBasicShape() { return _func->GetReference(ARG_SHAPE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx new file mode 100644 index 000000000..9a7ba439c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -0,0 +1,643 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations() +{ + MESSAGE("GEOMImpl_IBasicOperations::~GEOMImpl_IBasicOperations"); +} + + +//============================================================================= +/*! + * MakePointXYZ + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ + (double theX, double theY, double theZ) +{ + SetErrorCode(KO); + + //Add a new Point object + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a new Point function with XYZ parameters + Handle(GEOM_Function) aFunction = + aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; + + GEOMImpl_IPoint aPI(aFunction); + + aPI.SetX(theX); + aPI.SetY(theY); + aPI.SetZ(theZ); + + //Compute the point value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Point driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertex(" + << theX << ", " << theY << ", " << theZ << ")"; + + SetErrorCode(OK); + return aPoint; +} + +//============================================================================= +/*! + * MakePointWithReference + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference + (Handle(GEOM_Object) theReference, double theX, double theY, double theZ) +{ + SetErrorCode(KO); + + if (theReference.IsNull()) return NULL; + + //Add a new Point object + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a new Point function for creation a point relativley another point + Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ_REF); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; + + GEOMImpl_IPoint aPI(aFunction); + + Handle(GEOM_Function) aRefFunction = theReference->GetLastFunction(); + if (aRefFunction.IsNull()) return NULL; + + aPI.SetRef(aRefFunction); + aPI.SetX(theX); + aPI.SetY(theY); + aPI.SetZ(theZ); + + //Compute the point value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Point driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexWithRef(" + << theReference << ", " << theX << ", " << theY << ", " << theZ << ")"; + + SetErrorCode(OK); + return aPoint; +} + +//============================================================================= +/*! + * MakePointOnCurve + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve + (Handle(GEOM_Object) theCurve, double theParameter) +{ + SetErrorCode(KO); + + if (theCurve.IsNull()) return NULL; + + //Add a new Point object + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a new Point function for creation a point relativley another point + Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_CURVE_PAR); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; + + GEOMImpl_IPoint aPI (aFunction); + + Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction(); + if (aRefFunction.IsNull()) return NULL; + + aPI.SetCurve(aRefFunction); + aPI.SetParameter(theParameter); + + //Compute the point value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Point driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve(" + << theCurve << ", " << theParameter << ")"; + + SetErrorCode(OK); + return aPoint; +} + + +//============================================================================= +/*! + * MakeVectorDXDYDZ + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ + (double theDX, double theDY, double theDZ) +{ + SetErrorCode(KO); + + //Add a new Vector object + Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR); + + //Add a new Vector function with DXDYDZ parameters + Handle(GEOM_Function) aFunction = + aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_DX_DY_DZ); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL; + + GEOMImpl_IVector aPI (aFunction); + + aPI.SetDX(theDX); + aPI.SetDY(theDY); + aPI.SetDZ(theDZ); + + //Compute the Vector value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Vector driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ(" + << theDX << ", " << theDY << ", " << theDZ << ")"; + + SetErrorCode(OK); + return aVector; +} + +//============================================================================= +/*! + * MakeVectorTwoPnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt + (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; + + //Add a new Vector object + Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR); + + //Add a new Vector function + Handle(GEOM_Function) aFunction = + aVector->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TWO_PNT); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL; + + GEOMImpl_IVector aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetPoint1(aRef1); + aPI.SetPoint2(aRef2); + + //Compute the Vector value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Vector driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector(" + << thePnt1 << ", " << thePnt2 << ")"; + + SetErrorCode(OK); + return aVector; +} + + +//============================================================================= +/*! + * MakeLine + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theDir) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theDir.IsNull()) return NULL; + + //Add a new Line object + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + + //Add a new Line function + Handle(GEOM_Function) aFunction = + aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_PNT_DIR); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL; + + GEOMImpl_ILine aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theDir->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetPoint1(aRef1); + aPI.SetPoint2(aRef2); + + //Compute the Line value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Line driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine(" + << thePnt << ", " << theDir << ")"; + + SetErrorCode(OK); + return aLine; +} + +//============================================================================= +/*! + * MakeLineTwoPnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt + (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; + + //Add a new Line object + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + + //Add a new Line function + Handle(GEOM_Function) aFunction = + aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_PNT); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL; + + GEOMImpl_ILine aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetPoint1(aRef1); + aPI.SetPoint2(aRef2); + + //Compute the Line value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Line driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt(" + << thePnt1 << ", " << thePnt2 << ")"; + + SetErrorCode(OK); + return aLine; +} + + +//============================================================================= +/*! + * MakePlaneThreePnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt + (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3, double theSize) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Plane object + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + + //Add a new Plane function + Handle(GEOM_Function) aFunction = + aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_THREE_PNT); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL; + + GEOMImpl_IPlane aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRef3 = thePnt3->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) return NULL; + + aPI.SetPoint1(aRef1); + aPI.SetPoint2(aRef2); + aPI.SetPoint3(aRef3); + aPI.SetSize(theSize); + + //Compute the Plane value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Plane driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")"; + + SetErrorCode(OK); + return aPlane; +} + +//============================================================================= +/*! + * MakePlanePntVec + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, + double theSize) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Plane object + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + + //Add a new Plane function + Handle(GEOM_Function) aFunction = + aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_PNT_VEC); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL; + + GEOMImpl_IPlane aPI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aPI.SetPoint(aRefPnt); + aPI.SetVector(aRefVec); + aPI.SetSize(theSize); + + //Compute the Plane value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Plane driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane(" + << thePnt << ", " << theVec << ", " << theSize << ")"; + + SetErrorCode(OK); + return aPlane; +} + +//============================================================================= +/*! + * MakePlaneFace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace + (Handle(GEOM_Object) theFace, double theSize) +{ + SetErrorCode(KO); + + if (theFace.IsNull()) return NULL; + + //Add a new Plane object + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + + //Add a new Plane function + Handle(GEOM_Function) aFunction = + aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_FACE); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL; + + GEOMImpl_IPlane aPI (aFunction); + + Handle(GEOM_Function) aRef = theFace->GetLastFunction(); + if (aRef.IsNull()) return NULL; + + aPI.SetFace(aRef); + aPI.SetSize(theSize); + + //Compute the Plane value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Plane driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace(" + << theFace << ", " << theSize << ")"; + + SetErrorCode(OK); + return aPlane; +} + + +//============================================================================= +/*! + * MakeMarker + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker + (double theOX, double theOY, double theOZ, + double theXDX, double theXDY, double theXDZ, + double theYDX, double theYDY, double theYDZ) +{ + SetErrorCode(KO); + + //Add a new Marker object + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + + //Add a new Marker function + Handle(GEOM_Function) aFunction = + aMarker->AddFunction(GEOMImpl_MarkerDriver::GetID(), MARKER_CS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MarkerDriver::GetID()) return NULL; + + GEOMImpl_IMarker aPI(aFunction); + + aPI.SetOrigin(theOX, theOY, theOZ); + aPI.SetXDir(theXDX, theXDY, theXDZ); + aPI.SetYDir(theYDX, theYDY, theYDZ); + + //Compute the marker value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Marker driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker(" + << theOX << ", " << theOY << ", " << theOZ << ", " + << theXDX << ", " << theXDY << ", " << theXDZ << ", " + << theYDX << ", " << theYDY << ", " << theYDZ << ")"; + + SetErrorCode(OK); + return aMarker; +} diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx new file mode 100644 index 000000000..7106f4cd9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx @@ -0,0 +1,75 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IBasicOperations_HXX_ +#define _GEOMImpl_IBasicOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include + +class GEOMImpl_IBasicOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IBasicOperations(); + + // Point + Standard_EXPORT Handle(GEOM_Object) MakePointXYZ (double theX, double theY, double theZ); + + Standard_EXPORT Handle(GEOM_Object) MakePointWithReference (Handle(GEOM_Object) theReference, + double theX, double theY, double theZ); + + Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve, + double theParameter); + + // Vector + Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ); + + Standard_EXPORT Handle(GEOM_Object) MakeVectorTwoPnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2); + + // Line + Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2); + + Standard_EXPORT Handle(GEOM_Object) MakeLine (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theDir); + + // Plane + Standard_EXPORT Handle(GEOM_Object) MakePlaneThreePnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3, + double theSize); + + Standard_EXPORT Handle(GEOM_Object) MakePlanePntVec (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theSize); + + Standard_EXPORT Handle(GEOM_Object) MakePlaneFace (Handle(GEOM_Object) theFace, double theSize); + + // Marker + Standard_EXPORT Handle(GEOM_Object) MakeMarker (double theOX, double theOY, double theOZ, + double theXDX, double theXDY, double theXDZ, + double theYDX, double theYDY, double theYDZ); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx b/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx new file mode 100644 index 000000000..19f60e2a7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBlockTrsf.hxx @@ -0,0 +1,61 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an interface to a function for the Blocks Multi-Transformations. + + +#include "GEOM_Function.hxx" + +#define TRSF_ORIGIN 1 + +#define TRSF_FACE_1_U 2 +#define TRSF_FACE_2_U 3 +#define TRSF_NBITER_U 4 +#define TRSF_FACE_1_V 5 +#define TRSF_FACE_2_V 6 +#define TRSF_NBITER_V 7 + +class GEOMImpl_IBlockTrsf +{ + public: + + GEOMImpl_IBlockTrsf (Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOriginal (Handle(GEOM_Function) theOriginal) { _func->SetReference(TRSF_ORIGIN, theOriginal); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(TRSF_ORIGIN); } + + void SetFace1U (int theFaceId) { _func->SetInteger(TRSF_FACE_1_U, theFaceId); } + void SetFace2U (int theFaceId) { _func->SetInteger(TRSF_FACE_2_U, theFaceId); } + void SetFace1V (int theFaceId) { _func->SetInteger(TRSF_FACE_1_V, theFaceId); } + void SetFace2V (int theFaceId) { _func->SetInteger(TRSF_FACE_2_V, theFaceId); } + void SetNbIterU (int theNbIter) { _func->SetInteger(TRSF_NBITER_U, theNbIter); } + void SetNbIterV (int theNbIter) { _func->SetInteger(TRSF_NBITER_V, theNbIter); } + + int GetFace1U () { return _func->GetInteger(TRSF_FACE_1_U); } + int GetFace2U () { return _func->GetInteger(TRSF_FACE_2_U); } + int GetFace1V () { return _func->GetInteger(TRSF_FACE_1_V); } + int GetFace2V () { return _func->GetInteger(TRSF_FACE_2_V); } + int GetNbIterU() { return _func->GetInteger(TRSF_NBITER_U); } + int GetNbIterV() { return _func->GetInteger(TRSF_NBITER_V); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IBlocks.hxx b/src/GEOMImpl/GEOMImpl_IBlocks.hxx new file mode 100644 index 000000000..a8174bf26 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBlocks.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// NOTE: This is an interface to a function for the Blocks +// creation and transformation. + + +#include "GEOM_Function.hxx" + +#include "TColStd_HSequenceOfTransient.hxx" + +#define BLOCK_ARG_SHAPES 1 // Arguments for creation of block or face of block + +class GEOMImpl_IBlocks +{ + public: + + GEOMImpl_IBlocks(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(BLOCK_ARG_SHAPES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetShapes() + { return _func->GetReferenceList(BLOCK_ARG_SHAPES); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx new file mode 100644 index 000000000..2cbca5805 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -0,0 +1,3129 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +//#include + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IBlocksOperations::GEOMImpl_IBlocksOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IBlocksOperations::GEOMImpl_IBlocksOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IBlocksOperations::~GEOMImpl_IBlocksOperations() +{ + MESSAGE("GEOMImpl_IBlocksOperations::~GEOMImpl_IBlocksOperations"); +} + + +//============================================================================= +/*! + * MakeQuad + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad + (Handle(GEOM_Object) theEdge1, Handle(GEOM_Object) theEdge2, + Handle(GEOM_Object) theEdge3, Handle(GEOM_Object) theEdge4) +{ + SetErrorCode(KO); + + if (theEdge1.IsNull() || theEdge2.IsNull() || + theEdge3.IsNull() || theEdge4.IsNull()) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Face function + Handle(GEOM_Function) aFunction = + aFace->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_FACE_FOUR_EDGES); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theEdge1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theEdge2->GetLastFunction(); + Handle(GEOM_Function) aRef3 = theEdge3->GetLastFunction(); + Handle(GEOM_Function) aRef4 = theEdge4->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull() || + aRef3.IsNull() || aRef4.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + aShapesSeq->Append(aRef2); + aShapesSeq->Append(aRef3); + aShapesSeq->Append(aRef4); + + aPI.SetShapes(aShapesSeq); + + //Compute the Face value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a face"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad(" + << theEdge1 << ", " << theEdge2 << ", " << theEdge3 << ", " << theEdge4 << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeQuad2Edges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad2Edges + (Handle(GEOM_Object) theEdge1, Handle(GEOM_Object) theEdge2) +{ + SetErrorCode(KO); + + if (theEdge1.IsNull() || theEdge2.IsNull()) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Face function + Handle(GEOM_Function) aFunction = + aFace->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_FACE_TWO_EDGES); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theEdge1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theEdge2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + aShapesSeq->Append(aRef2); + + aPI.SetShapes(aShapesSeq); + + //Compute the Face value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a face"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad2Edges(" + << theEdge1 << ", " << theEdge2 << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeQuad4Vertices + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad4Vertices + (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3, Handle(GEOM_Object) thePnt4) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || + thePnt3.IsNull() || thePnt4.IsNull()) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Face function + Handle(GEOM_Function) aFunction = + aFace->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_FACE_FOUR_PNT); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRef3 = thePnt3->GetLastFunction(); + Handle(GEOM_Function) aRef4 = thePnt4->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull() || + aRef3.IsNull() || aRef4.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + aShapesSeq->Append(aRef2); + aShapesSeq->Append(aRef3); + aShapesSeq->Append(aRef4); + + aPI.SetShapes(aShapesSeq); + + //Compute the Face value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a face"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad4Vertices(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << thePnt4 << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeHexa + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa + (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2, + Handle(GEOM_Object) theFace3, Handle(GEOM_Object) theFace4, + Handle(GEOM_Object) theFace5, Handle(GEOM_Object) theFace6) +{ + SetErrorCode(KO); + + if (theFace1.IsNull() || theFace2.IsNull() || + theFace3.IsNull() || theFace4.IsNull() || + theFace5.IsNull() || theFace6.IsNull()) return NULL; + + //Add a new Solid object + Handle(GEOM_Object) aBlock = GetEngine()->AddObject(GetDocID(), GEOM_BLOCK); + + //Add a new Block function + Handle(GEOM_Function) aFunction = + aBlock->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_SIX_FACES); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction(); + Handle(GEOM_Function) aRef3 = theFace3->GetLastFunction(); + Handle(GEOM_Function) aRef4 = theFace4->GetLastFunction(); + Handle(GEOM_Function) aRef5 = theFace5->GetLastFunction(); + Handle(GEOM_Function) aRef6 = theFace6->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull() || + aRef3.IsNull() || aRef4.IsNull() || + aRef5.IsNull() || aRef6.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + aShapesSeq->Append(aRef2); + aShapesSeq->Append(aRef3); + aShapesSeq->Append(aRef4); + aShapesSeq->Append(aRef5); + aShapesSeq->Append(aRef6); + + aPI.SetShapes(aShapesSeq); + + //Compute the Block value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a block"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa(" + << theFace1 << ", " << theFace2 << ", " << theFace3 << ", " + << theFace4 << ", " << theFace5 << ", " << theFace6 << ")"; + + SetErrorCode(OK); + return aBlock; +} + +//============================================================================= +/*! + * MakeHexa2Faces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa2Faces + (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2) +{ + SetErrorCode(KO); + + if (theFace1.IsNull() || theFace2.IsNull()) return NULL; + + //Add a new Solid object + Handle(GEOM_Object) aBlock = GetEngine()->AddObject(GetDocID(), GEOM_BLOCK); + + //Add a new Block function + Handle(GEOM_Function) aFunction = + aBlock->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_TWO_FACES); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + aShapesSeq->Append(aRef2); + + aPI.SetShapes(aShapesSeq); + + //Compute the Block value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a block"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa2Faces(" + << theFace1 << ", " << theFace2 << ")"; + + SetErrorCode(OK); + return aBlock; +} + +//============================================================================= +/*! + * MakeBlockCompound + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeBlockCompound + (Handle(GEOM_Object) theCompound) +{ + SetErrorCode(KO); + + if (theCompound.IsNull()) return NULL; + + //Add a new object + Handle(GEOM_Object) aBlockComp = GetEngine()->AddObject(GetDocID(), GEOM_COMPOUND); + + //Add a new BlocksComp function + Handle(GEOM_Function) aFunction = + aBlockComp->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_COMPOUND_GLUE); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlocks aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theCompound->GetLastFunction(); + if (aRef1.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + aShapesSeq->Append(aRef1); + + aPI.SetShapes(aShapesSeq); + + //Compute the Blocks Compound value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to compute a blocks compound"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aBlockComp + << " = geompy.MakeBlockCompound(" << theCompound << ")"; + + SetErrorCode(OK); + return aBlockComp; +} + +//============================================================================= +/*! + * GetPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint + (Handle(GEOM_Object) theShape, + const Standard_Real theX, + const Standard_Real theY, + const Standard_Real theZ, + const Standard_Real theEpsilon) +{ + SetErrorCode(KO); + + //New Point object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Given shape is null"); + return NULL; + } + + //Compute the Vertex value + gp_Pnt P (theX, theY, theZ); + Standard_Real eps = Max(theEpsilon, Precision::Confusion()); + + TopoDS_Shape V; + Standard_Integer isFound = 0; + TopTools_MapOfShape mapShape; + TopExp_Explorer exp (aBlockOrComp, TopAbs_VERTEX); + + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current()); + gp_Pnt aPi = BRep_Tool::Pnt(aVi); + if (aPi.Distance(P) < eps) { + V = aVi; + isFound++; + } + } + } + + if (isFound == 0) { + SetErrorCode("Vertex has not been found"); + return NULL; + } else if (isFound > 1) { + SetErrorCode("Multiple vertices found by the given coordinates and epsilon"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(V)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + + //The GetPoint() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << aResult << " = geompy.GetPoint(" << theShape << ", " + << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetEdge + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdge + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2) +{ + SetErrorCode(KO); + + //New Edge object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Given shape is null"); + return NULL; + } + + TopoDS_Shape anArg1 = thePoint1->GetValue(); + TopoDS_Shape anArg2 = thePoint2->GetValue(); + if (anArg1.IsNull() || anArg2.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg1.ShapeType() != TopAbs_VERTEX || + anArg2.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for edge identification is not a vertex"); + return NULL; + } + + //Compute the Edge value + try { + TopTools_IndexedDataMapOfShapeListOfShape MVE; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (aBlockOrComp, TopAbs_VERTEX, TopAbs_EDGE, MVE); + + TopoDS_Shape V1,V2; + Standard_Integer ish, ext = MVE.Extent(); + + if (MVE.Contains(anArg1)) { + V1 = anArg1; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVE.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg1), TopoDS::Vertex(aShi))) { + V1 = aShi; + break; + } + } + } + + if (MVE.Contains(anArg2)) { + V2 = anArg2; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVE.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg2), TopoDS::Vertex(aShi))) { + V2 = aShi; + break; + } + } + } + + if (V1.IsNull() || V2.IsNull()) { + SetErrorCode("The given vertex does not belong to the shape"); + return NULL; + } + + TopoDS_Shape anEdge; + Standard_Integer isFound = + GEOMImpl_Block6Explorer::FindEdge(anEdge, V1, V2, MVE, Standard_True); + if (isFound == 0) { + SetErrorCode("The given vertices do not belong to one edge of the given shape"); + return NULL; + } else if (isFound > 1) { + SetErrorCode("Multiple edges found by the given vertices of the shape"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(anEdge)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdge(" + << theShape << ", " << thePoint1 << ", " << thePoint2 << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetEdgeNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdgeNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Given shape is null"); + return NULL; + } + + TopoDS_Shape anArg = thePoint->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for edge identification is not a vertex"); + return NULL; + } + + //Compute the Edge value + try { + TopoDS_Shape aShape; + + TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + + // 1. Explode blocks on edges + TopTools_MapOfShape mapShape; + Standard_Integer nbEdges = 0; + TopExp_Explorer exp (aBlockOrComp, TopAbs_EDGE); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbEdges++; + } + } + + if (nbEdges == 0) { + SetErrorCode("Given shape contains no edges"); + return NULL; + } + + mapShape.Clear(); + Standard_Integer ind = 1; + TopTools_Array1OfShape anEdges (1, nbEdges); + TColStd_Array1OfReal aDistances (1, nbEdges); + for (exp.Init(aBlockOrComp, TopAbs_EDGE); exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape anEdge = exp.Current(); + anEdges(ind) = anEdge; + + // 2. Classify the point relatively each edge + BRepExtrema_DistShapeShape aDistTool (aVert, anEdges(ind)); + if (!aDistTool.IsDone()) { + SetErrorCode("Can not find a distance from the given point to one of edges"); + return NULL; + } + aDistances(ind) = aDistTool.Value(); + ind++; + } + } + + // 3. Define edge, having minimum distance to the point + Standard_Real nearest = RealLast(), nbFound = 0; + Standard_Real prec = Precision::Confusion(); + for (ind = 1; ind <= nbEdges; ind++) { + if (Abs(aDistances(ind) - nearest) < prec) { + nbFound++; + } else if (aDistances(ind) < nearest) { + nearest = aDistances(ind); + aShape = anEdges(ind); + nbFound = 1; + } else { + } + } + if (nbFound > 1) { + SetErrorCode("Multiple edges near the given point are found"); + return NULL; + } else if (nbFound == 0) { + SetErrorCode("There are no edges near the given point"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdgeNearPoint(" + << theShape << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetFaceByPoints + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByPoints + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || + thePoint1.IsNull() || thePoint2.IsNull() || + thePoint3.IsNull() || thePoint4.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + + TopoDS_Shape anArg1 = thePoint1->GetValue(); + TopoDS_Shape anArg2 = thePoint2->GetValue(); + TopoDS_Shape anArg3 = thePoint3->GetValue(); + TopoDS_Shape anArg4 = thePoint4->GetValue(); + if (anArg1.IsNull() || anArg2.IsNull() || + anArg3.IsNull() || anArg4.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg1.ShapeType() != TopAbs_VERTEX || + anArg2.ShapeType() != TopAbs_VERTEX || + anArg3.ShapeType() != TopAbs_VERTEX || + anArg4.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for face identification is not a vertex"); + return NULL; + } + + //Compute the Face value + try { + TopoDS_Shape aShape; + + TopTools_IndexedDataMapOfShapeListOfShape MVF; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(aBlockOrComp, TopAbs_VERTEX, TopAbs_FACE, MVF); + + TopoDS_Shape V1,V2,V3,V4; + Standard_Integer ish, ext = MVF.Extent(); + + if (MVF.Contains(anArg1)) { + V1 = anArg1; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVF.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg1), TopoDS::Vertex(aShi))) { + V1 = aShi; + break; + } + } + } + + if (MVF.Contains(anArg2)) { + V2 = anArg2; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVF.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg2), TopoDS::Vertex(aShi))) { + V2 = aShi; + break; + } + } + } + + if (MVF.Contains(anArg3)) { + V3 = anArg3; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVF.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg3), TopoDS::Vertex(aShi))) { + V3 = aShi; + break; + } + } + } + + if (MVF.Contains(anArg4)) { + V4 = anArg4; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MVF.FindKey(ish); + if (BRepTools::Compare(TopoDS::Vertex(anArg4), TopoDS::Vertex(aShi))) { + V4 = aShi; + break; + } + } + } + + if (V1.IsNull() || V2.IsNull() || V3.IsNull() || V4.IsNull()) { + SetErrorCode("The given vertex does not belong to the shape"); + return NULL; + } + + Standard_Integer isFound = + GEOMImpl_Block6Explorer::FindFace(aShape, V1, V2, V3, V4, MVF, Standard_True); + if (isFound == 0) { + SetErrorCode("The given vertices do not belong to one face of the given shape"); + return NULL; + } else if (isFound > 1) { + SetErrorCode("The given vertices belong to several faces of the given shape"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByPoints(" + << theShape << ", " << thePoint1 << ", " << thePoint2 + << ", " << thePoint3 << ", " << thePoint4 << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetFaceByEdges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByEdges + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || theEdge1.IsNull() || theEdge2.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + if (aBlockOrComp.ShapeType() != TopAbs_SOLID && + aBlockOrComp.ShapeType() != TopAbs_COMPOUND && + aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) { + SetErrorCode("Shape is neither a block, nor a compound of blocks"); + return NULL; + } + + TopoDS_Shape anArg1 = theEdge1->GetValue(); + TopoDS_Shape anArg2 = theEdge2->GetValue(); + if (anArg1.IsNull() || anArg2.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg1.ShapeType() != TopAbs_EDGE || + anArg2.ShapeType() != TopAbs_EDGE) { + SetErrorCode("Element for face identification is not an edge"); + return NULL; + } + + //Compute the Face value + try { + TopoDS_Shape aShape; + + TopTools_IndexedDataMapOfShapeListOfShape MEF; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(aBlockOrComp, TopAbs_EDGE, TopAbs_FACE, MEF); + + TopoDS_Shape E1,E2; + Standard_Integer ish, ext = MEF.Extent(); + + if (MEF.Contains(anArg1)) { + E1 = anArg1; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MEF.FindKey(ish); + if (GEOMImpl_Block6Explorer::IsSimilarEdges(anArg1, aShi)) { + E1 = aShi; + } + } + } + + if (MEF.Contains(anArg2)) { + E2 = anArg2; + } else { + for (ish = 1; ish <= ext; ish++) { + TopoDS_Shape aShi = MEF.FindKey(ish); + if (GEOMImpl_Block6Explorer::IsSimilarEdges(anArg2, aShi)) { + E2 = aShi; + } + } + } + + if (E1.IsNull() || E2.IsNull()) { + SetErrorCode("The given edge does not belong to the shape"); + return NULL; + } + + const TopTools_ListOfShape& aFacesOfE1 = MEF.FindFromKey(E1); + const TopTools_ListOfShape& aFacesOfE2 = MEF.FindFromKey(E2); + + Standard_Integer isFound = 0; + TopTools_ListIteratorOfListOfShape anIterF1 (aFacesOfE1); + for (; anIterF1.More(); anIterF1.Next()) { + + TopTools_ListIteratorOfListOfShape anIterF2 (aFacesOfE2); + for (; anIterF2.More(); anIterF2.Next()) { + + if (anIterF1.Value().IsSame(anIterF2.Value())) { + isFound++; + + // Store the face, defined by two edges + aShape = anIterF1.Value(); + } + } + } + if (isFound == 0) { + SetErrorCode("The given edges do not belong to one face of the given shape"); + return NULL; + } else if (isFound > 1) { + SetErrorCode("The given edges belong to several faces of the given shape"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByEdges(" + << theShape << ", " << theEdge1 << ", " << theEdge2 << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetOppositeFace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetOppositeFace + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theFace) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || theFace.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block is null"); + return NULL; + } + if (aBlockOrComp.ShapeType() != TopAbs_SOLID) { + SetErrorCode("Shape is not a block"); + return NULL; + } + + TopoDS_Shape anArg = theFace->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_FACE) { + SetErrorCode("Element for face identification is not a face"); + return NULL; + } + + //Compute the Face value + try { + TopoDS_Shape aShape; + + GEOMImpl_Block6Explorer aBlockTool; + aBlockTool.InitByBlockAndFace(aBlockOrComp, anArg); + aShape = aBlockTool.GetFace(2); + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetOppositeFace(" + << theShape << ", " << theFace << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetFaceNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + if (aBlockOrComp.ShapeType() != TopAbs_SOLID && + aBlockOrComp.ShapeType() != TopAbs_COMPOUND && + aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) { + SetErrorCode("Shape is neither a block, nor a compound of blocks"); + return NULL; + } + + TopoDS_Shape anArg = thePoint->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Element for face identification is not a vertex"); + return NULL; + } + + //Compute the Face value + try { + TopoDS_Shape aShape; + + TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + gp_Pnt aPnt = BRep_Tool::Pnt(aVert); + Standard_Real PX, PY, PZ; + aPnt.Coord(PX, PY, PZ); + + // 1. Classify the point relatively each face + Standard_Integer nearest = 2, nbFound = 0; + TopTools_DataMapOfShapeInteger mapShapeDist; + TopExp_Explorer exp (aBlockOrComp, TopAbs_FACE); + for (; exp.More(); exp.Next()) { + TopoDS_Shape aFace = exp.Current(); + + if (!mapShapeDist.IsBound(aFace)) { + Standard_Integer aDistance = 2; + + // 1.a. Classify relatively Surface + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aFace)); + Handle(ShapeAnalysis_Surface) aSurfAna = new ShapeAnalysis_Surface (aSurf); + gp_Pnt2d p2dOnSurf = aSurfAna->ValueOfUV(aPnt, Precision::Confusion()); + gp_Pnt p3dOnSurf = aSurfAna->Value(p2dOnSurf); + Standard_Real aDist = p3dOnSurf.Distance(aPnt); + if (aDist > Precision::Confusion()) { + // OUT of Surface + aDistance = 1; + } else { + // 1.b. Classify relatively the face itself + BRepClass_FaceClassifier FC (TopoDS::Face(aFace), p2dOnSurf, Precision::Confusion()); + if (FC.State() == TopAbs_IN) { + aDistance = -1; + } else if (FC.State() == TopAbs_ON) { + aDistance = 0; + } else { // OUT + aDistance = 1; + } + } + + if (aDistance < nearest) { + nearest = aDistance; + aShape = aFace; + nbFound = 1; + + // A first found face, containing the point inside, will be returned. + // It is the solution, if there are no + // coincident or intersecting faces in the compound. + if (nearest == -1) break; + + } else if (aDistance == nearest) { + nbFound++; + } else { + } + + mapShapeDist.Bind(aFace, aDistance); + } // if (!mapShapeDist.IsBound(aFace)) + } + + // 2. Define face, containing the point or having minimum distance to it + if (nbFound > 1) { + if (nearest == 0) { + // The point is on boundary of some faces and there are + // no faces, having the point inside + SetErrorCode("Multiple faces near the given point are found"); + return NULL; + + } else if (nearest == 1) { + // The point is outside some faces and there are + // no faces, having the point inside or on boundary. + // We will get a nearest face + Standard_Real bigReal = RealLast(); + Standard_Real minDist = bigReal; + TopTools_DataMapIteratorOfDataMapOfShapeInteger mapShapeDistIter (mapShapeDist); + for (; mapShapeDistIter.More(); mapShapeDistIter.Next()) { + if (mapShapeDistIter.Value() == 1) { + TopoDS_Shape aFace = mapShapeDistIter.Key(); + Standard_Real aDist = bigReal; + + // 2.a. Fast check of distance - if point projection on surface is on face + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aFace)); + Handle(ShapeAnalysis_Surface) aSurfAna = new ShapeAnalysis_Surface (aSurf); + gp_Pnt2d p2dOnSurf = aSurfAna->ValueOfUV(aPnt, Precision::Confusion()); + gp_Pnt p3dOnSurf = aSurfAna->Value(p2dOnSurf); + aDist = p3dOnSurf.Distance(aPnt); + + BRepClass_FaceClassifier FC (TopoDS::Face(aFace), p2dOnSurf, Precision::Confusion()); + if (FC.State() == TopAbs_OUT) { + if (aDist < minDist) { + // 2.b. Slow check - if point projection on surface is outside of face + BRepExtrema_DistShapeShape aDistTool (aVert, aFace); + if (!aDistTool.IsDone()) { + SetErrorCode("Can not find a distance from the given point to one of faces"); + return NULL; + } + aDist = aDistTool.Value(); + } else { + aDist = bigReal; + } + } + + if (aDist < minDist) { + minDist = aDist; + aShape = aFace; + } + } + } + } else { // nearest == -1 +// // The point is inside some faces. +// // We will get a face with nearest center +// Standard_Real minDist = RealLast(); +// TopTools_DataMapIteratorOfDataMapOfShapeInteger mapShapeDistIter (mapShapeDist); +// for (; mapShapeDistIter.More(); mapShapeDistIter.Next()) { +// if (mapShapeDistIter.Value() == -1) { +// TopoDS_Shape aFace = mapShapeDistIter.Key(); +// GProp_GProps aSystem; +// BRepGProp::SurfaceProperties(aFace, aSystem); +// gp_Pnt aCenterMass = aSystem.CentreOfMass(); +// +// Standard_Real aDist = aCenterMass.Distance(aPnt); +// if (aDist < minDist) { +// minDist = aDist; +// aShape = aFace; +// } +// } +// } + } + } // if (nbFound > 1) + + if (nbFound == 0) { + SetErrorCode("There are no faces near the given point"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceNearPoint(" + << theShape << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetFaceByNormale + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale + (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theVector) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theShape.IsNull() || theVector.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theShape->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Block or compound is null"); + return NULL; + } + if (aBlockOrComp.ShapeType() != TopAbs_SOLID && + aBlockOrComp.ShapeType() != TopAbs_COMPOUND && + aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) { + SetErrorCode("Shape is neither a block, nor a compound of blocks"); + return NULL; + } + + TopoDS_Shape anArg = theVector->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_EDGE) { + SetErrorCode("Element for normale identification is not an edge"); + return NULL; + } + + //Compute the Face value + try { + TopoDS_Shape aShape; + + TopoDS_Edge anEdge = TopoDS::Edge(anArg); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anEdge, V1, V2, Standard_True); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); + gp_Vec aVec (P1, P2); + if (aVec.Magnitude() < Precision::Confusion()) { + SetErrorCode("Vector with null magnitude is given"); + return NULL; + } + + Standard_Real minAngle = RealLast(); + TopTools_MapOfShape mapShape; + TopExp_Explorer exp (aBlockOrComp, TopAbs_FACE); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Face aFace = TopoDS::Face(exp.Current()); + BRepAdaptor_Surface SF (aFace); + + Standard_Real u, v, x; + + // find a point on the surface to get normal direction in + u = SF.FirstUParameter(); + x = SF.LastUParameter(); + if (Precision::IsInfinite(u)) { + u = (Precision::IsInfinite(x)) ? 0. : x; + } else if (!Precision::IsInfinite(x)) { + u = (u+x) / 2.; + } + + v = SF.FirstVParameter(); + x = SF.LastVParameter(); + if (Precision::IsInfinite(v)) { + v = (Precision::IsInfinite(x)) ? 0. : x; + } else if (!Precision::IsInfinite(x)) { + v = (v+x) / 2.; + } + + // compute the normal direction + gp_Vec Vec1,Vec2; + SF.D1(u,v,P1,Vec1,Vec2); + gp_Vec V = Vec1.Crossed(Vec2); + x = V.Magnitude(); + if (V.Magnitude() < Precision::Confusion()) { + SetErrorCode("Normal vector of a face has null magnitude"); + return NULL; + } + + // consider the face orientation + if (aFace.Orientation() == TopAbs_REVERSED || + aFace.Orientation() == TopAbs_INTERNAL) { + V = - V; + } + + // compute the angle and compare with the minimal one + Standard_Real anAngle = aVec.Angle(V); + if (anAngle < minAngle) { + minAngle = anAngle; + aShape = aFace; + } + } + } + + if (aShape.IsNull()) { + SetErrorCode("Failed to find a face by the given normale"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByNormale(" + << theShape << ", " << theVector << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * IsCompoundOfBlocks + */ +//============================================================================= +Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks + (Handle(GEOM_Object) theCompound, + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces, + Standard_Integer& theNbBlocks) +{ + SetErrorCode(KO); + Standard_Boolean isCompOfBlocks = Standard_False; + theNbBlocks = 0; + + if (theCompound.IsNull()) return isCompOfBlocks; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + + //Check + isCompOfBlocks = Standard_True; + try { + TopTools_MapOfShape mapShape; + TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape aSolid = exp.Current(); + + TopTools_MapOfShape mapFaces; + TopExp_Explorer expF (aSolid, TopAbs_FACE); + Standard_Integer nbFaces = 0; + for (; expF.More(); expF.Next()) { + if (mapFaces.Add(expF.Current())) { + nbFaces++; + if (nbFaces > theMaxNbFaces) { + isCompOfBlocks = Standard_False; + break; + } + } + } + if (nbFaces < theMinNbFaces || theMaxNbFaces < nbFaces) { + isCompOfBlocks = Standard_False; + } else { + theNbBlocks++; + } + } + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return isCompOfBlocks; + } + + SetErrorCode(OK); + return isCompOfBlocks; +} + +//============================================================================= +/*! + * Set of functions, used by CheckCompoundOfBlocks() method + */ +//============================================================================= +void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape& theShape, + TopTools_ListOfShape& BLO, + TopTools_ListOfShape& NOT, + TopTools_ListOfShape& EXT) +{ + TopAbs_ShapeEnum aType = theShape.ShapeType(); + switch (aType) { + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + { + TopoDS_Iterator It (theShape); + for (; It.More(); It.Next()) { + AddBlocksFrom(It.Value(), BLO, NOT, EXT); + } + } + break; + case TopAbs_SOLID: + { + // Check, if there are seam or degenerated edges + BlockFix_CheckTool aTool; + aTool.SetShape(theShape); + aTool.Perform(); + if (aTool.NbPossibleBlocks() > 0) { + EXT.Append(theShape); + } else { + // Count faces and edges in each face to recognize blocks + TopTools_MapOfShape mapFaces; + Standard_Integer nbFaces = 0; + Standard_Boolean hasNonQuadr = Standard_False; + TopExp_Explorer expF (theShape, TopAbs_FACE); + + for (; expF.More(); expF.Next()) { + if (mapFaces.Add(expF.Current())) { + nbFaces++; + if (nbFaces > 6) break; + + // get wire + TopoDS_Shape aF = expF.Current(); + TopExp_Explorer wires (aF, TopAbs_WIRE); + if (!wires.More()) { + // no wire in the face + hasNonQuadr = Standard_True; + break; + } + TopoDS_Shape aWire = wires.Current(); + wires.Next(); + if (wires.More()) { + // multiple wires in the face + hasNonQuadr = Standard_True; + break; + } + + // Check number of edges in the face + Standard_Integer nbEdges = 0; + TopTools_MapOfShape mapEdges; + TopExp_Explorer expW (aWire, TopAbs_EDGE); + for (; expW.More(); expW.Next()) { + if (mapEdges.Add(expW.Current())) { + nbEdges++; + if (nbEdges > 4) break; + } + } + if (nbEdges != 4) { + hasNonQuadr = Standard_True; + } + } + } + + if (nbFaces == 6 && !hasNonQuadr) { + BLO.Append(theShape); + } else { + NOT.Append(theShape); + } + } + } + break; + default: + NOT.Append(theShape); + } +} + +void AddBlocksFromOld (const TopoDS_Shape& theShape, + TopTools_ListOfShape& BLO, + TopTools_ListOfShape& NOT, + TopTools_ListOfShape& DEG, + TopTools_ListOfShape& SEA) +{ + TopAbs_ShapeEnum aType = theShape.ShapeType(); + switch (aType) { + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + { + TopoDS_Iterator It (theShape); + for (; It.More(); It.Next()) { + AddBlocksFromOld(It.Value(), BLO, NOT, DEG, SEA); + } + } + break; + case TopAbs_SOLID: + { + TopTools_MapOfShape mapFaces; + TopExp_Explorer expF (theShape, TopAbs_FACE); + Standard_Integer nbFaces = 0; + Standard_Boolean hasNonQuadr = Standard_False; + Standard_Boolean hasDegenerated = Standard_False; + Standard_Boolean hasSeam = Standard_False; + for (; expF.More(); expF.Next()) { + if (mapFaces.Add(expF.Current())) { + nbFaces++; + if (nbFaces > 6) break; + + // Check number of edges in the face + Standard_Integer nbEdges = 0; + TopTools_MapOfShape mapEdges; + + // get wire + TopoDS_Shape aF = expF.Current(); + TopExp_Explorer wires (aF, TopAbs_WIRE); + if (!wires.More()) { + // no wire in the face + hasNonQuadr = Standard_True; + break; + } + TopoDS_Shape aWire = wires.Current(); + wires.Next(); + if (wires.More()) { + // multiple wires in the face + hasNonQuadr = Standard_True; + break; + } + + // iterate on wire + BRepTools_WireExplorer aWE (TopoDS::Wire(aWire), TopoDS::Face(aF)); + for (; aWE.More(); aWE.Next(), nbEdges++) { + if (BRep_Tool::Degenerated(aWE.Current())) { + // degenerated edge found + hasDegenerated = Standard_True; +// break; + } + if (mapEdges.Contains(aWE.Current())) { + // seam edge found + hasSeam = Standard_True; +// break; + } + mapEdges.Add(aWE.Current()); + } + if (nbEdges != 4) { + hasNonQuadr = Standard_True; + } + } + } + if (nbFaces == 6) { + if (hasDegenerated || hasSeam) { + if (hasDegenerated) { + DEG.Append(theShape); + } + if (hasSeam) { + SEA.Append(theShape); + } + } else if (hasNonQuadr) { + NOT.Append(theShape); + } else { + BLO.Append(theShape); + } + } else { + NOT.Append(theShape); + } + } + break; + default: + NOT.Append(theShape); + } +} + +#define REL_NOT_CONNECTED 0 +#define REL_OK 1 +#define REL_NOT_GLUED 2 +#define REL_COLLISION_VV 3 +#define REL_COLLISION_FF 4 +#define REL_COLLISION_EE 5 +#define REL_UNKNOWN 6 + +Standard_Integer BlocksRelation (const TopoDS_Shape& theBlock1, + const TopoDS_Shape& theBlock2) +{ + // Compare bounding boxes before calling BRepExtrema_DistShapeShape + Standard_Real Xmin1, Ymin1, Zmin1, Xmax1, Ymax1, Zmax1; + Standard_Real Xmin2, Ymin2, Zmin2, Xmax2, Ymax2, Zmax2; + Bnd_Box B1, B2; + BRepBndLib::Add(theBlock1, B1); + BRepBndLib::Add(theBlock2, B2); + B1.Get(Xmin1, Ymin1, Zmin1, Xmax1, Ymax1, Zmax1); + B2.Get(Xmin2, Ymin2, Zmin2, Xmax2, Ymax2, Zmax2); + if (Xmax2 < Xmin1 || Xmax1 < Xmin2 || + Ymax2 < Ymin1 || Ymax1 < Ymin2 || + Zmax2 < Zmin1 || Zmax1 < Zmin2) { + return REL_NOT_CONNECTED; + } + + BRepExtrema_DistShapeShape dst (theBlock1, theBlock2); + if (!dst.IsDone()) { + return REL_UNKNOWN; + } + + if (dst.Value() > Precision::Confusion()) { + return REL_NOT_CONNECTED; + } + + if (dst.InnerSolution()) { + return REL_COLLISION_VV; + } + + Standard_Integer nbSol = dst.NbSolution(); + Standard_Integer relation = REL_OK; + Standard_Integer nbVerts = 0; + Standard_Integer nbEdges = 0; + Standard_Integer sol = 1; + for (; sol <= nbSol; sol++) { + BRepExtrema_SupportType supp1 = dst.SupportTypeShape1(sol); + BRepExtrema_SupportType supp2 = dst.SupportTypeShape2(sol); + if (supp1 == BRepExtrema_IsVertex && supp2 == BRepExtrema_IsVertex) { + nbVerts++; + } else if (supp1 == BRepExtrema_IsInFace || supp2 == BRepExtrema_IsInFace) { + return REL_COLLISION_FF; + } else if (supp1 == BRepExtrema_IsOnEdge && supp2 == BRepExtrema_IsOnEdge) { + nbEdges++; + } else if ((supp1 == BRepExtrema_IsOnEdge && supp2 == BRepExtrema_IsVertex) || + (supp2 == BRepExtrema_IsOnEdge && supp1 == BRepExtrema_IsVertex)) { + relation = REL_COLLISION_EE; + } else { + } + } + + if (relation != REL_OK) { + return relation; + } + + TColStd_Array1OfInteger vertSol (1, nbVerts); + TopTools_Array1OfShape V1 (1, nbVerts); + TopTools_Array1OfShape V2 (1, nbVerts); + Standard_Integer ivs = 0; + for (sol = 1; sol <= nbSol; sol++) { + if (dst.SupportTypeShape1(sol) == BRepExtrema_IsVertex && + dst.SupportTypeShape2(sol) == BRepExtrema_IsVertex) { + TopoDS_Vertex Vcur = TopoDS::Vertex(dst.SupportOnShape1(sol)); + // Check, that this vertex is far enough from other solution vertices. + Standard_Integer ii = 1; + for (; ii <= ivs; ii++) { + if (BRepTools::Compare(TopoDS::Vertex(V1(ii)), Vcur)) { + continue; + } + } + ivs++; + vertSol(ivs) = sol; + V1(ivs) = Vcur; + V2(ivs) = dst.SupportOnShape2(sol); + } + } + + // As we deal only with quadrangles, + // 2, 3 or 4 vertex solutions can be found. + if (ivs <= 1) { + if (nbEdges > 0) { + return REL_COLLISION_FF; + } + return REL_NOT_CONNECTED; + } + if (ivs > 4) { + return REL_UNKNOWN; + } + + // Check sharing of coincident entities. + if (ivs == 2 || ivs == 3) { + // Map vertices and edges of the blocks + TopTools_IndexedDataMapOfShapeListOfShape MVE1, MVE2; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (theBlock1, TopAbs_VERTEX, TopAbs_EDGE, MVE1); + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (theBlock2, TopAbs_VERTEX, TopAbs_EDGE, MVE2); + + if (ivs == 2) { + // Find common edge + TopoDS_Shape anEdge1, anEdge2; + GEOMImpl_Block6Explorer::FindEdge(anEdge1, V1(1), V1(2), MVE1); + if (anEdge1.IsNull()) return REL_UNKNOWN; + + GEOMImpl_Block6Explorer::FindEdge(anEdge2, V2(1), V2(2), MVE2); + if (anEdge2.IsNull()) return REL_UNKNOWN; + + if (!anEdge1.IsSame(anEdge2)) return REL_NOT_GLUED; + + } else { // ivs == 3 + // Find common edges + Standard_Integer e1_v1 = 1; + Standard_Integer e1_v2 = 2; + Standard_Integer e2_v1 = 3; + Standard_Integer e2_v2 = 1; + + TopoDS_Shape anEdge11, anEdge12; + GEOMImpl_Block6Explorer::FindEdge(anEdge11, V1(e1_v1), V1(e1_v2), MVE1); + if (anEdge11.IsNull()) { + e1_v2 = 3; + e2_v1 = 2; + GEOMImpl_Block6Explorer::FindEdge(anEdge11, V1(e1_v1), V1(e1_v2), MVE1); + if (anEdge11.IsNull()) return REL_UNKNOWN; + } + GEOMImpl_Block6Explorer::FindEdge(anEdge12, V1(e2_v1), V1(e2_v2), MVE1); + if (anEdge12.IsNull()) { + e2_v2 = 5 - e2_v1; + GEOMImpl_Block6Explorer::FindEdge(anEdge12, V1(e2_v1), V1(e2_v2), MVE1); + if (anEdge12.IsNull()) return REL_UNKNOWN; + } + + TopoDS_Shape anEdge21, anEdge22; + GEOMImpl_Block6Explorer::FindEdge(anEdge21, V2(e1_v1), V2(e1_v2), MVE2); + if (anEdge21.IsNull()) return REL_UNKNOWN; + GEOMImpl_Block6Explorer::FindEdge(anEdge22, V2(e2_v1), V2(e2_v2), MVE2); + if (anEdge22.IsNull()) return REL_UNKNOWN; + + // Check of edges coincidence (with some precision) have to be done here + // if (!anEdge11.IsEqual(anEdge21)) return REL_UNKNOWN; + // if (!anEdge12.IsEqual(anEdge22)) return REL_UNKNOWN; + + // Check of edges sharing + if (!anEdge11.IsSame(anEdge21)) return REL_NOT_GLUED; + if (!anEdge12.IsSame(anEdge22)) return REL_NOT_GLUED; + } + } + + if (ivs == 4) { + // Map vertices and faces of the blocks + TopTools_IndexedDataMapOfShapeListOfShape MVF1, MVF2; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (theBlock1, TopAbs_VERTEX, TopAbs_FACE, MVF1); + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (theBlock2, TopAbs_VERTEX, TopAbs_FACE, MVF2); + + TopoDS_Shape aFace1, aFace2; + GEOMImpl_Block6Explorer::FindFace(aFace1, V1(1), V1(2), V1(3), V1(4), MVF1); + if (aFace1.IsNull()) return REL_UNKNOWN; + GEOMImpl_Block6Explorer::FindFace(aFace2, V2(1), V2(2), V2(3), V2(4), MVF2); + if (aFace2.IsNull()) return REL_UNKNOWN; + + // Check of faces coincidence (with some precision) have to be done here + // if (!aFace1.IsEqual(aFace2)) return REL_UNKNOWN; + + // Check of faces sharing + if (!aFace1.IsSame(aFace2)) return REL_NOT_GLUED; + } + + return REL_OK; +} + +void FindConnected (const Standard_Integer theBlockIndex, + const TColStd_Array2OfInteger& theRelations, + TColStd_MapOfInteger& theProcessedMap, + TColStd_MapOfInteger& theConnectedMap) +{ + theConnectedMap.Add(theBlockIndex); + theProcessedMap.Add(theBlockIndex); + + Standard_Integer nbBlocks = theRelations.ColLength(); + Standard_Integer col = 1; + for (; col <= nbBlocks; col++) { + if (theRelations(theBlockIndex, col) == REL_OK || + theRelations(theBlockIndex, col) == REL_NOT_GLUED) { + if (!theProcessedMap.Contains(col)) { + FindConnected(col, theRelations, theProcessedMap, theConnectedMap); + } + } + } +} + +Standard_Boolean HasAnyConnection (const Standard_Integer theBlockIndex, + const TColStd_MapOfInteger& theWith, + const TColStd_Array2OfInteger& theRelations, + TColStd_MapOfInteger& theProcessedMap) +{ + theProcessedMap.Add(theBlockIndex); + + Standard_Integer nbBlocks = theRelations.ColLength(); + Standard_Integer col = 1; + for (; col <= nbBlocks; col++) { + if (theRelations(theBlockIndex, col) != REL_NOT_CONNECTED) { + if (!theProcessedMap.Contains(col)) { + if (theWith.Contains(col)) + return Standard_True; + if (HasAnyConnection(col, theWith, theRelations, theProcessedMap)) + return Standard_True; + } + } + } + + return Standard_False; +} + +//============================================================================= +/*! + * CheckCompoundOfBlocksOld + */ +//============================================================================= +Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocksOld + (Handle(GEOM_Object) theCompound, + list& theErrors) +{ + SetErrorCode(KO); + + if (theCompound.IsNull()) return Standard_False; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + + Standard_Boolean isCompOfBlocks = Standard_True; + + // Map sub-shapes and their indices + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + + // 1. Report non-blocks + TopTools_ListOfShape NOT; // Not blocks + TopTools_ListOfShape DEG; // Hexahedral solids, having degenerated edges + TopTools_ListOfShape SEA; // Hexahedral solids, having seam edges + TopTools_ListOfShape BLO; // All blocks from the given compound + AddBlocksFromOld(aBlockOrComp, BLO, NOT, DEG, SEA); + + if (NOT.Extent() > 0) { + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = NOT_BLOCK; + TopTools_ListIteratorOfListOfShape it (NOT); + for (; it.More(); it.Next()) { + anErr.incriminated.push_back(anIndices.FindIndex(it.Value())); + } + theErrors.push_back(anErr); + } + + if (DEG.Extent() > 0 || SEA.Extent() > 0) { + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = EXTRA_EDGE; + + TopTools_ListIteratorOfListOfShape itDEG (DEG); + for (; itDEG.More(); itDEG.Next()) { + anErr.incriminated.push_back(anIndices.FindIndex(itDEG.Value())); + } + + TopTools_ListIteratorOfListOfShape itSEA (SEA); + for (; itSEA.More(); itSEA.Next()) { + anErr.incriminated.push_back(anIndices.FindIndex(itSEA.Value())); + } + + theErrors.push_back(anErr); + } + + Standard_Integer nbBlocks = BLO.Extent(); + if (nbBlocks == 0) { + isCompOfBlocks = Standard_False; + SetErrorCode(OK); + return isCompOfBlocks; + } + if (nbBlocks == 1) { + SetErrorCode(OK); + return isCompOfBlocks; + } + + // Convert list of blocks into array for easy and fast access + Standard_Integer ibl = 1; + TopTools_Array1OfShape aBlocks (1, nbBlocks); + TopTools_ListIteratorOfListOfShape BLOit (BLO); + for (; BLOit.More(); BLOit.Next(), ibl++) { + aBlocks.SetValue(ibl, BLOit.Value()); + } + + // 2. Find relations between all blocks, + // report connection errors (NOT_GLUED and INVALID_CONNECTION) + TColStd_Array2OfInteger aRelations (1, nbBlocks, 1, nbBlocks); + aRelations.Init(REL_NOT_CONNECTED); + + Standard_Integer row = 1; + for (row = 1; row <= nbBlocks; row++) { + TopoDS_Shape aBlock = aBlocks.Value(row); + + Standard_Integer col = row + 1; + for (; col <= nbBlocks; col++) { + Standard_Integer aRel = BlocksRelation(aBlock, aBlocks.Value(col)); + if (aRel != REL_NOT_CONNECTED) { + aRelations.SetValue(row, col, aRel); + aRelations.SetValue(col, row, aRel); + if (aRel == REL_NOT_GLUED) { + // report connection error + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = NOT_GLUED; + anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row))); + anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col))); + theErrors.push_back(anErr); + } else if (aRel == REL_COLLISION_VV || + aRel == REL_COLLISION_FF || + aRel == REL_COLLISION_EE || + aRel == REL_UNKNOWN) { + // report connection error + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = INVALID_CONNECTION; + anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row))); + anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col))); + theErrors.push_back(anErr); + } else { + } + } + } + } + + // 3. Find largest set of connected (good connection or not glued) blocks + TColStd_MapOfInteger aProcessedMap; + TColStd_MapOfInteger aLargestSet; + TColStd_MapOfInteger aCurrentSet; + for (ibl = 1; ibl <= nbBlocks; ibl++) { + if (!aProcessedMap.Contains(ibl)) { + aCurrentSet.Clear(); + FindConnected(ibl, aRelations, aProcessedMap, aCurrentSet); + if (aCurrentSet.Extent() > aLargestSet.Extent()) { + aLargestSet = aCurrentSet; + } + } + } + + // 4. Report all blocks, isolated from + BCError anErr; + anErr.error = NOT_CONNECTED; + Standard_Boolean hasIsolated = Standard_False; + for (ibl = 1; ibl <= nbBlocks; ibl++) { + if (!aLargestSet.Contains(ibl)) { + aProcessedMap.Clear(); + if (!HasAnyConnection(ibl, aLargestSet, aRelations, aProcessedMap)) { + // report connection absence + hasIsolated = Standard_True; + anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(ibl))); + } + } + } + if (hasIsolated) { + isCompOfBlocks = Standard_False; + theErrors.push_back(anErr); + } + + SetErrorCode(OK); + return isCompOfBlocks; +} + +//============================================================================= +/*! + * PrintBCErrors + */ +//============================================================================= +TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors + (Handle(GEOM_Object) theCompound, + const list& theErrors) +{ + TCollection_AsciiString aDescr; + + list::const_iterator errIt = theErrors.begin(); + int i = 0; + for (; errIt != theErrors.end(); i++, errIt++) { + BCError errStruct = *errIt; + + switch (errStruct.error) { + case NOT_BLOCK: + aDescr += "\n\tNot a Blocks: "; + break; + case EXTRA_EDGE: + aDescr += "\n\tHexahedral solids with degenerated and/or seam edges: "; + break; + case INVALID_CONNECTION: + aDescr += "\n\tInvalid connection between two blocks: "; + break; + case NOT_CONNECTED: + aDescr += "\n\tBlocks, not connected with main body: "; + break; + case NOT_GLUED: + aDescr += "\n\tNot glued blocks: "; + break; + default: + break; + } + + list sshList = errStruct.incriminated; + list::iterator sshIt = sshList.begin(); + int jj = 0; + for (; sshIt != sshList.end(); jj++, sshIt++) { + if (jj > 0) + aDescr += ", "; + aDescr += TCollection_AsciiString(*sshIt); + } + } + + return aDescr; +} + +//============================================================================= +/*! + * CheckCompoundOfBlocks + */ +//============================================================================= +Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks + (Handle(GEOM_Object) theCompound, + list& theErrors) +{ + SetErrorCode(KO); + + if (theCompound.IsNull()) return Standard_False; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + + Standard_Boolean isCompOfBlocks = Standard_True; + + // Map sub-shapes and their indices + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + + // 1. Separate blocks from non-blocks + TopTools_ListOfShape NOT; // Not blocks + TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges + TopTools_ListOfShape BLO; // All blocks from the given compound + AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT); + + // Report non-blocks + if (NOT.Extent() > 0) { + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = NOT_BLOCK; + TopTools_ListIteratorOfListOfShape it (NOT); + for (; it.More(); it.Next()) { + anErr.incriminated.push_back(anIndices.FindIndex(it.Value())); + } + theErrors.push_back(anErr); + } + + // Report solids, having degenerated and/or seam edges + if (EXT.Extent() > 0) { + isCompOfBlocks = Standard_False; + BCError anErr; + anErr.error = EXTRA_EDGE; + TopTools_ListIteratorOfListOfShape it (EXT); + for (; it.More(); it.Next()) { + anErr.incriminated.push_back(anIndices.FindIndex(it.Value())); + } + theErrors.push_back(anErr); + } + + Standard_Integer nbBlocks = BLO.Extent(); + if (nbBlocks == 0) { + isCompOfBlocks = Standard_False; + SetErrorCode(OK); + return isCompOfBlocks; + } + if (nbBlocks == 1) { + SetErrorCode(OK); + return isCompOfBlocks; + } + + // Prepare data for 2. and 3. + TColStd_Array2OfInteger aRelations (1, nbBlocks, 1, nbBlocks); + aRelations.Init(REL_NOT_CONNECTED); + + TopTools_IndexedMapOfShape mapBlocks; + + BRep_Builder BB; + TopoDS_Compound aComp; + BB.MakeCompound(aComp); + + TopTools_ListIteratorOfListOfShape BLOit (BLO); + for (; BLOit.More(); BLOit.Next()) { + mapBlocks.Add(BLOit.Value()); + BB.Add(aComp, BLOit.Value()); + } + + // 2. Find glued blocks (having shared faces) + TopTools_IndexedDataMapOfShapeListOfShape mapFaceBlocks; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (aComp, TopAbs_FACE, TopAbs_SOLID, mapFaceBlocks); + + Standard_Integer prevInd = 0, curInd = 0; + Standard_Integer ind = 1, nbFaces = mapFaceBlocks.Extent(); + for (; ind <= nbFaces; ind++) { + const TopTools_ListOfShape& aGluedBlocks = mapFaceBlocks.FindFromIndex(ind); + if (aGluedBlocks.Extent() > 1) { // Shared face found + TopTools_ListIteratorOfListOfShape aGluedBlocksIt (aGluedBlocks); + TopoDS_Shape prevBlock, curBlock; + for (; aGluedBlocksIt.More(); aGluedBlocksIt.Next()) { + curBlock = aGluedBlocksIt.Value(); + if (!prevBlock.IsNull()) { + prevInd = mapBlocks.FindIndex(prevBlock); + curInd = mapBlocks.FindIndex(curBlock); + aRelations.SetValue(prevInd, curInd, REL_OK); + aRelations.SetValue(curInd, prevInd, REL_OK); + } + prevBlock = curBlock; + } + } + } + + // 3. Find not glued blocks + GEOMAlgo_GlueAnalyser aGD; + + aGD.SetShape(aComp); + aGD.SetTolerance(Precision::Confusion()); + aGD.SetCheckGeometry(Standard_True); + aGD.Perform(); + + Standard_Integer iErr, iWrn; + iErr = aGD.ErrorStatus(); + if (iErr) { + SetErrorCode("Error in GEOMAlgo_GlueAnalyser"); + return isCompOfBlocks; + } + iWrn = aGD.WarningStatus(); + if (iWrn) { + MESSAGE("Warning in GEOMAlgo_GlueAnalyser"); + } + + // Report not glued blocks + if (aGD.HasSolidsToGlue()) { + isCompOfBlocks = Standard_False; + Standard_Integer aSx1Ind, aSx2Ind; + + const GEOMAlgo_ListOfCoupleOfShapes& aLCS = aGD.SolidsToGlue(); + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS (aLCS); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCS = aItCS.Value(); + const TopoDS_Shape& aSx1 = aCS.Shape1(); + const TopoDS_Shape& aSx2 = aCS.Shape2(); + + aSx1Ind = mapBlocks.FindIndex(aSx1); + aSx2Ind = mapBlocks.FindIndex(aSx2); + aRelations.SetValue(aSx1Ind, aSx2Ind, NOT_GLUED); + aRelations.SetValue(aSx2Ind, aSx1Ind, NOT_GLUED); + + BCError anErr; + anErr.error = NOT_GLUED; + anErr.incriminated.push_back(anIndices.FindIndex(aSx1)); + anErr.incriminated.push_back(anIndices.FindIndex(aSx2)); + theErrors.push_back(anErr); + } + } + + // 4. Find largest set of connected (good connection or not glued) blocks + Standard_Integer ibl = 1; + TColStd_MapOfInteger aProcessedMap; + TColStd_MapOfInteger aLargestSet; + TColStd_MapOfInteger aCurrentSet; + for (ibl = 1; ibl <= nbBlocks; ibl++) { + if (!aProcessedMap.Contains(ibl)) { + aCurrentSet.Clear(); + FindConnected(ibl, aRelations, aProcessedMap, aCurrentSet); + if (aCurrentSet.Extent() > aLargestSet.Extent()) { + aLargestSet = aCurrentSet; + } + } + } + + // 5. Report all blocks, isolated from + BCError anErr; + anErr.error = NOT_CONNECTED; + Standard_Boolean hasIsolated = Standard_False; + for (ibl = 1; ibl <= nbBlocks; ibl++) { + if (!aLargestSet.Contains(ibl)) { + aProcessedMap.Clear(); + if (!HasAnyConnection(ibl, aLargestSet, aRelations, aProcessedMap)) { + // report connection absence + hasIsolated = Standard_True; + anErr.incriminated.push_back(anIndices.FindIndex(mapBlocks.FindKey(ibl))); + } + } + } + if (hasIsolated) { + isCompOfBlocks = Standard_False; + theErrors.push_back(anErr); + } + + SetErrorCode(OK); + return isCompOfBlocks; +} + +//============================================================================= +/*! + * RemoveExtraEdges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges + (Handle(GEOM_Object) theObject) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be fixed + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); + + //Add a function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_REMOVE_EXTRA); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlockTrsf aTI (aFunction); + aTI.SetOriginal(aLastFunction); + + //Compute the fixed shape + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to remove extra edges of the given shape"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy + << " = geompy.RemoveExtraEdges(" << theObject << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * CheckAndImprove + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::CheckAndImprove + (Handle(GEOM_Object) theObject) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be fixed + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); + + //Add a function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_COMPOUND_IMPROVE); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlockTrsf aTI (aFunction); + aTI.SetOriginal(aLastFunction); + + //Compute the fixed shape + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to improve the given blocks compound"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy + << " = geompy.CheckAndImprove(" << theObject << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * ExplodeCompoundOfBlocks + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompoundOfBlocks + (Handle(GEOM_Object) theCompound, + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces) +{ + SetErrorCode(KO); + + if (theCompound.IsNull()) return NULL; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + if (aBlockOrComp.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aBlocks = new TColStd_HSequenceOfTransient; + Handle(GEOM_Object) anObj; + Handle(GEOM_Function) aFunction; + + TopTools_MapOfShape mapShape; + TCollection_AsciiString anAsciiList, anEntry; + + // Map shapes + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + + // Explode + try { + TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape aSolid = exp.Current(); + + TopTools_MapOfShape mapFaces; + TopExp_Explorer expF (aSolid, TopAbs_FACE); + Standard_Integer nbFaces = 0; + for (; expF.More(); expF.Next()) { + if (mapFaces.Add(expF.Current())) { + nbFaces++; + } + } + + if (theMinNbFaces <= nbFaces && nbFaces <= theMaxNbFaces) { + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aSolid)); + anObj = GetEngine()->AddSubShape(theCompound, anArray); + aBlocks->Append(anObj); + + //Make a Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry + ", "; + } + } + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return aBlocks; + } + + if (aBlocks->IsEmpty()) { + SetErrorCode("There are no specified blocks in the given shape"); + return aBlocks; + } + + anAsciiList.Trunc(anAsciiList.Length() - 2); + + //The explode doesn't change object so no new function is required. + aFunction = theCompound->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t[" + << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode(" + << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")"; + + SetErrorCode(OK); + return aBlocks; +} + +//============================================================================= +/*! + * GetBlockNearPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockNearPoint + (Handle(GEOM_Object) theCompound, + Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + //New object + Handle(GEOM_Object) aResult; + + // Arguments + if (theCompound.IsNull() || thePoint.IsNull()) return NULL; + + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + if (aBlockOrComp.IsNull()) { + SetErrorCode("Compound is null"); + return NULL; + } + if (aBlockOrComp.ShapeType() != TopAbs_COMPOUND && + aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) { + SetErrorCode("Shape to find block in is not a compound"); + return NULL; + } + + TopoDS_Shape anArg = thePoint->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Point is null"); + return NULL; + } + if (anArg.ShapeType() != TopAbs_VERTEX) { + SetErrorCode("Shape for block identification is not a vertex"); + return NULL; + } + + //Compute the Block value + try { + TopoDS_Shape aShape; + + TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + gp_Pnt aPnt = BRep_Tool::Pnt(aVert); + Standard_Real PX, PY, PZ; + aPnt.Coord(PX, PY, PZ); + + // 1. Classify the point relatively each block + Standard_Integer nearest = 2, nbFound = 0; + TopTools_DataMapOfShapeInteger mapShapeDist; + TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); + for (; exp.More(); exp.Next()) { + TopoDS_Shape aSolid = exp.Current(); + + if (!mapShapeDist.IsBound(aSolid)) { + Standard_Integer aDistance = 2; + + // 1.a. Classify relatively Bounding box + Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax; + Bnd_Box BB; + BRepBndLib::Add(aSolid, BB); + BB.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); + if (PX < Xmin || Xmax < PX || + PY < Ymin || Ymax < PY || + PZ < Zmin || Zmax < PZ) { + // OUT of bounding box + aDistance = 1; + } else { + // 1.b. Classify relatively the solid itself + BRepClass3d_SolidClassifier SC (aSolid, aPnt, Precision::Confusion()); + if (SC.State() == TopAbs_IN) { + aDistance = -1; + } else if (SC.State() == TopAbs_ON) { + aDistance = 0; + } else { // OUT + aDistance = 1; + } + } + + if (aDistance < nearest) { + nearest = aDistance; + aShape = aSolid; + nbFound = 1; + + // A first found block, containing the point inside, will be returned. + // It is the solution, if there are no intersecting blocks in the compound. + if (nearest == -1) break; + + } else if (aDistance == nearest) { + nbFound++; + } else { + } + + mapShapeDist.Bind(aSolid, aDistance); + } // if (!mapShapeDist.IsBound(aSolid)) + } + + // 2. Define block, containing the point or having minimum distance to it + if (nbFound > 1) { + if (nearest == 0) { + // The point is on boundary of some blocks and there are + // no blocks, having the point inside their volume + SetErrorCode("Multiple blocks near the given point are found"); + return NULL; + + } else if (nearest == 1) { + // The point is outside some blocks and there are + // no blocks, having the point inside or on boundary. + // We will get a nearest block + Standard_Real minDist = RealLast(); + TopTools_DataMapIteratorOfDataMapOfShapeInteger mapShapeDistIter (mapShapeDist); + for (; mapShapeDistIter.More(); mapShapeDistIter.Next()) { + if (mapShapeDistIter.Value() == 1) { + TopoDS_Shape aSolid = mapShapeDistIter.Key(); + BRepExtrema_DistShapeShape aDistTool (aVert, aSolid); + if (!aDistTool.IsDone()) { + SetErrorCode("Can not find a distance from the given point to one of blocks"); + return NULL; + } + Standard_Real aDist = aDistTool.Value(); + if (aDist < minDist) { + minDist = aDist; + aShape = aSolid; + } + } + } + } else { // nearest == -1 +// // The point is inside some blocks. +// // We will get a block with nearest center +// Standard_Real minDist = RealLast(); +// TopTools_DataMapIteratorOfDataMapOfShapeInteger mapShapeDistIter (mapShapeDist); +// for (; mapShapeDistIter.More(); mapShapeDistIter.Next()) { +// if (mapShapeDistIter.Value() == -1) { +// TopoDS_Shape aSolid = mapShapeDistIter.Key(); +// GProp_GProps aSystem; +// BRepGProp::VolumeProperties(aSolid, aSystem); +// gp_Pnt aCenterMass = aSystem.CentreOfMass(); +// +// Standard_Real aDist = aCenterMass.Distance(aPnt); +// if (aDist < minDist) { +// minDist = aDist; +// aShape = aSolid; +// } +// } +// } + } + } // if (nbFound > 1) + + if (nbFound == 0) { + SetErrorCode("There are no blocks near the given point"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theCompound, anArray); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockNearPoint(" + << theCompound << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetBlockByParts + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockByParts + (Handle(GEOM_Object) theCompound, + const Handle(TColStd_HSequenceOfTransient)& theParts) +{ + SetErrorCode(KO); + + Handle(GEOM_Object) aResult; + + if (theCompound.IsNull() || theParts.IsNull()) return NULL; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + if (aBlockOrComp.IsNull()) return NULL; + + //Get the parts + Standard_Integer argi, aLen = theParts->Length(); + TopTools_Array1OfShape anArgs (1, aLen); + TCollection_AsciiString anEntry, aPartsDescr; + for (argi = 1; argi <= aLen; argi++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theParts->Value(argi)); + Handle(GEOM_Function) aRef = anObj->GetLastFunction(); + if (aRef.IsNull()) return NULL; + + TopoDS_Shape anArg = aRef->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + anArgs(argi) = anArg; + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if (argi > 1) aPartsDescr += ", "; + aPartsDescr += anEntry; + } + + //Compute the Block value + try { + // 1. Explode compound on solids + TopTools_MapOfShape mapShape; + Standard_Integer nbSolids = 0; + TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbSolids++; + } + } + + mapShape.Clear(); + Standard_Integer ind = 1; + TopTools_Array1OfShape aSolids (1, nbSolids); + TColStd_Array1OfInteger aNbParts (1, nbSolids); + for (exp.Init(aBlockOrComp, TopAbs_SOLID); exp.More(); exp.Next(), ind++) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape aSolid = exp.Current(); + aSolids(ind) = aSolid; + aNbParts(ind) = 0; + + // 2. Define quantity of parts, contained in each solid + TopTools_IndexedMapOfShape aSubShapes; + TopExp::MapShapes(aSolid, aSubShapes); + for (argi = 1; argi <= aLen; argi++) { + if (aSubShapes.Contains(anArgs(argi))) { + aNbParts(ind)++; + } + } + } + } + + // 3. Define solid, containing maximum quantity of parts + Standard_Integer maxNb = 0, nbFound = 0; + TopoDS_Shape aShape; + for (ind = 1; ind <= nbSolids; ind++) { + if (aNbParts(ind) > maxNb) { + maxNb = aNbParts(ind); + aShape = aSolids(ind); + nbFound = 1; + } else if (aNbParts(ind) == maxNb) { + nbFound++; + } else { + } + } + if (nbFound > 1) { + SetErrorCode("Multiple blocks, containing maximum quantity of the given parts, are found"); + return NULL; + } else if (nbFound == 0) { + SetErrorCode("There are no blocks, containing the given parts"); + return NULL; + } else { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theCompound, anArray); + } + } catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockByParts(" + << theCompound << ", [" << aPartsDescr.ToCString() << "])"; + + SetErrorCode(OK); + return aResult; +} + +//============================================================================= +/*! + * GetBlocksByParts + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByParts + (Handle(GEOM_Object) theCompound, + const Handle(TColStd_HSequenceOfTransient)& theParts) +{ + SetErrorCode(KO); + + if (theCompound.IsNull() || theParts.IsNull()) return NULL; + TopoDS_Shape aBlockOrComp = theCompound->GetValue(); + if (aBlockOrComp.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aBlocks = new TColStd_HSequenceOfTransient; + Handle(GEOM_Object) anObj; + Handle(GEOM_Function) aFunction; + + //Get the parts + Standard_Integer argi, aLen = theParts->Length(); + TopTools_Array1OfShape anArgs (1, aLen); + TCollection_AsciiString anEntry, aPartsDescr, anAsciiList; + + for (argi = 1; argi <= aLen; argi++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theParts->Value(argi)); + Handle(GEOM_Function) aRef = anObj->GetLastFunction(); + if (aRef.IsNull()) return NULL; + + TopoDS_Shape anArg = aRef->GetValue(); + if (anArg.IsNull()) { + SetErrorCode("Null shape is given as argument"); + return NULL; + } + anArgs(argi) = anArg; + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + aPartsDescr += anEntry + ", "; + } + + //Get the Blocks + try { + TopTools_MapOfShape mapShape; + Standard_Integer nbSolids = 0; + TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbSolids++; + } + } + + mapShape.Clear(); + Standard_Integer ind = 1; + TopTools_Array1OfShape aSolids (1, nbSolids); + TColStd_Array1OfInteger aNbParts (1, nbSolids); + for (exp.Init(aBlockOrComp, TopAbs_SOLID); exp.More(); exp.Next(), ind++) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape aSolid = exp.Current(); + aSolids(ind) = aSolid; + aNbParts(ind) = 0; + + // 2. Define quantity of parts, contained in each solid + TopTools_IndexedMapOfShape aSubShapes; + TopExp::MapShapes(aSolid, aSubShapes); + for (argi = 1; argi <= aLen; argi++) { + if (aSubShapes.Contains(anArgs(argi))) { + aNbParts(ind)++; + } + } + } + } + + // 3. Define solid, containing maximum quantity of parts + Standard_Integer maxNb = 0, nbFound = 0; + for (ind = 1; ind <= nbSolids; ind++) { + if (aNbParts(ind) > maxNb) { + maxNb = aNbParts(ind); + nbFound = 1; + } else if (aNbParts(ind) == maxNb) { + nbFound++; + } else { + } + } + if (nbFound == 0) { + SetErrorCode("There are no blocks, containing the given parts"); + return NULL; + } + + // Map shapes + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + + for (ind = 1; ind <= nbSolids; ind++) { + if (aNbParts(ind) == maxNb) { + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aSolids(ind))); + anObj = GetEngine()->AddSubShape(theCompound, anArray); + aBlocks->Append(anObj); + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry + ", "; + if (aFunction.IsNull()) + aFunction = anObj->GetLastFunction(); + } + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + aPartsDescr.Trunc(aPartsDescr.Length() - 2); + anAsciiList.Trunc(anAsciiList.Length() - 2); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetBlocksByParts(" << theCompound + << ", [" << aPartsDescr.ToCString() << "])"; + + SetErrorCode(OK); + return aBlocks; +} + +//============================================================================= +/*! + * MakeMultiTransformation1D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation1D + (Handle(GEOM_Object) theObject, + const Standard_Integer theDirFace1, + const Standard_Integer theDirFace2, + const Standard_Integer theNbTimes) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_MULTI_TRANSFORM_1D); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlockTrsf aTI (aFunction); + aTI.SetOriginal(aLastFunction); + aTI.SetFace1U(theDirFace1); + aTI.SetFace2U(theDirFace2); + aTI.SetNbIterU(theNbTimes); + + //Compute the transformation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to make multi-transformation"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation1D(" + << theObject << ", " << theDirFace1 << ", " << theDirFace2 << ", " << theNbTimes << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * MakeMultiTransformation2D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation2D + (Handle(GEOM_Object) theObject, + const Standard_Integer theDirFace1U, + const Standard_Integer theDirFace2U, + const Standard_Integer theNbTimesU, + const Standard_Integer theDirFace1V, + const Standard_Integer theDirFace2V, + const Standard_Integer theNbTimesV) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_MULTI_TRANSFORM_2D); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL; + + GEOMImpl_IBlockTrsf aTI (aFunction); + aTI.SetOriginal(aLastFunction); + aTI.SetFace1U(theDirFace1U); + aTI.SetFace2U(theDirFace2U); + aTI.SetNbIterU(theNbTimesU); + aTI.SetFace1V(theDirFace1V); + aTI.SetFace2V(theDirFace2V); + aTI.SetNbIterV(theNbTimesV); + + //Compute the transformation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Block driver failed to make multi-transformation"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation2D(" + << theObject << ", " << theDirFace1U << ", " << theDirFace2U << ", " << theNbTimesU + << ", " << theDirFace1V << ", " << theDirFace2V << ", " << theNbTimesV << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Propagate + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate + (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + + TopTools_IndexedDataMapOfShapeListOfShape MEW; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (aShape, TopAbs_EDGE, TopAbs_WIRE, MEW); + Standard_Integer ie, nbEdges = MEW.Extent(); + + // Result + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + + TopTools_MapOfShape mapAcceptedEdges; + TCollection_AsciiString aListRes, anEntry; + + for (ie = 1; ie <= nbEdges; ie++) { + TopoDS_Shape curE = MEW.FindKey(ie); + + if (mapAcceptedEdges.Contains(curE)) continue; + + // Build the chain + TopTools_ListOfShape currentChain; + TopTools_ListOfShape listPrevEdges; + + currentChain.Append(curE); + listPrevEdges.Append(curE); + mapAcceptedEdges.Add(curE); + + // Collect all edges pass by pass + while (listPrevEdges.Extent() > 0) { + // List of edges, added to chain on this cycle pass + TopTools_ListOfShape listCurEdges; + + // Find the next portion of edges + TopTools_ListIteratorOfListOfShape itE (listPrevEdges); + for (; itE.More(); itE.Next()) { + TopoDS_Shape anE = itE.Value(); + + // Iterate on faces, having edge + TopTools_ListIteratorOfListOfShape itW (MEW.FindFromKey(anE)); + for (; itW.More(); itW.Next()) { + TopoDS_Shape aW = itW.Value(); + TopoDS_Shape anOppE; + + BRepTools_WireExplorer aWE (TopoDS::Wire(aW)); + Standard_Integer nb = 1, found = 0; + TopTools_Array1OfShape anEdges (1,4); + for (; aWE.More(); aWE.Next(), nb++) { + if (nb > 4) { + found = 0; + break; + } + anEdges(nb) = aWE.Current(); + if (anEdges(nb).IsSame(anE)) found = nb; + } + + if (nb == 5 && found > 0) { + // Quadrangle face found, get an opposite edge + Standard_Integer opp = found + 2; + if (opp > 4) opp -= 4; + anOppE = anEdges(opp); + + if (!mapAcceptedEdges.Contains(anOppE)) { + // Add found edge to the chain + currentChain.Append(anOppE); + listCurEdges.Append(anOppE); + mapAcceptedEdges.Add(anOppE); + } + } // if (nb == 5 && found > 0) + } // for (; itF.More(); itF.Next()) + } // for (; itE.More(); itE.Next()) + + listPrevEdges = listCurEdges; + } // while (listPrevEdges.Extent() > 0) + + // Store the chain in the document + Handle(TColStd_HArray1OfInteger) anArray = + new TColStd_HArray1OfInteger (1, currentChain.Extent()); + + // Fill array of sub-shape indices + TopTools_ListIteratorOfListOfShape itSub (currentChain); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + int id = anIndices.FindIndex(itSub.Value()); + anArray->SetValue(index, id); + } + + // Add a new group object + Handle(GEOM_Object) aChain = GetEngine()->AddSubShape(theShape, anArray); + + // Set a GROUP type + aChain->SetType(GEOM_GROUP); + + // Set a sub shape type + TDF_Label aFreeLabel = aChain->GetFreeLabel(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)TopAbs_EDGE); + + // Add the chain to the result + aSeq->Append(aChain); + + //Make a Python command + TDF_Tool::Entry(aChain->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + + if (aSeq->IsEmpty()) { + SetErrorCode("There are no quadrangle faces in the shape"); + return aSeq; + } + + aListRes.Trunc(aListRes.Length() - 2); + + // The Propagation doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + // Make a Python command + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t[" + << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")"; + + SetErrorCode(OK); + return aSeq; +} diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx new file mode 100644 index 000000000..4b43078dc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx @@ -0,0 +1,171 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IBlocksOperations_HXX_ +#define _GEOMImpl_IBlocksOperations_HXX_ + +#include "GEOM_IOperations.hxx" + +#include +#include + +#include + +class GEOM_Engine; +class Handle(GEOM_Object); +class Handle(TColStd_HArray1OfInteger); + +class GEOMImpl_IBlocksOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IBlocksOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IBlocksOperations(); + + // Creation of blocks and block faces + Standard_EXPORT Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2, + Handle(GEOM_Object) theEdge3, + Handle(GEOM_Object) theEdge4); + + Standard_EXPORT Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2); + + Standard_EXPORT Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); + + Standard_EXPORT Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1, + Handle(GEOM_Object) theFace2, + Handle(GEOM_Object) theFace3, + Handle(GEOM_Object) theFace4, + Handle(GEOM_Object) theFace5, + Handle(GEOM_Object) theFace6); + + Standard_EXPORT Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1, + Handle(GEOM_Object) theFace2); + + Standard_EXPORT Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound); + + // Extract elements of blocks and blocks compounds + Standard_EXPORT Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape, + const Standard_Real theX, + const Standard_Real theY, + const Standard_Real theZ, + const Standard_Real theEpsilon); + + Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock, + Handle(GEOM_Object) thePoint); + + Standard_EXPORT Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2, + Handle(GEOM_Object) thePoint3, + Handle(GEOM_Object) thePoint4); + + Standard_EXPORT Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theEdge1, + Handle(GEOM_Object) theEdge2); + + Standard_EXPORT Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock, + Handle(GEOM_Object) theFace); + + Standard_EXPORT Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock, + Handle(GEOM_Object) thePoint); + + Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock, + Handle(GEOM_Object) theVector); + + // Check blocks compounds + Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object) theCompound, + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces, + Standard_Integer& theNbBlocks); + + enum BCErrorType { + NOT_BLOCK, + EXTRA_EDGE, + INVALID_CONNECTION, + NOT_CONNECTED, + NOT_GLUED + }; + + struct BCError { + BCErrorType error; + list incriminated; + }; + + Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound, + list& theErrors); + + Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound, + list& theErrors); + + Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound, + const list& theErrors); + + Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape); + + Standard_EXPORT Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound); + + Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape& theShape, + TopTools_ListOfShape& BLO, + TopTools_ListOfShape& NOT, + TopTools_ListOfShape& EXT); + + // Extract blocks from blocks compounds + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks + (Handle(GEOM_Object) theCompound, + const Standard_Integer theMinNbFaces, + const Standard_Integer theMaxNbFaces); + + Standard_EXPORT Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound, + Handle(GEOM_Object) thePoint); + + Standard_EXPORT Handle(GEOM_Object) GetBlockByParts + (Handle(GEOM_Object) theCompound, + const Handle(TColStd_HSequenceOfTransient)& theParts); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetBlocksByParts + (Handle(GEOM_Object) theCompound, + const Handle(TColStd_HSequenceOfTransient)& theParts); + + // Operations on blocks with gluing of result + Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object) theBlock, + const Standard_Integer theDirFace1, + const Standard_Integer theDirFace2, + const Standard_Integer theNbTimes); + + Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object) theBlock, + const Standard_Integer theDirFace1U, + const Standard_Integer theDirFace2U, + const Standard_Integer theNbTimesU, + const Standard_Integer theDirFace1V, + const Standard_Integer theDirFace2V, + const Standard_Integer theNbTimesV); + + // Build groups for Propagation of 1D hypotheses + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IBoolean.hxx b/src/GEOMImpl/GEOMImpl_IBoolean.hxx new file mode 100644 index 000000000..62cb8ddb7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBoolean.hxx @@ -0,0 +1,43 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Common, Cut and Fuse creation. + + +#include "GEOM_Function.hxx" + +#define BOOL_ARG_SHAPE1 1 +#define BOOL_ARG_SHAPE2 2 + +class GEOMImpl_IBoolean +{ + public: + + GEOMImpl_IBoolean(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape1(Handle(GEOM_Function) theRef) { _func->SetReference(BOOL_ARG_SHAPE1, theRef); } + void SetShape2(Handle(GEOM_Function) theRef) { _func->SetReference(BOOL_ARG_SHAPE2, theRef); } + + Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); } + Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx new file mode 100644 index 000000000..65037c7d4 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -0,0 +1,349 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include "utilities.h" + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IBooleanOperations::GEOMImpl_IBooleanOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IBooleanOperations::~GEOMImpl_IBooleanOperations() +{ + MESSAGE("GEOMImpl_IBooleanOperations::~GEOMImpl_IBooleanOperations"); +} + + +//============================================================================= +/*! + * MakeBoolean + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + Standard_Integer theOp) +{ + SetErrorCode(KO); + + if (theShape1.IsNull() || theShape2.IsNull()) return NULL; + + //Add a new Boolean object + Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN); + + //Add a new Boolean function + Handle(GEOM_Function) aFunction; + if (theOp == 1) { + aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_COMMON); + } else if (theOp == 2) { + aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_CUT); + } else if (theOp == 3) { + aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE); + } else if (theOp == 4) { + aFunction = aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_SECTION); + } else { + } + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL; + + GEOMImpl_IBoolean aCI (aFunction); + + Handle(GEOM_Function) aRef1 = theShape1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theShape2->GetLastFunction(); + + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aCI.SetShape1(aRef1); + aCI.SetShape2(aRef2); + + //Compute the Boolean value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Boolean driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aBool; + if (theOp == 1) pd << " = geompy.MakeCommon("; + else if (theOp == 2) pd << " = geompy.MakeCut("; + else if (theOp == 3) pd << " = geompy.MakeFuse("; + else if (theOp == 4) pd << " = geompy.MakeSection("; + else {} + pd << theShape1 << ", " << theShape2 << ")"; + + SetErrorCode(OK); + return aBool; +} + +//============================================================================= +/*! + * MakePartition + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition + (const Handle(TColStd_HSequenceOfTransient)& theShapes, + const Handle(TColStd_HSequenceOfTransient)& theTools, + const Handle(TColStd_HSequenceOfTransient)& theKeepIns, + const Handle(TColStd_HSequenceOfTransient)& theRemoveIns, + const Standard_Integer theLimit, + const Standard_Boolean theRemoveWebs, + const Handle(TColStd_HArray1OfInteger)& theMaterials) +{ + SetErrorCode(KO); + + //Add a new Partition object + Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION); + + //Add a new Partition function + Handle(GEOM_Function) aFunction = + aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_PARTITION); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PartitionDriver::GetID()) return NULL; + + GEOMImpl_IPartition aCI (aFunction); + +// int aLen = theShapes.size(); +// aCI.SetLength(aLen); + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aToolsSeq = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aKeepInsSeq = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aRemInsSeq = new TColStd_HSequenceOfTransient; + + Standard_Integer ind, aLen; + TCollection_AsciiString anEntry; + TCollection_AsciiString aShapesDescr, aToolsDescr, aKeepInsDescr, aRemoveInsDescr; + + // Shapes + aLen = theShapes->Length(); + for (ind = 1; ind <= aLen; ind++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theShapes->Value(ind)); + Handle(GEOM_Function) aRefSh = anObj->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL shape for Partition"); + return NULL; + } + aShapesSeq->Append(aRefSh); + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if (ind > 1) aShapesDescr += ", "; + aShapesDescr += anEntry; + } + aCI.SetShapes(aShapesSeq); + + // Tools + aLen = theTools->Length(); + for (ind = 1; ind <= aLen; ind++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theTools->Value(ind)); + Handle(GEOM_Function) aRefSh = anObj->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL tool shape for Partition"); + return NULL; + } + aToolsSeq->Append(aRefSh); + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if (ind > 1) aToolsDescr += ", "; + aToolsDescr += anEntry; + } + aCI.SetTools(aToolsSeq); + + // Keep Inside + aLen = theKeepIns->Length(); + for (ind = 1; ind <= aLen; ind++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theKeepIns->Value(ind)); + Handle(GEOM_Function) aRefSh = anObj->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL shape for Partition"); + return NULL; + } + aKeepInsSeq->Append(aRefSh); + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if (ind > 1) aKeepInsDescr += ", "; + aKeepInsDescr += anEntry; + } + aCI.SetKeepIns(aKeepInsSeq); + + // Remove Inside + aLen = theRemoveIns->Length(); + for (ind = 1; ind <= aLen; ind++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theRemoveIns->Value(ind)); + Handle(GEOM_Function) aRefSh = anObj->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL shape for Partition"); + return NULL; + } + aRemInsSeq->Append(aRefSh); + + // For Python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if (ind > 1) aRemoveInsDescr += ", "; + aRemoveInsDescr += anEntry; + } + aCI.SetRemoveIns(aRemInsSeq); + + // Limit + aCI.SetLimit(theLimit); + + // Materials + if (theRemoveWebs) { + if (theMaterials.IsNull()) { + Handle(TColStd_HArray1OfInteger) aMaterials = + new TColStd_HArray1OfInteger (1, aShapesSeq->Length()); + aCI.SetMaterials(aMaterials); + } else { + aCI.SetMaterials(theMaterials); + } + } + + //Compute the Partition + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Partition driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aPartition << " = geompy.MakePartition(["; + // Shapes, Tools + pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], ["; + // Keep Ins, Remove Ins + pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], "; + // Limit, Remove Webs + pd << theLimit << ", " << (int)theRemoveWebs << ", ["; + // Materials + if (theMaterials->Length() > 0) { + int i = theMaterials->Lower(); + pd << theMaterials->Value(i); + i++; + for (; i <= theMaterials->Upper(); i++) { + pd << ", " << theMaterials->Value(i); + } + } + pd << "])"; + + SetErrorCode(OK); + return aPartition; +} + +//============================================================================= +/*! + * MakeHalfPartition + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition + (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || thePlane.IsNull()) return NULL; + + //Add a new Boolean object + Handle(GEOM_Object) aPart = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN); + + //Add a new Partition function + Handle(GEOM_Function) aFunction = + aPart->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_HALF); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PartitionDriver::GetID()) return NULL; + + GEOMImpl_IPartition aCI (aFunction); + + Handle(GEOM_Function) aRef1 = theShape->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePlane->GetLastFunction(); + + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aCI.SetShape(aRef1); + aCI.SetPlane(aRef2); + + //Compute the Partition value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Partition driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPart << " = geompy.MakeHalfPartition(" + << theShape << ", " << thePlane << ")"; + + SetErrorCode(OK); + return aPart; +} diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx new file mode 100644 index 000000000..c0d264b45 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IBooleanOperations_HXX_ +#define _GEOMImpl_IBooleanOperations_HXX_ + +#include "GEOM_IOperations.hxx" + +//#include "TColStd_HSequenceOfTransient.hxx" + +#include "list" + +class GEOM_Engine; +class Handle(GEOM_Object); +class Handle(TColStd_HArray1OfInteger); + +class GEOMImpl_IBooleanOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IBooleanOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IBooleanOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakeBoolean (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + Standard_Integer theOp); + + Standard_EXPORT Handle(GEOM_Object) MakePartition (const Handle(TColStd_HSequenceOfTransient)& theShapes, + const Handle(TColStd_HSequenceOfTransient)& theTools, + const Handle(TColStd_HSequenceOfTransient)& theKeepInside, + const Handle(TColStd_HSequenceOfTransient)& theRemoveInside, + const Standard_Integer theLimit, + const Standard_Boolean theRemoveWebs, + const Handle(TColStd_HArray1OfInteger)& theMaterials); + + Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) thePlane); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IBox.hxx b/src/GEOMImpl/GEOMImpl_IBox.hxx new file mode 100644 index 000000000..2cffca44b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IBox.hxx @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Box creation. + + +#include "GEOM_Function.hxx" + +#define BOX_ARG_DX 1 +#define BOX_ARG_DY 2 +#define BOX_ARG_DZ 3 +#define BOX_ARG_REF1 4 +#define BOX_ARG_REF2 5 + +class GEOMImpl_IBox +{ + public: + + GEOMImpl_IBox(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetDX(double theX) { _func->SetReal(BOX_ARG_DX, theX); } + + double GetDX() { return _func->GetReal(BOX_ARG_DX); } + + void SetDY(double theY) { _func->SetReal(BOX_ARG_DY, theY); } + + double GetDY() { return _func->GetReal(BOX_ARG_DY); } + + void SetDZ(double theZ) { _func->SetReal(BOX_ARG_DZ, theZ); } + + double GetDZ() { return _func->GetReal(BOX_ARG_DZ); } + + void SetRef1(Handle(GEOM_Function) theRefPoint1) { _func->SetReference(BOX_ARG_REF1, theRefPoint1); } + + Handle(GEOM_Function) GetRef1() { return _func->GetReference(BOX_ARG_REF1); } + + void SetRef2(Handle(GEOM_Function) theRefPoint2) { _func->SetReference(BOX_ARG_REF2, theRefPoint2); } + + Handle(GEOM_Function) GetRef2() { return _func->GetReference(BOX_ARG_REF2); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IChamfer.hxx b/src/GEOMImpl/GEOMImpl_IChamfer.hxx new file mode 100644 index 000000000..13c62df6f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IChamfer.hxx @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an interface to a function for the Chamfer and creation. + + +#include "GEOM_Function.hxx" + +#define CHAM_ARG_SH 1 +#define CHAM_ARG_D1 2 +#define CHAM_ARG_D2 3 +#define CHAM_ARG_LENG 4 +#define CHAM_ARG_LAST 4 + +class GEOMImpl_IChamfer +{ + public: + + GEOMImpl_IChamfer(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theRef) { _func->SetReference(CHAM_ARG_SH, theRef); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(CHAM_ARG_SH); } + + void SetD (double theD) { _func->SetReal(CHAM_ARG_D1, theD); } + void SetD1(double theD) { _func->SetReal(CHAM_ARG_D1, theD); } + void SetD2(double theD) { _func->SetReal(CHAM_ARG_D2, theD); } + + double GetD () { return _func->GetReal(CHAM_ARG_D1); } + double GetD1() { return _func->GetReal(CHAM_ARG_D1); } + double GetD2() { return _func->GetReal(CHAM_ARG_D2); } + + void SetLength(int theLen) { _func->SetInteger(CHAM_ARG_LENG, theLen); } + + int GetLength() { return _func->GetInteger(CHAM_ARG_LENG); } + + void SetFace(int theInd, int theFace) + { _func->SetInteger(CHAM_ARG_LAST + theInd, theFace); } + void SetFace1(int theFace) + { _func->SetInteger(CHAM_ARG_LAST + 1, theFace); } + void SetFace2(int theFace) + { _func->SetInteger(CHAM_ARG_LAST + 2, theFace); } + + int GetFace(int theInd) { return _func->GetInteger(CHAM_ARG_LAST + theInd); } + int GetFace1() { return _func->GetInteger(CHAM_ARG_LAST + 1); } + int GetFace2() { return _func->GetInteger(CHAM_ARG_LAST + 2); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ICircle.hxx b/src/GEOMImpl/GEOMImpl_ICircle.hxx new file mode 100644 index 000000000..892f534fb --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICircle.hxx @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Circle creation. + + +#include "GEOM_Function.hxx" + +#define CIRC_ARG_P1 1 +#define CIRC_ARG_P2 2 +#define CIRC_ARG_P3 3 + +#define CIRC_ARG_CC 4 +#define CIRC_ARG_VV 5 +#define CIRC_ARG_RR 6 + +class GEOMImpl_ICircle +{ + public: + + GEOMImpl_ICircle(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetPoint1(Handle(GEOM_Function) theP) { _func->SetReference(CIRC_ARG_P1, theP); } + void SetPoint2(Handle(GEOM_Function) theP) { _func->SetReference(CIRC_ARG_P2, theP); } + void SetPoint3(Handle(GEOM_Function) theP) { _func->SetReference(CIRC_ARG_P3, theP); } + + void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(CIRC_ARG_CC, theP); } + void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(CIRC_ARG_VV, theV); } + + void SetRadius(double theR) { _func->SetReal(CIRC_ARG_RR, theR); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(CIRC_ARG_P1); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(CIRC_ARG_P2); } + Handle(GEOM_Function) GetPoint3() { return _func->GetReference(CIRC_ARG_P3); } + + Handle(GEOM_Function) GetCenter() { return _func->GetReference(CIRC_ARG_CC); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(CIRC_ARG_VV); } + + double GetRadius() { return _func->GetReal(CIRC_ARG_RR); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ICone.hxx b/src/GEOMImpl/GEOMImpl_ICone.hxx new file mode 100644 index 000000000..2ed1c1cdc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICone.hxx @@ -0,0 +1,60 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Cone creation. + + +#include "GEOM_Function.hxx" + +#define CONE_ARG_R1 1 +#define CONE_ARG_R2 2 +#define CONE_ARG_H 3 +#define CONE_ARG_PNT 4 +#define CONE_ARG_VEC 5 + +class GEOMImpl_ICone +{ + public: + + GEOMImpl_ICone(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR1(double theR) { _func->SetReal(CONE_ARG_R1, theR); } + + double GetR1() { return _func->GetReal(CONE_ARG_R1); } + + void SetR2(double theR) { _func->SetReal(CONE_ARG_R2, theR); } + + double GetR2() { return _func->GetReal(CONE_ARG_R2); } + + void SetH(double theH) { _func->SetReal(CONE_ARG_H, theH); } + + double GetH() { return _func->GetReal(CONE_ARG_H); } + + void SetPoint(Handle(GEOM_Function) theRefPoint) { _func->SetReference(CONE_ARG_PNT, theRefPoint); } + + Handle(GEOM_Function) GetPoint() { return _func->GetReference(CONE_ARG_PNT); } + + void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(CONE_ARG_VEC, theRefVector); } + + Handle(GEOM_Function) GetVector() { return _func->GetReference(CONE_ARG_VEC); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ICopy.hxx b/src/GEOMImpl/GEOMImpl_ICopy.hxx new file mode 100644 index 000000000..7f63bdf27 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICopy.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Copy operation. + + +#include "GEOM_Function.hxx" + +#define COPY_ARG_REF 1 + +class GEOMImpl_ICopy +{ + public: + + GEOMImpl_ICopy(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(COPY_ARG_REF, theOriginal); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(COPY_ARG_REF); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx new file mode 100644 index 000000000..e6162262b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -0,0 +1,600 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_ICurvesOperations::GEOMImpl_ICurvesOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations() +{ + MESSAGE("GEOMImpl_ICurvesOperations::~GEOMImpl_ICurvesOperations"); +} + + +//============================================================================= +/*! + * MakePolyline + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (list thePoints) +{ + SetErrorCode(KO); + + //Add a new Polyline object + Handle(GEOM_Object) aPolyline = GetEngine()->AddObject(GetDocID(), GEOM_POLYLINE); + + //Add a new Polyline function for creation a polyline relatively to points set + Handle(GEOM_Function) aFunction = + aPolyline->AddFunction(GEOMImpl_PolylineDriver::GetID(), POLYLINE_POINTS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PolylineDriver::GetID()) return NULL; + + GEOMImpl_IPolyline aCI (aFunction); + + int aLen = thePoints.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++, ind++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + if (aRefPnt.IsNull()) { + SetErrorCode("NULL point for Polyline"); + return NULL; + } + aCI.SetPoint(ind, aRefPnt); + } + + //Compute the Polyline value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Polyline driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aPolyline << " = geompy.MakePolyline(["; + + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aPolyline; +} + +//============================================================================= +/*! + * MakeCircleThreePnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Circle object + Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE); + + //Add a new Circle function for creation a circle relatively to three points + Handle(GEOM_Function) aFunction = + aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL; + + GEOMImpl_ICircle aCI (aFunction); + + Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); + + if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; + + aCI.SetPoint1(aRefPnt1); + aCI.SetPoint2(aRefPnt2); + aCI.SetPoint3(aRefPnt3); + + //Compute the Circle value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Circle driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; + + SetErrorCode(OK); + return aCircle; +} + +//============================================================================= +/*! + * MakeCirclePntVecR + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Circle object + Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE); + + //Add a new Circle function for creation a circle relatively to point and vector + Handle(GEOM_Function) aFunction = + aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_PNT_VEC_R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL; + + GEOMImpl_ICircle aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetCenter(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetRadius(theR); + + //Compute the Circle value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Circle driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle(" + << thePnt << ", " << theVec << ", " << theR << ")"; + + SetErrorCode(OK); + return aCircle; +} + +//============================================================================= +/*! + * MakeEllipse + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse + (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, + double theRMajor, double theRMinor) +{ + SetErrorCode(KO); + + if (thePnt.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Ellipse object + Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE); + + //Add a new Ellipse function + Handle(GEOM_Function) aFunction = + anEll->AddFunction(GEOMImpl_EllipseDriver::GetID(), ELLIPSE_PNT_VEC_RR); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_EllipseDriver::GetID()) return NULL; + + GEOMImpl_IEllipse aCI (aFunction); + + Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetCenter(aRefPnt); + aCI.SetVector(aRefVec); + aCI.SetRMajor(theRMajor); + aCI.SetRMinor(theRMinor); + + //Compute the Ellipse value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Ellipse driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + + SetErrorCode(OK); + return anEll; +} + +//============================================================================= +/*! + * MakeArc + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Circle Arc object + Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_CIRC_ARC); + + //Add a new Circle Arc function + Handle(GEOM_Function) aFunction = + anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), CIRC_ARC_THREE_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL; + + GEOMImpl_IArc aCI (aFunction); + + Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); + + if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; + + aCI.SetPoint1(aRefPnt1); + aCI.SetPoint2(aRefPnt2); + aCI.SetPoint3(aRefPnt3); + + //Compute the Arc value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Arc driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; + + SetErrorCode(OK); + return anArc; +} + +//============================================================================= +/*! + * MakeSplineBezier + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier + (list thePoints) +{ + SetErrorCode(KO); + + //Add a new Spline object + Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); + + //Add a new Spline function for creation a bezier curve relatively to points set + Handle(GEOM_Function) aFunction = + aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_BEZIER); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL; + + GEOMImpl_ISpline aCI (aFunction); + + int aLen = thePoints.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++, ind++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + + if (aRefPnt.IsNull()) return NULL; + + aCI.SetPoint(ind, aRefPnt); + } + + //Compute the Spline value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Spline driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aSpline << " = geompy.MakeBezier(["; + + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aSpline; +} + +//============================================================================= +/*! + * MakeSplineInterpolation + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation + (list thePoints) +{ + SetErrorCode(KO); + + //Add a new Spline object + Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE); + + //Add a new Spline function for creation a bezier curve relatively to points set + Handle(GEOM_Function) aFunction = + aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL; + + GEOMImpl_ISpline aCI (aFunction); + + int aLen = thePoints.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = thePoints.begin(); + for (; it != thePoints.end(); it++, ind++) { + Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction(); + + if (aRefPnt.IsNull()) return NULL; + + aCI.SetPoint(ind, aRefPnt); + } + + //Compute the Spline value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Spline driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aSpline << " = geompy.MakeInterpol(["; + + it = thePoints.begin(); + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aSpline; +} + +//============================================================================= +/*! + * MakeSketcher + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher + (const TCollection_AsciiString& theCommand, + list theWorkingPlane) +{ + SetErrorCode(KO); + + if (theCommand.IsEmpty()) return NULL; + + //Add a new Sketcher object + Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER); + + //Add a new Sketcher function + Handle(GEOM_Function) aFunction = + aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_NINE_DOUBLS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL; + + GEOMImpl_ISketcher aCI (aFunction); + + aCI.SetCommand(theCommand); + + int ind = 1; + list::iterator it = theWorkingPlane.begin(); + for (; it != theWorkingPlane.end(); it++, ind++) + aCI.SetWorkingPlane(ind, *it); + + //Compute the Sketcher value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Sketcher driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand.ToCString() << "\", ["; + + it = theWorkingPlane.begin(); + pd << (*it++); + while (it != theWorkingPlane.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aSketcher; +} + +//============================================================================= +/*! + * MakeSketcherOnPlane + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane + (const TCollection_AsciiString& theCommand, + Handle(GEOM_Object) theWorkingPlane) +{ + SetErrorCode(KO); + + if (theCommand.IsEmpty()) return NULL; + + //Add a new Sketcher object + Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER); + + //Add a new Sketcher function + Handle(GEOM_Function) aFunction = + aSketcher->AddFunction(GEOMImpl_SketcherDriver::GetID(), SKETCHER_PLANE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL; + + GEOMImpl_ISketcher aCI (aFunction); + aCI.SetCommand(theCommand); + + Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction(); + if (aRefPlane.IsNull()) return NULL; + aCI.SetWorkingPlane( aRefPlane ); + + //Compute the Sketcher value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Sketcher driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\"" + << theCommand.ToCString() << "\", " << theWorkingPlane << " )"; + + SetErrorCode(OK); + return aSketcher; +} diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx new file mode 100644 index 000000000..9673f68cc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -0,0 +1,64 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +using namespace std; + +#ifndef _GEOMImpl_ICurvesOperations_HXX_ +#define _GEOMImpl_ICurvesOperations_HXX_ + +#include "GEOM_IOperations.hxx" + +#include + +#include + +class GEOM_Engine; +class Handle(GEOM_Object); + +class GEOMImpl_ICurvesOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_ICurvesOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_ICurvesOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakePolyline (list thePoints); + + Standard_EXPORT Handle(GEOM_Object) MakeCircleThreePnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); + Standard_EXPORT Handle(GEOM_Object) MakeCirclePntVecR (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, double theR); + + Standard_EXPORT Handle(GEOM_Object) MakeEllipse (Handle(GEOM_Object) thePnt, + Handle(GEOM_Object) theVec, + double theRMajor, double theRMinor); + + Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); + + Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list thePoints); + Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list thePoints); + + Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const TCollection_AsciiString& theCommand, + list theWorkingPlane); + Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const TCollection_AsciiString& theCommand, + Handle(GEOM_Object) theWorkingPlane); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ICylinder.hxx b/src/GEOMImpl/GEOMImpl_ICylinder.hxx new file mode 100644 index 000000000..91c3f0540 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ICylinder.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Cylinder creation. + + +#include "GEOM_Function.hxx" + +#define CYL_ARG_R 1 +#define CYL_ARG_H 2 +#define CYL_ARG_PNT 3 +#define CYL_ARG_VEC 4 + +class GEOMImpl_ICylinder +{ + public: + + GEOMImpl_ICylinder(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR(double theR) { _func->SetReal(CYL_ARG_R, theR); } + + double GetR() { return _func->GetReal(CYL_ARG_R); } + + void SetH(double theH) { _func->SetReal(CYL_ARG_H, theH); } + + double GetH() { return _func->GetReal(CYL_ARG_H); } + + void SetPoint(Handle(GEOM_Function) theRefPoint) { _func->SetReference(CYL_ARG_PNT, theRefPoint); } + + Handle(GEOM_Function) GetPoint() { return _func->GetReference(CYL_ARG_PNT); } + + void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(CYL_ARG_VEC, theRefVector); } + + Handle(GEOM_Function) GetVector() { return _func->GetReference(CYL_ARG_VEC); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IEllipse.hxx b/src/GEOMImpl/GEOMImpl_IEllipse.hxx new file mode 100644 index 000000000..1c6060ed7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IEllipse.hxx @@ -0,0 +1,51 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Ellipse creation. + + +#include "GEOM_Function.hxx" + +#define ELLIPS_ARG_CC 1 +#define ELLIPS_ARG_VV 2 +#define ELLIPS_ARG_RMAJ 3 +#define ELLIPS_ARG_RMIN 4 + +class GEOMImpl_IEllipse +{ + public: + + GEOMImpl_IEllipse(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(ELLIPS_ARG_CC, theP); } + void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(ELLIPS_ARG_VV, theV); } + + void SetRMajor(double theR) { _func->SetReal(ELLIPS_ARG_RMAJ, theR); } + void SetRMinor(double theR) { _func->SetReal(ELLIPS_ARG_RMIN, theR); } + + Handle(GEOM_Function) GetCenter() { return _func->GetReference(ELLIPS_ARG_CC); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(ELLIPS_ARG_VV); } + + double GetRMajor() { return _func->GetReal(ELLIPS_ARG_RMAJ); } + double GetRMinor() { return _func->GetReal(ELLIPS_ARG_RMIN); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IFillet.hxx b/src/GEOMImpl/GEOMImpl_IFillet.hxx new file mode 100644 index 000000000..2bd5df2d3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IFillet.hxx @@ -0,0 +1,59 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an interface to a function for the Fillet and creation. + + +#include "GEOM_Function.hxx" + +#define FILLET_ARG_SH 1 +#define FILLET_ARG_R 2 +#define FILLET_ARG_LENG 3 +#define FILLET_ARG_LAST 3 + +class GEOMImpl_IFillet +{ + public: + + GEOMImpl_IFillet(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theRef) { _func->SetReference(FILLET_ARG_SH, theRef); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET_ARG_SH); } + + void SetR(double theR) { _func->SetReal(FILLET_ARG_R, theR); } + + double GetR() { return _func->GetReal(FILLET_ARG_R); } + + void SetLength(int theLen) { _func->SetInteger(FILLET_ARG_LENG, theLen); } + + int GetLength() { return _func->GetInteger(FILLET_ARG_LENG); } + + void SetEdge(int theInd, int theEdge) + { _func->SetInteger(FILLET_ARG_LAST + theInd, theEdge); } + void SetFace(int theInd, int theFace) + { _func->SetInteger(FILLET_ARG_LAST + theInd, theFace); } + + int GetEdge(int theInd) { return _func->GetInteger(FILLET_ARG_LAST + theInd); } + int GetFace(int theInd) { return _func->GetInteger(FILLET_ARG_LAST + theInd); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IFilling.hxx b/src/GEOMImpl/GEOMImpl_IFilling.hxx new file mode 100644 index 000000000..0da183deb --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IFilling.hxx @@ -0,0 +1,56 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Filling operation. + + +#include "GEOM_Function.hxx" + +#define FILL_ARG_MINDEG 1 +#define FILL_ARG_MAXDEG 2 +#define FILL_ARG_TOL2D 3 +#define FILL_ARG_TOL3D 4 +#define FILL_ARG_SHAPE 5 +#define FILL_ARG_NBITER 6 + +class GEOMImpl_IFilling +{ + public: + + GEOMImpl_IFilling(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetTol2D(double theTol2D) { _func->SetReal(FILL_ARG_TOL2D, theTol2D); } + void SetTol3D(double theTol3D) { _func->SetReal(FILL_ARG_TOL3D, theTol3D); } + double GetTol2D() { return _func->GetReal(FILL_ARG_TOL2D); } + double GetTol3D() { return _func->GetReal(FILL_ARG_TOL3D); } + + void SetMinDeg(int theMinDeg) { _func->SetInteger(FILL_ARG_MINDEG, theMinDeg); } + void SetMaxDeg(int theMaxDeg) { _func->SetInteger(FILL_ARG_MAXDEG, theMaxDeg); } + int GetMinDeg() { return _func->GetInteger(FILL_ARG_MINDEG); } + int GetMaxDeg() { return _func->GetInteger(FILL_ARG_MAXDEG); } + void SetNbIter(int theNbIter) { _func->SetInteger(FILL_ARG_NBITER, theNbIter); } + int GetNbIter() { return _func->GetInteger(FILL_ARG_NBITER); } + + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(FILL_ARG_SHAPE, theShape); } + Handle(GEOM_Function) GetShape() { return _func->GetReference(FILL_ARG_SHAPE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx new file mode 100644 index 000000000..9bd419bd0 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// NOTE: This is an interface to a function for the Glueing of faces + + +#include "GEOM_Function.hxx" + +#define GLUE_ARG_BASE 1 +#define GLUE_ARG_TOLER 2 + +class GEOMImpl_IGlue +{ + public: + + GEOMImpl_IGlue(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetBase(Handle(GEOM_Function) theRefBase) + { _func->SetReference(GLUE_ARG_BASE, theRefBase); } + + Handle(GEOM_Function) GetBase() { return _func->GetReference(GLUE_ARG_BASE); } + + void SetTolerance(const Standard_Real theTolerance) + { _func->SetReal(GLUE_ARG_TOLER, theTolerance); } + + Standard_Real GetTolerance() { return _func->GetReal(GLUE_ARG_TOLER); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx new file mode 100644 index 000000000..c74ded4a8 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -0,0 +1,728 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include + +#include +#include +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IGroupOperations::GEOMImpl_IGroupOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IGroupOperations::GEOMImpl_IGroupOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IGroupOperations::~GEOMImpl_IGroupOperations() +{ + MESSAGE("GEOMImpl_IGroupOperations::~GEOMImpl_IGroupOperations"); +} + + +//============================================================================= +/*! + * CreateGroup + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup + (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType) +{ + SetErrorCode(KO); + + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, -1); + + //Add a new Fillet object + Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theMainShape, anArray); + + //Set a GROUP type + aGroup->SetType(GEOM_GROUP); + + //Set a sub shape type + TDF_Label aFreeLabel = aGroup->GetFreeLabel(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType); + + //Make a Python command + Handle(GEOM_Function) aFunction = aGroup->GetFunction(1); + //TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup + GEOM::TPythonDump(aFunction) << aGroup + << " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")"; + + SetErrorCode(OK); + return aGroup; +} + +//============================================================================= +/*! + * AddObject + */ +//============================================================================= +void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theSubShapeID) +{ + SetErrorCode(KO); + if(theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if(aFunction.IsNull()) return; + + GEOM_ISubShape aSSI(aFunction); + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if(aSeq.IsNull()) return; + if(aSeq->Length() == 1 && aSeq->Value(1) == -1) { + aSeq->SetValue(1, theSubShapeID); + } + else { + Standard_Integer aLength = aSeq->Length(); + Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength+1); + for(Standard_Integer i = 1; i<=aLength; i++) { + aNewSeq->SetValue(i, aSeq->Value(i)); + if(aSeq->Value(i) == theSubShapeID) { + SetErrorCode(ALREADY_PRESENT); + return; // + } + } + aNewSeq->SetValue(aLength+1, theSubShapeID); + aSSI.SetIndices(aNewSeq); + } + + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")"; + + SetErrorCode(OK); + return; +} + +//============================================================================= +/*! + * RemoveObject + */ +//============================================================================= +void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int theSubShapeID) +{ + SetErrorCode(KO); + if(theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if(aFunction.IsNull()) return; + + GEOM_ISubShape aSSI(aFunction); + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if(aSeq.IsNull()) return; + if(aSeq->Length() == 1 && aSeq->Value(1) == -1) { + SetErrorCode(NOT_EXISTS); + return; + } + else { + Handle(TColStd_HArray1OfInteger) aNewSeq; + Standard_Integer aLength = aSeq->Length(); + if(aLength == 1) { + if(aSeq->Value(1) != theSubShapeID) { + SetErrorCode(NOT_EXISTS); + return; + } + aNewSeq = new TColStd_HArray1OfInteger(1,1); + aNewSeq->SetValue(1, -1); + } + else { + aNewSeq = new TColStd_HArray1OfInteger(1, aLength-1); + Standard_Boolean isFound = Standard_False; + for(Standard_Integer i = 1, k=1; i<=aLength; i++) { + if(i == aLength && !isFound) { + SetErrorCode(NOT_EXISTS); + return; + } + if(aSeq->Value(i) == theSubShapeID) { + isFound = Standard_True; + continue; + } + aNewSeq->SetValue(k, aSeq->Value(i)); + k++; + } + + if(!isFound) { + SetErrorCode(NOT_EXISTS); + return; + } + } + + aSSI.SetIndices(aNewSeq); + } + + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")"; + + SetErrorCode(OK); + return; +} + +//============================================================================= +/*! + * UnionList + */ +//============================================================================= +void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfTransient)& theSubShapes) +{ + SetErrorCode(KO); + if (theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if (aFunction.IsNull()) return; + + GEOM_ISubShape aSSI (aFunction); + + // New contents of the group + TColStd_ListOfInteger aNewIDs; + TColStd_MapOfInteger mapIDs; + + // Add current IDs to the list + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if (aSeq.IsNull()) return; + Standard_Integer val_j, aLength = aSeq->Length(); + + for (Standard_Integer j = 1; j <= aLength; j++) { + val_j = aSeq->Value(j); + if (val_j > 0 && mapIDs.Add(val_j)) { + aNewIDs.Append(val_j); + } + } + + // Get Main Shape + Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape(); + if (aMainShapeFunc.IsNull()) return; + TDF_Label aLabel = aMainShapeFunc->GetOwnerEntry(); + if (aLabel.IsRoot()) return; + Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel); + if (aMainObj.IsNull()) return; + TopoDS_Shape aMainShape = aMainObj->GetValue(); + if (aMainShape.IsNull()) return; + + TopTools_IndexedMapOfShape mapIndices; + TopExp::MapShapes(aMainShape, mapIndices); + + // Get IDs of sub-shapes to add + Standard_Integer i, new_id, aLen = theSubShapes->Length(); + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + + if (anObj_i->IsMainShape()) { + TopoDS_Shape aShape_i = anObj_i->GetValue(); + if (mapIndices.Contains(aShape_i)) { + new_id = mapIndices.FindIndex(aShape_i); + if (mapIDs.Add(new_id)) { + aNewIDs.Append(new_id); + } + } else { + SetErrorCode("One of given objects can not be added to the group, because it is not a sub-shape of the group's main shape"); + return; + } + } else { + // Check main shape of sub-shape to add + Handle(GEOM_Function) aFunc_i = anObj_i->GetFunction(1); + if (aFunc_i.IsNull()) return; + + GEOM_ISubShape aSSI_i (aFunc_i); + + Handle(GEOM_Function) aMainShapeFunc_i = aSSI_i.GetMainShape(); + if (aMainShapeFunc_i.IsNull()) return; + TDF_Label aLabel_i = aMainShapeFunc_i->GetOwnerEntry(); + if (aLabel_i.IsRoot()) return; + Handle(GEOM_Object) aMainObj_i = GEOM_Object::GetObject(aLabel); + if (aMainObj_i.IsNull()) return; + TopoDS_Shape aMainShape_i = aMainObj_i->GetValue(); + if (aMainShape_i.IsNull()) return; + + if (aMainShape_i.IsSame(aMainShape)) { + // add all sub-shape IDs to the list + + // Get IDs + Handle(TColStd_HArray1OfInteger) aSeq_i = aSSI_i.GetIndices(); + if (aSeq_i.IsNull()) return; + Standard_Integer aLength_i = aSeq_i->Length(); + + for (Standard_Integer i_j = 1; i_j <= aLength_i; i_j++) { + new_id = aSeq_i->Value(i_j); + if (new_id > 0) { + if (mapIDs.Add(new_id)) { + aNewIDs.Append(new_id); + } + } + } + + } else if (mapIndices.Contains(aMainShape_i)) { + // compute new IDs and add them to the list + TopTools_IndexedMapOfShape mapIndices_i; + TopExp::MapShapes(aMainShape_i, mapIndices_i); + + // Get IDs + Handle(TColStd_HArray1OfInteger) aSeq_i = aSSI_i.GetIndices(); + if (aSeq_i.IsNull()) return; + Standard_Integer aLength_i = aSeq_i->Length(); + + for (Standard_Integer i_j = 1; i_j <= aLength_i; i_j++) { + if (aSeq_i->Value(i_j) > 0) { + TopoDS_Shape aShape_i_j = mapIndices_i.FindKey(i_j); + new_id = mapIndices.FindIndex(aShape_i_j); + if (mapIDs.Add(new_id)) { + aNewIDs.Append(new_id); + } + } + } + + } else { + SetErrorCode("One of given objects can not be added to the group, because it is not a sub-shape of the group's main shape"); + return; + } + } + } + + if (aNewIDs.Extent() > 0) { + Standard_Integer k = 1; + TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs); + Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aNewIDs.Extent()); + for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) { + aNewSeq->SetValue(k, aNewIDsIter.Value()); + } + + aSSI.SetIndices(aNewSeq); + } + + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", ["; + + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + pd << anObj_i << (( i < aLen ) ? ", " : "])"); + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * DifferenceList + */ +//============================================================================= +void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfTransient)& theSubShapes) +{ + SetErrorCode(KO); + if (theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if (aFunction.IsNull()) return; + + GEOM_ISubShape aSSI (aFunction); + + // Map of IDs to be removed + TColStd_MapOfInteger mapIDsToRemove; + + // Map of current IDs + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if (aSeq.IsNull()) return; + Standard_Integer aLength = aSeq->Length(); + + if (aLength == 1 && aSeq->Value(1) == -1) // empty group + return; + + TColStd_MapOfInteger mapIDsCurrent; + Standard_Integer j = 1; + for (; j <= aLength; j++) { + mapIDsCurrent.Add(aSeq->Value(j)); + } + + // Get Main Shape + Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape(); + if (aMainShapeFunc.IsNull()) return; + TDF_Label aLabel = aMainShapeFunc->GetOwnerEntry(); + if (aLabel.IsRoot()) return; + Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel); + if (aMainObj.IsNull()) return; + TopoDS_Shape aMainShape = aMainObj->GetValue(); + if (aMainShape.IsNull()) return; + + TopTools_IndexedMapOfShape mapIndices; + TopExp::MapShapes(aMainShape, mapIndices); + + // Get IDs of sub-shapes to be removed + Standard_Integer i, rem_id, aLen = theSubShapes->Length(); + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + + if (anObj_i->IsMainShape()) { + TopoDS_Shape aShape_i = anObj_i->GetValue(); + if (mapIndices.Contains(aShape_i)) { + rem_id = mapIndices.FindIndex(aShape_i); + if (mapIDsCurrent.Contains(rem_id)) { + mapIDsToRemove.Add(rem_id); + } + } else { + SetErrorCode("One of given objects can not be removed from the group, because it is not a sub-shape of the group's main shape"); + return; + } + } else { + // Check main shape of sub-shape to be removed + Handle(GEOM_Function) aFunc_i = anObj_i->GetFunction(1); + if (aFunc_i.IsNull()) return; + + GEOM_ISubShape aSSI_i (aFunc_i); + + Handle(GEOM_Function) aMainShapeFunc_i = aSSI_i.GetMainShape(); + if (aMainShapeFunc_i.IsNull()) return; + TDF_Label aLabel_i = aMainShapeFunc_i->GetOwnerEntry(); + if (aLabel_i.IsRoot()) return; + Handle(GEOM_Object) aMainObj_i = GEOM_Object::GetObject(aLabel); + if (aMainObj_i.IsNull()) return; + TopoDS_Shape aMainShape_i = aMainObj_i->GetValue(); + if (aMainShape_i.IsNull()) return; + + if (aMainShape_i.IsSame(aMainShape)) { + // remove all sub-shapes + + // Get IDs + Handle(TColStd_HArray1OfInteger) aSeq_i = aSSI_i.GetIndices(); + if (aSeq_i.IsNull()) return; + Standard_Integer aLength_i = aSeq_i->Length(); + + for (Standard_Integer i_j = 1; i_j <= aLength_i; i_j++) { + rem_id = aSeq_i->Value(i_j); + if (rem_id > 0) { + if (mapIDsCurrent.Contains(rem_id)) { + mapIDsToRemove.Add(rem_id); + } + } + } + + } else if (mapIndices.Contains(aMainShape_i)) { + // compute new IDs and add them to the map of ids to be removed + TopTools_IndexedMapOfShape mapIndices_i; + TopExp::MapShapes(aMainShape_i, mapIndices_i); + + // Get IDs + Handle(TColStd_HArray1OfInteger) aSeq_i = aSSI_i.GetIndices(); + if (aSeq_i.IsNull()) return; + Standard_Integer aLength_i = aSeq_i->Length(); + + for (Standard_Integer i_j = 1; i_j <= aLength_i; i_j++) { + if (aSeq_i->Value(i_j) > 0) { + TopoDS_Shape aShape_i_j = mapIndices_i.FindKey(i_j); + rem_id = mapIndices.FindIndex(aShape_i_j); + if (mapIDsCurrent.Contains(rem_id)) { + mapIDsToRemove.Add(rem_id); + } + } + } + + } else { + SetErrorCode("One of given objects can not be removed from the group, because it is not a sub-shape of the group's main shape"); + return; + } + } + } + + if (mapIDsToRemove.Extent() > 0) { + Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent(); + Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); + + for (j = 1; j <= aLength; j++) { + if (!mapIDsToRemove.Contains(aSeq->Value(j))) { + aNewSeq->SetValue(k, aSeq->Value(j)); + k++; + } + } + + aSSI.SetIndices(aNewSeq); + } + + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", ["; + + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + pd << anObj_i << (( i < aLen ) ? ", " : "])"); + } + + SetErrorCode(OK); +} +//============================================================================= +/*! + * UnionIDs + */ +//============================================================================= +void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfInteger)& theSubShapes) +{ + SetErrorCode(KO); + if (theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if (aFunction.IsNull()) return; + + GEOM_ISubShape aSSI (aFunction); + + // New contents of the group + TColStd_ListOfInteger aNewIDs; + TColStd_MapOfInteger mapIDs; + + // Add current IDs to the list + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if (aSeq.IsNull()) return; + Standard_Integer val_j, aLength = aSeq->Length(); + + for (Standard_Integer j = 1; j <= aLength; j++) { + val_j = aSeq->Value(j); + if (val_j > 0 && mapIDs.Add(val_j)) { + aNewIDs.Append(val_j); + } + } + + // Get Main Shape + Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape(); + if (aMainShapeFunc.IsNull()) return; + TDF_Label aLabel = aMainShapeFunc->GetOwnerEntry(); + if (aLabel.IsRoot()) return; + Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel); + if (aMainObj.IsNull()) return; + TopoDS_Shape aMainShape = aMainObj->GetValue(); + if (aMainShape.IsNull()) return; + + TopTools_IndexedMapOfShape mapIndices; + TopExp::MapShapes(aMainShape, mapIndices); + + // Get IDs of sub-shapes to add + Standard_Integer i, new_id, aLen = theSubShapes->Length(); + for (i = 1; i <= aLen; i++) { + new_id = theSubShapes->Value(i); + + if (0 < new_id && new_id <= mapIndices.Extent()) { + if (mapIDs.Add(new_id)) { + aNewIDs.Append(new_id); + } + } + } + + if (aNewIDs.Extent() > 0) { + Standard_Integer k = 1; + TColStd_ListIteratorOfListOfInteger aNewIDsIter (aNewIDs); + Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aNewIDs.Extent()); + for (; aNewIDsIter.More(); aNewIDsIter.Next(), k++) { + aNewSeq->SetValue(k, aNewIDsIter.Value()); + } + + aSSI.SetIndices(aNewSeq); + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * DifferenceIDs + */ +//============================================================================= +void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfInteger)& theSubShapes) +{ + SetErrorCode(KO); + if (theGroup.IsNull()) return; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if (aFunction.IsNull()) return; + + GEOM_ISubShape aSSI (aFunction); + + // Map of IDs to be removed + TColStd_MapOfInteger mapIDsToRemove; + + // Map of current IDs + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if (aSeq.IsNull()) return; + Standard_Integer aLength = aSeq->Length(); + + if (aLength == 1 && aSeq->Value(1) == -1) // empty group + return; + + TColStd_MapOfInteger mapIDsCurrent; + Standard_Integer j = 1; + for (; j <= aLength; j++) { + mapIDsCurrent.Add(aSeq->Value(j)); + } + + // Get Main Shape + Handle(GEOM_Function) aMainShapeFunc = aSSI.GetMainShape(); + if (aMainShapeFunc.IsNull()) return; + TDF_Label aLabel = aMainShapeFunc->GetOwnerEntry(); + if (aLabel.IsRoot()) return; + Handle(GEOM_Object) aMainObj = GEOM_Object::GetObject(aLabel); + if (aMainObj.IsNull()) return; + TopoDS_Shape aMainShape = aMainObj->GetValue(); + if (aMainShape.IsNull()) return; + + TopTools_IndexedMapOfShape mapIndices; + TopExp::MapShapes(aMainShape, mapIndices); + + // Get IDs of sub-shapes to be removed + Standard_Integer i, rem_id, aLen = theSubShapes->Length(); + for (i = 1; i <= aLen; i++) { + rem_id = theSubShapes->Value(i); + if (mapIDsCurrent.Contains(rem_id)) { + mapIDsToRemove.Add(rem_id); + } + } + + if (mapIDsToRemove.Extent() > 0) { + Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent(); + Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength); + + for (j = 1; j <= aLength; j++) { + if (!mapIDsToRemove.Contains(aSeq->Value(j))) { + aNewSeq->SetValue(k, aSeq->Value(j)); + k++; + } + } + + aSSI.SetIndices(aNewSeq); + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * GetType + */ +//============================================================================= +TopAbs_ShapeEnum GEOMImpl_IGroupOperations::GetType(Handle(GEOM_Object) theGroup) +{ + SetErrorCode(KO); + + TDF_Label aFreeLabel = theGroup->GetFreeLabel(); + Handle(TDataStd_Integer) anAttrib; + if(!aFreeLabel.FindAttribute(TDataStd_Integer::GetID(), anAttrib)) return TopAbs_SHAPE; + + SetErrorCode(OK); + return (TopAbs_ShapeEnum) anAttrib->Get(); +} + +//============================================================================= +/*! + * GetMainShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object) theGroup) +{ + SetErrorCode(KO); + + if(theGroup.IsNull()) return NULL; + + Handle(GEOM_Function) aGroupFunction = theGroup->GetFunction(1); + if (aGroupFunction.IsNull()) return NULL; + + GEOM_ISubShape aSSI (aGroupFunction); + Handle(GEOM_Function) aMainShapeFunction = aSSI.GetMainShape(); + if (aMainShapeFunction.IsNull()) return NULL; + + TDF_Label aLabel = aMainShapeFunction->GetOwnerEntry(); + Handle(GEOM_Object) aMainShape = GEOM_Object::GetObject(aLabel); + if (aMainShape.IsNull()) return NULL; + + //Make a Python command + TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription(); + + GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t" + << aMainShape << " = geompy.GetMainShape(" << theGroup << ")"; + + SetErrorCode(OK); + return aMainShape; +} + +//============================================================================= +/*! + * GetObjects + */ +//============================================================================= +Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GEOM_Object) theGroup) +{ + SetErrorCode(KO); + + if(theGroup.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); + if(aFunction.IsNull()) return NULL; + + GEOM_ISubShape aSSI(aFunction); + Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices(); + if(aSeq.IsNull()) return NULL; + + if(aSeq->Length() == 1 && aSeq->Value(1) == -1) { + SetErrorCode(OK); + return NULL; + } + + SetErrorCode(OK); + return aSeq; +} diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx new file mode 100644 index 000000000..48a1f2ebc --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.hxx @@ -0,0 +1,64 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IGroupOperations_HXX_ +#define _GEOMImpl_IGroupOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include +#include +#include +#include + +class GEOMImpl_IGroupOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IGroupOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IGroupOperations(); + + Standard_EXPORT Handle(GEOM_Object) CreateGroup(Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType); + + Standard_EXPORT void AddObject(Handle(GEOM_Object) theGroup, int theSubShapeID); + + Standard_EXPORT void RemoveObject(Handle(GEOM_Object) theGroup, int theSubShapeID); + + Standard_EXPORT void UnionList (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfTransient)& theSubShapes); + + Standard_EXPORT void DifferenceList (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfTransient)& theSubShapes); + + Standard_EXPORT void UnionIDs (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfInteger)& theSubShapes); + + Standard_EXPORT void DifferenceIDs (Handle(GEOM_Object) theGroup, + const Handle(TColStd_HSequenceOfInteger)& theSubShapes); + + Standard_EXPORT TopAbs_ShapeEnum GetType(Handle(GEOM_Object) theGroup); + + Standard_EXPORT Handle(GEOM_Object) GetMainShape(Handle(GEOM_Object) theGroup); + + Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetObjects(Handle(GEOM_Object) theGroup); + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IHealing.hxx b/src/GEOMImpl/GEOMImpl_IHealing.hxx new file mode 100755 index 000000000..81d69281a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IHealing.hxx @@ -0,0 +1,80 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Healing creation. + + +#include "GEOM_Function.hxx" + +#include +#include + +#define ARG_SHAPE_PROCESS_OPERATORS 1 +#define ARG_SHAPE_PROCESS_PARAMS 2 +#define ARG_SHAPE_PROCESS_VALUES 3 +#define ARG_ORIGINAL 4 +#define ARG_LIST_ARGUMENTS 5 +#define ARG_IS_COMMON_VERTEX 6 +#define ARG_TOLERANCE 7 +#define ARG_DEV_EDGE_VALUE 8 +#define ARG_IS_BY_PARAMETER 9 +#define ARG_SUBSHAPE_INDEX 10 + + +class GEOMImpl_IHealing +{ +public: + GEOMImpl_IHealing(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOperators( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_OPERATORS, arr); } + Handle(TColStd_HArray1OfExtendedString) GetOperators() { return _func->GetStringArray(ARG_SHAPE_PROCESS_OPERATORS); } + + void SetParameters( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_PARAMS, arr); } + Handle(TColStd_HArray1OfExtendedString) GetParameters() { return _func->GetStringArray(ARG_SHAPE_PROCESS_PARAMS); } + + void SetValues( const Handle(TColStd_HArray1OfExtendedString)& arr ) { if ( !arr.IsNull() ) _func->SetStringArray(ARG_SHAPE_PROCESS_VALUES, arr); } + Handle(TColStd_HArray1OfExtendedString) GetValues() { return _func->GetStringArray(ARG_SHAPE_PROCESS_VALUES); } + + void SetOriginal( Handle(GEOM_Function)& f ) { _func->SetReference(ARG_ORIGINAL, f); } + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ARG_ORIGINAL); } + + void SetFaces( const Handle(TColStd_HArray1OfInteger)& arr ) { if ( !arr.IsNull() ) _func->SetIntegerArray(ARG_LIST_ARGUMENTS, arr); } + Handle(TColStd_HArray1OfInteger) GetFaces() { return _func->GetIntegerArray(ARG_LIST_ARGUMENTS); } + + void SetWires( const Handle(TColStd_HArray1OfInteger)& arr ) { if ( !arr.IsNull() ) _func->SetIntegerArray(ARG_LIST_ARGUMENTS, arr); } + Handle(TColStd_HArray1OfInteger) GetWires() { return _func->GetIntegerArray(ARG_LIST_ARGUMENTS); } + + void SetIsCommonVertex( Standard_Boolean val ) { _func->SetInteger(ARG_IS_COMMON_VERTEX, val ? 1 : 0 ); } + Standard_Boolean GetIsCommonVertex() { return (_func->GetInteger(ARG_IS_COMMON_VERTEX) != 0 ); } + + void SetIsByParameter( Standard_Boolean val ) { _func->SetInteger(ARG_IS_BY_PARAMETER, val ? 1 : 0 ); } + Standard_Boolean GetIsByParameter() { return (_func->GetInteger(ARG_IS_BY_PARAMETER) != 0 ); } + + void SetTolerance( Standard_Real val ) { _func->SetReal(ARG_TOLERANCE, val); } + Standard_Real GetTolerance() { return _func->GetReal(ARG_TOLERANCE); } + + void SetDevideEdgeValue( Standard_Real val ) { _func->SetReal(ARG_DEV_EDGE_VALUE, val); } + Standard_Real GetDevideEdgeValue() { return _func->GetReal(ARG_DEV_EDGE_VALUE); } + + void SetIndex( Standard_Integer val ) { _func->SetInteger(ARG_SUBSHAPE_INDEX, val); } + Standard_Integer GetIndex() { return _func->GetInteger(ARG_SUBSHAPE_INDEX); } + +private: + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx new file mode 100644 index 000000000..3bd88274f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -0,0 +1,775 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +#include "utilities.h" +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations() +{ + MESSAGE("GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations"); +} + + +//============================================================================= +/*! + * ShapeProcess + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::ShapeProcess (Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfExtendedString)& theOperators, + const Handle(TColStd_HArray1OfExtendedString)& theParams, + const Handle(TColStd_HArray1OfExtendedString)& theValues) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + return NULL; + + if (theOperators.IsNull() || theOperators->Length() <= 0) { + SetErrorCode("No operators requested"); + return NULL; + } + + Standard_Integer nbParams = 0, nbValues = 0; + if (!theParams.IsNull()) { + nbParams = theParams->Length(); + } + if (!theValues.IsNull()) { + nbValues = theValues->Length(); + } + + if (nbParams != nbValues) { + SetErrorCode("Number of parameter values must be equal to the number of parameters"); + return NULL; + } + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SHAPE_PROCESS); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetOriginal(aLastFunction); + HI.SetOperators( theOperators ); + if (nbParams > 0) { + HI.SetParameters( theParams ); + HI.SetValues( theValues ); + } + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Shape Healing algorithm failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.ProcessShape(" << theObject << ", ["; + + // list of operators + int i = theOperators->Lower(), nb = theOperators->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theOperators->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "], ["; + // list of parameters + i = theParams->Lower(); nb = theParams->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theParams->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "], ["; + // list of values + i = theValues->Lower(); nb = theValues->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theValues->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "])"; + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * ShapeProcess + */ +//============================================================================= +void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list& theOperations, + list& theParams, + list& theValues) +{ + ShHealOper_ShapeProcess aHealer; + TColStd_SequenceOfAsciiString anOperators; + int nbOperatorErrors( 0 ); + if ( aHealer.GetOperators( anOperators ) ) + { + for ( Standard_Integer i = 1; i <= anOperators.Length(); i++ ) + { + string anOperation = anOperators.Value( i ).ToCString(); + if ( GetOperatorParameters( anOperation, theParams, theValues ) ) + theOperations.push_back( anOperation ); + else + nbOperatorErrors++; + } + } + else + { + SetErrorCode("ERROR retrieving operators (GEOMImpl_IHealingOperations)"); + } + + if ( nbOperatorErrors ) { + TCollection_AsciiString aMsg ("ERRORS retrieving ShapeProcess parameters (GEOMImpl_IHealingOperations): nbOperatorErrors = "); + aMsg += TCollection_AsciiString( nbOperatorErrors ); + MESSAGE(aMsg.ToCString()); + } +} + +//============================================================================= +/*! + * GetOperatorParameters + */ +//============================================================================= +bool GEOMImpl_IHealingOperations::GetOperatorParameters( const string theOperation, + list& theParams, + list& theValues ) +{ + ShHealOper_ShapeProcess aHealer; + int nbParamValueErrors( 0 ); + list aParams; + if ( GetParameters( theOperation, aParams ) ) { + for ( list::iterator it = aParams.begin(); it != aParams.end(); ++it ) { + TCollection_AsciiString aParam( (Standard_CString)(*it).c_str() ); + TCollection_AsciiString aValue; + if ( aHealer.GetParameter( aParam, aValue ) ) { + theParams.push_back( aParam.ToCString() ); + theValues.push_back( aValue.ToCString() ); + } + else + nbParamValueErrors++; + } + } + else + return false; + + if ( nbParamValueErrors ) { + TCollection_AsciiString aMsg ("ERRORS retrieving ShapeProcess parameter values (GEOMImpl_IHealingOperations): nbParamValueErrors = "); + aMsg += TCollection_AsciiString( nbParamValueErrors ); + MESSAGE(aMsg.ToCString()); + } + + return true; +} + +//============================================================================= +/*! + * GetParameters + */ +//============================================================================= +bool GEOMImpl_IHealingOperations::GetParameters (const string theOperation, + list& theParams) +{ + if ( theOperation == "SplitAngle" ) { + theParams.push_back( "SplitAngle.Angle" ); + theParams.push_back( "SplitAngle.MaxTolerance" ); + + } else if ( theOperation == "SplitClosedFaces" ) { + theParams.push_back( "SplitClosedFaces.NbSplitPoints" ); + + } else if ( theOperation == "FixFaceSize" ) { + theParams.push_back( "FixFaceSize.Tolerance" ); + + } else if( theOperation == "DropSmallEdges" ) { + theParams.push_back( "DropSmallEdges.Tolerance3d" ); + + } else if( theOperation == "BSplineRestriction" ) { + theParams.push_back( "BSplineRestriction.SurfaceMode" ); + theParams.push_back( "BSplineRestriction.Curve3dMode" ); + theParams.push_back( "BSplineRestriction.Curve2dMode" ); + theParams.push_back( "BSplineRestriction.Tolerance3d" ); + theParams.push_back( "BSplineRestriction.Tolerance2d" ); + theParams.push_back( "BSplineRestriction.RequiredDegree" ); + theParams.push_back( "BSplineRestriction.RequiredNbSegments" ); + theParams.push_back( "BSplineRestriction.Continuity3d" ); + theParams.push_back( "BSplineRestriction.Continuity2d" ); + + } else if( theOperation == "SplitContinuity" ) { + theParams.push_back( "SplitContinuity.Tolerance3d" ); + theParams.push_back( "SplitContinuity.SurfaceContinuity" ); + theParams.push_back( "SplitContinuity.CurveContinuity" ); + + } else if( theOperation == "ToBezier" ) { + theParams.push_back( "ToBezier.SurfaceMode" ); + theParams.push_back( "ToBezier.Curve3dMode" ); + theParams.push_back( "ToBezier.Curve2dMode" ); + theParams.push_back( "ToBezier.MaxTolerance" ); + + } else if( theOperation == "SameParameter" ) { + theParams.push_back( "SameParameter.Tolerance3d" ); + + } else if( theOperation == "FixShape" ) { + theParams.push_back( "FixShape.Tolerance3d" ); + theParams.push_back( "FixShape.MaxTolerance3d" ); + + } else { + return false; + } + + return true; +} + +//============================================================================= +/*! + * SuppressFaces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces + (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theFaces) +{ + // set error code, check parameters + SetErrorCode(KO); + + if ( theObject.IsNull() ) // if theFaces.IsNull() - it's OK, it means that ALL faces must be removed.. + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if(aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SUPPRESS_FACES); + + if(aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if(aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetFaces( theFaces ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressFaces(" << theObject << ", ["; + + // list of face ids + int i = theFaces->Lower(), nb = theFaces->Upper(); + for ( ; i <= nb; i++) + pd << theFaces->Value( i ) << (( i < nb ) ? ", " : "])"); + + SetErrorCode(OK); + return aNewObject; +} + + +//============================================================================= +/*! + * CloseContour + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour + (Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires, + bool isCommonVertex) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + { + SetErrorCode("NULL object given"); + return NULL; + } + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CLOSE_CONTOUR); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if(aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetWires( theWires ); + HI.SetIsCommonVertex( isCommonVertex ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.CloseContour(" << theObject << ", ["; + + // list of wire ids + if (!theWires.IsNull()) + { + int i = theWires->Lower(), nb = theWires->Upper(); + pd << theWires->Value(i++); + while (i <= nb) + pd << ", " << theWires->Value(i++); + } + pd << "], " << (int)isCommonVertex << ")"; + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * RemoveIntWires + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires + (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theWires) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) // if theWires is NULL it's OK, it means that ALL wires must be removed + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INT_WIRES); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetWires( theWires ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressInternalWires(" << theObject << ", ["; + + // list of wire ids + if (!theWires.IsNull()) { + int i = theWires->Lower(), nb = theWires->Upper(); + for ( ; i <= nb; i++) + pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])"); + } else { + pd << "])"; + } + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * FillHoles + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) // if theWires is NULL it's OK, it means that ALL holes must be removed + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), FILL_HOLES); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetWires( theWires ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressHoles(" << theObject << ", ["; + + // list of wire ids + if ( theWires.IsNull() ) + pd << "])"; + else { + int i = theWires->Lower(), nb = theWires->Upper(); + for ( ; i <= nb; i++) + pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])"); + } + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * Sew + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObject, + double theTolerance) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SEWING); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetTolerance( theTolerance ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.Sew(" + << theObject << ", " << theTolerance << ")"; + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * DivideEdge + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IHealingOperations::DivideEdge (Handle(GEOM_Object) theObject, + int theIndex, + double theValue, + bool isByParameter) +{ + // set error code, check parameters + SetErrorCode(KO); + + if (theObject.IsNull()) + return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed + + // Add a new object + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY ); + + //Add the function + aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), DIVIDE_EDGE); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL; + + // prepare "data container" class IHealing + GEOMImpl_IHealing HI(aFunction); + HI.SetIndex( theIndex ); + HI.SetDevideEdgeValue( theValue ); + HI.SetIsByParameter( isByParameter ); + HI.SetOriginal( aLastFunction ); + + //Compute the translation + try + { + if (!GetSolver()->ComputeFunction(aFunction)) + { + SetErrorCode("Healing driver failed"); + return NULL; + } + } + catch (Standard_Failure) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.DivideEdge(" << theObject + << ", " << theIndex << ", " << theValue << ", " << (int)isByParameter << ")"; + + SetErrorCode(OK); + return aNewObject; +} + +//============================================================================= +/*! + * GetFreeBoundary + */ +//============================================================================= +bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject, + Handle(TColStd_HSequenceOfTransient)& theClosed, + Handle(TColStd_HSequenceOfTransient)& theOpen ) +{ + // set error code, check parameters + SetErrorCode(KO); + + if ( theObject.IsNull() || theClosed.IsNull() || theOpen.IsNull() ) + return false; + + TopoDS_Shape aShape = theObject->GetValue(); + if ( aShape.IsNull() ) + return false; + + // get free boundary shapes + ShapeAnalysis_FreeBounds anAnalizer( aShape ); + TopoDS_Compound aClosed = anAnalizer.GetClosedWires(); + TopoDS_Compound anOpen = anAnalizer.GetOpenWires(); + + // iterate through shapes and append them to the return sequence + Handle(GEOM_Object) anObj; + Handle(GEOM_Function) aFunction; + TopExp_Explorer anExp; + for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() ) + { + anObj = GetEngine()->AddObject( GetDocID(), GEOM_FREE_BOUNDS ); + aFunction = anObj->AddFunction( GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF ); + TopoDS_Shape aValueShape = anExp.Current(); + aFunction->SetValue( aValueShape ); + theClosed->Append(anObj); + } + for ( anExp.Init( anOpen, TopAbs_WIRE ); anExp.More(); anExp.Next() ) + { + anObj = GetEngine()->AddObject( GetDocID(), GEOM_FREE_BOUNDS ); + aFunction = anObj->AddFunction( GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF ); + TopoDS_Shape aValueShape = anExp.Current(); + aFunction->SetValue( aValueShape ); + theOpen->Append(anObj); + } + + if(!aFunction.IsNull()) { + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + + Standard_Integer i, aLen = theClosed->Length(); + if (aLen > 0) { + pd << "(isDone, ["; + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theClosed->Value(i)); + pd << anObj_i << ((i < aLen) ? ", " : ""); + } + pd << "], "; + } else { + pd << "(isDone, empty_list, "; + } + + aLen = theOpen->Length(); + if (aLen > 0) { + pd << "["; + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theOpen->Value(i)); + pd << anObj_i << ((i < aLen) ? ", " : ""); + } + pd << "]"; + } else { + pd << "empty_list"; + } + + pd << ") = geompy.GetFreeBoundary(" << theObject << ")"; + } + + SetErrorCode(OK); + return true; +} diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx new file mode 100644 index 000000000..cdb1ceae6 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx @@ -0,0 +1,86 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IHealingOperations_HXX_ +#define _GEOMImpl_IHealingOperations_HXX_ + +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include +#include + +#include + +class GEOMImpl_IHealingOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IHealingOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IHealingOperations(); + + // Apply Shape Processing to the selected Object + Standard_EXPORT Handle(GEOM_Object) ShapeProcess( Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfExtendedString)& theOperations, + const Handle(TColStd_HArray1OfExtendedString)& theParams, + const Handle(TColStd_HArray1OfExtendedString)& theValues ); + + // Retrieve default Shape Process parameters (from resource file) + Standard_EXPORT void GetShapeProcessParameters( list& theOperations, + list& theParams, + list& theValues ); + + // Retrieve default Shape Process parameters for given operator + Standard_EXPORT bool GetOperatorParameters( const string theOperation, + list& theParams, + list& theValues ); + + // returns all parameters that are valid for the given operation (Shape Process operator) + Standard_EXPORT static bool GetParameters( const string theOperation, list& theParams ); + + Standard_EXPORT Handle(GEOM_Object) SuppressFaces( Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theFaces); + + Standard_EXPORT Handle(GEOM_Object) CloseContour( Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires, + bool isCommonVertex ); + + Standard_EXPORT Handle(GEOM_Object) RemoveIntWires( Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires); + + Standard_EXPORT Handle(GEOM_Object) FillHoles( Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires); + + Standard_EXPORT Handle(GEOM_Object) Sew( Handle(GEOM_Object) theObject, + double theTolerance ); + + Standard_EXPORT Handle(GEOM_Object) DivideEdge( Handle(GEOM_Object) theObject, + int theIndex, + double theValue, + bool isByParameter ); + + // this function does not use Function-Driver mechanism, it just computes the free + // boundary edges and returns them in the sequence. It is called just for information reasons + // and it's not intended for history/undo/redo/etc.. + Standard_EXPORT bool GetFreeBoundary ( Handle(GEOM_Object) theObject, + Handle(TColStd_HSequenceOfTransient)& theOutClosedWires, + Handle(TColStd_HSequenceOfTransient)& theOutOpenWires ); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IImportExport.hxx b/src/GEOMImpl/GEOMImpl_IImportExport.hxx new file mode 100644 index 000000000..efa6b2bec --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IImportExport.hxx @@ -0,0 +1,51 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Import Export operation. + + +#include "GEOM_Function.hxx" + +#define EXP_ARG_REF 1 +#define EXP_ARG_FILE 2 +#define EXP_ARG_PLUG 3 + +class GEOMImpl_IImportExport +{ + public: + + GEOMImpl_IImportExport(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(EXP_ARG_REF, theOriginal); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(EXP_ARG_REF); } + + void SetFileName(const TCollection_AsciiString& theFileName) { _func->SetString(EXP_ARG_FILE, theFileName); } + + TCollection_AsciiString GetFileName() { return _func->GetString(EXP_ARG_FILE); } + + void SetPluginName(const TCollection_AsciiString& theFormatName) + { _func->SetString(EXP_ARG_PLUG, theFormatName); } + + TCollection_AsciiString GetPluginName() { return _func->GetString(EXP_ARG_PLUG); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx new file mode 100644 index 000000000..6aee3f044 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -0,0 +1,405 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IInsertOperations::GEOMImpl_IInsertOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations() +{ + MESSAGE("GEOMImpl_IInsertOperations::~GEOMImpl_IInsertOperations"); +} + + + +//============================================================================= +/*! + * MakeCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) theOriginal) +{ + SetErrorCode(KO); + + if (theOriginal.IsNull()) return NULL; + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); + + //Add a Copy function for creation a copy object + Handle(GEOM_Function) aFunction = aCopy->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITH_REF); + + //Check if the function is set correctly + if(aFunction->GetDriverGUID() != GEOMImpl_CopyDriver::GetID()) return NULL; + + GEOMImpl_ICopy aCI(aFunction); + + Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction(); + if (aRefFunction.IsNull()) return NULL; + + aCI.SetOriginal(aRefFunction); + + //Compute the Copy value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Copy driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeCopy(" << theOriginal << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Export + */ +//============================================================================= +void GEOMImpl_IInsertOperations::Export + (const Handle(GEOM_Object) theOriginal, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) +{ + SetErrorCode(KO); + + if (theOriginal.IsNull()) return; + + Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction(); + if (aRefFunction.IsNull()) return; //There is no function which creates an object to be exported + + //Add an Export function + Handle(GEOM_Function) aFunction = theOriginal->AddFunction(GEOMImpl_ExportDriver::GetID(), EXPORT_SHAPE); + if (aFunction.IsNull()) return; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ExportDriver::GetID()) return; + + //Set parameters + GEOMImpl_IImportExport aCI (aFunction); + aCI.SetOriginal(aRefFunction); + aCI.SetFileName(theFileName); + + Handle(TCollection_HAsciiString) aHLibName; + if (!IsSupported(Standard_False, theFormatName, aHLibName)) { + return; + } + TCollection_AsciiString aLibName = aHLibName->String(); + aCI.SetPluginName(aLibName); + + //Perform the Export + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Export driver failed"); + return; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal << ", \"" + << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * Import + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import + (const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName) +{ + SetErrorCode(KO); + + if (theFileName.IsEmpty() || theFormatName.IsEmpty()) return NULL; + + //Add a new result object + Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT); + + //Add an Import function + Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_ImportDriver::GetID(), IMPORT_SHAPE); + if (aFunction.IsNull()) return result; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ImportDriver::GetID()) return result; + + //Set parameters + GEOMImpl_IImportExport aCI (aFunction); + aCI.SetFileName(theFileName); + + Handle(TCollection_HAsciiString) aHLibName; + if (!IsSupported(Standard_True, theFormatName, aHLibName)) { + return result; + } + TCollection_AsciiString aLibName = aHLibName->String(); + aCI.SetPluginName(aLibName); + + //Perform the Import + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Import driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\"" + << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; + + SetErrorCode(OK); + return result; +} + +//============================================================================= +/*! + * ImportTranslators + */ +//============================================================================= +Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators + (Handle(TColStd_HSequenceOfAsciiString)& theFormats, + Handle(TColStd_HSequenceOfAsciiString)& thePatterns) +{ + if (theFormats.IsNull()) + theFormats = new TColStd_HSequenceOfAsciiString; + else + theFormats->Clear(); + + if (thePatterns.IsNull()) + thePatterns = new TColStd_HSequenceOfAsciiString; + else + thePatterns->Clear(); + + if (!InitResMgr()) return Standard_False; + + // Read Import formats list + if (myResMgr->Find("Import")) { + TCollection_AsciiString aFormats (myResMgr->Value("Import")); + TCollection_AsciiString aToken = aFormats.Token("| \t", 1); + int i = 1; + for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) { + theFormats->Append(aToken); + } + } + + // Read Patterns for each supported format + int j = 1, len = theFormats->Length(); + for (; j <= len; j++) { + TCollection_AsciiString aPattern; + TCollection_AsciiString aKey (theFormats->Value(j)); + aKey += ".Pattern"; + if (myResMgr->Find(aKey.ToCString())) + aPattern = myResMgr->Value(aKey.ToCString()); + else { + aPattern = theFormats->Value(j); + aPattern += " Files ( *.* )"; + } + thePatterns->Append(aPattern); + } + + return (!theFormats->IsEmpty()); +} + +//============================================================================= +/*! + * ExportTranslators + */ +//============================================================================= +Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators + (Handle(TColStd_HSequenceOfAsciiString)& theFormats, + Handle(TColStd_HSequenceOfAsciiString)& thePatterns) +{ + if (theFormats.IsNull()) + theFormats = new TColStd_HSequenceOfAsciiString; + else + theFormats->Clear(); + + if (thePatterns.IsNull()) + thePatterns = new TColStd_HSequenceOfAsciiString; + else + thePatterns->Clear(); + + if (!InitResMgr()) return Standard_False; + + // Read Export formats list + if (myResMgr->Find("Export")) { + TCollection_AsciiString aFormats (myResMgr->Value("Export")); + TCollection_AsciiString aToken = aFormats.Token("| \t", 1); + int i = 1; + for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) { + theFormats->Append(aToken); + } + } + + // Read Patterns for each supported format + int j = 1, len = theFormats->Length(); + for (; j <= len; j++) { + TCollection_AsciiString aPattern; + TCollection_AsciiString aKey (theFormats->Value(j)); + aKey += ".Pattern"; + if (myResMgr->Find(aKey.ToCString())) + aPattern = myResMgr->Value(aKey.ToCString()); + else { + aPattern = theFormats->Value(j); + aPattern += " Files ( *.* )"; + } + thePatterns->Append(aPattern); + } + + return (!theFormats->IsEmpty()); +} + +//============================================================================= +/*! + * IsSupported + */ +//============================================================================= +Standard_Boolean GEOMImpl_IInsertOperations::IsSupported + (const Standard_Boolean isImport, + const TCollection_AsciiString& theFormat, + Handle(TCollection_HAsciiString)& theLibName) +{ + if (!InitResMgr()) return Standard_False; + + // Import/Export mode + TCollection_AsciiString aMode; + //Standard_CString aMode; + if (isImport) aMode = "Import"; + else aMode = "Export"; + + // Read supported formats for the certain mode + if (myResMgr->Find(aMode.ToCString())) { + TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString())); + if (aFormats.Search(theFormat) > -1) { + // Read library name for the supported format + TCollection_AsciiString aKey (theFormat); + aKey += "."; + aKey += aMode; + if (myResMgr->Find(aKey.ToCString())) { + TCollection_AsciiString aLibName (myResMgr->Value(aKey.ToCString())); + theLibName = new TCollection_HAsciiString (aLibName); + return Standard_True; + } + } + } + + return Standard_False; +} + +//============================================================================= +/*! + * InitResMgr + */ +//============================================================================= +Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr() +{ + if (myResMgr.IsNull()) { + // Initialize the Resource Manager + TCollection_AsciiString aResDir (getenv("GEOM_ROOT_DIR")); +#ifdef WNT + aResDir += "\\share\\salome\\resources"; +#else + aResDir += "/share/salome/resources"; +#endif + char * dir = getenv("GEOM_ENGINE_RESOURCES_DIR"); + TCollection_AsciiString aUserResDir; + if ( dir ) + { + aUserResDir = dir; + } + else + { + aUserResDir = getenv("HOME"); +#ifdef WNT + aUserResDir += "\\.salome\\resources"; +#else + aUserResDir += "/.salome/resources"; +#endif + } + myResMgr = new Resource_Manager ("ImportExport", aResDir, aUserResDir, Standard_False); + + if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) { + // instead of complains in Resource_Manager + INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString() << + " and in " << aUserResDir.ToCString() ); + } + } + + return ( myResMgr->Find("Import") || myResMgr->Find("Export") ); +} diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx new file mode 100644 index 000000000..795b3ae93 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.hxx @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IInsertOperations_HXX_ +#define _GEOMImpl_IInsertOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include +#include +#include +#include + +class GEOMImpl_IInsertOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IInsertOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IInsertOperations(); + + + Standard_EXPORT Handle(GEOM_Object) MakeCopy (Handle(GEOM_Object) theOriginal); + + Standard_EXPORT Handle(GEOM_Object) Import (const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatType); + + Standard_EXPORT void Export (const Handle(GEOM_Object) theOriginal, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatType); + + Standard_EXPORT Standard_Boolean ImportTranslators (Handle(TColStd_HSequenceOfAsciiString)& theFormats, + Handle(TColStd_HSequenceOfAsciiString)& thePatterns); + + Standard_EXPORT Standard_Boolean ExportTranslators (Handle(TColStd_HSequenceOfAsciiString)& theFormats, + Handle(TColStd_HSequenceOfAsciiString)& thePatterns); + + Standard_EXPORT Standard_Boolean IsSupported (const Standard_Boolean isImport, + const TCollection_AsciiString& theFormat, + Handle(TCollection_HAsciiString)& theLibName); + + private: + Standard_Boolean InitResMgr (); + + private: + Handle(Resource_Manager) myResMgr; +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ILine.hxx b/src/GEOMImpl/GEOMImpl_ILine.hxx new file mode 100644 index 000000000..fd9f108f8 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ILine.hxx @@ -0,0 +1,43 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the vector creation. + + +#include "GEOM_Function.hxx" + +#define LINE_ARG_PNT1 1 +#define LINE_ARG_PNT2 2 + +class GEOMImpl_ILine +{ + public: + + GEOMImpl_ILine(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT1, theRef); } + void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT2, theRef); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(LINE_ARG_PNT1); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(LINE_ARG_PNT2); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx new file mode 100644 index 000000000..c6f85f04a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -0,0 +1,525 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_ILocalOperations::GEOMImpl_ILocalOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_ILocalOperations::GEOMImpl_ILocalOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_ILocalOperations::~GEOMImpl_ILocalOperations() +{ + MESSAGE("GEOMImpl_ILocalOperations::~GEOMImpl_ILocalOperations"); +} + + +//============================================================================= +/*! + * MakeFilletAll + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll + (Handle(GEOM_Object) theShape, double theR) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_ALL); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL; + + GEOMImpl_IFillet aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR(theR); + + //Compute the Fillet value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Fillet driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFillet << " = geompy.MakeFilletAll(" + << theShape << ", " << theR << ")"; + + SetErrorCode(OK); + return aFillet; +} + +//============================================================================= +/*! + * MakeFilletEdges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges + (Handle(GEOM_Object) theShape, double theR, list theEdges) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_EDGES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL; + + GEOMImpl_IFillet aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR(theR); + int aLen = theEdges.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++, ind++) { + aCI.SetEdge(ind, (*it)); + } + + //Compute the Fillet value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Fillet driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aFillet << " = geompy.MakeFillet(" << theShape + << ", " << theR << ", geompy.ShapeType[\"EDGE\"], ["; + + it = theEdges.begin(); + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aFillet; +} + +//============================================================================= +/*! + * MakeFilletFaces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFaces + (Handle(GEOM_Object) theShape, double theR, list theFaces) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_FACES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL; + + GEOMImpl_IFillet aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR(theR); + int aLen = theFaces.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++, ind++) { + aCI.SetFace(ind, (*it)); + } + + //Compute the Fillet value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Fillet driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aFillet << " = geompy.MakeFillet(" << theShape + << ", " << theR << ", geompy.ShapeType[\"FACE\"], ["; + + it = theFaces.begin(); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aFillet; +} + +//============================================================================= +/*! + * MakeChamferAll + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferAll (Handle(GEOM_Object) theShape, double theD) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_ALL); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL; + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetD(theD); + + //Compute the Chamfer value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aChamfer << " = geompy.MakeChamferAll(" + << theShape << ", " << theD << ")"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * MakeChamferEdge + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge + (Handle(GEOM_Object) theShape, double theD1, double theD2, + int theFace1, int theFace2) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL; + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetD1(theD1); + aCI.SetD2(theD2); + aCI.SetFace1(theFace1); + aCI.SetFace2(theFace2); + + //Compute the Chamfer value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aChamfer + << " = geompy.MakeChamferEdge(" << theShape << ", " << theD1 + << ", " << theD2 << ", " << theFace1 << ", " << theFace2 << ")"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * MakeChamferFaces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces + (Handle(GEOM_Object) theShape, double theD1, double theD2, + list theFaces) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_FACES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL; + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetD1(theD1); + aCI.SetD2(theD2); + int aLen = theFaces.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++, ind++) { + aCI.SetFace(ind, (*it)); + } + + //Compute the Chamfer value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aChamfer << " = geompy.MakeChamferFaces(" << theShape + << ", " << theD1 << ", " << theD2 << ", ["; + + it = theFaces.begin(); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * Archimede + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeArchimede (Handle(GEOM_Object) theShape, + double theWeight, + double theWaterDensity, + double theMeshingDeflection) +{ + SetErrorCode(KO); + + //Add a new Archimede object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_ARCHIMEDE); + + //Add a new Archimede function + Handle(GEOM_Function) aFunction = aChamfer->AddFunction(GEOMImpl_ArchimedeDriver::GetID(), ARCHIMEDE_TYPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ArchimedeDriver::GetID()) return NULL; + + GEOMImpl_IArchimede aAI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aAI.SetBasicShape(aRefShape); + aAI.SetWeight(theWeight); + aAI.SetDensity(theWaterDensity); + aAI.SetDeflection(theMeshingDeflection); + + //Compute the Archimede value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Archimede driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aChamfer + << " = geompy.Archimede(" << theShape << ", " << theWeight << ", " + << theWaterDensity << ", " << theMeshingDeflection << ")"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * GetSubShape + */ +//============================================================================= +bool GEOMImpl_ILocalOperations::GetSubShape (const TopoDS_Shape& theShape, const int theIndex, + TopoDS_Shape& theSubShape) +{ + if (theShape.IsNull() || theIndex < 1) + return false; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(theShape, anIndices); + if (theIndex > anIndices.Extent()) return false; + theSubShape = anIndices.FindKey(theIndex); + + return true; +} + +//============================================================================= +/*! + * GetSubShapeIndex + */ +//============================================================================= +Standard_Integer GEOMImpl_ILocalOperations::GetSubShapeIndex (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theSubShape) +{ + SetErrorCode(KO); + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape aSubShape = theSubShape->GetValue(); + + if (aShape.IsNull() || aSubShape.IsNull()) return -1; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + if (anIndices.Contains(aSubShape)) { + SetErrorCode(OK); + return anIndices.FindIndex(aSubShape); + } + + return -1; +} diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx new file mode 100644 index 000000000..9050413e3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_ILocalOperations_HXX_ +#define _GEOMImpl_ILocalOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include + +#include + +class GEOMImpl_ILocalOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_ILocalOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_ILocalOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakeFilletAll (Handle(GEOM_Object) theShape, double theR); + Standard_EXPORT Handle(GEOM_Object) MakeFilletEdges (Handle(GEOM_Object) theShape, double theR, + list theEdges); + Standard_EXPORT Handle(GEOM_Object) MakeFilletFaces (Handle(GEOM_Object) theShape, double theR, + list theFaces); + + Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD); + Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape, + double theD1, double theD2, + int theFace1, int theFace2); + Standard_EXPORT Handle(GEOM_Object) MakeChamferFaces (Handle(GEOM_Object) theShape, + double theD1, double theD2, + list theFaces); + + Standard_EXPORT Handle(GEOM_Object) MakeArchimede (Handle(GEOM_Object) theShape, + double theWeight, double theWaterDensity, + double theMeshingDeflection); + + Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theShape, + Handle(GEOM_Object) theSubShape); + + Standard_EXPORT static bool GetSubShape (const TopoDS_Shape& theShape, + const int theIndex, + TopoDS_Shape& theSubShape); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IMarker.hxx b/src/GEOMImpl/GEOMImpl_IMarker.hxx new file mode 100644 index 000000000..2e6b157ac --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IMarker.hxx @@ -0,0 +1,88 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an interface to a function for the local coordinate system creation. + + +#include "GEOM_Function.hxx" + +#define CS_ARG_O_X 1 +#define CS_ARG_O_Y 2 +#define CS_ARG_O_Z 3 + +#define CS_ARG_X_DX 4 +#define CS_ARG_X_DY 5 +#define CS_ARG_X_DZ 6 + +#define CS_ARG_Y_DX 7 +#define CS_ARG_Y_DY 8 +#define CS_ARG_Y_DZ 9 + +class GEOMImpl_IMarker +{ + public: + + GEOMImpl_IMarker(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOrigin (const double theX, const double theY, const double theZ) + { + _func->SetReal(CS_ARG_O_X, theX); + _func->SetReal(CS_ARG_O_Y, theY); + _func->SetReal(CS_ARG_O_Z, theZ); + } + + void SetXDir (const double theDX, const double theDY, const double theDZ) + { + _func->SetReal(CS_ARG_X_DX, theDX); + _func->SetReal(CS_ARG_X_DY, theDY); + _func->SetReal(CS_ARG_X_DZ, theDZ); + } + + void SetYDir (const double theDX, const double theDY, const double theDZ) + { + _func->SetReal(CS_ARG_Y_DX, theDX); + _func->SetReal(CS_ARG_Y_DY, theDY); + _func->SetReal(CS_ARG_Y_DZ, theDZ); + } + + void GetOrigin (double& theX, double& theY, double& theZ) + { + theX = _func->GetReal(CS_ARG_O_X); + theY = _func->GetReal(CS_ARG_O_Y); + theZ = _func->GetReal(CS_ARG_O_Z); + } + + void GetXDir (double& theDX, double& theDY, double& theDZ) + { + theDX = _func->GetReal(CS_ARG_X_DX); + theDY = _func->GetReal(CS_ARG_X_DY); + theDZ = _func->GetReal(CS_ARG_X_DZ); + } + + void GetYDir (double& theDX, double& theDY, double& theDZ) + { + theDX = _func->GetReal(CS_ARG_Y_DX); + theDY = _func->GetReal(CS_ARG_Y_DY); + theDZ = _func->GetReal(CS_ARG_Y_DZ); + } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IMeasure.hxx b/src/GEOMImpl/GEOMImpl_IMeasure.hxx new file mode 100644 index 000000000..32ff00963 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IMeasure.hxx @@ -0,0 +1,41 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// NOTE: This is an interface to a functions for the Measurement + + +#include "GEOM_Function.hxx" + +#define MEASURE_ARG_BASE 1 + +class GEOMImpl_IMeasure +{ + public: + + GEOMImpl_IMeasure(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetBase(Handle(GEOM_Function) theRefBase) + { _func->SetReference(MEASURE_ARG_BASE, theRefBase); } + + Handle(GEOM_Function) GetBase() { return _func->GetReference(MEASURE_ARG_BASE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx new file mode 100644 index 000000000..4cc2facc4 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -0,0 +1,926 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include +#include +#include + +#include +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IMeasureOperations::GEOMImpl_IMeasureOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations() +{ + MESSAGE("GEOMImpl_IMeasureOperations::~GEOMImpl_IMeasureOperations"); +} + + +//============================================================================= +/*! + * GetCentreOfMass + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass + (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new CentreOfMass object + Handle(GEOM_Object) aCDG = GetEngine()->AddObject(GetDocID(), GEOM_CDG); + + //Add a new CentreOfMass function + Handle(GEOM_Function) aFunction = + aCDG->AddFunction(GEOMImpl_MeasureDriver::GetID(), CDG_MEASURE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MeasureDriver::GetID()) return NULL; + + GEOMImpl_IMeasure aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetBase(aRefShape); + + //Compute the CentreOfMass value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Measure driver failed to compute centre of mass"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCDG << " = geompy.MakeCDG(" << theShape << ")"; + + SetErrorCode(OK); + return aCDG; +} + +//============================================================================= +/*! + * GetBasicProperties + */ +//============================================================================= +void GEOMImpl_IMeasureOperations::GetBasicProperties (Handle(GEOM_Object) theShape, + Standard_Real& theLength, + Standard_Real& theSurfArea, + Standard_Real& theVolume) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return; + } + + //Compute the parameters + GProp_GProps LProps, SProps; + try { + BRepGProp::LinearProperties(aShape, LProps); + theLength = LProps.Mass(); + + BRepGProp::SurfaceProperties(aShape, SProps); + theSurfArea = SProps.Mass(); + + theVolume = 0.0; + if (aShape.ShapeType() < TopAbs_SHELL) { + for (TopExp_Explorer Exp (aShape, TopAbs_SOLID); Exp.More(); Exp.Next()) { + GProp_GProps VProps; + BRepGProp::VolumeProperties(Exp.Current(), VProps); + theVolume += VProps.Mass(); + } + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return; + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * GetInertia + */ +//============================================================================= +void GEOMImpl_IMeasureOperations::GetInertia + (Handle(GEOM_Object) theShape, + Standard_Real& I11, Standard_Real& I12, Standard_Real& I13, + Standard_Real& I21, Standard_Real& I22, Standard_Real& I23, + Standard_Real& I31, Standard_Real& I32, Standard_Real& I33, + Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return; + } + + //Compute the parameters + GProp_GProps System; + + try { + if (aShape.ShapeType() == TopAbs_VERTEX || + aShape.ShapeType() == TopAbs_EDGE || + aShape.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(aShape, System); + } else if (aShape.ShapeType() == TopAbs_FACE || + aShape.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(aShape, System); + } else { + BRepGProp::VolumeProperties(aShape, System); + } + gp_Mat I = System.MatrixOfInertia(); + + I11 = I(1,1); + I12 = I(1,2); + I13 = I(1,3); + + I21 = I(2,1); + I22 = I(2,2); + I23 = I(2,3); + + I31 = I(3,1); + I32 = I(3,2); + I33 = I(3,3); + + GProp_PrincipalProps Pr = System.PrincipalProperties(); + Pr.Moments(Ix,Iy,Iz); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return; + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * GetBoundingBox + */ +//============================================================================= +void GEOMImpl_IMeasureOperations::GetBoundingBox + (Handle(GEOM_Object) theShape, + Standard_Real& Xmin, Standard_Real& Xmax, + Standard_Real& Ymin, Standard_Real& Ymax, + Standard_Real& Zmin, Standard_Real& Zmax) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return; + } + + //Compute the parameters + Bnd_Box B; + + try { + BRepBndLib::Add(aShape, B); + B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return; + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * GetTolerance + */ +//============================================================================= +void GEOMImpl_IMeasureOperations::GetTolerance + (Handle(GEOM_Object) theShape, + Standard_Real& FaceMin, Standard_Real& FaceMax, + Standard_Real& EdgeMin, Standard_Real& EdgeMax, + Standard_Real& VertMin, Standard_Real& VertMax) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return; + } + + //Compute the parameters + Standard_Real T; + FaceMin = EdgeMin = VertMin = RealLast(); + FaceMax = EdgeMax = VertMax = -RealLast(); + + try { + for (TopExp_Explorer ExF (aShape, TopAbs_FACE); ExF.More(); ExF.Next()) { + TopoDS_Face Face = TopoDS::Face(ExF.Current()); + T = BRep_Tool::Tolerance(Face); + if (T > FaceMax) + FaceMax = T; + if (T < FaceMin) + FaceMin = T; + } + for (TopExp_Explorer ExE (aShape, TopAbs_EDGE); ExE.More(); ExE.Next()) { + TopoDS_Edge Edge = TopoDS::Edge(ExE.Current()); + T = BRep_Tool::Tolerance(Edge); + if (T > EdgeMax) + EdgeMax = T; + if (T < EdgeMin) + EdgeMin = T; + } + for (TopExp_Explorer ExV (aShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) { + TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current()); + T = BRep_Tool::Tolerance(Vertex); + if (T > VertMax) + VertMax = T; + if (T < VertMin) + VertMin = T; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return; + } + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * CheckShape + */ +//============================================================================= +bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape, + TCollection_AsciiString& theDump) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return false; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return false; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return false; + } + + //Compute the parameters + bool isValid = false; + try { + BRepCheck_Analyzer ana (aShape, false); + if (ana.IsValid()) { + theDump.Clear(); + isValid = true; + } else { + StructuralDump(ana, aShape, theDump); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return false; + } + + SetErrorCode(OK); + return isValid; +} + +//============================================================================= +/*! + * WhatIs + */ +//============================================================================= +TCollection_AsciiString GEOMImpl_IMeasureOperations::WhatIs (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + TCollection_AsciiString Astr; + + if (theShape.IsNull()) return Astr; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return Astr; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) { + SetErrorCode("The Objects has NULL Shape"); + return Astr; + } + + //Compute the parameters + if (aShape.ShapeType() == TopAbs_EDGE) { + if (BRep_Tool::Degenerated(TopoDS::Edge(aShape))) { + Astr = Astr + " It is a degenerated edge \n"; + } + } + + Astr = Astr + " Number of sub-shapes : \n"; + + try { + int iType, nbTypes [TopAbs_SHAPE]; + for (iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[aShape.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(aShape); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(aShape); + + TopTools_ListIteratorOfListOfShape itL (aListOfShape); + for (; itL.More(); itL.Next()) { + TopoDS_Iterator it (itL.Value()); + for (; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + if (aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypes[s.ShapeType()]++; + } + } + } + + Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbTypes[TopAbs_VERTEX]) + "\n"; + Astr = Astr + " EDGE : " + TCollection_AsciiString(nbTypes[TopAbs_EDGE]) + "\n"; + Astr = Astr + " WIRE : " + TCollection_AsciiString(nbTypes[TopAbs_WIRE]) + "\n"; + Astr = Astr + " FACE : " + TCollection_AsciiString(nbTypes[TopAbs_FACE]) + "\n"; + Astr = Astr + " SHELL : " + TCollection_AsciiString(nbTypes[TopAbs_SHELL]) + "\n"; + Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[TopAbs_SOLID]) + "\n"; + Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[TopAbs_COMPSOLID]) + "\n"; + Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[TopAbs_COMPOUND]) + "\n"; + Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return Astr; + } + + SetErrorCode(OK); + return Astr; +} + +//============================================================================= +/*! + * GetMinDistance + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::GetMinDistance + (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2, + Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, + Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2) +{ + SetErrorCode(KO); + Standard_Real MinDist = 1.e9; + + if (theShape1.IsNull() || theShape2.IsNull()) return MinDist; + + Handle(GEOM_Function) aRefShape1 = theShape1->GetLastFunction(); + Handle(GEOM_Function) aRefShape2 = theShape2->GetLastFunction(); + if (aRefShape1.IsNull() || aRefShape2.IsNull()) return MinDist; + + TopoDS_Shape aShape1 = aRefShape1->GetValue(); + TopoDS_Shape aShape2 = aRefShape2->GetValue(); + if (aShape1.IsNull() || aShape2.IsNull()) { + SetErrorCode("One of Objects has NULL Shape"); + return MinDist; + } + + //Compute the parameters + try { + BRepExtrema_DistShapeShape dst (aShape1, aShape2); + if (dst.IsDone()) { + gp_Pnt PMin1, PMin2, P1, P2; + + for (int i = 1; i <= dst.NbSolution(); i++) { + P1 = dst.PointOnShape1(i); + P2 = dst.PointOnShape2(i); + + Standard_Real Dist = P1.Distance(P2); + if (MinDist > Dist) { + MinDist = Dist; + PMin1 = P1; + PMin2 = P2; + } + } + + PMin1.Coord(X1, Y1, Z1); + PMin2.Coord(X2, Y2, Z2); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return MinDist; + } + + SetErrorCode(OK); + return MinDist; +} + +//======================================================================= +//function : PointCoordinates +//purpose : Get coordinates of point +//======================================================================= +void GEOMImpl_IMeasureOperations::PointCoordinates( Handle(GEOM_Object) theShape, + Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ ) +{ + SetErrorCode( KO ); + + if ( theShape.IsNull() ) + return; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if ( aRefShape.IsNull() ) + return; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) + { + SetErrorCode( "Shape must be a vertex" ); + return; + } + + try + { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + theX = aPnt.X(); + theY = aPnt.Y(); + theZ = aPnt.Z(); + SetErrorCode( OK ); + } + catch ( Standard_Failure ) + { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode( aFail->GetMessageString() ); + } +} + +//======================================================================= +//function : StructuralDump +//purpose : Structural (data exchange) style of output. +//======================================================================= +void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + TCollection_AsciiString& theDump) +{ + Standard_Integer i; + theDump.Clear(); + theDump += " -- The Shape has problems :\n"; + theDump += " Check Count\n"; + theDump += " ------------------------------------------------\n"; + + Standard_Integer last_stat = (Standard_Integer)BRepCheck_CheckFail; + Handle(TColStd_HArray1OfInteger) NbProblems = + new TColStd_HArray1OfInteger(1, last_stat); + for (i = 1; i <= last_stat; i++) + NbProblems->SetValue(i,0); + + Handle(TopTools_HSequenceOfShape) sl; + sl = new TopTools_HSequenceOfShape(); + TopTools_DataMapOfShapeListOfShape theMap; + theMap.Clear(); + GetProblemShapes(theAna, theShape, sl, NbProblems, theMap); + theMap.Clear(); + + Standard_Integer count = 0; + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnCurve); + if (count > 0) { + theDump += " Invalid Point on Curve ................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnCurveOnSurface); + if (count > 0) { + theDump += " Invalid Point on CurveOnSurface .......... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidPointOnSurface); + if (count > 0) { + theDump += " Invalid Point on Surface ................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_No3DCurve); + if (count > 0) { + theDump += " No 3D Curve .............................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_Multiple3DCurve); + if (count > 0) { + theDump += " Multiple 3D Curve ........................ "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_Invalid3DCurve); + if (count > 0) { + theDump += " Invalid 3D Curve ......................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_NoCurveOnSurface); + if (count > 0) { + theDump += " No Curve on Surface ...................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidCurveOnSurface); + if (count > 0) { + theDump += " Invalid Curve on Surface ................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidCurveOnClosedSurface); + if (count > 0) { + theDump += " Invalid Curve on closed Surface .......... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidSameRangeFlag); + if (count > 0) { + theDump += " Invalid SameRange Flag ................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidSameParameterFlag); + if (count > 0) { + theDump += " Invalid SameParameter Flag ............... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidDegeneratedFlag); + if (count > 0) { + theDump += " Invalid Degenerated Flag ................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_FreeEdge); + if (count > 0) { + theDump += " Free Edge ................................ "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidMultiConnexity); + if (count > 0) { + theDump += " Invalid MultiConnexity ................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidRange); + if (count > 0) { + theDump += " Invalid Range ............................ "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_EmptyWire); + if (count > 0) { + theDump += " Empty Wire ............................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantEdge); + if (count > 0) { + theDump += " Redundant Edge ........................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_SelfIntersectingWire); + if (count > 0) { + theDump += " Self Intersecting Wire ................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_NoSurface); + if (count > 0) { + theDump += " No Surface ............................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidWire); + if (count > 0) { + theDump += " Invalid Wire ............................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantWire); + if (count > 0) { + theDump += " Redundant Wire ........................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_IntersectingWires); + if (count > 0) { + theDump += " Intersecting Wires ....................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_InvalidImbricationOfWires); + if (count > 0) { + theDump += " Invalid Imbrication of Wires ............. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_EmptyShell); + if (count > 0) { + theDump += " Empty Shell .............................. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_RedundantFace); + if (count > 0) { + theDump += " Redundant Face ........................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_UnorientableShape); + if (count > 0) { + theDump += " Unorientable Shape ....................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_NotClosed); + if (count > 0) { + theDump += " Not Closed ............................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_NotConnected); + if (count > 0) { + theDump += " Not Connected ............................ "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_SubshapeNotInShape); + if (count > 0) { + theDump += " Subshape not in Shape .................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientation); + if (count > 0) { + theDump += " Bad Orientation .......................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_BadOrientationOfSubshape); + if (count > 0) { + theDump += " Bad Orientation of Subshape .............. "; + theDump += TCollection_AsciiString(count) + "\n"; + } + count = NbProblems->Value((Standard_Integer)BRepCheck_CheckFail); + if (count > 0) { + theDump += " checkshape failure ....................... "; + theDump += TCollection_AsciiString(count) + "\n"; + } + + theDump += " ------------------------------------------------\n"; + theDump += "*** Shapes with problems : "; + theDump += TCollection_AsciiString(sl->Length()) + "\n"; + + Standard_Integer nbv, nbe, nbw, nbf, nbs, nbo; + nbv = nbe = nbw = nbf = nbs = nbo = 0; + + for (i = 1; i <= sl->Length(); i++) { + TopoDS_Shape shi = sl->Value(i); + TopAbs_ShapeEnum sti = shi.ShapeType(); + switch (sti) { + case TopAbs_VERTEX : nbv++; break; + case TopAbs_EDGE : nbe++; break; + case TopAbs_WIRE : nbw++; break; + case TopAbs_FACE : nbf++; break; + case TopAbs_SHELL : nbs++; break; + case TopAbs_SOLID : nbo++; break; + default : break; + } + } + + if (nbv > 0) { + theDump += "VERTEX : "; + if (nbv < 10) theDump += " "; + theDump += TCollection_AsciiString(nbv) + "\n"; + } + if (nbe > 0) { + theDump += "EDGE : "; + if (nbe < 10) theDump += " "; + theDump += TCollection_AsciiString(nbe) + "\n"; + } + if (nbw > 0) { + theDump += "WIRE : "; + if (nbw < 10) theDump += " "; + theDump += TCollection_AsciiString(nbw) + "\n"; + } + if (nbf > 0) { + theDump += "FACE : "; + if (nbf < 10) theDump += " "; + theDump += TCollection_AsciiString(nbf) + "\n"; + } + if (nbs > 0) { + theDump += "SHELL : "; + if (nbs < 10) theDump += " "; + theDump += TCollection_AsciiString(nbs) + "\n"; + } + if (nbo > 0) { + theDump += "SOLID : "; + if (nbo < 10) theDump += " "; + theDump += TCollection_AsciiString(nbo) + "\n"; + } +} + +//======================================================================= +//function : GetProblemShapes +// purpose : for StructuralDump +//======================================================================= +void GEOMImpl_IMeasureOperations::GetProblemShapes (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + Handle(TopTools_HSequenceOfShape)& sl, + Handle(TColStd_HArray1OfInteger)& NbProblems, + TopTools_DataMapOfShapeListOfShape& theMap) +{ + for (TopoDS_Iterator iter(theShape); iter.More(); iter.Next()) { + GetProblemShapes(theAna, iter.Value(), sl, NbProblems, theMap); + } + TopAbs_ShapeEnum styp = theShape.ShapeType(); + BRepCheck_ListIteratorOfListOfStatus itl; + TopTools_ListOfShape empty; + if (!theMap.IsBound(theShape)) { + theMap.Bind(theShape,empty); + + if (!theAna.Result(theShape).IsNull()) { + itl.Initialize(theAna.Result(theShape)->Status()); + // !!! May be, we have to print all the problems, not only the first one ? + if (itl.Value() != BRepCheck_NoError) { + sl->Append(theShape); + BRepCheck_Status stat = itl.Value(); + NbProblems->SetValue((Standard_Integer)stat, + NbProblems->Value((Standard_Integer)stat) + 1); + } + } + } + + switch (styp) { + case TopAbs_EDGE: + GetProblemSub(theAna, theShape, sl, NbProblems, TopAbs_VERTEX, theMap); + break; + case TopAbs_FACE: + GetProblemSub(theAna, theShape, sl, NbProblems, TopAbs_WIRE, theMap); + GetProblemSub(theAna, theShape, sl, NbProblems, TopAbs_EDGE, theMap); + GetProblemSub(theAna, theShape, sl, NbProblems, TopAbs_VERTEX, theMap); + break; + case TopAbs_SHELL: + break; + case TopAbs_SOLID: + GetProblemSub(theAna, theShape, sl, NbProblems, TopAbs_SHELL, theMap); + break; + default: + break; + } +} + +//======================================================================= +//function : Contains +//======================================================================= +static Standard_Boolean Contains (const TopTools_ListOfShape& L, + const TopoDS_Shape& S) +{ + TopTools_ListIteratorOfListOfShape it; + for (it.Initialize(L); it.More(); it.Next()) { + if (it.Value().IsSame(S)) { + return Standard_True; + } + } + return Standard_False; +} + +//======================================================================= +//function : GetProblemSub +// purpose : for StructuralDump +//======================================================================= +void GEOMImpl_IMeasureOperations::GetProblemSub (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + Handle(TopTools_HSequenceOfShape)& sl, + Handle(TColStd_HArray1OfInteger)& NbProblems, + const TopAbs_ShapeEnum Subtype, + TopTools_DataMapOfShapeListOfShape& theMap) +{ + BRepCheck_ListIteratorOfListOfStatus itl; + TopExp_Explorer exp; + for (exp.Init(theShape, Subtype); exp.More(); exp.Next()) { + const TopoDS_Shape& sub = exp.Current(); + + const Handle(BRepCheck_Result)& res = theAna.Result(sub); + for (res->InitContextIterator(); + res->MoreShapeInContext(); + res->NextShapeInContext()) { + if (res->ContextualShape().IsSame(theShape) && !Contains(theMap(sub), theShape)) { + theMap(sub).Append(theShape); + itl.Initialize(res->StatusOnShape()); + + if (itl.Value() != BRepCheck_NoError) { + Standard_Integer ii = 0; + + for (ii = 1; ii <= sl->Length(); ii++) + if (sl->Value(ii).IsSame(sub)) break; + + if (ii > sl->Length()) { + sl->Append(sub); + BRepCheck_Status stat = itl.Value(); + NbProblems->SetValue((Standard_Integer)stat, + NbProblems->Value((Standard_Integer)stat) + 1); + } + for (ii = 1; ii <= sl->Length(); ii++) + if (sl->Value(ii).IsSame(theShape)) break; + if (ii > sl->Length()) { + sl->Append(theShape); + BRepCheck_Status stat = itl.Value(); + NbProblems->SetValue((Standard_Integer)stat, + NbProblems->Value((Standard_Integer)stat) + 1); + } + } + break; + } + } + } +} diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx new file mode 100644 index 000000000..541364583 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -0,0 +1,93 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IMeasureOperations_HXX_ +#define _GEOMImpl_IMeasureOperations_HXX_ + +#include "GEOM_IOperations.hxx" + +#include +#include +#include +#include + +class GEOM_Engine; +class Handle(GEOM_Object); + +class GEOMImpl_IMeasureOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IMeasureOperations(); + + Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape); + + Standard_EXPORT void GetBasicProperties (Handle(GEOM_Object) theShape, + Standard_Real& theLength, + Standard_Real& theSurfArea, + Standard_Real& theVolume); + + Standard_EXPORT void GetInertia (Handle(GEOM_Object) theShape, + Standard_Real& I11, Standard_Real& I12, Standard_Real& I13, + Standard_Real& I21, Standard_Real& I22, Standard_Real& I23, + Standard_Real& I31, Standard_Real& I32, Standard_Real& I33, + Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz); + + Standard_EXPORT void GetBoundingBox (Handle(GEOM_Object) theShape, + Standard_Real& Xmin, Standard_Real& Xmax, + Standard_Real& Ymin, Standard_Real& Ymax, + Standard_Real& Zmin, Standard_Real& Zmax); + + Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape, + Standard_Real& FaceMin, Standard_Real& FaceMax, + Standard_Real& EdgeMin, Standard_Real& EdgeMax, + Standard_Real& VertMin, Standard_Real& VertMax); + + Standard_EXPORT bool CheckShape (Handle(GEOM_Object) theShape, + TCollection_AsciiString& theDump); + + Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape); + + Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2, + Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1, + Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2); + + Standard_EXPORT void PointCoordinates( Handle(GEOM_Object) theShape, + Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ ); + + private: + void StructuralDump (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + TCollection_AsciiString& theDump); + + void GetProblemShapes (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + Handle(TopTools_HSequenceOfShape)& sl, + Handle(TColStd_HArray1OfInteger)& NbProblems, + TopTools_DataMapOfShapeListOfShape& theMap); + + void GetProblemSub (const BRepCheck_Analyzer& theAna, + const TopoDS_Shape& theShape, + Handle(TopTools_HSequenceOfShape)& sl, + Handle(TColStd_HArray1OfInteger)& NbProblems, + const TopAbs_ShapeEnum Subtype, + TopTools_DataMapOfShapeListOfShape& theMap); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_IMirror.hxx b/src/GEOMImpl/GEOMImpl_IMirror.hxx new file mode 100644 index 000000000..94a00b9fd --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IMirror.hxx @@ -0,0 +1,49 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Mirror creation. + + +#include "GEOM_Function.hxx" + +#define MIRROR_ARG_ORIGINAL 1 +#define MIRROR_ARG_PLANE 2 +#define MIRROR_ARG_AXIS 3 +#define MIRROR_ARG_POINT 4 + +class GEOMImpl_IMirror +{ + public: + + GEOMImpl_IMirror(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetOriginal(Handle(GEOM_Function) theShape) { _func->SetReference(MIRROR_ARG_ORIGINAL, theShape); } + void SetPlane (Handle(GEOM_Function) thePlane) { _func->SetReference(MIRROR_ARG_PLANE, thePlane); } + void SetAxis (Handle(GEOM_Function) theAxis ) { _func->SetReference(MIRROR_ARG_AXIS , theAxis ); } + void SetPoint (Handle(GEOM_Function) thePoint) { _func->SetReference(MIRROR_ARG_POINT, thePoint); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(MIRROR_ARG_ORIGINAL); } + Handle(GEOM_Function) GetPlane() { return _func->GetReference(MIRROR_ARG_PLANE); } + Handle(GEOM_Function) GetAxis () { return _func->GetReference(MIRROR_ARG_AXIS ); } + Handle(GEOM_Function) GetPoint() { return _func->GetReference(MIRROR_ARG_POINT); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IOffset.hxx b/src/GEOMImpl/GEOMImpl_IOffset.hxx new file mode 100644 index 000000000..5eb57cf28 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IOffset.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Offset creation. + + +#include "GEOM_Function.hxx" + +#define OFF_ARG_SHAPE 1 +#define OFF_ARG_VALUE 2 + +class GEOMImpl_IOffset +{ + public: + + GEOMImpl_IOffset(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(OFF_ARG_SHAPE, theShape); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(OFF_ARG_SHAPE); } + + void SetValue(double theValue) { _func->SetReal(OFF_ARG_VALUE, theValue); } + + double GetValue() { return _func->GetReal(OFF_ARG_VALUE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPartition.hxx b/src/GEOMImpl/GEOMImpl_IPartition.hxx new file mode 100644 index 000000000..575f6e6c4 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPartition.hxx @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Partition creation. + + +#include "GEOM_Function.hxx" + +#include "TColStd_HSequenceOfTransient.hxx" +#include "TColStd_HArray1OfInteger.hxx" + +#define PART_ARG_LIMIT 1 +#define PART_ARG_SHAPES 2 +#define PART_ARG_TOOLS 3 +#define PART_ARG_KEEP_IN 4 +#define PART_ARG_REM_IN 5 + +#define PART_ARG_MATERIALS 6 + +#define PART_ARG_SHAPE 7 +#define PART_ARG_PLANE 8 + +class GEOMImpl_IPartition +{ + public: + + GEOMImpl_IPartition(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetLimit(int theLimit) { _func->SetInteger(PART_ARG_LIMIT, theLimit); } + + void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(PART_ARG_SHAPES, theShapes); } + + void SetTools(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(PART_ARG_TOOLS, theShapes); } + + void SetKeepIns(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(PART_ARG_KEEP_IN, theShapes); } + + void SetRemoveIns(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(PART_ARG_REM_IN, theShapes); } + + void SetMaterials(const Handle(TColStd_HArray1OfInteger)& theMaterials) + { _func->SetIntegerArray(PART_ARG_MATERIALS, theMaterials); } + + + int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); } + + Handle(TColStd_HSequenceOfTransient) GetShapes() { return _func->GetReferenceList(PART_ARG_SHAPES); } + Handle(TColStd_HSequenceOfTransient) GetTools() { return _func->GetReferenceList(PART_ARG_TOOLS); } + Handle(TColStd_HSequenceOfTransient) GetKeepIns() { return _func->GetReferenceList(PART_ARG_KEEP_IN); } + Handle(TColStd_HSequenceOfTransient) GetRemoveIns() { return _func->GetReferenceList(PART_ARG_REM_IN); } + + Handle(TColStd_HArray1OfInteger) GetMaterials() { return _func->GetIntegerArray(PART_ARG_MATERIALS); } + + + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(PART_ARG_SHAPE, theShape); } + void SetPlane(Handle(GEOM_Function) thePlane) { _func->SetReference(PART_ARG_PLANE, thePlane); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(PART_ARG_SHAPE); } + Handle(GEOM_Function) GetPlane() { return _func->GetReference(PART_ARG_PLANE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPipe.hxx b/src/GEOMImpl/GEOMImpl_IPipe.hxx new file mode 100644 index 000000000..5ed0050b9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPipe.hxx @@ -0,0 +1,43 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Pipe creation. + + +#include "GEOM_Function.hxx" + +#define PIPE_ARG_BASE 1 +#define PIPE_ARG_PATH 2 + +class GEOMImpl_IPipe +{ + public: + + GEOMImpl_IPipe(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetBase (Handle(GEOM_Function) theBase) { _func->SetReference(PIPE_ARG_BASE, theBase); } + void SetPath (Handle(GEOM_Function) thePath) { _func->SetReference(PIPE_ARG_PATH, thePath); } + + Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); } + Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPlane.hxx b/src/GEOMImpl/GEOMImpl_IPlane.hxx new file mode 100644 index 000000000..5129d6a9d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPlane.hxx @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the vector creation. + + +#include "GEOM_Function.hxx" + +#define PLN_ARG_SIZE 1 + +#define PLN_ARG_PNT1 2 +#define PLN_ARG_PNT2 3 +#define PLN_ARG_PNT3 4 + +#define PLN_ARG_VEC 5 + +#define PLN_ARG_REF 6 + +class GEOMImpl_IPlane +{ + public: + + GEOMImpl_IPlane(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetSize(double theSize) { _func->SetReal(PLN_ARG_SIZE, theSize); } + + double GetSize() { return _func->GetReal(PLN_ARG_SIZE); } + + void SetPoint (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); } + void SetVector(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC , theRef); } + + void SetFace (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_REF , theRef); } + + void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); } + void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT2, theRef); } + void SetPoint3(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT3, theRef); } + + Handle(GEOM_Function) GetPoint () { return _func->GetReference(PLN_ARG_PNT1); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(PLN_ARG_VEC ); } + + Handle(GEOM_Function) GetFace () { return _func->GetReference(PLN_ARG_REF ); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(PLN_ARG_PNT1); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(PLN_ARG_PNT2); } + Handle(GEOM_Function) GetPoint3() { return _func->GetReference(PLN_ARG_PNT3); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx new file mode 100755 index 000000000..2adb7cfc6 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the point creation. + + +#include "GEOM_Function.hxx" + +#define ARG_X 1 +#define ARG_Y 2 +#define ARG_Z 3 + +#define ARG_REF 4 + +#define ARG_PARAM 5 +#define ARG_CURVE 6 + +class GEOMImpl_IPoint +{ + public: + + GEOMImpl_IPoint(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetX(double theX) { _func->SetReal(ARG_X, theX); } + void SetY(double theY) { _func->SetReal(ARG_Y, theY); } + void SetZ(double theZ) { _func->SetReal(ARG_Z, theZ); } + + double GetX() { return _func->GetReal(ARG_X); } + double GetY() { return _func->GetReal(ARG_Y); } + double GetZ() { return _func->GetReal(ARG_Z); } + + void SetRef(Handle(GEOM_Function) theRefPoint) { _func->SetReference(ARG_REF, theRefPoint); } + + Handle(GEOM_Function) GetRef() { return _func->GetReference(ARG_REF); } + + void SetCurve(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_CURVE, theRef); } + + Handle(GEOM_Function) GetCurve() { return _func->GetReference(ARG_CURVE); } + + void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } + + double GetParameter() { return _func->GetReal(ARG_PARAM); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPolyline.hxx b/src/GEOMImpl/GEOMImpl_IPolyline.hxx new file mode 100644 index 000000000..c76c8a992 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPolyline.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Polyline creation. + + +#include "GEOM_Function.hxx" + +#define POLY_ARG_LENG 1 +#define POLY_ARG_LAST 1 + +class GEOMImpl_IPolyline +{ + public: + + GEOMImpl_IPolyline(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetLength(int theLen) { _func->SetInteger(POLY_ARG_LENG, theLen); } + + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(POLY_ARG_LAST + theId, theP); } + + int GetLength() { return _func->GetInteger(POLY_ARG_LENG); } + + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(POLY_ARG_LAST + theId); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPosition.hxx b/src/GEOMImpl/GEOMImpl_IPosition.hxx new file mode 100644 index 000000000..194f6c7ea --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPosition.hxx @@ -0,0 +1,52 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Setting In Position. + + +#include "GEOM_Function.hxx" + +#define POSITION_ARG_SHAPE 1 +#define POSITION_ARG_START_LCS 2 +#define POSITION_ARG_END_LCS 3 + +class GEOMImpl_IPosition +{ + public: + + GEOMImpl_IPosition(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(POSITION_ARG_SHAPE, theShape); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(POSITION_ARG_SHAPE); } + + void SetStartLCS(Handle(GEOM_Function) theStartLCS) + { _func->SetReference(POSITION_ARG_START_LCS, theStartLCS); } + + Handle(GEOM_Function) GetStartLCS() { return _func->GetReference(POSITION_ARG_START_LCS); } + + void SetEndLCS(Handle(GEOM_Function) theEndLCS) + { _func->SetReference(POSITION_ARG_END_LCS, theEndLCS); } + + Handle(GEOM_Function) GetEndLCS() { return _func->GetReference(POSITION_ARG_END_LCS); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IPrism.hxx b/src/GEOMImpl/GEOMImpl_IPrism.hxx new file mode 100644 index 000000000..7d82753a3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPrism.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Prism creation. + + +#include "GEOM_Function.hxx" + +#define PRISM_ARG_H 1 +#define PRISM_ARG_VEC 2 +#define PRISM_ARG_BASE 3 +#define PRISM_ARG_PNT_F 4 +#define PRISM_ARG_PNT_L 5 + +class GEOMImpl_IPrism +{ + public: + + GEOMImpl_IPrism(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetBase (Handle(GEOM_Function) theRefBase ) { _func->SetReference(PRISM_ARG_BASE, theRefBase); } + void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(PRISM_ARG_VEC , theRefVector); } + void SetFirstPoint(Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); } + void SetLastPoint (Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); } + + Handle(GEOM_Function) GetBase () { return _func->GetReference(PRISM_ARG_BASE); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(PRISM_ARG_VEC ); } + Handle(GEOM_Function) GetFirstPoint() { return _func->GetReference(PRISM_ARG_PNT_F ); } + Handle(GEOM_Function) GetLastPoint () { return _func->GetReference(PRISM_ARG_PNT_L ); } + + void SetH(double theH) { _func->SetReal(PRISM_ARG_H, theH); } + + double GetH() { return _func->GetReal(PRISM_ARG_H); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IRevolution.hxx b/src/GEOMImpl/GEOMImpl_IRevolution.hxx new file mode 100644 index 000000000..5857361bb --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IRevolution.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Revolution creation. + + +#include "GEOM_Function.hxx" + +#define REVOL_ARG_ANGLE 1 +#define REVOL_ARG_AXIS 2 +#define REVOL_ARG_BASE 3 + +class GEOMImpl_IRevolution +{ + public: + + GEOMImpl_IRevolution(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetAngle(double theAngle) { _func->SetReal(REVOL_ARG_ANGLE, theAngle); } + + double GetAngle() { return _func->GetReal(REVOL_ARG_ANGLE); } + + void SetAxis(Handle(GEOM_Function) theRefAxis) { _func->SetReference(REVOL_ARG_AXIS, theRefAxis); } + + Handle(GEOM_Function) GetAxis() { return _func->GetReference(REVOL_ARG_AXIS); } + + void SetBase(Handle(GEOM_Function) theRefBase) { _func->SetReference(REVOL_ARG_BASE, theRefBase); } + + Handle(GEOM_Function) GetBase() { return _func->GetReference(REVOL_ARG_BASE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IRotate.hxx b/src/GEOMImpl/GEOMImpl_IRotate.hxx new file mode 100644 index 000000000..44e7cccac --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IRotate.hxx @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Rotate operation. + + +#include "GEOM_Function.hxx" + +#define ROTATE_ANGLE 1 +#define ROTATE_AXIS 2 +#define ROTATE_ORGN 3 +#define ROTATE_STEP1 4 +#define ROTATE_NBITER1 5 +#define ROTATE_NBITER2 6 + +class GEOMImpl_IRotate +{ + public: + + GEOMImpl_IRotate(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetAngle(Standard_Real theAngle) { _func->SetReal(ROTATE_ANGLE, theAngle); } + + Standard_Real GetAngle() { return _func->GetReal(ROTATE_ANGLE); } + + void SetAxis(Handle(GEOM_Function) theVector) { _func->SetReference(ROTATE_AXIS, theVector); } + + Handle(GEOM_Function) GetAxis() { return _func->GetReference(ROTATE_AXIS); } + + void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(ROTATE_ORGN, theOriginal); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(ROTATE_ORGN); } + + void SetStep(double theStep) { return _func->SetReal(ROTATE_STEP1, theStep); } + + double GetStep() { return _func->GetReal(ROTATE_STEP1); } + + void SetNbIter1(int theNbIter) { _func->SetInteger(ROTATE_NBITER1, theNbIter); } + + int GetNbIter1() { return _func->GetInteger(ROTATE_NBITER1); } + + void SetNbIter2(int theNbIter) { _func->SetInteger(ROTATE_NBITER2, theNbIter); } + + int GetNbIter2() { return _func->GetInteger(ROTATE_NBITER2); } + + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IScale.hxx b/src/GEOMImpl/GEOMImpl_IScale.hxx new file mode 100644 index 000000000..75df3263b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IScale.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Scale creation. + + +#include "GEOM_Function.hxx" + +#define SCALE_ARG_SHAPE 1 +#define SCALE_ARG_VALUE 2 +#define SCALE_ARG_POINT 3 + +class GEOMImpl_IScale +{ + public: + + GEOMImpl_IScale(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShape(Handle(GEOM_Function) theShape) { _func->SetReference(SCALE_ARG_SHAPE, theShape); } + + Handle(GEOM_Function) GetShape() { return _func->GetReference(SCALE_ARG_SHAPE); } + + void SetFactor(double theValue) { _func->SetReal(SCALE_ARG_VALUE, theValue); } + + double GetFactor() { return _func->GetReal(SCALE_ARG_VALUE); } + + void SetPoint(Handle(GEOM_Function) thePoint) { _func->SetReference(SCALE_ARG_POINT, thePoint); } + + Handle(GEOM_Function) GetPoint() { return _func->GetReference(SCALE_ARG_POINT); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IShapes.hxx b/src/GEOMImpl/GEOMImpl_IShapes.hxx new file mode 100644 index 000000000..61d7fa6f3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IShapes.hxx @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// NOTE: This is an intreface to a function for the Shapes +// (Wire, Face, Shell, Solid and Compound) creation. + + +#include "GEOM_Function.hxx" + +#include "TColStd_HSequenceOfTransient.hxx" +#include "TColStd_HArray1OfInteger.hxx" + +#define SHAPE_ARG_SHAPES 1 // for Wire, Shell, Solid and Compound + +#define SHAPE_ARG_BASE 2 // for Face, Solid and Sub-shape + +#define SHAPE_ARG_PLANAR 3 // for Face + +#define SHAPE_ARG_SUBTYPE 4 // for Sub-shape +#define SHAPE_ARG_INDICES 5 // for Sub-shape + +class GEOMImpl_IShapes +{ + public: + + GEOMImpl_IShapes(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(SHAPE_ARG_SHAPES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetShapes() + { return _func->GetReferenceList(SHAPE_ARG_SHAPES); } + + void SetBase(Handle(GEOM_Function) theRefBase) + { _func->SetReference(SHAPE_ARG_BASE, theRefBase); } + + Handle(GEOM_Function) GetBase() { return _func->GetReference(SHAPE_ARG_BASE); } + + void SetIsPlanar(const Standard_Boolean isPlanarWanted) + { _func->SetInteger(SHAPE_ARG_PLANAR, isPlanarWanted ? 1 : 0); } + + Standard_Boolean GetIsPlanar() { return (_func->GetInteger(SHAPE_ARG_PLANAR) == 1); } + + void SetSubShapeType(const Standard_Integer theType) + { _func->SetInteger(SHAPE_ARG_SUBTYPE, theType); } + + Standard_Integer GetSubShapeType() { return _func->GetInteger(SHAPE_ARG_SUBTYPE); } + + void SetIndices(const Handle(TColStd_HArray1OfInteger)& theIndices) + { _func->SetIntegerArray(SHAPE_ARG_INDICES, theIndices); } + + Handle(TColStd_HArray1OfInteger) GetIndices() + { return _func->GetIntegerArray(SHAPE_ARG_INDICES); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx new file mode 100644 index 000000000..39172e1a9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -0,0 +1,2039 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOMImpl_IShapesOperations.hxx" + +#include "GEOMImpl_Types.hxx" + +#include "GEOMImpl_VectorDriver.hxx" +#include "GEOMImpl_ShapeDriver.hxx" +#include "GEOMImpl_CopyDriver.hxx" +#include "GEOMImpl_GlueDriver.hxx" + +#include "GEOMImpl_IVector.hxx" +#include "GEOMImpl_IShapes.hxx" +#include "GEOMImpl_IGlue.hxx" + +#include "GEOMImpl_Block6Explorer.hxx" + +#include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + +#include "GEOMAlgo_FinderShapeOn1.hxx" +#include "GEOMAlgo_FinderShapeOnQuad.hxx" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +//#include + +//#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOMImpl_IShapesOperations::GEOMImpl_IShapesOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IShapesOperations::GEOMImpl_IShapesOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOMImpl_IShapesOperations::~GEOMImpl_IShapesOperations() +{ + MESSAGE("GEOMImpl_IShapesOperations::~GEOMImpl_IShapesOperations"); +} + + +//============================================================================= +/*! + * MakeEdge + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge + (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; + + //Add a new Edge object + Handle(GEOM_Object) anEdge = GetEngine()->AddObject(GetDocID(), GEOM_EDGE); + + //Add a new Vector function + Handle(GEOM_Function) aFunction = + anEdge->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TWO_PNT); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL; + + GEOMImpl_IVector aPI (aFunction); + + Handle(GEOM_Function) aRef1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = thePnt2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetPoint1(aRef1); + aPI.SetPoint2(aRef2); + + //Compute the Edge value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Vector driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdge(" + << thePnt1 << ", " << thePnt2 << ")"; + + SetErrorCode(OK); + return anEdge; +} + +//============================================================================= +/*! + * MakeWire + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWire + (list theShapes) +{ + return MakeShape(theShapes, GEOM_WIRE, WIRE_EDGES, "MakeWire"); +} + +//============================================================================= +/*! + * MakeFace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) theWire, + const bool isPlanarWanted) +{ + SetErrorCode(KO); + + if (theWire.IsNull()) return NULL; + + //Add a new Face object + Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new Shape function for creation of a face from a wire + Handle(GEOM_Function) aFunction = + aFace->AddFunction(GEOMImpl_ShapeDriver::GetID(), FACE_WIRE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(GEOM_Function) aRefWire = theWire->GetLastFunction(); + + if (aRefWire.IsNull()) return NULL; + + aCI.SetBase(aRefWire); + aCI.SetIsPlanar(isPlanarWanted); + + //Compute the Face value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to compute a face"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace(" + << theWire << ", " << (int)isPlanarWanted << ")"; + + SetErrorCode(OK); + return aFace; +} + +//============================================================================= +/*! + * MakeFaceWires + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires + (list theShapes, + const bool isPlanarWanted) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_FACE); + + //Add a new function + Handle(GEOM_Function) aFunction = + aShape->AddFunction(GEOMImpl_ShapeDriver::GetID(), FACE_WIRES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + + // Shapes + list::iterator it = theShapes.begin(); + for (; it != theShapes.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the face construction"); + return NULL; + } + aShapesSeq->Append(aRefSh); + } + aCI.SetShapes(aShapesSeq); + + aCI.SetIsPlanar(isPlanarWanted); + + //Compute the shape + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy.MakeFaceWires(["; + + // Shapes + it = theShapes.begin(); + if (it != theShapes.end()) { + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); + } + } + pd << "], " << (int)isPlanarWanted << ")"; + + SetErrorCode(OK); + return aShape; +} + +//============================================================================= +/*! + * MakeShell + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShell + (list theShapes) +{ + return MakeShape(theShapes, GEOM_SHELL, SHELL_FACES, "MakeShell"); +} + +//============================================================================= +/*! + * MakeSolidShells + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShells + (list theShapes) +{ + return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolidShells"); +} + +//============================================================================= +/*! + * MakeSolidShell + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShell (Handle(GEOM_Object) theShell) +{ + SetErrorCode(KO); + + if (theShell.IsNull()) return NULL; + + //Add a new Solid object + Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID); + + //Add a new Solid function for creation of a solid from a shell + Handle(GEOM_Function) aFunction = + aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(GEOM_Function) aRefShell = theShell->GetLastFunction(); + + if (aRefShell.IsNull()) return NULL; + + aCI.SetBase(aRefShell); + + //Compute the Solid value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Solid driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aSolid + << " = geompy.MakeSolid(" << theShell << ")"; + + SetErrorCode(OK); + return aSolid; +} + +//============================================================================= +/*! + * MakeCompound + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeCompound + (list theShapes) +{ + return MakeShape(theShapes, GEOM_COMPOUND, COMPOUND_SHAPES, "MakeCompound"); +} + +//============================================================================= +/*! + * MakeShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape + (list theShapes, + const Standard_Integer theObjectType, + const Standard_Integer theFunctionType, + const TCollection_AsciiString& theMethodName) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), theObjectType); + + //Add a new function + Handle(GEOM_Function) aFunction = + aShape->AddFunction(GEOMImpl_ShapeDriver::GetID(), theFunctionType); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aCI (aFunction); + + Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; + + // Shapes + list::iterator it = theShapes.begin(); + for (; it != theShapes.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + aShapesSeq->Append(aRefSh); + } + aCI.SetShapes(aShapesSeq); + + //Compute the shape + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy." << theMethodName.ToCString() << "(["; + + // Shapes + it = theShapes.begin(); + if (it != theShapes.end()) { + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); + } + } + pd << "])"; + + SetErrorCode(OK); + return aShape; +} + +//============================================================================= +/*! + * MakeGlueFaces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new Glued object + Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED); + + //Add a new Glue function + Handle(GEOM_Function) aFunction; + aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_FACES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL; + + GEOMImpl_IGlue aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetBase(aRefShape); + aCI.SetTolerance(theTolerance); + + //Compute the sub-shape value + Standard_Boolean isWarning = Standard_False; + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to glue faces"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + // to provide warning + if (!aFunction->GetValue().IsNull()) { + isWarning = Standard_True; + } else { + return NULL; + } + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueFaces(" + << theShape << ", " << theTolerance << ")"; + + // to provide warning + if (!isWarning) SetErrorCode(OK); + return aGlued; +} + +//============================================================================= +/*! + * MakeExplode + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode + (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted) +{ +// OSD_Timer timer1, timer2, timer3, timer4; +// timer1.Start(); + + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + Handle(GEOM_Object) anObj; + Handle(GEOM_Function) aFunction; + TopTools_MapOfShape mapShape; + TopTools_ListOfShape listShape; + + if (aShape.ShapeType() == TopAbs_COMPOUND && + (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) { + TopoDS_Iterator It (aShape, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + if (mapShape.Add(It.Value())) { + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) { + listShape.Append(It.Value()); + } + } + } + } else { + TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) + if (mapShape.Add(exp.Current())) + listShape.Append(exp.Current()); + } + + if (listShape.IsEmpty()) { + SetErrorCode("The given shape has no sub-shapes of the requested type"); + return aSeq; + } + +// timer1.Stop(); +// timer2.Start(); + + if (isSorted) + SortShapes(listShape); + +// timer2.Stop(); +// timer3.Start(); + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + + TopTools_ListIteratorOfListOfShape itSub (listShape); + TCollection_AsciiString anAsciiList, anEntry; + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape aValue = itSub.Value(); + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aValue)); + anObj = GetEngine()->AddSubShape(theShape, anArray); + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + + //Make a Python command + anAsciiList.Trunc(anAsciiList.Length() - 1); + + aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString(); + pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "("); + pd << theShape << ", " << theShapeType << ")"; + + SetErrorCode(OK); + +// timer4.Stop(); + +// cout << "Explosure takes:" << endl; +// timer1.Show(); +// cout << "Sorting takes:" << endl; +// timer2.Show(); +// cout << "Sub-shapes addition takes:" << endl; +// timer3.Show(); +// cout << "Update Description takes:" << endl; +// timer4.Show(); + + return aSeq; +} + +//============================================================================= +/*! + * GetSubShapeAllIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs + (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + TopTools_MapOfShape mapShape; + TopTools_ListOfShape listShape; + + if (aShape.ShapeType() == TopAbs_COMPOUND && + (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID || + TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) { + TopoDS_Iterator It (aShape, Standard_True, Standard_True); + for (; It.More(); It.Next()) { + if (mapShape.Add(It.Value())) { + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE || + TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) { + listShape.Append(It.Value()); + } + } + } + } else { + TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) + if (mapShape.Add(exp.Current())) + listShape.Append(exp.Current()); + } + + if (listShape.IsEmpty()) { + SetErrorCode("The given shape has no sub-shapes of the requested type"); + return aSeq; + } + + if (isSorted) + SortShapes(listShape); + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + + TopTools_ListIteratorOfListOfShape itSub (listShape); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape aValue = itSub.Value(); + aSeq->Append(anIndices.FindIndex(aValue)); + } + + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll"; + pd << (isSorted ? "SortedIDs(" : "IDs("); + pd << theShape << ", " << theShapeType << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetSubShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetSubShape + (Handle(GEOM_Object) theMainShape, + const Standard_Integer theID) +{ + SetErrorCode(KO); + + if (theMainShape.IsNull()) return NULL; + + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, theID); + Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray,true); + if (anObj.IsNull()) { + SetErrorCode("Can not get a sub-shape with the given ID"); + return NULL; + } + + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << anObj << " = geompy.GetSubShape(" + << theMainShape << ", [" << theID << "])"; + + SetErrorCode(OK); + return anObj; +} + + +//============================================================================= +/*! + * NumberOfFaces + */ +//============================================================================= +Standard_Integer GEOMImpl_IShapesOperations::NumberOfFaces (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + Standard_Integer nb = 0; + + if (theShape.IsNull()) return -1; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return -1; + + TopTools_MapOfShape mapShape; + + TopExp_Explorer exp (aShape, TopAbs_FACE); + for (; exp.More(); exp.Next()) + if (mapShape.Add(exp.Current())) + nb++; + + SetErrorCode(OK); + return nb; +} + +//============================================================================= +/*! + * NumberOfEdges + */ +//============================================================================= +Standard_Integer GEOMImpl_IShapesOperations::NumberOfEdges (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + Standard_Integer nb = 0; + + if (theShape.IsNull()) return -1; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return -1; + + TopTools_MapOfShape mapShape; + + TopExp_Explorer exp (aShape, TopAbs_EDGE); + for (; exp.More(); exp.Next()) + if (mapShape.Add(exp.Current())) + nb++; + + SetErrorCode(OK); + return nb; +} + +//============================================================================= +/*! + * ReverseShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + + //Add a new reversed object + Handle(GEOM_Object) aReversed = GetEngine()->AddObject(GetDocID(), theShape->GetType()); + + //Add a new Revese function + Handle(GEOM_Function) aFunction; + aFunction = aReversed->AddFunction(GEOMImpl_ShapeDriver::GetID(), REVERSE_ORIENTATION); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL; + + GEOMImpl_IShapes aSI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aSI.SetBase(aRefShape); + + //Compute the sub-shape value + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Shape driver failed to reverse shape"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aReversed + << " = geompy.ChangeOrientation(" << theShape << ")"; + + SetErrorCode(OK); + return aReversed; +} + +//============================================================================= +/*! + * GetFreeFacesIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetFreeFacesIDs + (Handle(GEOM_Object) theShape) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + + TopTools_IndexedDataMapOfShapeListOfShape mapFaceBlocks; + GEOMImpl_Block6Explorer::MapShapesAndAncestors + (aShape, TopAbs_FACE, TopAbs_SOLID, mapFaceBlocks); + + Standard_Integer ind = 1, nbFaces = mapFaceBlocks.Extent(); + + if (nbFaces == 0) { + SetErrorCode("The given shape has no faces"); + return aSeq; + } + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + + Standard_Integer id; + for (; ind <= nbFaces; ind++) { + if (mapFaceBlocks.FindFromIndex(ind).Extent() != 2) { + id = anIndices.FindIndex(mapFaceBlocks.FindKey(ind)); + aSeq->Append(id); + } + } + + //The explode doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //Make a Python command + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() + << "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//======================================================================= +//function : GetSharedShapes +//purpose : +//======================================================================= + +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes + (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + const Standard_Integer theShapeType) +{ + SetErrorCode(KO); + + if (theShape1.IsNull() || theShape2.IsNull()) return NULL; + + TopoDS_Shape aShape1 = theShape1->GetValue(); + TopoDS_Shape aShape2 = theShape2->GetValue(); + + if (aShape1.IsNull() || aShape2.IsNull()) return NULL; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape1, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + + TopTools_IndexedMapOfShape mapShape1; + TopExp::MapShapes(aShape1, TopAbs_ShapeEnum(theShapeType), mapShape1); + + Handle(GEOM_Object) anObj; + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; + + TopTools_MapOfShape mapShape2; + TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType)); + for (; exp.More(); exp.Next()) { + TopoDS_Shape aSS = exp.Current(); + if (mapShape2.Add(aSS) && mapShape1.Contains(aSS)) { + anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aSS)); + anObj = GetEngine()->AddSubShape(theShape1, anArray); + aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; + } + } + + if (aSeq->IsEmpty()) { + SetErrorCode("The given shapes have no shared sub-shapes of the requested type"); + return aSeq; + } + + //Make a Python command + anAsciiList.Trunc(anAsciiList.Length() - 1); + + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetSharedShapes(" << theShape1 << ", " + << theShape2 << ", " << theShapeType << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +static GEOM::TPythonDump& operator<< (GEOM::TPythonDump& theDump, + const GEOMAlgo_State theState) +{ + switch (theState) { + case GEOMAlgo_ST_IN: + theDump << "geompy.GEOM.ST_IN"; + break; + case GEOMAlgo_ST_OUT: + theDump << "geompy.GEOM.ST_OUT"; + break; + case GEOMAlgo_ST_ON: + theDump << "geompy.GEOM.ST_ON"; + break; + case GEOMAlgo_ST_ONIN: + theDump << "geompy.GEOM.ST_ONIN"; + break; + case GEOMAlgo_ST_ONOUT: + theDump << "geompy.GEOM.ST_ONOUT"; + break; + default: + theDump << "geompy.GEOM.ST_UNKNOWN"; + break; + } + return theDump; +} + +//======================================================================= +//function : checkTypeShapesOn +/*! + * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK + * \param theShapeType - the shape type to check + * \retval bool - result of the check + */ +//======================================================================= + +bool GEOMImpl_IShapesOperations::checkTypeShapesOn(const Standard_Integer theShapeType) +{ + if (theShapeType != TopAbs_VERTEX && + theShapeType != TopAbs_EDGE && + theShapeType != TopAbs_FACE && + theShapeType != TopAbs_SOLID) { + SetErrorCode("Only solids, vertices, edges or faces can be found by this method"); + return false; + } + return true; +} + +//======================================================================= +//function : makePlane + /*! + * \brief Creates Geom_Plane + * \param theAx1 - shape object defining plane parameters + * \retval Handle(Geom_Surface) - resulting surface + */ +//======================================================================= + +Handle(Geom_Surface) GEOMImpl_IShapesOperations::makePlane(const TopoDS_Shape& anAx1) +{ + if (anAx1.ShapeType() != TopAbs_EDGE) return NULL; + TopoDS_Edge anEdge = TopoDS::Edge(anAx1); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anEdge, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + SetErrorCode("Bad edge given for the plane normal vector"); + return NULL; + } + gp_Pnt aLoc = BRep_Tool::Pnt(V1); + gp_Vec aVec (aLoc, BRep_Tool::Pnt(V2)); + if (aVec.Magnitude() < Precision::Confusion()) { + SetErrorCode("Vector with null magnitude given"); + return NULL; + } + return new Geom_Plane(aLoc, aVec); +} + +//======================================================================= +//function : makeCylinder + /*! + * \brief Creates Geom_CylindricalSurface + * \param theAx1 - edge defining cylinder axis + * \param theRadius - cylinder radius + * \retval Handle(Geom_Surface) - resulting surface + */ +//======================================================================= + +Handle(Geom_Surface) GEOMImpl_IShapesOperations::makeCylinder(const TopoDS_Shape& anAxis, + const Standard_Real theRadius) +{ + //Axis of the cylinder + if (anAxis.ShapeType() != TopAbs_EDGE) { + SetErrorCode("Not an edge given for the axis"); + return NULL; + } + TopoDS_Edge anEdge = TopoDS::Edge(anAxis); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anEdge, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + SetErrorCode("Bad edge given for the axis"); + return NULL; + } + gp_Pnt aLoc = BRep_Tool::Pnt(V1); + gp_Vec aVec (aLoc, BRep_Tool::Pnt(V2)); + if (aVec.Magnitude() < Precision::Confusion()) { + SetErrorCode("Vector with null magnitude given"); + return NULL; + } + + gp_Ax3 anAx3 (aLoc, aVec); + return new Geom_CylindricalSurface(anAx3, theRadius); +} + + +//======================================================================= +//function : getShapesOnSurfaceIDs + /*! + * \brief Find IDs of subshapes complying with given status about surface + * \param theSurface - the surface to check state of subshapes against + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ +//======================================================================= + +Handle(TColStd_HSequenceOfInteger) + GEOMImpl_IShapesOperations::getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface, + const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState) +{ + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; +// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:"); +// OSD_Timer timer1; +// timer1.Start(); + + // Check presence of triangulation, build if need + if (!CheckTriangulation(theShape)) + return aSeqOfIDs; + + // Call algo + GEOMAlgo_FinderShapeOn1 aFinder; + Standard_Real aTol = 0.0001; // default value + + aFinder.SetShape(theShape); + aFinder.SetTolerance(aTol); + aFinder.SetSurface(theSurface); + aFinder.SetShapeType(theShapeType); + aFinder.SetState(theState); + + // Sets the minimal number of inner points for the faces that do not have own + // inner points at all (for e.g. rectangular planar faces have just 2 triangles). + // Default value=3 + aFinder.SetNbPntsMin(3); + // Sets the maximal number of inner points for edges or faces. + // It is usefull for the cases when this number is very big (e.g =2000) to improve + // the performance. If this value =0, all inner points will be taken into account. + // Default value=0 + aFinder.SetNbPntsMax(100); + +// timer1.Stop(); +// timer1.Show(); + +// MESSAGE("--------------------------- Perform on Plane takes:"); +// timer1.Reset(); +// timer1.Start(); + aFinder.Perform(); +// timer1.Stop(); +// timer1.Show(); + +// MESSAGE("--------------------------- GetShapesOnPlane phase 3 takes:"); +// timer1.Reset(); +// timer1.Start(); + + // Interprete results + Standard_Integer iErr = aFinder.ErrorStatus(); + // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iErr) { + MESSAGE(" iErr : " << iErr); + TCollection_AsciiString aMsg (" iErr : "); + aMsg += TCollection_AsciiString(iErr); + SetErrorCode(aMsg); + return aSeqOfIDs; + } + Standard_Integer iWrn = aFinder.WarningStatus(); + // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iWrn) { + MESSAGE(" *** iWrn : " << iWrn); + } + + const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result + + if (listSS.Extent() < 1) { + SetErrorCode("Not a single sub-shape of the requested type found on the given surface"); + return aSeqOfIDs; + } + +// timer1.Stop(); +// timer1.Show(); + +// MESSAGE("--------------------------- GetShapesOnPlane phase 4 takes:"); +// timer1.Reset(); +// timer1.Start(); + + // Fill sequence of object IDs + aSeqOfIDs = new TColStd_HSequenceOfInteger; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(theShape, anIndices); + + TopTools_ListIteratorOfListOfShape itSub (listSS); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + int id = anIndices.FindIndex(itSub.Value()); + aSeqOfIDs->Append(id); + } +// timer1.Stop(); +// timer1.Show(); + return aSeqOfIDs; +} + +//======================================================================= +//function : getObjectsShapesOn +/*! + * \brief Find shape objects and their entries by their ids + * \param theShapeIDs - incoming shape ids + * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." + * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects + */ +//======================================================================= + +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations:: + getObjectsShapesOn(const Handle(GEOM_Object)& theShape, + const Handle(TColStd_HSequenceOfInteger)& theShapeIDs, + TCollection_AsciiString & theShapeEntries) +{ + Handle(TColStd_HSequenceOfTransient) aSeq; + + if ( !theShapeIDs.IsNull() && theShapeIDs->Length() > 0 ) + { + aSeq = new TColStd_HSequenceOfTransient; + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + TCollection_AsciiString anEntry; + for ( int i = 1; i <= theShapeIDs->Length(); ++i ) + { + anArray->SetValue(1, theShapeIDs->Value( i )); + Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theShape, anArray); + aSeq->Append( anObj ); + + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + if ( i != 1 ) theShapeEntries += ","; + theShapeEntries += anEntry; + } + } + return aSeq; +} + +//======================================================================= +//function : getShapesOnSurface +/*! + * \brief Find subshapes complying with given status about surface + * \param theSurface - the surface to check state of subshapes against + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theState - required state + * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ +//======================================================================= + +Handle(TColStd_HSequenceOfTransient) + GEOMImpl_IShapesOperations::getShapesOnSurface(const Handle(Geom_Surface)& theSurface, + const Handle(GEOM_Object)& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState, + TCollection_AsciiString & theShapeEntries) +{ + // Find subshapes ids + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = + getShapesOnSurfaceIDs (theSurface, theShape->GetValue(), theShapeType, theState); + if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) + return NULL; + + return getObjectsShapesOn( theShape, aSeqOfIDs, theShapeEntries ); +} + +//============================================================================= +/*! + * GetShapesOnPlane + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlane + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + +// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:"); +// OSD_Timer timer1; +// timer1.Start(); + + if (theShape.IsNull() || theAx1.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAx1 = theAx1->GetValue(); + + if (aShape.IsNull() || anAx1.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( theShapeType )) + return NULL; + + // Create plane + Handle(Geom_Surface) aPlane = makePlane( anAx1 ); + if ( aPlane.IsNull() ) + return NULL; + + // Find objects + TCollection_AsciiString anAsciiList; + Handle(TColStd_HSequenceOfTransient) aSeq; + aSeq = getShapesOnSurface( aPlane, theShape, aShapeType, theState, anAsciiList ); + if ( aSeq.IsNull() || aSeq->Length() == 0 ) + return NULL; + +// timer1.Stop(); +// timer1.Show(); + +// MESSAGE("--------------------------- GetShapesOnPlane phase 5 takes:"); +// timer1.Reset(); +// timer1.Start(); + + // Make a Python command + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnPlane(" << theShape << ", " + << theShapeType << ", " << theAx1 << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetShapesOnCylinder + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCylinder + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theAxis.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAxis = theAxis->GetValue(); + + if (aShape.IsNull() || anAxis.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Create a cylinder surface + Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius ); + if ( aCylinder.IsNull() ) + return NULL; + + // Find objects + TCollection_AsciiString anAsciiList; + Handle(TColStd_HSequenceOfTransient) aSeq; + aSeq = getShapesOnSurface( aCylinder, theShape, aShapeType, theState, anAsciiList ); + if ( aSeq.IsNull() || aSeq->Length() == 0 ) + return NULL; + + // Make a Python command + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType + << ", " << theAxis << ", " << theRadius << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetShapesOnSphere + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphere + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theCenter.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape aCenter = theCenter->GetValue(); + + if (aShape.IsNull() || aCenter.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Center of the sphere + if (aCenter.ShapeType() != TopAbs_VERTEX) return NULL; + gp_Pnt aLoc = BRep_Tool::Pnt(TopoDS::Vertex(aCenter)); + + gp_Ax3 anAx3 (aLoc, gp::DZ()); + Handle(Geom_SphericalSurface) aSphere = + new Geom_SphericalSurface(anAx3, theRadius); + + // Find objects + TCollection_AsciiString anAsciiList; + Handle(TColStd_HSequenceOfTransient) aSeq; + aSeq = getShapesOnSurface( aSphere, theShape, aShapeType, theState, anAsciiList ); + if ( aSeq.IsNull() || aSeq->Length() == 0 ) + return NULL; + + // Make a Python command + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType + << ", " << theCenter << ", " << theRadius << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//======================================================================= +//function : getCreatedLast + /*! + * \brief Select the object created last + * \param theObj1 - Object 1 + * \param theObj2 - Object 2 + * \retval Handle(GEOM_Object) - selected object + */ +//======================================================================= + +Handle(GEOM_Object) GEOMImpl_IShapesOperations::getCreatedLast(const Handle(GEOM_Object)& theObj1, + const Handle(GEOM_Object)& theObj2) +{ + if ( theObj1.IsNull() ) return theObj2; + if ( theObj2.IsNull() ) return theObj1; + return ( theObj1->GetEntry().Tag() > theObj2->GetEntry().Tag() ) ? theObj1 : theObj2; +} + +//============================================================================= +/*! + * GetShapesOnPlaneIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneIDs + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theAx1.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAx1 = theAx1->GetValue(); + + if (aShape.IsNull() || anAx1.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Create plane + Handle(Geom_Surface) aPlane = makePlane( anAx1 ); + if ( aPlane.IsNull() ) + return NULL; + + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeq; + aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState ); + + // The GetShapesOnPlaneIDs() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAx1)->GetLastFunction(); + + // Make a Python command + const bool append = true; + GEOM::TPythonDump(aFunction,append) + << "listShapesOnPlane = geompy.GetShapesOnPlaneIDs" + << "(" << theShape << "," << theShapeType << "," << theAx1 << "," << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetShapesOnCylinderIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylinderIDs + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theAxis.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape anAxis = theAxis->GetValue(); + + if (aShape.IsNull() || anAxis.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Create a cylinder surface + Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius ); + if ( aCylinder.IsNull() ) + return NULL; + + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeq; + aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState ); + + // The GetShapesOnCylinder() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAxis)->GetLastFunction(); + + // Make a Python command + const bool append = true; + GEOM::TPythonDump(aFunction,append) + << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs" + << "(" << theShape << ", " << theShapeType << ", " << theAxis << ", " + << theRadius << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//============================================================================= +/*! + * GetShapesOnSphereIDs + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnSphereIDs + (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if (theShape.IsNull() || theCenter.IsNull()) return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape aCenter = theCenter->GetValue(); + + if (aShape.IsNull() || aCenter.IsNull()) return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + // Center of the sphere + if (aCenter.ShapeType() != TopAbs_VERTEX) return NULL; + gp_Pnt aLoc = BRep_Tool::Pnt(TopoDS::Vertex(aCenter)); + + gp_Ax3 anAx3 (aLoc, gp::DZ()); + Handle(Geom_SphericalSurface) aSphere = + new Geom_SphericalSurface(anAx3, theRadius); + + // Find object IDs + Handle(TColStd_HSequenceOfInteger) aSeq; + aSeq = getShapesOnSurfaceIDs( aSphere, aShape, aShapeType, theState ); + + // The GetShapesOnSphere() doesn't change object so no new function is required. + Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theCenter)->GetLastFunction(); + + // Make a Python command + const bool append = true; + GEOM::TPythonDump(aFunction,append) + << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs" + << "(" << theShape << ", " << theShapeType << ", " << theCenter << ", " + << theRadius << ", " << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//======================================================================= +//function : getShapesOnQuadrangleIDs + /*! + * \brief Find IDs of subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ +//======================================================================= + +Handle(TColStd_HSequenceOfInteger) + GEOMImpl_IShapesOperations::getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState) +{ + SetErrorCode(KO); + + if ( theShape.IsNull() || + theTopLeftPoint.IsNull() || + theTopRigthPoint.IsNull() || + theBottomLeftPoint.IsNull() || + theBottomRigthPoint.IsNull() ) + return NULL; + + TopoDS_Shape aShape = theShape->GetValue(); + TopoDS_Shape aTL = theTopLeftPoint->GetValue(); + TopoDS_Shape aTR = theTopRigthPoint->GetValue(); + TopoDS_Shape aBL = theBottomLeftPoint->GetValue(); + TopoDS_Shape aBR = theBottomRigthPoint->GetValue(); + + if (aShape.IsNull() || + aTL.IsNull() || + aTR.IsNull() || + aBL.IsNull() || + aBR.IsNull() || + aTL.ShapeType() != TopAbs_VERTEX || + aTR.ShapeType() != TopAbs_VERTEX || + aBL.ShapeType() != TopAbs_VERTEX || + aBR.ShapeType() != TopAbs_VERTEX ) + return NULL; + + TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType); + if ( !checkTypeShapesOn( aShapeType )) + return NULL; + + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; + + // Check presence of triangulation, build if need + if (!CheckTriangulation(aShape)) + return aSeqOfIDs; + + // Call algo + gp_Pnt aPntTL = BRep_Tool::Pnt(TopoDS::Vertex(aTL)); + gp_Pnt aPntTR = BRep_Tool::Pnt(TopoDS::Vertex(aTR)); + gp_Pnt aPntBL = BRep_Tool::Pnt(TopoDS::Vertex(aBL)); + gp_Pnt aPntBR = BRep_Tool::Pnt(TopoDS::Vertex(aBR)); + + GEOMAlgo_FinderShapeOnQuad aFinder( aPntTL, aPntTR, aPntBL, aPntBR ); + Standard_Real aTol = 0.0001; // default value + + aFinder.SetShape(aShape); + aFinder.SetTolerance(aTol); + //aFinder.SetSurface(theSurface); + aFinder.SetShapeType(aShapeType); + aFinder.SetState(theState); + + // Sets the minimal number of inner points for the faces that do not have own + // inner points at all (for e.g. rectangular planar faces have just 2 triangles). + // Default value=3 + aFinder.SetNbPntsMin(3); + // Sets the maximal number of inner points for edges or faces. + // It is usefull for the cases when this number is very big (e.g =2000) to improve + // the performance. If this value =0, all inner points will be taken into account. + // Default value=0 + aFinder.SetNbPntsMax(100); + + aFinder.Perform(); + + // Interprete results + Standard_Integer iErr = aFinder.ErrorStatus(); + // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iErr) { + MESSAGE(" iErr : " << iErr); + TCollection_AsciiString aMsg (" iErr : "); + aMsg += TCollection_AsciiString(iErr); + SetErrorCode(aMsg); + return aSeqOfIDs; + } + Standard_Integer iWrn = aFinder.WarningStatus(); + // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx + if (iWrn) { + MESSAGE(" *** iWrn : " << iWrn); + } + + const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result + + if (listSS.Extent() < 1) { + SetErrorCode("Not a single sub-shape of the requested type found on the given surface"); + return aSeqOfIDs; + } + + // Fill sequence of object IDs + aSeqOfIDs = new TColStd_HSequenceOfInteger; + + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + + TopTools_ListIteratorOfListOfShape itSub (listSS); + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + int id = anIndices.FindIndex(itSub.Value()); + aSeqOfIDs->Append(id); + } + return aSeqOfIDs; +} + +//======================================================================= +//function : GetShapesOnQuadrangle + /*! + * \brief Find subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ +//======================================================================= + +Handle(TColStd_HSequenceOfTransient) + GEOMImpl_IShapesOperations::GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState) +{ + // Find indices + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = + getShapesOnQuadrangleIDs( theShape, + theShapeType, + theTopLeftPoint, + theTopRigthPoint, + theBottomLeftPoint, + theBottomRigthPoint, + theState); + if ( aSeqOfIDs.IsNull() || aSeqOfIDs->IsEmpty() ) + return NULL; + + // Find objects by indices + TCollection_AsciiString anAsciiList; + Handle(TColStd_HSequenceOfTransient) aSeq; + aSeq = getObjectsShapesOn( theShape, aSeqOfIDs, anAsciiList ); + if ( aSeq.IsNull() || aSeq->IsEmpty() ) + return NULL; + + // Make a Python command + + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 )); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) + << "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnQuadrangle(" + << theShape << ", " + << theShapeType << ", " + << theTopLeftPoint << ", " + << theTopRigthPoint << ", " + << theBottomLeftPoint << ", " + << theBottomRigthPoint << ", " + << theState << ")"; + + SetErrorCode(OK); + return aSeq; +} + +//======================================================================= +//function : GetShapesOnQuadrangleIDs + /*! + * \brief Find IDs of subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ +//======================================================================= + +Handle(TColStd_HSequenceOfInteger) + GEOMImpl_IShapesOperations::GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState) +{ + // Find indices + Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = + getShapesOnQuadrangleIDs( theShape, + theShapeType, + theTopLeftPoint, + theTopRigthPoint, + theBottomLeftPoint, + theBottomRigthPoint, + theState); + if ( aSeqOfIDs.IsNull() || aSeqOfIDs->IsEmpty() ) + return NULL; + + // Make a Python command + + // The GetShapesOnCylinder() doesn't change object so no new function is required. + Handle(GEOM_Object) lastObj = getCreatedLast(theShape,theTopLeftPoint); + lastObj = getCreatedLast(lastObj,theTopRigthPoint); + lastObj = getCreatedLast(lastObj,theBottomRigthPoint); + lastObj = getCreatedLast(lastObj,theBottomLeftPoint); + Handle(GEOM_Function) aFunction = lastObj->GetLastFunction(); + + const bool append = true; + GEOM::TPythonDump(aFunction,append) + << "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs(" + << theShape << ", " + << theShapeType << ", " + << theTopLeftPoint << ", " + << theTopRigthPoint << ", " + << theBottomLeftPoint << ", " + << theBottomRigthPoint << ", " + << theState << ")"; + + SetErrorCode(OK); + return aSeqOfIDs; +} + + +//============================================================================= +/*! + * GetInPlace + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace + (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat) +{ + SetErrorCode(KO); + + if (theShapeWhere.IsNull() || theShapeWhat.IsNull()) return NULL; + + TopoDS_Shape aWhere = theShapeWhere->GetValue(); + TopoDS_Shape aWhat = theShapeWhat->GetValue(); + + if (aWhere.IsNull() || aWhat.IsNull()) return NULL; + + //Fill array of indices + Handle(TColStd_HArray1OfInteger) aModifiedArray; + + Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction(); + + TopTools_IndexedMapOfShape aWhereIndices; + TopExp::MapShapes(aWhere, aWhereIndices); + + if (aWhereIndices.Contains(aWhat)) { + + // entity was not changed by the operation + Standard_Integer aWhatIndex = aWhereIndices.FindIndex(aWhat); + aModifiedArray = new TColStd_HArray1OfInteger(1,1); + aModifiedArray->SetValue(1, aWhatIndex); + + } else { + + TDF_Label aHistoryLabel = aWhereFunction->GetHistoryEntry(Standard_False); + if (aHistoryLabel.IsNull()) { + SetErrorCode("Modifications history does not exist for the shape under consideration."); + return NULL; + } + + // search in history for all argument shapes + Standard_Boolean isFound = Standard_False; + + TDF_LabelSequence aLabelSeq; + aWhereFunction->GetDependency(aLabelSeq); + Standard_Integer nbArg = aLabelSeq.Length(); + + for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) { + + TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); + + Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); + TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); + + TopTools_IndexedMapOfShape anArgumentIndices; + TopExp::MapShapes(anArgumentShape, anArgumentIndices); + + if (anArgumentIndices.Contains(aWhat)) { + isFound = Standard_True; + Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(aWhat); + + // Find corresponding label in history + TDF_Label anArgumentHistoryLabel = + aWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False); + if (anArgumentHistoryLabel.IsNull()) { + // Lost History of operation argument. Possibly, all its entities was removed. + SetErrorCode(OK); + return NULL; + } + + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False); + if (aWhatHistoryLabel.IsNull()) { + // Removed entity + SetErrorCode(OK); + return NULL; + } + + Handle(TDataStd_IntegerArray) anIntegerArray; + if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) { + SetErrorCode("Error: Empty modifications history for the sought shape."); + return NULL; + } + + aModifiedArray = anIntegerArray->Array(); + if (aModifiedArray->Length() == 0) { + SetErrorCode("Error: Empty modifications history for the sought shape."); + return NULL; + } + } + } + + if (!isFound) { + SetErrorCode("The sought shape does not belong to any operation argument."); + return NULL; + } + } + + //Add a new object + Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); + + if (aModifiedArray->Length() > 1) { + //Set a GROUP type + aResult->SetType(GEOM_GROUP); + + //Set a sub shape type + TDF_Label aFreeLabel = aResult->GetFreeLabel(); + TopAbs_ShapeEnum aShapeType = aWhat.ShapeType(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType); + } + + //Make a Python command + Handle(GEOM_Function) aFunction = aResult->GetFunction(1); + + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace(" + << theShapeWhere << ", " << theShapeWhat << ")"; + + SetErrorCode(OK); + return aResult; +} + +//======================================================================= +//function : SortShapes +//purpose : +//======================================================================= +void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL) +{ + Standard_Integer MaxShapes = SL.Extent(); + TopTools_Array1OfShape aShapes (1,MaxShapes); + TColStd_Array1OfInteger OrderInd(1,MaxShapes); + TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z; + TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z; + + // Computing of CentreOfMass + Standard_Integer Index; + GProp_GProps GPr; + gp_Pnt GPoint; + TopTools_ListIteratorOfListOfShape it(SL); + for (Index=1; it.More(); Index++) + { + TopoDS_Shape S = it.Value(); + SL.Remove( it ); // == it.Next() + aShapes(Index) = S; + OrderInd.SetValue (Index, Index); + if (S.ShapeType() == TopAbs_VERTEX) + { + GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S )); + Length.SetValue( Index, (Standard_Real) S.Orientation()); + } + else + { + BRepGProp::LinearProperties (S, GPr); + GPoint = GPr.CentreOfMass(); + Length.SetValue( Index, GPr.Mass() ); + } + MidXYZ.SetValue(Index, + GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9); + } + // Sorting + Standard_Integer aTemp; + Standard_Boolean exchange, Sort = Standard_True; + while (Sort) + { + Sort = Standard_False; + for (Index=1; Index < MaxShapes; Index++) + { + if (MidXYZ(OrderInd(Index)) > MidXYZ(OrderInd(Index+1))) + exchange = Standard_True; + else if (MidXYZ(OrderInd(Index)) == MidXYZ(OrderInd(Index+1)) && + Length(OrderInd(Index)) > Length(OrderInd(Index+1)) ) + exchange = Standard_True; + else + exchange = Standard_False; + if (exchange) + { + aTemp = OrderInd(Index); + OrderInd(Index) = OrderInd(Index+1); + OrderInd(Index+1) = aTemp; + Sort = Standard_True; + } + } + } + for (Index=1; Index <= MaxShapes; Index++) + SL.Append( aShapes( OrderInd(Index) )); +} + +//======================================================================= +//function : CheckTriangulation +//purpose : +//======================================================================= +bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape) +{ +// MESSAGE("CheckTriangulation"); +// +// OSD_Timer timer1; +// timer1.Start(); + + TopExp_Explorer exp (aShape, TopAbs_FACE); + if (!exp.More()) { + SetErrorCode("Shape without faces given"); + return false; + } + + TopLoc_Location aTopLoc; + Handle(Poly_Triangulation) aTRF; + aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc); + if (aTRF.IsNull()) { + // calculate deflection + Standard_Real aDeviationCoefficient = 0.001; + + Bnd_Box B; + BRepBndLib::Add(aShape, B); + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + + Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin; + Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4; + +// MESSAGE("Deflection = " << aDeflection); + + Standard_Real aHLRAngle = 0.349066; + + BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle); + } +// timer1.Stop(); +// timer1.Show(); + + return true; +} diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx new file mode 100644 index 000000000..82a7d37e0 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -0,0 +1,284 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_IShapesOperations_HXX_ +#define _GEOMImpl_IShapesOperations_HXX_ + +#include "GEOM_IOperations.hxx" + +#include "GEOMAlgo_State.hxx" + +#include +#include +#include + +#include +#include + +class GEOM_Engine; +class Handle(GEOM_Object); +class Handle(TColStd_HArray1OfInteger); + +class GEOMImpl_IShapesOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IShapesOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) MakeWire (list theEdgesAndWires); + + Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted); + + Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (list theWires, + const bool isPlanarWanted); + + Standard_EXPORT Handle(GEOM_Object) MakeShell (list theShapes); + + Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); + + Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (list theShells); + + Standard_EXPORT Handle(GEOM_Object) MakeCompound (list theShapes); + + Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + const Standard_Boolean isSorted); + + Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape, + const Standard_Integer theID); + + Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape); + Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape); + + Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + const Standard_Integer theShapeType); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAx1, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theAxis, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theCenter, + const Standard_Real theRadius, + const GEOMAlgo_State theState); + + /*! + * \brief Find subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) + GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState); + + /*! + * \brief Find IDs of subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) + GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState); + + Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + Handle(GEOM_Object) theAxis, + const Standard_Real theRadius); + + Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape, + const Standard_Integer theShapeType, + Handle(GEOM_Object) theCenter, + const Standard_Real theRadius); + + Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat); + + Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL); + + private: + Handle(GEOM_Object) MakeShape (list theShapes, + const Standard_Integer theObjectType, + const Standard_Integer theFunctionType, + const TCollection_AsciiString& theMethodName); + +// ---------------------------------------------------- + // methods common for all GetShapesOnXXX() functions +// ---------------------------------------------------- + + bool CheckTriangulation (const TopoDS_Shape& aShape); + + /*! + * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK + * \param theShapeType - the shape type to check + * \retval bool - result of the check + */ + bool checkTypeShapesOn(const Standard_Integer theShapeType); + + /*! + * \brief Creates Geom_Plane + * \param theAx1 - edge defining plane normal + * \retval Handle(Geom_Surface) - resulting surface + */ + Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1); + + /*! + * \brief Creates Geom_CylindricalSurface + * \param theAx1 - edge defining cylinder axis + * \param theRadius - cylinder radius + * \retval Handle(Geom_Surface) - resulting surface + */ + Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1, + const Standard_Real theRadius); + + /*! + * \brief Find IDs of subshapes complying with given status about surface + * \param theSurface - the surface to check state of subshapes against + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ + Handle(TColStd_HSequenceOfInteger) + getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface, + const TopoDS_Shape& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState); + + /*! + * \brief Find subshapes complying with given status about surface + * \param theSurface - the surface to check state of subshapes against + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theState - required state + * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ + Handle(TColStd_HSequenceOfTransient) + getShapesOnSurface(const Handle(Geom_Surface)& theSurface, + const Handle(GEOM_Object)& theShape, + TopAbs_ShapeEnum theShapeType, + GEOMAlgo_State theState, + TCollection_AsciiString & theShapeEntries + ); + + /*! + * \brief Find IDs of subshapes complying with given status about quadrangle + * \param theShape - the shape to explore + * \param theShapeType - type of subshape of theShape + * \param theTopLeftPoint - top left quadrangle corner + * \param theTopRigthPoint - top right quadrangle corner + * \param theBottomLeftPoint - bottom left quadrangle corner + * \param theBottomRigthPoint - bottom right quadrangle corner + * \param theState - required state + * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes + */ + Handle(TColStd_HSequenceOfInteger) + getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape, + const Standard_Integer theShapeType, + const Handle(GEOM_Object)& theTopLeftPoint, + const Handle(GEOM_Object)& theTopRigthPoint, + const Handle(GEOM_Object)& theBottomLeftPoint, + const Handle(GEOM_Object)& theBottomRigthPoint, + const GEOMAlgo_State theState); + + /*! + * \brief Find shape objects and their entries by their ids + * \param theShape - the main shape + * \param theShapeIDs - theShapeIDs - incoming shape ids + * \param theShapeEntries - outgoing entries like "entry1, entry2, ..." + * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects + */ + Handle(TColStd_HSequenceOfTransient) + getObjectsShapesOn(const Handle(GEOM_Object)& theShape, + const Handle(TColStd_HSequenceOfInteger)& theShapeIDs, + TCollection_AsciiString & theShapeEntries); + + /*! + * \brief Select the object created last + * \param theObj1 - Object 1 + * \param theObj2 - Object 2 + * \retval Handle(GEOM_Object) - selected object + */ + static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1, + const Handle(GEOM_Object)& theObj2); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ISketcher.hxx b/src/GEOMImpl/GEOMImpl_ISketcher.hxx new file mode 100644 index 000000000..e2149c82f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ISketcher.hxx @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an interface to a function for the Sketcher creation. + + +#include "GEOM_Function.hxx" + +#define SKETCH_ARG_CMD 1 +#define SKETCH_ARG_DOUBLE 2 +#define SKETCH_ARG_WPLANE 12 + +class GEOMImpl_ISketcher +{ + public: + + GEOMImpl_ISketcher(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetCommand(const TCollection_AsciiString& theCommand) + { _func->SetString(SKETCH_ARG_CMD, theCommand); } + + TCollection_AsciiString GetCommand() { return _func->GetString(SKETCH_ARG_CMD); } + + void SetWorkingPlane(int theInd, double theValue) + { _func->SetReal(SKETCH_ARG_DOUBLE + theInd, theValue); } + + double GetWorkingPlane(int theInd) { return _func->GetReal(SKETCH_ARG_DOUBLE + theInd); } + + void SetWorkingPlane(Handle(GEOM_Function) thePlane) + { _func->SetReference(SKETCH_ARG_WPLANE, thePlane); } + + Handle(GEOM_Function) GetWorkingPlane() { return _func->GetReference(SKETCH_ARG_WPLANE); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ISphere.hxx b/src/GEOMImpl/GEOMImpl_ISphere.hxx new file mode 100644 index 000000000..ce426bfdf --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ISphere.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Sphere creation. + + +#include "GEOM_Function.hxx" + +#define SPH_ARG_R 1 +#define SPH_ARG_PNT 4 + +class GEOMImpl_ISphere +{ + public: + + GEOMImpl_ISphere(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetR(double theR) { _func->SetReal(SPH_ARG_R, theR); } + + double GetR() { return _func->GetReal(SPH_ARG_R); } + + void SetPoint(Handle(GEOM_Function) theRefPoint) { _func->SetReference(SPH_ARG_PNT, theRefPoint); } + + Handle(GEOM_Function) GetPoint() { return _func->GetReference(SPH_ARG_PNT); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ISpline.hxx b/src/GEOMImpl/GEOMImpl_ISpline.hxx new file mode 100644 index 000000000..fcb9b462d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ISpline.hxx @@ -0,0 +1,45 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Spline creation. + + +#include "GEOM_Function.hxx" + +#define SPL_ARG_LENG 1 +#define SPL_ARG_LAST 1 + +class GEOMImpl_ISpline +{ + public: + + GEOMImpl_ISpline(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); } + + void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); } + + int GetLength() { return _func->GetInteger(SPL_ARG_LENG); } + + Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ITorus.hxx b/src/GEOMImpl/GEOMImpl_ITorus.hxx new file mode 100644 index 000000000..39b417f7e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITorus.hxx @@ -0,0 +1,51 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Torus creation. + + +#include "GEOM_Function.hxx" + +#define TORUS_ARG_CC 1 +#define TORUS_ARG_VV 2 +#define TORUS_ARG_RMAJ 3 +#define TORUS_ARG_RMIN 4 + +class GEOMImpl_ITorus +{ + public: + + GEOMImpl_ITorus(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(TORUS_ARG_CC, theP); } + void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(TORUS_ARG_VV, theV); } + + void SetRMajor(double theR) { _func->SetReal(TORUS_ARG_RMAJ, theR); } + void SetRMinor(double theR) { _func->SetReal(TORUS_ARG_RMIN, theR); } + + Handle(GEOM_Function) GetCenter() { return _func->GetReference(TORUS_ARG_CC); } + Handle(GEOM_Function) GetVector() { return _func->GetReference(TORUS_ARG_VV); } + + double GetRMajor() { return _func->GetReal(TORUS_ARG_RMAJ); } + double GetRMinor() { return _func->GetReal(TORUS_ARG_RMIN); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx new file mode 100644 index 000000000..16885bcc3 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -0,0 +1,1329 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID) +: GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations() +{ + MESSAGE("GEOMImpl_ITransformOperations::~GEOMImpl_ITransformOperations"); +} + + +//============================================================================= +/*! + * TranslateTwoPoints + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + // Get last functions of the arguments + Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction(); + Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction(); + + //Add a translate function + aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI (aFunction); + aTI.SetPoint1(aP1F); + aTI.SetPoint2(aP2F); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateTwoPoints(" + << theObject << ", " << thePoint1 << ", " << thePoint2 << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * TranslateDXDYDZ + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ + (Handle(GEOM_Object) theObject, double theX, double theY, double theZ) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a translate function + aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetDX(theX); + aTI.SetDY(theY); + aTI.SetDZ(theZ); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ(" + << theObject << ", " << theX << ", " << theY << ", " << theZ << ")"; + + SetErrorCode(OK); + return theObject; +} + + +//============================================================================= +/*! + * TranslateTwoPointsCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_TWO_POINTS_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetPoint1(thePoint1->GetLastFunction()); + aTI.SetPoint2(thePoint2->GetLastFunction()); + //aTI.SetShape(theObject->GetValue()); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints(" + << theObject << ", " << thePoint1 << ", " << thePoint2 << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * TranslateDXDYDZCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy + (Handle(GEOM_Object) theObject, double theX, double theY, double theZ) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_XYZ_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetDX(theX); + aTI.SetDY(theY); + aTI.SetDZ(theZ); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation(" + << theObject << ", " << theX << ", " << theY << ", " << theZ << ")"; + + SetErrorCode(OK); + return aCopy; +} + + +//============================================================================= +/*! + * TranslateVector + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theVector.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + // Get last functions of the arguments + Handle(GEOM_Function) aVF = theVector->GetLastFunction(); + + //Add a translate function + aFunction = theObject->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI (aFunction); + aTI.SetVector(aVF); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVector(" + << theObject << ", " << theVector << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * TranslateVectorCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theVector.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetVector(theVector->GetLastFunction()); +// aTI.SetShape(theObject->GetValue()); + aTI.SetOriginal(aLastFunction); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector(" + << theObject << ", " << theVector << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Translate1D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, + double theStep, Standard_Integer theNbTimes) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theVector.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_1D); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetVector(theVector->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + aTI.SetStep1(theStep); + aTI.SetNbIter1(theNbTimes); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D(" + << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Translate2D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theVector, + double theStep1, + Standard_Integer theNbTimes1, + Handle(GEOM_Object) theVector2, + double theStep2, + Standard_Integer theNbTimes2) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theVector.IsNull() || theVector2.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a translate function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_2D); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL; + + GEOMImpl_ITranslate aTI(aFunction); + aTI.SetVector(theVector->GetLastFunction()); + aTI.SetVector2(theVector2->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + aTI.SetStep1(theStep1); + aTI.SetNbIter1(theNbTimes1); + aTI.SetStep2(theStep2); + aTI.SetNbIter2(theNbTimes2); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Translation driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D(" + << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1 + << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")"; + + SetErrorCode(OK); + return aCopy; +} + + +//============================================================================= +/*! + * MirrorPlane + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePlane.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + // Get last functions of the arguments + Handle(GEOM_Function) aPF = thePlane->GetLastFunction(); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetPlane(aPF); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPlane(" + << theObject << ", " << thePlane << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * MirrorPlaneCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePlane) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePlane.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_PLANE_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetPlane(thePlane->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane(" + << theObject << ", " << thePlane << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * MirrorPoint + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + // Get last functions of the arguments + Handle(GEOM_Function) aPF = thePoint->GetLastFunction(); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetPoint(aPF); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPoint(" + << theObject << ", " << thePoint << ")"; + + SetErrorCode(OK); + return NULL; +} + +//============================================================================= +/*! + * MirrorPointCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_POINT_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetPoint(thePoint->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint(" + << theObject << ", " << thePoint << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * MirrorAxis + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + // Get last functions of the arguments + Handle(GEOM_Function) anAF = theAxis->GetLastFunction(); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetAxis(anAF); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorAxis(" + << theObject << ", " << theAxis << ")"; + + SetErrorCode(OK); + return NULL; +} + +//============================================================================= +/*! + * MirrorAxisCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a mirror function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_MirrorDriver::GetID(), MIRROR_AXIS_COPY); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_MirrorDriver::GetID()) return NULL; + + GEOMImpl_IMirror aTI (aFunction); + aTI.SetAxis(theAxis->GetLastFunction()); + aTI.SetOriginal(aLastFunction); + + //Compute the mirror + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Mirror driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis(" + << theObject << ", " << theAxis << ")"; + + SetErrorCode(OK); + return aCopy; +} + + +//============================================================================= +/*! + * OffsetShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape + (Handle(GEOM_Object) theObject, double theOffset) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset + + //Add a new Offset function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL; + + GEOMImpl_IOffset aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetValue(theOffset); + + //Compute the offset + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Offset driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.OffsetShape(" + << theObject << ", " << theOffset << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * OffsetShapeCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy + (Handle(GEOM_Object) theObject, double theOffset) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a new Offset function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_SHAPE_COPY); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL; + + GEOMImpl_IOffset aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetValue(theOffset); + + //Compute the offset + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Offset driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset(" + << theObject << ", " << theOffset << ")"; + + SetErrorCode(OK); + return aCopy; +} + + +//============================================================================= +/*! + * ScaleShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled + + // Get last functions of the arguments + Handle(GEOM_Function) aPF = thePoint->GetLastFunction(); + + //Add a scale function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL; + + GEOMImpl_IScale aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetPoint(aPF); + aTI.SetFactor(theFactor); + + //Compute the scale + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Scale driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShape(" + << theObject << ", " << thePoint << ", " << theFactor << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * ScaleShapeCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePoint, double theFactor) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || thePoint.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a scale function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_COPY); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ScaleDriver::GetID()) return NULL; + + GEOMImpl_IScale aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetPoint(thePoint->GetLastFunction()); + aTI.SetFactor(theFactor); + + //Compute the scale + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Scale driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform(" + << theObject << ", " << thePoint << ", " << theFactor << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * PositionShape + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position + + // Get last functions of the arguments + Handle(GEOM_Function) aStartLCS = theStartLCS->GetLastFunction(); + Handle(GEOM_Function) aEndLCS = theEndLCS->GetLastFunction(); + + //Add a Position function + Handle(GEOM_Function) aFunction = + theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL; + + GEOMImpl_IPosition aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetStartLCS(aStartLCS); + aTI.SetEndLCS(aEndLCS); + + //Compute the Position + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Position driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionShape(" + << theObject << ", " << theStartLCS << ", " << theEndLCS << ")"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * PositionShapeCopy + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy + (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theStartLCS, Handle(GEOM_Object) theEndLCS) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a position function + Handle(GEOM_Function) aFunction = + aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE_COPY); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL; + + GEOMImpl_IPosition aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetStartLCS(theStartLCS->GetLastFunction()); + aTI.SetEndLCS(theEndLCS->GetLastFunction()); + + //Compute the position + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Position driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition(" + << theObject << ", " << theStartLCS << ", " << theEndLCS << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Rotate + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis, + double theAngle) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated + + // Get last functions of the arguments + Handle(GEOM_Function) anAF = theAxis->GetLastFunction(); + + //Add a rotate function + aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL; + + GEOMImpl_IRotate aRI(aFunction); + aRI.SetAxis(anAF); + aRI.SetOriginal(aLastFunction); + aRI.SetAngle(theAngle); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Rotate driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject + << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + + SetErrorCode(OK); + return theObject; +} + +//============================================================================= +/*! + * Rotate + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a rotate function + aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL; + + GEOMImpl_IRotate aRI(aFunction); + aRI.SetAxis(theAxis->GetLastFunction()); + aRI.SetOriginal(aLastFunction); + aRI.SetAngle(theAngle); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Rotate driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject + << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Rotate1D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis, + Standard_Integer theNbTimes) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a rotate function + aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL; + + GEOMImpl_IRotate aRI(aFunction); + aRI.SetOriginal(aLastFunction); + aRI.SetAxis(theAxis->GetLastFunction()); + aRI.SetNbIter1(theNbTimes); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Rotate driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1D(" + << theObject << ", " << theAxis << ", " << theNbTimes << ")"; + + SetErrorCode(OK); + return aCopy; +} + +//============================================================================= +/*! + * Rotate2D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis, + double theAngle, + Standard_Integer theNbTimes1, + double theStep, + Standard_Integer theNbTimes2) +{ + SetErrorCode(KO); + + if (theObject.IsNull() || theAxis.IsNull()) return NULL; + + Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction(); + if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated + + //Add a new Copy object + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + + //Add a rotate function + aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL; + + GEOMImpl_IRotate aRI(aFunction); + aRI.SetAxis(theAxis->GetLastFunction()); + aRI.SetOriginal(aLastFunction); + aRI.SetNbIter1(theNbTimes1); + aRI.SetNbIter2(theNbTimes2); + aRI.SetAngle(theAngle); + aRI.SetStep(theStep); + + //Compute the translation + try { + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Rotate driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2D(" + << theObject << ", " << theAxis << ", " << theAngle << ", " + << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")"; + + SetErrorCode(OK); + return aCopy; +} diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx new file mode 100644 index 000000000..701e65690 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx @@ -0,0 +1,112 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOMImpl_ITransformOperations_HXX_ +#define _GEOMImpl_ITransformOperations_HXX_ + +#include "Utils_SALOME_Exception.hxx" +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" +#include + +class GEOMImpl_ITransformOperations : public GEOM_IOperations { + public: + Standard_EXPORT GEOMImpl_ITransformOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_ITransformOperations(); + + Standard_EXPORT Handle(GEOM_Object) TranslateTwoPoints (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) TranslateTwoPointsCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + + Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZ (Handle(GEOM_Object) theObject, double theX, double theY, double theZ); + + Standard_EXPORT Handle(GEOM_Object) TranslateDXDYDZCopy (Handle(GEOM_Object) theObject, double theX, double theY, double theZ); + + Standard_EXPORT Handle(GEOM_Object) TranslateVector (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theVector); + + Standard_EXPORT Handle(GEOM_Object) TranslateVectorCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theVector); + + Standard_EXPORT Handle(GEOM_Object) Translate1D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep, Standard_Integer theNbTimes); + + Standard_EXPORT Handle(GEOM_Object) Translate2D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theVector, double theStep1, Standard_Integer theNbTimes1, + Handle(GEOM_Object) theVector2, double theStep2, Standard_Integer theNbTimes2); + + Standard_EXPORT Handle(GEOM_Object) MirrorPlane (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePlane); + + Standard_EXPORT Handle(GEOM_Object) MirrorPlaneCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePlane); + + Standard_EXPORT Handle(GEOM_Object) MirrorAxis (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis); + + Standard_EXPORT Handle(GEOM_Object) MirrorAxisCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis); + + Standard_EXPORT Handle(GEOM_Object) MirrorPoint (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint); + + Standard_EXPORT Handle(GEOM_Object) MirrorPointCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint); + + Standard_EXPORT Handle(GEOM_Object) OffsetShape (Handle(GEOM_Object) theObject, + double theOffset); + + Standard_EXPORT Handle(GEOM_Object) OffsetShapeCopy (Handle(GEOM_Object) theObject, + double theOffset); + + Standard_EXPORT Handle(GEOM_Object) ScaleShape (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint, + double theFactor); + + Standard_EXPORT Handle(GEOM_Object) ScaleShapeCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) thePoint, + double theFactor); + + Standard_EXPORT Handle(GEOM_Object) PositionShape (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theStartLCS, + Handle(GEOM_Object) theEndLCS); + + Standard_EXPORT Handle(GEOM_Object) PositionShapeCopy (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theStartLCS, + Handle(GEOM_Object) theEndLCS); + + Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle); + + Standard_EXPORT Handle(GEOM_Object) RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle); + + Standard_EXPORT Handle(GEOM_Object) Rotate1D (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, Standard_Integer theNbTimes); + + Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject, + Handle(GEOM_Object) theAxis, + double theAngle, + Standard_Integer theNbTimes1, + double theStep, + Standard_Integer theNbTimes2); +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ITranslate.hxx b/src/GEOMImpl/GEOMImpl_ITranslate.hxx new file mode 100755 index 000000000..054b8530c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ITranslate.hxx @@ -0,0 +1,95 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the Translate creation. + + +#include "GEOM_Function.hxx" + +#define TRANSLATE_ARG_POINT1 1 +#define TRANSLATE_ARG_POINT2 2 +#define TRANSLATE_ARG_VECTOR 3 +#define TRANSLATE_ARG_ORIGINAL 6 +#define TRANSLATE_ARG_STEP1 7 +#define TRANSLATE_ARG_NBITER1 8 +#define TRANSLATE_ARG_STEP2 9 +#define TRANSLATE_ARG_NBITER2 10 +#define TRANSLATE_ARG_VECTOR2 11 +#define TRANSLATE_ARG_DX 12 +#define TRANSLATE_ARG_DY 13 +#define TRANSLATE_ARG_DZ 14 + +class GEOMImpl_ITranslate +{ + public: + + GEOMImpl_ITranslate(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetPoint1(Handle(GEOM_Function) thePoint1) { _func->SetReference(TRANSLATE_ARG_POINT1, thePoint1); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(TRANSLATE_ARG_POINT1); } + + void SetPoint2(Handle(GEOM_Function) thePoint2) { _func->SetReference(TRANSLATE_ARG_POINT2, thePoint2); } + + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(TRANSLATE_ARG_POINT2); } + + void SetVector(Handle(GEOM_Function) theVector) { _func->SetReference(TRANSLATE_ARG_VECTOR, theVector); } + + Handle(GEOM_Function) GetVector() { return _func->GetReference(TRANSLATE_ARG_VECTOR); } + + void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(TRANSLATE_ARG_ORIGINAL, theOriginal); } + + Handle(GEOM_Function) GetOriginal() { return _func->GetReference(TRANSLATE_ARG_ORIGINAL); } + + void SetStep1(double theStep) { return _func->SetReal(TRANSLATE_ARG_STEP1, theStep); } + + double GetStep1() { return _func->GetReal(TRANSLATE_ARG_STEP1); } + + void SetNbIter1(int theNbIter) { _func->SetInteger(TRANSLATE_ARG_NBITER1, theNbIter); } + + int GetNbIter1() { return _func->GetInteger(TRANSLATE_ARG_NBITER1); } + + void SetStep2(double theStep) { return _func->SetReal(TRANSLATE_ARG_STEP2, theStep); } + + double GetStep2() { return _func->GetReal(TRANSLATE_ARG_STEP2); } + + void SetNbIter2(int theNbIter) { _func->SetInteger(TRANSLATE_ARG_NBITER2, theNbIter); } + + int GetNbIter2() { return _func->GetInteger(TRANSLATE_ARG_NBITER2); } + + void SetVector2(Handle(GEOM_Function) theVector) { _func->SetReference(TRANSLATE_ARG_VECTOR2, theVector); } + + Handle(GEOM_Function) GetVector2() { return _func->GetReference(TRANSLATE_ARG_VECTOR2); } + + void SetDX(double theDX) { return _func->SetReal(TRANSLATE_ARG_DX, theDX); } + + double GetDX() { return _func->GetReal(TRANSLATE_ARG_DX); } + + void SetDY(double theDY) { return _func->SetReal(TRANSLATE_ARG_DY, theDY); } + + double GetDY() { return _func->GetReal(TRANSLATE_ARG_DY); } + + void SetDZ(double theDZ) { return _func->SetReal(TRANSLATE_ARG_DZ, theDZ); } + + double GetDZ() { return _func->GetReal(TRANSLATE_ARG_DZ); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_IVector.hxx b/src/GEOMImpl/GEOMImpl_IVector.hxx new file mode 100644 index 000000000..2214d7dfa --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IVector.hxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//NOTE: This is an intreface to a function for the vector creation. + + +#include "GEOM_Function.hxx" + +#define VEC_ARG_DX 1 +#define VEC_ARG_DY 2 +#define VEC_ARG_DZ 3 + +#define VEC_ARG_PNT1 4 +#define VEC_ARG_PNT2 5 + +class GEOMImpl_IVector +{ + public: + + GEOMImpl_IVector(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetDX(double theDX) { _func->SetReal(VEC_ARG_DX, theDX); } + void SetDY(double theDY) { _func->SetReal(VEC_ARG_DY, theDY); } + void SetDZ(double theDZ) { _func->SetReal(VEC_ARG_DZ, theDZ); } + + double GetDX() { return _func->GetReal(VEC_ARG_DX); } + double GetDY() { return _func->GetReal(VEC_ARG_DY); } + double GetDZ() { return _func->GetReal(VEC_ARG_DZ); } + + void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(VEC_ARG_PNT1, theRef); } + void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(VEC_ARG_PNT2, theRef); } + + Handle(GEOM_Function) GetPoint1() { return _func->GetReference(VEC_ARG_PNT1); } + Handle(GEOM_Function) GetPoint2() { return _func->GetReference(VEC_ARG_PNT2); } + + private: + + Handle(GEOM_Function) _func; +}; diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx new file mode 100644 index 000000000..e7c263c72 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx @@ -0,0 +1,162 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include "utilities.h" + +#include + +#include +#include + +#ifdef WNT +#include +#else +#include +#endif + +#ifdef WNT +#define LibHandle HMODULE +#define LoadLib( name ) LoadLibrary( name ) +#define GetProc GetProcAddress +#define UnLoadLib( handle ) FreeLibrary( handle ); +#else +#define LibHandle void* +#define LoadLib( name ) dlopen( name, RTLD_LAZY ) +#define GetProc dlsym +#define UnLoadLib( handle ) dlclose( handle ); +#endif + +typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&, TCollection_AsciiString&); + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ImportDriver::GetID() +{ + static Standard_GUID aImportDriver("FF1BBB60-5D14-4df2-980B-3A668264EA16"); + return aImportDriver; +} + + +//======================================================================= +//function : GEOMImpl_ImportDriver +//purpose : +//======================================================================= +GEOMImpl_ImportDriver::GEOMImpl_ImportDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IImportExport aCI (aFunction); + //Standard_Integer aType = aFunction->GetType(); + + // retrieve the file and plugin library names + TCollection_AsciiString aFileName = aCI.GetFileName(); + TCollection_AsciiString aLibName = aCI.GetPluginName(); + if (aFileName.IsEmpty() || aLibName.IsEmpty()) + return 0; + + // load plugin library + LibHandle anImportLib = LoadLib( aLibName.ToCString() ); + funcPoint fp = 0; + if ( anImportLib ) + fp = (funcPoint)GetProc( anImportLib, "Import" ); + + if ( !fp ) + return 0; + + // perform the import + TCollection_AsciiString anError; + TopoDS_Shape aShape = fp( aFileName, anError ); + + // unload plugin library + UnLoadLib( anImportLib ); + + if ( aShape.IsNull() ) { + StdFail_NotDone::Raise(anError.ToCString()); + return 0; + } + + // set the function result + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ImportDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ImportDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ImportDriver", + sizeof(GEOMImpl_ImportDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ImportDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ImportDriver))) { + _anOtherObject = Handle(GEOMImpl_ImportDriver)((Handle(GEOMImpl_ImportDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx new file mode 100644 index 000000000..0d07a34fa --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ImportDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ImportDriver_HeaderFile +#define _GEOMImpl_ImportDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ImportDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ImportDriver); + +class Handle(GEOMImpl_ImportDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ImportDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ImportDriver)(const Handle(GEOMImpl_ImportDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ImportDriver)(const GEOMImpl_ImportDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ImportDriver)& operator=(const Handle(GEOMImpl_ImportDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ImportDriver)& operator=(const GEOMImpl_ImportDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ImportDriver* operator->() + { + return (GEOMImpl_ImportDriver *)ControlAccess(); + } + + GEOMImpl_ImportDriver* operator->() const + { + return (GEOMImpl_ImportDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ImportDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ImportDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ImportDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ImportDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ImportDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ImportDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ImportDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ImportDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.cxx b/src/GEOMImpl/GEOMImpl_LineDriver.cxx new file mode 100644 index 000000000..10cfec55c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_LineDriver.cxx @@ -0,0 +1,174 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_LineDriver::GetID() +{ + static Standard_GUID aLineDriver("FF1BBB06-5D14-4df2-980B-3A668264EA16"); + return aLineDriver; +} + + +//======================================================================= +//function : GEOMImpl_LineDriver +//purpose : +//======================================================================= +GEOMImpl_LineDriver::GEOMImpl_LineDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ILine aPI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == LINE_TWO_PNT) { + Handle(GEOM_Function) aRefPnt1 = aPI.GetPoint1(); + Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2(); + TopoDS_Shape aShape1 = aRefPnt1->GetValue(); + TopoDS_Shape aShape2 = aRefPnt2->GetValue(); + if (aShape1.ShapeType() != TopAbs_VERTEX || + aShape2.ShapeType() != TopAbs_VERTEX) return 0; + if (aShape1.IsSame(aShape2)) { + Standard_ConstructionError::Raise("The end points must be different"); + } + gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + if (P1.Distance(P2) < Precision::Confusion()) { + Standard_ConstructionError::Raise("The end points are too close"); + } + aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + + } else if (aType == LINE_PNT_DIR) { + Handle(GEOM_Function) aRefPnt = aPI.GetPoint1(); + Handle(GEOM_Function) aRefDir = aPI.GetPoint2(); + TopoDS_Shape aShape1 = aRefPnt->GetValue(); + TopoDS_Shape aShape2 = aRefDir->GetValue(); + if (aShape1.ShapeType() != TopAbs_VERTEX || + aShape2.ShapeType() != TopAbs_EDGE) return 0; + if (aShape1.IsSame(aShape2)) { + Standard_ConstructionError::Raise("The end points must be different"); + } + gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + + TopoDS_Edge anE = TopoDS::Edge(aShape2); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_NullObject::Raise("Line creation aborted: vector is not defined"); + } + gp_Pnt PV1 = BRep_Tool::Pnt(V1); + gp_Pnt PV2 = BRep_Tool::Pnt(V2); + if (PV1.Distance(PV2) < Precision::Confusion()) { + Standard_ConstructionError::Raise("Vector with null magnitude"); + } + + gp_Pnt P2 (P1.XYZ() + PV2.XYZ() - PV1.XYZ()); + aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + aShape.Infinite(true); + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_LineDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_LineDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_LineDriver", + sizeof(GEOMImpl_LineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_LineDriver) Handle(GEOMImpl_LineDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_LineDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_LineDriver))) { + _anOtherObject = Handle(GEOMImpl_LineDriver)((Handle(GEOMImpl_LineDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.hxx b/src/GEOMImpl/GEOMImpl_LineDriver.hxx new file mode 100644 index 000000000..58480a781 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_LineDriver.hxx @@ -0,0 +1,157 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_LineDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_LineDriver_HeaderFile +#define _GEOMImpl_LineDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_LineDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_LineDriver); + +class Handle(GEOMImpl_LineDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_LineDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_LineDriver)(const Handle(GEOMImpl_LineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_LineDriver)(const GEOMImpl_LineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_LineDriver)& operator=(const Handle(GEOMImpl_LineDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_LineDriver)& operator=(const GEOMImpl_LineDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_LineDriver* operator->() + { + return (GEOMImpl_LineDriver *)ControlAccess(); + } + + GEOMImpl_LineDriver* operator->() const + { + return (GEOMImpl_LineDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_LineDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_LineDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_LineDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_LineDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_LineDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_LineDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_LineDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_LineDriver) == AType || TFunction_Driver::IsKind(AType)); } + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx new file mode 100644 index 000000000..041510ca7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx @@ -0,0 +1,160 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_MarkerDriver::GetID() +{ + static Standard_GUID aMarkerDriver("FF1BBB07-5D14-4df2-980B-3A668264EA16"); + return aMarkerDriver; +} + + +//======================================================================= +//function : GEOMImpl_MarkerDriver +//purpose : +//======================================================================= +GEOMImpl_MarkerDriver::GEOMImpl_MarkerDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_MarkerDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IMarker aPI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == MARKER_CS) { + double OX, OY, OZ; + double XDX, XDY, XDZ; + double YDX, YDY, YDZ; + aPI.GetOrigin(OX, OY, OZ); + aPI.GetXDir(XDX, XDY, XDZ); + aPI.GetYDir(YDX, YDY, YDZ); + + gp_Pnt aPO (OX, OY, OZ); + gp_Vec aVX (XDX, XDY, XDZ); + gp_Vec aVY (YDX, YDY, YDZ); + Standard_Real aTol = Precision::Confusion(); + if (aVX.Magnitude() < aTol || + aVY.Magnitude() < aTol || + aVX.IsParallel(aVY, Precision::Angular())) { + Standard_ConstructionError::Raise("Degenerated or parallel directions given"); + } + + gp_Vec aN = aVX ^ aVY; + gp_Ax3 anA (aPO, aN, aVX); + gp_Pln aPln (anA); + + double aTrimSize = 100.0; + aShape = BRepBuilderAPI_MakeFace(aPln, -aTrimSize, +aTrimSize, -aTrimSize, +aTrimSize).Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_MarkerDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_MarkerDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MarkerDriver", + sizeof(GEOMImpl_MarkerDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_MarkerDriver) Handle(GEOMImpl_MarkerDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_MarkerDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MarkerDriver))) { + _anOtherObject = Handle(GEOMImpl_MarkerDriver)((Handle(GEOMImpl_MarkerDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx new file mode 100644 index 000000000..822c996a1 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx @@ -0,0 +1,157 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_MarkerDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_MarkerDriver_HeaderFile +#define _GEOMImpl_MarkerDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_MarkerDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MarkerDriver); + +class Handle(GEOMImpl_MarkerDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_MarkerDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_MarkerDriver)(const Handle(GEOMImpl_MarkerDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_MarkerDriver)(const GEOMImpl_MarkerDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_MarkerDriver)& operator=(const Handle(GEOMImpl_MarkerDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_MarkerDriver)& operator=(const GEOMImpl_MarkerDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_MarkerDriver* operator->() + { + return (GEOMImpl_MarkerDriver *)ControlAccess(); + } + + GEOMImpl_MarkerDriver* operator->() const + { + return (GEOMImpl_MarkerDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_MarkerDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_MarkerDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_MarkerDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_MarkerDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_MarkerDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MarkerDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MarkerDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MarkerDriver) == AType || TFunction_Driver::IsKind(AType)); } + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx new file mode 100644 index 000000000..d92516814 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx @@ -0,0 +1,154 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_MeasureDriver::GetID() +{ + static Standard_GUID aMeasureDriver("FF1BBB65-5D14-4df2-980B-3A668264EA16"); + return aMeasureDriver; +} + + +//======================================================================= +//function : GEOMImpl_MeasureDriver +//purpose : +//======================================================================= +GEOMImpl_MeasureDriver::GEOMImpl_MeasureDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IMeasure aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == CDG_MEASURE) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull()) { + Standard_NullObject::Raise("Shape for centre of mass calculation is null"); + } + + GProp_GProps aSystem; + gp_Pnt aCenterMass; + + if (aShapeBase.ShapeType() == TopAbs_VERTEX) { + aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase)); + } else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(aShapeBase, aSystem); + aCenterMass = aSystem.CentreOfMass(); + } else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(aShapeBase, aSystem); + aCenterMass = aSystem.CentreOfMass(); + } else { + BRepGProp::VolumeProperties(aShapeBase, aSystem); + aCenterMass = aSystem.CentreOfMass(); + } + + aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape(); + + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_MeasureDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_MeasureDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MeasureDriver", + sizeof(GEOMImpl_MeasureDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_MeasureDriver) Handle(GEOMImpl_MeasureDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_MeasureDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MeasureDriver))) { + _anOtherObject = Handle(GEOMImpl_MeasureDriver)((Handle(GEOMImpl_MeasureDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx new file mode 100644 index 000000000..d708d1736 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_MeasureDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_MeasureDriver_HeaderFile +#define _GEOMImpl_MeasureDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_MeasureDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MeasureDriver); + +class Handle(GEOMImpl_MeasureDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_MeasureDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_MeasureDriver)(const Handle(GEOMImpl_MeasureDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_MeasureDriver)(const GEOMImpl_MeasureDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_MeasureDriver)& operator=(const Handle(GEOMImpl_MeasureDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_MeasureDriver)& operator=(const GEOMImpl_MeasureDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_MeasureDriver* operator->() + { + return (GEOMImpl_MeasureDriver *)ControlAccess(); + } + + GEOMImpl_MeasureDriver* operator->() const + { + return (GEOMImpl_MeasureDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_MeasureDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_MeasureDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_MeasureDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_MeasureDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_MeasureDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MeasureDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MeasureDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MeasureDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx new file mode 100644 index 000000000..cde05e64e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx @@ -0,0 +1,186 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_MirrorDriver::GetID() +{ + static Standard_GUID aMirrorDriver("FF1BBB57-5D14-4df2-980B-3A668264EA16"); + return aMirrorDriver; +} + + +//======================================================================= +//function : GEOMImpl_MirrorDriver +//purpose : +//======================================================================= + +GEOMImpl_MirrorDriver::GEOMImpl_MirrorDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_MirrorDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + if (aFunction.IsNull()) return 0; + + TopoDS_Shape aShape; + gp_Trsf aTrsf; + + GEOMImpl_IMirror TI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + Handle(GEOM_Function) anOriginalFunction = TI.GetOriginal(); + if (anOriginalFunction.IsNull()) return 0; + + TopoDS_Shape anOriginal = anOriginalFunction->GetValue(); + if (anOriginal.IsNull()) return 0; + + if (aType == MIRROR_PLANE || aType == MIRROR_PLANE_COPY) { + Handle(GEOM_Function) aPlane = TI.GetPlane(); + if (aPlane.IsNull()) return 0; + TopoDS_Shape aFaceShape = aPlane->GetValue(); + if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) return 0; + TopoDS_Face aFace = TopoDS::Face(aFaceShape); + + Handle(Geom_Surface) surf = BRep_Tool::Surface(aFace); + Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf); + const gp_Ax3 pos = myPlane->Position(); + const gp_Pnt loc = pos.Location(); /* location of the plane */ + const gp_Dir dir = pos.Direction(); /* Main direction of the plane (Z axis) */ + gp_Ax2 aPln (loc, dir); + aTrsf.SetMirror(aPln); + + } else if (aType == MIRROR_AXIS || aType == MIRROR_AXIS_COPY) { + Handle(GEOM_Function) anAxis = TI.GetAxis(); + if (anAxis.IsNull()) return 0; + TopoDS_Shape anAxisShape = anAxis->GetValue(); + if (anAxisShape.IsNull() || anAxisShape.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(anAxisShape); + + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex (anEdge)); + gp_Vec aV (aP1, aP2); + gp_Ax1 anAx1 (aP1, aV); + aTrsf.SetMirror(anAx1); + + } else if (aType == MIRROR_POINT || aType == MIRROR_POINT_COPY) { + Handle(GEOM_Function) aPoint = TI.GetPoint(); + if (aPoint.IsNull()) return 0; + TopoDS_Shape aVertexShape = aPoint->GetValue(); + if (aVertexShape.IsNull() || aVertexShape.ShapeType() != TopAbs_VERTEX) return 0; + TopoDS_Vertex aVertex = TopoDS::Vertex(aVertexShape); + + gp_Pnt aP = BRep_Tool::Pnt(aVertex); + aTrsf.SetMirror(aP); + } else { + return 0; + } + + BRepBuilderAPI_Transform aTransformation (anOriginal, aTrsf, Standard_False); + aShape = aTransformation.Shape(); + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_MirrorDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_MirrorDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MirrorDriver", + sizeof(GEOMImpl_MirrorDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_MirrorDriver) Handle(GEOMImpl_MirrorDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_MirrorDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MirrorDriver))) { + _anOtherObject = Handle(GEOMImpl_MirrorDriver)((Handle(GEOMImpl_MirrorDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx new file mode 100644 index 000000000..430e6199b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_MirrorDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_MirrorDriver_HeaderFile +#define _GEOMImpl_MirrorDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_MirrorDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MirrorDriver); + +class Handle(GEOMImpl_MirrorDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_MirrorDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_MirrorDriver)(const Handle(GEOMImpl_MirrorDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_MirrorDriver)(const GEOMImpl_MirrorDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_MirrorDriver)& operator=(const Handle(GEOMImpl_MirrorDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_MirrorDriver)& operator=(const GEOMImpl_MirrorDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_MirrorDriver* operator->() + { + return (GEOMImpl_MirrorDriver *)ControlAccess(); + } + + GEOMImpl_MirrorDriver* operator->() const + { + return (GEOMImpl_MirrorDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_MirrorDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_MirrorDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_MirrorDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_MirrorDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_MirrorDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MirrorDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MirrorDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MirrorDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx new file mode 100644 index 000000000..d0994f5df --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx @@ -0,0 +1,148 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_OffsetDriver::GetID() +{ + static Standard_GUID aOffsetDriver("FF1BBB51-5D14-4df2-980B-3A668264EA16"); + return aOffsetDriver; +} + + +//======================================================================= +//function : GEOMImpl_OffsetDriver +//purpose : +//======================================================================= +GEOMImpl_OffsetDriver::GEOMImpl_OffsetDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IOffset aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) { + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + Standard_Real anOffset = aCI.GetValue(); + Standard_Real aTol = Precision::Confusion(); + + if (Abs(anOffset) < aTol) { + TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value ("); + aMsg += TCollection_AsciiString(aTol); + aMsg += ")"; + StdFail_NotDone::Raise(aMsg.ToCString()); + } + + BRepOffsetAPI_MakeOffsetShape MO (aShapeBase, + aCI.GetValue(), + aTol); + if (MO.IsDone()) { + aShape = MO.Shape(); + } else { + StdFail_NotDone::Raise("Offset construction failed"); + } + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_OffsetDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_OffsetDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_OffsetDriver", + sizeof(GEOMImpl_OffsetDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_OffsetDriver) Handle(GEOMImpl_OffsetDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_OffsetDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_OffsetDriver))) { + _anOtherObject = Handle(GEOMImpl_OffsetDriver)((Handle(GEOMImpl_OffsetDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx new file mode 100644 index 000000000..04213c437 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_OffsetDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_OffsetDriver_HeaderFile +#define _GEOMImpl_OffsetDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_OffsetDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_OffsetDriver); + +class Handle(GEOMImpl_OffsetDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_OffsetDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_OffsetDriver)(const Handle(GEOMImpl_OffsetDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_OffsetDriver)(const GEOMImpl_OffsetDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_OffsetDriver)& operator=(const Handle(GEOMImpl_OffsetDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_OffsetDriver)& operator=(const GEOMImpl_OffsetDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_OffsetDriver* operator->() + { + return (GEOMImpl_OffsetDriver *)ControlAccess(); + } + + GEOMImpl_OffsetDriver* operator->() const + { + return (GEOMImpl_OffsetDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_OffsetDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_OffsetDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_OffsetDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_OffsetDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_OffsetDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_OffsetDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_OffsetDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_OffsetDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx new file mode 100644 index 000000000..f0ea483b2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -0,0 +1,288 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PartitionDriver::GetID() +{ + static Standard_GUID aPartitionDriver("FF1BBB22-5D14-4df2-980B-3A668264EA16"); + return aPartitionDriver; +} + + +//======================================================================= +//function : GEOMImpl_PartitionDriver +//purpose : +//======================================================================= +GEOMImpl_PartitionDriver::GEOMImpl_PartitionDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPartition aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + NMTAlgo_Splitter1 PS; + + if (aType == PARTITION_PARTITION) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetTools(); + Handle(TColStd_HSequenceOfTransient) aKeepIns = aCI.GetKeepIns(); + Handle(TColStd_HSequenceOfTransient) aRemIns = aCI.GetRemoveIns(); + Handle(TColStd_HArray1OfInteger) aMaterials = aCI.GetMaterials(); + Standard_Boolean DoRemoveWebs = !aMaterials.IsNull(); + + unsigned int ind, nbshapes = 0; + nbshapes += aShapes->Length() + aTools->Length(); + nbshapes += aKeepIns->Length() + aRemIns->Length(); + + TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes); + + // add object shapes that are in ListShapes; + for (ind = 1; ind <= aShapes->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("In Partition a shape is null"); + } + if (ShapesMap.Add(aShape_i)) { + PS.AddShape(aShape_i); + if (DoRemoveWebs) { + if (aMaterials->Length() >= ind) + PS.SetMaterial(aShape_i, aMaterials->Value(ind)); + } + } + } + + // add tool shapes that are in ListTools and not in ListShapes; + for (ind = 1; ind <= aTools->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aTools->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("In Partition a tool shape is null"); + } + if (!ShapesMap.Contains(aShape_i) && ToolsMap.Add(aShape_i)) + PS.AddTool(aShape_i); + } + + // add shapes that are in ListKeepInside, as object shapes; + for (ind = 1; ind <= aKeepIns->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aKeepIns->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("In Partition a Keep Inside shape is null"); + } + if (!ToolsMap.Contains(aShape_i) && ShapesMap.Add(aShape_i)) + PS.AddShape(aShape_i); + } + + // add shapes that are in ListRemoveInside, as object shapes; + for (ind = 1; ind <= aRemIns->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRemIns->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("In Partition a Remove Inside shape is null"); + } + if (!ToolsMap.Contains(aShape_i) && ShapesMap.Add(aShape_i)) + PS.AddShape(aShape_i); + } + + PS.Compute(); + PS.SetRemoveWebs(DoRemoveWebs); + PS.Build((TopAbs_ShapeEnum) aCI.GetLimit()); + + // suppress result outside of shapes in KInsideMap + for (ind = 1; ind <= aKeepIns->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aKeepIns->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + PS.KeepShapesInside(aShape_i); + } + + // suppress result inside of shapes in RInsideMap + for (ind = 1; ind <= aRemIns->Length(); ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRemIns->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + PS.RemoveShapesInside(aShape_i); + } + + } else if (aType == PARTITION_HALF) { + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + Handle(GEOM_Function) aRefPlane = aCI.GetPlane(); + TopoDS_Shape aShapeArg = aRefShape->GetValue(); + TopoDS_Shape aPlaneArg = aRefPlane->GetValue(); + + if (aShapeArg.IsNull() || aPlaneArg.IsNull()) { + Standard_NullObject::Raise("In Half Partition a shape or a plane is null"); + } + + // add object shapes that are in ListShapes; + PS.AddShape(aShapeArg); + + // add tool shapes that are in ListTools and not in ListShapes; + PS.AddTool(aPlaneArg); + + PS.Compute(); + PS.SetRemoveWebs(Standard_False); + PS.Build(aShapeArg.ShapeType()); + + } else { + } + + aShape = PS.Shape(); + if (aShape.IsNull()) return 0; + + if (!BRepAlgo::IsValid(aShape)) { + Standard_ConstructionError::Raise("Partition aborted : non valid shape result"); + } + + aFunction->SetValue(aShape); + + // Fill history to be used by GetInPlace functionality + TopTools_IndexedMapOfShape aResIndices; + TopExp::MapShapes(aShape, aResIndices); + + // history for all argument shapes + TDF_LabelSequence aLabelSeq; + aFunction->GetDependency(aLabelSeq); + Standard_Integer nbArg = aLabelSeq.Length(); + + for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) { + + TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg); + + Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel); + TopoDS_Shape anArgumentShape = anArgumentObject->GetValue(); + + TopTools_IndexedMapOfShape anArgumentIndices; + TopExp::MapShapes(anArgumentShape, anArgumentIndices); + Standard_Integer nbArgumentEntities = anArgumentIndices.Extent(); + + // Find corresponding label in history + TDF_Label anArgumentHistoryLabel = + aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True); + + for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) { + TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie); + const TopTools_ListOfShape& aModified = PS.Modified(anEntity); + Standard_Integer nbModified = aModified.Extent(); + + if (nbModified > 0) { + TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True); + Handle(TDataStd_IntegerArray) anAttr = + TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified); + + TopTools_ListIteratorOfListOfShape itM (aModified); + for (int im = 1; itM.More(); itM.Next(), ++im) { + int id = aResIndices.FindIndex(itM.Value()); + anAttr->SetValue(im, id); + } + } + } + } + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PartitionDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PartitionDriver", + sizeof(GEOMImpl_PartitionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PartitionDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PartitionDriver))) { + _anOtherObject = Handle(GEOMImpl_PartitionDriver)((Handle(GEOMImpl_PartitionDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx new file mode 100644 index 000000000..fb8236af5 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PartitionDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PartitionDriver_HeaderFile +#define _GEOMImpl_PartitionDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PartitionDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PartitionDriver); + +class Handle(GEOMImpl_PartitionDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PartitionDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PartitionDriver)(const Handle(GEOMImpl_PartitionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PartitionDriver)(const GEOMImpl_PartitionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PartitionDriver)& operator=(const Handle(GEOMImpl_PartitionDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PartitionDriver)& operator=(const GEOMImpl_PartitionDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PartitionDriver* operator->() + { + return (GEOMImpl_PartitionDriver *)ControlAccess(); + } + + GEOMImpl_PartitionDriver* operator->() const + { + return (GEOMImpl_PartitionDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PartitionDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PartitionDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PartitionDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PartitionDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PartitionDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PartitionDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PartitionDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx new file mode 100644 index 000000000..7ab584415 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -0,0 +1,159 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PipeDriver::GetID() +{ + static Standard_GUID aPipeDriver("FF1BBB19-5D14-4df2-980B-3A668264EA16"); + return aPipeDriver; +} + + +//======================================================================= +//function : GEOMImpl_PipeDriver +//purpose : +//======================================================================= +GEOMImpl_PipeDriver::GEOMImpl_PipeDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPipe aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == PIPE_BASE_PATH) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + Handle(GEOM_Function) aRefPath = aCI.GetPath(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapePath = aRefPath->GetValue(); + if (aShapeBase.IsNull() || aShapePath.IsNull()) { + Standard_NullObject::Raise("MakePipe aborted : null shape argument"); + } + + // Get path contour + TopoDS_Wire aWire; + if (aShapePath.ShapeType() == TopAbs_WIRE) { + aWire = TopoDS::Wire(aShapePath); + } else { + if (aShapePath.ShapeType() == TopAbs_EDGE) { + TopoDS_Edge anEdge = TopoDS::Edge(aShapePath); + aWire = BRepBuilderAPI_MakeWire(anEdge); + } else { + Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge"); + } + } + + // Make pipe + aShape = BRepOffsetAPI_MakePipe(aWire, aShapeBase); + } + else { + } + + if (aShape.IsNull()) return 0; + + BRepCheck_Analyzer ana (aShape, Standard_False); + if (!ana.IsValid()) { + Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); + } + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PipeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeDriver", + sizeof(GEOMImpl_PipeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PipeDriver) Handle(GEOMImpl_PipeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PipeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeDriver))) { + _anOtherObject = Handle(GEOMImpl_PipeDriver)((Handle(GEOMImpl_PipeDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx new file mode 100644 index 000000000..5c9897ac4 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PipeDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PipeDriver_HeaderFile +#define _GEOMImpl_PipeDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PipeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeDriver); + +class Handle(GEOMImpl_PipeDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PipeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PipeDriver)(const Handle(GEOMImpl_PipeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PipeDriver)(const GEOMImpl_PipeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PipeDriver)& operator=(const Handle(GEOMImpl_PipeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PipeDriver)& operator=(const GEOMImpl_PipeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PipeDriver* operator->() + { + return (GEOMImpl_PipeDriver *)ControlAccess(); + } + + GEOMImpl_PipeDriver* operator->() const + { + return (GEOMImpl_PipeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PipeDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PipeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PipeDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PipeDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PipeDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PipeDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PipeDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx new file mode 100644 index 000000000..8941ba280 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx @@ -0,0 +1,183 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PlaneDriver::GetID() +{ + static Standard_GUID aPlaneDriver("FF1BBB05-5D14-4df2-980B-3A668264EA16"); + return aPlaneDriver; +} + + +//======================================================================= +//function : GEOMImpl_PlaneDriver +//purpose : +//======================================================================= +GEOMImpl_PlaneDriver::GEOMImpl_PlaneDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPlane aPI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + double aSize = aPI.GetSize() / 2.0; + if (aType == PLANE_PNT_VEC) { + Handle(GEOM_Function) aRefPnt = aPI.GetPoint(); + Handle(GEOM_Function) aRefVec = aPI.GetVector(); + TopoDS_Shape aShape1 = aRefPnt->GetValue(); + TopoDS_Shape aShape2 = aRefVec->GetValue(); + if (aShape1.ShapeType() != TopAbs_VERTEX || + aShape2.ShapeType() != TopAbs_EDGE) return 0; + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + TopoDS_Edge anE = TopoDS::Edge(aShape2); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + gp_Pln aPln (aP, aV); + aShape = BRepBuilderAPI_MakeFace(aPln, -aSize, +aSize, -aSize, +aSize).Shape(); + } + } else if (aType == PLANE_THREE_PNT) { + Handle(GEOM_Function) aRefPnt1 = aPI.GetPoint1(); + Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2(); + Handle(GEOM_Function) aRefPnt3 = aPI.GetPoint3(); + TopoDS_Shape aShape1 = aRefPnt1->GetValue(); + TopoDS_Shape aShape2 = aRefPnt2->GetValue(); + TopoDS_Shape aShape3 = aRefPnt3->GetValue(); + if (aShape1.ShapeType() != TopAbs_VERTEX || + aShape2.ShapeType() != TopAbs_VERTEX || + aShape3.ShapeType() != TopAbs_VERTEX) return 0; + gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2)); + gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape3)); + if (aP1.Distance(aP2) < gp::Resolution() || + aP1.Distance(aP3) < gp::Resolution() || + aP2.Distance(aP3) < gp::Resolution()) + Standard_ConstructionError::Raise("Plane creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) + Standard_ConstructionError::Raise("Plane creation aborted: points lay on one line"); + GC_MakePlane aMakePlane (aP1, aP2, aP3); + aShape = BRepBuilderAPI_MakeFace(aMakePlane, -aSize, +aSize, -aSize, +aSize).Shape(); + } else if (aType == PLANE_FACE) { + Handle(GEOM_Function) aRef = aPI.GetFace(); + TopoDS_Shape aRefShape = aRef->GetValue(); + if (aRefShape.ShapeType() != TopAbs_FACE) return 0; + Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aRefShape)); + if (!aGS->IsKind(STANDARD_TYPE(Geom_Plane))) { + Standard_TypeMismatch::Raise("Plane creation aborted: non-planar face given as argument"); + } + aShape = BRepBuilderAPI_MakeFace(aGS, -aSize, +aSize, -aSize, +aSize).Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PlaneDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PlaneDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PlaneDriver", + sizeof(GEOMImpl_PlaneDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PlaneDriver) Handle(GEOMImpl_PlaneDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PlaneDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PlaneDriver))) { + _anOtherObject = Handle(GEOMImpl_PlaneDriver)((Handle(GEOMImpl_PlaneDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx new file mode 100644 index 000000000..c772fe1b2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx @@ -0,0 +1,157 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PlaneDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PlaneDriver_HeaderFile +#define _GEOMImpl_PlaneDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PlaneDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PlaneDriver); + +class Handle(GEOMImpl_PlaneDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PlaneDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PlaneDriver)(const Handle(GEOMImpl_PlaneDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PlaneDriver)(const GEOMImpl_PlaneDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PlaneDriver)& operator=(const Handle(GEOMImpl_PlaneDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PlaneDriver)& operator=(const GEOMImpl_PlaneDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PlaneDriver* operator->() + { + return (GEOMImpl_PlaneDriver *)ControlAccess(); + } + + GEOMImpl_PlaneDriver* operator->() const + { + return (GEOMImpl_PlaneDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PlaneDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PlaneDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PlaneDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PlaneDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PlaneDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PlaneDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PlaneDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PlaneDriver) == AType || TFunction_Driver::IsKind(AType)); } + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx new file mode 100644 index 000000000..99bf329be --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PointDriver::GetID() +{ + static Standard_GUID aPointDriver("FF1BBB02-5D14-4df2-980B-3A668264EA16"); + return aPointDriver; +} + + +//======================================================================= +//function : GEOMImpl_PointDriver +//purpose : +//======================================================================= +GEOMImpl_PointDriver::GEOMImpl_PointDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPoint aPI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + gp_Pnt aPnt; + + if (aType == POINT_XYZ) { + aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ()); + + } else if (aType == POINT_XYZ_REF) { + + Handle(GEOM_Function) aRefPoint = aPI.GetRef(); + TopoDS_Shape aRefShape = aRefPoint->GetValue(); + if (aRefShape.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise + ("Point creation aborted : referenced shape is not a vertex"); + } + gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aRefShape)); + aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ()); + + } else if (aType == POINT_CURVE_PAR) { + + Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); + TopoDS_Shape aRefShape = aRefCurve->GetValue(); + if (aRefShape.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : curve shape is not an edge"); + } + Standard_Real aFP, aLP, aP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP); + aP = aFP + (aLP - aFP) * aPI.GetParameter(); + aPnt = aCurve->Value(aP); + + } else { + return 0; + } + + BRepBuilderAPI_MakeVertex mkVertex (aPnt); + TopoDS_Shape aShape = mkVertex.Shape(); + aShape.Infinite(Standard_True); + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PointDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PointDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PointDriver", + sizeof(GEOMImpl_PointDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_PointDriver) Handle(GEOMImpl_PointDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PointDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PointDriver))) { + _anOtherObject = Handle(GEOMImpl_PointDriver)((Handle(GEOMImpl_PointDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.hxx b/src/GEOMImpl/GEOMImpl_PointDriver.hxx new file mode 100644 index 000000000..3a0ae554f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PointDriver.hxx @@ -0,0 +1,157 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PointDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PointDriver_HeaderFile +#define _GEOMImpl_PointDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PointDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PointDriver); + +class Handle(GEOMImpl_PointDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PointDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PointDriver)(const Handle(GEOMImpl_PointDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PointDriver)(const GEOMImpl_PointDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PointDriver)& operator=(const Handle(GEOMImpl_PointDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PointDriver)& operator=(const GEOMImpl_PointDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PointDriver* operator->() + { + return (GEOMImpl_PointDriver *)ControlAccess(); + } + + GEOMImpl_PointDriver* operator->() const + { + return (GEOMImpl_PointDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PointDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PointDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PointDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PointDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PointDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PointDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PointDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PointDriver) == AType || TFunction_Driver::IsKind(AType)); } + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx new file mode 100644 index 000000000..3399b5715 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx @@ -0,0 +1,144 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PolylineDriver::GetID() +{ + static Standard_GUID aPolylineDriver("FF1BBB31-5D14-4df2-980B-3A668264EA16"); + return aPolylineDriver; +} + + +//======================================================================= +//function : GEOMImpl_PolylineDriver +//purpose : +//======================================================================= +GEOMImpl_PolylineDriver::GEOMImpl_PolylineDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPolyline aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == POLYLINE_POINTS) { + int aLen = aCI.GetLength(); + int ind = 1; + BRepBuilderAPI_MakePolygon aMakePoly; + for (; ind <= aLen; ind++) + { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + aMakePoly.Add(TopoDS::Vertex(aShapePnt)); +// if (!aMakePoly.Added()) return 0; + } + } + if (false) aMakePoly.Close(); + if (aMakePoly.IsDone()) { + aShape = aMakePoly.Wire(); + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PolylineDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PolylineDriver", + sizeof(GEOMImpl_PolylineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PolylineDriver) Handle(GEOMImpl_PolylineDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PolylineDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PolylineDriver))) { + _anOtherObject = Handle(GEOMImpl_PolylineDriver)((Handle(GEOMImpl_PolylineDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx new file mode 100644 index 000000000..fa3de0a28 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PolylineDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PolylineDriver_HeaderFile +#define _GEOMImpl_PolylineDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PolylineDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PolylineDriver); + +class Handle(GEOMImpl_PolylineDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PolylineDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PolylineDriver)(const Handle(GEOMImpl_PolylineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PolylineDriver)(const GEOMImpl_PolylineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PolylineDriver)& operator=(const Handle(GEOMImpl_PolylineDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PolylineDriver)& operator=(const GEOMImpl_PolylineDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PolylineDriver* operator->() + { + return (GEOMImpl_PolylineDriver *)ControlAccess(); + } + + GEOMImpl_PolylineDriver* operator->() const + { + return (GEOMImpl_PolylineDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PolylineDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PolylineDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PolylineDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PolylineDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PolylineDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PolylineDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PolylineDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx new file mode 100644 index 000000000..deb251d0a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx @@ -0,0 +1,193 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PositionDriver::GetID() +{ + static Standard_GUID aPositionDriver("FF1BBB69-5D14-4df2-980B-3A668264EA16"); + return aPositionDriver; +} + + +//======================================================================= +//function : GEOMImpl_PositionDriver +//purpose : +//======================================================================= +GEOMImpl_PositionDriver::GEOMImpl_PositionDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPosition aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == POSITION_SHAPE || aType == POSITION_SHAPE_COPY) { + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + Handle(GEOM_Function) aRefStartLCS = aCI.GetStartLCS(); + Handle(GEOM_Function) aRefEndLCS = aCI.GetEndLCS(); + + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + TopoDS_Shape aShapeStartLCS = aRefStartLCS->GetValue(); + TopoDS_Shape aShapeEndLCS = aRefEndLCS->GetValue(); + + if (aShapeBase.IsNull() || aShapeStartLCS.IsNull() || + aShapeEndLCS.IsNull() || aShapeEndLCS.ShapeType() != TopAbs_FACE) + return 0; + + gp_Trsf aTrsf; + gp_Ax3 aStartAx3, aDestAx3; + aStartAx3.Transform(aShapeStartLCS.Location().Transformation()); + aDestAx3.Transform(aShapeEndLCS.Location().Transformation()); + + Handle(Geom_Surface) aGS2 = BRep_Tool::Surface( TopoDS::Face( aShapeEndLCS ) ); + if (!aGS2.IsNull() && aGS2->IsKind( STANDARD_TYPE( Geom_Plane ) ) ) { + Handle(Geom_Plane) aGPlane2 = Handle(Geom_Plane)::DownCast( aGS2 ); + gp_Pln aPln2 = aGPlane2->Pln(); + aDestAx3 = aPln2.Position(); + } + + if(aShapeStartLCS.ShapeType() == TopAbs_FACE) { + Handle(Geom_Surface) aGS = BRep_Tool::Surface( TopoDS::Face( aShapeStartLCS ) ); + if (!aGS.IsNull() && aGS->IsKind( STANDARD_TYPE( Geom_Plane ) ) ) { + Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS ); + gp_Pln aPln = aGPlane->Pln(); + aStartAx3 = aPln.Position(); + } + aTrsf.SetDisplacement(aStartAx3, aDestAx3); + } + else { + gp_Trsf aTrsf1, aTrsf2; + aTrsf1.SetDisplacement(aStartAx3, aDestAx3); + BRepBuilderAPI_Transform aBT (aShapeBase, aTrsf1, Standard_False); + TopoDS_Shape aNewShape = aBT.Shape(); + + gp_Pnt aPnt; + if (aNewShape.ShapeType() == TopAbs_VERTEX) { + aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aNewShape)); + } + else { + GProp_GProps aSystem; + if (aNewShape.ShapeType() == TopAbs_EDGE || aNewShape.ShapeType() == TopAbs_WIRE) + BRepGProp::LinearProperties(aNewShape, aSystem); + else if (aNewShape.ShapeType() == TopAbs_FACE || aNewShape.ShapeType() == TopAbs_SHELL) + BRepGProp::SurfaceProperties(aNewShape, aSystem); + else + BRepGProp::VolumeProperties(aNewShape, aSystem); + + aPnt = aSystem.CentreOfMass(); + } + + gp_Vec aVec(aPnt, aDestAx3.Location()); + aTrsf2.SetTranslation(aVec); + aTrsf = aTrsf2 * aTrsf1; + } + + BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False); + aShape = aBRepTrsf.Shape(); + } + else + return 0; + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PositionDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PositionDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PositionDriver", + sizeof(GEOMImpl_PositionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PositionDriver) Handle(GEOMImpl_PositionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PositionDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PositionDriver))) { + _anOtherObject = Handle(GEOMImpl_PositionDriver)((Handle(GEOMImpl_PositionDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.hxx b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx new file mode 100644 index 000000000..a7b833e6c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PositionDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PositionDriver_HeaderFile +#define _GEOMImpl_PositionDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PositionDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PositionDriver); + +class Handle(GEOMImpl_PositionDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PositionDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PositionDriver)(const Handle(GEOMImpl_PositionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PositionDriver)(const GEOMImpl_PositionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PositionDriver)& operator=(const Handle(GEOMImpl_PositionDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PositionDriver)& operator=(const GEOMImpl_PositionDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PositionDriver* operator->() + { + return (GEOMImpl_PositionDriver *)ControlAccess(); + } + + GEOMImpl_PositionDriver* operator->() const + { + return (GEOMImpl_PositionDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PositionDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PositionDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PositionDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PositionDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PositionDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PositionDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PositionDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PositionDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx new file mode 100644 index 000000000..6be39bc15 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -0,0 +1,165 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_PrismDriver::GetID() +{ + static Standard_GUID aPrismDriver("FF1BBB17-5D14-4df2-980B-3A668264EA16"); + return aPrismDriver; +} + + +//======================================================================= +//function : GEOMImpl_PrismDriver +//purpose : +//======================================================================= +GEOMImpl_PrismDriver::GEOMImpl_PrismDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPrism aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == PRISM_BASE_VEC_H) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapeVec.ShapeType() == TopAbs_EDGE) { + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (Abs(aCI.GetH()) < Precision::Confusion()) { + Standard_ConstructionError::Raise("Absolute value of prism height is too small"); + } + if (aV.Magnitude() > Precision::Confusion()) { + aV.Normalize(); + aShape = BRepPrimAPI_MakePrism(aShapeBase, aV * aCI.GetH(), Standard_False).Shape(); + } + } + } + } else if (aType == PRISM_BASE_TWO_PNT) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + Handle(GEOM_Function) aRefPnt1 = aCI.GetFirstPoint(); + Handle(GEOM_Function) aRefPnt2 = aCI.GetLastPoint(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapePnt1 = aRefPnt1->GetValue(); + TopoDS_Shape aShapePnt2 = aRefPnt2->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && + aShapePnt2.ShapeType() == TopAbs_VERTEX) { + TopoDS_Vertex V1 = TopoDS::Vertex(aShapePnt1); + TopoDS_Vertex V2 = TopoDS::Vertex(aShapePnt2); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aV.Magnitude() > gp::Resolution()) { + aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); + } + } + } + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_PrismDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_PrismDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PrismDriver", + sizeof(GEOMImpl_PrismDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_PrismDriver) Handle(GEOMImpl_PrismDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_PrismDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PrismDriver))) { + _anOtherObject = Handle(GEOMImpl_PrismDriver)((Handle(GEOMImpl_PrismDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.hxx b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx new file mode 100644 index 000000000..5129bcbc7 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_PrismDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_PrismDriver_HeaderFile +#define _GEOMImpl_PrismDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_PrismDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PrismDriver); + +class Handle(GEOMImpl_PrismDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_PrismDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_PrismDriver)(const Handle(GEOMImpl_PrismDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_PrismDriver)(const GEOMImpl_PrismDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_PrismDriver)& operator=(const Handle(GEOMImpl_PrismDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_PrismDriver)& operator=(const GEOMImpl_PrismDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_PrismDriver* operator->() + { + return (GEOMImpl_PrismDriver *)ControlAccess(); + } + + GEOMImpl_PrismDriver* operator->() const + { + return (GEOMImpl_PrismDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_PrismDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_PrismDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_PrismDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_PrismDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_PrismDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PrismDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PrismDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PrismDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx new file mode 100644 index 000000000..9208b717b --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -0,0 +1,165 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_RevolutionDriver::GetID() +{ + static Standard_GUID aRevolutionDriver("FF1BBB18-5D14-4df2-980B-3A668264EA16"); + return aRevolutionDriver; +} + + +//======================================================================= +//function : GEOMImpl_RevolutionDriver +//purpose : +//======================================================================= +GEOMImpl_RevolutionDriver::GEOMImpl_RevolutionDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IRevolution aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == REVOLUTION_BASE_AXIS_ANGLE) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + Handle(GEOM_Function) aRefAxis = aCI.GetAxis(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapeAxis = aRefAxis->GetValue(); + if (aShapeAxis.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise("Revolution Axis must be an edge"); + } + + TopoDS_Edge anE = TopoDS::Edge(aShapeAxis); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_ConstructionError::Raise("Bad edge for the Revolution Axis given"); + } + + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aV.Magnitude() < Precision::Confusion()) { + Standard_ConstructionError::Raise + ("End vertices of edge, defining the Revolution Axis, are too close"); + } + + if (aShapeBase.ShapeType() == TopAbs_VERTEX) { + gp_Lin aL(BRep_Tool::Pnt(V1), gp_Dir(aV)); + Standard_Real d = aL.Distance(BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase))); + if (d < Precision::Confusion()) { + Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis"); + } + } + + gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV); + BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, aCI.GetAngle(), Standard_False); + if (!MR.IsDone()) MR.Build(); + if (!MR.IsDone()) StdFail_NotDone::Raise("Revolution algorithm has failed"); + aShape = MR.Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_RevolutionDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_RevolutionDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RevolutionDriver", + sizeof(GEOMImpl_RevolutionDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_RevolutionDriver) Handle(GEOMImpl_RevolutionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_RevolutionDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_RevolutionDriver))) { + _anOtherObject = Handle(GEOMImpl_RevolutionDriver)((Handle(GEOMImpl_RevolutionDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx new file mode 100644 index 000000000..c063c435e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_RevolutionDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_RevolutionDriver_HeaderFile +#define _GEOMImpl_RevolutionDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_RevolutionDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_RevolutionDriver); + +class Handle(GEOMImpl_RevolutionDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_RevolutionDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_RevolutionDriver)(const Handle(GEOMImpl_RevolutionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_RevolutionDriver)(const GEOMImpl_RevolutionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_RevolutionDriver)& operator=(const Handle(GEOMImpl_RevolutionDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_RevolutionDriver)& operator=(const GEOMImpl_RevolutionDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_RevolutionDriver* operator->() + { + return (GEOMImpl_RevolutionDriver *)ControlAccess(); + } + + GEOMImpl_RevolutionDriver* operator->() const + { + return (GEOMImpl_RevolutionDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_RevolutionDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_RevolutionDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_RevolutionDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_RevolutionDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_RevolutionDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_RevolutionDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_RevolutionDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_RevolutionDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx new file mode 100644 index 000000000..8c76d1862 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx @@ -0,0 +1,264 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_RotateDriver::GetID() +{ + static Standard_GUID aRotateDriver("FF1BBB56-5D14-4df2-980B-3A668264EA16"); + return aRotateDriver; +} + + +//======================================================================= +//function : GEOMImpl_RotateDriver +//purpose : +//======================================================================= + +GEOMImpl_RotateDriver::GEOMImpl_RotateDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const +{ + if(Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + if(aFunction.IsNull()) return 0; + + GEOMImpl_IRotate RI(aFunction); + gp_Trsf aTrsf; + Standard_Integer aType = aFunction->GetType(); + Handle(GEOM_Function) anOriginalFunction = RI.GetOriginal(); + if(anOriginalFunction.IsNull()) return 0; + TopoDS_Shape aShape, anOriginal = anOriginalFunction->GetValue(); + if(anOriginal.IsNull()) return 0; + + if(aType == ROTATE || aType == ROTATE_COPY) { + Handle(GEOM_Function) anAxis = RI.GetAxis(); + if(anAxis.IsNull()) return 0; + TopoDS_Shape A = anAxis->GetValue(); + if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(A); + + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + gp_Dir aDir(gp_Vec(aP1, aP2)); + gp_Ax1 anAx1(aP1, aDir); + Standard_Real anAngle = RI.GetAngle(); + aTrsf.SetRotation(anAx1, anAngle); + + BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + aShape = aTransformation.Shape(); + } + else if(aType == ROTATE_1D) { + //Get direction + Handle(GEOM_Function) anAxis = RI.GetAxis(); + if(anAxis.IsNull()) return 0; + TopoDS_Shape A = anAxis->GetValue(); + if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(A); + + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + gp_Dir D(gp_Vec(aP1, aP2)) ; + + gp_Ax1 AX1(aP1, D) ; + + Standard_Integer nbtimes = RI.GetNbIter1(); + Standard_Real angle = 360.0/nbtimes ; + + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound( aCompound ); + + for (int i = 0; i < nbtimes; i++ ) { + aTrsf.SetRotation(AX1, i*angle*PI180) ; + BRepBuilderAPI_Transform myBRepTransformation(anOriginal, aTrsf, Standard_False) ; + B.Add( aCompound, myBRepTransformation.Shape() ); + } + + aShape = aCompound ; + } + else if(aType == ROTATE_2D) { + Standard_Real DX, DY, DZ ; + + //Get direction + Handle(GEOM_Function) anAxis = RI.GetAxis(); + if(anAxis.IsNull()) return 0; + TopoDS_Shape A = anAxis->GetValue(); + if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(A); + gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + gp_Dir D(gp_Vec(aP1, aP2)) ; + + gp_Ax1 AX1(aP1, D) ; + + + gp_Trsf theTransformation1 ; + gp_Trsf theTransformation2 ; + gp_Pnt P1 ; + GProp_GProps System ; + + if ( anOriginal.ShapeType() == TopAbs_VERTEX) { + P1 = BRep_Tool::Pnt(TopoDS::Vertex( anOriginal )); + } + else if ( anOriginal.ShapeType() == TopAbs_EDGE || anOriginal.ShapeType() == TopAbs_WIRE ) { + BRepGProp::LinearProperties(anOriginal, System); + P1 = System.CentreOfMass() ; + } + else if ( anOriginal.ShapeType() == TopAbs_FACE || anOriginal.ShapeType() == TopAbs_SHELL ) { + BRepGProp::SurfaceProperties(anOriginal, System); + P1 = System.CentreOfMass() ; + } + else { + BRepGProp::VolumeProperties(anOriginal, System); + P1 = System.CentreOfMass() ; + } + + Handle(Geom_Line) Line = new Geom_Line(AX1); + GeomAPI_ProjectPointOnCurve aPrjTool( P1, Line ) ; + gp_Pnt P2 = aPrjTool.NearestPoint(); + + if ( P1.IsEqual(P2, Precision::Confusion() ) ) return 0; + + gp_Vec Vec(P1.X()-P2.X(), P1.Y()-P2.Y(), P1.Z()-P2.Z()) ; + Vec.Normalize(); + + Standard_Integer nbtimes2 = RI.GetNbIter2(); + Standard_Integer nbtimes1 = RI.GetNbIter1(); + Standard_Real step = RI.GetStep(); + Standard_Real ang = RI.GetAngle(); + + gp_Vec myVec ; + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound( aCompound ); + for (int i = 0; i < nbtimes2; i++ ) { + for (int j = 0; j < nbtimes1; j++ ) { + DX = i * step * Vec.X() ; + DY = i * step * Vec.Y() ; + DZ = i * step * Vec.Z() ; + myVec.SetCoord( DX, DY, DZ ) ; + theTransformation1.SetTranslation(myVec) ; + theTransformation2.SetRotation(AX1, j*ang*PI180) ; + BRepBuilderAPI_Transform myBRepTransformation1(anOriginal, theTransformation1, Standard_False) ; + BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False) ; + B.Add( aCompound, myBRepTransformation2.Shape() ); + } + } + + aShape = aCompound; + + } + else return 0; + + + + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_RotateDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_RotateDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RotateDriver", + sizeof(GEOMImpl_RotateDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_RotateDriver) Handle(GEOMImpl_RotateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_RotateDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_RotateDriver))) { + _anOtherObject = Handle(GEOMImpl_RotateDriver)((Handle(GEOMImpl_RotateDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.hxx b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx new file mode 100644 index 000000000..c9800cfb0 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_RotateDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_RotateDriver_HeaderFile +#define _GEOMImpl_RotateDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_RotateDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_RotateDriver); + +class Handle(GEOMImpl_RotateDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_RotateDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_RotateDriver)(const Handle(GEOMImpl_RotateDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_RotateDriver)(const GEOMImpl_RotateDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_RotateDriver)& operator=(const Handle(GEOMImpl_RotateDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_RotateDriver)& operator=(const GEOMImpl_RotateDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_RotateDriver* operator->() + { + return (GEOMImpl_RotateDriver *)ControlAccess(); + } + + GEOMImpl_RotateDriver* operator->() const + { + return (GEOMImpl_RotateDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_RotateDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_RotateDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_RotateDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_RotateDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_RotateDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_RotateDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_RotateDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_RotateDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx new file mode 100644 index 000000000..21824877f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx @@ -0,0 +1,138 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ScaleDriver::GetID() +{ + static Standard_GUID aScaleDriver("FF1BBB52-5D14-4df2-980B-3A668264EA16"); + return aScaleDriver; +} + + +//======================================================================= +//function : GEOMImpl_ScaleDriver +//purpose : +//======================================================================= +GEOMImpl_ScaleDriver::GEOMImpl_ScaleDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IScale aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == SCALE_SHAPE || aType == SCALE_SHAPE_COPY) { + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapeBase.IsNull() || aShapePnt.IsNull()) return 0; + if (aShapePnt.ShapeType() != TopAbs_VERTEX) return 0; + + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + gp_Trsf aTrsf; + aTrsf.SetScale(aP, aCI.GetFactor()); + BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False); + aShape = aBRepTrsf.Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ScaleDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ScaleDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ScaleDriver", + sizeof(GEOMImpl_ScaleDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ScaleDriver) Handle(GEOMImpl_ScaleDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ScaleDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ScaleDriver))) { + _anOtherObject = Handle(GEOMImpl_ScaleDriver)((Handle(GEOMImpl_ScaleDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx new file mode 100644 index 000000000..3f80b8311 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ScaleDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ScaleDriver_HeaderFile +#define _GEOMImpl_ScaleDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ScaleDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ScaleDriver); + +class Handle(GEOMImpl_ScaleDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ScaleDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ScaleDriver)(const Handle(GEOMImpl_ScaleDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ScaleDriver)(const GEOMImpl_ScaleDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ScaleDriver)& operator=(const Handle(GEOMImpl_ScaleDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ScaleDriver)& operator=(const GEOMImpl_ScaleDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ScaleDriver* operator->() + { + return (GEOMImpl_ScaleDriver *)ControlAccess(); + } + + GEOMImpl_ScaleDriver* operator->() const + { + return (GEOMImpl_ScaleDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ScaleDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ScaleDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ScaleDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ScaleDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ScaleDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ScaleDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ScaleDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ScaleDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx new file mode 100644 index 000000000..50ba2a682 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -0,0 +1,413 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include + +#include + +// OCCT Includes +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ShapeDriver::GetID() +{ + static Standard_GUID aShapeDriver("FF1BBB54-5D14-4df2-980B-3A668264EA16"); + return aShapeDriver; +} + + +//======================================================================= +//function : GEOMImpl_ShapeDriver +//purpose : +//======================================================================= +GEOMImpl_ShapeDriver::GEOMImpl_ShapeDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IShapes aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + BRep_Builder B; + + if (aType == WIRE_EDGES) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + unsigned int ind, nbshapes = aShapes->Length(); + + TopoDS_Wire aWire; + B.MakeWire(aWire); + BRepBuilderAPI_MakeWire MW; + bool isMWDone = true; + + // add edges + for (ind = 1; ind <= nbshapes; ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("Shape for wire construction is null"); + } + if (aShape_i.ShapeType() == TopAbs_EDGE) { + B.Add(aWire, TopoDS::Edge(aShape_i)); + MW.Add(TopoDS::Edge(aShape_i)); + } else if (aShape_i.ShapeType() == TopAbs_WIRE) { + B.Add(aWire, TopoDS::Wire(aShape_i)); + MW.Add(TopoDS::Wire(aShape_i)); + } else { + Standard_TypeMismatch::Raise + ("Shape for wire construction is neither an edge nor a wire"); + } + if (!MW.IsDone()) { + // check status after each edge/wire addition, because the final status + // can be OK even in case, when some edges/wires was not accepted. + isMWDone = false; + } + } + + if (isMWDone) { + aShape = MW; + } else { + // fix edges order + Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire; + aFW->Load(aWire); + aFW->FixReorder(); + + if (aFW->StatusReorder(ShapeExtend_FAIL1)) { + Standard_ConstructionError::Raise("Wire construction failed: several loops detected"); + } else if (aFW->StatusReorder(ShapeExtend_FAIL)) { + Standard_ConstructionError::Raise("Wire construction failed"); + } else if (aFW->StatusReorder(ShapeExtend_DONE2)) { + Standard_ConstructionError::Raise("Wire construction failed: some gaps detected"); + } else { + } + aShape = aFW->WireAPIMake(); + } + + } else if (aType == FACE_WIRE) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull() || aShapeBase.ShapeType() != TopAbs_WIRE) { + Standard_NullObject::Raise + ("Shape for face construction is null or not a wire"); + } + TopoDS_Wire W = TopoDS::Wire(aShapeBase); + //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar()); + //if (!MF.IsDone()) { + // Standard_ConstructionError::Raise("Face construction failed"); + //} + //aShape = MF.Shape(); + GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape); + if (aShape.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + + } else if (aType == FACE_WIRES) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + int nbshapes = aShapes->Length(); + if (nbshapes < 1) { + Standard_ConstructionError::Raise("No wires given"); + } + + // first wire + Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1)); + TopoDS_Shape aWire = aRefWire->GetValue(); + if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE) { + Standard_NullObject::Raise("Shape for face construction is null or not a wire"); + } + TopoDS_Wire W = TopoDS::Wire(aWire); + + // basic face + //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar()); + //if (!MF.IsDone()) { + // Standard_ConstructionError::Raise("Face construction failed"); + //} + //TopoDS_Shape FFace = MF.Shape(); + TopoDS_Shape FFace; + GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace); + if (FFace.IsNull()) { + Standard_ConstructionError::Raise("Face construction failed"); + } + + if (nbshapes == 1) { + aShape = FFace; + + } else { + TopoDS_Compound C; + BRep_Builder aBuilder; + aBuilder.MakeCompound(C); + BRepAlgo_FaceRestrictor FR; + + TopAbs_Orientation OriF = FFace.Orientation(); + TopoDS_Shape aLocalS = FFace.Oriented(TopAbs_FORWARD); + FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True); + + for (int ind = 1; ind <= nbshapes; ind++) { + Handle(GEOM_Function) aRefWire_i = + Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aWire_i = aRefWire_i->GetValue(); + if (aWire_i.IsNull() || aWire_i.ShapeType() != TopAbs_WIRE) { + Standard_NullObject::Raise("Shape for face construction is null or not a wire"); + } + + FR.Add(TopoDS::Wire(aWire_i)); + } + + FR.Perform(); + + if (FR.IsDone()) { + int k = 0; + TopoDS_Shape aFace; + for (; FR.More(); FR.Next()) { + aFace = FR.Current().Oriented(OriF); + aBuilder.Add(C, aFace); + k++; + } + if (k == 1) { + aShape = aFace; + } else { + aShape = C; + } + } + } + } else if (aType == SHELL_FACES) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + unsigned int ind, nbshapes = aShapes->Length(); + + // add faces + BRepBuilderAPI_Sewing aSewing(Precision::Confusion()*10.0); + for (ind = 1; ind <= nbshapes; ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("Face for shell construction is null"); + } + aSewing.Add(aShape_i); + } + + aSewing.Perform(); + + TopExp_Explorer exp (aSewing.SewedShape(), TopAbs_SHELL); + Standard_Integer ish = 0; + for (; exp.More(); exp.Next()) { + aShape = exp.Current(); + ish++; + } + + if (ish != 1) + aShape = aSewing.SewedShape(); + + } else if (aType == SOLID_SHELL) { + Handle(GEOM_Function) aRefShell = aCI.GetBase(); + TopoDS_Shape aShapeShell = aRefShell->GetValue(); + if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) { + Standard_NullObject::Raise("Shape for solid construction is null or not a shell"); + } + + BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell)); + if(chkShell.Closed() == BRepCheck_NotClosed) return 0; + + TopoDS_Solid Sol; + B.MakeSolid(Sol); + B.Add(Sol, aShapeShell); + BRepClass3d_SolidClassifier SC (Sol); + SC.PerformInfinitePoint(Precision::Confusion()); + if (SC.State() == TopAbs_IN) { + B.MakeSolid(Sol); + B.Add(Sol, aShapeShell.Reversed()); + } + + aShape = Sol; + + } else if (aType == SOLID_SHELLS) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + unsigned int ind, nbshapes = aShapes->Length(); + Standard_Integer ish = 0; + TopoDS_Solid Sol; + B.MakeSolid(Sol); + + // add shapes + for (ind = 1; ind <= nbshapes; ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aShapeShell = aRefShape->GetValue(); + if (aShapeShell.IsNull()) { + Standard_NullObject::Raise("Shell for solid construction is null"); + } + if (aShapeShell.ShapeType() == TopAbs_SHELL) { + B.Add(Sol, aShapeShell); + ish++; + } + } + if ( ish == 0 ) return 0; + BRepClass3d_SolidClassifier SC (Sol); + SC.PerformInfinitePoint(Precision::Confusion()); + switch (SC.State()) { + case TopAbs_IN: + aShape = Sol.Reversed(); break; + case TopAbs_OUT: + aShape = Sol; break; + default: // not closed shell? + return 0; + } + + } else if (aType == COMPOUND_SHAPES) { + Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); + unsigned int ind, nbshapes = aShapes->Length(); + + // add shapes + TopoDS_Compound C; + B.MakeCompound(C); + for (ind = 1; ind <= nbshapes; ind++) { + Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("Shape for compound construction is null"); + } + B.Add(C, aShape_i); + } + + aShape = C; + + } else if (aType == REVERSE_ORIENTATION) { + Handle(GEOM_Function) aRefShape = aCI.GetBase(); + TopoDS_Shape aShape_i = aRefShape->GetValue(); + if (aShape_i.IsNull()) { + Standard_NullObject::Raise("Shape for reverse is null"); + } + + BRepBuilderAPI_Copy Copy(aShape_i); + if( Copy.IsDone() ) { + TopoDS_Shape tds = Copy.Shape(); + if( tds.IsNull() ) { + Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape"); + } + + if( tds.Orientation() == TopAbs_FORWARD) + tds.Orientation(TopAbs_REVERSED) ; + else + tds.Orientation(TopAbs_FORWARD) ; + + aShape = tds; + } + } + + if (aShape.IsNull()) return 0; + + // Check shape validity + BRepCheck_Analyzer ana (aShape, false); + if (!ana.IsValid()) { + Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); + } + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_ShapeDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ShapeDriver", + sizeof(GEOMImpl_ShapeDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ShapeDriver) Handle(GEOMImpl_ShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ShapeDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ShapeDriver))) { + _anOtherObject = Handle(GEOMImpl_ShapeDriver)((Handle(GEOMImpl_ShapeDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx new file mode 100644 index 000000000..32dab4150 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_ShapeDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_ShapeDriver_HeaderFile +#define _GEOMImpl_ShapeDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_ShapeDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ShapeDriver); + +class Handle(GEOMImpl_ShapeDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ShapeDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ShapeDriver)(const Handle(GEOMImpl_ShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_ShapeDriver)(const GEOMImpl_ShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_ShapeDriver)& operator=(const Handle(GEOMImpl_ShapeDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ShapeDriver)& operator=(const GEOMImpl_ShapeDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ShapeDriver* operator->() + { + return (GEOMImpl_ShapeDriver *)ControlAccess(); + } + + GEOMImpl_ShapeDriver* operator->() const + { + return (GEOMImpl_ShapeDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ShapeDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_ShapeDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_ShapeDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_ShapeDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ShapeDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ShapeDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx new file mode 100644 index 000000000..b6075c0b4 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx @@ -0,0 +1,169 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_SketcherDriver::GetID() +{ + static Standard_GUID aSketcherDriver("FF1BBB64-5D14-4df2-980B-3A668264EA16"); + return aSketcherDriver; +} + + +//======================================================================= +//function : GEOMImpl_SketcherDriver +//purpose : +//======================================================================= +GEOMImpl_SketcherDriver::GEOMImpl_SketcherDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISketcher aCI (aFunction); + //Standard_Integer aType = aFunction->GetType(); + + // retrieve the command + TCollection_AsciiString aCommand = aCI.GetCommand(); + if (aCommand.IsEmpty()) + return 0; + + TopoDS_Shape aShape; + + // create sketcher + Sketcher_Profile aProfile (aCommand.ToCString()); + + if (!aProfile.IsDone()) { + Standard_ConstructionError::Raise("Sketcher creation failed"); + } + + aShape = aProfile.GetShape(); + if (aShape.IsNull()) + return 0; + + gp_Ax3 aWPlane; + if ( aFunction->GetType() == SKETCHER_NINE_DOUBLS ) + { + gp_Pnt aOrigin = + gp_Pnt(aCI.GetWorkingPlane(1), aCI.GetWorkingPlane(2), aCI.GetWorkingPlane(3)); + gp_Dir aDirZ = + gp_Dir(aCI.GetWorkingPlane(4), aCI.GetWorkingPlane(5), aCI.GetWorkingPlane(6)); + gp_Dir aDirX = + gp_Dir(aCI.GetWorkingPlane(7), aCI.GetWorkingPlane(8), aCI.GetWorkingPlane(9)); + aWPlane = gp_Ax3(aOrigin, aDirZ, aDirX); + } + else + { + Handle(GEOM_Function) aRefFace = aCI.GetWorkingPlane(); + TopoDS_Shape aShape = aRefFace->GetValue(); + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_FACE ) + return 0; + Handle(Geom_Surface) aGS = BRep_Tool::Surface( TopoDS::Face( aShape )); + if ( aGS.IsNull() || !aGS->IsKind( STANDARD_TYPE( Geom_Plane ))) + return 0; + Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS ); + aWPlane = aGPlane->Pln().Position(); + } + gp_Trsf aTrans; + aTrans.SetTransformation(aWPlane); + aTrans.Invert(); + BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); + aShape = aTransformation.Shape(); + + if (aShape.IsNull()) + return 0; + + // set the function result + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_SketcherDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_SketcherDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SketcherDriver", + sizeof(GEOMImpl_SketcherDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_SketcherDriver) Handle(GEOMImpl_SketcherDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_SketcherDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SketcherDriver))) { + _anOtherObject = Handle(GEOMImpl_SketcherDriver)((Handle(GEOMImpl_SketcherDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx new file mode 100644 index 000000000..04886ea7f --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_SketcherDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_SketcherDriver_HeaderFile +#define _GEOMImpl_SketcherDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_SketcherDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SketcherDriver); + +class Handle(GEOMImpl_SketcherDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_SketcherDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_SketcherDriver)(const Handle(GEOMImpl_SketcherDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_SketcherDriver)(const GEOMImpl_SketcherDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_SketcherDriver)& operator=(const Handle(GEOMImpl_SketcherDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_SketcherDriver)& operator=(const GEOMImpl_SketcherDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_SketcherDriver* operator->() + { + return (GEOMImpl_SketcherDriver *)ControlAccess(); + } + + GEOMImpl_SketcherDriver* operator->() const + { + return (GEOMImpl_SketcherDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_SketcherDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_SketcherDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_SketcherDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_SketcherDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_SketcherDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SketcherDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SketcherDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SketcherDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.cxx b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx new file mode 100644 index 000000000..1cd98297e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx @@ -0,0 +1,133 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_SphereDriver::GetID() +{ + static Standard_GUID aSphereDriver("FF1BBB16-5D14-4df2-980B-3A668264EA16"); + return aSphereDriver; +} + + +//======================================================================= +//function : GEOMImpl_SphereDriver +//purpose : +//======================================================================= +GEOMImpl_SphereDriver::GEOMImpl_SphereDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISphere aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == SPHERE_R) { + aShape = BRepPrimAPI_MakeSphere(aCI.GetR()).Shape(); + } + else if (aType == SPHERE_PNT_R) { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + aShape = BRepPrimAPI_MakeSphere(aP, aCI.GetR()).Shape(); + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_SphereDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_SphereDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SphereDriver", + sizeof(GEOMImpl_SphereDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_SphereDriver) Handle(GEOMImpl_SphereDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_SphereDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SphereDriver))) { + _anOtherObject = Handle(GEOMImpl_SphereDriver)((Handle(GEOMImpl_SphereDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.hxx b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx new file mode 100644 index 000000000..d770e7213 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_SphereDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_SphereDriver_HeaderFile +#define _GEOMImpl_SphereDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_SphereDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SphereDriver); + +class Handle(GEOMImpl_SphereDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_SphereDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_SphereDriver)(const Handle(GEOMImpl_SphereDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_SphereDriver)(const GEOMImpl_SphereDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_SphereDriver)& operator=(const Handle(GEOMImpl_SphereDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_SphereDriver)& operator=(const GEOMImpl_SphereDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_SphereDriver* operator->() + { + return (GEOMImpl_SphereDriver *)ControlAccess(); + } + + GEOMImpl_SphereDriver* operator->() const + { + return (GEOMImpl_SphereDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_SphereDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_SphereDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_SphereDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_SphereDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_SphereDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SphereDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SphereDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SphereDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx new file mode 100644 index 000000000..0e1bae59a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -0,0 +1,176 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +//#include +#include + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_SplineDriver::GetID() +{ + static Standard_GUID aSplineDriver("FF1BBB33-5D14-4df2-980B-3A668264EA16"); + return aSplineDriver; +} + + +//======================================================================= +//function : GEOMImpl_SplineDriver +//purpose : +//======================================================================= +GEOMImpl_SplineDriver::GEOMImpl_SplineDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISpline aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == SPLINE_BEZIER || aType == SPLINE_INTERPOLATION) { + int ind, aLen = aCI.GetLength(); + if (aLen < 2) return 0; + Standard_Boolean isSeveral = Standard_False; + gp_Pnt aPrevP; + TColgp_Array1OfPnt CurvePoints (1, aLen); + for (ind = 1; ind <= aLen; ind++) { + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + if (!isSeveral && ind > 1) { + if (aP.Distance(aPrevP) > Precision::Confusion()) { + isSeveral = Standard_True; + } + } + CurvePoints.SetValue(ind, aP); + aPrevP = aP; + } + } + if (aType == SPLINE_BEZIER) { + if (!isSeveral) { + Standard_ConstructionError::Raise("Points for Bezier Curve are too close"); + } + Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); + aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); + } else { +// GeomAPI_PointsToBSpline GBC (CurvePoints); +// aShape = BRepBuilderAPI_MakeEdge(GBC).Edge(); + Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aLen); + for (ind = 1; ind <= aLen; ind++) { + aHCurvePoints->SetValue(ind, CurvePoints.Value(ind)); + } + GeomAPI_Interpolate GBC (aHCurvePoints, Standard_False, gp::Resolution()); + GBC.Perform(); + if (GBC.IsDone()) + aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge(); + else + return 0; + } + } + else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_SplineDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_SplineDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SplineDriver", + sizeof(GEOMImpl_SplineDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_SplineDriver) Handle(GEOMImpl_SplineDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_SplineDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SplineDriver))) { + _anOtherObject = Handle(GEOMImpl_SplineDriver)((Handle(GEOMImpl_SplineDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.hxx b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx new file mode 100644 index 000000000..3e809de8a --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_SplineDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_SplineDriver_HeaderFile +#define _GEOMImpl_SplineDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_SplineDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SplineDriver); + +class Handle(GEOMImpl_SplineDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_SplineDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_SplineDriver)(const Handle(GEOMImpl_SplineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_SplineDriver)(const GEOMImpl_SplineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_SplineDriver)& operator=(const Handle(GEOMImpl_SplineDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_SplineDriver)& operator=(const GEOMImpl_SplineDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_SplineDriver* operator->() + { + return (GEOMImpl_SplineDriver *)ControlAccess(); + } + + GEOMImpl_SplineDriver* operator->() const + { + return (GEOMImpl_SplineDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_SplineDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_SplineDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_SplineDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_SplineDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_SplineDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SplineDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SplineDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SplineDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Template.cxx b/src/GEOMImpl/GEOMImpl_Template.cxx new file mode 100644 index 000000000..992faed5c --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Template.cxx @@ -0,0 +1,107 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_Template::GetID() +{ + static Standard_GUID aTemplate("Insert the correct GUID here"); + return aTemplate; +} + + +//======================================================================= +//function : GEOMImpl_Template +//purpose : +//======================================================================= + +GEOMImpl_Template::GEOMImpl_Template() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_Template::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + if(aFunction.IsNull()) return 0; + + //Add implemetation here + + log.SetTouched(Label()); + return 1; +} + + +//======================================================================= +//function : GEOMImpl_Template_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_Template_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Template", + sizeof(GEOMImpl_Template), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_Template) Handle(GEOMImpl_Template)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_Template) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Template))) { + _anOtherObject = Handle(GEOMImpl_Template)((Handle(GEOMImpl_Template)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_Template.hxx b/src/GEOMImpl/GEOMImpl_Template.hxx new file mode 100644 index 000000000..916cf6ab9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Template.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_Template.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_Template_HeaderFile +#define _GEOMImpl_Template_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_Template; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Template); + +class Handle(GEOMImpl_Template) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_Template)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_Template)(const Handle(GEOMImpl_Template)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_Template)(const GEOMImpl_Template* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_Template)& operator=(const Handle(GEOMImpl_Template)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_Template)& operator=(const GEOMImpl_Template* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_Template* operator->() + { + return (GEOMImpl_Template *)ControlAccess(); + } + + GEOMImpl_Template* operator->() const + { + return (GEOMImpl_Template *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_Template)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_Template) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_Template : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_Template(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_Template() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Template_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_Template) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_Template) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.cxx b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx new file mode 100644 index 000000000..023355213 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx @@ -0,0 +1,162 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_TorusDriver::GetID() +{ + static Standard_GUID aTorusDriver("FF1BBB12-5D14-4df2-980B-3A668264EA16"); + return aTorusDriver; +} + + +//======================================================================= +//function : GEOMImpl_TorusDriver +//purpose : +//======================================================================= +GEOMImpl_TorusDriver::GEOMImpl_TorusDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_TorusDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ITorus aCI (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == TORUS_RR) { + aShape = BRepPrimAPI_MakeTorus(aCI.GetRMajor(), aCI.GetRMinor()).Shape(); + + } else if (aType == TORUS_PNT_VEC_RR) { + Handle(GEOM_Function) aRefPoint = aCI.GetCenter(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapePnt.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise("Torus Center must be a vertex"); + } + if (aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_TypeMismatch::Raise("Torus Axis must be an edge"); + } + + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_ConstructionError::Raise("Bad edge for the Torus Axis given"); + } + + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aV.Magnitude() < Precision::Confusion()) { + Standard_ConstructionError::Raise + ("End vertices of edge, defining the Torus Axis, are too close"); + } + + gp_Ax2 anAxes (aP, aV); + BRepPrimAPI_MakeTorus MT (anAxes, aCI.GetRMajor(), aCI.GetRMinor()); + if (!MT.IsDone()) MT.Build(); + if (!MT.IsDone()) StdFail_NotDone::Raise("Torus construction algorithm has failed"); + aShape = MT.Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_TorusDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_TorusDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TorusDriver", + sizeof(GEOMImpl_TorusDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_TorusDriver) Handle(GEOMImpl_TorusDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_TorusDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_TorusDriver))) { + _anOtherObject = Handle(GEOMImpl_TorusDriver)((Handle(GEOMImpl_TorusDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.hxx b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx new file mode 100644 index 000000000..cca5123ca --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_TorusDriver.ixx +// Module : GEOMImpl + +#ifndef _GEOMImpl_TorusDriver_HeaderFile +#define _GEOMImpl_TorusDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_TorusDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_TorusDriver); + +class Handle(GEOMImpl_TorusDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_TorusDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_TorusDriver)(const Handle(GEOMImpl_TorusDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_TorusDriver)(const GEOMImpl_TorusDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_TorusDriver)& operator=(const Handle(GEOMImpl_TorusDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_TorusDriver)& operator=(const GEOMImpl_TorusDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_TorusDriver* operator->() + { + return (GEOMImpl_TorusDriver *)ControlAccess(); + } + + GEOMImpl_TorusDriver* operator->() const + { + return (GEOMImpl_TorusDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_TorusDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_TorusDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_TorusDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_TorusDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_TorusDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_TorusDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_TorusDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_TorusDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx new file mode 100644 index 000000000..33a6590df --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx @@ -0,0 +1,243 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_TranslateDriver::GetID() +{ + static Standard_GUID aTranslateDriver("FF1BBB03-5D14-4df2-980B-3A668264EA16"); + return aTranslateDriver; +} + + +//======================================================================= +//function : GEOMImpl_TranslateDriver +//purpose : +//======================================================================= + +GEOMImpl_TranslateDriver::GEOMImpl_TranslateDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const +{ + if(Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + if(aFunction.IsNull()) return 0; + + GEOMImpl_ITranslate TI(aFunction); + gp_Trsf aTrsf; + gp_Pnt aP1, aP2; + Standard_Integer aType = aFunction->GetType(); + + Handle(GEOM_Function) anOriginalFunction = TI.GetOriginal(); + if(anOriginalFunction.IsNull()) return 0; + TopoDS_Shape aShape, anOriginal = anOriginalFunction->GetValue(); + if(anOriginal.IsNull()) return 0; + + if(aType == TRANSLATE_TWO_POINTS || aType == TRANSLATE_TWO_POINTS_COPY) { + Handle(GEOM_Function) aPoint1 = TI.GetPoint1(); + Handle(GEOM_Function) aPoint2 = TI.GetPoint2(); + if(aPoint1.IsNull() || aPoint2.IsNull()) return 0; + TopoDS_Shape aV1 = aPoint1->GetValue(); + TopoDS_Shape aV2 = aPoint2->GetValue(); + if(aV1.IsNull() || aV1.ShapeType() != TopAbs_VERTEX) return 0; + if(aV2.IsNull() || aV2.ShapeType() != TopAbs_VERTEX) return 0; + + aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aV1)); + aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aV2)); + + aTrsf.SetTranslation(aP1, aP2); + BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + aShape = aTransformation.Shape(); + + } else if(aType == TRANSLATE_VECTOR || aType == TRANSLATE_VECTOR_COPY) { + Handle(GEOM_Function) aVector = TI.GetVector(); + if(aVector.IsNull()) return 0; + TopoDS_Shape aV = aVector->GetValue(); + if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(aV); + + aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)); + aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge)); + + aTrsf.SetTranslation(aP1, aP2); + BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + aShape = aTransformation.Shape(); + } + else if(aType == TRANSLATE_XYZ || aType == TRANSLATE_XYZ_COPY) { + gp_Vec aVec(TI.GetDX(), TI.GetDY(), TI.GetDZ()); + aTrsf.SetTranslation(aVec); + BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False); + aShape = aTransformation.Shape(); + } + else if(aType == TRANSLATE_1D) { + Standard_Real DX, DY, DZ, step = TI.GetStep1(); + Standard_Integer nbtimes = TI.GetNbIter1(); + gp_Vec myVec ; + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound( aCompound ); + + Handle(GEOM_Function) aVector = TI.GetVector(); + if(aVector.IsNull()) return 0; + TopoDS_Shape aV = aVector->GetValue(); + if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(aV); + + gp_Vec Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge))); + Vec.Normalize(); + + for (int i = 0; i < nbtimes; i++ ) { + DX = i * step * Vec.X() ; + DY = i * step * Vec.Y() ; + DZ = i * step * Vec.Z() ; + myVec.SetCoord( DX, DY, DZ ) ; + aTrsf.SetTranslation(myVec) ; + BRepBuilderAPI_Transform aTransformation(anOriginal, aTrsf, Standard_False) ; + B.Add(aCompound , aTransformation.Shape() ); + } + aShape = aCompound; + } + else if(aType == TRANSLATE_2D) { + Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2(); + Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2(); + gp_Vec myVec ; + Handle(GEOM_Function) aVector = TI.GetVector(); + if(aVector.IsNull()) return 0; + TopoDS_Shape aV = aVector->GetValue(); + if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0; + TopoDS_Edge anEdge = TopoDS::Edge(aV); + + gp_Vec Vec1(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge))); + Vec1.Normalize(); + + Handle(GEOM_Function) aVector2 = TI.GetVector2(); + if(aVector2.IsNull()) return 0; + aV = aVector2->GetValue(); + if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0; + anEdge = TopoDS::Edge(aV); + + gp_Vec Vec2(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge))); + Vec2.Normalize(); + + TopoDS_Compound aCompound; + BRep_Builder B; + B.MakeCompound( aCompound ); + + for (int i = 0; i < nbtimes1; i++ ) { + for (int j = 0; j < nbtimes2; j++ ) { + DX = i * step1 * Vec1.X() + j * step2 * Vec2.X() ; + DY = i * step1 * Vec1.Y() + j * step2 * Vec2.Y() ; + DZ = i * step1 * Vec1.Z() + j * step2 * Vec2.Z() ; + myVec.SetCoord( DX, DY, DZ ) ; + aTrsf.SetTranslation(myVec) ; + BRepBuilderAPI_Transform myBRepTransformation(anOriginal, aTrsf, Standard_False) ; + B.Add(aCompound , myBRepTransformation.Shape() ); + } + } + aShape = aCompound; + } + else return 0; + + + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_TranslateDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TranslateDriver", + sizeof(GEOMImpl_TranslateDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= + +const Handle(GEOMImpl_TranslateDriver) Handle(GEOMImpl_TranslateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_TranslateDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_TranslateDriver))) { + _anOtherObject = Handle(GEOMImpl_TranslateDriver)((Handle(GEOMImpl_TranslateDriver)&)AnObject); + } + } + + return _anOtherObject ; +} + + diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx new file mode 100644 index 000000000..48c05cff5 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx @@ -0,0 +1,158 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_TranslateDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_TranslateDriver_HeaderFile +#define _GEOMImpl_TranslateDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_TranslateDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_TranslateDriver); + +class Handle(GEOMImpl_TranslateDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_TranslateDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_TranslateDriver)(const Handle(GEOMImpl_TranslateDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_TranslateDriver)(const GEOMImpl_TranslateDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_TranslateDriver)& operator=(const Handle(GEOMImpl_TranslateDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_TranslateDriver)& operator=(const GEOMImpl_TranslateDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_TranslateDriver* operator->() + { + return (GEOMImpl_TranslateDriver *)ControlAccess(); + } + + GEOMImpl_TranslateDriver* operator->() const + { + return (GEOMImpl_TranslateDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_TranslateDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_TranslateDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_TranslateDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_TranslateDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_TranslateDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_TranslateDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_TranslateDriver) == AType || TFunction_Driver::IsKind(AType)); } + + +}; + +#endif diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx new file mode 100755 index 000000000..392163c0d --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -0,0 +1,230 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +//GEOM_Object types + +#define GEOM_COPY 0 +#define GEOM_IMPORT 1 + +#define GEOM_POINT 2 +#define GEOM_VECTOR 3 +#define GEOM_PLANE 4 +#define GEOM_LINE 5 + +#define GEOM_TORUS 6 +#define GEOM_BOX 7 +#define GEOM_CYLINDER 8 +#define GEOM_CONE 9 +#define GEOM_SPHERE 10 + +#define GEOM_PRISM 11 +#define GEOM_REVOLUTION 12 + +#define GEOM_BOOLEAN 13 +#define GEOM_PARTITION 14 + +#define GEOM_POLYLINE 15 +#define GEOM_CIRCLE 16 +#define GEOM_SPLINE 17 +#define GEOM_ELLIPSE 18 +#define GEOM_CIRC_ARC 19 + +#define GEOM_FILLET 20 +#define GEOM_CHAMFER 21 + +#define GEOM_EDGE 22 +#define GEOM_WIRE 23 +#define GEOM_FACE 24 +#define GEOM_SHELL 25 +#define GEOM_SOLID 26 +#define GEOM_COMPOUND 27 + +#define GEOM_SUBSHAPE 28 + +#define GEOM_PIPE 29 + +#define GEOM_ARCHIMEDE 30 + +#define GEOM_FILLING 31 + +#define GEOM_EXPLODE 32 + +#define GEOM_GLUED 33 + +#define GEOM_SKETCHER 34 + +#define GEOM_CDG 35 + +#define GEOM_FREE_BOUNDS 36 + +#define GEOM_GROUP 37 + +#define GEOM_BLOCK 38 + +#define GEOM_MARKER 39 + +//GEOM_Function types + +#define COPY_WITH_REF 1 +#define COPY_WITHOUT_REF 2 + +#define EXPORT_SHAPE 1 +#define IMPORT_SHAPE 1 + +#define POINT_XYZ 1 +#define POINT_XYZ_REF 2 +#define POINT_CURVE_PAR 3 + +#define VECTOR_TWO_PNT 1 +#define VECTOR_DX_DY_DZ 2 + +#define PLANE_PNT_VEC 1 +#define PLANE_FACE 2 +#define PLANE_THREE_PNT 3 + +#define LINE_TWO_PNT 1 +#define LINE_PNT_DIR 2 + +#define TRANSLATE_TWO_POINTS 1 +#define TRANSLATE_VECTOR 2 +#define TRANSLATE_TWO_POINTS_COPY 3 +#define TRANSLATE_VECTOR_COPY 4 +#define TRANSLATE_1D 5 +#define TRANSLATE_2D 6 +#define TRANSLATE_XYZ 7 +#define TRANSLATE_XYZ_COPY 8 + +#define ROTATE 1 +#define ROTATE_COPY 2 +#define ROTATE_1D 3 +#define ROTATE_2D 4 + +#define MIRROR_PLANE 1 +#define MIRROR_PLANE_COPY 2 +#define MIRROR_AXIS 3 +#define MIRROR_AXIS_COPY 4 +#define MIRROR_POINT 5 +#define MIRROR_POINT_COPY 6 + +#define OFFSET_SHAPE 1 +#define OFFSET_SHAPE_COPY 2 + +#define SCALE_SHAPE 1 +#define SCALE_SHAPE_COPY 2 + +#define POSITION_SHAPE 1 +#define POSITION_SHAPE_COPY 2 + +#define TORUS_RR 1 +#define TORUS_PNT_VEC_RR 2 + +#define BOX_DX_DY_DZ 1 +#define BOX_TWO_PNT 2 + +#define CYLINDER_R_H 1 +#define CYLINDER_PNT_VEC_R_H 2 + +#define CONE_R1_R2_H 1 +#define CONE_PNT_VEC_R1_R2_H 2 + +#define SPHERE_R 1 +#define SPHERE_PNT_R 2 + +#define PRISM_BASE_VEC_H 1 +#define PRISM_BASE_TWO_PNT 2 + +#define REVOLUTION_BASE_AXIS_ANGLE 1 + +#define PIPE_BASE_PATH 1 + +#define BOOLEAN_COMMON 1 +#define BOOLEAN_CUT 2 +#define BOOLEAN_FUSE 3 +#define BOOLEAN_SECTION 4 + +#define PARTITION_PARTITION 1 +#define PARTITION_HALF 2 + +#define POLYLINE_POINTS 1 + +#define CIRCLE_THREE_PNT 1 +#define CIRCLE_PNT_VEC_R 2 + +#define SPLINE_BEZIER 1 +#define SPLINE_INTERPOLATION 2 + +#define ELLIPSE_PNT_VEC_RR 1 + +#define CIRC_ARC_THREE_PNT 1 + +#define FILLET_SHAPE_ALL 1 +#define FILLET_SHAPE_EDGES 2 +#define FILLET_SHAPE_FACES 3 + +#define CHAMFER_SHAPE_ALL 1 +#define CHAMFER_SHAPE_EDGE 2 +#define CHAMFER_SHAPE_FACES 3 + +#define WIRE_EDGES 1 +#define FACE_WIRE 2 +#define SHELL_FACES 3 +#define SOLID_SHELL 4 +#define SOLID_SHELLS 5 +#define COMPOUND_SHAPES 6 +#define SUBSHAPE_SORTED 7 +#define SUBSHAPE_NOT_SORTED 8 +#define FACE_WIRES 9 +#define REVERSE_ORIENTATION 10 + +#define ARCHIMEDE_TYPE 1 + +// Shape Healing operators +#define SHAPE_PROCESS 1 +#define SUPPRESS_FACES 2 +#define CLOSE_CONTOUR 3 +#define REMOVE_INT_WIRES 4 +#define FILL_HOLES 5 +#define SEWING 6 +#define DIVIDE_EDGE 7 + +#define BASIC_FILLING 1 + +#define GLUE_FACES 1 + +#define SKETCHER_NINE_DOUBLS 1 +#define SKETCHER_PLANE 2 + +#define CDG_MEASURE 1 + +#define GROUP_FUNCTION 1 + +// Blocks +#define BLOCK_FACE_FOUR_PNT 1 +#define BLOCK_FACE_FOUR_EDGES 2 +#define BLOCK_FACE_TWO_EDGES 3 +#define BLOCK_SIX_FACES 4 +#define BLOCK_TWO_FACES 5 +#define BLOCK_MULTI_TRANSFORM_1D 6 +#define BLOCK_MULTI_TRANSFORM_2D 7 +#define BLOCK_COMPOUND_GLUE 8 +#define BLOCK_REMOVE_EXTRA 9 +#define BLOCK_COMPOUND_IMPROVE 10 + +// Marker +#define MARKER_CS 1 diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.cxx b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx new file mode 100644 index 000000000..531077599 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx @@ -0,0 +1,155 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_VectorDriver::GetID() +{ + static Standard_GUID aVectorDriver("FF1BBB04-5D14-4df2-980B-3A668264EA16"); + return aVectorDriver; +} + + +//======================================================================= +//function : GEOMImpl_VectorDriver +//purpose : +//======================================================================= +GEOMImpl_VectorDriver::GEOMImpl_VectorDriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IVector aPI (aFunction); + Standard_Integer aType = aFunction->GetType(); + if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT) return 0; + + TopoDS_Shape aShape; + + if (aType == VECTOR_DX_DY_DZ) { + gp_Pnt P1 = gp::Origin(); + gp_Pnt P2 (aPI.GetDX(), aPI.GetDY(), aPI.GetDZ()); + if (P1.Distance(P2) < Precision::Confusion()) { + TCollection_AsciiString aMsg ("Can not build vector with length, less than "); + aMsg += TCollection_AsciiString(Precision::Confusion()); + Standard_ConstructionError::Raise(aMsg.ToCString()); + } + aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + } else if (aType == VECTOR_TWO_PNT) { + Handle(GEOM_Function) aRefPnt1 = aPI.GetPoint1(); + Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2(); + TopoDS_Shape aShape1 = aRefPnt1->GetValue(); + TopoDS_Shape aShape2 = aRefPnt2->GetValue(); + if (aShape1.ShapeType() != TopAbs_VERTEX || + aShape2.ShapeType() != TopAbs_VERTEX) return 0; + if (aShape1.IsSame(aShape2)) { + Standard_ConstructionError::Raise("The end points must be different"); + } + TopoDS_Vertex V1 = TopoDS::Vertex(aShape1); + TopoDS_Vertex V2 = TopoDS::Vertex(aShape2); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + gp_Pnt P2 = BRep_Tool::Pnt(V2); + if (P1.Distance(P2) < Precision::Confusion()) { + Standard_ConstructionError::Raise("The end points are too close"); + } + aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape(); + } else { + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + + +//======================================================================= +//function : GEOMImpl_VectorDriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_VectorDriver_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_VectorDriver", + sizeof(GEOMImpl_VectorDriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_VectorDriver) Handle(GEOMImpl_VectorDriver)::DownCast + (const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_VectorDriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_VectorDriver))) { + _anOtherObject = Handle(GEOMImpl_VectorDriver)((Handle(GEOMImpl_VectorDriver)&)AnObject); + } + } + + return _anOtherObject ; +} diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.hxx b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx new file mode 100644 index 000000000..ed31f6dc9 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx @@ -0,0 +1,157 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : GEOMImpl_VectorDriver.hxx +// Module : GEOMImpl + +#ifndef _GEOMImpl_VectorDriver_HeaderFile +#define _GEOMImpl_VectorDriver_HeaderFile + +#ifndef _TColStd_SequenceOfExtendedString_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_GUID_HeaderFile +#include +#endif + +#ifndef _Handle_TFunction_Driver_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TFunction_Driver); +class GEOMImpl_VectorDriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_VectorDriver); + +class Handle(GEOMImpl_VectorDriver) : public Handle(TFunction_Driver) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_VectorDriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_VectorDriver)(const Handle(GEOMImpl_VectorDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + { + } + + Handle(GEOMImpl_VectorDriver)(const GEOMImpl_VectorDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + { + } + + Handle(GEOMImpl_VectorDriver)& operator=(const Handle(GEOMImpl_VectorDriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_VectorDriver)& operator=(const GEOMImpl_VectorDriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_VectorDriver* operator->() + { + return (GEOMImpl_VectorDriver *)ControlAccess(); + } + + GEOMImpl_VectorDriver* operator->() const + { + return (GEOMImpl_VectorDriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_VectorDriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_VectorDriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +#ifndef _TFunction_Driver_HeaderFile +#include +#endif +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif +#ifndef _Standard_CString_HeaderFile +#include +#endif + +class TColStd_SequenceOfExtendedString; + + +class GEOMImpl_VectorDriver : public TFunction_Driver { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // +Standard_EXPORT GEOMImpl_VectorDriver(); +Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; +Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} +Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT ~GEOMImpl_VectorDriver() {}; + + + // Type management + // +Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_VectorDriver_Type_(); +Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_VectorDriver) ; } +Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_VectorDriver) == AType || TFunction_Driver::IsKind(AType)); } + +}; + +#endif diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx new file mode 100644 index 000000000..03d857168 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -0,0 +1,653 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_Tools.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "GEOMToolsGUI.h" + +#include "GeometryGUI.h" +#include "GEOM_Actor.h" +#include "GEOMBase.h" +#include "GEOM_Operation.h" +#include "GEOM_Displayer.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "utilities.h" + +// QT Includes +#include +#include + +// OCCT Includes +#include + +using namespace std; + +typedef QMap FilterMap; + +//======================================================================= +// function : getFileName +// purpose : Selection of a file name for Import/Export. Returns also +// the selected file type code through argument. +//======================================================================= +static QString getFileName( QWidget* parent, + const QString& initial, + const FilterMap& filterMap, + const QString& caption, + bool open, + QString& format ) +{ + static QString lastUsedFilter; + QStringList filters; + for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) + filters.push_back( it.key() ); + + SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true ); + if ( !caption.isEmpty() ) + fd->setCaption( caption ); + + if ( !initial.isEmpty() ) + fd->setSelection( initial ); + + if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) + fd->setSelectedFilter( lastUsedFilter ); + + fd->setFilters( filters ); + + fd->exec(); + QString filename = fd->selectedFile(); + format = filterMap[fd->selectedFilter()]; + lastUsedFilter = fd->selectedFilter(); + delete fd; + qApp->processEvents(); + return filename; +} + +//======================================================================= +// function : GEOMToolsGUI() +// purpose : Constructor +//======================================================================= +GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) +: GEOMGUI( parent ) +{ +} + + +//======================================================================= +// function : ~GEOMToolsGUI() +// purpose : Destructor +//======================================================================= +GEOMToolsGUI::~GEOMToolsGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +{ + getGeometryGUI()->EmitSignalDeactivateDialog(); + + switch (theCommandID) + { + case 31: // COPY + { + OnEditCopy(); + break; + } + case 33: // DELETE + { + OnEditDelete(); + break; + } + case 111: // IMPORT BREP + case 112: // IMPORT IGES + case 113: // IMPORT STEP + { + Import(); + break; + } + case 121: // EXPORT BREP + case 122: // EXPORT IGES + case 123: // EXPORT STEP + { + Export(); + break; + } + case 411: // SETTINGS - ADD IN STUDY + { + // SAN -- TO BE REMOVED !!! + break; + } + case 412: // SETTINGS - SHADING COLOR + { + OnSettingsColor(); + break; + } + case 413: // SETTINGS - ISOS + { + OnSettingsIsos(); + break; + } + case 414: // SETTINGS : STEP VALUE FOR SPIN BOXES + { + OnSettingsStep(); + break; + } + case 804: // ADD IN STUDY - POPUP VIEWER + { + // SAN -- TO BE REMOVED !!!! + break; + } + case 901: // RENAME + { + OnRename(); + break; + } + case 5103: // CHECK GEOMETRY + { + OnCheckGeometry(); + break; + } + case 8032: // COLOR - POPUP VIEWER + { + OnColor(); + break; + } + case 8033: // TRANSPARENCY - POPUP VIEWER + { + OnTransparency(); + break; + } + case 8034: // ISOS - POPUP VIEWER + { + OnNbIsos(); + break; + } + case 9024 : // OPEN - OBJBROSER POPUP + { + OnOpen(); + break; + } + default: + { + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + + +//=============================================================================== +// function : OnEditDelete() +// purpose : +//=============================================================================== +void GEOMToolsGUI::OnEditDelete() +{ + SALOME_ListIO selected; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if ( aSelMgr && appStudy ) { + aSelMgr->selectedObjects( selected, QString::null, false ); + if ( !selected.IsEmpty() ) { + _PTR(Study) aStudy = appStudy->studyDS(); + + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warn1 ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + return; + } + + // VSR 17/11/04: check if all objects selected belong to GEOM component --> start + // modifications of ASV 01.06.05 + QString parentComp = getParentComponent( aStudy, selected ); + const char* geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() ); + QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR ) ); + + if ( parentComp != geomComp ) { + SUIT_MessageBox::warn1 ( app->desktop(), + QObject::tr("ERR_ERROR"), + QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ), + QObject::tr("BUT_OK") ); + return; + } + // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish + + if ( SUIT_MessageBox::warn2( app->desktop(), + QObject::tr( "GEOM_WRN_WARNING" ), + QObject::tr( "GEOM_REALLY_DELETE" ), + QObject::tr( "GEOM_BUT_YES" ), + QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 ) + return; + + // QAD_Operation* op = new SALOMEGUI_ImportOperation(.....); + // op->start(); + + // prepare list of SALOME_Views + QPtrList views; + SALOME_View* view; + // fill the list + ViewManagerList vmans = app->viewManagers(); + SUIT_ViewManager* vman; + for ( vman = vmans.first(); vman; vman = vmans.next() ) { + SUIT_ViewModel* vmod = vman->getViewModel(); + view = dynamic_cast ( vmod ); // must work for OCC and VTK views + if ( view ) + views.append( view ); + } + + _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder()); + _PTR(GenericAttribute) anAttr; + GEOM_Displayer* disp = new GEOM_Displayer( appStudy ); + + // MAIN LOOP OF SELECTED OBJECTS + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + + Handle(SALOME_InteractiveObject) io = It.Value(); + if ( !io->hasEntry() ) + continue; + + _PTR(SObject) obj ( aStudy->FindObjectID( io->getEntry() ) ); + + // disable removal of "Geometry" component object + if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) ) + continue; + + // iterate through all children of obj, find IOR attributes on children + // and remove shapes that correspond to these IORs + for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) { + _PTR(SObject) child (it->Value()); + if (child->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR (anAttr); + + // Delete child( s ) shape in Client : + const TCollection_AsciiString ASCior ((char*)anIOR->Value().c_str()); + getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCior); + + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(child); + GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow(corbaObj); + if (!CORBA::is_nil(geomObj)) { + for (view = views.first(); view; view = views.next()) { + disp->Erase(geomObj, true, view); + } + } + } + } // for ( children of obj ) + + // Erase main graphical object + for ( view = views.first(); view; view = views.next() ) + disp->Erase( io, true, view ); + + // Delete main shape in Client : + if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) { + _PTR(AttributeIOR) anIOR( anAttr ); + const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() ); + getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor ); + } + + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj); + GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); + if ( !CORBA::is_nil( geomObj ) ) + GeometryGUI::GetGeomGen()->RemoveObject( geomObj ); + + // Remove objects from Study + aStudyBuilder->RemoveObject( obj ); + + //deleted = true; + } // MAIN LOOP of selected + + selected.Clear(); + aSelMgr->setSelectedObjects( selected ); + getGeometryGUI()->updateObjBrowser(); + } // if ( selected not empty ) + } // if ( selMgr && appStudy ) + + app->updateActions(); //SRN: To update a Save button in the toolbar + + } // if ( app ) + + + // if ( deleted ) + // op->finish(); + // else + // op->abort(); +} + + +//============================================================================== +// function : OnEditCopy() +// purpose : +//============================================================================== +void GEOMToolsGUI::OnEditCopy() +{ +/* + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + GEOM::string_array_var listIOR = new GEOM::string_array; + + const SALOME_ListIO& List = Sel->StoredIObjects(); + + myGeomBase->ConvertListOfIOInListOfIOR(List, listIOR); + + Sel->ClearIObjects(); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + int aStudyID = aStudy->StudyId(); + + for (unsigned int ind = 0; ind < listIOR->length();ind++) { + GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]); + try { + GEOM::GEOM_IInsertOperations_var IOp = myGeom->GetIInsertOperations(aStudyID); + GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit); + myGeomBase->Display(result); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); +*/ +} + + +//===================================================================================== +// function : Import +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Import() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( getGeometryGUI()->getApp() ); + //SUIT_Application* app = getGeometryGUI()->getApp(); + if (! app) return false; + + SalomeApp_Study* stud = dynamic_cast ( app->activeStudy() ); + if ( !stud ) { + cout << "FAILED to cast active study to SalomeApp_Study" << endl; + return false; + } + _PTR(Study) aStudy = stud->studyDS(); + + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warn1 ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + return false; + } + + GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); + if ( CORBA::is_nil( eng ) ) { + SUIT_MessageBox::error1( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ), + QObject::tr("BUT_OK") ); + return false; + } + + GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() ); + if ( aInsOp->_is_nil() ) + return false; + + GEOM::GEOM_Object_var anObj; + + // Obtain a list of available import formats + FilterMap aMap; + GEOM::string_array_var aFormats, aPatterns; + aInsOp->ImportTranslators( aFormats, aPatterns ); + + for ( int i = 0, n = aFormats->length(); i < n; i++ ) + aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); + + QString fileType; + + QString fileName = getFileName(app->desktop(), "", aMap, + tr("GEOM_MEN_IMPORT"), true, fileType); + if (fileName.isEmpty() || fileType.isEmpty()) + return false; + + GEOM_Operation* anOp = new GEOM_Operation (app, aInsOp.in()); + try { + SUIT_OverrideCursor wc; + + app->putInfo(tr("GEOM_PRP_LOADING").arg(SUIT_Tools::file(fileName, /*withExten=*/true))); + + anOp->start(); + + CORBA::String_var fileN = fileName.latin1(); + CORBA::String_var fileT = fileType.latin1(); + anObj = aInsOp->Import(fileN, fileT); + + if ( !anObj->_is_nil() && aInsOp->IsDone() ) { + anObj->SetName(GEOMBase::GetDefaultName(QObject::tr("GEOM_IMPORT")).latin1()); + QString aPublishObjName = + GEOMBase::GetDefaultName(SUIT_Tools::file(fileName, /*withExten=*/true)); + + SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy); + GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy, + SALOMEDS::SObject::_nil(), + anObj, + aPublishObjName); + + GEOM_Displayer( stud ).Display( anObj.in() ); + + // update data model and object browser + getGeometryGUI()->updateObjBrowser( true ); + + anOp->commit(); + } + else { + anOp->abort(); + wc.suspend(); + SUIT_MessageBox::error1( app->desktop(), + QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), + QObject::tr("BUT_OK") ); + } + } + catch( const SALOME::SALOME_Exception& S_ex ) { + //QtCatchCorbaException(S_ex); + anOp->abort(); + return false; + } + + app->updateActions(); //SRN: To update a Save button in the toolbar + + return true; +} + + +//===================================================================================== +// function : Export +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Export() +{ + SalomeApp_Application* app = getGeometryGUI()->getApp(); + if (!app) return false; + + SalomeApp_Study* stud = dynamic_cast ( app->activeStudy() ); + if ( !stud ) { + cout << "FAILED to cast active study to SalomeApp_Study" << endl; + return false; + } + _PTR(Study) aStudy = stud->studyDS(); + + GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); + if ( CORBA::is_nil( eng ) ) { + SUIT_MessageBox::error1( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ), + QObject::tr("BUT_OK") ); + return false; + } + + GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() ); + if ( aInsOp->_is_nil() ) + return false; + + // Obtain a list of available export formats + FilterMap aMap; + GEOM::string_array_var aFormats, aPatterns; + aInsOp->ExportTranslators( aFormats, aPatterns ); + for ( int i = 0, n = aFormats->length(); i < n; i++ ) + aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); + + // Get selected objects + LightApp_SelectionMgr* sm = app->selectionMgr(); + if ( !sm ) + return false; + + SALOME_ListIO selectedObjects; + sm->selectedObjects( selectedObjects ); + + SALOME_ListIteratorOfListIO It( selectedObjects ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(IObject, found); + + if ( !found || anObj->_is_nil() ) + continue; + + QString fileType; + QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, + tr("GEOM_MEN_EXPORT"), false, fileType); + + // User has pressed "Cancel" --> stop the operation + if ( file.isEmpty() || fileType.isEmpty() ) + return false; + + GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() ); + try { + SUIT_OverrideCursor wc; + + app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) ); + + anOp->start(); + + + aInsOp->Export( anObj, file, fileType.latin1() ); + + if ( aInsOp->IsDone() ) + anOp->commit(); + else + { + anOp->abort(); + wc.suspend(); + SUIT_MessageBox::error1( app->desktop(), + QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), + QObject::tr("BUT_OK") ); + return false; + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + //QtCatchCorbaException(S_ex); + anOp->abort(); + return false; + } + } + + return true; +} + + +QString GEOMToolsGUI::getParentComponent( _PTR( Study ) study, const SALOME_ListIO& iobjs ) +{ + QString parentComp; + + for ( SALOME_ListIteratorOfListIO it( iobjs ); it.More(); it.Next() ) { + + Handle(SALOME_InteractiveObject) io = it.Value(); + if ( !io->hasEntry() ) + continue; + + QString compName = getParentComponent( study->FindObjectID( io->getEntry() ) ); + + if ( parentComp.isNull() ) + parentComp = compName; + else if ( parentComp.compare( compName) != 0 ) { // objects belonging to different components are selected + parentComp = QString::null; + break; + } + } + + return parentComp; +} + +QString GEOMToolsGUI::getParentComponent( _PTR( SObject ) obj ) +{ + if ( obj ) { + _PTR(SComponent) comp = obj->GetFatherComponent(); + if ( comp ) { + _PTR(GenericAttribute) anAttr; + if ( comp->FindAttribute( anAttr, "AttributeName") ) { + _PTR(AttributeName) aName( anAttr ); + return QString( aName->Value().c_str() ); + } + } + } + return QString(); +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WNT + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) + { + return new GEOMToolsGUI( parent ); + } +} diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc new file mode 100644 index 000000000..19e6ed621 --- /dev/null +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -0,0 +1,113 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include "GEOM_Gen_i.hh" +#include +#include +#include +#include + +//======================================================================= +//function : DumpPython +//purpose : +//======================================================================= + +Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript) +{ + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); + if(CORBA::is_nil(aStudy)) + return new Engines::TMPFile(0); + + SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType()); + if(CORBA::is_nil(aSO)) + return new Engines::TMPFile(0); + + Resource_DataMapOfAsciiStringAsciiString aMap; + + SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO); + for(Itr->InitEx(true); Itr->More(); Itr->Next()) { + SALOMEDS::SObject_var aValue = Itr->Value(); + CORBA::String_var IOR = aValue->GetIOR(); + if(strlen(IOR.in()) > 0) { + CORBA::Object_var obj = _orb->string_to_object(IOR); + GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_narrow(obj); + if(!CORBA::is_nil(GO)) { + CORBA::String_var aName = aValue->GetName(); + CORBA::String_var anEntry = GO->GetEntry(); + aMap.Bind( (char*)anEntry.in(), (char*)aName.in() ); + } + } + } + + TCollection_AsciiString aScript = + "### This file is generated by SALOME automatically by dump python funcitonality\n" + "### of GEOM component\n\n"; + aScript += _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, isValidScript); + + int aLen = aScript.Length(); + unsigned char* aBuffer = new unsigned char[aLen+1]; + strcpy((char*)aBuffer, aScript.ToCString()); + + CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; + Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); + + return aStreamFile._retn(); +} + +//======================================================================= +//function : GetDumpName +//purpose : +//======================================================================= + +char* GEOM_Gen_i::GetDumpName (const char* theStudyEntry) +{ + const char* name = _impl->GetDumpName( theStudyEntry ); + if ( name && strlen( name ) > 0 ) + return strdup( name ); + + return NULL; +} + +//======================================================================= +//function : GetAllDumpNames +//purpose : +//======================================================================= + +GEOM::string_array* GEOM_Gen_i::GetAllDumpNames() +{ + Handle(TColStd_HSequenceOfAsciiString) aHSeq = _impl->GetAllDumpNames(); + int i = 0, aLen = aHSeq->Length(); + + GEOM::string_array_var seq = new GEOM::string_array(); + seq->length(aLen); + + for (; i < aLen; i++) { + seq[i] = CORBA::string_dup(aHSeq->Value(i + 1).ToCString()); + } + + return seq._retn(); +} diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc new file mode 100644 index 000000000..c7a7f73f4 --- /dev/null +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -0,0 +1,887 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include "GEOM_Gen_i.hh" +#include "GEOM_Object_i.hh" + +#include + +#include "Utils_CorbaException.hxx" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" +#include "utilities.h" + +#include "GEOM_Object_i.hh" +#include "GEOM_Object.hxx" +#include "GEOM_Function.hxx" +#include "GEOMImpl_Types.hxx" +#include "GEOMImpl_CopyDriver.hxx" + +// Cascade headers +#include +#include +#include +#include +#include +#include +#include + +#include "SALOMEDS_Tool.hxx" + +//============================================================================ +// function : GEOM_Gen_i() +// purpose : constructor to be called for servant creation. +//============================================================================ +GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName) +{ + _thisObj = this; + _id = _poa->activate_object(_thisObj); + name_service = new SALOME_NamingService(_orb); + + _impl = new ::GEOMImpl_Gen; + +} + + + +//============================================================================ +// function : ~GEOM_Gen_i() +// purpose : destructor +//============================================================================ +GEOM_Gen_i::~GEOM_Gen_i() { + delete name_service; + delete _impl; +} + + +//============================================================================ +// function : IORToLocalPersistentID() +// purpose : +//============================================================================ +char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(IORString)); + if (!CORBA::is_nil(anObject)) { + return strdup(anObject->GetEntry()); + } + return 0; +} + + +//============================================================================ +// function : LocalPersistentIDToIOR() +// purpose : Create/Load CORBA object from a persistent ref (an entry) +// : Used when a study is loaded +// : The IOR (IORName) of object created is returned +//============================================================================ +char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + SALOMEDS::Study_var aStudy = theSObject->GetStudy(); + + Handle(GEOM_Object) anObject = _impl->GetObject(aStudy->StudyId(), const_cast(aLocalPersistentID)); + TCollection_AsciiString anEntry; + TDF_Tool::Entry(anObject->GetEntry(), anEntry); + GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString()); + + CORBA::String_var aPersRefString = _orb->object_to_string(obj); + return strdup(aPersRefString); +} + +//============================================================================ +// function : CanPublishInStudy +// purpose : +//============================================================================ +bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) +{ + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(theIOR); + return !(anObject->_is_nil()); +} + + +//============================================================================ +// function : PublishInStudy +// purpose : +//============================================================================ +SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) +{ + Unexpect aCatch(SALOME_SalomeException); + SALOMEDS::SObject_var aResultSO; + if(CORBA::is_nil(theObject) || theStudy->_is_nil()) return aResultSO; + + GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow(theObject); + if(aShape->_is_nil()) return aResultSO; + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); + + SALOMEDS::SComponent_var aFather = theStudy->FindComponent("GEOM"); + if (aFather->_is_nil()) { + aFather = aStudyBuilder->NewComponent("GEOM"); + anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue("Geometry"); + anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap"); + SALOMEDS::AttributePixMap::_narrow(anAttr)->SetPixMap("ICON_OBJBROWSER_Geometry"); + aStudyBuilder->DefineComponentInstance(aFather, GEOM_Gen::_this()); + } + if (aFather->_is_nil()) return aResultSO; + + if (CORBA::is_nil(theSObject)) { + aResultSO = aStudyBuilder->NewObject(aFather); + } else { + if (!theSObject->ReferencedObject(aResultSO)) + aResultSO = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for the method AddInStudy with theFather argumenet != NULL + //THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM); + } + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + char *aGeomObjIOR = _orb->object_to_string(theObject); + anIOR->SetValue(strdup(aGeomObjIOR)); + + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap"); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + TCollection_AsciiString aShapeName("Shape_"); + + if ( aShape->GetType() == GEOM_GROUP ) { + GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() ); + switch ( (TopAbs_ShapeEnum)anOp->GetType( aShape ) ) { + case TopAbs_VERTEX: + aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_PNT" ); + aShapeName = "Group_Of_Vertices_"; + break; + case TopAbs_EDGE: + aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_EDGE" ); + aShapeName = "Group_Of_Edges_"; + break; + case TopAbs_FACE: + aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_FACE" ); + aShapeName = "Group_Of_Faces_"; + break; + case TopAbs_SOLID: + aPixmap->SetPixMap( "ICON_OBJBROWSER_GROUP_SOLID" ); + aShapeName = "Group_Of_Solids_"; + break; + } + } else if ( aShape->GetType() == GEOM_MARKER ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_LCS" ); + aShapeName = "LocalCS_"; + } else if ( aShape->GetShapeType() == GEOM::COMPOUND ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); + aShapeName = "Compound_"; + } else if ( aShape->GetShapeType() == GEOM::COMPSOLID ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); + aShapeName = "Compsolid_"; + } else if ( aShape->GetShapeType() == GEOM::SOLID ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); + aShapeName = "Solid_"; + } else if ( aShape->GetShapeType() == GEOM::SHELL ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); + aShapeName = "Shell_"; + } else if ( aShape->GetShapeType() == GEOM::FACE ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); + aShapeName = "Face_"; + } else if ( aShape->GetShapeType() == GEOM::WIRE ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); + aShapeName = "Wire_"; + } else if ( aShape->GetShapeType() == GEOM::EDGE ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); + aShapeName = "Edge_"; + } else if ( aShape->GetShapeType() == GEOM::VERTEX ) { + aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); + aShapeName = "Vertex_"; + } + //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); + //else aShapeName = TCollection_AsciiString(strdup(theName)); + + // asv : 11.11.04 Introducing a more sofisticated method of name creation, just as + // it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number + // of objects in the study, but compute a number of objects with the same prefix + // and build a new name as Prefix_N+1 + if ( strlen( theName ) == 0 ) { // MOST PROBABLY CALLED FROM BATCHMODE OR SUPERVISOR + int i = 0; // (WITH EMPTY NEW NAME) + SALOMEDS::SObject_var obj; + TCollection_AsciiString aNewShapeName; + do { + aNewShapeName = aShapeName + TCollection_AsciiString(++i); + obj = theStudy->FindObject( aNewShapeName.ToCString() ); + } + while ( !obj->_is_nil() ); + aShapeName = aNewShapeName; + } + else // MOST PROBABLY CALLED FROM GEOM GUI (ALREADY WITH VALID NAME) + aShapeName = TCollection_AsciiString(strdup(theName)); + + //Set the study entry as a name of the published GEOM_Object + aShape->SetStudyEntry(aResultSO->GetID()); + + //Set a name of the added shape + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); + SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr); + aNameAttrib->SetValue(aShapeName.ToCString()); + + return aResultSO._retn(); +} + + +//============================================================================ +// function : Save() +// purpose : save OCAF/Geom document +//============================================================================ +SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) { + SALOMEDS::TMPFile_var aStreamFile; + // Get a temporary directory to store a file + std::string aTmpDir = (isMultiFile)?theURL:SALOMEDS_Tool::GetTmpDir(); + // Create a list to store names of created files + SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; + aSeq->length(1); + // Prepare a file name to open + TCollection_AsciiString aNameWithExt(""); + if (isMultiFile) + aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str()); + aNameWithExt += TCollection_AsciiString("_GEOM.sgd"); + aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString()); + // Build a full file name of temporary file + TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt; + // Save GEOM component in this file + _impl->Save(theComponent->GetStudy()->StudyId(), aFullName.ToCString()); + // Conver a file to the byte stream + aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile); + // Remove the created file and tmp directory + if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); + + // Return the created byte stream + return aStreamFile._retn(); +} + + +//============================================================================ +// function : SaveASCII() +// purpose : +//============================================================================ +SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) { + SALOMEDS::TMPFile_var aStreamFile = Save(theComponent, theURL, isMultiFile); + return aStreamFile._retn(); +} + + +//============================================================================ +// function : Load() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { + + if (theStream.length() <= 9) { + MESSAGE("The TMPFile is too short : " << theStream.length() << " bytes "); + return false; + } + + // Get a temporary directory for a file + std::string aTmpDir = isMultiFile?theURL:SALOMEDS_Tool::GetTmpDir(); + // Conver the byte stream theStream to a file and place it in tmp directory + SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), isMultiFile); + + // Prepare a file name to open + TCollection_AsciiString aNameWithExt(""); + if (isMultiFile) + aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str()); + aNameWithExt += TCollection_AsciiString("_GEOM.sgd"); + TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt); + + // Open document + if (!_impl->Load(theComponent->GetStudy()->StudyId(), aFullName.ToCString())) return false; + + // Remove the created file and tmp directory + if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); + + SALOMEDS::Study_var Study = theComponent->GetStudy(); + TCollection_AsciiString name( strdup(Study->Name()) ); + + return true; +} + + +//============================================================================ +// function : LoadASCII() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) { + return Load(theComponent, theStream, theURL, isMultiFile); +} + + +//============================================================================ +// function : Close() +// purpose : +//============================================================================ +void GEOM_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) +{ + _impl->Close(theComponent->GetStudy()->StudyId()); +} + +//============================================================================ +// function : CanCopy() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { + // Try to retrieve known by Geometry component GEOM_Object by given IOR + SALOMEDS::GenericAttribute_var anAttr; + if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return false; + + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIOR->Value())); + // If the object is null one it can't be copied: return false + if (anObject->_is_nil()) return false; + return true; +} + +//============================================================================ +// function : CopyFrom() +// purpose : +//============================================================================ +SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) { + // Declare a sequence of the byte to store the copied object + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; + + // Try to get GEOM_Object object by given SObject + SALOMEDS::GenericAttribute_var anAttr; + if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return aStreamFile._retn(); + GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())); + if (anObject->_is_nil()) return aStreamFile._retn(); + + aStreamFile = anObject->GetShapeStream(); + + // Assign an ID the type of GEOM_Object + theObjectID = anObject->GetType(); + + // Return created TMPFile + return aStreamFile._retn(); +} + +//============================================================================ +// function : CanPaste() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) { + // The Geometry component can paste only objects copied by Geometry component + // and with the object type = 1 + if (strcmp(theComponentName, ComponentDataType()) != 0) return false; + return true; +} + +//============================================================================ +// function : PasteInto() +// purpose : +//============================================================================ +SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) { + // Find the current Study and StudyBuilder + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + // Retrieve a TopoDS_Shape from byte stream + TopoDS_Shape aTopology; + istrstream aStreamedBrep((char*) &theStream[0], theStream.length()); + BRep_Builder aBuilder; + try { + BRepTools::Read(aTopology, aStreamedBrep, aBuilder); + } catch (Standard_Failure) { + return false; + } + + // SObject of the created shape is theObject or new Child of Component if theObject == geom component + SALOMEDS::SObject_var aNewSO; + if (strcmp(theObject->GetFatherComponent()->GetID(),theObject->GetID()) == 0) { + aNewSO = aStudyBuilder->NewObject(theObject); + } else aNewSO = SALOMEDS::SObject::_duplicate(theObject); + + + //Create a new GEOM_Object + Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID); + Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF); + aFunction->SetValue(aTopology); + + TCollection_AsciiString anEntry; + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + GEOM::GEOM_Object_var obj = GetObject(anObj->GetDocID(), anEntry.ToCString()); + + // Add IORAttribute to the Study and set IOR of the created GEOM_Object to it + SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSO, "AttributeIOR"); + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(_orb->object_to_string(obj)); + + // Return the created in the Study SObject + return aNewSO._retn(); +} + +//============================================================================ +// function : ComponentDataType() +// purpose : +//============================================================================ +char* GEOM_Gen_i::ComponentDataType() +{ + return strdup("GEOM"); +} + +//============================================================================ +// function : AddInStudy +// purpose : +//============================================================================ +SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather) +{ + SALOMEDS::SObject_var aResultSO; + if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO; + + SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); + char* IOR; + + if(!theFather->_is_nil()) { + IOR = _orb->object_to_string(theFather); + SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR); + if(aFatherSO->_is_nil()) return aResultSO._retn(); + aResultSO = aStudyBuilder->NewObject(aFatherSO); + //aStudyBuilder->Addreference(aResultSO, aResultSO); + } + + aResultSO = PublishInStudy(theStudy, aResultSO, theObject, theName); + if(aResultSO->_is_nil()) return aResultSO._retn(); + + GEOM::ListOfGO_var aList = theObject->GetDependency(); + Standard_Integer aLength = aList->length(); + if(aLength < 1) return aResultSO._retn(); + + //Publish the arguments + for(Standard_Integer i = 0; i< aLength; i++) { + GEOM::GEOM_Object_var anObject = aList[i]; + if(anObject->_is_nil()) continue; + IOR = _orb->object_to_string(anObject); + SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(IOR); + if(aSO->_is_nil()) continue; + SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO); + aStudyBuilder->Addreference(aSubSO, aSO); + } + + return aResultSO._retn(); +} + +//============================================================================ +// function : register() +// purpose : register 'name' in 'name_service' +//============================================================================ +void GEOM_Gen_i::register_name(char * name) +{ + GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this()); + name_service->Register(g, strdup(name)); +} + +//============================================================================ +// function : Undo +// purpose : +//============================================================================ +void GEOM_Gen_i::Undo(CORBA::Long theStudyID) +{ + _impl->Undo(theStudyID); +} + +//============================================================================ +// function : Redo +// purpose : +//============================================================================ +void GEOM_Gen_i::Redo(CORBA::Long theStudyID) +{ + _impl->Redo(theStudyID); +} + +//============================================================================ +// function : GetIBasicOperations +// purpose : +//============================================================================ +GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIBasicOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IBasicOperations_i* aServant = + new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IBasicOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetITransformOperations +// purpose : +//============================================================================ +GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetITransformOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_ITransformOperations_i* aServant = + new GEOM_ITransformOperations_i(_poa, engine, _impl->GetITransformOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_ITransformOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetI3DPrimOperations +// purpose : +//============================================================================ +GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_I3DPrimOperations_i* aServant = + new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIShapesOperations +// purpose : +//============================================================================ +GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIShapesOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IShapesOperations_i* aServant = + new GEOM_IShapesOperations_i(_poa, engine, _impl->GetIShapesOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IShapesOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIBlocksOperations +// purpose : +//============================================================================ +GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IBlocksOperations_i* aServant = + new GEOM_IBlocksOperations_i(_poa, engine, _impl->GetIBlocksOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IBlocksOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIBooleanOperations +// purpose : +//============================================================================ +GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IBooleanOperations_i* aServant = + new GEOM_IBooleanOperations_i(_poa, engine, _impl->GetIBooleanOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IBooleanOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetICurvesOperations +// purpose : +//============================================================================ +GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetICurvesOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_ICurvesOperations_i* aServant = + new GEOM_ICurvesOperations_i(_poa, engine, _impl->GetICurvesOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_ICurvesOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetILocalOperations +// purpose : +//============================================================================ +GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetILocalOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_ILocalOperations_i* aServant = + new GEOM_ILocalOperations_i(_poa, engine, _impl->GetILocalOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_ILocalOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIHealingOperations +// purpose : +//============================================================================ +GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::IHealingOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IHealingOperations_i* aServant = + new GEOM_IHealingOperations_i(_poa, engine, _impl->GetIHealingOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IHealingOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIInsertOperations +// purpose : +//============================================================================ +GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIInsertOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IInsertOperations_i* aServant = + new GEOM_IInsertOperations_i(_poa, engine, _impl->GetIInsertOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IInsertOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIMeasureOperations +// purpose : +//============================================================================ +GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IMeasureOperations_i* aServant = + new GEOM_IMeasureOperations_i(_poa, engine, _impl->GetIMeasureOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IMeasureOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================ +// function : GetIGroupOperations +// purpose : +//============================================================================ +GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIGroupOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IGroupOperations_i* aServant = + new GEOM_IGroupOperations_i(_poa, engine, _impl->GetIGroupOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IGroupOperations_var operations = aServant->_this(); + return operations._retn(); +} + +//============================================================================= +/*! + * AddSubShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices) +{ + if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil(); + Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); + if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil(); + + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length()); + for(Standard_Integer i = 0; iSetValue(i+1, theIndices[i]); + + Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray, true); + if(anObject.IsNull()) return GEOM::GEOM_Object::_nil(); + + TCollection_AsciiString anEntry; + TDF_Tool::Entry(anObject->GetEntry(), anEntry); + return GetObject(anObject->GetDocID(), anEntry.ToCString()); +} + +//============================================================================= +/*! + * RemoveObject + */ +//============================================================================= +void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject) +{ + Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return; + _impl->RemoveObject(anObject); + return; +} + + +//================================================================================= +// function : GetStringFromIOR() +// purpose : returns a string that represents a 'GEOM::GEOM_Object_var' +//================================================================================= +char* GEOM_Gen_i::GetStringFromIOR(GEOM::GEOM_Object_ptr theObject) { + return _orb->object_to_string(theObject); +} + + +//================================================================================= +// function : GetIORFromString() +// purpose : returns a 'GEOM::GEOM_Object_var' from a string representing it +//================================================================================= +GEOM::GEOM_Object_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) { + GEOM::GEOM_Object_var aGeomObject; + if(strcmp(stringIOR,"") != 0){ + CORBA::Object_var anObject = _orb->string_to_object(stringIOR); + if(!CORBA::is_nil(anObject)) + aGeomObject = GEOM::GEOM_Object::_narrow(anObject.in()); + } + return aGeomObject._retn(); +} + +//================================================================================= +// function : GetObject() +// purpose : +//================================================================================= +GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry) +{ + GEOM::GEOM_Object_var obj; + Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry); + if (handle_object.IsNull()) return NULL; + + TCollection_AsciiString stringIOR = handle_object->GetIOR(); + if (stringIOR.Length() > 1) { + CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString()); + if (!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object); + return obj._retn(); + } + + GEOM::GEOM_Gen_ptr engine = _this(); + GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object); + + obj = servant->_this(); + stringIOR = _orb->object_to_string(obj); + handle_object->SetIOR(stringIOR); + return obj._retn(); +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WNT + __declspec( dllexport ) +#endif + PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char * interfaceName) + { + GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName); + myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example + return myGEOM_Gen_i->getId(); + } +} diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh new file mode 100644 index 000000000..4c31be326 --- /dev/null +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -0,0 +1,227 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef __GEOM_GEN_I_H__ +#define __GEOM_GEN_I_H__ + +#include "GEOMImpl_Gen.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) + +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) + + +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" + +#include "GEOM_IBasicOperations_i.hh" +#include "GEOM_ITransformOperations_i.hh" +#include "GEOM_I3DPrimOperations_i.hh" +#include "GEOM_IShapesOperations_i.hh" +#include "GEOM_IBlocksOperations_i.hh" +#include "GEOM_IBooleanOperations_i.hh" +#include "GEOM_ICurvesOperations_i.hh" +#include "GEOM_ILocalOperations_i.hh" +#include "GEOM_IHealingOperations_i.hh" +#include "GEOM_IInsertOperations_i.hh" +#include "GEOM_IMeasureOperations_i.hh" +#include "GEOM_IGroupOperations_i.hh" + +//#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + + +//===================================================================== +// GEOM_Gen_i : class definition +//===================================================================== +class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Component_i +{ + public: + + //-----------------------------------------------------------------------// + // Constructor / Destructor // + //-----------------------------------------------------------------------// + + // constructor to be called for servant creation. + GEOM_Gen_i(); + GEOM_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + // destructor, doing nothing (for now) + virtual ~GEOM_Gen_i(); + + // generic method to be put in a super class + void register_name(char * name); + + + //-----------------------------------------------------------------------// + // Inherited methods from SALOMEDS::Driver // + //-----------------------------------------------------------------------// + + SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + + SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + + CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); + + CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); + + void Close(SALOMEDS::SComponent_ptr theComponent); + char* ComponentDataType(); + + + char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + bool CanPublishInStudy(CORBA::Object_ptr theIOR); + SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) ; + + CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); + SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); + CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); + SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); + + /*! \brief Adds theObject in the study with a name = theName, if + * theFather is not null the object is placed under theFather + */ + SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy, + GEOM::GEOM_Object_ptr theObject, + const char* theName, + GEOM::GEOM_Object_ptr theFather); + + //-----------------------------------------------------------------------// + // Transaction methods // + //-----------------------------------------------------------------------// + + //Undos one transaction in the document associated with theStudyID + virtual void Undo(CORBA::Long theStudyID); + + //Redos one transaction in the document associated with theStudyID + virtual void Redo(CORBA::Long theStudyID); + + //-----------------------------------------------------------------------// + // Operations methods // + //-----------------------------------------------------------------------// + + //Returns a pointer to BasicOperations interface + virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to TransformOperations interface + virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to 3DPrimOperations interface + virtual GEOM::GEOM_I3DPrimOperations_ptr GetI3DPrimOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to ShapesOperations interface + virtual GEOM::GEOM_IShapesOperations_ptr GetIShapesOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to BlocksOperations interface + virtual GEOM::GEOM_IBlocksOperations_ptr GetIBlocksOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to BooleanOperations interface + virtual GEOM::GEOM_IBooleanOperations_ptr GetIBooleanOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to CurvesOperations interface + virtual GEOM::GEOM_ICurvesOperations_ptr GetICurvesOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to LocalOperations interface + virtual GEOM::GEOM_ILocalOperations_ptr GetILocalOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to HealingOperations interface + virtual GEOM::GEOM_IHealingOperations_ptr GetIHealingOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to InsertOperations interface + virtual GEOM::GEOM_IInsertOperations_ptr GetIInsertOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to MeasureOperations interface + virtual GEOM::GEOM_IMeasureOperations_ptr GetIMeasureOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Returns a pointer to GroupOperations interface + virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + + //Adds a new sub shape + virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices); + + virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject); + + virtual char* GetStringFromIOR(GEOM::GEOM_Object_ptr theObject); + + virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR); + + virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript); + + char* GetDumpName (const char* theStudyEntry); + + GEOM::string_array* GetAllDumpNames(); + + //-----------------------------------------------------------------------// + // Internal methods // + //-----------------------------------------------------------------------// + + virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry); + + private: + + ::GEOMImpl_Gen* _impl; + SALOME_NamingService * name_service; + char * _name; +}; + +#endif diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc new file mode 100644 index 000000000..ac8d8fb6b --- /dev/null +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -0,0 +1,486 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_I3DPrimOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i() +{ + MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i"); +} + + +//============================================================================= +/*! + * MakeBoxDXDYDZ + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the Box + Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeBoxTwoPnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn(); + + //Create the Box + Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeCylinderRH + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the Cylinder + Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeCylinderPntVecRH + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR, CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Cylinder + Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeConeR1R2H + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the Cone + Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeConePntVecR1R2H + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Cone + Handle(GEOM_Object) anObject = + GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSphereR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the Cone + Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSpherePntR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR + (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL) return aGEOMObject._retn(); + + //Get the reference point + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + + if (aPnt.IsNull()) return aGEOMObject._retn(); + + //Create the Sphere + Handle(GEOM_Object) anObject = + GetOperations()->MakeSpherePntR(aPnt, theR); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeTorusRR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR + (CORBA::Double theRMajor, CORBA::Double theRMinor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + // Make Torus + Handle(GEOM_Object) anObject = + GetOperations()->MakeTorusRR(theRMajor, theRMinor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeTorusPntVecRR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, CORBA::Double theRMinor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + // Make Torus + Handle(GEOM_Object) anObject = + GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePrismVecH + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismVecH(aBase, aVec, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePrismTwoPnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL) + return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject + (thePoint1->GetStudyID(), thePoint1->GetEntry()); + Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject + (thePoint2->GetStudyID(), thePoint2->GetEntry()); + + if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) + return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePipe + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || thePath == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject + (thePath->GetStudyID(), thePath->GetEntry()); + + if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn(); + + //Create the Pipe + Handle(GEOM_Object) anObject = + GetOperations()->MakePipe(aBase, aPath); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeRevolutionAxisAngle + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject + (theAxis->GetStudyID(), theAxis->GetEntry()); + + if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn(); + + //Create the Revolution + Handle(GEOM_Object) anObject = + GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFilling + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape, + CORBA::Long theMinDeg, + CORBA::Long theMaxDeg, + CORBA::Double theTol2D, + CORBA::Double theTol3D, + CORBA::Long theNbIter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Create the Solid + Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh new file mode 100644 index 000000000..acee1fdfc --- /dev/null +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -0,0 +1,101 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_I3DPrimOperations_i_HeaderFile +#define _GEOM_I3DPrimOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_I3DPrimOperations.hxx" + +class GEOM_I3DPrimOperations_i : + public virtual POA_GEOM::GEOM_I3DPrimOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_I3DPrimOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_I3DPrimOperations* theImpl); + ~GEOM_I3DPrimOperations_i(); + + GEOM::GEOM_Object_ptr MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + + GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH); + + GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR, + CORBA::Double theH); + + GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theH); + + GEOM::GEOM_Object_ptr MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theH); + + GEOM::GEOM_Object_ptr MakeSphereR (CORBA::Double theR); + + GEOM::GEOM_Object_ptr MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theR); + + GEOM::GEOM_Object_ptr MakeTorusRR (CORBA::Double theRMajor, + CORBA::Double theRMinor); + + GEOM::GEOM_Object_ptr MakeTorusPntVecRR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, + CORBA::Double theRMinor); + + GEOM::GEOM_Object_ptr MakePrismVecH (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); + + GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + + GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath); + + GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + + GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter); + + ::GEOMImpl_I3DPrimOperations* GetOperations() + { return (::GEOMImpl_I3DPrimOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc new file mode 100644 index 000000000..b24857da1 --- /dev/null +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -0,0 +1,390 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IBasicOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IBasicOperations_i::GEOM_IBasicOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBasicOperations* theImpl) + :GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IBasicOperations_i::GEOM_IBasicOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IBasicOperations_i::~GEOM_IBasicOperations_i() +{ + MESSAGE("GEOM_IBasicOperations_i::~GEOM_IBasicOperations_i"); +} + + +//============================================================================= +/*! + * MakePointXYZ + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointXYZ + (CORBA::Double theX, CORBA::Double theY, CORBA::Double theZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the point + + Handle(GEOM_Object) anObject = GetOperations()->MakePointXYZ(theX, theY, theZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePointWithReference + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointWithReference + (GEOM::GEOM_Object_ptr theReference, CORBA::Double theX, CORBA::Double theY, CORBA::Double theZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if(theReference == NULL) return aGEOMObject._retn(); + + //Get the reference point + + Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject + (theReference->GetStudyID(), theReference->GetEntry()); + if (aRefernce.IsNull()) return aGEOMObject._retn(); + + //Create the point + + Handle(GEOM_Object) anObject = + GetOperations()->MakePointWithReference(aRefernce, theX, theY, theZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePointOnCurve + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve + (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCurve == NULL) return aGEOMObject._retn(); + + //Get the reference curve + + Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject + (theCurve->GetStudyID(), theCurve->GetEntry()); + if (aRefernce.IsNull()) return aGEOMObject._retn(); + + //Create the point + + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnCurve(aRefernce, theParameter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MakeVectorDXDYDZ + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorDXDYDZ + (CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the Vector + + Handle(GEOM_Object) anObject = GetOperations()->MakeVectorDXDYDZ(theDX, theDY, theDZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeVectorTwoPnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorTwoPnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); + + //Get the reference points + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the vector + + Handle(GEOM_Object) anObject = + GetOperations()->MakeVectorTwoPnt(aRef1, aRef2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MakeLine + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLine + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theDir) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theDir == NULL) return aGEOMObject._retn(); + + //Get the reference objects + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (theDir->GetStudyID(), theDir->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the Line + + Handle(GEOM_Object) anObject = + GetOperations()->MakeLine(aRef1, aRef2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeLineTwoPnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoPnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); + + //Get the reference points + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the Line + + Handle(GEOM_Object) anObject = + GetOperations()->MakeLineTwoPnt(aRef1, aRef2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MakePlanePntVec + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the references + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the plane + + Handle(GEOM_Object) anObject = + GetOperations()->MakePlanePntVec(aRef1, aRef2, theTrimSize); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePlaneThreePnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneThreePnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) + return aGEOMObject._retn(); + + //Get the reference points + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aRef3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull()) + return aGEOMObject._retn(); + + //Create the plane + + Handle(GEOM_Object) anObject = + GetOperations()->MakePlaneThreePnt(aRef1, aRef2, aRef3, theTrimSize); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePlaneFace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneFace + (GEOM::GEOM_Object_ptr theFace, CORBA::Double theTrimSize) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theFace == NULL) return aGEOMObject._retn(); + + //Get the reference face + + Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject + (theFace->GetStudyID(), theFace->GetEntry()); + if (aRef.IsNull()) return aGEOMObject._retn(); + + //Create the plane + + Handle(GEOM_Object) anObject = + GetOperations()->MakePlaneFace(aRef, theTrimSize); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MakeMarker + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker + (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, + CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, + CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Create the point + Handle(GEOM_Object) anObject = GetOperations()->MakeMarker(theOX , theOY , theOZ, + theXDX, theXDY, theXDZ, + theYDX, theYDY, theYDZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh new file mode 100644 index 000000000..e46f50431 --- /dev/null +++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh @@ -0,0 +1,87 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IBasicOperations_i_HeaderFile +#define _GEOM_IBasicOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IBasicOperations.hxx" + +class GEOM_IBasicOperations_i : + public virtual POA_GEOM::GEOM_IBasicOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IBasicOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBasicOperations* theImpl); + ~GEOM_IBasicOperations_i(); + + GEOM::GEOM_Object_ptr MakePointXYZ (CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ); + + GEOM::GEOM_Object_ptr MakePointWithReference (GEOM::GEOM_Object_ptr theReference, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ); + + GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theParameter); + + GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + + GEOM::GEOM_Object_ptr MakeVectorTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakeLine (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theDir); + + GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Double theTrimSize); + + GEOM::GEOM_Object_ptr MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize); + + GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theTrimSize); + + GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, + CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, + CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ); + + ::GEOMImpl_IBasicOperations* GetOperations() { return (::GEOMImpl_IBasicOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.cc b/src/GEOM_I/GEOM_IBlocksOperations_i.cc new file mode 100644 index 000000000..97e693731 --- /dev/null +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.cc @@ -0,0 +1,1056 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IBlocksOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBlocksOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IBlocksOperations_i::~GEOM_IBlocksOperations_i() +{ + MESSAGE("GEOM_IBlocksOperations_i::~GEOM_IBlocksOperations_i"); +} + + +//============================================================================= +/*! + * MakeQuad + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad + (GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, GEOM::GEOM_Object_ptr theEdge4) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theEdge1 == NULL || theEdge2 == NULL || + theEdge3 == NULL || theEdge4 == NULL) return aGEOMObject._retn(); + + //Get the reference edges + Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject + (theEdge1->GetStudyID(), theEdge1->GetEntry()); + Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject + (theEdge2->GetStudyID(), theEdge2->GetEntry()); + Handle(GEOM_Object) anEdge3 = GetOperations()->GetEngine()->GetObject + (theEdge3->GetStudyID(), theEdge3->GetEntry()); + Handle(GEOM_Object) anEdge4 = GetOperations()->GetEngine()->GetObject + (theEdge4->GetStudyID(), theEdge4->GetEntry()); + + if (anEdge1.IsNull() || anEdge2.IsNull() || + anEdge3.IsNull() || anEdge4.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->MakeQuad(anEdge1, anEdge2, anEdge3, anEdge4); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeQuad2Edges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad2Edges + (GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn(); + + //Get the reference edges + Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject + (theEdge1->GetStudyID(), theEdge1->GetEntry()); + Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject + (theEdge2->GetStudyID(), theEdge2->GetEntry()); + + if (anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->MakeQuad2Edges(anEdge1, anEdge2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeQuad4Vertices + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad4Vertices + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, GEOM::GEOM_Object_ptr thePnt4) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || + thePnt3 == NULL || thePnt4 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + Handle(GEOM_Object) aPnt4 = GetOperations()->GetEngine()->GetObject + (thePnt4->GetStudyID(), thePnt4->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull() || + aPnt3.IsNull() || aPnt4.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->MakeQuad4Vertices(aPnt1, aPnt2, aPnt3, aPnt4); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeHexa + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa + (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, GEOM::GEOM_Object_ptr theFace6) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theFace1 == NULL || theFace2 == NULL || + theFace3 == NULL || theFace4 == NULL || + theFace5 == NULL || theFace6 == NULL) return aGEOMObject._retn(); + + //Get the reference Faces + Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject + (theFace1->GetStudyID(), theFace1->GetEntry()); + Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject + (theFace2->GetStudyID(), theFace2->GetEntry()); + Handle(GEOM_Object) anFace3 = GetOperations()->GetEngine()->GetObject + (theFace3->GetStudyID(), theFace3->GetEntry()); + Handle(GEOM_Object) anFace4 = GetOperations()->GetEngine()->GetObject + (theFace4->GetStudyID(), theFace4->GetEntry()); + Handle(GEOM_Object) anFace5 = GetOperations()->GetEngine()->GetObject + (theFace5->GetStudyID(), theFace5->GetEntry()); + Handle(GEOM_Object) anFace6 = GetOperations()->GetEngine()->GetObject + (theFace6->GetStudyID(), theFace6->GetEntry()); + + if (anFace1.IsNull() || anFace2.IsNull() || + anFace3.IsNull() || anFace4.IsNull() || + anFace5.IsNull() || anFace6.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = GetOperations()->MakeHexa + (anFace1, anFace2, anFace3, anFace4, anFace5, anFace6); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeHexa2Faces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa2Faces + (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn(); + + //Get the reference Faces + Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject + (theFace1->GetStudyID(), theFace1->GetEntry()); + Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject + (theFace2->GetStudyID(), theFace2->GetEntry()); + + if (anFace1.IsNull() || anFace2.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->MakeHexa2Faces(anFace1, anFace2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeBlockCompound + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeBlockCompound + (GEOM::GEOM_Object_ptr theCompound) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return aGEOMObject._retn(); + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return aGEOMObject._retn(); + + //Create the Blocks Compound + Handle(GEOM_Object) anObject = + GetOperations()->MakeBlockCompound(aCompound); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theX, + const CORBA::Double theY, + const CORBA::Double theZ, + const CORBA::Double theEpsilon) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Create the Point + Handle(GEOM_Object) anObject = + GetOperations()->GetPoint(aShape, theX, theY, theZ, theEpsilon); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetEdge + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdge (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + thePoint1 == NULL || thePoint2 == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject + (thePoint1->GetStudyID(), thePoint1->GetEntry()); + Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject + (thePoint2->GetStudyID(), thePoint2->GetEntry()); + + if (aShape.IsNull() || + aPoint1.IsNull() || aPoint2.IsNull()) return aGEOMObject._retn(); + + //Create the Point + Handle(GEOM_Object) anObject = + GetOperations()->GetEdge(aShape, aPoint1, aPoint2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetEdgeNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + //Create the Edge + Handle(GEOM_Object) anObject = + GetOperations()->GetEdgeNearPoint(aShape, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetFaceByPoints + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByPoints + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + thePoint1 == NULL || thePoint2 == NULL || + thePoint3 == NULL || thePoint4 == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject + (thePoint1->GetStudyID(), thePoint1->GetEntry()); + Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject + (thePoint2->GetStudyID(), thePoint2->GetEntry()); + Handle(GEOM_Object) aPoint3 = GetOperations()->GetEngine()->GetObject + (thePoint3->GetStudyID(), thePoint3->GetEntry()); + Handle(GEOM_Object) aPoint4 = GetOperations()->GetEngine()->GetObject + (thePoint4->GetStudyID(), thePoint4->GetEntry()); + + if (aShape.IsNull() || + aPoint1.IsNull() || aPoint2.IsNull() || + aPoint3.IsNull() || aPoint4.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->GetFaceByPoints(aShape, aPoint1, aPoint2, aPoint3, aPoint4); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetFaceByEdges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByEdges + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject + (theEdge1->GetStudyID(), theEdge1->GetEntry()); + Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject + (theEdge2->GetStudyID(), theEdge2->GetEntry()); + + if (aShape.IsNull() || + anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->GetFaceByEdges(aShape, anEdge1, anEdge2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetOppositeFace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetOppositeFace (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theFace) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theFace == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject + (theFace->GetStudyID(), theFace->GetEntry()); + + if (aShape.IsNull() || aFace.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->GetOppositeFace(aShape, aFace); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetFaceNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->GetFaceNearPoint(aShape, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetFaceByNormale + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theVector) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theVector == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject + (theVector->GetStudyID(), theVector->GetEntry()); + + if (aShape.IsNull() || aVector.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = + GetOperations()->GetFaceByNormale(aShape, aVector); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * ExplodeCompoundOfBlocks + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks + (GEOM::GEOM_Object_ptr theCompound, + const CORBA::Long theMinNbFaces, + const CORBA::Long theMaxNbFaces) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return aSeq._retn(); + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return aSeq._retn(); + + //Explode + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->ExplodeCompoundOfBlocks(aCompound, theMinNbFaces, theMaxNbFaces); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * IsCompoundOfBlocks + */ +//============================================================================= +CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks + (GEOM::GEOM_Object_ptr theCompound, + const CORBA::Long theMinNbFaces, + const CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks) +{ + theNbBlocks = 0; + CORBA::Boolean isComp = false; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return isComp; + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return isComp; + + //Check + Standard_Integer nbBlocks = 0; + isComp = GetOperations()->IsCompoundOfBlocks(aCompound, + theMinNbFaces, + theMaxNbFaces, + nbBlocks); + if (!GetOperations()->IsDone()) + return isComp; + + theNbBlocks = nbBlocks; + return isComp; +} + +//============================================================================= +/*! + * CheckCompoundOfBlocks + */ +//============================================================================= +CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks + (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors) +{ + CORBA::Boolean isComp = false; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return isComp; + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return isComp; + + //Check + list errList; + isComp = GetOperations()->CheckCompoundOfBlocks(aCompound, errList); + if (!GetOperations()->IsDone()) + return isComp; + + const int nbErr = errList.size(); + GEOM::GEOM_IBlocksOperations::BCErrors_var anErrArray = + new GEOM::GEOM_IBlocksOperations::BCErrors(); + anErrArray->length(nbErr); + + // fill the local CORBA array with values from lists + list::iterator errIt = errList.begin(); + int i = 0; + for (; errIt != errList.end(); i++, errIt++) { + GEOM::GEOM_IBlocksOperations::BCError_var anError = + new GEOM::GEOM_IBlocksOperations::BCError(); + + GEOMImpl_IBlocksOperations::BCError errStruct = *errIt; + + switch (errStruct.error) { + case GEOMImpl_IBlocksOperations::NOT_BLOCK: + anError->error = GEOM::GEOM_IBlocksOperations::NOT_BLOCK; + break; + case GEOMImpl_IBlocksOperations::EXTRA_EDGE: + anError->error = GEOM::GEOM_IBlocksOperations::EXTRA_EDGE; + break; + case GEOMImpl_IBlocksOperations::INVALID_CONNECTION: + anError->error = GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION; + break; + case GEOMImpl_IBlocksOperations::NOT_CONNECTED: + anError->error = GEOM::GEOM_IBlocksOperations::NOT_CONNECTED; + break; + case GEOMImpl_IBlocksOperations::NOT_GLUED: + anError->error = GEOM::GEOM_IBlocksOperations::NOT_GLUED; + break; + default: + break; + } + + list sshList = errStruct.incriminated; + GEOM::ListOfLong_var anIncrims = new GEOM::ListOfLong(); + anIncrims->length(sshList.size()); + + list::iterator sshIt = sshList.begin(); + int jj = 0; + for (; sshIt != sshList.end(); jj++, sshIt++) { + anIncrims[jj] = *sshIt; + } + + anError->incriminated = anIncrims; + + anErrArray[i] = anError; + } + + // initialize out-parameter with local array + theErrors = anErrArray._retn(); + + return isComp; +} + +//============================================================================= +/*! + * PrintBCErrors + */ +//============================================================================= +char* GEOM_IBlocksOperations_i::PrintBCErrors + (GEOM::GEOM_Object_ptr theCompound, + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) +{ + //Get the reference Compound + if (theCompound == NULL) return NULL; + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + if (aCompound.IsNull()) return NULL; + + // Convert the errors sequence + list anErrors; + int nbErr = theErrors.length(); + int ie = 0; + for (; ie < nbErr; ie++) { + const GEOM::GEOM_IBlocksOperations::BCError err = theErrors[ie]; + const GEOM::GEOM_IBlocksOperations::BCErrorType typ = err.error; + const GEOM::ListOfLong incrims = err.incriminated; + + GEOMImpl_IBlocksOperations::BCError errStruct; + switch (typ) { + case GEOM::GEOM_IBlocksOperations::NOT_BLOCK: + errStruct.error = GEOMImpl_IBlocksOperations::NOT_BLOCK; + break; + case GEOM::GEOM_IBlocksOperations::EXTRA_EDGE: + errStruct.error = GEOMImpl_IBlocksOperations::EXTRA_EDGE; + break; + case GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION: + errStruct.error = GEOMImpl_IBlocksOperations::INVALID_CONNECTION; + break; + case GEOM::GEOM_IBlocksOperations::NOT_CONNECTED: + errStruct.error = GEOMImpl_IBlocksOperations::NOT_CONNECTED; + break; + case GEOM::GEOM_IBlocksOperations::NOT_GLUED: + errStruct.error = GEOMImpl_IBlocksOperations::NOT_GLUED; + break; + default: + break; + } + + int ii = 0; + int aLen = incrims.length(); + for (; ii < aLen; ii++) { + errStruct.incriminated.push_back(incrims[ii]); + } + + anErrors.push_back(errStruct); + } + + TCollection_AsciiString aDescr = GetOperations()->PrintBCErrors(aCompound, anErrors); + return CORBA::string_dup(aDescr.ToCString()); +} + +//============================================================================= +/*! + * RemoveExtraEdges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Get the result + Handle(GEOM_Object) anObject = + GetOperations()->RemoveExtraEdges(aShape); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * CheckAndImprove + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Object_ptr theCompound) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return aGEOMObject._retn(); + + //Get the result + Handle(GEOM_Object) anObject = + GetOperations()->CheckAndImprove(aCompound); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetBlockNearPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL || thePoint == NULL) return aGEOMObject._retn(); + + //Get the reference Objects + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if (aCompound.IsNull() || aPoint.IsNull()) return aGEOMObject._retn(); + + //Get the block + Handle(GEOM_Object) anObject = + GetOperations()->GetBlockNearPoint(aCompound, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetBlockByParts + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, + const GEOM::ListOfGO& theParts) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return aGEOMObject._retn(); + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return aGEOMObject._retn(); + + //Get the parts + int ind, aLen; + Handle(TColStd_HSequenceOfTransient) aParts = new TColStd_HSequenceOfTransient; + + aLen = theParts.length(); + for (ind = 0; ind < aLen; ind++) { + if (theParts[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aParts->Append(aSh); + } + + //Get the Block + Handle(GEOM_Object) anObject = + GetOperations()->GetBlockByParts(aCompound, aParts); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetBlocksByParts + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, + const GEOM::ListOfGO& theParts) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theCompound == NULL) return aSeq._retn(); + + //Get the reference Compound + Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject + (theCompound->GetStudyID(), theCompound->GetEntry()); + + if (aCompound.IsNull()) return aSeq._retn(); + + //Get the parts + int ind, aLen; + Handle(TColStd_HSequenceOfTransient) aParts = new TColStd_HSequenceOfTransient; + + aLen = theParts.length(); + for (ind = 0; ind < aLen; ind++) { + if (theParts[ind] == NULL) return aSeq._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry()); + if (aSh.IsNull()) return aSeq._retn(); + aParts->Append(aSh); + } + + //Get the Block + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetBlocksByParts(aCompound, aParts); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * MakeMultiTransformation1D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation1D + (GEOM::GEOM_Object_ptr theBlock, + const CORBA::Long theDirFace1, + const CORBA::Long theDirFace2, + const CORBA::Long theNbTimes) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBlock == NULL) return aGEOMObject._retn(); + + //Get the object itself and the vector of translation + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theBlock->GetStudyID(), theBlock->GetEntry()); + + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Perform the transformation + Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation1D + (aBasicObject, theDirFace1, theDirFace2, theNbTimes); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeMultiTransformation2D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation2D + (GEOM::GEOM_Object_ptr theBlock, + const CORBA::Long theDirFace1U, + const CORBA::Long theDirFace2U, + const CORBA::Long theNbTimesU, + const CORBA::Long theDirFace1V, + const CORBA::Long theDirFace2V, + const CORBA::Long theNbTimesV) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBlock == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theBlock->GetStudyID(), theBlock->GetEntry()); + + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Perform the transformation + Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation2D + (aBasicObject, + theDirFace1U, theDirFace2U, theNbTimesU, + theDirFace1V, theDirFace2V, theNbTimesV); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * Propagate + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IBlocksOperations_i::Propagate (GEOM::GEOM_Object_ptr theShape) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aSeq._retn(); + + //Get the reference Shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aSeq._retn(); + + //Get the Propagation chains + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->Propagate(aShape); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} diff --git a/src/GEOM_I/GEOM_IBlocksOperations_i.hh b/src/GEOM_I/GEOM_IBlocksOperations_i.hh new file mode 100644 index 000000000..b4ff44f8e --- /dev/null +++ b/src/GEOM_I/GEOM_IBlocksOperations_i.hh @@ -0,0 +1,152 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IBlocksOperations_i_HeaderFile +#define _GEOM_IBlocksOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IBlocksOperations.hxx" + +class GEOM_IBlocksOperations_i : + public virtual POA_GEOM::GEOM_IBlocksOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IBlocksOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBlocksOperations* theImpl); + ~GEOM_IBlocksOperations_i(); + + // Creation of blocks and block faces + GEOM::GEOM_Object_ptr MakeQuad (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, + GEOM::GEOM_Object_ptr theEdge4); + + GEOM::GEOM_Object_ptr MakeQuad2Edges (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2); + + GEOM::GEOM_Object_ptr MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + GEOM::GEOM_Object_ptr thePnt4); + + GEOM::GEOM_Object_ptr MakeHexa (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, + GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, + GEOM::GEOM_Object_ptr theFace6); + + GEOM::GEOM_Object_ptr MakeHexa2Faces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2); + + GEOM::GEOM_Object_ptr MakeBlockCompound (GEOM::GEOM_Object_ptr theCompound); + + // Extract elements of blocks and blocks compounds + GEOM::GEOM_Object_ptr GetPoint (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theEpsilon); + + GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + + GEOM::GEOM_Object_ptr GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + + GEOM::GEOM_Object_ptr GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4); + + GEOM::GEOM_Object_ptr GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2); + + GEOM::GEOM_Object_ptr GetOppositeFace (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theFace); + + GEOM::GEOM_Object_ptr GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + + GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theVector); + + // Check blocks compound + CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks); + + CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors); + + char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); + + GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape); + + GEOM::GEOM_Object_ptr CheckAndImprove (GEOM::GEOM_Object_ptr theCompound); + + // Extract blocks from blocks compounds + GEOM::ListOfGO* ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces); + + GEOM::GEOM_Object_ptr GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_Object_ptr thePoint); + + GEOM::GEOM_Object_ptr GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, + const GEOM::ListOfGO& theParts); + + GEOM::ListOfGO* GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, + const GEOM::ListOfGO& theParts); + + // Operations on blocks with gluing of result + GEOM::GEOM_Object_ptr MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1, + CORBA::Long theDirFace2, + CORBA::Long theNbTimes); + + GEOM::GEOM_Object_ptr MakeMultiTransformation2D (GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1U, + CORBA::Long theDirFace2U, + CORBA::Long theNbTimesU, + CORBA::Long theDirFace1V, + CORBA::Long theDirFace2V, + CORBA::Long theNbTimesV); + + // Build groups for Propagation of 1D hypotheses + GEOM::ListOfGO* Propagate (GEOM::GEOM_Object_ptr theShape); + + ::GEOMImpl_IBlocksOperations* GetOperations() + { return (::GEOMImpl_IBlocksOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc new file mode 100644 index 000000000..f69cce675 --- /dev/null +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -0,0 +1,202 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IBooleanOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IBooleanOperations_i::GEOM_IBooleanOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBooleanOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IBooleanOperations_i::GEOM_IBooleanOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IBooleanOperations_i::~GEOM_IBooleanOperations_i() +{ + MESSAGE("GEOM_IBooleanOperations_i::~GEOM_IBooleanOperations_i"); +} + + +//============================================================================= +/*! + * MakeBoolean + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean + (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOp) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn(); + + //Get the reference shapes + Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject + (theShape1->GetStudyID(), theShape1->GetEntry()); + Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject + (theShape2->GetStudyID(), theShape2->GetEntry()); + + if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn(); + + // Make Boolean + Handle(GEOM_Object) anObject = GetOperations()->MakeBoolean(aSh1, aSh2, theOp); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePartition + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition + (const GEOM::ListOfGO& theShapes, + const GEOM::ListOfGO& theTools, + const GEOM::ListOfGO& theKeepIns, + const GEOM::ListOfGO& theRemoveIns, + const CORBA::Short theLimit, + const CORBA::Boolean theRemoveWebs, + const GEOM::ListOfLong& theMaterials) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + Handle(TColStd_HSequenceOfTransient) aShapes = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aTools = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aKeepIns = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aRemIns = new TColStd_HSequenceOfTransient; + Handle(TColStd_HArray1OfInteger) aMaterials; + + //Get the shapes + aLen = theShapes.length(); + for (ind = 0; ind < aLen; ind++) { + if (theShapes[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes->Append(aSh); + } + + //Get the tools + aLen = theTools.length(); + for (ind = 0; ind < aLen; ind++) { + if (theTools[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theTools[ind]->GetStudyID(), theTools[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aTools->Append(aSh); + } + + //Get the keep inside shapes + aLen = theKeepIns.length(); + for (ind = 0; ind < aLen; ind++) { + if (theKeepIns[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theKeepIns[ind]->GetStudyID(), theKeepIns[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aKeepIns->Append(aSh); + } + + //Get the remove inside shapes + aLen = theRemoveIns.length(); + for (ind = 0; ind < aLen; ind++) { + if (theRemoveIns[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theRemoveIns[ind]->GetStudyID(), theRemoveIns[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aRemIns->Append(aSh); + } + + //Get the materials + aLen = theMaterials.length(); + aMaterials = new TColStd_HArray1OfInteger (1, aLen); + for (ind = 0; ind < aLen; ind++) { + aMaterials->SetValue(ind+1, theMaterials[ind]); + } + + // Make Partition + Handle(GEOM_Object) anObject = + GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, + theLimit, theRemoveWebs, aMaterials); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeHalfPartition + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition + (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePlane) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || thePlane == NULL) return aGEOMObject._retn(); + + //Get the reference shapes + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aPl = GetOperations()->GetEngine()->GetObject + (thePlane->GetStudyID(), thePlane->GetEntry()); + + if (aSh.IsNull() || aPl.IsNull()) return aGEOMObject._retn(); + + // Make Half Partition + Handle(GEOM_Object) anObject = GetOperations()->MakeHalfPartition(aSh, aPl); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.hh b/src/GEOM_I/GEOM_IBooleanOperations_i.hh new file mode 100644 index 000000000..d0afa8461 --- /dev/null +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.hh @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IBooleanOperations_i_HeaderFile +#define _GEOM_IBooleanOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IBooleanOperations.hxx" + +class GEOM_IBooleanOperations_i : + public virtual POA_GEOM::GEOM_IBooleanOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IBooleanOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IBooleanOperations* theImpl); + ~GEOM_IBooleanOperations_i(); + + GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOp); + + GEOM::GEOM_Object_ptr MakePartition (const GEOM::ListOfGO& theShapes, + const GEOM::ListOfGO& theTools, + const GEOM::ListOfGO& theKeepInside, + const GEOM::ListOfGO& theRemoveInside, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + const GEOM::ListOfLong& theMaterials); + + + GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePlane); + + ::GEOMImpl_IBooleanOperations* GetOperations() + { return (::GEOMImpl_IBooleanOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc new file mode 100644 index 000000000..05baaeca8 --- /dev/null +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -0,0 +1,347 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_ICurvesOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_ICurvesOperations_i::GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ICurvesOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_ICurvesOperations_i::GEOM_ICurvesOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_ICurvesOperations_i::~GEOM_ICurvesOperations_i() +{ + MESSAGE("GEOM_ICurvesOperations_i::~GEOM_ICurvesOperations_i"); +} + + +//============================================================================= +/*! + * MakeCirclePntVecR + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theR) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + // Make Circle + Handle(GEOM_Object) anObject = + GetOperations()->MakeCirclePntVecR(aPnt, aVec, theR); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeCircleThreePnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); + + // Make Circle + Handle(GEOM_Object) anObject = + GetOperations()->MakeCircleThreePnt(aPnt1, aPnt2, aPnt3); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeEllipse + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, double theRMinor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + // Make Ellipse + Handle(GEOM_Object) anObject = + GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeArc + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc + (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); + + // Make Arc + Handle(GEOM_Object) anObject = + GetOperations()->MakeArc(aPnt1, aPnt2, aPnt3); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakePolyline + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline + (const GEOM::ListOfGO& thePoints) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference point + int ind = 0; + int aLen = thePoints.length(); + list aPoints; + for (; ind < aLen; ind++) { + if (thePoints[ind] == NULL) return aGEOMObject._retn(); + + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); + + if (aPnt.IsNull()) return aGEOMObject._retn(); + aPoints.push_back(aPnt); + } + + // Make Polyline + Handle(GEOM_Object) anObject = + GetOperations()->MakePolyline(aPoints); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSplineBezier + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier + (const GEOM::ListOfGO& thePoints) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference point + int ind = 0; + int aLen = thePoints.length(); + list aPoints; + for (; ind < aLen; ind++) { + if (thePoints[ind] == NULL) return aGEOMObject._retn(); + + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); + + if (aPnt.IsNull()) return aGEOMObject._retn(); + aPoints.push_back(aPnt); + } + + // Make Bezier curve + Handle(GEOM_Object) anObject = + GetOperations()->MakeSplineBezier(aPoints); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSplineInterpolation + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation + (const GEOM::ListOfGO& thePoints) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference point + int ind = 0; + int aLen = thePoints.length(); + list aPoints; + for (; ind < aLen; ind++) { + if (thePoints[ind] == NULL) return aGEOMObject._retn(); + + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePoints[ind]->GetStudyID(), thePoints[ind]->GetEntry()); + + if (aPnt.IsNull()) return aGEOMObject._retn(); + aPoints.push_back(aPnt); + } + + // Make Polyline + Handle(GEOM_Object) anObject = + GetOperations()->MakeSplineInterpolation(aPoints); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSketcher + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher + (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind = 0; + int aLen = theWorkingPlane.length(); + list aWorkingPlane; + for (; ind < aLen; ind++) + aWorkingPlane.push_back(theWorkingPlane[ind]); + + // Make Sketcher + Handle(GEOM_Object) anObject = + GetOperations()->MakeSketcher((char*)theCommand, aWorkingPlane); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return GEOM::GEOM_Object::_nil(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MakeSketcherOnPlane + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane + (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + Handle(GEOM_Object) aWorkingPlane = GetOperations()->GetEngine()->GetObject + (theWorkingPlane->GetStudyID(), theWorkingPlane->GetEntry()); + + // Make Sketcher + Handle(GEOM_Object) anObject = + GetOperations()->MakeSketcherOnPlane((char*)theCommand, aWorkingPlane); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return GEOM::GEOM_Object::_nil(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh new file mode 100644 index 000000000..692422980 --- /dev/null +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_ICurvesOperations_i_HeaderFile +#define _GEOM_ICurvesOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_ICurvesOperations.hxx" + +class GEOM_ICurvesOperations_i : + public virtual POA_GEOM::GEOM_ICurvesOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ICurvesOperations* theImpl); + ~GEOM_ICurvesOperations_i(); + + GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + double theR); + + GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + + GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + double theRMajor, double theRMinor); + + GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + + GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints); + + GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints); + + GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints); + + GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane); + + GEOM::GEOM_Object_ptr MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane); + + ::GEOMImpl_ICurvesOperations* GetOperations() + { return (::GEOMImpl_ICurvesOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.cc b/src/GEOM_I/GEOM_IGroupOperations_i.cc new file mode 100644 index 000000000..e64e1b26d --- /dev/null +++ b/src/GEOM_I/GEOM_IGroupOperations_i.cc @@ -0,0 +1,330 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IGroupOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IGroupOperations_i::GEOM_IGroupOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IGroupOperations* theImpl) + :GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IGroupOperations_i::GEOM_IGroupOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IGroupOperations_i::~GEOM_IGroupOperations_i() +{ + MESSAGE("GEOM_IGroupOperations_i::~GEOM_IGroupOperations_i"); +} + + +//============================================================================= +/*! + * CreateGroup + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::CreateGroup(GEOM::GEOM_Object_ptr theMainShape, CORBA::Long theShapeType) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theMainShape == NULL || theShapeType < 0) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); + + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Fillet + Handle(GEOM_Object) anObject = GetOperations()->CreateGroup(aShapeRef, (TopAbs_ShapeEnum)theShapeType); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * AddObject + */ +//============================================================================= +void GEOM_IGroupOperations_i::AddObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + GetOperations()->AddObject(aGroupRef, theSubShapeId); + return; +} + +//============================================================================= +/*! + * RemoveObject + */ +//============================================================================= +void GEOM_IGroupOperations_i::RemoveObject(GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + GetOperations()->RemoveObject(aGroupRef, theSubShapeId); + + return; +} + +//============================================================================= +/*! + * UnionList + */ +//============================================================================= +void GEOM_IGroupOperations_i::UnionList (GEOM::GEOM_Object_ptr theGroup, + const GEOM::ListOfGO& theSubShapes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject + (theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + //Get sub-shape to add + Handle(TColStd_HSequenceOfTransient) aSubShapes = new TColStd_HSequenceOfTransient; + + int ind, aLen = theSubShapes.length(); + for (ind = 0; ind < aLen; ind++) { + if (theSubShapes[ind] == NULL) return; + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theSubShapes[ind]->GetStudyID(), theSubShapes[ind]->GetEntry()); + if (aSh.IsNull()) return; + aSubShapes->Append(aSh); + } + + //Perform the operation + GetOperations()->UnionList(aGroupRef, aSubShapes); + return; +} + +//============================================================================= +/*! + * DifferenceList + */ +//============================================================================= +void GEOM_IGroupOperations_i::DifferenceList (GEOM::GEOM_Object_ptr theGroup, + const GEOM::ListOfGO& theSubShapes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject + (theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + //Get sub-shape to remove + Handle(TColStd_HSequenceOfTransient) aSubShapes = new TColStd_HSequenceOfTransient; + + int ind, aLen = theSubShapes.length(); + for (ind = 0; ind < aLen; ind++) { + if (theSubShapes[ind] == NULL) return; + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theSubShapes[ind]->GetStudyID(), theSubShapes[ind]->GetEntry()); + if (aSh.IsNull()) return; + aSubShapes->Append(aSh); + } + + //Perform the operation + GetOperations()->DifferenceList(aGroupRef, aSubShapes); + return; +} + +//============================================================================= +/*! + * UnionIDs + */ +//============================================================================= +void GEOM_IGroupOperations_i::UnionIDs (GEOM::GEOM_Object_ptr theGroup, + const GEOM::ListOfLong& theSubShapes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject + (theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + //Get sub-shape to add + Handle(TColStd_HSequenceOfInteger) aSubShapes = new TColStd_HSequenceOfInteger; + + int ind, aLen = theSubShapes.length(); + for (ind = 0; ind < aLen; ind++) { + aSubShapes->Append(theSubShapes[ind]); + } + + //Perform the operation + GetOperations()->UnionIDs(aGroupRef, aSubShapes); + return; +} + +//============================================================================= +/*! + * DifferenceIDs + */ +//============================================================================= +void GEOM_IGroupOperations_i::DifferenceIDs (GEOM::GEOM_Object_ptr theGroup, + const GEOM::ListOfLong& theSubShapes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject + (theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return; + + //Get sub-shape to remove + Handle(TColStd_HSequenceOfInteger) aSubShapes = new TColStd_HSequenceOfInteger; + + int ind, aLen = theSubShapes.length(); + for (ind = 0; ind < aLen; ind++) { + aSubShapes->Append(theSubShapes[ind]); + } + + //Perform the operation + GetOperations()->DifferenceIDs(aGroupRef, aSubShapes); + return; +} + +//============================================================================= +/*! + * GetType + */ +//============================================================================= +CORBA::Long GEOM_IGroupOperations_i::GetType(GEOM::GEOM_Object_ptr theGroup) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return -1; + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + + if (aGroupRef.IsNull()) return -1; + + return GetOperations()->GetType(aGroupRef); +} + +//============================================================================= +/*! + * GetMainShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IGroupOperations_i::GetMainShape(GEOM::GEOM_Object_ptr theGroup) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return aGEOMObject._retn(); + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return aGEOMObject._retn(); + + Handle(GEOM_Object) anObject = GetOperations()->GetMainShape(aGroupRef); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetObjects + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IGroupOperations_i::GetObjects(GEOM::GEOM_Object_ptr theGroup) +{ + GEOM::ListOfLong_var aList; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theGroup == NULL) return aList._retn(); + + //Get the reference group + Handle(GEOM_Object) aGroupRef = GetOperations()->GetEngine()->GetObject(theGroup->GetStudyID(), theGroup->GetEntry()); + if (aGroupRef.IsNull()) return aList._retn(); + + aList = new GEOM::ListOfLong; + + Handle(TColStd_HArray1OfInteger) aSeq = GetOperations()->GetObjects(aGroupRef); + if (!GetOperations()->IsDone() || aSeq.IsNull()) return aList._retn(); + + aList->length(aSeq->Length()); + for(int i = 1; i<=aSeq->Length(); i++) aList[i-1] = aSeq->Value(i); + + return aList._retn(); +} + diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.hh b/src/GEOM_I/GEOM_IGroupOperations_i.hh new file mode 100644 index 000000000..4273c731d --- /dev/null +++ b/src/GEOM_I/GEOM_IGroupOperations_i.hh @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IGroupOperations_i_HeaderFile +#define _GEOM_IGroupOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IGroupOperations.hxx" + +class GEOM_IGroupOperations_i : + public virtual POA_GEOM::GEOM_IGroupOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IGroupOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IGroupOperations* theImpl); + ~GEOM_IGroupOperations_i(); + + GEOM::GEOM_Object_ptr CreateGroup (GEOM::GEOM_Object_ptr theMainShape, CORBA::Long theShapeType); + + void AddObject (GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId); + + void RemoveObject (GEOM::GEOM_Object_ptr theGroup, CORBA::Long theSubShapeId); + + void UnionList (GEOM::GEOM_Object_ptr theGroup, const GEOM::ListOfGO& theSubShapes); + + void DifferenceList (GEOM::GEOM_Object_ptr theGroup, const GEOM::ListOfGO& theSubShapes); + + void UnionIDs (GEOM::GEOM_Object_ptr theGroup, const GEOM::ListOfLong& theSubShapes); + + void DifferenceIDs (GEOM::GEOM_Object_ptr theGroup, const GEOM::ListOfLong& theSubShapes); + + CORBA::Long GetType (GEOM::GEOM_Object_ptr theGroup); + + GEOM::GEOM_Object_ptr GetMainShape (GEOM::GEOM_Object_ptr theGroup); + + GEOM::ListOfLong* GetObjects (GEOM::GEOM_Object_ptr theGroup); + + ::GEOMImpl_IGroupOperations* GetOperations() + { return (::GEOMImpl_IGroupOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.cc b/src/GEOM_I/GEOM_IHealingOperations_i.cc new file mode 100644 index 000000000..30f823a51 --- /dev/null +++ b/src/GEOM_I/GEOM_IHealingOperations_i.cc @@ -0,0 +1,456 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include + +#include "GEOM_IHealingOperations_i.hh" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOM_IHealingOperations_i::GEOM_IHealingOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IHealingOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IHealingOperations_i::GEOM_IHealingOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOM_IHealingOperations_i::~GEOM_IHealingOperations_i() +{ + MESSAGE("GEOM_IHealingOperations_i::~GEOM_IHealingOperations_i"); +} + +//============================================================================= +/*! + * Convert + */ +//============================================================================= +Handle(TColStd_HArray1OfInteger) GEOM_IHealingOperations_i::Convert + (const GEOM::short_array& theInArray) +{ + Handle(TColStd_HArray1OfInteger) anOutArray; + int n = theInArray.length(); + if ( n <= 0 ) + return anOutArray; + anOutArray = new TColStd_HArray1OfInteger( 1, n ); + for (int i = 0; i < n; i++) + anOutArray->SetValue( i+1, theInArray[i] ); + return anOutArray; +} + +//============================================================================= +/*! + * Convert + */ +//============================================================================= +Handle(TColStd_HArray1OfExtendedString) GEOM_IHealingOperations_i::Convert + (const GEOM::string_array& theInArray) +{ + Handle(TColStd_HArray1OfExtendedString) anOutArray; + int n = theInArray.length(); + if ( n <= 0 ) + return anOutArray; + anOutArray = new TColStd_HArray1OfExtendedString( 1, n ); + char* str; + for ( int i = 0; i < n; i++ ) + { + str = CORBA::string_dup( theInArray[i] ); + anOutArray->SetValue( i+1, TCollection_ExtendedString( str ) ); + } + return anOutArray; +} + +//============================================================================= +/*! + * ProcessShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ProcessShape (GEOM::GEOM_Object_ptr theObject, + const GEOM::string_array& theOperations, + const GEOM::string_array& theParams, + const GEOM::string_array& theValues) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) ) + return aGEOMObject._retn(); + + // Check if theOperations has more than 0 elements and theParams and theValues have the same length +// if ( theOperations.length() <= 0 || theParams.length() != theValues.length() ) +// return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if ( anObject.IsNull() ) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = GetOperations()->ShapeProcess( anObject, + Convert( theOperations ), Convert( theParams ), Convert( theValues ) ); + if ( !GetOperations()->IsDone() || aNewObject.IsNull() ) + return aGEOMObject._retn(); + + return GetObject( aNewObject ); +} + +//============================================================================= +/*! + * GetShapeProcessParameters + */ +//============================================================================= +void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out theOperations, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues) +{ + GEOM::string_array_var anOpArray = new GEOM::string_array(); + GEOM::string_array_var aParArray = new GEOM::string_array(); + GEOM::string_array_var aValArray = new GEOM::string_array(); + + // retrieve the values as stl-lists + list operationsList, paramsList, valuesList; + GetOperations()->GetShapeProcessParameters( operationsList, paramsList, valuesList ); + const int opSize = operationsList.size(), + parSize = paramsList.size(), + valSize = valuesList.size(); + + if ( opSize >= 0 && parSize >= 0 && parSize == valSize ) { + // allocate the CORBA arrays, sizes == returned lists' sizes + anOpArray->length(opSize); + aParArray->length(parSize); + aValArray->length(valSize); + + // fill the local CORBA arrays with values from lists + list::iterator opIt, parIt, valIt; + int i = 0; + for ( opIt = operationsList.begin(); opIt != operationsList.end(); i++,++opIt ) + anOpArray[i] = CORBA::string_dup( (*opIt).c_str() ); + + for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); + parIt != paramsList.end(); i++, ++parIt,++valIt ) { + aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); + aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + } + } + + // initialize out-parameters with local arrays + theOperations = anOpArray._retn(); + theParams = aParArray._retn(); + theValues = aValArray._retn(); +} + +//============================================================================= +/*! + * GetOperatorParameters + */ +//============================================================================= +void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues) +{ + GEOM::string_array_var aParArray = new GEOM::string_array(); + GEOM::string_array_var aValArray = new GEOM::string_array(); + + // retrieve the values as stl-lists + list paramsList, valuesList; + if ( GetOperations()->GetOperatorParameters( theOperator, paramsList, valuesList ) ) { + const int parSize = paramsList.size(), valSize = valuesList.size(); + + if ( parSize == valSize ) { + aParArray->length(parSize); + aValArray->length(valSize); + + // fill the local CORBA arrays with values from lists + list::iterator parIt, valIt; + int i; + for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); + parIt != paramsList.end(); i++, ++parIt,++valIt ) { + aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); + aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + } + } + } + + // initialize out-parameters with local arrays + theParams = aParArray._retn(); + theValues = aValArray._retn(); +} + +//============================================================================= +/*! + * SuppressFaces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SuppressFaces (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) ) // if theFaces is empty - it's OK, it means that ALL faces must be removed + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->SuppressFaces( anObject, Convert( theFaces ) ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject( aNewObject ); +} + +//============================================================================= +/*! + * CloseContour + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::CloseContour (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires, + CORBA::Boolean isCommonVertex) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) ) + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->CloseContour( anObject, Convert( theWires ), isCommonVertex ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} + +//============================================================================= +/*! + * RemoveIntWires + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveIntWires (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->RemoveIntWires( anObject, Convert( theWires ) ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} + +//============================================================================= +/*! + * FillHoles + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_ptr theObject, + const GEOM::short_array& theWires) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->FillHoles( anObject, Convert( theWires ) ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} + +//============================================================================= +/*! + * Sew + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) || theTolerance < 0 ) + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->Sew( anObject, theTolerance ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} + +//============================================================================= +/*! + * DivideEdge + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_ptr theObject, + CORBA::Short theIndex, + CORBA::Double theValue, + CORBA::Boolean isByParameter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + // Set a not done flag + GetOperations()->SetNotDone(); + + // Check parameters + if ( CORBA::is_nil(theObject) || theValue < 0 || theValue > 1 ) + return aGEOMObject._retn(); + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return aGEOMObject._retn(); + + // Perform + Handle(GEOM_Object) aNewObject = + GetOperations()->DivideEdge( anObject, theIndex, theValue, isByParameter ); + if (!GetOperations()->IsDone() || aNewObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(aNewObject); +} + +//============================================================================= +/*! + * GetFreeBoundary + */ +//============================================================================= +CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_ptr theObject, + GEOM::ListOfGO_out theClosedWires, + GEOM::ListOfGO_out theOpenWires ) +{ + theClosedWires = new GEOM::ListOfGO; + theOpenWires = new GEOM::ListOfGO; + + // Set a not done flag + GetOperations()->SetNotDone(); + + if ( CORBA::is_nil(theObject) ) + return false; + + // Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) + return false; + + Handle(TColStd_HSequenceOfTransient) aClosed = new TColStd_HSequenceOfTransient(); + Handle(TColStd_HSequenceOfTransient) anOpen = new TColStd_HSequenceOfTransient(); + bool res = GetOperations()->GetFreeBoundary( anObject, aClosed, anOpen ); + + if ( !GetOperations()->IsDone() || !res ) + return false; + + int i, n = aClosed->Length(); + theClosedWires->length( n ); + for ( i = 1; i <= n; i++ ) + (*theClosedWires)[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aClosed->Value(i))); + + n = anOpen->Length(); + theOpenWires->length( n ); + for ( i = 1, n = anOpen->Length(); i <= n; i++ ) + (*theOpenWires)[i-1] = GetObject(Handle(GEOM_Object)::DownCast(anOpen->Value(i))); + + return true; +} diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.hh b/src/GEOM_I/GEOM_IHealingOperations_i.hh new file mode 100644 index 000000000..855059540 --- /dev/null +++ b/src/GEOM_I/GEOM_IHealingOperations_i.hh @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IHealingOperations_i_HeaderFile +#define _GEOM_IHealingOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IHealingOperations.hxx" + +#include +#include + +class GEOM_IHealingOperations_i : + public virtual POA_GEOM::GEOM_IHealingOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IHealingOperations* theImpl); + ~GEOM_IHealingOperations_i(); + + GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, const GEOM::string_array& theOperations, const GEOM::string_array& theParams, const GEOM::string_array& theValues); + + void GetShapeProcessParameters(GEOM::string_array_out theOperations, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + + void GetOperatorParameters (const char* theOperator, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + + GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theFaces); + + GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires, CORBA::Boolean isCommonVertex); + + GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); + + GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires); + + GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, CORBA::Double theTolerance); + + GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, CORBA::Short theIndex, CORBA::Double theValue, CORBA::Boolean isByParameter); + + CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires ); + + ::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); } + +private: + Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); + Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); + +}; + +#endif diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc new file mode 100644 index 000000000..7388c8269 --- /dev/null +++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc @@ -0,0 +1,219 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +#include + +#include "GEOM_IInsertOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IInsertOperations_i::GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IInsertOperations* theImpl) + :GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IInsertOperations_i::GEOM_IInsertOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IInsertOperations_i::~GEOM_IInsertOperations_i() +{ + MESSAGE("GEOM_IInsertOperations_i::~GEOM_IInsertOperations_i"); +} + + +//============================================================================= +/*! + * MakeCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::MakeCopy(GEOM::GEOM_Object_ptr theOriginal) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theOriginal == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) anOriginal = + GetOperations()->GetEngine()->GetObject(theOriginal->GetStudyID(), + theOriginal->GetEntry()); + + if (anOriginal.IsNull()) return aGEOMObject._retn(); + + //Create the copy + Handle(GEOM_Object) anObject = GetOperations()->MakeCopy(anOriginal); + + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * Export + */ +//============================================================================= +void GEOM_IInsertOperations_i::Export + (GEOM::GEOM_Object_ptr theOriginal, + const char* theFileName, + const char* theFormatName) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theOriginal); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theOriginal == NULL) return; + + //Get the reference shape + Handle(GEOM_Object) anOriginal = + GetOperations()->GetEngine()->GetObject(theOriginal->GetStudyID(), + theOriginal->GetEntry()); + + if (anOriginal.IsNull()) return; + + //Export the shape to the file + char* aFileName = strdup(theFileName); + char* aFormatName = strdup(theFormatName); + GetOperations()->Export(anOriginal, aFileName, aFormatName); + free(aFileName); + free(aFormatName); + + return; +} + +//============================================================================= +/*! + * Import + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::Import + (const char* theFileName, + const char* theFormatName) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Import the shape from the file + char* aFileName = strdup(theFileName); + char* aFormatName = strdup(theFormatName); + Handle(GEOM_Object) anObject = GetOperations()->Import(aFileName, aFormatName); + free(aFileName); + free(aFormatName); + + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * ImportTranslators + */ +//============================================================================= +void GEOM_IInsertOperations_i::ImportTranslators + (GEOM::string_array_out theFormats, GEOM::string_array_out thePatterns) +{ + // allocate the CORBA arrays + GEOM::string_array_var aFormatsArray = new GEOM::string_array(); + GEOM::string_array_var aPatternsArray = new GEOM::string_array(); + + // Get sequences of available formats + Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString; + Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString; + if (GetOperations()->ImportTranslators(aFormats, aPatterns)) { + const int formSize = aFormats->Length(); + if (formSize == aPatterns->Length()) { + aFormatsArray->length(formSize); + aPatternsArray->length(formSize); + + // fill the local CORBA arrays with values from sequences + CORBA::Long i = 1; + for (; i <= formSize; i++) { + aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); + aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); + } + } + } + + // initialize out-parameters with local arrays + theFormats = aFormatsArray._retn(); + thePatterns = aPatternsArray._retn(); +} + +//============================================================================= +/*! + * ExportTranslators + */ +//============================================================================= +void GEOM_IInsertOperations_i::ExportTranslators + (GEOM::string_array_out theFormats, GEOM::string_array_out thePatterns) +{ + // allocate the CORBA arrays + GEOM::string_array_var aFormatsArray = new GEOM::string_array(); + GEOM::string_array_var aPatternsArray = new GEOM::string_array(); + + // Get sequences of available formats + Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString; + Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString; + if (GetOperations()->ExportTranslators(aFormats, aPatterns)) { + const int formSize = aFormats->Length(); + if (formSize == aPatterns->Length()) { + aFormatsArray->length(formSize); + aPatternsArray->length(formSize); + + // fill the local CORBA arrays with values from sequences + CORBA::Long i = 1; + for (; i <= formSize; i++) { + aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString()); + aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString()); + } + } + } + + // initialize out-parameters with local arrays + theFormats = aFormatsArray._retn(); + thePatterns = aPatternsArray._retn(); +} diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.hh b/src/GEOM_I/GEOM_IInsertOperations_i.hh new file mode 100644 index 000000000..ad98c51de --- /dev/null +++ b/src/GEOM_I/GEOM_IInsertOperations_i.hh @@ -0,0 +1,61 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IInsertOperations_i_HeaderFile +#define _GEOM_IInsertOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IInsertOperations.hxx" + +class GEOM_IInsertOperations_i : + public virtual POA_GEOM::GEOM_IInsertOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IInsertOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IInsertOperations* theImpl); + ~GEOM_IInsertOperations_i(); + + GEOM::GEOM_Object_ptr MakeCopy (GEOM::GEOM_Object_ptr theOriginal); + + void Export (GEOM::GEOM_Object_ptr theOriginal, + const char* theFileName, + const char* theFormatName); + + GEOM::GEOM_Object_ptr Import (const char* theFileName, + const char* theFormatName); + + void ImportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns); + + void ExportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns); + + ::GEOMImpl_IInsertOperations* GetOperations() + { return (::GEOMImpl_IInsertOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.cc b/src/GEOM_I/GEOM_ILocalOperations_i.cc new file mode 100644 index 000000000..f91cb437f --- /dev/null +++ b/src/GEOM_I/GEOM_ILocalOperations_i.cc @@ -0,0 +1,294 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_ILocalOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_ILocalOperations_i::GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ILocalOperations* theImpl) + :GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_ILocalOperations_i::GEOM_ILocalOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_ILocalOperations_i::~GEOM_ILocalOperations_i() +{ + MESSAGE("GEOM_ILocalOperations_i::~GEOM_ILocalOperations_i"); +} + + +//============================================================================= +/*! + * MakeFilletAll + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFilletAll(aShapeRef, theR); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFilletEdges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theEdges) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference edges + int ind = 0; + int aLen = theEdges.length(); + list anEdges; + for (; ind < aLen; ind++) { + anEdges.push_back(theEdges[ind]); + } + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFilletEdges(aShapeRef, theR, anEdges); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFilletFaces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference faces + int ind = 0; + int aLen = theFaces.length(); + list aFaces; + for (; ind < aLen; ind++) { + aFaces.push_back(theFaces[ind]); + } + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFilletFaces(aShapeRef, theR, aFaces); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeChamferAll + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferAll(aShapeRef, theD); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeChamferEdge + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferEdge(aShapeRef, theD1, theD2, theFace1, theFace2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeChamferFaces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference faces + int ind = 0; + int aLen = theFaces.length(); + list aFaces; + for (; ind < aLen; ind++) { + aFaces.push_back(theFaces[ind]); + } + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferFaces(aShapeRef, theD1, theD2, aFaces); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeArchimede + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Archimede + Handle(GEOM_Object) anObject = GetOperations()->MakeArchimede + (aShapeRef, theWeight, theWaterDensity, theMeshingDeflection); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetSubShapeIndex + */ +//============================================================================= +CORBA::Long GEOM_ILocalOperations_i::GetSubShapeIndex + (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theSubShape) +{ + if (theShape == NULL || theSubShape == NULL) return -1; + + //Get the reference shapes + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject + (theSubShape->GetStudyID(), theSubShape->GetEntry()); + if (aShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1; + + //Get the unique ID of inside + CORBA::Long anID = GetOperations()->GetSubShapeIndex(aShapeRef, aSubShapeRef); + if (!GetOperations()->IsDone()) + return -1; + + return anID; +} diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.hh b/src/GEOM_I/GEOM_ILocalOperations_i.hh new file mode 100644 index 000000000..35eab0de9 --- /dev/null +++ b/src/GEOM_I/GEOM_ILocalOperations_i.hh @@ -0,0 +1,69 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_ILocalOperations_i_HeaderFile +#define _GEOM_ILocalOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_ILocalOperations.hxx" + +class GEOM_ILocalOperations_i : + public virtual POA_GEOM::GEOM_ILocalOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ILocalOperations* theImpl); + ~GEOM_ILocalOperations_i(); + + GEOM::GEOM_Object_ptr MakeFilletAll (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theEdges); + GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + const GEOM::ListOfLong& theFaces); + + GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); + GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2); + GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theFaces); + + GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection); + + CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theSubShape); + + ::GEOMImpl_ILocalOperations* GetOperations() + { return (::GEOMImpl_ILocalOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc new file mode 100644 index 000000000..1564bd5b7 --- /dev/null +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -0,0 +1,305 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IMeasureOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IMeasureOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i() +{ + MESSAGE("GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i"); +} + + +//============================================================================= +/*! + * GetCentreOfMass + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass + (GEOM::GEOM_Object_ptr theShape) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + // Make Point - centre of mass of theShape + Handle(GEOM_Object) anObject = GetOperations()->GetCentreOfMass(aShape); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetBasicProperties + */ +//============================================================================= +void GEOM_IMeasureOperations_i::GetBasicProperties (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& theLength, + CORBA::Double& theSurfArea, + CORBA::Double& theVolume) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return; + + // Get shape parameters + GetOperations()->GetBasicProperties(aShape, theLength, theSurfArea, theVolume); +} + +//============================================================================= +/*! + * GetInertia + */ +//============================================================================= +void GEOM_IMeasureOperations_i::GetInertia + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13, + CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23, + CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33, + CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return; + + // Get shape parameters + GetOperations()->GetInertia(aShape, + I11, I12, I13, + I21, I22, I23, + I31, I32, I33, + Ix , Iy , Iz); +} + +//============================================================================= +/*! + * GetBoundingBox + */ +//============================================================================= +void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& Xmin, CORBA::Double& Xmax, + CORBA::Double& Ymin, CORBA::Double& Ymax, + CORBA::Double& Zmin, CORBA::Double& Zmax) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return; + + // Get shape parameters + GetOperations()->GetBoundingBox(aShape, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax); +} + +//============================================================================= +/*! + * GetTolerance + */ +//============================================================================= +void GEOM_IMeasureOperations_i::GetTolerance + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& FaceMin, CORBA::Double& FaceMax, + CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, + CORBA::Double& VertMin, CORBA::Double& VertMax) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return; + + // Get shape parameters + GetOperations()->GetTolerance(aShape, + FaceMin, FaceMax, + EdgeMin, EdgeMax, + VertMin, VertMax); +} + +//============================================================================= +/*! + * CheckShape + */ +//============================================================================= +CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theShape, + CORBA::String_out theDescription) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) + { + theDescription = CORBA::string_dup("null"); + return 0; + } + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) + { + theDescription = CORBA::string_dup("null2"); + return 0; + } + + // Get shape parameters + TCollection_AsciiString aDump; + if (GetOperations()->CheckShape(aShape, aDump)) + { + theDescription = CORBA::string_dup("OK"); + return 1; + } + theDescription = CORBA::string_dup(aDump.ToCString()); + return 0; +} + +//============================================================================= +/*! + * WhatIs + */ +//============================================================================= +char* GEOM_IMeasureOperations_i::WhatIs (GEOM::GEOM_Object_ptr theShape) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return NULL; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return NULL; + + // Get shape parameters + TCollection_AsciiString aDescription = GetOperations()->WhatIs(aShape); + return strdup(aDescription.ToCString()); +} + +//============================================================================= +/*! + * GetMinDistance + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance + (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2, + CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1, + CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape1 == NULL || theShape2 == NULL) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject + (theShape1->GetStudyID(), theShape1->GetEntry()); + Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject + (theShape2->GetStudyID(), theShape2->GetEntry()); + + if (aShape1.IsNull() || aShape2.IsNull()) return -1.0; + + // Get shape parameters + return GetOperations()->GetMinDistance(aShape1, aShape2, X1, Y1, Z1, X2, Y2, Z2); +} + +//============================================================================= +/*! + * PointCoordinates + */ +//============================================================================= +void GEOM_IMeasureOperations_i::PointCoordinates( + GEOM::GEOM_Object_ptr theShape, CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z ) + +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if ( theShape->_is_nil() ) + return; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject( + theShape->GetStudyID(), theShape->GetEntry() ); + + if ( aShape.IsNull() ) + return; + + // Get shape parameters + GetOperations()->PointCoordinates( aShape, X, Y, Z ); +} diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh new file mode 100644 index 000000000..81639bfc0 --- /dev/null +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -0,0 +1,83 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IMeasureOperations_i_HeaderFile +#define _GEOM_IMeasureOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IMeasureOperations.hxx" + +class GEOM_IMeasureOperations_i : + public virtual POA_GEOM::GEOM_IMeasureOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IMeasureOperations* theImpl); + ~GEOM_IMeasureOperations_i(); + + void GetBasicProperties (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& theLength, + CORBA::Double& theSurfArea, + CORBA::Double& theVolume); + + GEOM::GEOM_Object_ptr GetCentreOfMass (GEOM::GEOM_Object_ptr theShape); + + void GetInertia (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13, + CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23, + CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33, + CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz); + + void GetBoundingBox (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& Xmin, CORBA::Double& Xmax, + CORBA::Double& Ymin, CORBA::Double& Ymax, + CORBA::Double& Zmin, CORBA::Double& Zmax); + + void GetTolerance (GEOM::GEOM_Object_ptr theShape, + CORBA::Double& FaceMin, CORBA::Double& FaceMax, + CORBA::Double& EdgeMin, CORBA::Double& EdgeMax, + CORBA::Double& VertMin, CORBA::Double& VertMax); + + CORBA::Boolean CheckShape (GEOM::GEOM_Object_ptr theShape, + CORBA::String_out theDescription); + + char* WhatIs (GEOM::GEOM_Object_ptr theShape); + + CORBA::Double GetMinDistance (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1, + CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2); + + + void PointCoordinates( GEOM::GEOM_Object_ptr theShape, + CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z ); + + ::GEOMImpl_IMeasureOperations* GetOperations() + { return (::GEOMImpl_IMeasureOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc new file mode 100644 index 000000000..8170be2f7 --- /dev/null +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -0,0 +1,138 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include "GEOM_IOperations_i.hh" + +#include "GEOM_Engine.hxx" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include +#include +#include + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl) +:SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine) +{ + thePOA->activate_object(this); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOM_IOperations_i::~GEOM_IOperations_i() +{} + + +//============================================================================= +/*! + * IsDone + */ +//============================================================================= +CORBA::Boolean GEOM_IOperations_i::IsDone() +{ + return _impl->IsDone(); +} + + +//============================================================================= +/*! + * SetErrorCode + */ +//============================================================================= +void GEOM_IOperations_i::SetErrorCode(const char* theErrorCode) +{ + _impl->SetErrorCode((char*)theErrorCode); +} + +//============================================================================= +/*! + * GetErrorCode + */ +//============================================================================= +char* GEOM_IOperations_i::GetErrorCode() +{ + return CORBA::string_dup(_impl->GetErrorCode()); +} + +//============================================================================= +/*! + * GetStudyID + */ +//============================================================================= +CORBA::Long GEOM_IOperations_i::GetStudyID() +{ + return _impl->GetDocID(); +} + +//============================================================================= +/*! + * StartOperation + */ +//============================================================================= +void GEOM_IOperations_i::StartOperation() +{ + _impl->StartOperation(); +} + +//============================================================================= +/*! + * FinishOperation + */ +//============================================================================= +void GEOM_IOperations_i::FinishOperation() +{ + _impl->FinishOperation(); +} + + +//============================================================================= +/*! + * AboutOperation + */ +//============================================================================= +void GEOM_IOperations_i::AbortOperation() +{ + _impl->AbortOperation(); +} + +//============================================================================= +/*! + * GetObject + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject) +{ + if(theObject.IsNull()) return NULL; + TCollection_AsciiString anEntry; + TDF_Tool::Entry(theObject->GetEntry(), anEntry); + GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_duplicate(_engine->GetObject(theObject->GetDocID(), anEntry.ToCString())); + return GO._retn(); +} diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh new file mode 100644 index 000000000..e73120afa --- /dev/null +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -0,0 +1,64 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IOperations_i_HeaderFile +#define _GEOM_IOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "SALOME_GenericObj_i.hh" +#include "GEOM_IOperations.hxx" +#include "GEOM_Object_i.hh" +#include "GEOM_Object.hxx" + +class GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperations, public virtual SALOME::GenericObj_i +{ + public: + GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl); + ~GEOM_IOperations_i(); + + virtual CORBA::Boolean IsDone(); + + virtual void SetErrorCode(const char* theErrorCode); + + virtual char* GetErrorCode(); + + virtual CORBA::Long GetStudyID(); + + virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject); + + virtual void StartOperation(); + + virtual void FinishOperation(); + + virtual void AbortOperation(); + + + ::GEOM_IOperations* GetImpl() { return _impl; } + + private: + + ::GEOM_IOperations* _impl; + GEOM::GEOM_Gen_ptr _engine; +}; + +#endif diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc new file mode 100644 index 000000000..4c452deae --- /dev/null +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -0,0 +1,998 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_IShapesOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IShapesOperations_i::GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IShapesOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IShapesOperations_i::GEOM_IShapesOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i() +{ + MESSAGE("GEOM_IShapesOperations_i::~GEOM_IShapesOperations_i"); +} + + +//============================================================================= +/*! + * MakeEdge + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn(); + + //Create the Edge + Handle(GEOM_Object) anObject = GetOperations()->MakeEdge(aPnt1, aPnt2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeWire + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire + (const GEOM::ListOfGO& theEdgesAndWires) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + list aShapes; + + //Get the shapes + aLen = theEdgesAndWires.length(); + for (ind = 0; ind < aLen; ind++) { + if (theEdgesAndWires[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theEdgesAndWires[ind]->GetStudyID(), theEdgesAndWires[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes.push_back(aSh); + } + + // Make Solid + Handle(GEOM_Object) anObject = + GetOperations()->MakeWire(aShapes); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace + (GEOM::GEOM_Object_ptr theWire, + const CORBA::Boolean isPlanarWanted) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theWire == NULL) return aGEOMObject._retn(); + + //Get the reference wire + Handle(GEOM_Object) aWire = GetOperations()->GetEngine()->GetObject + (theWire->GetStudyID(), theWire->GetEntry()); + + if (aWire.IsNull()) return aGEOMObject._retn(); + + //Create the Face + Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeFaceWires + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires + (const GEOM::ListOfGO& theWires, + const CORBA::Boolean isPlanarWanted) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + list aShapes; + + //Get the shapes + aLen = theWires.length(); + for (ind = 0; ind < aLen; ind++) { + if (theWires[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theWires[ind]->GetStudyID(), theWires[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes.push_back(aSh); + } + + // Make Face + Handle(GEOM_Object) anObject = + GetOperations()->MakeFaceWires(aShapes, isPlanarWanted); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeShell + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeShell + (const GEOM::ListOfGO& theFacesAndShells) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + list aShapes; + + //Get the shapes + aLen = theFacesAndShells.length(); + for (ind = 0; ind < aLen; ind++) { + if (theFacesAndShells[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theFacesAndShells[ind]->GetStudyID(), theFacesAndShells[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes.push_back(aSh); + } + + // Make Solid + Handle(GEOM_Object) anObject = + GetOperations()->MakeShell(aShapes); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSolidShell + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShell + (GEOM::GEOM_Object_ptr theShell) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShell == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShell = GetOperations()->GetEngine()->GetObject + (theShell->GetStudyID(), theShell->GetEntry()); + + if (aShell.IsNull()) return aGEOMObject._retn(); + + //Create the Solid + Handle(GEOM_Object) anObject = GetOperations()->MakeSolidShell(aShell); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeSolidShells + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidShells + (const GEOM::ListOfGO& theShells) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + list aShapes; + + //Get the shapes + aLen = theShells.length(); + for (ind = 0; ind < aLen; ind++) { + if (theShells[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theShells[ind]->GetStudyID(), theShells[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes.push_back(aSh); + } + + // Make Solid + Handle(GEOM_Object) anObject = + GetOperations()->MakeSolidShells(aShapes); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeCompound + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeCompound + (const GEOM::ListOfGO& theShapes) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + int ind, aLen; + list aShapes; + + //Get the shapes + aLen = theShapes.length(); + for (ind = 0; ind < aLen; ind++) { + if (theShapes[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aShapes.push_back(aSh); + } + + // Make Solid + Handle(GEOM_Object) anObject = + GetOperations()->MakeCompound(aShapes); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeGlueFaces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Perform the gluing + Handle(GEOM_Object) anObject = + GetOperations()->MakeGlueFaces(aShape, theTolerance); + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // to allow warning + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeExplode + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeExplode (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + if (theShape == NULL) return aSeq._retn(); + + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakeExplode(aShape, theShapeType, isSorted); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * SubShapeAllIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + const CORBA::Boolean isSorted) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + if (theShape == NULL) return aSeq._retn(); + + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->SubShapeAllIDs(aShape, theShapeType, isSorted); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetSubShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape + (GEOM::GEOM_Object_ptr theMainShape, + const CORBA::Long theID) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theMainShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theMainShape->GetStudyID(), theMainShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + Handle(GEOM_Object) anObject = GetOperations()->GetSubShape(aShape, theID); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * NumberOfFaces + */ +//============================================================================= +CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape) +{ + if (theShape == NULL) return -1; + + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape); + if (!GetOperations()->IsDone()) return -1; + + return aNb; +} + +//============================================================================= +/*! + * NumberOfEdges + */ +//============================================================================= +CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape) +{ + if (theShape == NULL) return -1; + + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape); + if (!GetOperations()->IsDone()) return -1; + + return aNb; +} + +//============================================================================= +/*! + * ChangeOrientation + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation + (GEOM::GEOM_Object_ptr theShape) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + //Create the Solid + Handle(GEOM_Object) anObject = GetOperations()->ReverseShape(aShape); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * GetFreeFacesIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + if (theShape == NULL) return aSeq._retn(); + + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->GetFreeFacesIDs(aShape); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetSharedShapes + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes + (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + const CORBA::Long theShapeType) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + if (theShape1 == NULL || + theShape2 == NULL) return aSeq._retn(); + + Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject + (theShape1->GetStudyID(), theShape1->GetEntry()); + Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject + (theShape2->GetStudyID(), theShape2->GetEntry()); + + if (aShape1.IsNull() || + aShape2.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetSharedShapes(aShape1, aShape2, theShapeType); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +static GEOMAlgo_State ShapeState (const GEOM::shape_state theState) +{ + GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN; + + switch (theState) { + case GEOM::ST_ON: + aState = GEOMAlgo_ST_ON; + break; + case GEOM::ST_OUT: + aState = GEOMAlgo_ST_OUT; + break; + case GEOM::ST_ONOUT: + aState = GEOMAlgo_ST_ONOUT; + break; + case GEOM::ST_IN: + aState = GEOMAlgo_ST_IN; + break; + case GEOM::ST_ONIN: + aState = GEOMAlgo_ST_ONIN; + break; + default: + break; + } + + return aState; +} + +//============================================================================= +/*! + * GetShapesOnPlane + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); + + if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); + + //Get Shapes On Plane + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnCylinder + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAxis == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject + (theAxis->GetStudyID(), theAxis->GetEntry()); + + if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); + + //Get Shapes On Cylinder + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder + (aShape, theShapeType, anAxis, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnSphere + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theCenter == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject + (theCenter->GetStudyID(), theCenter->GetEntry()); + + if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); + + //Get Shapes On Sphere + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere + (aShape, theShapeType, aCenter, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnQuadrangle + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle + (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + theTopLeftPoint == NULL || + theTopRigthPoint == NULL || + theBottomLeftPoint == NULL || + theBottomRigthPoint == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); + Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); + Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); + Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + + if (aShape.IsNull() || + aTopLeftPoint.IsNull() || + aTopRigthPoint.IsNull() || + aBottomLeftPoint.IsNull() || + aBottomRigthPoint.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Quadrangle + Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle + (aShape, theShapeType, + aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint, + ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnPlaneIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnPlaneIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAx1 == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject + (theAx1->GetStudyID(), theAx1->GetEntry()); + + if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn(); + + //Get Shapes On Plane + Handle(TColStd_HSequenceOfInteger) aHSeq = + GetOperations()->GetShapesOnPlaneIDs(aShape, theShapeType, anAx1, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnCylinderIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnCylinderIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theAxis == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject + (theAxis->GetStudyID(), theAxis->GetEntry()); + + if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn(); + + //Get Shapes On Cylinder + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnCylinderIDs + (aShape, theShapeType, anAxis, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnSphereIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnSphereIDs + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + const CORBA::Double theRadius, + const GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || theCenter == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject + (theCenter->GetStudyID(), theCenter->GetEntry()); + + if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn(); + + //Get Shapes On Sphere + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnSphereIDs + (aShape, theShapeType, aCenter, theRadius, ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetShapesOnQuadrangleIDs + */ +//============================================================================= +GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs + (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState) +{ + GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL || + theTopLeftPoint == NULL || + theTopRigthPoint == NULL || + theBottomLeftPoint == NULL || + theBottomRigthPoint == NULL ) + return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + Handle(GEOM_Object) aTopLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopLeftPoint->GetEntry()); + Handle(GEOM_Object) aTopRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theTopRigthPoint->GetEntry()); + Handle(GEOM_Object) aBottomLeftPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomLeftPoint->GetEntry()); + Handle(GEOM_Object) aBottomRigthPoint = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theBottomRigthPoint->GetEntry()); + + if (aShape.IsNull() || + aTopLeftPoint.IsNull() || + aTopRigthPoint.IsNull() || + aBottomLeftPoint.IsNull() || + aBottomRigthPoint.IsNull() ) + return aSeq._retn(); + + //Get Shapes On Quadrangle + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs + (aShape, theShapeType, + aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint, + ShapeState(theState)); + if (!GetOperations()->IsDone() || aHSeq.IsNull()) + return aSeq._retn(); + + Standard_Integer aLength = aHSeq->Length(); + aSeq->length(aLength); + for (Standard_Integer i = 1; i <= aLength; i++) + aSeq[i-1] = aHSeq->Value(i); + + return aSeq._retn(); +} + +//============================================================================= +/*! + * GetInPlace + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlace + (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShapeWhere == NULL || + theShapeWhat == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShapeWhere = GetOperations()->GetEngine()->GetObject + (theShapeWhere->GetStudyID(), theShapeWhere->GetEntry()); + Handle(GEOM_Object) aShapeWhat = GetOperations()->GetEngine()->GetObject + (theShapeWhat->GetStudyID(), theShapeWhat->GetEntry()); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aGEOMObject._retn(); + + //Get Shapes in place of aShapeWhat + Handle(GEOM_Object) anObject = + GetOperations()->GetInPlace(aShapeWhere, aShapeWhat); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh new file mode 100644 index 000000000..eb48a0f74 --- /dev/null +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -0,0 +1,144 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_IShapesOperations_i_HeaderFile +#define _GEOM_IShapesOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IShapesOperations.hxx" + +class GEOM_IShapesOperations_i : + public virtual POA_GEOM::GEOM_IShapesOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IShapesOperations* theImpl); + ~GEOM_IShapesOperations_i(); + + GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + + GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires); + + GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire, + CORBA::Boolean isPlanarWanted); + + GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires, + CORBA::Boolean isPlanarWanted); + + GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells); + + GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell); + + GEOM::GEOM_Object_ptr MakeSolidShells (const GEOM::ListOfGO& theShells); + + GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); + + GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + + GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + + GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + + GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theID); + + CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape); + CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape); + + GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape); + + GEOM::ListOfLong* GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape); + + GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theShapeType); + + GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::shape_state theState); + + GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfGO* GetShapesOnQuadrangle (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState); + + GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAx1, + GEOM::shape_state theState); + + GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theCenter, + CORBA::Double theRadius, + GEOM::shape_state theState); + + GEOM::ListOfLong* GetShapesOnQuadrangleIDs (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + GEOM::GEOM_Object_ptr theTopLeftPoint, + GEOM::GEOM_Object_ptr theTopRigthPoint, + GEOM::GEOM_Object_ptr theBottomLeftPoint, + GEOM::GEOM_Object_ptr theBottomRigthPoint, + GEOM::shape_state theState); + + GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat); + + ::GEOMImpl_IShapesOperations* GetOperations() + { return (::GEOMImpl_IShapesOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc new file mode 100644 index 000000000..d68c74492 --- /dev/null +++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc @@ -0,0 +1,950 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include "GEOM_ITransformOperations_i.hh" + +#include "utilities.h" +#include "OpUtil.hxx" +#include "Utils_ExceptHandlers.hxx" + +#include +#include +#include +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#define SUBSHAPE_ERROR "Sub shape cannot be transformed" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ITransformOperations* theImpl) + :GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i() +{ + MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i"); +} + + +//============================================================================= +/*! + * TranslateTwoPoints + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::GEOM_Object_var aGEOMObject; + + if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the first point of translation + Handle(GEOM_Object) aPoint1 = + GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry()); + if (aPoint1.IsNull()) return aGEOMObject._retn(); + + //Get the second point of translation + Handle(GEOM_Object) aPoint2 = + GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry()); + if (aPoint2.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * TranslateTwoPointsCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the first point of translation + Handle(GEOM_Object) aPoint1 = + GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry()); + if (aPoint1.IsNull()) return aGEOMObject._retn(); + + //Get the second point of translation + Handle(GEOM_Object) aPoint2 = + GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry()); + if (aPoint2.IsNull()) return aGEOMObject._retn(); + + //Create the translated shape + Handle(GEOM_Object) anObject = + GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * TranslateDXDYDZ + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::GEOM_Object_var aGEOMObject ; + + if (theObject == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ); + + return aGEOMObject._retn(); +} + + +//============================================================================= +/*! + * TranslateDXDYDZCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy + (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + + + //Create the translated shape + Handle(GEOM_Object) anObject = + GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * TranslateVector + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aVector = + GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + GetOperations()->TranslateVector(anObject, aVector); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * TranslateVectorCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aVector = + GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * Rotate + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the object itself + Handle(GEOM_Object) anObject = GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the axis of revolution + Handle(GEOM_Object) anAxis = + GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry()); + if (anAxis.IsNull()) return aGEOMObject._retn(); + + //Perform the rotation + GetOperations()->Rotate(anObject, anAxis, theAngle); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * RotateCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the axis of rotation + Handle(GEOM_Object) anAxis = + GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry()); + if (anAxis.IsNull()) return aGEOMObject._retn(); + + //Perform the rotation + Handle(GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * MirrorPlane + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the plane + Handle(GEOM_Object) aPlane = + GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry()); + if (aPlane.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + GetOperations()->MirrorPlane(anObject, aPlane); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * MirrorPlaneCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aPlane = + GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry()); + if (aPlane.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + Handle(GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MirrorAxis + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the axis + Handle(GEOM_Object) aAxis = + GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry()); + if (aAxis.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + GetOperations()->MirrorAxis(anObject, aAxis); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * MirrorAxisCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aAxis = + GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry()); + if (aAxis.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + Handle(GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MirrorPoint + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the point + Handle(GEOM_Object) aPoint = + GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry()); + if (aPoint.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + GetOperations()->MirrorPoint(anObject, aPoint); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * MirrorPointCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aPoint = + GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry()); + if (aPoint.IsNull()) return aGEOMObject._retn(); + + //Perform the mirror + Handle(GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * OffsetShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape + (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + + //Get the basic object + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Create the offset shape + GetOperations()->OffsetShape(aBasicObject, theOffset); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * OffsetShapeCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy + (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL) return aGEOMObject._retn(); + + //Get the basic object + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Create the offset shape + Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + +//============================================================================= +/*! + * ScaleShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + //Get the object itself + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the point + Handle(GEOM_Object) aPoint = + GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry()); + if (aPoint.IsNull()) return aGEOMObject._retn(); + + //Perform the scale + GetOperations()->ScaleShape(anObject, aPoint, theFactor); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * ScaleShapeCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn(); + + //Get the basic object + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the point + Handle(GEOM_Object) aPoint = + GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry()); + if (aPoint.IsNull()) return aGEOMObject._retn(); + + //Perform the scale + Handle(GEOM_Object) anObject = + GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * PositionShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) +{ + GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL) + return aGEOMObject._retn(); + + //check if the object is a subshape + if(!theObject->IsMainShape()) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + //Get the basic object + Handle(GEOM_Object) anObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (anObject.IsNull()) return aGEOMObject._retn(); + + //Get the Start LCS + Handle(GEOM_Object) aStartLCS = + GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry()); + if (aStartLCS.IsNull()) return aGEOMObject._retn(); + + //Get the End LCS + Handle(GEOM_Object) aEndLCS = + GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry()); + if (aEndLCS.IsNull()) return aGEOMObject._retn(); + + //Perform the Position + GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS); + + return aGEOMObject._retn(); +} + +//============================================================================= +/*! + * PositionShapeCopy + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL) + return aGEOMObject._retn(); + + //Get the basic object + Handle(GEOM_Object) aBasicObject = + GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the Start LCS + Handle(GEOM_Object) aStartLCS = + GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry()); + if (aStartLCS.IsNull()) return aGEOMObject._retn(); + + //Get the End LCS + Handle(GEOM_Object) aEndLCS = + GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry()); + if (aEndLCS.IsNull()) return aGEOMObject._retn(); + + //Perform the position + Handle(GEOM_Object) anObject = + GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MultiTranslate1D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D + (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, CORBA::Long theNbTimes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector of translation + Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject + (theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + Handle(GEOM_Object) anObject = + GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MultiTranslate2D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theVector1 == NULL || theVector2 == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the vector1 of translation + Handle(GEOM_Object) aVector1 = GetOperations()->GetEngine()->GetObject + (theVector1->GetStudyID(), theVector1->GetEntry()); + if (aVector1.IsNull()) return aGEOMObject._retn(); + + //Get the vector2 of translation + Handle(GEOM_Object) aVector2 = GetOperations()->GetEngine()->GetObject + (theVector2->GetStudyID(), theVector2->GetEntry()); + if (aVector2.IsNull()) return aGEOMObject._retn(); + + //Perform the translation + Handle(GEOM_Object) anObject = GetOperations()->Translate2D + (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MultiRotate1D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Long theNbTimes) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the a directon of rotation + Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject + (theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the rotation + Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MultiRotate2D + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + GEOM::GEOM_Object_var aGEOMObject; + + if (theObject == NULL || theVector == NULL) return aGEOMObject._retn(); + + //Get the object itself + Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject + (theObject->GetStudyID(), theObject->GetEntry()); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Get the a directon of rotation + Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject + (theVector->GetStudyID(), theVector->GetEntry()); + if (aVector.IsNull()) return aGEOMObject._retn(); + + //Perform the rotation + Handle(GEOM_Object) anObject = GetOperations()->Rotate2D + (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2); + if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + + return GetObject(anObject); +} diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh new file mode 100644 index 000000000..7cb17e1be --- /dev/null +++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh @@ -0,0 +1,130 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_ITransformOperations_i_HeaderFile +#define _GEOM_ITransformOperations_i_HeaderFile + + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_ITransformOperations.hxx" + +class GEOM_ITransformOperations_i : + public virtual POA_GEOM::GEOM_ITransformOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_ITransformOperations* theImpl); + ~GEOM_ITransformOperations_i(); + + GEOM::GEOM_Object_ptr TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + + GEOM::GEOM_Object_ptr TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + + GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); + + + GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); + + GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector); + + GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector); + + GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector, CORBA::Double theStep, CORBA::Long theNbTimes); + + GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theVector1, CORBA::Double theStep1, CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, CORBA::Double theStep2, CORBA::Long theNbTimes2); + + GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + + GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Long theNbTimes); + + + GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2); + + GEOM::GEOM_Object_ptr RotateCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + + GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + + GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + + GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + + GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + + GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + + GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + + GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + + GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + + GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); + + GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); + + GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); + + GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); + + ::GEOMImpl_ITransformOperations* GetOperations() { return (::GEOMImpl_ITransformOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc new file mode 100644 index 000000000..66e85cbf3 --- /dev/null +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -0,0 +1,315 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#include + +#include +//#include +#include +#include + +#include "utilities.h" +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef WNT +#pragma warning( disable:4786 ) +#endif + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= + +GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + Handle(GEOM_Object) theImpl) +: SALOME::GenericObj_i( thePOA ), _engine(theEngine), _impl(theImpl) +{ + thePOA->activate_object(this); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= + +GEOM_Object_i::~GEOM_Object_i() +{} + + +//============================================================================= +/*! + * GetEntry + */ +//============================================================================= +char* GEOM_Object_i::GetEntry() +{ + const TDF_Label& aLabel = _impl->GetEntry(); + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aLabel, anEntry); + return CORBA::string_dup(anEntry.ToCString()); +} + +//============================================================================= +/*! + * GetStudyID + */ +//============================================================================= +CORBA::Long GEOM_Object_i::GetStudyID() +{ + return _impl->GetDocID(); +} + + +//============================================================================= +/*! + * GetType + */ +//============================================================================= +CORBA::Long GEOM_Object_i::GetType() +{ + return _impl->GetType(); +} + +//============================================================================= +/*! + * GetShapeType + */ +//============================================================================= +GEOM::shape_type GEOM_Object_i::GetShapeType() +{ + TopoDS_Shape _geom = _impl->GetValue(); + if(_geom.IsNull()) return GEOM::SHAPE; + return (GEOM::shape_type)_geom.ShapeType(); +} + +//============================================================================= +/*! + * SetName + */ +//============================================================================= +void GEOM_Object_i::SetName(const char* theName) +{ + _impl->SetName(theName); +} + + +//============================================================================= +/*! + * GetName + */ +//============================================================================= +char* GEOM_Object_i::GetName() +{ + char* aName = _impl->GetName(); + if(aName) return strdup(aName); + return strdup(""); +} + +//============================================================================= +/*! + * SetStudyEntry + */ +//============================================================================= +void GEOM_Object_i::SetStudyEntry(const char* theEntry) +{ + _impl->SetAuxData(theEntry); +} + + +//============================================================================= +/*! + * GetStudyEntry + */ +//============================================================================= +char* GEOM_Object_i::GetStudyEntry() +{ + TCollection_AsciiString anEntry = _impl->GetAuxData(); + if(!anEntry.IsEmpty()) return CORBA::string_dup(anEntry.ToCString()); + return CORBA::string_dup(""); +} + + +//============================================================================= +/*! + * GetDependency + */ +//============================================================================= +GEOM::ListOfGO* GEOM_Object_i::GetDependency() +{ + GEOM::ListOfGO_var aList = new GEOM::ListOfGO(); + aList->length(0); + + Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllDependency(); + if (aSeq.IsNull()) return aList._retn(); + int aLength = aSeq->Length(); + if (aLength == 0) return aList._retn(); + + aList->length(aLength); + + TCollection_AsciiString anEntry; + + for (int i = 1; i<=aLength; i++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(aSeq->Value(i)); + if (anObj.IsNull()) continue; + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_duplicate(_engine->GetObject(anObj->GetDocID(), anEntry.ToCString())); + aList[i-1] = obj; + } + + return aList._retn(); +} + +//============================================================================= +/*! + * GetLastDependency + */ +//============================================================================= +GEOM::ListOfGO* GEOM_Object_i::GetLastDependency() +{ + GEOM::ListOfGO_var aList = new GEOM::ListOfGO(); + aList->length(0); + + Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetLastDependency(); + if (aSeq.IsNull()) return aList._retn(); + int aLength = aSeq->Length(); + if (aLength == 0) return aList._retn(); + + aList->length(aLength); + + TCollection_AsciiString anEntry; + + for (int i = 1; i<=aLength; i++) { + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(aSeq->Value(i)); + if (anObj.IsNull()) continue; + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_duplicate(_engine->GetObject(anObj->GetDocID(), anEntry.ToCString())); + aList[i-1] = obj; + } + + return aList._retn(); +} + +//================================================================================= +// function : GetShapeStream +// Transfer resulting shape to client as sequence of bytes +//client can extract shape from stream using BrepTools::Read function +//================================================================================= +SALOMEDS::TMPFile* GEOM_Object_i::GetShapeStream() +{ + TopoDS_Shape aShape = _impl->GetValue(); + + if(aShape.IsNull()) return NULL; + + ostrstream streamShape; + //Write TopoDS_Shape in ASCII format to the stream + BRepTools::Write(aShape, streamShape); + //Returns the number of bytes that have been stored in the stream's buffer. + int size = streamShape.pcount(); + char* buf = new char [size]; + //Get pointer on internal character array in ostrstream + char* valueOfStream = streamShape.str(); + //Create copy of ostrstream content + memcpy(buf, valueOfStream, size); + //Allow automatic deletion of ostrstream content + streamShape.rdbuf()->freeze(0); + + CORBA::Octet* OctetBuf = (CORBA::Octet*)buf; + SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size,size,OctetBuf,1); + return SeqFile._retn(); + +} + + +//======================================================================= +//function : getShape +//purpose : return the TopoDS_Shape when client and servant are colocated, be careful +//======================================================================= +long GEOM_Object_i::getShape() { + _geom = _impl->GetValue(); + return((long)(&_geom)); +} + +//============================================================================= +/*! + * GetSubShapeIndices + */ +//============================================================================= +GEOM::ListOfLong* GEOM_Object_i::GetSubShapeIndices() +{ + GEOM::ListOfLong_var anIndices = new GEOM::ListOfLong; + + if(!_impl->IsMainShape()) { + Handle(GEOM_Function) aFunction = _impl->GetFunction(1); //Get SubShape function (always the first (and last) one) + if(aFunction.IsNull()) return anIndices._retn(); + GEOM_ISubShape ISS(aFunction); + Handle(TColStd_HArray1OfInteger) anArray = ISS.GetIndices(); + if(anArray.IsNull() || anArray->Length() < 1) return anIndices._retn(); + anIndices->length(anArray->Length()); + for(int i=1; i<=anArray->Length(); i++) anIndices[i-1] = anArray->Value(i); + } + else { + anIndices->length(0); + } + + return anIndices._retn(); +} + + +//============================================================================= +/*! + * GetMainShape + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Object_i::GetMainShape() +{ + GEOM::GEOM_Object_var obj; + if(!_impl->IsMainShape()) { + Handle(GEOM_Function) aFunction = _impl->GetFunction(1); //Get SubShape function (always the first (and last) one) + if(aFunction.IsNull()) return obj._retn(); + GEOM_ISubShape ISS(aFunction); + + aFunction = ISS.GetMainShape(); + if(aFunction.IsNull()) return obj._retn(); + TDF_Label aLabel = aFunction->GetOwnerEntry(); + if(aLabel.IsNull()) return obj._retn(); + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aLabel, anEntry); + return GEOM::GEOM_Object::_duplicate(_engine->GetObject(_impl->GetDocID(), anEntry.ToCString())); + } + + return obj._retn(); +} + +bool GEOM_Object_i::IsShape() +{ + return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER; +} diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh new file mode 100644 index 000000000..ab5779589 --- /dev/null +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -0,0 +1,82 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#ifndef _GEOM_Object_i_HeaderFile +#define _GEOM_Object_i_HeaderFile + + +#include +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(GEOM_Gen) + +#include "SALOME_GenericObj_i.hh" + +#include "GEOM_Object.hxx" + +#include + +class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOME::GenericObj_i +{ + public: + GEOM_Object_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, Handle(GEOM_Object) theImpl); + ~GEOM_Object_i(); + + virtual char* GetEntry(); + + virtual CORBA::Long GetStudyID(); + + virtual CORBA::Long GetType(); + + virtual GEOM::shape_type GetShapeType(); + + virtual void SetName(const char* theName); + + virtual char* GetName(); + + virtual void SetStudyEntry(const char* theEntry); + + virtual char* GetStudyEntry(); + + virtual GEOM::ListOfGO* GetDependency(); + + virtual GEOM::ListOfGO* GetLastDependency(); + + virtual SALOMEDS::TMPFile* GetShapeStream(); + + long getShape(); + + virtual bool IsMainShape() { return _impl->IsMainShape(); } + + virtual GEOM::ListOfLong* GetSubShapeIndices(); + + virtual GEOM::GEOM_Object_ptr GetMainShape(); + + virtual bool IsShape(); + + Handle(GEOM_Object) GetImpl() { return _impl; } + + private: + + GEOM::GEOM_Gen_ptr _engine; + Handle(GEOM_Object) _impl; + TopoDS_Shape _geom; +}; + +#endif diff --git a/src/GEOM_I/Makefile.in b/src/GEOM_I/Makefile.in new file mode 100644 index 000000000..6cf1d5df1 --- /dev/null +++ b/src/GEOM_I/Makefile.in @@ -0,0 +1,98 @@ +# GEOM GEOM : implementaion of GEOM_Gen.idl +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Patrick GOLDBRONN (CEA) +# Module : GEOM +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + +@COMMENCE@ + +# Libraries targets + +LIB = libGEOMEngine.la +LIB_SRC = \ + GEOM_Object_i.cc \ + GEOM_IOperations_i.cc \ + GEOM_IBasicOperations_i.cc \ + GEOM_IHealingOperations_i.cc \ + GEOM_I3DPrimOperations_i.cc \ + GEOM_IShapesOperations_i.cc \ + GEOM_IBlocksOperations_i.cc \ + GEOM_IBooleanOperations_i.cc \ + GEOM_ICurvesOperations_i.cc \ + GEOM_ILocalOperations_i.cc \ + GEOM_IInsertOperations_i.cc \ + GEOM_ITransformOperations_i.cc \ + GEOM_IMeasureOperations_i.cc \ + GEOM_IGroupOperations_i.cc \ + GEOM_Gen_i.cc \ + GEOM_DumpPython.cc + +# SALOME_Component.idl +LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Exception.idl + #SALOME_Exception.idl SALOME_GenericObj.idl + +LIB_SERVER_IDL = GEOM_Gen.idl + +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +#This export required to compile GEOM_Superv_i.lo library +EXPORT_HEADERS = GEOM_Object_i.hh \ + GEOM_IOperations_i.hh \ + GEOM_IBasicOperations_i.hh \ + GEOM_IHealingOperations_i.hh \ + GEOM_I3DPrimOperations_i.hh \ + GEOM_IShapesOperations_i.hh \ + GEOM_IBlocksOperations_i.hh \ + GEOM_IBooleanOperations_i.hh \ + GEOM_ICurvesOperations_i.hh \ + GEOM_ILocalOperations_i.hh \ + GEOM_IInsertOperations_i.hh \ + GEOM_ITransformOperations_i.hh \ + GEOM_IMeasureOperations_i.hh \ + GEOM_IGroupOperations_i.hh \ + GEOM_Gen_i.hh + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += -lGEOMArchimede -lGEOMbasic -lGEOMimpl -lGEOMSketcher \ + $(CAS_DATAEXCHANGE) $(CAS_LDPATH) -lTKFillet -lTKOffset \ + -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ diff --git a/src/GEOM_I_Superv/GEOM_List_i.hh b/src/GEOM_I_Superv/GEOM_List_i.hh new file mode 100644 index 000000000..765e381e8 --- /dev/null +++ b/src/GEOM_I_Superv/GEOM_List_i.hh @@ -0,0 +1,104 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef __GEOM_LIST_I_H__ +#define __GEOM_LIST_I_H__ + +// IDL headers +#include +#include CORBA_SERVER_HEADER(GEOM_Superv) + +#include "GEOM_Gen_i.hh" +#include "utilities.h" + +template +class GEOM_List_i : + public virtual POA_GEOM::GEOM_List, + public virtual PortableServer::RefCountServantBase +{ +public: + GEOM_List_i(); + GEOM_List_i(const Type& theListToCopy); + ~GEOM_List_i(); + + const Type& GetList(); + + template + void AddObject(ElemType theObject); + +private: + Type myGOList; +}; + +//============================================================================= +// constructor: +//============================================================================= +template +GEOM_List_i::GEOM_List_i() +{ + MESSAGE("GEOM_List_i::GEOM_List_i"); + //create an empty list + myGOList.length(0); +} + +//============================================================================= +// constructor: +//============================================================================= +template +GEOM_List_i::GEOM_List_i(const Type& theListToCopy) +{ + int aLength = theListToCopy.length(); + myGOList.length(aLength); + for (int i = 0; i < aLength; i++) + myGOList[i] = theListToCopy[i]; +} + +//============================================================================= +// destructor: +//============================================================================= +template +GEOM_List_i::~GEOM_List_i() +{ + MESSAGE("GEOM_List_i::~GEOM_List_i"); +} + +//============================================================================= +// GetList: +//============================================================================= +template +const Type& GEOM_List_i::GetList() +{ + MESSAGE("GEOM_List_i::GetList()"); + return myGOList; +} + +//============================================================================= +// AddObject: +//============================================================================= +template +template +void GEOM_List_i::AddObject(ElemType theObject) +{ + MESSAGE("GEOM_List_i::AddObject(...)"); + int aLength = myGOList.length(); + myGOList.length(aLength+1); + myGOList[aLength] = theObject; +} + +#endif diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc new file mode 100644 index 000000000..32b1589de --- /dev/null +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -0,0 +1,1937 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +#include "GEOM_Superv_i.hh" +#include "SALOME_LifeCycleCORBA.hxx" +using namespace std; +//============================================================================= +// constructor: +//============================================================================= +GEOM_Superv_i::GEOM_Superv_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName) +{ + MESSAGE("GEOM_Superv_i::GEOM_Superv_i"); + + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + name_service = new SALOME_NamingService(_orb); + //get RootPOA (the default) + //myPOA = PortableServer::RefCountServantBase::_default_POA(); + CORBA::Object_var anObj = _orb->resolve_initial_references("RootPOA"); + myPOA = PortableServer::POA::_narrow(anObj); + + setGeomEngine(); + + myStudyID = -1; + + myBasicOp = GEOM::GEOM_IBasicOperations::_nil(); + my3DPrimOp = GEOM::GEOM_I3DPrimOperations::_nil(); + myBoolOp = GEOM::GEOM_IBooleanOperations::_nil(); + myInsOp = GEOM::GEOM_IInsertOperations::_nil(); + myTransfOp = GEOM::GEOM_ITransformOperations::_nil(); + myShapesOp = GEOM::GEOM_IShapesOperations::_nil(); + myBlocksOp = GEOM::GEOM_IBlocksOperations::_nil(); + myCurvesOp = GEOM::GEOM_ICurvesOperations::_nil(); + myLocalOp = GEOM::GEOM_ILocalOperations::_nil(); + myGroupOp = GEOM::GEOM_IGroupOperations::_nil(); +} + +//============================================================================= +// destructor +//============================================================================= +GEOM_Superv_i::~GEOM_Superv_i() +{ + MESSAGE("GEOM_Superv_i::~GEOM_Superv_i"); + delete name_service; +} + +//============================================================================ +// function : register() +// purpose : register 'name' in 'name_service' +//============================================================================ +void GEOM_Superv_i::register_name(char * name) +{ + GEOM::GEOM_Superv_ptr g = GEOM::GEOM_Superv::_narrow(POA_GEOM::GEOM_Superv::_this()); + name_service->Register(g, strdup(name)); +} + +//============================================================================= +// setGEOMEngine: +//============================================================================= +void GEOM_Superv_i::setGeomEngine() +{ + // get GEOM_Gen engine + SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service ); + Engines::Component_var comp = lcc->FindOrLoad_Component( "FactoryServer", "GEOM" ); + + myGeomEngine = GEOM::GEOM_Gen::_narrow(comp); +} + +//============================================================================= +// SetStudyID: +//============================================================================= +void GEOM_Superv_i::SetStudyID( CORBA::Long theId ) +{ + myStudyID = theId; +} + +//============================================================================= +// CreateListOfGO: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfGO() +{ + MESSAGE("GEOM_Superv_i::CreateListOfGO()"); + GEOM_List_i* aListPtr = new GEOM_List_i(); + return aListPtr->_this(); +} + +//============================================================================= +// AddItemToListOfGO: +//============================================================================= +void GEOM_Superv_i::AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, + GEOM::GEOM_Object_ptr theObject) +{ + MESSAGE("GEOM_Superv_i::AddItemToListOfGO(...)"); + if (GEOM_List_i* aList = + dynamic_cast*>(GetServant(theList, myPOA).in())) { + aList->AddObject(theObject); + MESSAGE(" NewLength = "<GetList().length()); + } +} + +//============================================================================= +// CreateListOfLong: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfLong() +{ + MESSAGE("GEOM_Superv_i::CreateListOfLong()"); + GEOM_List_i* aListPtr = new GEOM_List_i(); + return aListPtr->_this(); +} + +//============================================================================= +// AddItemToListOfLong: +//============================================================================= +void GEOM_Superv_i::AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, + long theObject) +{ + MESSAGE("GEOM_Superv_i::AddItemToListOfLong(...)"); + if (GEOM_List_i* aList = + dynamic_cast*>(GetServant(theList, myPOA).in())) { + aList->AddObject(theObject); + MESSAGE(" NewLength = "<GetList().length()); + } +} + +//============================================================================= +// CreateListOfDouble: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::CreateListOfDouble() +{ + MESSAGE("GEOM_Superv_i::CreateListOfDouble()"); + GEOM_List_i* aListPtr = new GEOM_List_i(); + return aListPtr->_this(); +} + +//============================================================================= +// AddItemToListOfDouble: +//============================================================================= +void GEOM_Superv_i::AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, + double theObject) +{ + MESSAGE("GEOM_Superv_i::AddItemToListOfDouble(...)"); + if (GEOM_List_i* aList = + dynamic_cast*>(GetServant(theList, myPOA).in())) { + aList->AddObject(theObject); + MESSAGE(" NewLength = "<GetList().length()); + } +} + +//============================================================================= +// getBasicOp: +//============================================================================= +void GEOM_Superv_i::getBasicOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IBasicOperations interface + myBasicOp = myGeomEngine->GetIBasicOperations(myStudyID); +} + +//============================================================================= +// get3DPrimOp: +//============================================================================= +void GEOM_Superv_i::get3DPrimOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_I3DPrimOperations interface + my3DPrimOp = myGeomEngine->GetI3DPrimOperations(myStudyID); +} + +//============================================================================= +// getBoolOp: +//============================================================================= +void GEOM_Superv_i::getBoolOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IBooleanOperations interface + myBoolOp = myGeomEngine->GetIBooleanOperations(myStudyID); +} + +//============================================================================= +// getInsOp: +//============================================================================= +void GEOM_Superv_i::getInsOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IInsertOperations interface + myInsOp = myGeomEngine->GetIInsertOperations(myStudyID); +} + +//============================================================================= +// getTransfOp: +//============================================================================= +void GEOM_Superv_i::getTransfOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_ITransformOperations interface + myTransfOp = myGeomEngine->GetITransformOperations(myStudyID); +} + +//============================================================================= +// getShapesOp: +//============================================================================= +void GEOM_Superv_i::getShapesOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IShapesOperations interface + myShapesOp = myGeomEngine->GetIShapesOperations(myStudyID); +} + +//============================================================================= +// getBlocksOp: +//============================================================================= +void GEOM_Superv_i::getBlocksOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IBlocksOperations interface + myBlocksOp = myGeomEngine->GetIBlocksOperations(myStudyID); +} + +//============================================================================= +// getCurvesOp: +//============================================================================= +void GEOM_Superv_i::getCurvesOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_ICurvesOperations interface + myCurvesOp = myGeomEngine->GetICurvesOperations(myStudyID); +} + +//============================================================================= +// getLocalOp: +//============================================================================= +void GEOM_Superv_i::getLocalOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_ILocalOperations interface + myLocalOp = myGeomEngine->GetILocalOperations(myStudyID); +} + +//============================================================================= +// getGroupOp: +//============================================================================= +void GEOM_Superv_i::getGroupOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IGroupOperations interface + myGroupOp = myGeomEngine->GetIGroupOperations(myStudyID); +} + +//============================================================================= +// GetServant: +//============================================================================= +PortableServer::ServantBase_var GEOM_Superv_i::GetServant(CORBA::Object_ptr theObject, + PortableServer::POA_ptr thePOA) +{ + if(CORBA::is_nil(theObject)) return NULL; + PortableServer::Servant aServant = thePOA->reference_to_servant(theObject); + return aServant; +} + +//============================================================================ +// function : Save() +// purpose : save OCAF/Geom document +//============================================================================ +SALOMEDS::TMPFile* GEOM_Superv_i::Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) +{ + SALOMEDS::TMPFile_var aStreamFile; + return aStreamFile._retn(); +} + +//============================================================================ +// function : SaveASCII() +// purpose : +//============================================================================ +SALOMEDS::TMPFile* GEOM_Superv_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) +{ + SALOMEDS::TMPFile_var aStreamFile; + return aStreamFile._retn(); +} + +//============================================================================ +// function : Load() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Superv_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) +{ + return false; +} + +//============================================================================ +// function : LoadASCII() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Superv_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) +{ + return false; +} + +//============================================================================ +// function : Close() +// purpose : +//============================================================================ +void GEOM_Superv_i::Close(SALOMEDS::SComponent_ptr theComponent) +{} + +//============================================================================ +// function : ComponentDataType() +// purpose : +//============================================================================ +char* GEOM_Superv_i::ComponentDataType() +{ + return 0; +} + +//============================================================================ +// function : IORToLocalPersistentID() +// purpose : +//============================================================================ +char* GEOM_Superv_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + return 0; +} + +//============================================================================ +// function : LocalPersistentIDToIOR() +// purpose : Create/Load CORBA object from a persistent ref (an entry) +// : Used when a study is loaded +// : The IOR (IORName) of object created is returned +//============================================================================ +char* GEOM_Superv_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) +{ + return 0; +} + +//============================================================================ +// function : CanPublishInStudy +// purpose : +//============================================================================ +bool GEOM_Superv_i::CanPublishInStudy(CORBA::Object_ptr theIOR) +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + return myGeomEngine->CanPublishInStudy(theIOR); +} + +//============================================================================ +// function : PublishInStudy +// purpose : +//============================================================================ +SALOMEDS::SObject_ptr GEOM_Superv_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + return myGeomEngine->PublishInStudy(theStudy, theSObject, theObject, theName); +} + +//============================================================================ +// function : CanCopy() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Superv_i::CanCopy(SALOMEDS::SObject_ptr theObject) +{ + return false; +} + +//============================================================================ +// function : CopyFrom() +// purpose : +//============================================================================ +SALOMEDS::TMPFile* GEOM_Superv_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) +{ + SALOMEDS::TMPFile_var aStreamFile; + return aStreamFile._retn(); +} + +//============================================================================ +// function : CanPaste() +// purpose : +//============================================================================ +CORBA::Boolean GEOM_Superv_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) +{ + return false; +} + +//============================================================================ +// function : PasteInto() +// purpose : +//============================================================================ +SALOMEDS::SObject_ptr GEOM_Superv_i::PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) +{ + SALOMEDS::SObject_var aNewSO; + return aNewSO._retn(); +} + +//================= Primitives Construction : BasicOperations ================= +//============================================================================= +// MakePointXYZ: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointXYZ(CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ) +{ + MESSAGE("GEOM_Superv_i::MakePointXYZ"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + // make vertex and return + return myBasicOp->MakePointXYZ(theX, theY, theZ); +} + +//============================================================================= +// MakePointWithReference: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointWithReference (GEOM::GEOM_Object_ptr theReference, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ) +{ + MESSAGE("GEOM_Superv_i::MakePointWithReference"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakePointWithReference(theReference, theX, theY, theZ); +} + +//============================================================================= +// MakePointOnCurve: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theParameter) +{ + MESSAGE("GEOM_Superv_i::MakePointOnCurve"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakePointOnCurve(theRefCurve, theParameter); +} + +//============================================================================= +// MakeVectorDXDYDZ: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) +{ + MESSAGE("GEOM_Superv_i::MakeVectorDXDYDZ"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakeVectorDXDYDZ(theDX, theDY, theDZ); +} + +//============================================================================= +// MakeVectorTwoPnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeVectorTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2) +{ + MESSAGE("GEOM_Superv_i::MakeVector"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakeVectorTwoPnt(thePnt1, thePnt2); +} + +//============================================================================= +// MakeLineTwoPnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2) +{ + MESSAGE("GEOM_Superv_i::MakeLineTwoPnt"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakeLineTwoPnt(thePnt1, thePnt2); +} + +//============================================================================= +// MakePlaneThreePnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Double theTrimSize) +{ + MESSAGE("GEOM_Superv_i::MakePlaneThreePnt"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize); +} + +//============================================================================= +// MakePlanePntVec: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize) +{ + MESSAGE("GEOM_Superv_i::MakePlanePntVec"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakePlanePntVec(thePnt, theVec, theTrimSize); +} + +//============================================================================= +// MakePlaneFace: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneFace (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theTrimSize) +{ + MESSAGE("GEOM_Superv_i::MakePlaneFace"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakePlaneFace(theFace, theTrimSize); +} + +//============================================================================= +// MakeMarker: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker +(CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, + CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, + CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ) +{ + MESSAGE("GEOM_Superv_i::MakeMarker"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + return myBasicOp->MakeMarker(theOX, theOY, theOZ, theXDX, theXDY, theXDZ, theYDX, theYDY, theYDZ); +} + +//================= Primitives Construction : 3DPrimOperations ================ +//============================================================================= +// MakeBox: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBox (CORBA::Double theX1, + CORBA::Double theY1, + CORBA::Double theZ1, + CORBA::Double theX2, + CORBA::Double theY2, + CORBA::Double theZ2) +{ + MESSAGE("GEOM_Superv_i::MakeBox"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeBoxTwoPnt(myBasicOp->MakePointXYZ(theX1, theY1, theZ1), + myBasicOp->MakePointXYZ(theX2, theY2, theZ2)); +} + +//============================================================================= +// MakeBoxDXDYDZ: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) +{ + MESSAGE("GEOM_Superv_i::MakeBoxDXDYDZ"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeBoxDXDYDZ(theDX, theDY, theDZ); +} + +//============================================================================= +// MakeBoxTwoPnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2) +{ + MESSAGE("GEOM_Superv_i::MakeBoxTwoPnt"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeBoxTwoPnt(thePnt1, thePnt2); +} + +//============================================================================= +// MakeCylinderPntVecRH: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + CORBA::Double theHeight) +{ + MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRH"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeCylinderPntVecRH(thePnt, theAxis, theRadius, theHeight); +} + +//============================================================================= +// MakeCylinderRH: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH) +{ + MESSAGE("GEOM_Superv_i::MakeCylinderRH"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeCylinderRH(theR, theH); +} + +//============================================================================= +// MakeSphere: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphere (CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theRadius) +{ + MESSAGE("GEOM_Superv_i::MakeSphepe"); + if (CORBA::is_nil(myBasicOp)) getBasicOp(); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeSpherePntR(myBasicOp->MakePointXYZ(theX, theY, theZ), theRadius); +} + +//============================================================================= +// MakeSphereR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphereR (CORBA::Double theR) +{ + MESSAGE("GEOM_Superv_i::MakeSphereR"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeSphereR(theR); +} + +//============================================================================= +// MakeSpherePntR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theR) +{ + MESSAGE("GEOM_Superv_i::MakeSpherePntR"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeSpherePntR(thePnt, theR); +} + +//============================================================================= +// MakeTorusPntVecRR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusPntVecRR (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, + CORBA::Double theRMinor) +{ + MESSAGE("GEOM_Superv_i::MakeTorusPntVecRR"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor); +} + +//============================================================================= +// MakeTorusRR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTorusRR (CORBA::Double theRMajor, + CORBA::Double theRMinor) +{ + MESSAGE("GEOM_Superv_i::MakeTorusRR"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeTorusRR(theRMajor, theRMinor); +} + +//============================================================================= +// MakeConePntVecR1R2H: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight) +{ + MESSAGE("GEOM_Superv_i::MakeConePntVecR1R2H"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theHeight); +} + +//============================================================================= +// MakeConeR1R2H: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight) +{ + MESSAGE("GEOM_Superv_i::MakeConeR1R2H"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeConeR1R2H(theR1, theR2, theHeight); +} + +//============================================================================= +// MakePrismVecH: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) +{ + MESSAGE("GEOM_Superv_i::MakePrismVecH"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakePrismVecH(theBase, theVec, theH); +} + + +//============================================================================= +// MakePrismTwoPnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + MESSAGE("GEOM_Superv_i::MakePrismTwoPnt"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakePrismTwoPnt(theBase, thePoint1, thePoint2); +} + +//============================================================================= +// MakePipe: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipe (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath) +{ + MESSAGE("GEOM_Superv_i::MakePipe"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakePipe(theBase, thePath); +} + +//============================================================================= +// MakeRevolutionAxisAngle: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + MESSAGE("GEOM_Superv_i::MakeRevolutionAxisAngle"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeRevolutionAxisAngle(theBase, theAxis, theAngle); +} + +//============================================================================= +// MakeFilling: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theMinDeg, CORBA::Long theMaxDeg, + CORBA::Double theTol2D, CORBA::Double theTol3D, + CORBA::Long theNbIter) +{ + MESSAGE("GEOM_Superv_i::MakeFilling"); + if (CORBA::is_nil(my3DPrimOp)) get3DPrimOp(); + return my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter); +} + +//============================= BooleanOperations ============================= +//============================================================================= +// MakeBoolean: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOperation) +{ + // theOperation indicates the operation to be done: + // 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section + MESSAGE("GEOM_Superv_i::MakeBoolean"); + if (CORBA::is_nil(myBoolOp)) getBoolOp(); + return myBoolOp->MakeBoolean(theShape1, theShape2, theOperation); +} + +//============================================================================= +// MakeFuse: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + MESSAGE("GEOM_Superv_i::MakeFuse"); + if (CORBA::is_nil(myBoolOp)) getBoolOp(); + return myBoolOp->MakeBoolean(theShape1, theShape2, 3); +} + +//============================================================================= +// MakePartition: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theShapes, + GEOM::GEOM_List_ptr theTools, + GEOM::GEOM_List_ptr theKeepInside, + GEOM::GEOM_List_ptr theRemoveInside, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + GEOM::GEOM_List_ptr theMaterials) +{ + MESSAGE("GEOM_Superv_i::MakePartition"); + GEOM_List_i* aListImplS = + dynamic_cast*>(GetServant(theShapes, myPOA).in()); + GEOM_List_i* aListImplT = + dynamic_cast*>(GetServant(theTools, myPOA).in()); + GEOM_List_i* aListImplKI = + dynamic_cast*>(GetServant(theKeepInside, myPOA).in()); + GEOM_List_i* aListImplRI = + dynamic_cast*>(GetServant(theRemoveInside, myPOA).in()); + GEOM_List_i* aListImplM = + dynamic_cast*>(GetServant(theMaterials, myPOA).in()); + if (aListImplS && aListImplT && aListImplKI && aListImplRI && aListImplM) { + if (CORBA::is_nil(myBoolOp)) getBoolOp(); + return myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), + aListImplKI->GetList(), aListImplRI->GetList(), + theLimit, theRemoveWebs, aListImplM->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeHalfPartition: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePlane) +{ + MESSAGE("GEOM_Superv_i::MakeHalfPartition"); + if (CORBA::is_nil(myBoolOp)) getBoolOp(); + return myBoolOp->MakeHalfPartition(theShape, thePlane); +} + +//============================== InsertOperations ============================= +//============================================================================= +// MakeCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCopy (GEOM::GEOM_Object_ptr theOriginal) +{ + MESSAGE("GEOM_Superv_i::MakeCopy"); + if (CORBA::is_nil(myInsOp)) getInsOp(); + return myInsOp->MakeCopy(theOriginal); +} + +//============================================================================= +// Export: +//============================================================================= +void GEOM_Superv_i::Export (GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const char* theFormatName) +{ + MESSAGE("GEOM_Superv_i::Export"); + if (CORBA::is_nil(myInsOp)) getInsOp(); + myInsOp->Export(theObject, theFileName, theFormatName); +} + +//============================================================================= +// Import: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::Import (const char* theFileName, + const char* theFormatName) +{ + MESSAGE("GEOM_Superv_i::Import"); + if (CORBA::is_nil(myInsOp)) getInsOp(); + return myInsOp->Import(theFileName, theFormatName); +} + +//============================================================================= +// ImportTranslators: +//============================================================================= +void GEOM_Superv_i::ImportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns) +{ + MESSAGE("GEOM_Superv_i::ImportTranslators"); + if (CORBA::is_nil(myInsOp)) getInsOp(); + myInsOp->ImportTranslators(theFormats, thePatterns); +} + +//============================================================================= +// ExportTranslators: +//============================================================================= +void GEOM_Superv_i::ExportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns) +{ + MESSAGE("GEOM_Superv_i::ExportTranslators"); + if (CORBA::is_nil(myInsOp)) getInsOp(); + myInsOp->ExportTranslators(theFormats, thePatterns); +} + +//============================= TransformOperations =========================== +//============================================================================= +// TranslateTwoPoints: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + MESSAGE("GEOM_Superv_i::TranslateTwoPoints"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateTwoPoints(theObject, thePoint1, thePoint2); +} + +//============================================================================= +// TranslateTwoPointsCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + MESSAGE("GEOM_Superv_i::TranslateTwoPointsCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateTwoPointsCopy(theObject, thePoint1, thePoint2); +} + +//============================================================================= +// TranslateDXDYDZ: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) +{ + MESSAGE("GEOM_Superv_i::TranslateDXDYDZ"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateDXDYDZ(theObject, theDX, theDY, theDZ); +} + +//============================================================================= +// TranslateDXDYDZCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ) +{ + MESSAGE("GEOM_Superv_i::TranslateDXDYDZCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ); +} + +//============================================================================= +// TranslateVector: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVector (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector) +{ + MESSAGE("GEOM_Superv_i::TranslateVector"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateVector(theObject, theVector); +} + +//============================================================================= +// TranslateVectorCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector) +{ + MESSAGE("GEOM_Superv_i::TranslateVectorCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->TranslateVectorCopy(theObject, theVector); +} + +//============================================================================= +// MultiTranslate1D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, + CORBA::Long theNbTimes) +{ + MESSAGE("GEOM_Superv_i::MultiTranslate1D"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MultiTranslate1D(theObject, theVector, theStep, theNbTimes); +} + +//============================================================================= +// MultiTranslate2D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2) +{ + MESSAGE("GEOM_Superv_i::MultiTranslate2D"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, + theVector2, theStep2, theNbTimes2); +} + +//============================================================================= +// Rotate: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::Rotate (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + MESSAGE("GEOM_Superv_i::Rotate"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->Rotate(theObject, theAxis, theAngle); +} + +//============================================================================= +// RotateCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::RotateCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + MESSAGE("GEOM_Superv_i::RotateCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->RotateCopy(theObject, theAxis, theAngle); +} + +//============================================================================= +// MultiRotate1D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Long theNbTimes) +{ + MESSAGE("GEOM_Superv_i::MultiRotate1D"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MultiRotate1D(theObject, theAxis, theNbTimes); +} + +//============================================================================= +// MultiRotate2D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2) +{ + MESSAGE("GEOM_Superv_i::MultiRotate2D"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2); +} + +//============================================================================= +// MirrorPlane: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlane (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) +{ + MESSAGE("GEOM_Superv_i::MirrorPlane"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorPlane(theObject, thePlane); +} + +//============================================================================= +// MirrorPlaneCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane) +{ + MESSAGE("GEOM_Superv_i::MirrorPlaneCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorPlaneCopy(theObject, thePlane); +} + +//============================================================================= +// MirrorAxis: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxis (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) +{ + MESSAGE("GEOM_Superv_i::MirrorAxis"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorAxis(theObject, theAxis); +} + +//============================================================================= +// MirrorAxisCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis) +{ + MESSAGE("GEOM_Superv_i::MirrorAxisCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorAxisCopy(theObject, theAxis); +} + +//============================================================================= +// MirrorPoint: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPoint (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) +{ + MESSAGE("GEOM_Superv_i::MirrorPoint"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorPoint(theObject, thePoint); +} + +//============================================================================= +// MirrorPointCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint) +{ + MESSAGE("GEOM_Superv_i::MirrorPointCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->MirrorPointCopy(theObject, thePoint); +} + +//============================================================================= +// OffsetShape: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShape (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) +{ + MESSAGE("GEOM_Superv_i::OffsetShape"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->OffsetShape(theObject, theOffset); +} + +//============================================================================= +// OffsetShapeCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset) +{ + MESSAGE("GEOM_Superv_i::OffsetShapeCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->OffsetShapeCopy(theObject, theOffset); +} + +//============================================================================= +// ScaleShape: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) +{ + MESSAGE("GEOM_Superv_i::ScaleShape"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->ScaleShape(theObject, thePoint, theFactor); +} + +//============================================================================= +// ScaleShapeCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor) +{ + MESSAGE("GEOM_Superv_i::ScaleShapeCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->ScaleShapeCopy(theObject, thePoint, theFactor); +} + +//============================================================================= +// PositionShape: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) +{ + MESSAGE("GEOM_Superv_i::PositionShape"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->PositionShape(theObject, theStartLCS, theEndLCS); +} + +//============================================================================= +// PositionShapeCopy: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS) +{ + MESSAGE("GEOM_Superv_i::PositionShapeCopy"); + if (CORBA::is_nil(myTransfOp)) getTransfOp(); + return myTransfOp->PositionShapeCopy(theObject, theStartLCS, theEndLCS); +} + +//=============================== ShapesOperations ============================ +//============================================================================= +// Make: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdge (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2) +{ + MESSAGE("GEOM_Superv_i::MakeEdge"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeEdge(thePnt1, thePnt2); +} + +//============================================================================= +// MakeWire: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires) +{ + MESSAGE("GEOM_Superv_i::MakeWire"); + if (GEOM_List_i* aListImplEW = + dynamic_cast*>(GetServant(theEdgesAndWires, myPOA).in())) { + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeWire(aListImplEW->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeFace: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFace (GEOM::GEOM_Object_ptr theWire, + CORBA::Boolean isPlanarWanted) +{ + MESSAGE("GEOM_Superv_i::MakeFace"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeFace(theWire, isPlanarWanted); +} + +//============================================================================= +// MakeFaceWires: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceWires (GEOM::GEOM_List_ptr theWires, + CORBA::Boolean isPlanarWanted) +{ + MESSAGE("GEOM_Superv_i::MakeFaceWires"); + if (GEOM_List_i* aListImplW = + dynamic_cast*>(GetServant(theWires, myPOA).in())) { + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeFaceWires(aListImplW->GetList(), isPlanarWanted); + } + return NULL; +} + +//============================================================================= +// MakeShell: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeShell (GEOM::GEOM_List_ptr theFacesAndShells) +{ + MESSAGE("GEOM_Superv_i::MakeShell"); + if (GEOM_List_i* aListImplFS = + dynamic_cast*>(GetServant(theFacesAndShells, myPOA).in())) { + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeShell(aListImplFS->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeSolidShell: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidShell (GEOM::GEOM_Object_ptr theShell) +{ + MESSAGE("GEOM_Superv_i::MakeSolidShell"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeSolidShell(theShell); +} + +//============================================================================= +// MakeSolidShells: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidShells (GEOM::GEOM_List_ptr theShells) +{ + MESSAGE("GEOM_Superv_i::MakeSolidShells"); + if (GEOM_List_i* aListImplS = + dynamic_cast*>(GetServant(theShells, myPOA).in())) { + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeSolidShells(aListImplS->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeCompound: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes) +{ + MESSAGE("GEOM_Superv_i::MakeCompound"); + if (GEOM_List_i* aListImpl = + dynamic_cast*>(GetServant(theShapes, myPOA).in())) { + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeCompound(aListImpl->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeGlueFaces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance) +{ + MESSAGE("GEOM_Superv_i::MakeGlueFaces"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->MakeGlueFaces(theShape, theTolerance); +} + +//============================================================================= +// MakeExplode: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::MakeExplode (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted) +{ + MESSAGE("GEOM_Superv_i::MakeExplode"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + + GEOM::ListOfGO* aList = myShapesOp->MakeExplode(theShape, theShapeType, isSorted); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aList)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + return aListPtr->_this(); +} + +//============================================================================= +// NumberOfFaces: +//============================================================================= +CORBA::Long GEOM_Superv_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape) +{ + MESSAGE("GEOM_Superv_i::NumberOfFaces"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->NumberOfFaces(theShape); +} + +//============================================================================= +// NumberOfEdges: +//============================================================================= +CORBA::Long GEOM_Superv_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape) +{ + MESSAGE("GEOM_Superv_i::NumberOfEdges"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->NumberOfEdges(theShape); +} + +//============================================================================= +// ChangeOrientation: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ChangeOrientation (GEOM::GEOM_Object_ptr theShape) +{ + MESSAGE("GEOM_Superv_i::ChangeOrientation"); + if (CORBA::is_nil(myShapesOp)) getShapesOp(); + return myShapesOp->ChangeOrientation(theShape); +} + + +//=============================== BlocksOperations ============================ +//============================================================================= +// MakeQuad4Vertices: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + GEOM::GEOM_Object_ptr thePnt4) +{ + MESSAGE("GEOM_Superv_i::MakeQuad4Vertices"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeQuad4Vertices(thePnt1, thePnt2, thePnt3, thePnt4); +} + +//============================================================================= +// MakeQuad: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, + GEOM::GEOM_Object_ptr theEdge4) +{ + MESSAGE("GEOM_Superv_i::MakeQuad"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeQuad(theEdge1, theEdge2, theEdge3, theEdge4); +} + +//============================================================================= +// MakeQuad2Edges: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeQuad2Edges (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2) +{ + MESSAGE("GEOM_Superv_i::MakeQuad2Edges"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeQuad2Edges(theEdge1, theEdge2); +} + +//============================================================================= +// MakeHexa: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, + GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, + GEOM::GEOM_Object_ptr theFace6) +{ + MESSAGE("GEOM_Superv_i::MakeHexa"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeHexa(theFace1, theFace2, theFace3, theFace4, theFace5, theFace6); +} + +//============================================================================= +// MakeHexa2Faces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHexa2Faces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2) +{ + MESSAGE("GEOM_Superv_i::MakeHexa2Faces"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeHexa2Faces(theFace1, theFace2); +} + +//============================================================================= +// GetPoint: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetPoint (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theEpsilon) +{ + MESSAGE("GEOM_Superv_i::GetPoint"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetPoint(theShape, theX, theY, theZ, theEpsilon); +} + +//============================================================================= +// GetEdge: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdge (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + MESSAGE("GEOM_Superv_i::GetEdge"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetEdge(theShape, thePoint1, thePoint2); +} + +//============================================================================= +// GetEdgeNearPoint: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + MESSAGE("GEOM_Superv_i::GetEdgeNearPoint"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetEdgeNearPoint(theShape, thePoint); +} + +//============================================================================= +// GetFaceByPoints: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4) +{ + MESSAGE("GEOM_Superv_i::GetFaceByPoints"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4); +} + +//============================================================================= +// GetFaceByEdges: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2) +{ + MESSAGE("GEOM_Superv_i::GetFaceByEdges"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetFaceByEdges(theShape, theEdge1, theEdge2); +} + +//============================================================================= +// GetOppositeFace: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetOppositeFace (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theFace) +{ + MESSAGE("GEOM_Superv_i::GetOppositeFace"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetOppositeFace(theBlock, theFace); +} + +//============================================================================= +// GetFaceNearPoint: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint) +{ + MESSAGE("GEOM_Superv_i::GetFaceNearPoint"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetFaceNearPoint(theShape, thePoint); +} + +//============================================================================= +// GetFaceByNormale: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theVector) +{ + MESSAGE("GEOM_Superv_i::GetFaceByNormale"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetFaceByNormale(theBlock, theVector); +} + +//============================================================================= +// IsCompoundOfBlocks: +//============================================================================= +CORBA::Boolean GEOM_Superv_i::IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks) +{ + MESSAGE("GEOM_Superv_i::IsCompoundOfBlocks"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->IsCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces, theNbBlocks); +} + +//============================================================================= +// CheckCompoundOfBlocks: +//============================================================================= +CORBA::Boolean GEOM_Superv_i::CheckCompoundOfBlocks +(GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors) +{ + MESSAGE("GEOM_Superv_i::CheckCompoundOfBlocks"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->CheckCompoundOfBlocks(theCompound, theErrors); +} + +//============================================================================= +// PrintBCErrors: +//============================================================================= +char* GEOM_Superv_i::PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors) +{ + MESSAGE("GEOM_Superv_i::PrintBCErrors"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->PrintBCErrors(theCompound, theErrors); +} + +//============================================================================= +// ExplodeCompoundOfBlocks: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces) +{ + MESSAGE("GEOM_Superv_i::ExplodeCompoundOfBlocks"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + GEOM::ListOfGO* aBlocks = myBlocksOp->ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aBlocks)); + return aListPtr->_this(); +} + +//============================================================================= +// GetBlockNearPoint: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_Object_ptr thePoint) +{ + MESSAGE("GEOM_Superv_i::GetBlockNearPoint"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetBlockNearPoint(theCompound, thePoint); +} + +//============================================================================= +// GetBlockByParts: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_List_ptr theParts) +{ + MESSAGE("GEOM_Superv_i::GetBlockByParts"); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(theParts, myPOA).in())) { + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->GetBlockByParts(theCompound, aListImplP->GetList()); + } + return NULL; +} + +//============================================================================= +// GetBlocksByParts: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_List_ptr theParts) +{ + MESSAGE("GEOM_Superv_i::GetBlocksByParts"); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(theParts, myPOA).in())) { + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + + GEOM::ListOfGO* aBlocks = myBlocksOp->GetBlocksByParts(theCompound, aListImplP->GetList()); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aBlocks)); + return aListPtr->_this(); + } + return NULL; +} + +//============================================================================= +// MakeMultiTransformation1D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1, + CORBA::Long theDirFace2, + CORBA::Long theNbTimes) +{ + MESSAGE("GEOM_Superv_i::MakeMultiTransformation1D"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeMultiTransformation1D(theBlock, theDirFace1, theDirFace2, theNbTimes); +} + +//============================================================================= +// MakeMultiTransformation2D: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMultiTransformation2D +(GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1U, + CORBA::Long theDirFace2U, + CORBA::Long theNbTimesU, + CORBA::Long theDirFace1V, + CORBA::Long theDirFace2V, + CORBA::Long theNbTimesV) +{ + MESSAGE("GEOM_Superv_i::MakeMultiTransformation2D"); + if (CORBA::is_nil(myBlocksOp)) getBlocksOp(); + return myBlocksOp->MakeMultiTransformation2D(theBlock, + theDirFace1U, theDirFace2U, theNbTimesU, + theDirFace1V, theDirFace2V, theNbTimesV); +} + +//=============================== CurvesOperations ============================ +//============================================================================= +// MakeCirclePntVecR: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR) +{ + MESSAGE("GEOM_Superv_i::MakeCirclePntVecR"); + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeCirclePntVecR(theCenter, theVector, theR); +} + +//============================================================================= +// MakeCircleThreePnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + MESSAGE("GEOM_Superv_i::MakeCircleThreePnt"); + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeCircleThreePnt(thePnt1, thePnt2, thePnt3); +} + +//============================================================================= +// MakeEllipse: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipse (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, + CORBA::Double theRMinor) +{ + MESSAGE("GEOM_Superv_i::MakeEllipse"); + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeEllipse(theCenter, theVector, theRMajor, theRMinor); +} + +//============================================================================= +// MakeArc: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArc (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + MESSAGE("GEOM_Superv_i::MakeArc"); + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeArc(thePnt1, thePnt2, thePnt3); +} + +//============================================================================= +// MakePolyline: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePolyline (GEOM::GEOM_List_ptr thePoints) +{ + MESSAGE("GEOM_Superv_i::MakePolyline"); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(thePoints, myPOA).in())) { + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakePolyline(aListImplP->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeSplineBezier: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineBezier (GEOM::GEOM_List_ptr thePoints) +{ + MESSAGE("GEOM_Superv_i::MakeSplineBezier"); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(thePoints, myPOA).in())) { + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeSplineBezier(aListImplP->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeSplineInterpolation: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints) +{ + MESSAGE("GEOM_Superv_i::MakeSplineInterpolation"); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(thePoints, myPOA).in())) { + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeSplineInterpolation(aListImplP->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeSketcher: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSketcher (const char* theCommand, + GEOM::GEOM_List_ptr theWorkingPlane) +{ + MESSAGE("GEOM_Superv_i::MakeSketcher"); + if (GEOM_List_i* aListImplWP = + dynamic_cast*>(GetServant(theWorkingPlane, myPOA).in())) { + if (CORBA::is_nil(myCurvesOp)) getCurvesOp(); + return myCurvesOp->MakeSketcher(theCommand, aListImplWP->GetList()); + } + return NULL; +} + +//=============================== LocalOperations ============================= +//============================================================================= +// MakeFilletAll: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletAll (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR) +{ + MESSAGE("GEOM_Superv_i::MakeFilletAllMakeSketcher"); + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeFilletAll(theShape, theR); +} + +//============================================================================= +// MakeFilletEdges: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theEdges) +{ + MESSAGE("GEOM_Superv_i::MakeFilletEdges"); + if (GEOM_List_i* aListImplE = + dynamic_cast*>(GetServant(theEdges, myPOA).in())) { + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeFilletEdges(theShape, theR, aListImplE->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeFilletFaces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR, + GEOM::GEOM_List_ptr theFaces) +{ + MESSAGE("GEOM_Superv_i::MakeFilletFaces"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theFaces, myPOA).in())) { + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeFilletFaces(theShape, theR, aListImplF->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeChamferAll: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD) +{ + MESSAGE("GEOM_Superv_i::MakeChamferAll"); + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeChamferAll(theShape, theD); +} + +//============================================================================= +// MakeChamferEdge: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2) +{ + MESSAGE("GEOM_Superv_i::MakeChamferEdge"); + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2); +} + +//============================================================================= +// MakeChamferFaces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theFaces) +{ + MESSAGE("GEOM_Superv_i::MakeChamferFaces"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theFaces, myPOA).in())) { + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeChamferFaces(theShape, theD1, theD2, aListImplF->GetList()); + } + return NULL; +} + +//============================================================================= +// MakeArchimede: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection) +{ + MESSAGE("GEOM_Superv_i::MakeArchimede"); + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->MakeArchimede(theShape, theWeight, theWaterDensity, theMeshingDeflection); +} + +//============================================================================= +// GetSubShapeIndexMakeFilletAll: +//============================================================================= +CORBA::Long GEOM_Superv_i::GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theSubShape) +{ + MESSAGE("GEOM_Superv_i::GetSubShapeIndexMakeArchimede"); + if (CORBA::is_nil(myLocalOp)) getLocalOp(); + return myLocalOp->GetSubShapeIndex(theShape, theSubShape); +} + +//=============================== GroupOperations ============================= +//============================================================================= +// CreateGroup: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::CreateGroup (GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theShapeType) +{ + MESSAGE("GEOM_Superv_i::CreateGroup"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + return myGroupOp->CreateGroup(theMainShape, theShapeType); +} + +//============================================================================= +// AddObject: +//============================================================================= +void GEOM_Superv_i::AddObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId) +{ + MESSAGE("GEOM_Superv_i::AddObject"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + myGroupOp->AddObject(theGroup, theSubShapeId); +} + +//============================================================================= +// RemoveObject: +//============================================================================= +void GEOM_Superv_i::RemoveObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId) +{ + MESSAGE("GEOM_Superv_i::RemoveObject"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + myGroupOp->RemoveObject(theGroup, theSubShapeId); +} + +//============================================================================= +// GetType: +//============================================================================= +CORBA::Long GEOM_Superv_i::GetType (GEOM::GEOM_Object_ptr theGroup) +{ + MESSAGE("GEOM_Superv_i::GetType"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + return myGroupOp->GetType(theGroup); +} + +//============================================================================= +// GetMainShape: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::GetMainShape (GEOM::GEOM_Object_ptr theGroup) +{ + MESSAGE("GEOM_Superv_i::GetMainShape"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + return myGroupOp->GetMainShape(theGroup); +} + +//============================================================================= +// GetObjects: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::GetObjects (GEOM::GEOM_Object_ptr theGroup) +{ + MESSAGE("GEOM_Superv_i::GetObjects"); + if (CORBA::is_nil(myGroupOp)) getGroupOp(); + + GEOM::ListOfLong* aList = myGroupOp->GetObjects(theGroup); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aList)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + return aListPtr->_this(); +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + PortableServer::ObjectId * GEOM_SupervEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char * interfaceName) + { + GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName); + myGEOM_Superv_i->register_name("/myGEOM_Superv"); + return myGEOM_Superv_i->getId() ; + } +} diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh new file mode 100644 index 000000000..4abb6e257 --- /dev/null +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -0,0 +1,503 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef __GEOM_SUPERV_I_H__ +#define __GEOM_SUPERV_I_H__ + +// IDL headers +#include +#include CORBA_SERVER_HEADER(GEOM_Superv) + +#include "GEOM_Gen_i.hh" +#include "GEOM_List_i.hh" + +class GEOM_Superv_i : public virtual POA_GEOM::GEOM_Superv, + public Engines_Component_i +{ +public: + GEOM_Superv_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + ~GEOM_Superv_i(); + + // generic method to be put in a super class + void register_name(char * name); + void setGeomEngine(); + + void getBasicOp(); + void get3DPrimOp(); + void getBoolOp(); + void getInsOp(); + void getTransfOp(); + void getShapesOp(); + void getBlocksOp(); + void getCurvesOp(); + void getLocalOp(); + void getGroupOp(); + + PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject, + PortableServer::POA_ptr thePOA); + + //-----------------------------------------------------------------------// + // Set current stydy ID // + //-----------------------------------------------------------------------// + void SetStudyID( CORBA::Long theId ); + + //-----------------------------------------------------------// + // Create ListOfGO and add items to it // + //-----------------------------------------------------------// + GEOM::GEOM_List_ptr CreateListOfGO(); + void AddItemToListOfGO(GEOM::GEOM_List_ptr& theList, + GEOM::GEOM_Object_ptr theObject); + + //-----------------------------------------------------------// + // Create ListOfLong and add items to it // + //-----------------------------------------------------------// + GEOM::GEOM_List_ptr CreateListOfLong(); + void AddItemToListOfLong(GEOM::GEOM_List_ptr& theList, + long theObject); + + //-----------------------------------------------------------// + // Create ListOfDouble and add items to it // + //-----------------------------------------------------------// + GEOM::GEOM_List_ptr CreateListOfDouble(); + void AddItemToListOfDouble(GEOM::GEOM_List_ptr& theList, + double theObject); + + //-----------------------------------------------------------------------// + // Inherited methods from SALOMEDS::Driver // + //-----------------------------------------------------------------------// + + SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + + SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + + CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); + + CORBA::Boolean LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); + + void Close(SALOMEDS::SComponent_ptr theComponent); + char* ComponentDataType(); + + + char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + bool CanPublishInStudy(CORBA::Object_ptr theIOR); + SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) ; + + CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); + SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); + CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); + SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); + + //-----------------------------------------------------------// + // Primitives Construction : BasicOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakePointXYZ (CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ); + GEOM::GEOM_Object_ptr MakePointWithReference (GEOM::GEOM_Object_ptr theReference, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ); + GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr MakeVectorTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakePlanePntVec (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace, + CORBA::Double theTrimSize); + GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ, + CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ, + CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ); + + //-----------------------------------------------------------// + // Primitives Construction : 3DPrimOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeBox (CORBA::Double theX1, + CORBA::Double theY1, + CORBA::Double theZ1, + CORBA::Double theX2, + CORBA::Double theY2, + CORBA::Double theZ2); + GEOM::GEOM_Object_ptr MakeBoxDXDYDZ (CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr MakeBoxTwoPnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + CORBA::Double theHeight); + GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR, + CORBA::Double theH); + GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theRadius); + GEOM::GEOM_Object_ptr MakeSphereR (CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeSpherePntR (GEOM::GEOM_Object_ptr thePnt, + CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeTorusPntVecRR (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, + CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr MakeTorusRR (CORBA::Double theRMajor, + CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr MakeConePntVecR1R2H (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight); + GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1, + CORBA::Double theR2, + CORBA::Double theHeight); + GEOM::GEOM_Object_ptr MakePrismVecH (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); + GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath); + GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theMinDeg, CORBA::Long theMaxDeg, + CORBA::Double theTol2D, CORBA::Double theTol3D, + CORBA::Long theNbIter); + + //-----------------------------------------------------------// + // BooleanOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOperation); + GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2); + GEOM::GEOM_Object_ptr MakePartition (GEOM::GEOM_List_ptr theShapes, + GEOM::GEOM_List_ptr theTools, + GEOM::GEOM_List_ptr theKeepInside, + GEOM::GEOM_List_ptr theRemoveInside, + CORBA::Short theLimit, + CORBA::Boolean theRemoveWebs, + GEOM::GEOM_List_ptr theMaterials); + GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePlane); + + //-----------------------------------------------------------// + // InsertOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeCopy (GEOM::GEOM_Object_ptr theOriginal); + void Export (GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const char* theFormatName); + GEOM::GEOM_Object_ptr Import (const char* theFileName, + const char* theFormatName); + void ImportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns); + void ExportTranslators (GEOM::string_array_out theFormats, + GEOM::string_array_out thePatterns); + + //-----------------------------------------------------------// + // TransformOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr TranslateDXDYDZCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theDX, + CORBA::Double theDY, + CORBA::Double theDZ); + GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector); + GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theStep, + CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr MultiTranslate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theVector1, + CORBA::Double theStep1, + CORBA::Long theNbTimes1, + GEOM::GEOM_Object_ptr theVector2, + CORBA::Double theStep2, + CORBA::Long theNbTimes2); + GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + GEOM::GEOM_Object_ptr RotateCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle, + CORBA::Long theNbTimes1, + CORBA::Double theStep, + CORBA::Long theNbTimes2); + GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePlane); + GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theAxis); + GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset); + GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); + GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr thePoint, + CORBA::Double theFactor); + GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); + GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject, + GEOM::GEOM_Object_ptr theStartLCS, + GEOM::GEOM_Object_ptr theEndLCS); + + //-----------------------------------------------------------// + // ShapesOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires); + GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire, + CORBA::Boolean isPlanarWanted); + GEOM::GEOM_Object_ptr MakeFaceWires (GEOM::GEOM_List_ptr theWires, + CORBA::Boolean isPlanarWanted); + GEOM::GEOM_Object_ptr MakeShell (GEOM::GEOM_List_ptr theFacesAndShells); + GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell); + GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); + GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); + GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, + CORBA::Long theShapeType, + CORBA::Boolean isSorted); + CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape); + CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape); + GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape); + + //-----------------------------------------------------------// + // BlocksOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeQuad4Vertices (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3, + GEOM::GEOM_Object_ptr thePnt4); + GEOM::GEOM_Object_ptr MakeQuad (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2, + GEOM::GEOM_Object_ptr theEdge3, + GEOM::GEOM_Object_ptr theEdge4); + GEOM::GEOM_Object_ptr MakeQuad2Edges (GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2); + GEOM::GEOM_Object_ptr MakeHexa (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2, + GEOM::GEOM_Object_ptr theFace3, + GEOM::GEOM_Object_ptr theFace4, + GEOM::GEOM_Object_ptr theFace5, + GEOM::GEOM_Object_ptr theFace6); + GEOM::GEOM_Object_ptr MakeHexa2Faces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2); + GEOM::GEOM_Object_ptr GetPoint (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theX, + CORBA::Double theY, + CORBA::Double theZ, + CORBA::Double theEpsilon); + GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr GetFaceByPoints (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2, + GEOM::GEOM_Object_ptr thePoint3, + GEOM::GEOM_Object_ptr thePoint4); + GEOM::GEOM_Object_ptr GetFaceByEdges (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2); + GEOM::GEOM_Object_ptr GetOppositeFace (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theFace); + GEOM::GEOM_Object_ptr GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock, + GEOM::GEOM_Object_ptr theVector); + CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces, + CORBA::Long& theNbBlocks); + CORBA::Boolean CheckCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors); + char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound, + const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); + GEOM::GEOM_List_ptr ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound, + CORBA::Long theMinNbFaces, + CORBA::Long theMaxNbFaces); + GEOM::GEOM_Object_ptr GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_Object_ptr thePoint); + GEOM::GEOM_Object_ptr GetBlockByParts (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_List_ptr theParts); + GEOM::GEOM_List_ptr GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound, + GEOM::GEOM_List_ptr theParts); + GEOM::GEOM_Object_ptr MakeMultiTransformation1D (GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1, + CORBA::Long theDirFace2, + CORBA::Long theNbTimes); + GEOM::GEOM_Object_ptr MakeMultiTransformation2D (GEOM::GEOM_Object_ptr theBlock, + CORBA::Long theDirFace1U, + CORBA::Long theDirFace2U, + CORBA::Long theNbTimesU, + CORBA::Long theDirFace1V, + CORBA::Long theDirFace2V, + CORBA::Long theNbTimesV); + + //-----------------------------------------------------------// + // CurvesOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints); + GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints); + GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints); + GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, + GEOM::GEOM_List_ptr theWorkingPlane); + + //-----------------------------------------------------------// + // LocalOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr MakeFilletAll (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + GEOM::GEOM_List_ptr theEdges); + GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, + GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); + GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + CORBA::Long theFace1, CORBA::Long theFace2); + GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theWeight, + CORBA::Double theWaterDensity, + CORBA::Double theMeshingDeflection); + CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theShape, + GEOM::GEOM_Object_ptr theSubShape); + + //-----------------------------------------------------------// + // GroupOperations // + //-----------------------------------------------------------// + GEOM::GEOM_Object_ptr CreateGroup (GEOM::GEOM_Object_ptr theMainShape, + CORBA::Long theShapeType); + void AddObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId); + void RemoveObject (GEOM::GEOM_Object_ptr theGroup, + CORBA::Long theSubShapeId); + CORBA::Long GetType (GEOM::GEOM_Object_ptr theGroup); + GEOM::GEOM_Object_ptr GetMainShape (GEOM::GEOM_Object_ptr theGroup); + GEOM::GEOM_List_ptr GetObjects (GEOM::GEOM_Object_ptr theGroup); + +private: + SALOME_NamingService * name_service; + GEOM::GEOM_Gen_ptr myGeomEngine; + CORBA::Long myStudyID; + PortableServer::POA_var myPOA; + + GEOM::GEOM_IBasicOperations_ptr myBasicOp; + GEOM::GEOM_I3DPrimOperations_ptr my3DPrimOp; + GEOM::GEOM_IBooleanOperations_ptr myBoolOp; + GEOM::GEOM_IInsertOperations_ptr myInsOp; + GEOM::GEOM_ITransformOperations_ptr myTransfOp; + GEOM::GEOM_IShapesOperations_ptr myShapesOp; + GEOM::GEOM_IBlocksOperations_ptr myBlocksOp; + GEOM::GEOM_ICurvesOperations_ptr myCurvesOp; + GEOM::GEOM_ILocalOperations_ptr myLocalOp; + GEOM::GEOM_IGroupOperations_ptr myGroupOp; + +}; + +#endif diff --git a/src/GEOM_SWIG/GEOM_Nut.py b/src/GEOM_SWIG/GEOM_Nut.py new file mode 100755 index 000000000..c3d2db429 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_Nut.py @@ -0,0 +1,68 @@ +##################################################################### +#Created :17/02/2005 +#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey +##################################################################### + +import geompy +import salome +import os +import math + +#Sketcher_1 creation +Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") +geompy.addToStudy(Sketcher_1, "Sketcher_1") +Face_1 = geompy.MakeFace(Sketcher_1, 1) +geompy.addToStudy(Face_1, "Face_1") + +#Line creation +Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100)) +geompy.addToStudy(Line_1, "Line_1") + +#Prism creation +Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100) +geompy.addToStudy(Prism_1, "Prism_1") + +#Sketcher_2 creation +Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) +geompy.addToStudy(Sketcher_2, "Sketcher_2") +Face_2 = geompy.MakeFace(Sketcher_2, 1) +geompy.addToStudy(Face_2, "Face_2") + +#Revolution creation +Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi) +geompy.addToStudy(Revolution_1, "Revolution_1") + +#Common applying +Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1) +geompy.addToStudy(Common_1, "Common_1") + +#Explode Common_1 on edges +CommonExplodedListEdges = geompy.SubShapeAll(Common_1, geompy.ShapeType["EDGE"]) +for i in range(0, len(CommonExplodedListEdges)): + name = "Edge_"+str(i+1) + geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name) + +#Fillet applying +#ID = geompy.GetSubShapeID(Common_1, CommonExplodedListEdges[0]) +Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [6]) +geompy.addToStudy(Fillet_1, "Fillet_1") + +#Chamfer applying +Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, 16, 50 ) +geompy.addToStudy(Chamfer_1, "Chamfer_1") + +Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, 21, 31 ) +geompy.addToStudy(Chamfer_2, "Chamfer_2") + +#Import of the shape from "slots.brep" +thePath = os.getenv("DATA_DIR") +theFileName = thePath + "/Shapes/Brep/slots.brep" +theShapeForCut = geompy.ImportBREP(theFileName) +geompy.addToStudy(theShapeForCut, "slot.brep_1") + +#Cut applying +Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2) +geompy.addToStudy(Cut_1, "Cut_1") + +salome.sg.updateObjBrowser(1) + diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py new file mode 100644 index 000000000..4389fbd14 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -0,0 +1,451 @@ +# GEOM GEOM_SWIG : binding of C++ implementaion with Python +# +# Copyright (C) 2003 CEA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +# +# +# File : GEOM_TestOthers.py +# Author : Julia DOROVSKIKH +# Module : GEOM +# $Header$ + +import os + +def TestExportImport (geompy, shape): + + print "Test Export/Import ...", + + # Files for Export/Import testing + fileExportImport = "/tmp/testExportImport.brep" + fileExportImportBREP = "/tmp/testExportImportBREP.brep" + fileExportImportIGES = "/tmp/testExportImportIGES.iges" + fileExportImportSTEP = "/tmp/testExportImportSTEP.step" + + if os.access(fileExportImport, os.F_OK): + if os.access(fileExportImport, os.W_OK): + os.remove(fileExportImport) + else: + fileExportImport = "/tmp/testExportImport1.brep" + + if os.access(fileExportImportBREP, os.W_OK): + os.remove(fileExportImportBREP) + else: + fileExportImportBREP = "/tmp/testExportImportBREP1.brep" + + if os.access(fileExportImportIGES, os.W_OK): + os.remove(fileExportImportIGES) + else: + fileExportImportIGES = "/tmp/testExportImportIGES1.iges" + + if os.access(fileExportImportSTEP, os.W_OK): + os.remove(fileExportImportSTEP) + else: + fileExportImportSTEP = "/tmp/testExportImportSTEP1.step" + + # Export + geompy.Export(shape, fileExportImport, "BREP") + + # ExportBREP, ExportIGES, ExportSTEP + geompy.ExportBREP(shape, fileExportImportBREP) + geompy.ExportIGES(shape, fileExportImportIGES) + geompy.ExportSTEP(shape, fileExportImportSTEP) + + # Import + Import = geompy.Import(fileExportImport, "BREP") + + id_Import = geompy.addToStudy(Import, "Import") + + # ImportBREP, ImportIGES, ImportSTEP + ImportBREP = geompy.ImportBREP(fileExportImportBREP) + ImportIGES = geompy.ImportIGES(fileExportImportIGES) + ImportSTEP = geompy.ImportSTEP(fileExportImportSTEP) + + id_ImportBREP = geompy.addToStudy(ImportBREP, "ImportBREP") + id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES") + id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP") + + # Remove files for Export/Import testing + os.remove(fileExportImport) + os.remove(fileExportImportBREP) + os.remove(fileExportImportIGES) + os.remove(fileExportImportSTEP) + + print "OK" + + +def TestOtherOperations (geompy, math): + + # MakeFaces + p11 = geompy.MakeVertex( 0, 0, 0) + p12 = geompy.MakeVertex(30, 0, 0) + p13 = geompy.MakeVertex(30, 30, 0) + p14 = geompy.MakeVertex( 0, 30, 0) + + p21 = geompy.MakeVertex(10, 10, 0) + p22 = geompy.MakeVertex(20, 10, 0) + p23 = geompy.MakeVertex(20, 20, 0) + p24 = geompy.MakeVertex(10, 20, 0) + + e11 = geompy.MakeEdge(p11, p12) + e12 = geompy.MakeEdge(p12, p13) + e13 = geompy.MakeEdge(p13, p14) + e14 = geompy.MakeEdge(p14, p11) + + e21 = geompy.MakeEdge(p21, p22) + e22 = geompy.MakeEdge(p22, p23) + e23 = geompy.MakeEdge(p23, p24) + e24 = geompy.MakeEdge(p24, p21) + + w1 = geompy.MakeWire([e11, e12, e13, e14]) + w2 = geompy.MakeWire([e21, e22, e23, e24]) + w3 = geompy.MakeTranslation(w2, 0, 0, 10) + + id_w1 = geompy.addToStudy(w1, "Outside Wire") + id_w2 = geompy.addToStudy(w2, "Inside Wire") + id_w3 = geompy.addToStudy(w3, "Inside Wire, translated along OZ") + + f12 = geompy.MakeFaces([w1, w2], 0) + id_f12 = geompy.addToStudy(f12, "MakeFaces WO + WI") + + # Export/Import + TestExportImport(geompy, f12) + + # OrientationChange + Box = geompy.MakeBoxDXDYDZ(200, 200, 200) + Orientation = geompy.OrientationChange(Box) + id_Orientation = geompy.addToStudy(Orientation, "OrientationChange") + + # MakeCommon, MakeCut, MakeFuse, MakeSection + Sphere = geompy.MakeSphereR(100) + + Common = geompy.MakeCommon (Box, Sphere) + Cut = geompy.MakeCut (Box, Sphere) + Fuse = geompy.MakeFuse (Box, Sphere) + Section = geompy.MakeSection(Box, Sphere) + + id_Common = geompy.addToStudy(Common, "Common") + id_Cut = geompy.addToStudy(Cut, "Cut") + id_Fuse = geompy.addToStudy(Fuse, "Fuse") + id_Section = geompy.addToStudy(Section, "Section") + + # Partition + p100 = geompy.MakeVertex(100, 100, 100) + p300 = geompy.MakeVertex(300, 300, 300) + Box1 = geompy.MakeBoxTwoPnt(p100, p300) + Partition = geompy.Partition([Box], [Box1], [], [Box]) + id_Partition = geompy.addToStudy(Partition, "Partition of Box by Box1") + + # MakeMultiRotation1D, MakeMultiRotation2D + pz = geompy.MakeVertex(0, 0, 100) + vy = geompy.MakeVectorDXDYDZ(0, 100, 0) + + MultiRot1D = geompy.MakeMultiRotation1D(f12, vy, pz, 6) + MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3) + + id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MakeMultiRotation1D") + id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MakeMultiRotation2D") + + # MakeFilletAll + radius_fillet = 10. + face5 = geompy.SubShapeSorted(Box, geompy.ShapeType["FACE"], [5]) + f_glob_id = geompy.GetSubShapeID(Box, face5) + SuppFace = geompy.SuppressFaces(Box, [f_glob_id]) + + MakeFilletAll = geompy.MakeFilletAll(SuppFace, radius_fillet) + id_MakeFilletAll = geompy.addToStudy(MakeFilletAll, "MakeFilletAll") + + # MakeChamferAll + dimension_chamfer = 10. + MakeChamferAll = geompy.MakeChamferAll(SuppFace, dimension_chamfer) + id_MakeChamferAll = geompy.addToStudy(MakeChamferAll, "MakeChamferAll") + + # MakeChamfer + d1 = 13. + d2 = 7. + box_faces = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) + f_ind_1 = geompy.GetSubShapeID(Box, box_faces[0]) + f_ind_2 = geompy.GetSubShapeID(Box, box_faces[1]) + f_ind_3 = geompy.GetSubShapeID(Box, box_faces[2]) + + MakeChamfer = geompy.MakeChamfer(Box, d1, d2, geompy.ShapeType["FACE"], + [f_ind_1, f_ind_2, f_ind_3]) + id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer") + + # NumberOfFaces + NumberOfFaces = geompy.NumberOfFaces(Box) + if NumberOfFaces != 6: + print "Bad number of faces in BOX!" + + # NumberOfEdges + NumberOfEdges = geompy.NumberOfEdges(Box) + if NumberOfEdges != 12: + print "Bad number of edges in BOX!" + + # MakeBlockExplode + Compound = geompy.MakeCompound([Box, Sphere]) + MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6) + + id_MakeBlockExplode = geompy.addToStudy(MakeBlockExplode[0], "MakeBlockExplode") + + # CheckCompoundOfBlocks + p1 = geompy.MakeVertex(200, 0, 0) + p2 = geompy.MakeVertex(400, 200, 200) + p3 = geompy.MakeVertex(400, 50, 50) + p4 = geompy.MakeVertex(600, 250, 250) + + Box2 = geompy.MakeBoxTwoPnt(p1, p2) + Box3 = geompy.MakeBoxTwoPnt(p3, p4) + Cyl = geompy.MakeCylinderRH(50, 300) + Cone = geompy.MakeConeR1R2H(150, 10, 400) + + Compound1 = geompy.MakeCompound([Box, Cyl, Cone, Box3, Box2]) + + IsValid = geompy.CheckCompoundOfBlocks(Compound1) + if IsValid == 0: + print "The Blocks Compound is NOT VALID" + else: + print "The Blocks Compound is VALID" + + IsValid = geompy.CheckCompoundOfBlocks(Box) + if IsValid == 0: + print "The Box is NOT VALID" + else: + print "The Box is VALID" + + # test geometrical groups + + # CreateGroup + CreateGroup = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) + + id_CreateGroup = geompy.addToStudy(CreateGroup, "CreateGroup") + + # AddObject + f_ind_4 = geompy.GetSubShapeID(Box, box_faces[3]) + f_ind_5 = geompy.GetSubShapeID(Box, box_faces[4]) + f_ind_6 = geompy.GetSubShapeID(Box, box_faces[5]) + + geompy.AddObject(CreateGroup, f_ind_6) # box_faces[5] + geompy.AddObject(CreateGroup, f_ind_1) # box_faces[0] + geompy.AddObject(CreateGroup, f_ind_4) # box_faces[3] + + # UnionList + geompy.UnionList(CreateGroup, [box_faces[2], box_faces[4], box_faces[5]]) + + # RemoveObject(theGroup, theSubShapeID) + geompy.RemoveObject(CreateGroup, f_ind_1) # box_faces[0] + + # DifferenceList + geompy.DifferenceList(CreateGroup, [box_faces[1], box_faces[0], box_faces[3]]) + + # GetObjectIDs + GetObjectIDs = geompy.GetObjectIDs(CreateGroup) + + print "Group of Box's faces includes the following IDs:" + print "(must be ", f_ind_6, ", ", f_ind_3, " and ", f_ind_5, ")" + for ObjectID in GetObjectIDs: + print " ", ObjectID + + BoxCopy = geompy.GetMainShape(CreateGroup) + + # ----------------------------------------------------------------------------- + # enumeration ShapeTypeString as a dictionary + # ----------------------------------------------------------------------------- + ShapeTypeString = {'0':"COMPOUND", '1':"COMPSOLID", '2':"SOLID", '3':"SHELL", '4':"FACE", '5':"WIRE", '6':"EDGE", '7':"VERTEX", '8':"SHAPE"} + + GroupType = geompy.GetType(CreateGroup) + print "Type of elements of the created group is ", ShapeTypeString[`GroupType`] + + # Prepare data for the following operations + p0 = geompy.MakeVertex(0, 0, 0) + b0 = geompy.MakeBox(-50, -50, -50, 50, 50, 50) + s0 = geompy.MakeSphereR(100) + + id_b0 = geompy.addToStudy(b0, "b0") + id_s0 = geompy.addToStudy(s0, "s0") + + v_0pp = geompy.MakeVectorDXDYDZ( 0, 1, 1) + v_0np = geompy.MakeVectorDXDYDZ( 0, -1, 1) + v_p0p = geompy.MakeVectorDXDYDZ( 1, 0, 1) + v_n0p = geompy.MakeVectorDXDYDZ(-1, 0, 1) + v_pp0 = geompy.MakeVectorDXDYDZ( 1, 1, 0) + v_np0 = geompy.MakeVectorDXDYDZ(-1, 1, 0) + + pln_0pp = geompy.MakePlane(p0, v_0pp, 300) + pln_0np = geompy.MakePlane(p0, v_0np, 300) + pln_p0p = geompy.MakePlane(p0, v_p0p, 300) + pln_n0p = geompy.MakePlane(p0, v_n0p, 300) + pln_pp0 = geompy.MakePlane(p0, v_pp0, 300) + pln_np0 = geompy.MakePlane(p0, v_np0, 300) + + part_tool_1 = geompy.MakePartition([b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0], + [], + [], + [b0]) + + pt_pnt_1 = geompy.MakeVertex( 55, 0, 55) + pt_pnt_2 = geompy.MakeVertex( 0, 55, 55) + pt_pnt_3 = geompy.MakeVertex(-55, 0, 55) + pt_pnt_4 = geompy.MakeVertex( 0, -55, 55) + pt_pnt_5 = geompy.MakeVertex( 55, 55, 0) + pt_pnt_6 = geompy.MakeVertex( 55, -55, 0) + pt_pnt_7 = geompy.MakeVertex(-55, 55, 0) + pt_pnt_8 = geompy.MakeVertex(-55, -55, 0) + pt_pnt_9 = geompy.MakeVertex( 55, 0, -55) + pt_pnt_10 = geompy.MakeVertex( 0, 55, -55) + pt_pnt_11 = geompy.MakeVertex(-55, 0, -55) + pt_pnt_12 = geompy.MakeVertex( 0, -55, -55) + + pt_face_1 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_1) + pt_face_2 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_2) + pt_face_3 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_3) + pt_face_4 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_4) + pt_face_5 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_5) + pt_face_6 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_6) + pt_face_7 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_7) + pt_face_8 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_8) + pt_face_9 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_9) + pt_face_10 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_10) + pt_face_11 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_11) + pt_face_12 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_12) + + pt_box = geompy.GetBlockNearPoint(part_tool_1, p0) + + part_tool = geompy.MakeCompound([pt_face_1, pt_face_4, pt_face_7, pt_face_10, + pt_face_2, pt_face_5, pt_face_8, pt_face_11, + pt_face_3, pt_face_6, pt_face_9, pt_face_12, pt_box]) + id_part_tool = geompy.addToStudy(part_tool, "part_tool") + + part = geompy.MakePartition([s0], [part_tool]) + geompy.addToStudy(part, "part") + + # GetFreeFacesIDs + anIDs = geompy.GetFreeFacesIDs(part) + freeFaces = geompy.GetSubShape(part, anIDs) + + geompy.addToStudy(freeFaces, "freeFaces") + + # RemoveExtraEdges + freeFacesWithoutExtra = geompy.RemoveExtraEdges(freeFaces) + + geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra") + + # GetSharedShapes + sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra, geompy.ShapeType["FACE"]) + + for shFace in sharedFaces: + geompy.addToStudy(shFace, "sharedFace") + + # CheckAndImprove + blocksComp = geompy.CheckAndImprove(part) + + geompy.addToStudy(blocksComp, "blocksComp") + + # Propagate + listChains = geompy.Propagate(blocksComp) + + for chain in listChains: + geompy.addToStudyInFather(blocksComp, chain, "propagation chain") + + # GetPoint(theShape, theX, theY, theZ, theEpsilon) + # + # (-50, 50, 50) .-----. (50, 50, 50) + # pb0_top_1 | | + # | . pmidle + # | | + # (-50, -50, 50) '-----' (50, -50, 50) + # + pb0_top_1 = geompy.GetPoint(blocksComp, -50, 50, 50, 0.01) + pb0_bot_1 = geompy.GetPoint(blocksComp, -50, -50, -50, 0.01) + + geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)") + geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)") + + # GetEdgeNearPoint(theShape, thePoint) + pmidle = geompy.MakeVertex(50, 0, 50) + edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle) + + geompy.addToStudyInFather(blocksComp, edge1, "edge near point (50, 0, 50)") + + # GetBlockByParts(theCompound, theParts) + b0_image = geompy.GetBlockByParts(blocksComp, [pb0_top_1, pb0_bot_1, edge1]) + + geompy.addToStudyInFather(blocksComp, b0_image, "b0 image") + + # GetShapesOnPlane + faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"], + v_0pp, geompy.GEOM.ST_ONIN) + for face_i in faces_on_pln: + geompy.addToStudy(face_i, "Face on Plane (N = (0, 1, 1)) or below it") + + # GetShapesOnCylinder + edges_on_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"], + vy, 55, geompy.GEOM.ST_OUT) + for edge_i in edges_on_cyl: + geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), r = 55)") + + # GetShapesOnSphere + vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"], + p0, 100, geompy.GEOM.ST_ON) + for vertex_i in vertices_on_sph: + geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)") + pass + + # GetShapesOnQuadrangle + + geompy.addToStudy(f12, "F12" ) + + bl = geompy.MakeVertex(10,-10, 0) + br = geompy.MakeVertex(40,-10, 0) + tr = geompy.MakeVertex(40, 20, 0) + tl = geompy.MakeVertex(10, 20, 0) + qe1 = geompy.MakeEdge(bl, br) + qe2 = geompy.MakeEdge(br, tr) + qe3 = geompy.MakeEdge(tr, tl) + qe4 = geompy.MakeEdge(tl, bl) + quadrangle = geompy.MakeWire([qe1, qe2, qe3, qe4]) + geompy.addToStudy(quadrangle, "Quadrangle") + + edges_onin_quad = geompy.GetShapesOnQuadrangle( f12, geompy.ShapeType["EDGE"], + tl, tr, bl, br, geompy.GEOM.ST_ONIN) + comp = geompy.MakeCompound(edges_onin_quad) + geompy.addToStudy(comp, "Edges of F12 ONIN Quadrangle") + if len( edges_onin_quad ) != 4: + print "Error in GetShapesOnQuadrangle()" + pass + + # GetInPlace(theShapeWhere, theShapeWhat) + box5 = geompy.MakeBoxDXDYDZ(100, 100, 100) + box6 = geompy.MakeTranslation(box5, 50, 50, 0) + + part = geompy.MakePartition([box5], [box6]) + geompy.addToStudy(part, "Partitioned") + + ibb = 5 + box_list = [box5, box6] + for abox in box_list: + geompy.addToStudy(abox, "Box " + `ibb`) + box_faces = geompy.SubShapeAll(abox, geompy.ShapeType["FACE"]) + ifa = 1 + for aface in box_faces: + geompy.addToStudyInFather(abox, aface, "Face" + `ifa`) + refl_box_face = geompy.GetInPlace(part, aface) + if refl_box_face is not None: + geompy.addToStudyInFather(part, refl_box_face, + "Reflection of Face " + `ifa` + " of box " + `ibb`) + ifa = ifa + 1 + ibb = ibb + 1 diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py new file mode 100644 index 000000000..aa90a337f --- /dev/null +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -0,0 +1,1203 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : geompy.py +# Author : Paul RASCLE, EDF +# Module : GEOM +# $Header$ + +from batchmode_salome import * +import GEOM + +g=None +step = 0 +while step < 50 and g == None: + g = lcc.FindOrLoadComponent("FactoryServer", "GEOM") + step = step + 1 + time.sleep(4) +geom = g._narrow( GEOM.GEOM_Gen ) + +myBuilder = None +myStudyId = 0 +father = None + +BasicOp = None +CurvesOp = None +PrimOp = None +ShapesOp = None +HealOp = None +InsertOp = None +BoolOp = None +TrsfOp = None +LocalOp = None +MeasuOp = None +BlocksOp = None +GroupOp = None + +def init_geom(theStudy): + + global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp + global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp, father + + myStudy = theStudy + myStudyId = myStudy._get_StudyId() + myBuilder = myStudy.NewBuilder() + father = myStudy.FindComponent("GEOM") + if father is None: + father = myBuilder.NewComponent("GEOM") + A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName") + FName = A1._narrow(SALOMEDS.AttributeName) + FName.SetValue("Geometry") + A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap") + aPixmap = A2._narrow(SALOMEDS.AttributePixMap) + aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry") + myBuilder.DefineComponentInstance(father,geom) + pass + + # ----------------------------------------------------------------------------- + # Assign Operations Interfaces + # ----------------------------------------------------------------------------- + + BasicOp = geom.GetIBasicOperations (myStudyId) + CurvesOp = geom.GetICurvesOperations (myStudyId) + PrimOp = geom.GetI3DPrimOperations (myStudyId) + ShapesOp = geom.GetIShapesOperations (myStudyId) + HealOp = geom.GetIHealingOperations (myStudyId) + InsertOp = geom.GetIInsertOperations (myStudyId) + BoolOp = geom.GetIBooleanOperations (myStudyId) + TrsfOp = geom.GetITransformOperations(myStudyId) + LocalOp = geom.GetILocalOperations (myStudyId) + MeasuOp = geom.GetIMeasureOperations (myStudyId) + BlocksOp = geom.GetIBlocksOperations (myStudyId) + GroupOp = geom.GetIGroupOperations (myStudyId) + pass + +init_geom(myStudy) + +# * Get name for sub-shape aSubObj of shape aMainObj +# +def SubShapeName(aSubObj, aMainObj): + name = "SubShape" + print name + return name + +# * Publish in study aShape with name aName +# +def addToStudy(aShape, aName): + try: + aSObject = geom.AddInStudy(myStudy, aShape, aName, None) + except: + print "addToStudy() failed" + return "" + return aShape.GetStudyEntry() + +# * Publish in study aShape with name aName as sub-object of previously published aFather +# +def addToStudyInFather(aFather, aShape, aName): + try: + aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather) + except: + print "addToStudyInFather() failed" + return "" + return aShape.GetStudyEntry() + +# ----------------------------------------------------------------------------- +# enumeration ShapeType as a dictionary +# ----------------------------------------------------------------------------- + +ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} + +# ----------------------------------------------------------------------------- +# Basic primitives +# ----------------------------------------------------------------------------- + +def MakeVertex(theX, theY, theZ): + anObj = BasicOp.MakePointXYZ(theX, theY, theZ) + if BasicOp.IsDone() == 0: + print "MakePointXYZ : ", BasicOp.GetErrorCode() + return anObj + +def MakeVertexWithRef(vertex,x,y,z): + anObj = BasicOp.MakePointWithReference(vertex,x,y,z) + if BasicOp.IsDone() == 0: + print "MakePointWithReference : ", BasicOp.GetErrorCode() + return anObj + +def MakeVertexOnCurve(curve,par): + anObj = BasicOp.MakePointOnCurve(curve,par) + if BasicOp.IsDone() == 0: + print "MakePointOnCurve : ", BasicOp.GetErrorCode() + return anObj + +def MakeVectorDXDYDZ(dx,dy,dz): + anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz) + if BasicOp.IsDone() == 0: + print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode() + return anObj + +def MakeVector(p1,p2): + anObj = BasicOp.MakeVectorTwoPnt(p1, p2) + if BasicOp.IsDone() == 0: + print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode() + return anObj + +def MakeLine(p1, d1): + anObj = BasicOp.MakeLine(p1,d1) + if BasicOp.IsDone() == 0: + print "MakeLine : ", BasicOp.GetErrorCode() + return anObj + +def MakeLineTwoPnt(p1, p2): + anObj = BasicOp.MakeLineTwoPnt(p1,p2) + if BasicOp.IsDone() == 0: + print "MakeLineTwoPnt : ", BasicOp.GetErrorCode() + return anObj + +def MakePlane(p1,v1,trimsize): + anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize) + if BasicOp.IsDone() == 0: + print "MakePlanePntVec : ", BasicOp.GetErrorCode() + return anObj + +def MakePlaneThreePnt(p1,p2,p3,trimsize): + anObj = BasicOp.MakePlaneThreePnt(p1,p2,p3,trimsize) + if BasicOp.IsDone() == 0: + print "MakePlaneThreePnt : ", BasicOp.GetErrorCode() + return anObj + +def MakePlaneFace(face,trimsize): + anObj = BasicOp.MakePlaneFace(face,trimsize) + if BasicOp.IsDone() == 0: + print "MakePlaneFace : ", BasicOp.GetErrorCode() + return anObj + +def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ): + anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ) + if BasicOp.IsDone() == 0: + print "MakeMarker : ", BasicOp.GetErrorCode() + return anObj + +def MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec): + """ + * Create a local coordinate system. + * \param theOrigin Point of coordinate system origin. + * \param theXVec Vector of X direction + * \param theYVec Vector of Y direction + * \return New GEOM_Object, containing the created coordinate system. + """ + O = PointCoordinates( theOrigin ) + OXOY = [] + for vec in [ theXVec, theYVec ]: + v1, v2 = SubShapeAll( vec, ShapeType["VERTEX"] ) + p1 = PointCoordinates( v1 ) + p2 = PointCoordinates( v2 ) + for i in range( 0, 3 ): + OXOY.append( p2[i] - p1[i] ) + # + anObj = BasicOp.MakeMarker( O[0], O[1], O[2], + OXOY[0], OXOY[1], OXOY[2], + OXOY[3], OXOY[4], OXOY[5], ) + if BasicOp.IsDone() == 0: + print "MakeMarker : ", BasicOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Curves +# ----------------------------------------------------------------------------- + +def MakeArc(p1,p2,p3): + anObj = CurvesOp.MakeArc(p1,p2,p3) + if CurvesOp.IsDone() == 0: + print "MakeArc : ", CurvesOp.GetErrorCode() + return anObj + +def MakeCircle(p1,v1,radius): + anObj = CurvesOp.MakeCirclePntVecR(p1,v1,radius) + if CurvesOp.IsDone() == 0: + print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode() + return anObj + +def MakeCircleThreePnt(p1,p2,p3): + anObj = CurvesOp.MakeCircleThreePnt(p1,p2,p3) + if CurvesOp.IsDone() == 0: + print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode() + return anObj + +def MakeEllipse(p1,v1,radiusMaj,radiusMin): + anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin) + if CurvesOp.IsDone() == 0: + print "MakeEllipse : ", CurvesOp.GetErrorCode() + return anObj + +def MakePolyline(ListShape): + anObj = CurvesOp.MakePolyline(ListShape) + if CurvesOp.IsDone() == 0: + print "MakePolyline : ", CurvesOp.GetErrorCode() + return anObj + +def MakeBezier(ListShape): + anObj = CurvesOp.MakeSplineBezier(ListShape) + if CurvesOp.IsDone() == 0: + print "MakeSplineBezier : ", CurvesOp.GetErrorCode() + return anObj + +def MakeInterpol(ListShape): + anObj = CurvesOp.MakeSplineInterpolation(ListShape) + if CurvesOp.IsDone() == 0: + print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode() + return anObj + +# : Nine double values, defining origin, +# OZ and OX directions of the working plane. +def MakeSketcher(Cmd, WPL = [0,0,0, 0,0,1, 1,0,0]): + anObj = CurvesOp.MakeSketcher(Cmd, WPL) + if CurvesOp.IsDone() == 0: + print "MakeSketcher : ", CurvesOp.GetErrorCode() + return anObj + +def MakeSketcherOnPlane(theCommand, theWorkingPlane): + """ + * Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. \n + * For format of the description string see the previous method.\n + * \param theCommand String, defining the sketcher in local + * coordinates of the working plane. + * \param theWorkingPlane Planar Face of the working plane. + * \return New GEOM_Object, containing the created wire. + """ + anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane) + if CurvesOp.IsDone() == 0: + print "MakeSketcher : ", CurvesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create 3D Primitives +# ----------------------------------------------------------------------------- + +def MakeBox(x1,y1,z1,x2,y2,z2): + pnt1 = MakeVertex(x1,y1,z1) + pnt2 = MakeVertex(x2,y2,z2) + return MakeBoxTwoPnt(pnt1,pnt2) + +def MakeBoxDXDYDZ(dx,dy,dz): + anObj = PrimOp.MakeBoxDXDYDZ(dx,dy,dz) + if PrimOp.IsDone() == 0: + print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode() + return anObj + +def MakeBoxTwoPnt(point1, point2): + anObj = PrimOp.MakeBoxTwoPnt(point1, point2) + if PrimOp.IsDone() == 0: + print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode() + return anObj + +def MakeCylinder(p1,v1,radius,height): + anObj = PrimOp.MakeCylinderPntVecRH(p1,v1,radius,height) + if PrimOp.IsDone() == 0: + print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode() + return anObj + +def MakeCylinderRH(radius,height): + anObj = PrimOp.MakeCylinderRH(radius,height) + if PrimOp.IsDone() == 0: + print "MakeCylinderRH : ", PrimOp.GetErrorCode() + return anObj + +def MakeSpherePntR(point,radius): + anObj = PrimOp.MakeSpherePntR(point,radius) + if PrimOp.IsDone() == 0: + print "MakeSpherePntR : ", PrimOp.GetErrorCode() + return anObj + +def MakeSphere(x,y,z,radius): + point = MakeVertex(x,y,z) + anObj = MakeSpherePntR(point,radius) + return anObj + +def MakeSphereR(radius): + anObj = PrimOp.MakeSphereR(radius) + if PrimOp.IsDone() == 0: + print "MakeSphereR : ", PrimOp.GetErrorCode() + return anObj + +def MakeCone(p1,v1,radius1,radius2,height): + anObj = PrimOp.MakeConePntVecR1R2H(p1,v1,radius1,radius2,height) + if PrimOp.IsDone() == 0: + print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode() + return anObj + +def MakeConeR1R2H(radius1,radius2,height): + anObj = PrimOp.MakeConeR1R2H(radius1,radius2,height) + if PrimOp.IsDone() == 0: + print "MakeConeR1R2H : ", PrimOp.GetErrorCode() + return anObj + +def MakeTorus(p1,v1,major_radius,minor_radius): + anObj = PrimOp.MakeTorusPntVecRR(p1,v1,major_radius,minor_radius) + if PrimOp.IsDone() == 0: + print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode() + return anObj + +def MakeTorusRR(major_radius,minor_radius): + anObj = PrimOp.MakeTorusRR(major_radius,minor_radius) + if PrimOp.IsDone() == 0: + print "MakeTorusRR : ", PrimOp.GetErrorCode() + return anObj + +def MakePrism(baseShape,point1,point2): + anObj = PrimOp.MakePrismTwoPnt(baseShape,point1,point2) + if PrimOp.IsDone() == 0: + print "MakePrismTwoPnt : ", PrimOp.GetErrorCode() + return anObj + +def MakePrismVecH(baseShape,vector,height): + anObj = PrimOp.MakePrismVecH(baseShape,vector,height) + if PrimOp.IsDone() == 0: + print "MakePrismVecH : ", PrimOp.GetErrorCode() + return anObj + +def MakePipe(baseShape,pathShape): + anObj = PrimOp.MakePipe(baseShape,pathShape) + if PrimOp.IsDone() == 0: + print "MakePipe : ", PrimOp.GetErrorCode() + return anObj + +def MakeRevolution(aShape,axis,angle): + anObj = PrimOp.MakeRevolutionAxisAngle(aShape,axis,angle) + if PrimOp.IsDone() == 0: + print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create base shapes +# ----------------------------------------------------------------------------- + +def MakeEdge(p1,p2): + anObj = ShapesOp.MakeEdge(p1,p2) + if ShapesOp.IsDone() == 0: + print "MakeEdge : ", ShapesOp.GetErrorCode() + return anObj + +def MakeWire(ListShape): + anObj = ShapesOp.MakeWire(ListShape) + if ShapesOp.IsDone() == 0: + print "MakeWire : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFace(aShapeWire,WantPlanarFace): + anObj = ShapesOp.MakeFace(aShapeWire,WantPlanarFace) + if ShapesOp.IsDone() == 0: + print "MakeFace : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFaceWires(ListWires,WantPlanarFace): + anObj = ShapesOp.MakeFaceWires(ListWires,WantPlanarFace) + if ShapesOp.IsDone() == 0: + print "MakeFaceWires : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFaces(ListWires,WantPlanarFace): + anObj = MakeFaceWires(ListWires,WantPlanarFace) + return anObj + +def MakeShell(ListOfShapes): + anObj = ShapesOp.MakeShell(ListOfShapes) + if ShapesOp.IsDone() == 0: + print "MakeShell : ", ShapesOp.GetErrorCode() + return anObj + +def MakeSolid(ListOfShells): + anObj = ShapesOp.MakeSolidShells(ListOfShells) + if ShapesOp.IsDone() == 0: + print "MakeSolid : ", ShapesOp.GetErrorCode() + return anObj + +def MakeCompound(ListShape): + anObj = ShapesOp.MakeCompound(ListShape) + if ShapesOp.IsDone() == 0: + print "MakeCompound : ", ShapesOp.GetErrorCode() + return anObj + +def NumberOfFaces(theShape): + nb_faces = ShapesOp.NumberOfFaces(theShape) + if ShapesOp.IsDone() == 0: + print "NumberOfFaces : ", ShapesOp.GetErrorCode() + return nb_faces + +def NumberOfEdges(theShape): + nb_edges = ShapesOp.NumberOfEdges(theShape) + if ShapesOp.IsDone() == 0: + print "NumberOfEdges : ", ShapesOp.GetErrorCode() + return nb_edges + +def ChangeOrientation(Shape): + anObj = ShapesOp.ChangeOrientation(Shape) + if ShapesOp.IsDone() == 0: + print "ChangeOrientation : ", ShapesOp.GetErrorCode() + return anObj + +def OrientationChange(Shape): + anObj = ChangeOrientation(Shape) + return anObj + +def GetFreeFacesIDs(theShape): + anIDs = ShapesOp.GetFreeFacesIDs(theShape) + if ShapesOp.IsDone() == 0: + print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode() + return anIDs + +def GetSharedShapes(theShape1, theShape2, theShapeType): + aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType) + if ShapesOp.IsDone() == 0: + print "GetSharedShapes : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnPlane(theShape, theShapeType, theAx1, theState): + aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnPlane : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState): + aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnPlaneIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState): + aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState): + aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnCylinderIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState): + aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnSphere : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState): + aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetInPlace(theShapeWhere, theShapeWhat): + anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat) + if ShapesOp.IsDone() == 0: + print "GetInPlace : ", ShapesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Access to sub-shapes by their unique IDs inside the main shape. +# ----------------------------------------------------------------------------- + +# Obtain a composite sub-shape of , composed from sub-shapes +# of , selected by their unique IDs inside +def GetSubShape(aShape, ListOfID): + anObj = geom.AddSubShape(aShape,ListOfID) + return anObj + +# Obtain unique ID of sub-shape inside +def GetSubShapeID(aShape, aSubShape): + anID = LocalOp.GetSubShapeIndex(aShape, aSubShape) + if LocalOp.IsDone() == 0: + print "GetSubShapeIndex : ", LocalOp.GetErrorCode() + return anID + +# ----------------------------------------------------------------------------- +# Decompose objects +# ----------------------------------------------------------------------------- + +def SubShapeAll(aShape, aType): + ListObj = ShapesOp.MakeExplode(aShape,aType,0) + if ShapesOp.IsDone() == 0: + print "MakeExplode : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllIDs(aShape, aType): + ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0) + if ShapesOp.IsDone() == 0: + print "SubShapeAllIDs : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllSorted(aShape, aType): + ListObj = ShapesOp.MakeExplode(aShape,aType,1) + if ShapesOp.IsDone() == 0: + print "MakeExplode : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllSortedIDs(aShape, aType): + ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1) + if ShapesOp.IsDone() == 0: + print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode() + return ListObj + +# Obtain a compound of sub-shapes of , +# selected by they indices in list of all sub-shapes of type +def SubShape(aShape, aType, ListOfInd): + ListOfIDs = [] + AllShapeList = SubShapeAll(aShape, aType) + for ind in ListOfInd: + ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1])) + anObj = GetSubShape(aShape, ListOfIDs) + return anObj + +# Obtain a compound of sub-shapes of , +# selected by they indices in sorted list of all sub-shapes of type +def SubShapeSorted(aShape, aType, ListOfInd): + ListOfIDs = [] + AllShapeList = SubShapeAllSorted(aShape, aType) + for ind in ListOfInd: + ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1])) + anObj = GetSubShape(aShape, ListOfIDs) + return anObj + +# ----------------------------------------------------------------------------- +# Healing operations +# ----------------------------------------------------------------------------- + +def ProcessShape(Shape, Operators, Parameters, Values): + anObj = HealOp.ProcessShape(Shape, Operators, Parameters, Values) + if HealOp.IsDone() == 0: + print "ProcessShape : ", HealOp.GetErrorCode() + return anObj + +def SuppressFaces(aShape,ListOfId): + anObj = HealOp.SuppressFaces(aShape,ListOfId) + if HealOp.IsDone() == 0: + print "SuppressFaces : ", HealOp.GetErrorCode() + return anObj + +def MakeSewing(ListShape,precision): + comp = MakeCompound(ListShape) + anObj = Sew(comp,precision) + return anObj + +def Sew(aShape,precision): + anObj = HealOp.Sew(aShape,precision) + if HealOp.IsDone() == 0: + print "Sew : ", HealOp.GetErrorCode() + return anObj + +def SuppressInternalWires(aShape, Wires): + anObj = HealOp.RemoveIntWires(aShape, Wires) + if HealOp.IsDone() == 0: + print "SuppressInternalWires : ", HealOp.GetErrorCode() + return anObj + +def SuppressHoles(aShape, ListOfId): + anObj = HealOp.FillHoles(aShape,ListOfId) + if HealOp.IsDone() == 0: + print "SuppressHoles : ", HealOp.GetErrorCode() + return anObj + +def CloseContour(aShape, Wires, IsCommonVertex): + anObj = HealOp.CloseContour(aShape, Wires, IsCommonVertex) + if HealOp.IsDone() == 0: + print "CloseContour : ", HealOp.GetErrorCode() + return anObj + +def DivideEdge(aShape, EdgeID, Value, IsByParameter): + anObj = HealOp.DivideEdge(aShape, EdgeID, Value, IsByParameter) + if HealOp.IsDone() == 0: + print "DivideEdge : ", HealOp.GetErrorCode() + return anObj + +def GetFreeBoundary(Shape): + anObj = HealOp.GetFreeBoundary(Shape) + if HealOp.IsDone() == 0: + print "GetFreeBoundaries : ", HealOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create advanced objects +# ----------------------------------------------------------------------------- + +def MakeCopy(aShape): + anObj = InsertOp.MakeCopy(aShape) + if InsertOp.IsDone() == 0: + print "MakeCopy : ", InsertOp.GetErrorCode() + return anObj + +def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter): + anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter) + if PrimOp.IsDone() == 0: + print "MakeFilling : ", PrimOp.GetErrorCode() + return anObj + +def MakeGlueFaces(aShape,aTolerance): + anObj = ShapesOp.MakeGlueFaces(aShape,aTolerance) + if ShapesOp.IsDone() == 0: + print "MakeGlueFaces : ", ShapesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Boolean (Common, Cut, Fuse, Section) +# ----------------------------------------------------------------------------- + +def MakeBoolean(shape1,shape2,operation): + anObj = BoolOp.MakeBoolean(shape1,shape2,operation) + if BoolOp.IsDone() == 0: + print "MakeBoolean : ", BoolOp.GetErrorCode() + return anObj + +def MakeCommon(s1, s2): + return MakeBoolean(s1, s2, 1) + +def MakeCut(s1, s2): + return MakeBoolean(s1, s2, 2) + +def MakeFuse(s1, s2): + return MakeBoolean(s1, s2, 3) + +def MakeSection(s1, s2): + return MakeBoolean(s1, s2, 4) + +def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + anObj = BoolOp.MakePartition(ListShapes, ListTools, + ListKeepInside, ListRemoveInside, + Limit, RemoveWebs, ListMaterials); + if BoolOp.IsDone() == 0: + print "MakePartition : ", BoolOp.GetErrorCode() + return anObj + +def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + anObj = MakePartition(ListShapes, ListTools, + ListKeepInside, ListRemoveInside, + Limit, RemoveWebs, ListMaterials); + return anObj + +def MakeHalfPartition(theShape, thePlane): + anObj = BoolOp.MakeHalfPartition(theShape, thePlane) + if BoolOp.IsDone() == 0: + print "MakeHalfPartition : ", BoolOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Transform objects +# ----------------------------------------------------------------------------- + +def MakeTranslationTwoPoints(aShape,point1,point2): + anObj = TrsfOp.TranslateTwoPointsCopy(aShape,point1,point2) + if TrsfOp.IsDone() == 0: + print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeTranslation(aShape,dx,dy,dz): + anObj = TrsfOp.TranslateDXDYDZCopy(aShape,dx,dy,dz) + if TrsfOp.IsDone() == 0: + print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeTranslationVector(theObject, theVector): + anObj = TrsfOp.TranslateVectorCopy(theObject, theVector) + if TrsfOp.IsDone() == 0: + print "TranslateVectorCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeRotation(aShape,axis,angle): + anObj = TrsfOp.RotateCopy(aShape,axis,angle) + if TrsfOp.IsDone() == 0: + print "RotateCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeScaleTransform(aShape,theCenterofScale,factor): + anObj = TrsfOp.ScaleShapeCopy(aShape,theCenterofScale,factor) + if TrsfOp.IsDone() == 0: + print "ScaleShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByPlane(aShape,aPlane): + anObj = TrsfOp.MirrorPlaneCopy(aShape,aPlane) + if TrsfOp.IsDone() == 0: + print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByAxis(theObject, theAxis): + anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis) + if TrsfOp.IsDone() == 0: + print "MirrorAxisCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByPoint(theObject, thePoint): + anObj = TrsfOp.MirrorPointCopy(theObject, thePoint) + if TrsfOp.IsDone() == 0: + print "MirrorPointCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakePosition(aShape,theStartLCS,theEndLCS): + anObj = TrsfOp.PositionShapeCopy(aShape,theStartLCS,theEndLCS) + if TrsfOp.IsDone() == 0: + print "PositionShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeOffset(aShape, anOffset): + anObj = TrsfOp.OffsetShapeCopy(aShape, anOffset) + if TrsfOp.IsDone() == 0: + print "OffsetShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Patterns +# ----------------------------------------------------------------------------- + +def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes): + anObj = TrsfOp.MultiTranslate1D(aShape,aDir,aStep,aNbTimes) + if TrsfOp.IsDone() == 0: + print "MultiTranslate1D : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2): + anObj = TrsfOp.MultiTranslate2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2) + if TrsfOp.IsDone() == 0: + print "MultiTranslate2D : ", TrsfOp.GetErrorCode() + return anObj + +def MultiRotate1D(aShape,aVec,aNbTimes): + anObj = TrsfOp.MultiRotate1D(aShape,aVec,aNbTimes) + if TrsfOp.IsDone() == 0: + print "MultiRotate1D : ", TrsfOp.GetErrorCode() + return anObj + +def MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2): + anObj = TrsfOp.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2) + if TrsfOp.IsDone() == 0: + print "MultiRotate2D : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes): + aVec = MakeLine(aPoint,aDir) + anObj = MultiRotate1D(aShape,aVec,aNbTimes) + return anObj + +def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2): + aVec = MakeLine(aPoint,aDir) + anObj = MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2) + return anObj + +# ----------------------------------------------------------------------------- +# Local operations +# ----------------------------------------------------------------------------- + +def MakeFilletAll(aShape,radius): + anObj = LocalOp.MakeFilletAll(aShape,radius) + if LocalOp.IsDone() == 0: + print "MakeFilletAll : ", LocalOp.GetErrorCode() + return anObj + +def MakeFillet(aShape,radius,aShapeType,ListShape): + anObj = None + if aShapeType == ShapeType["EDGE"]: + anObj = LocalOp.MakeFilletEdges(aShape,radius,ListShape) + else: + anObj = LocalOp.MakeFilletFaces(aShape,radius,ListShape) + if LocalOp.IsDone() == 0: + print "MakeFillet : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferAll(aShape,d): + anObj = LocalOp.MakeChamferAll(aShape,d) + if LocalOp.IsDone() == 0: + print "MakeChamferAll : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferEdge(aShape,d1,d2,face1,face2): + anObj = LocalOp.MakeChamferEdge(aShape,d1,d2,face1,face2) + if LocalOp.IsDone() == 0: + print "MakeChamferEdge : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferFaces(aShape,d1,d2,ListShape): + anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape) + if LocalOp.IsDone() == 0: + print "MakeChamferFaces : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamfer(aShape,d1,d2,aShapeType,ListShape): + anObj = None + if aShapeType == ShapeType["EDGE"]: + anObj = MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1]) + else: + anObj = MakeChamferFaces(aShape,d1,d2,ListShape) + return anObj + +def Archimede(aShape,weight,WaterDensity,MeshingDeflection): + anObj = LocalOp.MakeArchimede(aShape,weight,WaterDensity,MeshingDeflection) + if LocalOp.IsDone() == 0: + print "MakeArchimede : ", LocalOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Information objects +# ----------------------------------------------------------------------------- + +def PointCoordinates(Point): + aTuple = MeasuOp.PointCoordinates(Point) + if MeasuOp.IsDone() == 0: + print "PointCoordinates : ", MeasuOp.GetErrorCode() + return aTuple + +def BasicProperties(Shape): + aTuple = MeasuOp.GetBasicProperties(Shape) + if MeasuOp.IsDone() == 0: + print "BasicProperties : ", MeasuOp.GetErrorCode() + return aTuple + +def BoundingBox(Shape): + aTuple = MeasuOp.GetBoundingBox(Shape) + if MeasuOp.IsDone() == 0: + print "BoundingBox : ", MeasuOp.GetErrorCode() + return aTuple + +def Inertia(Shape): + aTuple = MeasuOp.GetInertia(Shape) + if MeasuOp.IsDone() == 0: + print "Inertia : ", MeasuOp.GetErrorCode() + return aTuple + +def MinDistance(Shape1, Shape2): + aTuple = MeasuOp.GetMinDistance(Shape1, Shape2) + if MeasuOp.IsDone() == 0: + print "MinDistance : ", MeasuOp.GetErrorCode() + return aTuple[0] + +def Tolerance(Shape): + aTuple = MeasuOp.GetTolerance(Shape) + if MeasuOp.IsDone() == 0: + print "Tolerance : ", MeasuOp.GetErrorCode() + return aTuple + +def WhatIs(Shape): + aDescr = MeasuOp.WhatIs(Shape) + if MeasuOp.IsDone() == 0: + print "WhatIs : ", MeasuOp.GetErrorCode() + return aDescr + +def MakeCDG(aShape): + anObj = MeasuOp.GetCentreOfMass(aShape) + if MeasuOp.IsDone() == 0: + print "GetCentreOfMass : ", MeasuOp.GetErrorCode() + return anObj + +def CheckShape(aShape): + (IsValid, Status) = MeasuOp.CheckShape(aShape) + if MeasuOp.IsDone() == 0: + print "CheckShape : ", MeasuOp.GetErrorCode() + else: + if IsValid == 0: + print Status + return IsValid + +# ----------------------------------------------------------------------------- +# Import/Export objects +# ----------------------------------------------------------------------------- + +def Import(filename, formatname): + anObj = InsertOp.Import(filename, formatname) + if InsertOp.IsDone() == 0: + print "Import : ", InsertOp.GetErrorCode() + return anObj + +def ImportBREP(theFileName): + return Import(theFileName, "BREP") + +def ImportIGES(theFileName): + return Import(theFileName, "IGES") + +def ImportSTEP(theFileName): + return Import(theFileName, "STEP") + +def Export(aShape, filename, formatname): + InsertOp.Export(aShape, filename, formatname) + if InsertOp.IsDone() == 0: + print "Export : ", InsertOp.GetErrorCode() + +def ExportBREP(theObject, theFileName): + return Export(theObject, theFileName, "BREP") + +def ExportIGES(theObject, theFileName): + return Export(theObject, theFileName, "IGES") + +def ExportSTEP(theObject, theFileName): + return Export(theObject, theFileName, "STEP") + +# ----------------------------------------------------------------------------- +# Block operations +# ----------------------------------------------------------------------------- + +def MakeQuad(E1, E2, E3, E4): + anObj = BlocksOp.MakeQuad(E1, E2, E3, E4) + if BlocksOp.IsDone() == 0: + print "MakeQuad : ", BlocksOp.GetErrorCode() + return anObj + +def MakeQuad2Edges(E1, E2): + anObj = BlocksOp.MakeQuad2Edges(E1, E2) + if BlocksOp.IsDone() == 0: + print "MakeQuad2Edges : ", BlocksOp.GetErrorCode() + return anObj + +def MakeQuad4Vertices(V1, V2, V3, V4): + anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4) + if BlocksOp.IsDone() == 0: + print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode() + return anObj + +def MakeHexa(F1, F2, F3, F4, F5, F6): + anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6) + if BlocksOp.IsDone() == 0: + print "MakeHexa : ", BlocksOp.GetErrorCode() + return anObj + +def MakeHexa2Faces(F1, F2): + anObj = BlocksOp.MakeHexa2Faces(F1, F2) + if BlocksOp.IsDone() == 0: + print "MakeHexa2Faces : ", BlocksOp.GetErrorCode() + return anObj + +def GetPoint(theShape, theX, theY, theZ, theEpsilon): + anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon) + if BlocksOp.IsDone() == 0: + print "GetPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetEdge(theShape, thePoint1, thePoint2): + anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2) + if BlocksOp.IsDone() == 0: + print "GetEdge : ", BlocksOp.GetErrorCode() + return anObj + +def GetEdgeNearPoint(theShape, thePoint): + anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint) + if BlocksOp.IsDone() == 0: + print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4): + anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4) + if BlocksOp.IsDone() == 0: + print "GetFaceByPoints : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByEdges(theShape, theEdge1, theEdge2): + anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2) + if BlocksOp.IsDone() == 0: + print "GetFaceByEdges : ", BlocksOp.GetErrorCode() + return anObj + +def GetOppositeFace(theBlock, theFace): + anObj = BlocksOp.GetOppositeFace(theBlock, theFace) + if BlocksOp.IsDone() == 0: + print "GetOppositeFace : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceNearPoint(theShape, thePoint): + anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint) + if BlocksOp.IsDone() == 0: + print "GetFaceNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByNormale(theBlock, theVector): + anObj = BlocksOp.GetFaceByNormale(theBlock, theVector) + if BlocksOp.IsDone() == 0: + print "GetFaceByNormale : ", BlocksOp.GetErrorCode() + return anObj + +def CheckCompoundOfBlocks(theCompound): + (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound) + if BlocksOp.IsDone() == 0: + print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode() + else: + if IsValid == 0: + Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors) + print Descr + return IsValid + +def RemoveExtraEdges(theShape): + anObj = BlocksOp.RemoveExtraEdges(theShape) + if BlocksOp.IsDone() == 0: + print "RemoveExtraEdges : ", BlocksOp.GetErrorCode() + return anObj + +def CheckAndImprove(theShape): + anObj = BlocksOp.CheckAndImprove(theShape) + if BlocksOp.IsDone() == 0: + print "CheckAndImprove : ", BlocksOp.GetErrorCode() + return anObj + +def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces): + aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces) + if BlocksOp.IsDone() == 0: + print "MakeBlockExplode : ", BlocksOp.GetErrorCode() + return aList + +def GetBlockNearPoint(theCompound, thePoint): + anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint) + if BlocksOp.IsDone() == 0: + print "GetBlockNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetBlockByParts(theCompound, theParts): + anObj = BlocksOp.GetBlockByParts(theCompound, theParts) + if BlocksOp.IsDone() == 0: + print "GetBlockByParts : ", BlocksOp.GetErrorCode() + return anObj + +def GetBlocksByParts(theCompound, theParts): + aList = BlocksOp.GetBlocksByParts(theCompound, theParts) + if BlocksOp.IsDone() == 0: + print "GetBlocksByParts : ", BlocksOp.GetErrorCode() + return aList + +def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes): + anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes) + if BlocksOp.IsDone() == 0: + print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode() + return anObj + +def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, + DirFaceID1V, DirFaceID2V, NbTimesV): + anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, + DirFaceID1V, DirFaceID2V, NbTimesV) + if BlocksOp.IsDone() == 0: + print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode() + return anObj + +def Propagate(theShape): + listChains = BlocksOp.Propagate(theShape) + if BlocksOp.IsDone() == 0: + print "Propagate : ", BlocksOp.GetErrorCode() + return listChains + +# ----------------------------------------------------------------------------- +# Group operations +# ----------------------------------------------------------------------------- + +def CreateGroup(MainShape, ShapeType): + anObj = GroupOp.CreateGroup(MainShape, ShapeType) + if GroupOp.IsDone() == 0: + print "CreateGroup : ", GroupOp.GetErrorCode() + return anObj + +def AddObject(Group, SubShapeID): + GroupOp.AddObject(Group, SubShapeID) + if GroupOp.IsDone() == 0: + print "AddObject : ", GroupOp.GetErrorCode() + +def RemoveObject(Group, SubShapeID): + GroupOp.RemoveObject(Group, SubShapeID) + if GroupOp.IsDone() == 0: + print "RemoveObject : ", GroupOp.GetErrorCode() + +def UnionList (theGroup, theSubShapes): + GroupOp.UnionList(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "UnionList : ", GroupOp.GetErrorCode() + +def UnionIDs(theGroup, theSubShapes): + GroupOp.UnionIDs(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "UnionIDs : ", GroupOp.GetErrorCode() + +def DifferenceList (theGroup, theSubShapes): + GroupOp.DifferenceList(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "DifferenceList : ", GroupOp.GetErrorCode() + +def DifferenceIDs(theGroup, theSubShapes): + GroupOp.DifferenceIDs(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "DifferenceIDs : ", GroupOp.GetErrorCode() + +def GetObjectIDs(Group): + ListIDs = GroupOp.GetObjects(Group) + if GroupOp.IsDone() == 0: + print "GetObjectIDs : ", GroupOp.GetErrorCode() + return ListIDs + +def GetType(theGroup): + aType = GroupOp.GetType(theGroup) + if GroupOp.IsDone() == 0: + print "GetType : ", GroupOp.GetErrorCode() + return aType + +def GetMainShape(theGroup): + anObj = GroupOp.GetMainShape(theGroup) + if GroupOp.IsDone() == 0: + print "GetMainShape : ", GroupOp.GetErrorCode() + return anObj + +def GetEdgesByLength (theShape, min_length, max_length, include_min = 1, include_max = 1): + """ + Create group of edges of theShape, whose length is in range [min_length, max_length]. + If include_min/max == 0, edges with length == min/max_length will not be included in result. + """ + + edges = SubShapeAll(theShape, ShapeType["EDGE"]) + edges_in_range = [] + for edge in edges: + Props = BasicProperties(edge) + if min_length <= Props[0] and Props[0] <= max_length: + if (not include_min) and (min_length == Props[0]): + skip = 1 + else: + if (not include_max) and (Props[0] == max_length): + skip = 1 + else: + edges_in_range.append(edge) + + if len(edges_in_range) <= 0: + print "No edges found by given criteria" + return 0 + + group_edges = CreateGroup(theShape, ShapeType["EDGE"]) + UnionList(group_edges, edges_in_range) + + return group_edges + +# Add Path to the system path +# +def addPath(Path): + if (sys.path.count(Path) < 1): + sys.path.append(Path) diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py new file mode 100644 index 000000000..6d47c038a --- /dev/null +++ b/src/GEOM_SWIG/geompy.py @@ -0,0 +1,2603 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : geompy.py +# Author : Paul RASCLE, EDF +# Module : GEOM +# $Header$ + +from salome import * +import GEOM + +""" + \namespace geompy + \brief Module geompy +""" + +g = lcc.FindOrLoadComponent("FactoryServer", "GEOM") +geom = g._narrow( GEOM.GEOM_Gen ) +gg = ImportComponentGUI("GEOM") +gg.initGeomGen() + +#SRN: modified on Mar 18, 2005 + +myBuilder = None +myStudyId = 0 +father = None + +BasicOp = None +CurvesOp = None +PrimOp = None +ShapesOp = None +HealOp = None +InsertOp = None +BoolOp = None +TrsfOp = None +LocalOp = None +MeasuOp = None +BlocksOp = None +GroupOp = None + +def init_geom(theStudy): + + global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp + global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp, father + + myStudy = theStudy + myStudyId = myStudy._get_StudyId() + myBuilder = myStudy.NewBuilder() + father = myStudy.FindComponent("GEOM") + if father is None: + father = myBuilder.NewComponent("GEOM") + A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName") + FName = A1._narrow(SALOMEDS.AttributeName) + FName.SetValue("Geometry") + A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap") + aPixmap = A2._narrow(SALOMEDS.AttributePixMap) + aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry") + myBuilder.DefineComponentInstance(father,geom) + pass + + # ----------------------------------------------------------------------------- + # Assign Operations Interfaces + # ----------------------------------------------------------------------------- + + BasicOp = geom.GetIBasicOperations (myStudyId) + CurvesOp = geom.GetICurvesOperations (myStudyId) + PrimOp = geom.GetI3DPrimOperations (myStudyId) + ShapesOp = geom.GetIShapesOperations (myStudyId) + HealOp = geom.GetIHealingOperations (myStudyId) + InsertOp = geom.GetIInsertOperations (myStudyId) + BoolOp = geom.GetIBooleanOperations (myStudyId) + TrsfOp = geom.GetITransformOperations(myStudyId) + LocalOp = geom.GetILocalOperations (myStudyId) + MeasuOp = geom.GetIMeasureOperations (myStudyId) + BlocksOp = geom.GetIBlocksOperations (myStudyId) + GroupOp = geom.GetIGroupOperations (myStudyId) + pass + +init_geom(myStudy) + +#SRN: end of modifications + +def SubShapeName(aSubObj, aMainObj): + """ + * Get name for sub-shape aSubObj of shape aMainObj + + * Example: see GEOM_TestAll.py + """ + aSubId = orb.object_to_string(aSubObj) + aMainId = orb.object_to_string(aMainObj) + index = gg.getIndexTopology(aSubId, aMainId) + name = gg.getShapeTypeString(aSubId) + "_%d"%(index) + return name + +def addToStudy(aShape, aName): + """ + * Publish in study aShape with name aName + + * Example: see GEOM_TestAll.py + """ + try: + aSObject = geom.AddInStudy(myStudy, aShape, aName, None) + except: + print "addToStudy() failed" + return "" + return aShape.GetStudyEntry() + +def addToStudyInFather(aFather, aShape, aName): + """ + * Publish in study aShape with name aName as sub-object of previously published aFather + + * Example: see GEOM_TestAll.py + """ + try: + aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather) + except: + print "addToStudyInFather() failed" + return "" + return aShape.GetStudyEntry() + +# ----------------------------------------------------------------------------- +# enumeration ShapeType as a dictionary +# ----------------------------------------------------------------------------- + +ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} + +# ----------------------------------------------------------------------------- +# Basic primitives +# ----------------------------------------------------------------------------- + +def MakeVertex(theX, theY, theZ): + """ + * Create point by three coordinates. + * \param theX The X coordinate of the point. + * \param theY The Y coordinate of the point. + * \param theZ The Z coordinate of the point. + * \return New GEOM_Object, containing the created point. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePointXYZ(theX, theY, theZ) + if BasicOp.IsDone() == 0: + print "MakePointXYZ : ", BasicOp.GetErrorCode() + return anObj + +def MakeVertexWithRef(theReference, theX, theY, theZ): + """ + * Create a point, distant from the referenced point + * on the given distances along the coordinate axes. + * \param theReference The referenced point. + * \param theX Displacement from the referenced point along OX axis. + * \param theY Displacement from the referenced point along OY axis. + * \param theZ Displacement from the referenced point along OZ axis. + * \return New GEOM_Object, containing the created point. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePointWithReference(theReference, theX, theY, theZ) + if BasicOp.IsDone() == 0: + print "MakePointWithReference : ", BasicOp.GetErrorCode() + return anObj + +def MakeVertexOnCurve(theRefCurve, theParameter): + """ + * Create a point, corresponding to the given parameter on the given curve. + * \param theRefCurve The referenced curve. + * \param theParameter Value of parameter on the referenced curve. + * \return New GEOM_Object, containing the created point. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePointOnCurve(theRefCurve, theParameter) + if BasicOp.IsDone() == 0: + print "MakePointOnCurve : ", BasicOp.GetErrorCode() + return anObj + +def MakeVectorDXDYDZ(theDX, theDY, theDZ): + """ + * Create a vector with the given components. + * \param theDX X component of the vector. + * \param theDY Y component of the vector. + * \param theDZ Z component of the vector. + * \return New GEOM_Object, containing the created vector. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ) + if BasicOp.IsDone() == 0: + print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode() + return anObj + +def MakeVector(thePnt1, thePnt2): + """ + * Create a vector between two points. + * \param thePnt1 Start point for the vector. + * \param thePnt2 End point for the vector. + * \return New GEOM_Object, containing the created vector. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2) + if BasicOp.IsDone() == 0: + print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode() + return anObj + +def MakeLine(thePnt, theDir): + """ + * Create a line, passing through the given point + * and parrallel to the given direction + * \param thePnt Point. The resulting line will pass through it. + * \param theDir Direction. The resulting line will be parallel to it. + * \return New GEOM_Object, containing the created line. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakeLine(thePnt, theDir) + if BasicOp.IsDone() == 0: + print "MakeLine : ", BasicOp.GetErrorCode() + return anObj + +def MakeLineTwoPnt(thePnt1, thePnt2): + """ + * Create a line, passing through the given points + * \param thePnt1 First of two points, defining the line. + * \param thePnt2 Second of two points, defining the line. + * \return New GEOM_Object, containing the created line. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakeLineTwoPnt(thePnt1, thePnt2) + if BasicOp.IsDone() == 0: + print "MakeLineTwoPnt : ", BasicOp.GetErrorCode() + return anObj + +def MakePlane(thePnt, theVec, theTrimSize): + """ + * Create a plane, passing through the given point + * and normal to the given vector. + * \param thePnt Point, the plane has to pass through. + * \param theVec Vector, defining the plane normal direction. + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize) + if BasicOp.IsDone() == 0: + print "MakePlanePntVec : ", BasicOp.GetErrorCode() + return anObj + +def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize): + """ + * Create a plane, passing through the three given points + * \param thePnt1 First of three points, defining the plane. + * \param thePnt2 Second of three points, defining the plane. + * \param thePnt3 Fird of three points, defining the plane. + * \param theTrimSize Half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize) + if BasicOp.IsDone() == 0: + print "MakePlaneThreePnt : ", BasicOp.GetErrorCode() + return anObj + +def MakePlaneFace(theFace, theTrimSize): + """ + * Create a plane, similar to the existing one, but with another size of representing face. + * \param theFace Referenced plane. + * \param theTrimSize New half size of a side of quadrangle face, representing the plane. + * \return New GEOM_Object, containing the created plane. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakePlaneFace(theFace, theTrimSize) + if BasicOp.IsDone() == 0: + print "MakePlaneFace : ", BasicOp.GetErrorCode() + return anObj + +def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ): + """ + * Create a local coordinate system. + * \param OX,OY,OZ Three coordinates of coordinate system origin. + * \param XDX,XDY,XDZ Three components of OX direction + * \param YDX,YDY,YDZ Three components of OY direction + * \return New GEOM_Object, containing the created coordinate system. + + * Example: see GEOM_TestAll.py + """ + anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ) + if BasicOp.IsDone() == 0: + print "MakeMarker : ", BasicOp.GetErrorCode() + return anObj + +def MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec): + """ + * Create a local coordinate system. + * \param theOrigin Point of coordinate system origin. + * \param theXVec Vector of X direction + * \param theYVec Vector of Y direction + * \return New GEOM_Object, containing the created coordinate system. + """ + O = PointCoordinates( theOrigin ) + OXOY = [] + for vec in [ theXVec, theYVec ]: + v1, v2 = SubShapeAll( vec, ShapeType["VERTEX"] ) + p1 = PointCoordinates( v1 ) + p2 = PointCoordinates( v2 ) + for i in range( 0, 3 ): + OXOY.append( p2[i] - p1[i] ) + # + anObj = BasicOp.MakeMarker( O[0], O[1], O[2], + OXOY[0], OXOY[1], OXOY[2], + OXOY[3], OXOY[4], OXOY[5], ) + if BasicOp.IsDone() == 0: + print "MakeMarker : ", BasicOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Curves +# ----------------------------------------------------------------------------- + +def MakeArc(thePnt1, thePnt2, thePnt3): + """ + * Create an arc of circle, passing through three given points. + * \param thePnt1 Start point of the arc. + * \param thePnt2 Middle point of the arc. + * \param thePnt3 End point of the arc. + * \return New GEOM_Object, containing the created arc. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3) + if CurvesOp.IsDone() == 0: + print "MakeArc : ", CurvesOp.GetErrorCode() + return anObj + +def MakeCircle(thePnt, theVec, theR): + """ + * Create a circle with given center, normal vector and radius. + * \param thePnt Circle center. + * \param theVec Vector, normal to the plane of the circle. + * \param theR Circle radius. + * \return New GEOM_Object, containing the created circle. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR) + if CurvesOp.IsDone() == 0: + print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode() + return anObj + +def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3): + """ + * Create a circle, passing through three given points + * \param thePnt1,thePnt2,thePnt3 Points, defining the circle. + * \return New GEOM_Object, containing the created circle. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3) + if CurvesOp.IsDone() == 0: + print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode() + return anObj + +def MakeEllipse(thePnt, theVec, theRMajor, theRMinor): + """ + * Create an ellipse with given center, normal vector and radiuses. + * \param thePnt Ellipse center. + * \param theVec Vector, normal to the plane of the ellipse. + * \param theRMajor Major ellipse radius. + * \param theRMinor Minor ellipse radius. + * \return New GEOM_Object, containing the created ellipse. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) + if CurvesOp.IsDone() == 0: + print "MakeEllipse : ", CurvesOp.GetErrorCode() + return anObj + +def MakePolyline(thePoints): + """ + * Create a polyline on the set of points. + * \param thePoints Sequence of points for the polyline. + * \return New GEOM_Object, containing the created polyline. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakePolyline(thePoints) + if CurvesOp.IsDone() == 0: + print "MakePolyline : ", CurvesOp.GetErrorCode() + return anObj + +def MakeBezier(thePoints): + """ + * Create bezier curve on the set of points. + * \param thePoints Sequence of points for the bezier curve. + * \return New GEOM_Object, containing the created bezier curve. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeSplineBezier(thePoints) + if CurvesOp.IsDone() == 0: + print "MakeSplineBezier : ", CurvesOp.GetErrorCode() + return anObj + +def MakeInterpol(thePoints): + """ + * Create B-Spline curve on the set of points. + * \param thePoints Sequence of points for the B-Spline curve. + * \return New GEOM_Object, containing the created B-Spline curve. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeSplineInterpolation(thePoints) + if CurvesOp.IsDone() == 0: + print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode() + return anObj + +def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]): + """ + * Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. \n + * Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n + * Format of the description string have to be the following: + * + * "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]" + * + * Where: + * - x1, y1 are coordinates of the first sketcher point (zero by default), + * - CMD is one of + * - "R angle" : Set the direction by angle + * - "D dx dy" : Set the direction by DX & DY + * . + * \n + * - "TT x y" : Create segment by point at X & Y + * - "T dx dy" : Create segment by point with DX & DY + * - "L length" : Create segment by direction & Length + * - "IX x" : Create segment by direction & Intersect. X + * - "IY y" : Create segment by direction & Intersect. Y + * . + * \n + * - "C radius length" : Create arc by direction, radius and length(in degree) + * . + * \n + * - "WW" : Close Wire (to finish) + * - "WF" : Close Wire and build face (to finish) + * + * \param theCommand String, defining the sketcher in local + * coordinates of the working plane. + * \param theWorkingPlane Nine double values, defining origin, + * OZ and OX directions of the working plane. + * \return New GEOM_Object, containing the created wire. + + * Example: see GEOM_TestAll.py + """ + anObj = CurvesOp.MakeSketcher(theCommand, theWorkingPlane) + if CurvesOp.IsDone() == 0: + print "MakeSketcher : ", CurvesOp.GetErrorCode() + return anObj + +def MakeSketcherOnPlane(theCommand, theWorkingPlane): + """ + * Create a sketcher (wire or face), following the textual description, + * passed through \a theCommand argument. \n + * For format of the description string see the previous method.\n + * \param theCommand String, defining the sketcher in local + * coordinates of the working plane. + * \param theWorkingPlane Planar Face of the working plane. + * \return New GEOM_Object, containing the created wire. + """ + anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane) + if CurvesOp.IsDone() == 0: + print "MakeSketcher : ", CurvesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create 3D Primitives +# ----------------------------------------------------------------------------- + +def MakeBox(x1,y1,z1,x2,y2,z2): + """ + * Create a box by coordinates of two opposite vertices. + + * Example: see GEOM_TestAll.py + """ + pnt1 = MakeVertex(x1,y1,z1) + pnt2 = MakeVertex(x2,y2,z2) + return MakeBoxTwoPnt(pnt1,pnt2) + +def MakeBoxDXDYDZ(theDX, theDY, theDZ): + """ + * Create a box with specified dimensions along the coordinate axes + * and with edges, parallel to the coordinate axes. + * Center of the box will be at point (DX/2, DY/2, DZ/2). + * \param theDX Length of Box edges, parallel to OX axis. + * \param theDY Length of Box edges, parallel to OY axis. + * \param theDZ Length of Box edges, parallel to OZ axis. + * \return New GEOM_Object, containing the created box. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ) + if PrimOp.IsDone() == 0: + print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode() + return anObj + +def MakeBoxTwoPnt(thePnt1, thePnt2): + """ + * Create a box with two specified opposite vertices, + * and with edges, parallel to the coordinate axes + * \param thePnt1 First of two opposite vertices. + * \param thePnt2 Second of two opposite vertices. + * \return New GEOM_Object, containing the created box. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2) + if PrimOp.IsDone() == 0: + print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode() + return anObj + +def MakeCylinder(thePnt, theAxis, theR, theH): + """ + * Create a cylinder with given base point, axis, radius and height. + * \param thePnt Central point of cylinder base. + * \param theAxis Cylinder axis. + * \param theR Cylinder radius. + * \param theH Cylinder height. + * \return New GEOM_Object, containing the created cylinder. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH) + if PrimOp.IsDone() == 0: + print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode() + return anObj + +def MakeCylinderRH(theR, theH): + """ + * Create a cylinder with given radius and height at + * the origin of coordinate system. Axis of the cylinder + * will be collinear to the OZ axis of the coordinate system. + * \param theR Cylinder radius. + * \param theH Cylinder height. + * \return New GEOM_Object, containing the created cylinder. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeCylinderRH(theR, theH) + if PrimOp.IsDone() == 0: + print "MakeCylinderRH : ", PrimOp.GetErrorCode() + return anObj + +def MakeSpherePntR(thePnt, theR): + """ + * Create a sphere with given center and radius. + * \param thePnt Sphere center. + * \param theR Sphere radius. + * \return New GEOM_Object, containing the created sphere. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeSpherePntR(thePnt, theR) + if PrimOp.IsDone() == 0: + print "MakeSpherePntR : ", PrimOp.GetErrorCode() + return anObj + +def MakeSphere(x, y, z, theR): + """ + * Create a sphere with given center and radius. + * \param x,y,z Coordinates of sphere center. + * \param theR Sphere radius. + * \return New GEOM_Object, containing the created sphere. + + * Example: see GEOM_TestAll.py + """ + point = MakeVertex(x, y, z) + anObj = MakeSpherePntR(point, theR) + return anObj + +def MakeSphereR(theR): + """ + * Create a sphere with given radius at the origin of coordinate system. + * \param theR Sphere radius. + * \return New GEOM_Object, containing the created sphere. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeSphereR(theR) + if PrimOp.IsDone() == 0: + print "MakeSphereR : ", PrimOp.GetErrorCode() + return anObj + +def MakeCone(thePnt, theAxis, theR1, theR2, theH): + """ + * Create a cone with given base point, axis, height and radiuses. + * \param thePnt Central point of the first cone base. + * \param theAxis Cone axis. + * \param theR1 Radius of the first cone base. + * \param theR2 Radius of the second cone base. + * \note If both radiuses are non-zero, the cone will be truncated. + * \note If the radiuses are equal, a cylinder will be created instead. + * \param theH Cone height. + * \return New GEOM_Object, containing the created cone. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH) + if PrimOp.IsDone() == 0: + print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode() + return anObj + +def MakeConeR1R2H(theR1, theR2, theH): + """ + * Create a cone with given height and radiuses at + * the origin of coordinate system. Axis of the cone will + * be collinear to the OZ axis of the coordinate system. + * \param theR1 Radius of the first cone base. + * \param theR2 Radius of the second cone base. + * \note If both radiuses are non-zero, the cone will be truncated. + * \note If the radiuses are equal, a cylinder will be created instead. + * \param theH Cone height. + * \return New GEOM_Object, containing the created cone. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeConeR1R2H(theR1, theR2, theH) + if PrimOp.IsDone() == 0: + print "MakeConeR1R2H : ", PrimOp.GetErrorCode() + return anObj + +def MakeTorus(thePnt, theVec, theRMajor, theRMinor): + """ + * Create a torus with given center, normal vector and radiuses. + * \param thePnt Torus central point. + * \param theVec Torus axis of symmetry. + * \param theRMajor Torus major radius. + * \param theRMinor Torus minor radius. + * \return New GEOM_Object, containing the created torus. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor) + if PrimOp.IsDone() == 0: + print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode() + return anObj + +def MakeTorusRR(theRMajor, theRMinor): + """ + * Create a torus with given radiuses at the origin of coordinate system. + * \param theRMajor Torus major radius. + * \param theRMinor Torus minor radius. + * \return New GEOM_Object, containing the created torus. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeTorusRR(theRMajor, theRMinor) + if PrimOp.IsDone() == 0: + print "MakeTorusRR : ", PrimOp.GetErrorCode() + return anObj + +def MakePrism(theBase, thePoint1, thePoint2): + """ + * Create a shape by extrusion of the base shape along a vector, defined by two points. + * \param theBase Base shape to be extruded. + * \param thePoint1 First end of extrusion vector. + * \param thePoint2 Second end of extrusion vector. + * \return New GEOM_Object, containing the created prism. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2) + if PrimOp.IsDone() == 0: + print "MakePrismTwoPnt : ", PrimOp.GetErrorCode() + return anObj + +def MakePrismVecH(theBase, theVec, theH): + """ + * Create a shape by extrusion of the base shape along the vector, + * i.e. all the space, transfixed by the base shape during its translation + * along the vector on the given distance. + * \param theBase Base shape to be extruded. + * \param theVec Direction of extrusion. + * \param theH Prism dimension along theVec. + * \return New GEOM_Object, containing the created prism. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakePrismVecH(theBase, theVec, theH) + if PrimOp.IsDone() == 0: + print "MakePrismVecH : ", PrimOp.GetErrorCode() + return anObj + +def MakePipe(theBase, thePath): + """ + * Create a shape by extrusion of the base shape along + * the path shape. The path shape can be a wire or an edge. + * \param theBase Base shape to be extruded. + * \param thePath Path shape to extrude the base shape along it. + * \return New GEOM_Object, containing the created pipe. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakePipe(theBase, thePath) + if PrimOp.IsDone() == 0: + print "MakePipe : ", PrimOp.GetErrorCode() + return anObj + +def MakeRevolution(theBase, theAxis, theAngle): + """ + * Create a shape by revolution of the base shape around the axis + * on the given angle, i.e. all the space, transfixed by the base + * shape during its rotation around the axis on the given angle. + * \param theBase Base shape to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in radians. + * \return New GEOM_Object, containing the created revolution. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle) + if PrimOp.IsDone() == 0: + print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create base shapes +# ----------------------------------------------------------------------------- + +def MakeEdge(thePnt1, thePnt2): + """ + * Create a linear edge with specified ends. + * \param thePnt1 Point for the first end of edge. + * \param thePnt2 Point for the second end of edge. + * \return New GEOM_Object, containing the created edge. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeEdge(thePnt1, thePnt2) + if ShapesOp.IsDone() == 0: + print "MakeEdge : ", ShapesOp.GetErrorCode() + return anObj + +def MakeWire(theEdgesAndWires): + """ + * Create a wire from the set of edges and wires. + * \param theEdgesAndWires List of edges and/or wires. + * \return New GEOM_Object, containing the created wire. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeWire(theEdgesAndWires) + if ShapesOp.IsDone() == 0: + print "MakeWire : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFace(theWire, isPlanarWanted): + """ + * Create a face on the given wire. + * \param theWire Wire to build the face on. + * \param isPlanarWanted If TRUE, only planar face will be built. + * If impossible, NULL object will be returned. + * \return New GEOM_Object, containing the created face. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeFace(theWire, isPlanarWanted) + if ShapesOp.IsDone() == 0: + print "MakeFace : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFaceWires(theWires, isPlanarWanted): + """ + * Create a face on the given wires set. + * \param theWires List of wires to build the face on. + * \param isPlanarWanted If TRUE, only planar face will be built. + * If impossible, NULL object will be returned. + * \return New GEOM_Object, containing the created face. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeFaceWires(theWires, isPlanarWanted) + if ShapesOp.IsDone() == 0: + print "MakeFaceWires : ", ShapesOp.GetErrorCode() + return anObj + +def MakeFaces(theWires, isPlanarWanted): + """ + * Shortcut to MakeFaceWires() + + * Example: see GEOM_TestOthers.py + """ + anObj = MakeFaceWires(theWires, isPlanarWanted) + return anObj + +def MakeShell(theFacesAndShells): + """ + * Create a shell from the set of faces and shells. + * \param theFacesAndShells List of faces and/or shells. + * \return New GEOM_Object, containing the created shell. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeShell(theFacesAndShells) + if ShapesOp.IsDone() == 0: + print "MakeShell : ", ShapesOp.GetErrorCode() + return anObj + +def MakeSolid(theShells): + """ + * Create a solid, bounded by the given shells. + * \param theShells Sequence of bounding shells. + * \return New GEOM_Object, containing the created solid. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeSolidShells(theShells) + if ShapesOp.IsDone() == 0: + print "MakeSolid : ", ShapesOp.GetErrorCode() + return anObj + +def MakeCompound(theShapes): + """ + * Create a compound of the given shapes. + * \param theShapes List of shapes to put in compound. + * \return New GEOM_Object, containing the created compound. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.MakeCompound(theShapes) + if ShapesOp.IsDone() == 0: + print "MakeCompound : ", ShapesOp.GetErrorCode() + return anObj + +def NumberOfFaces(theShape): + """ + * Gives quantity of faces in the given shape. + * \param theShape Shape to count faces of. + * \return Quantity of faces. + + * Example: see GEOM_TestOthers.py + """ + nb_faces = ShapesOp.NumberOfFaces(theShape) + if ShapesOp.IsDone() == 0: + print "NumberOfFaces : ", ShapesOp.GetErrorCode() + return nb_faces + +def NumberOfEdges(theShape): + """ + * Gives quantity of edges in the given shape. + * \param theShape Shape to count edges of. + * \return Quantity of edges. + + * Example: see GEOM_TestOthers.py + """ + nb_edges = ShapesOp.NumberOfEdges(theShape) + if ShapesOp.IsDone() == 0: + print "NumberOfEdges : ", ShapesOp.GetErrorCode() + return nb_edges + +def ChangeOrientation(theShape): + """ + * Reverses an orientation the given shape. + * \param theShape Shape to be reversed. + * \return The reversed copy of theShape. + + * Example: see GEOM_TestAll.py + """ + anObj = ShapesOp.ChangeOrientation(theShape) + if ShapesOp.IsDone() == 0: + print "ChangeOrientation : ", ShapesOp.GetErrorCode() + return anObj + +def OrientationChange(theShape): + """ + * Shortcut to ChangeOrientation() + + * Example: see GEOM_TestOthers.py + """ + anObj = ChangeOrientation(theShape) + return anObj + +def GetFreeFacesIDs(theShape): + """ + * Retrieve all free faces from the given shape. + * Free face is a face, which is not shared between two shells of the shape. + * \param theShape Shape to find free faces in. + * \return List of IDs of all free faces, contained in theShape. + + * Example: see GEOM_TestOthers.py + """ + anIDs = ShapesOp.GetFreeFacesIDs(theShape) + if ShapesOp.IsDone() == 0: + print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode() + return anIDs + +def GetSharedShapes(theShape1, theShape2, theShapeType): + """ + * Get all sub-shapes of theShape1 of the given type, shared with theShape2. + * \param theShape1 Shape to find sub-shapes in. + * \param theShape2 Shape to find shared sub-shapes with. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of sub-shapes of theShape1, shared with theShape2. + + * Example: see GEOM_TestOthers.py + """ + aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType) + if ShapesOp.IsDone() == 0: + print "GetSharedShapes : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnPlane(theShape, theShapeType, theAx1, theState): + """ + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified plane by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAx1 Vector (or line, or linear edge), specifying normal + * direction and location of the plane to find shapes on. + * \param theState The state of the subshapes to find. It can be one of + * ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + * \return List of all found sub-shapes. + + * Example: see GEOM_TestOthers.py + """ + aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnPlane : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState): + """ + * Works like the above method, but returns list of sub-shapes indices + """ + aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnPlaneIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState): + """ + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified cylinder by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theAxis Vector (or line, or linear edge), specifying + * axis of the cylinder to find shapes on. + * \param theRadius Radius of the cylinder to find shapes on. + * \param theState The state of the subshapes to find. It can be one of + * ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + * \return List of all found sub-shapes. + + * Example: see GEOM_TestOthers.py + """ + aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState): + """ + * Works like the above method, but returns list of sub-shapes indices + """ + aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnCylinderIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState): + """ + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified sphere by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theCenter Point, specifying center of the sphere to find shapes on. + * \param theRadius Radius of the sphere to find shapes on. + * \param theState The state of the subshapes to find. It can be one of + * ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + * \return List of all found sub-shapes. + + * Example: see GEOM_TestOthers.py + """ + aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnSphere : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState): + """ + * Works like the above method, but returns list of sub-shapes indices + """ + aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + """ + * Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively + * the specified quadrangle by the certain way, defined through \a theState parameter. + * \param theShape Shape to find sub-shapes of. + * \param theShapeType Type of sub-shapes to be retrieved. + * \param theCenter Point, specifying center of the sphere to find shapes on. + * \param theRadius Radius of the sphere to find shapes on. + * \param theState The state of the subshapes to find. It can be one of + * ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + * \return List of all found sub-shapes. + + * Example: see GEOM_TestOthers.py + """ + aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode() + return aList + +def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState): + """ + * Works like the above method, but returns list of sub-shapes indices + """ + aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState) + if ShapesOp.IsDone() == 0: + print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode() + return aList + +def GetInPlace(theShapeWhere, theShapeWhat): + """ + * Get sub-shape(s) of theShapeWhere, which are + * coincident with \a theShapeWhat or could be a part of it. + * \param theShapeWhere Shape to find sub-shapes of. + * \param theShapeWhat Shape, specifying what to find. + * \return Group of all found sub-shapes or a single found sub-shape. + + * Example: see GEOM_TestOthers.py + """ + anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat) + if ShapesOp.IsDone() == 0: + print "GetInPlace : ", ShapesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Access to sub-shapes by their unique IDs inside the main shape. +# ----------------------------------------------------------------------------- + +def GetSubShape(aShape, ListOfID): + """ + * Obtain a composite sub-shape of , composed from sub-shapes + * of , selected by their unique IDs inside + + * Example: see GEOM_TestAll.py + """ + anObj = geom.AddSubShape(aShape,ListOfID) + return anObj + +def GetSubShapeID(aShape, aSubShape): + """ + * Obtain unique ID of sub-shape inside + + * Example: see GEOM_TestAll.py + """ + anID = LocalOp.GetSubShapeIndex(aShape, aSubShape) + if LocalOp.IsDone() == 0: + print "GetSubShapeIndex : ", LocalOp.GetErrorCode() + return anID + +# ----------------------------------------------------------------------------- +# Decompose objects +# ----------------------------------------------------------------------------- + +def SubShapeAll(aShape, aType): + """ + * Explode a shape on subshapes of a given type. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of sub-shapes of type theShapeType, contained in theShape. + + * Example: see GEOM_TestAll.py + """ + ListObj = ShapesOp.MakeExplode(aShape,aType,0) + if ShapesOp.IsDone() == 0: + print "MakeExplode : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllIDs(aShape, aType): + """ + * Explode a shape on subshapes of a given type. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of IDs of sub-shapes. + """ + ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0) + if ShapesOp.IsDone() == 0: + print "SubShapeAllIDs : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllSorted(aShape, aType): + """ + * Explode a shape on subshapes of a given type. + * Sub-shapes will be sorted by coordinates of their gravity centers. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of sub-shapes of type theShapeType, contained in theShape. + + * Example: see GEOM_TestAll.py + """ + ListObj = ShapesOp.MakeExplode(aShape,aType,1) + if ShapesOp.IsDone() == 0: + print "MakeExplode : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShapeAllSortedIDs(aShape, aType): + """ + * Explode a shape on subshapes of a given type. + * Sub-shapes will be sorted by coordinates of their gravity centers. + * \param theShape Shape to be exploded. + * \param theShapeType Type of sub-shapes to be retrieved. + * \return List of IDs of sub-shapes. + """ + ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1) + if ShapesOp.IsDone() == 0: + print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode() + return ListObj + +def SubShape(aShape, aType, ListOfInd): + """ + * Obtain a compound of sub-shapes of , + * selected by they indices in list of all sub-shapes of type . + * Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + + * Example: see GEOM_TestAll.py + """ + ListOfIDs = [] + AllShapeList = SubShapeAll(aShape, aType) + for ind in ListOfInd: + ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1])) + anObj = GetSubShape(aShape, ListOfIDs) + return anObj + +def SubShapeSorted(aShape, aType, ListOfInd): + """ + * Obtain a compound of sub-shapes of , + * selected by they indices in sorted list of all sub-shapes of type . + * Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type] + + * Example: see GEOM_TestAll.py + """ + ListOfIDs = [] + AllShapeList = SubShapeAllSorted(aShape, aType) + for ind in ListOfInd: + ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1])) + anObj = GetSubShape(aShape, ListOfIDs) + return anObj + +# ----------------------------------------------------------------------------- +# Healing operations +# ----------------------------------------------------------------------------- + +def ProcessShape(theShape, theOperators, theParameters, theValues): + """ + * Apply a sequence of Shape Healing operators to the given object. + * \param theShape Shape to be processed. + * \param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.). + * \param theParameters List of names of parameters + * ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.). + * \param theValues List of values of parameters, in the same order + * as parameters are listed in \a theParameters list. + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.ProcessShape(theShape, theOperators, theParameters, theValues) + if HealOp.IsDone() == 0: + print "ProcessShape : ", HealOp.GetErrorCode() + return anObj + +def SuppressFaces(theObject, theFaces): + """ + * Remove faces from the given object (shape). + * \param theObject Shape to be processed. + * \param theFaces Indices of faces to be removed, if EMPTY then the method + * removes ALL faces of the given object. + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.SuppressFaces(theObject, theFaces) + if HealOp.IsDone() == 0: + print "SuppressFaces : ", HealOp.GetErrorCode() + return anObj + +def MakeSewing(ListShape, theTolerance): + """ + * Sewing of some shapes into single shape. + + * Example: see GEOM_TestHealing.py + """ + comp = MakeCompound(ListShape) + anObj = Sew(comp, theTolerance) + return anObj + +def Sew(theObject, theTolerance): + """ + * Sewing of the given object. + * \param theObject Shape to be processed. + * \param theTolerance Required tolerance value. + * \return New GEOM_Object, containing processed shape. + + * Example: see MakeSewing() above + """ + anObj = HealOp.Sew(theObject, theTolerance) + if HealOp.IsDone() == 0: + print "Sew : ", HealOp.GetErrorCode() + return anObj + +def SuppressInternalWires(theObject, theWires): + """ + * Remove internal wires and edges from the given object (face). + * \param theObject Shape to be processed. + * \param theWires Indices of wires to be removed, if EMPTY then the method + * removes ALL internal wires of the given object. + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.RemoveIntWires(theObject, theWires) + if HealOp.IsDone() == 0: + print "SuppressInternalWires : ", HealOp.GetErrorCode() + return anObj + +def SuppressHoles(theObject, theWires): + """ + * Remove internal closed contours (holes) from the given object. + * \param theObject Shape to be processed. + * \param theWires Indices of wires to be removed, if EMPTY then the method + * removes ALL internal holes of the given object + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.FillHoles(theObject, theWires) + if HealOp.IsDone() == 0: + print "SuppressHoles : ", HealOp.GetErrorCode() + return anObj + +def CloseContour(theObject, theWires, isCommonVertex): + """ + * Close an open wire. + * \param theObject Shape to be processed. + * \param theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape, + * if -1, then theObject itself is a wire. + * \param isCommonVertex If TRUE : closure by creation of a common vertex, + * If FALS : closure by creation of an edge between ends. + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.CloseContour(theObject, theWires, isCommonVertex) + if HealOp.IsDone() == 0: + print "CloseContour : ", HealOp.GetErrorCode() + return anObj + +def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter): + """ + * Addition of a point to a given edge object. + * \param theObject Shape to be processed. + * \param theEdgeIndex Index of edge to be divided within theObject's shape, + * if -1, then theObject itself is the edge. + * \param theValue Value of parameter on edge or length parameter, + * depending on \a isByParameter. + * \param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], + * if FALSE : \a theValue is treated as a length parameter [0..1] + * \return New GEOM_Object, containing processed shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter) + if HealOp.IsDone() == 0: + print "DivideEdge : ", HealOp.GetErrorCode() + return anObj + +def GetFreeBoundary(theObject): + """ + * Get a list of wires (wrapped in GEOM_Object-s), + * that constitute a free boundary of the given shape. + * \param theObject Shape to get free boundary of. + * \return [status, theClosedWires, theOpenWires] + * status: FALSE, if an error(s) occured during the method execution. + * theClosedWires: Closed wires on the free boundary of the given shape. + * theOpenWires: Open wires on the free boundary of the given shape. + + * Example: see GEOM_TestHealing.py + """ + anObj = HealOp.GetFreeBoundary(theObject) + if HealOp.IsDone() == 0: + print "GetFreeBoundaries : ", HealOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Create advanced objects +# ----------------------------------------------------------------------------- + +def MakeCopy(theOriginal): + """ + * Create a copy of the given object + + * Example: see GEOM_TestAll.py + """ + anObj = InsertOp.MakeCopy(theOriginal) + if InsertOp.IsDone() == 0: + print "MakeCopy : ", InsertOp.GetErrorCode() + return anObj + +def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter): + """ + * Create a filling from the given compound of contours. + * \param theShape the compound of contours + * \param theMinDeg a minimal degree + * \param theMaxDeg a maximal degree + * \param theTol2D a 2d tolerance + * \param theTol3D a 3d tolerance + * \param theNbIter a number of iteration + * \return New GEOM_Object, containing the created filling surface. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter) + if PrimOp.IsDone() == 0: + print "MakeFilling : ", PrimOp.GetErrorCode() + return anObj + +def MakeGlueFaces(theShape, theTolerance): + """ + * Replace coincident faces in theShape by one face. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \return New GEOM_Object, containing a copy of theShape without coincident faces. + + * Example: see GEOM_Spanner.py + """ + anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance) + if ShapesOp.IsDone() == 0: + print "MakeGlueFaces : ", ShapesOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Boolean (Common, Cut, Fuse, Section) +# ----------------------------------------------------------------------------- + +def MakeBoolean(theShape1, theShape2, theOperation): + """ + * Perform one of boolean operations on two given shapes. + * \param theShape1 First argument for boolean operation. + * \param theShape2 Second argument for boolean operation. + * \param theOperation Indicates the operation to be done: + * 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestAll.py + """ + anObj = BoolOp.MakeBoolean(theShape1, theShape2, theOperation) + if BoolOp.IsDone() == 0: + print "MakeBoolean : ", BoolOp.GetErrorCode() + return anObj + +def MakeCommon(s1, s2): + """ + * Shortcut to MakeBoolean(s1, s2, 1) + + * Example: see GEOM_TestOthers.py + """ + return MakeBoolean(s1, s2, 1) + +def MakeCut(s1, s2): + """ + * Shortcut to MakeBoolean(s1, s2, 2) + + * Example: see GEOM_TestOthers.py + """ + return MakeBoolean(s1, s2, 2) + +def MakeFuse(s1, s2): + """ + * Shortcut to MakeBoolean(s1, s2, 3) + + * Example: see GEOM_TestOthers.py + """ + return MakeBoolean(s1, s2, 3) + +def MakeSection(s1, s2): + """ + * Shortcut to MakeBoolean(s1, s2, 4) + + * Example: see GEOM_TestOthers.py + """ + return MakeBoolean(s1, s2, 4) + +def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + """ + * Perform partition operation. + * \param ListShapes Shapes to be intersected. + * \param ListTools Shapes to intersect theShapes. + * \param ListKeepInside Shapes, outside which the results will be deleted. + * Each shape from theKeepInside must belong to theShapes also. + * \param ListRemoveInside Shapes, inside which the results will be deleted. + * Each shape from theRemoveInside must belong to theShapes also. + * \param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). + * \param RemoveWebs If TRUE, perform Glue 3D algorithm. + * \param ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE. + * \return New GEOM_Object, containing the result shapes. + + * Example: see GEOM_TestAll.py + """ + anObj = BoolOp.MakePartition(ListShapes, ListTools, + ListKeepInside, ListRemoveInside, + Limit, RemoveWebs, ListMaterials); + if BoolOp.IsDone() == 0: + print "MakePartition : ", BoolOp.GetErrorCode() + return anObj + +def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], + Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): + """ + * Shortcut to MakePartition() + + * Example: see GEOM_TestOthers.py + """ + anObj = MakePartition(ListShapes, ListTools, + ListKeepInside, ListRemoveInside, + Limit, RemoveWebs, ListMaterials); + return anObj + +def MakeHalfPartition(theShape, thePlane): + """ + * Perform partition of the Shape with the Plane + * \param theShape Shape to be intersected. + * \param thePlane Tool shape, to intersect theShape. + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestAll.py + """ + anObj = BoolOp.MakeHalfPartition(theShape, thePlane) + if BoolOp.IsDone() == 0: + print "MakeHalfPartition : ", BoolOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Transform objects +# ----------------------------------------------------------------------------- + +def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2): + """ + * Translate the given object along the vector, specified + * by its end points, creating its copy before the translation. + * \param theObject The object to be translated. + * \param thePoint1 Start point of translation vector. + * \param thePoint2 End point of translation vector. + * \return New GEOM_Object, containing the translated object. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2) + if TrsfOp.IsDone() == 0: + print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeTranslation(theObject, theDX, theDY, theDZ): + """ + * Translate the given object along the vector, specified + * by its components, creating its copy before the translation. + * \param theObject The object to be translated. + * \param theDX,theDY,theDZ Components of translation vector. + * \return New GEOM_Object, containing the translated object. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ) + if TrsfOp.IsDone() == 0: + print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeTranslationVector(theObject, theVector): + """ + * Translate the given object along the given vector, + * creating its copy before the translation. + * \param theObject The object to be translated. + * \param theVector The translation vector. + * \return New GEOM_Object, containing the translated object. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.TranslateVectorCopy(theObject, theVector) + if TrsfOp.IsDone() == 0: + print "TranslateVectorCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeRotation(theObject, theAxis, theAngle): + """ + * Rotate the given object around the given axis + * on the given angle, creating its copy before the rotatation. + * \param theObject The object to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in radians. + * \return New GEOM_Object, containing the rotated object. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.RotateCopy(theObject, theAxis, theAngle) + if TrsfOp.IsDone() == 0: + print "RotateCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeScaleTransform(theObject, thePoint, theFactor): + """ + * Scale the given object by the factor, creating its copy before the scaling. + * \param theObject The object to be scaled. + * \param thePoint Center point for scaling. + * \param theFactor Scaling factor value. + * \return New GEOM_Object, containing the scaled shape. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor) + if TrsfOp.IsDone() == 0: + print "ScaleShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByPlane(theObject, thePlane): + """ + * Create an object, symmetrical + * to the given one relatively the given plane. + * \param theObject The object to be mirrored. + * \param thePlane Plane of symmetry. + * \return New GEOM_Object, containing the mirrored shape. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MirrorPlaneCopy(theObject, thePlane) + if TrsfOp.IsDone() == 0: + print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByAxis(theObject, theAxis): + """ + * Create an object, symmetrical + * to the given one relatively the given axis. + * \param theObject The object to be mirrored. + * \param theAxis Axis of symmetry. + * \return New GEOM_Object, containing the mirrored shape. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis) + if TrsfOp.IsDone() == 0: + print "MirrorAxisCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMirrorByPoint(theObject, thePoint): + """ + * Create an object, symmetrical + * to the given one relatively the given point. + * \param theObject The object to be mirrored. + * \param thePoint Point of symmetry. + * \return New GEOM_Object, containing the mirrored shape. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MirrorPointCopy(theObject, thePoint) + if TrsfOp.IsDone() == 0: + print "MirrorPointCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakePosition(theObject, theStartLCS, theEndLCS): + """ + * Modify the Location of the given object by LCS + * creating its copy before the setting + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS) + if TrsfOp.IsDone() == 0: + print "PositionShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +def MakeOffset(theObject, theOffset): + """ + * Create new object as offset of the given one. + * \param theObject The base object for the offset. + * \param theOffset Offset value. + * \return New GEOM_Object, containing the offset object. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.OffsetShapeCopy(theObject, theOffset) + if TrsfOp.IsDone() == 0: + print "OffsetShapeCopy : ", TrsfOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Patterns +# ----------------------------------------------------------------------------- + +def MakeMultiTranslation1D(theObject, theVector, theStep, theNbTimes): + """ + * Translate the given object along the given vector a given number times + * \param theObject The object to be translated. + * \param theVector Direction of the translation. + * \param theStep Distance to translate on. + * \param theNbTimes Quantity of translations to be done. + * \return New GEOM_Object, containing compound of all + * the shapes, obtained after each translation. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes) + if TrsfOp.IsDone() == 0: + print "MultiTranslate1D : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMultiTranslation2D(theObject, theVector1, theStep1, theNbTimes1, + theVector2, theStep2, theNbTimes2): + """ + * Conseqently apply two specified translations to theObject specified number of times. + * \param theObject The object to be translated. + * \param theVector1 Direction of the first translation. + * \param theStep1 Step of the first translation. + * \param theNbTimes1 Quantity of translations to be done along theVector1. + * \param theVector2 Direction of the second translation. + * \param theStep2 Step of the second translation. + * \param theNbTimes2 Quantity of translations to be done along theVector2. + * \return New GEOM_Object, containing compound of all + * the shapes, obtained after each translation. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, + theVector2, theStep2, theNbTimes2) + if TrsfOp.IsDone() == 0: + print "MultiTranslate2D : ", TrsfOp.GetErrorCode() + return anObj + +def MultiRotate1D(theObject, theAxis, theNbTimes): + """ + * Rotate the given object around the given axis a given number times. + * Rotation angle will be 2*PI/theNbTimes. + * \param theObject The object to be rotated. + * \param theAxis The rotation axis. + * \param theNbTimes Quantity of rotations to be done. + * \return New GEOM_Object, containing compound of all the + * shapes, obtained after each rotation. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes) + if TrsfOp.IsDone() == 0: + print "MultiRotate1D : ", TrsfOp.GetErrorCode() + return anObj + +def MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2): + """ + * Rotate the given object around the + * given axis on the given angle a given number + * times and multi-translate each rotation result. + * Translation direction passes through center of gravity + * of rotated shape and its projection on the rotation axis. + * \param theObject The object to be rotated. + * \param theAxis Rotation axis. + * \param theAngle Rotation angle in graduces. + * \param theNbTimes1 Quantity of rotations to be done. + * \param theStep Translation distance. + * \param theNbTimes2 Quantity of translations to be done. + * \return New GEOM_Object, containing compound of all the + * shapes, obtained after each transformation. + + * Example: see GEOM_TestAll.py + """ + anObj = TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2) + if TrsfOp.IsDone() == 0: + print "MultiRotate2D : ", TrsfOp.GetErrorCode() + return anObj + +def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes): + """ + * The same, as MultiRotate1D(), but axis is given by direction and point + + * Example: see GEOM_TestOthers.py + """ + aVec = MakeLine(aPoint,aDir) + anObj = MultiRotate1D(aShape,aVec,aNbTimes) + return anObj + +def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2): + """ + * The same, as MultiRotate2D(), but axis is given by direction and point + + * Example: see GEOM_TestOthers.py + """ + aVec = MakeLine(aPoint,aDir) + anObj = MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2) + return anObj + +# ----------------------------------------------------------------------------- +# Local operations +# ----------------------------------------------------------------------------- + +def MakeFilletAll(theShape, theR): + """ + * Perform a fillet on all edges of the given shape. + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestOthers.py + """ + anObj = LocalOp.MakeFilletAll(theShape, theR) + if LocalOp.IsDone() == 0: + print "MakeFilletAll : ", LocalOp.GetErrorCode() + return anObj + +def MakeFillet(theShape, theR, theShapeType, theListShapes): + """ + * Perform a fillet on the specified edges/faces of the given shape + * \param theShape Shape, to perform fillet on. + * \param theR Fillet radius. + * \param theShapeType Type of shapes in . + * \param theListShapes Global indices of edges/faces to perform fillet on. + * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestAll.py + """ + anObj = None + if theShapeType == ShapeType["EDGE"]: + anObj = LocalOp.MakeFilletEdges(theShape, theR, theListShapes) + else: + anObj = LocalOp.MakeFilletFaces(theShape, theR, theListShapes) + if LocalOp.IsDone() == 0: + print "MakeFillet : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferAll(theShape, theD): + """ + * Perform a symmetric chamfer on all edges of the given shape. + * \param theShape Shape, to perform chamfer on. + * \param theD Chamfer size along each face. + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestOthers.py + """ + anObj = LocalOp.MakeChamferAll(theShape, theD) + if LocalOp.IsDone() == 0: + print "MakeChamferAll : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2): + """ + * Perform a chamfer on edges, common to the specified faces, + * with distance D1 on the Face1 + * \param theShape Shape, to perform chamfer on. + * \param theD1 Chamfer size along \a theFace1. + * \param theD2 Chamfer size along \a theFace2. + * \param theFace1,theFace2 Global indices of two faces of \a theShape. + * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestAll.py + """ + anObj = LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2) + if LocalOp.IsDone() == 0: + print "MakeChamferEdge : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferFaces(theShape, theD1, theD2, theFaces): + """ + * Perform a chamfer on all edges of the specified faces, + * with distance D1 on the first specified face (if several for one edge) + * \param theShape Shape, to perform chamfer on. + * \param theD1 Chamfer size along face from \a theFaces. If both faces, + * connected to the edge, are in \a theFaces, \a theD1 + * will be get along face, which is nearer to \a theFaces beginning. + * \param theD2 Chamfer size along another of two faces, connected to the edge. + * \param theFaces Sequence of global indices of faces of \a theShape. + * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID(). + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_TestAll.py + """ + anObj = LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces) + if LocalOp.IsDone() == 0: + print "MakeChamferFaces : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamfer(aShape,d1,d2,aShapeType,ListShape): + """ + * Shortcut to MakeChamferEdge() and MakeChamferFaces() + + * Example: see GEOM_TestOthers.py + """ + anObj = None + if aShapeType == ShapeType["EDGE"]: + anObj = MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1]) + else: + anObj = MakeChamferFaces(aShape,d1,d2,ListShape) + return anObj + +def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection): + """ + * Perform an Archimde operation on the given shape with given parameters. + * The object presenting the resulting face is returned + * \param theShape Shape to be put in water. + * \param theWeight Weight og the shape. + * \param theWaterDensity Density of the water. + * \param theMeshDeflection Deflection of the mesh, using to compute the section. + * \return New GEOM_Object, containing a section of \a theShape + * by a plane, corresponding to water level. + + * Example: see GEOM_TestAll.py + """ + anObj = LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection) + if LocalOp.IsDone() == 0: + print "MakeArchimede : ", LocalOp.GetErrorCode() + return anObj + +# ----------------------------------------------------------------------------- +# Information objects +# ----------------------------------------------------------------------------- + +def PointCoordinates(Point): + """ + * Get point coordinates + * \return [x, y, z] + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.PointCoordinates(Point) + if MeasuOp.IsDone() == 0: + print "PointCoordinates : ", MeasuOp.GetErrorCode() + return aTuple + +def BasicProperties(theShape): + """ + * Get summarized length of all wires, + * area of surface and volume of the given shape. + * \param theShape Shape to define properties of. + * \return [theLength, theSurfArea, theVolume] + * theLength: Summarized length of all wires of the given shape. + * theSurfArea: Area of surface of the given shape. + * theVolume: Volume of the given shape. + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.GetBasicProperties(theShape) + if MeasuOp.IsDone() == 0: + print "BasicProperties : ", MeasuOp.GetErrorCode() + return aTuple + +def BoundingBox(theShape): + """ + * Get parameters of bounding box of the given shape + * \param theShape Shape to obtain bounding box of. + * \return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] + * Xmin,Xmax: Limits of shape along OX axis. + * Ymin,Ymax: Limits of shape along OY axis. + * Zmin,Zmax: Limits of shape along OZ axis. + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.GetBoundingBox(theShape) + if MeasuOp.IsDone() == 0: + print "BoundingBox : ", MeasuOp.GetErrorCode() + return aTuple + +def Inertia(theShape): + """ + * Get inertia matrix and moments of inertia of theShape. + * \param theShape Shape to calculate inertia of. + * \return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz] + * I(1-3)(1-3): Components of the inertia matrix of the given shape. + * Ix,Iy,Iz: Moments of inertia of the given shape. + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.GetInertia(theShape) + if MeasuOp.IsDone() == 0: + print "Inertia : ", MeasuOp.GetErrorCode() + return aTuple + +def MinDistance(theShape1, theShape2): + """ + * Get minimal distance between the given shapes. + * \param theShape1,theShape2 Shapes to find minimal distance between. + * \return Value of the minimal distance between the given shapes. + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.GetMinDistance(theShape1, theShape2) + if MeasuOp.IsDone() == 0: + print "MinDistance : ", MeasuOp.GetErrorCode() + return aTuple[0] + +def Tolerance(theShape): + """ + * Get min and max tolerances of sub-shapes of theShape + * \param theShape Shape, to get tolerances of. + * \return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] + * FaceMin,FaceMax: Min and max tolerances of the faces. + * EdgeMin,EdgeMax: Min and max tolerances of the edges. + * VertMin,VertMax: Min and max tolerances of the vertices. + + * Example: see GEOM_TestMeasures.py + """ + aTuple = MeasuOp.GetTolerance(theShape) + if MeasuOp.IsDone() == 0: + print "Tolerance : ", MeasuOp.GetErrorCode() + return aTuple + +def WhatIs(theShape): + """ + * Obtain description of the given shape (number of sub-shapes of each type) + * \param theShape Shape to be described. + * \return Description of the given shape. + + * Example: see GEOM_TestMeasures.py + """ + aDescr = MeasuOp.WhatIs(theShape) + if MeasuOp.IsDone() == 0: + print "WhatIs : ", MeasuOp.GetErrorCode() + return aDescr + +def MakeCDG(theShape): + """ + * Get a point, situated at the centre of mass of theShape. + * \param theShape Shape to define centre of mass of. + * \return New GEOM_Object, containing the created point. + + * Example: see GEOM_TestMeasures.py + """ + anObj = MeasuOp.GetCentreOfMass(theShape) + if MeasuOp.IsDone() == 0: + print "GetCentreOfMass : ", MeasuOp.GetErrorCode() + return anObj + +def CheckShape(theShape): + """ + * Check a topology of the given shape. + * \param theShape Shape to check validity of. + * \return TRUE, if the shape "seems to be valid" from the topological point of view. + * If theShape is invalid, prints a description of problem. + + * Example: see GEOM_TestMeasures.py + """ + (IsValid, Status) = MeasuOp.CheckShape(theShape) + if MeasuOp.IsDone() == 0: + print "CheckShape : ", MeasuOp.GetErrorCode() + else: + if IsValid == 0: + print Status + return IsValid + +# ----------------------------------------------------------------------------- +# Import/Export objects +# ----------------------------------------------------------------------------- + +def Import(theFileName, theFormatName): + """ + * Import a shape from the BREP or IGES or STEP file + * (depends on given format) with given name. + * \param theFileName The file, containing the shape. + * \param theFormatName Specify format for the file reading. + * Available formats can be obtained with InsertOp.ImportTranslators() method. + * \return New GEOM_Object, containing the imported shape. + + * Example: see GEOM_TestOthers.py + """ + anObj = InsertOp.Import(theFileName, theFormatName) + if InsertOp.IsDone() == 0: + print "Import : ", InsertOp.GetErrorCode() + return anObj + +def ImportBREP(theFileName): + """ + * Shortcut to Import() for BREP format + + * Example: see GEOM_TestOthers.py + """ + return Import(theFileName, "BREP") + +def ImportIGES(theFileName): + """ + * Shortcut to Import() for IGES format + + * Example: see GEOM_TestOthers.py + """ + return Import(theFileName, "IGES") + +def ImportSTEP(theFileName): + """ + * Shortcut to Import() for STEP format + + * Example: see GEOM_TestOthers.py + """ + return Import(theFileName, "STEP") + +def Export(theObject, theFileName, theFormatName): + """ + * Export the given shape into a file with given name. + * \param theObject Shape to be stored in the file. + * \param theFileName Name of the file to store the given shape in. + * \param theFormatName Specify format for the shape storage. + * Available formats can be obtained with InsertOp.ImportTranslators() method. + + * Example: see GEOM_TestOthers.py + """ + InsertOp.Export(theObject, theFileName, theFormatName) + if InsertOp.IsDone() == 0: + print "Export : ", InsertOp.GetErrorCode() + +def ExportBREP(theObject, theFileName): + """ + * Shortcut to Export() for BREP format + + * Example: see GEOM_TestOthers.py + """ + return Export(theObject, theFileName, "BREP") + +def ExportIGES(theObject, theFileName): + """ + * Shortcut to Export() for IGES format + + * Example: see GEOM_TestOthers.py + """ + return Export(theObject, theFileName, "IGES") + +def ExportSTEP(theObject, theFileName): + """ + * Shortcut to Export() for STEP format + + * Example: see GEOM_TestOthers.py + """ + return Export(theObject, theFileName, "STEP") + +# ----------------------------------------------------------------------------- +# Block operations +# ----------------------------------------------------------------------------- + +def MakeQuad(E1, E2, E3, E4): + """ + * Create a quadrangle face from four edges. Order of Edges is not + * important. It is not necessary that edges share the same vertex. + * \param E1,E2,E3,E4 Edges for the face bound. + * \return New GEOM_Object, containing the created face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeQuad(E1, E2, E3, E4) + if BlocksOp.IsDone() == 0: + print "MakeQuad : ", BlocksOp.GetErrorCode() + return anObj + +def MakeQuad2Edges(E1, E2): + """ + * Create a quadrangle face on two edges. + * The missing edges will be built by creating the shortest ones. + * \param E1,E2 Two opposite edges for the face. + * \return New GEOM_Object, containing the created face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeQuad2Edges(E1, E2) + if BlocksOp.IsDone() == 0: + print "MakeQuad2Edges : ", BlocksOp.GetErrorCode() + return anObj + +def MakeQuad4Vertices(V1, V2, V3, V4): + """ + * Create a quadrangle face with specified corners. + * The missing edges will be built by creating the shortest ones. + * \param V1,V2,V3,V4 Corner vertices for the face. + * \return New GEOM_Object, containing the created face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4) + if BlocksOp.IsDone() == 0: + print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode() + return anObj + +def MakeHexa(F1, F2, F3, F4, F5, F6): + """ + * Create a hexahedral solid, bounded by the six given faces. Order of + * faces is not important. It is not necessary that Faces share the same edge. + * \param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid. + * \return New GEOM_Object, containing the created solid. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6) + if BlocksOp.IsDone() == 0: + print "MakeHexa : ", BlocksOp.GetErrorCode() + return anObj + +def MakeHexa2Faces(F1, F2): + """ + * Create a hexahedral solid between two given faces. + * The missing faces will be built by creating the smallest ones. + * \param F1,F2 Two opposite faces for the hexahedral solid. + * \return New GEOM_Object, containing the created solid. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeHexa2Faces(F1, F2) + if BlocksOp.IsDone() == 0: + print "MakeHexa2Faces : ", BlocksOp.GetErrorCode() + return anObj + +def GetPoint(theShape, theX, theY, theZ, theEpsilon): + """ + * Get a vertex, found in the given shape by its coordinates. + * \param theShape Block or a compound of blocks. + * \param theX,theY,theZ Coordinates of the sought vertex. + * \param theEpsilon Maximum allowed distance between the resulting + * vertex and point with the given coordinates. + * \return New GEOM_Object, containing the found vertex. + + * Example: see GEOM_TestOthers.py + """ + anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon) + if BlocksOp.IsDone() == 0: + print "GetPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetEdge(theShape, thePoint1, thePoint2): + """ + * Get an edge, found in the given shape by two given vertices. + * \param theShape Block or a compound of blocks. + * \param thePoint1,thePoint2 Points, close to the ends of the desired edge. + * \return New GEOM_Object, containing the found edge. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2) + if BlocksOp.IsDone() == 0: + print "GetEdge : ", BlocksOp.GetErrorCode() + return anObj + +def GetEdgeNearPoint(theShape, thePoint): + """ + * Find an edge of the given shape, which has minimal distance to the given point. + * \param theShape Block or a compound of blocks. + * \param thePoint Point, close to the desired edge. + * \return New GEOM_Object, containing the found edge. + + * Example: see GEOM_TestOthers.py + """ + anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint) + if BlocksOp.IsDone() == 0: + print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4): + """ + * Returns a face, found in the given shape by four given corner vertices. + * \param theShape Block or a compound of blocks. + * \param thePoint1-thePoint4 Points, close to the corners of the desired face. + * \return New GEOM_Object, containing the found face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4) + if BlocksOp.IsDone() == 0: + print "GetFaceByPoints : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByEdges(theShape, theEdge1, theEdge2): + """ + * Get a face of block, found in the given shape by two given edges. + * \param theShape Block or a compound of blocks. + * \param theEdge1,theEdge2 Edges, close to the edges of the desired face. + * \return New GEOM_Object, containing the found face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2) + if BlocksOp.IsDone() == 0: + print "GetFaceByEdges : ", BlocksOp.GetErrorCode() + return anObj + +def GetOppositeFace(theBlock, theFace): + """ + * Find a face, opposite to the given one in the given block. + * \param theBlock Must be a hexahedral solid. + * \param theFace Face of \a theBlock, opposite to the desired face. + * \return New GEOM_Object, containing the found face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetOppositeFace(theBlock, theFace) + if BlocksOp.IsDone() == 0: + print "GetOppositeFace : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceNearPoint(theShape, thePoint): + """ + * Find a face of the given shape, which has minimal distance to the given point. + * \param theShape Block or a compound of blocks. + * \param thePoint Point, close to the desired face. + * \return New GEOM_Object, containing the found face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint) + if BlocksOp.IsDone() == 0: + print "GetFaceNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetFaceByNormale(theBlock, theVector): + """ + * Find a face of block, whose outside normale has minimal angle with the given vector. + * \param theShape Block or a compound of blocks. + * \param theVector Vector, close to the normale of the desired face. + * \return New GEOM_Object, containing the found face. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetFaceByNormale(theBlock, theVector) + if BlocksOp.IsDone() == 0: + print "GetFaceByNormale : ", BlocksOp.GetErrorCode() + return anObj + +def CheckCompoundOfBlocks(theCompound): + """ + * Check, if the compound of blocks is given. + * To be considered as a compound of blocks, the + * given shape must satisfy the following conditions: + * - Each element of the compound should be a Block (6 faces and 12 edges). + * - A connection between two Blocks should be an entire quadrangle face or an entire edge. + * - The compound should be connexe. + * - The glue between two quadrangle faces should be applied. + * \param theCompound The compound to check. + * \return TRUE, if the given shape is a compound of blocks. + * If theCompound is not valid, prints all discovered errors. + + * Example: see GEOM_Spanner.py + """ + (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound) + if BlocksOp.IsDone() == 0: + print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode() + else: + if IsValid == 0: + Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors) + print Descr + return IsValid + +def RemoveExtraEdges(theShape): + """ + * Remove all seam and degenerated edges from \a theShape. + * Unite faces and edges, sharing one surface. + * \param theShape The compound or single solid to remove irregular edges from. + * \return Improved shape. + + * Example: see GEOM_TestOthers.py + """ + anObj = BlocksOp.RemoveExtraEdges(theShape) + if BlocksOp.IsDone() == 0: + print "RemoveExtraEdges : ", BlocksOp.GetErrorCode() + return anObj + +def CheckAndImprove(theShape): + """ + * Check, if the given shape is a blocks compound. + * Fix all detected errors. + * \note Single block can be also fixed by this method. + * \param theCompound The compound to check and improve. + * \return Improved compound. + + * Example: see GEOM_TestOthers.py + """ + anObj = BlocksOp.CheckAndImprove(theShape) + if BlocksOp.IsDone() == 0: + print "CheckAndImprove : ", BlocksOp.GetErrorCode() + return anObj + +def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces): + """ + * Get all the blocks, contained in the given compound. + * \param theCompound The compound to explode. + * \param theMinNbFaces If solid has lower number of faces, it is not a block. + * \param theMaxNbFaces If solid has higher number of faces, it is not a block. + * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted. + * \return List of GEOM_Objects, containing the retrieved blocks. + + * Example: see GEOM_TestOthers.py + """ + aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces) + if BlocksOp.IsDone() == 0: + print "MakeBlockExplode : ", BlocksOp.GetErrorCode() + return aList + +def GetBlockNearPoint(theCompound, thePoint): + """ + * Find block, containing the given point inside its volume or on boundary. + * \param theCompound Compound, to find block in. + * \param thePoint Point, close to the desired block. If the point lays on + * boundary between some blocks, we return block with nearest center. + * \return New GEOM_Object, containing the found block. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint) + if BlocksOp.IsDone() == 0: + print "GetBlockNearPoint : ", BlocksOp.GetErrorCode() + return anObj + +def GetBlockByParts(theCompound, theParts): + """ + * Find block, containing all the elements, passed as the parts, or maximum quantity of them. + * \param theCompound Compound, to find block in. + * \param theParts List of faces and/or edges and/or vertices to be parts of the found block. + * \return New GEOM_Object, containing the found block. + + * Example: see GEOM_TestOthers.py + """ + anObj = BlocksOp.GetBlockByParts(theCompound, theParts) + if BlocksOp.IsDone() == 0: + print "GetBlockByParts : ", BlocksOp.GetErrorCode() + return anObj + +def GetBlocksByParts(theCompound, theParts): + """ + * Return all blocks, containing all the elements, passed as the parts. + * \param theCompound Compound, to find blocks in. + * \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks. + * \return List of GEOM_Objects, containing the found blocks. + + * Example: see GEOM_Spanner.py + """ + aList = BlocksOp.GetBlocksByParts(theCompound, theParts) + if BlocksOp.IsDone() == 0: + print "GetBlocksByParts : ", BlocksOp.GetErrorCode() + return aList + +def MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes): + """ + * Multi-transformate block and glue the result. + * Transformation is defined so, as to superpose direction faces. + * \param Block Hexahedral solid to be multi-transformed. + * \param DirFace1 ID of First direction face. + * \param DirFace2 ID of Second direction face. + * \param NbTimes Quantity of transformations to be done. + * \note Unique ID of sub-shape can be obtained, using method GetSubShapeID(). + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes) + if BlocksOp.IsDone() == 0: + print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode() + return anObj + +def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU, + DirFace1V, DirFace2V, NbTimesV): + """ + * Multi-transformate block and glue the result. + * \param Block Hexahedral solid to be multi-transformed. + * \param DirFace1U,DirFace2U IDs of Direction faces for the first transformation. + * \param DirFace1V,DirFace2V IDs of Direction faces for the second transformation. + * \param NbTimesU,NbTimesV Quantity of transformations to be done. + * \return New GEOM_Object, containing the result shape. + + * Example: see GEOM_Spanner.py + """ + anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU, + DirFace1V, DirFace2V, NbTimesV) + if BlocksOp.IsDone() == 0: + print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode() + return anObj + +def Propagate(theShape): + """ + * Build all possible propagation groups. + * Propagation group is a set of all edges, opposite to one (main) + * edge of this group directly or through other opposite edges. + * Notion of Opposite Edge make sence only on quadrangle face. + * \param theShape Shape to build propagation groups on. + * \return List of GEOM_Objects, each of them is a propagation group. + + * Example: see GEOM_TestOthers.py + """ + listChains = BlocksOp.Propagate(theShape) + if BlocksOp.IsDone() == 0: + print "Propagate : ", BlocksOp.GetErrorCode() + return listChains + +# ----------------------------------------------------------------------------- +# Group operations +# ----------------------------------------------------------------------------- + +def CreateGroup(theMainShape, theShapeType): + """ + * Creates a new group which will store sub shapes of theMainShape + * \param theMainShape is a GEOM object on which the group is selected + * \param theShapeType defines a shape type of the group + * \return a newly created GEOM group + + * Example: see GEOM_TestOthers.py + """ + anObj = GroupOp.CreateGroup(theMainShape, theShapeType) + if GroupOp.IsDone() == 0: + print "CreateGroup : ", GroupOp.GetErrorCode() + return anObj + +def AddObject(theGroup, theSubShapeID): + """ + * Adds a sub object with ID theSubShapeId to the group + * \param theGroup is a GEOM group to which the new sub shape is added + * \param theSubShapeID is a sub shape ID in the main object. + * \note Use method GetSubShapeID() to get an unique ID of the sub shape + + * Example: see GEOM_TestOthers.py + """ + GroupOp.AddObject(theGroup, theSubShapeID) + if GroupOp.IsDone() == 0: + print "AddObject : ", GroupOp.GetErrorCode() + +def RemoveObject(theGroup, theSubShapeID): + """ + * Removes a sub object with ID \a theSubShapeId from the group + * \param theGroup is a GEOM group from which the new sub shape is removed + * \param theSubShapeID is a sub shape ID in the main object. + * \note Use method GetSubShapeID() to get an unique ID of the sub shape + + * Example: see GEOM_TestOthers.py + """ + GroupOp.RemoveObject(theGroup, theSubShapeID) + if GroupOp.IsDone() == 0: + print "RemoveObject : ", GroupOp.GetErrorCode() + +def UnionList (theGroup, theSubShapes): + """ + * Adds to the group all the given shapes. No errors, if some shapes are alredy included. + * \param theGroup is a GEOM group to which the new sub shapes are added. + * \param theSubShapes is a list of sub shapes to be added. + + * Example: see GEOM_TestOthers.py + """ + GroupOp.UnionList(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "UnionList : ", GroupOp.GetErrorCode() + +def UnionIDs(theGroup, theSubShapes): + """ + * Works like the above method, but argument + * theSubShapes here is a list of sub-shapes indices + """ + GroupOp.UnionIDs(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "UnionIDs : ", GroupOp.GetErrorCode() + +def DifferenceList (theGroup, theSubShapes): + """ + * Removes from the group all the given shapes. No errors, if some shapes are not included. + * \param theGroup is a GEOM group from which the sub-shapes are removed. + * \param theSubShapes is a list of sub-shapes to be removed. + + * Example: see GEOM_TestOthers.py + """ + GroupOp.DifferenceList(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "DifferenceList : ", GroupOp.GetErrorCode() + +def DifferenceIDs(theGroup, theSubShapes): + """ + * Works like the above method, but argument + * theSubShapes here is a list of sub-shapes indices + """ + GroupOp.DifferenceIDs(theGroup, theSubShapes) + if GroupOp.IsDone() == 0: + print "DifferenceIDs : ", GroupOp.GetErrorCode() + +def GetObjectIDs(theGroup): + """ + * Returns a list of sub objects ID stored in the group + * \param theGroup is a GEOM group for which a list of IDs is requested + + * Example: see GEOM_TestOthers.py + """ + ListIDs = GroupOp.GetObjects(theGroup) + if GroupOp.IsDone() == 0: + print "GetObjectIDs : ", GroupOp.GetErrorCode() + return ListIDs + +def GetType(theGroup): + """ + * Returns a type of sub objects stored in the group + * \param theGroup is a GEOM group which type is returned. + + * Example: see GEOM_TestOthers.py + """ + aType = GroupOp.GetType(theGroup) + if GroupOp.IsDone() == 0: + print "GetType : ", GroupOp.GetErrorCode() + return aType + +def GetMainShape(theGroup): + """ + * Returns a main shape associated with the group + * \param theGroup is a GEOM group for which a main shape object is requested + * \return a GEOM object which is a main shape for theGroup + + * Example: see GEOM_TestOthers.py + """ + anObj = GroupOp.GetMainShape(theGroup) + if GroupOp.IsDone() == 0: + print "GetMainShape : ", GroupOp.GetErrorCode() + return anObj + +def GetEdgesByLength (theShape, min_length, max_length, include_min = 1, include_max = 1): + """ + Create group of edges of theShape, whose length is in range [min_length, max_length]. + If include_min/max == 0, edges with length == min/max_length will not be included in result. + """ + + edges = SubShapeAll(theShape, ShapeType["EDGE"]) + edges_in_range = [] + for edge in edges: + Props = BasicProperties(edge) + if min_length <= Props[0] and Props[0] <= max_length: + if (not include_min) and (min_length == Props[0]): + skip = 1 + else: + if (not include_max) and (Props[0] == max_length): + skip = 1 + else: + edges_in_range.append(edge) + + if len(edges_in_range) <= 0: + print "No edges found by given criteria" + return 0 + + group_edges = CreateGroup(theShape, ShapeType["EDGE"]) + UnionList(group_edges, edges_in_range) + + return group_edges + +def SelectEdges (min_length, max_length, include_min = 1, include_max = 1): + """ + Create group of edges of selected shape, whose length is in range [min_length, max_length]. + If include_min/max == 0, edges with length == min/max_length will not be included in result. + """ + + nb_selected = sg.SelectedCount() + if nb_selected < 1: + print "Select a shape before calling this function, please." + return 0 + if nb_selected > 1: + print "Only one shape must be selected" + return 0 + + id_shape = sg.getSelected(0) + shape = IDToObject( id_shape ) + + group_edges = GetEdgesByLength(shape, min_length, max_length, include_min, include_max) + + left_str = " < " + right_str = " < " + if include_min: left_str = " <= " + if include_max: right_str = " <= " + + addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length` + + left_str + "length" + right_str + `max_length`) + + sg.updateObjBrowser(1) + + return group_edges + +def addPath(Path): + """ + * Add Path to load python scripts from + """ + if (sys.path.count(Path) < 1): + sys.path.append(Path) diff --git a/src/GEOM_SWIG/libGEOM_Swig.i b/src/GEOM_SWIG/libGEOM_Swig.i new file mode 100644 index 000000000..f10a5baea --- /dev/null +++ b/src/GEOM_SWIG/libGEOM_Swig.i @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : libGeometry_Swig.i +// Created : Tue Mar 26 15:04:48 2002 +// Author : Nicolas REJNERI, Paul RASCLE +// Project : SALOME +// Module : GEOM +// Copyright : Open CASCADE, EDF 2002 +// $Header$ + +%module libGEOM_Swig + +%include "GeometryGUI_Swig.i" + diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx new file mode 100644 index 000000000..5dde019e0 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -0,0 +1,345 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GenerationGUI_FillingDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "GenerationGUI_FillingDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GEOMImpl_Types.hxx" + +#include + +#include "utilities.h" + +//================================================================================= +// class : GenerationGUI_FillingDlg() +// purpose : Constructs a GenerationGUI_FillingDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GenerationGUI_FillingDlg::GenerationGUI_FillingDlg(GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) +{ + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FILLING"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FILLING_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FILLING")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel5Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_FILLING_COMPOUND")); + GroupPoints->TextLabel2->setText(tr("GEOM_FILLING_MIN_DEG")); + GroupPoints->TextLabel3->setText(tr("GEOM_FILLING_TOL_2D")); + GroupPoints->TextLabel4->setText(tr("GEOM_FILLING_NB_ITER")); + GroupPoints->TextLabel5->setText(tr("GEOM_FILLING_MAX_DEG")); + GroupPoints->TextLabel6->setText(tr("GEOM_FILLING_TOL_3D")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + +//================================================================================= +// function : ~GenerationGUI_FillingDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_FillingDlg::~GenerationGUI_FillingDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + + myMinDeg = 2; + myMaxDeg = 5; + myTol3D = 0.0001; + myTol2D = 0.0001; + myNbIter = 5; + myOkCompound = false; + + globalSelection( GEOM_COMPOUND ); + + double SpecificStep1 = 1; + double SpecificStep2 = 0.0001; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_1->RangeStepAndValidator(2.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_2->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); + GroupPoints->SpinBox_3->RangeStepAndValidator(1.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_4->RangeStepAndValidator(1.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_5->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); + + GroupPoints->SpinBox_1->SetValue(myMinDeg); + GroupPoints->SpinBox_2->SetValue(myTol2D); + GroupPoints->SpinBox_3->SetValue(myNbIter); + GroupPoints->SpinBox_4->SetValue(myMaxDeg); + GroupPoints->SpinBox_5->SetValue(myTol3D); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_3, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_4, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_5, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_FILLING")); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool GenerationGUI_FillingDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void GenerationGUI_FillingDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkCompound = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if (!testResult) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + TopoDS_Shape S; + myOkCompound = false; + + if ( GEOMBase::GetShape(aSelectedObject, S) && + S.ShapeType() == TopAbs_COMPOUND) + { + // myCompound should be a compound of edges + for ( TopoDS_Iterator it( S ); it.More(); it.Next() ) + if ( it.Value().ShapeType() != TopAbs_EDGE ) + return; + myCompound = aSelectedObject; + myOkCompound = true; + } + } + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_ALLSHAPES ); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_COMPOUND ); + this->SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection( GEOM_COMPOUND ); + displayPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_1) + myMinDeg = int(newValue); + else if(send == GroupPoints->SpinBox_2) + myTol2D = newValue; + else if(send == GroupPoints->SpinBox_3) + myNbIter = int(newValue); + else if(send == GroupPoints->SpinBox_4) + myMaxDeg = int(newValue); + else if(send == GroupPoints->SpinBox_5) + myTol3D = newValue; + + displayPreview(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool GenerationGUI_FillingDlg::isValid( QString& ) +{ + return myOkCompound > 0; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling( + myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx new file mode 100644 index 000000000..5cf2f1458 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -0,0 +1,308 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GenerationGUI_PipeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "GenerationGUI_PipeDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include +#include +#include +#if OCC_VERSION_MAJOR >= 5 +#include +#else +#include +#endif + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +//================================================================================= +// class : GenerationGUI_PipeDlg() +// purpose : Constructs a GenerationGUI_PipeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PIPE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PIPE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_PipeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_PipeDlg::~GenerationGUI_PipeDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myOkBase = myOkPath = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName(tr("GEOM_PIPE")); + + globalSelection( GEOM_ALLSHAPES ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnAply() +// purpose : +//================================================================================= +bool GenerationGUI_PipeDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void GenerationGUI_PipeDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPath = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if (!testResult) + return; + + TopoDS_Shape S; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myOkBase = false; + + if(!GEOMBase::GetShape(aSelectedObject, S) || + S.ShapeType() == TopAbs_COMPSOLID || + S.ShapeType() == TopAbs_COMPOUND || + S.ShapeType() == TopAbs_SOLID || + S.ShapeType() == TopAbs_SHAPE) + return; + + myBase = aSelectedObject; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myOkPath = false; + + if(!GEOMBase::GetShape(aSelectedObject, S) || + !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) + return; + + myPath = aSelectedObject; + myOkPath = true; + } + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void GenerationGUI_PipeDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool GenerationGUI_PipeDlg::isValid( QString& ) +{ + return myOkBase && myOkPath; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool GenerationGUI_PipeDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + getOperation() )->MakePipe( myBase, myPath ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + + + diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx new file mode 100644 index 000000000..bc3aa51dc --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -0,0 +1,343 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GenerationGUI_PrismDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "GenerationGUI_PrismDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include +#include "GEOMImpl_Types.hxx" + +#include +#include + +#include "utilities.h" + +//================================================================================= +// class : GenerationGUI_PrismDlg() +// purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PRISM_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PRISM")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints->CheckButton1->hide(); + GroupPoints->GroupBox1->setTitle(tr("GEOM_PRISM_BSV")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_PrismDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myOkBase = myOkVec = false; + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, +999.999, step, 3); + GroupPoints->SpinBox_DX->SetValue(100.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_PRISM")); + + globalSelection( GEOM_ALLSHAPES ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool GenerationGUI_PrismDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void GenerationGUI_PrismDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkVec = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if (!testResult) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myOkBase = false; + TopoDS_Shape S; + + if ( !GEOMBase::GetShape(aSelectedObject, S) || + S.ShapeType() <= 2) + return; + + myBase = aSelectedObject; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myVec = aSelectedObject; + myOkVec = true; + } + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_ALLSHAPES ); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void GenerationGUI_PrismDlg::enterEvent(QEvent * e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + displayPreview(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + + +//================================================================================= +// function : getHeight() +// purpose : +//================================================================================= +double GenerationGUI_PrismDlg::getHeight() const +{ + return GroupPoints->SpinBox_DX->GetValue(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool GenerationGUI_PrismDlg::isValid( QString& ) +{ + return myOkBase && myOkVec; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool GenerationGUI_PrismDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakePrismVecH ( myBase, myVec, getHeight() ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + + +//================================================================================= +// function : onReverse() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onReverse() +{ + double anOldValue = GroupPoints->SpinBox_DX->GetValue(); + GroupPoints->SpinBox_DX->SetValue( -anOldValue ); +} + + + diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx new file mode 100644 index 000000000..14c0d011d --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -0,0 +1,363 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GenerationGUI_RevolDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "GenerationGUI_RevolDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include +#include +#include +#include "GEOMImpl_Types.hxx" + +#include +#include + +#include "utilities.h" + +//================================================================================= +// class : GenerationGUI_RevolDlg() +// purpose : Constructs a GenerationGUI_RevolDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REVOL"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_REVOLUTION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_REVOLUTION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints->CheckButton1->hide(); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); + GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_RevolDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myOkBase = myOkAxis = false; + + double SpecificStep = 5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(45.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName(tr("GEOM_REVOLUTION")); + + globalSelection( GEOM_ALLSHAPES ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool GenerationGUI_RevolDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + +//======================================================================= +//function : isAcceptableBase +//purpose : return true if theBase can be used as algo argument +//======================================================================= + +static bool isAcceptableBase(const TopoDS_Shape& theBase) +{ + switch ( theBase.ShapeType() ) { + case TopAbs_VERTEX: + case TopAbs_EDGE: + case TopAbs_WIRE: + case TopAbs_FACE: + case TopAbs_SHELL: + return true; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + return false; + case TopAbs_COMPOUND: { + TopExp_Explorer exp( theBase, TopAbs_SOLID); + return !exp.More(); + } + default: + return false; + } + return false; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void GenerationGUI_RevolDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkAxis = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if (!testResult) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + TopoDS_Shape S; + myOkBase = false; + + if ( !GEOMBase::GetShape(aSelectedObject, S) || !isAcceptableBase( S ) ) + return; + + myBase = aSelectedObject; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myAxis = aSelectedObject; + myOkAxis = true; + } + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_ALLSHAPES ); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + displayPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : getAngle() +// purpose : +//================================================================================= +double GenerationGUI_RevolDlg::getAngle() const +{ + return GroupPoints->SpinBox_DX->GetValue(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool GenerationGUI_RevolDlg::isValid( QString& ) +{ + return myOkBase && myOkAxis; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool GenerationGUI_RevolDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + + +//================================================================================= +// function : onReverse() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::onReverse() +{ + double anOldValue = GroupPoints->SpinBox_DX->GetValue(); + GroupPoints->SpinBox_DX->SetValue( -anOldValue ); +} diff --git a/src/GroupGUI/GroupGUI.cxx b/src/GroupGUI/GroupGUI.cxx new file mode 100644 index 000000000..5bfaf9fca --- /dev/null +++ b/src/GroupGUI/GroupGUI.cxx @@ -0,0 +1,152 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : GroupGUI.cxx +// Author : Sergey ANIKIN +// Module : GEOM +// $Header$ + +#include "GroupGUI.h" +#include "GroupGUI_GroupDlg.h" + +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" +#include "SUIT_MessageBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" +#include "LightApp_SelectionMgr.h" + +GroupGUI* GroupGUI::myGUIObject = 0; + +//======================================================================= +// function : GetGroupGUI() +// purpose : Get the only GroupGUI object [ static ] +//======================================================================= +GroupGUI* GroupGUI::GetGroupGUI(GeometryGUI* parent) +{ + if ( myGUIObject == 0 ) + myGUIObject = new GroupGUI(parent); + + return myGUIObject; +} + +//======================================================================= +// function : GroupGUI() +// purpose : Constructor +//======================================================================= +GroupGUI::GroupGUI(GeometryGUI* parent) +: GEOMGUI(parent) +{ +} + + +//======================================================================= +// function : ~GroupGUI() +// purpose : Destructor +//======================================================================= +GroupGUI::~GroupGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +{ + getGeometryGUI()->EmitSignalDeactivateDialog(); + + QDialog* aDlg = NULL; + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + if ( aStudy->GetProperties()->IsLocked() ) { + SUIT_MessageBox::warn1 ( parent, + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + return false; + } + + switch ( theCommandID ) { + case 800: + case 8001: + aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, parent, ""); + break; + case 801: + { + SALOME_ListIO aList; + aList.Clear(); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) + aSelMgr->selectedObjects( aList ); + } + + if ( aList.Extent() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult ); + + if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { + aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, parent, "" ); + break; + } + } + SUIT_MessageBox::warn1 ( parent, + tr("WRN_WARNING"), + tr("NO_GROUP"), + tr("BUT_OK") ); + break; + } + default: + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; + } + + if ( aDlg != NULL ) + aDlg->show(); + + return true; +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WNT + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI(GeometryGUI* p) + { + return GroupGUI::GetGroupGUI(p); + } +} diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx new file mode 100644 index 000000000..041774bf4 --- /dev/null +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -0,0 +1,729 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : GroupGUI_GroupDlg.cxx +// Author : Sergey ANIKIN +// Module : GEOM +// $Header$ + +#include "GroupGUI_GroupDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" +#include "LightApp_SelectionMgr.h" + +#include "GEOMBase.h" + +#include "GEOMImpl_Types.hxx" + +#include +#include +#include +#include + +#include +#include + + + + +GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, + QWidget* parent, + const char* name, + bool modal, + WFlags fl) + :GEOMBase_Skeleton( parent, "GroupGUI_GroupDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myMode( mode ), + myBusy( false ) +{ + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_VERTEX" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_EDGE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_FACE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_SOLID" ) ) ); + + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + + setCaption( myMode == CreateGroup ? tr( "CREATE_GROUP_TITLE" ) : tr( "EDIT_GROUP_TITLE" ) ); + + // Shape type button group + GroupConstructors->setEnabled( myMode == CreateGroup ); + GroupConstructors->setTitle( tr( "SHAPE_TYPE" ) ); + RadioButton1->setPixmap( image0 ); + RadioButton2->setPixmap( image1 ); + RadioButton3->setPixmap( image2 ); + RadioButton4->setPixmap( image3 ); + RadioButton4->show(); + + // Group name + GroupBoxName->setTitle( tr( "GROUP_NAME" ) ); + + // Main shape and sub-shapes + GroupMedium = new QGroupBox( 1, Qt::Vertical, tr( "MAIN_SUB_SHAPES" ), this ); + GroupMedium->setInsideMargin( 10 ); + Layout1->addWidget( GroupMedium, 2, 0 ); + + QWidget* aFrame = new QWidget( GroupMedium ); + QGridLayout* aMedLayout = new QGridLayout( aFrame, 4, 4, 0, 6 ); + + QLabel* aMainLabel = new QLabel( tr( "MAIN_SHAPE" ), aFrame ); + + mySelBtn = new QPushButton( aFrame ); + mySelBtn->setPixmap( iconSelect ); + mySelBtn->setEnabled( myMode == CreateGroup ); + + myMainName = new QLineEdit( aFrame ); + myMainName->setReadOnly( true ); + myMainName->setEnabled( myMode == CreateGroup ); + + mySelSubBtn = new QPushButton( tr( "SELECT_SUB_SHAPES" ), aFrame ); + mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), aFrame ); + myAddBtn = new QPushButton( tr( "ADD" ), aFrame ); + myRemBtn = new QPushButton( tr( "REMOVE" ), aFrame ); + myIdList = new QListBox( aFrame ); + + myIdList->setSelectionMode( QListBox::Extended ); + myIdList->setRowMode( QListBox::FitToWidth ); + + aMedLayout->addWidget( aMainLabel, 0, 0 ); + aMedLayout->addWidget( mySelBtn, 0, 1 ); + aMedLayout->addMultiCellWidget( myMainName, 0, 0, 2, 3 ); + aMedLayout->addMultiCellWidget( mySelSubBtn, 1, 1, 0, 2 ); + aMedLayout->addWidget( mySelAllBtn, 1, 3 ); + aMedLayout->addMultiCellWidget( myIdList, 2, 3, 0, 2 ); + aMedLayout->addWidget( myAddBtn, 2, 3 ); + aMedLayout->addWidget( myRemBtn, 3, 3 ); + + Init(); +} + +GroupGUI_GroupDlg::~GroupGUI_GroupDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::Init() +{ + // san -- TODO: clear selected sub-shapes... + + if ( myMode == CreateGroup ) { + initName( tr( "GROUP_PREFIX" ) ); + + // Get ready for main shape selection + myEditCurrentArgument = myMainName; + + connect( GroupConstructors, SIGNAL( clicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + connect( mySelBtn, SIGNAL( clicked() ), this, SLOT(SetEditCurrentArgument())); + } + else if ( myMode == EditGroup && IObjectCount() ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { + myGroup = anObj; + + ResultName->setText( GEOMBase::GetName( myGroup ) ); + + GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); + myMainObj = anOp->GetMainShape( myGroup ); + if ( !CORBA::is_nil( myMainObj ) ) + myMainName->setText( GEOMBase::GetName( myMainObj ) ); + + setShapeType( (TopAbs_ShapeEnum)anOp->GetType( myGroup ) ); + + GEOM::ListOfLong_var aCurrList = anOp->GetObjects( myGroup ); + QListBoxItem* anItem; + for ( int i = 0, n = aCurrList->length(); i < n; i++ ) { + anItem = new QListBoxText( QString( "%1" ).arg(aCurrList[i] ) ); + myIdList->insertItem( anItem ); + } + + myEditCurrentArgument = 0; + } + } + + connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( mySelSubBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( selectAllSubShapes() ) ); + connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( add() ) ); + connect( myRemBtn, SIGNAL( clicked() ), this, SLOT( remove() ) ); + connect( myIdList, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); + + activateSelection(); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::enterEvent( QEvent* e ) +{ + if ( !buttonCancel->isEnabled() ) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool GroupGUI_GroupDlg::ClickOnApply() +{ + if ( !onAccept( myMode == CreateGroup, true ) ) + return false; + + if ( myMode == CreateGroup ) + initName(); + return true; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + activateSelection(); +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::LineEditReturnPressed() +{ + QLineEdit* send = ( QLineEdit* )sender(); + + if ( send == myMainName && !myEditCurrentArgument ) { + myEditCurrentArgument = myMainName; + activateSelection(); + } + else + GEOMBase_Skeleton::LineEditReturnPressed(); + + updateState(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == mySelBtn ) + myEditCurrentArgument = myMainName; + else if ( send == mySelSubBtn || send == mySelAllBtn ) + myEditCurrentArgument = 0; + + activateSelection(); + updateState(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void GroupGUI_GroupDlg::SelectionIntoArgument() +{ + if ( myEditCurrentArgument ) { // Selection of a main shape is active + myEditCurrentArgument->setText( "" ); + + if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { + myMainObj = anObj; + myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); + updateState(); + return; + } + } + + myMainObj = GEOM::GEOM_Object::_nil(); + } + else { // an attempt to synchronize list box selection with 3d viewer + if ( myBusy ) + return; + + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals( true ); + myIdList->clearSelection(); + + TColStd_IndexedMapOfInteger aMapIndex; + + if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + } + + if ( !aMapIndex.Extent() ) // try to find out and process the object browser selection + { + GEOM::ListOfGO anObjects; + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + for (int i = 0; i < anObjects.length(); i++) + { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape(anObjects[i], aShape, getShapeType()) ) + { + CORBA::Long anIndex = aLocOp->GetSubShapeIndex( myMainObj, anObjects[i] ); + if ( anIndex >= 0 ) + aMapIndex.Add( anIndex ); + } + } + } + + if ( aMapIndex.Extent()>=1 ) + { + QMap aMap; + for ( int i = 0, n = myIdList->count(); i < n; i++ ) + aMap.insert( myIdList->item( i )->text().toInt(), i ); + + for ( int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++ ) + { + if ( aMap.contains( aMapIndex( ii ) ) ) + myIdList->setSelected( aMap[aMapIndex( ii )], true ); + } + } + myIdList->blockSignals( isBlocked ); + } + + updateState(); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void GroupGUI_GroupDlg::ConstructorsClicked( int constructorId ) +{ + myIdList->clear(); + activateSelection(); + updateState(); +} + +//================================================================================= +// function : selectAllSubShapes +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::selectAllSubShapes() +{ + if ( CORBA::is_nil( myMainObj ) ) + return; + + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + + GEOM::ListOfGO_var aSubShapes = aShOp->MakeExplode( myMainObj, getShapeType(), false ); + if ( !aShOp->IsDone() ) + return; + + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals( true ); + myIdList->clear(); + + QListBoxItem* anItem; + for ( int i = 0, n = aSubShapes->length(); i < n; i++ ) { + CORBA::Long anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubShapes[i] ); + if ( anIndex < 0 ) + continue; + + anItem = new QListBoxText( QString( "%1" ).arg( anIndex ) ); + myIdList->insertItem( anItem ); + myIdList->setSelected( anItem, true ); + } + + myIdList->blockSignals( isBlocked ); + highlightSubShapes(); + updateState(); +} + +//================================================================================= +// function : add +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::add() +{ + TColStd_MapOfInteger aMap; + for ( int i = 0, n = myIdList->count(); i < n; i++ ) + aMap.Add( myIdList->item( i )->text().toInt() ); + + TColStd_IndexedMapOfInteger aMapIndex; + + if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + } + + if ( !aMapIndex.Extent() ) // try to find out and process the object browser selection + { + GEOM::ListOfGO anObjects; + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + for (int i = 0; i < anObjects.length(); i++) + { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape(anObjects[i], aShape, getShapeType()) ) + { + CORBA::Long anIndex = aLocOp->GetSubShapeIndex( myMainObj, anObjects[i] ); + if ( anIndex >= 0 ) + aMapIndex.Add( anIndex ); + } + } + } + + if ( aMapIndex.Extent()>=1 ) + { + QListBoxItem* anItem; + bool isBlocked = myIdList->signalsBlocked(); + myIdList->blockSignals( true ); + + for ( int i = 1, n = aMapIndex.Extent(); i <= n; i++ ) { + if ( aMap.Contains( aMapIndex( i ) ) ) + continue; + + anItem = new QListBoxText( QString( "%1" ).arg( aMapIndex( i ) ) ); + myIdList->insertItem( anItem ); + myIdList->setSelected( anItem, true ); + } + + myIdList->blockSignals( isBlocked ); + } + + updateState(); +} + +//================================================================================= +// function : remove +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::remove() +{ + for ( int i = myIdList->count() - 1; i >= 0; i-- ) { + if ( myIdList->isSelected( i ) ) + myIdList->removeItem( i ); + } + updateState(); +} + + +//================================================================================= +// function : getConstructorId() +// purpose : +//================================================================================= +int GroupGUI_GroupDlg::getConstructorId() const +{ + return GroupConstructors->id( GroupConstructors->selected() ); +} + +//================================================================================= +// function : getShapeType() +// purpose : +//================================================================================= +TopAbs_ShapeEnum GroupGUI_GroupDlg::getShapeType() const +{ + switch ( getConstructorId() ) { + case 0: return TopAbs_VERTEX; + case 1: return TopAbs_EDGE; + case 2: return TopAbs_FACE; + case 3: return TopAbs_SOLID; + default: return TopAbs_SHAPE; + } +} + +//================================================================================= +// function : setShapeType() +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::setShapeType( const TopAbs_ShapeEnum theType ) +{ + int anId = 0; + switch ( theType ) { + case TopAbs_VERTEX: anId = 0; break; + case TopAbs_EDGE: anId = 1; break; + case TopAbs_FACE: anId = 2; break; + case TopAbs_SOLID: anId = 3; break; + } + GroupConstructors->setButton( anId ); +} + + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void GroupGUI_GroupDlg::activateSelection() +{ + globalSelection( GEOM_ALLSHAPES ); + + if ( !myMainObj->_is_nil() && !myEditCurrentArgument ) { + localSelection( myMainObj, getShapeType() ); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : updateState +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::updateState() +{ + bool isAdd = false; + + TColStd_IndexedMapOfInteger aMapIndex; + + if ( IObjectCount() == 1 ) { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); + } + + if ( !aMapIndex.Extent() ) // try to find out and process the object browser selection + { + isAdd = true; + GEOM::ListOfGO anObjects; + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects); + GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); + for (int i = 0; i < anObjects.length(); i++) + { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape(anObjects[i], aShape, getShapeType()) ) + { + CORBA::Long anIndex = aLocOp->GetSubShapeIndex( myMainObj, anObjects[i] ); + if ( anIndex >= 0 ) + aMapIndex.Add( anIndex ); + else + isAdd = false; + } + else + isAdd = false; + + if ( !isAdd ) + { + aMapIndex.Clear(); + break; + } + } + } + + isAdd = aMapIndex.Extent() > 0; + + myAddBtn->setEnabled( !myEditCurrentArgument && !CORBA::is_nil( myMainObj ) && isAdd ); + bool hasSel = false; + for ( int ii = 0, nn = myIdList->count(); !hasSel && ii < nn; ii++ ) + hasSel = myIdList->isSelected( ii ); + myRemBtn->setEnabled( hasSel ); + mySelSubBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); + mySelAllBtn->setEnabled( !CORBA::is_nil( myMainObj ) ); +} + +//================================================================================= +// function : selectionChanged +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::selectionChanged() +{ + highlightSubShapes(); +} + +//================================================================================= +// function : highlightSubShapes +// purpose : +//================================================================================= +void GroupGUI_GroupDlg::highlightSubShapes() +{ + if ( CORBA::is_nil( myMainObj ) ) + return; + + Standard_Boolean isOk; + Handle(GEOM_AISShape) aSh = + GEOMBase::ConvertIORinGEOMAISShape( GEOMBase::GetIORFromObject( myMainObj ), isOk, true ); + if ( !isOk || aSh.IsNull() ) + return; + + TColStd_MapOfInteger anIds; + + myBusy = true; + + for ( int ii = 0, nn = myIdList->count(); ii < nn; ii++ ) + if ( myIdList->isSelected( ii ) ) + anIds.Add( myIdList->item( ii )->text().toInt() ); + + LightApp_SelectionMgr* aSelMgr = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + aSelMgr->clearSelected(); + aSelMgr->AddOrRemoveIndex( aSh->getIO(), anIds, false ); + + myBusy = false; + + updateState(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() +{ + return getGeomEngine()->GetIGroupOperations( getStudyId() ); +} + +#define RETURN_WITH_MSG(a, b) \ + if ( !(a) ) { \ + theMessage += (b); \ + return false; \ + } + +//================================================================================= +// function : isValid() +// purpose : Verify validity of input data +//================================================================================= +bool GroupGUI_GroupDlg::isValid( QString& theMessage ) +{ + SalomeApp_Study* study = getStudy(); + ASSERT(study); + RETURN_WITH_MSG ( !study->studyDS()->GetProperties()->IsLocked(), tr( "GEOM_STUDY_LOCKED" ) ) + + if ( myMode == CreateGroup ) { + RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_MAIN_OBJ" ) ) + } + else { + RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_GROUP" ) ) + } + + const char* aName = getNewObjectName(); + RETURN_WITH_MSG ( aName && strlen( aName ), tr( "EMPTY_NAME" ) ) + + RETURN_WITH_MSG ( myIdList->count(), tr( "EMPTY_LIST" ) ) + return true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool GroupGUI_GroupDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); + + GEOM::GEOM_Object_var aGroup; + if ( myMode == CreateGroup ) + aGroup = anOp->CreateGroup( myMainObj, getShapeType() ); + else if ( myMode == EditGroup ) + aGroup = myGroup; + + if ( CORBA::is_nil( aGroup ) || ( myMode == CreateGroup && !anOp->IsDone() ) ) + return false; + + GEOM::ListOfLong_var aCurrList = anOp->GetObjects( aGroup ); + if ( !anOp->IsDone() ) + return false; + + for ( int i = 0, n = aCurrList->length(); i < n; i++ ) { + anOp->RemoveObject( aGroup, aCurrList[i] ); + if ( !anOp->IsDone() ) + return false; + } + + for ( int ii = 0, nn = myIdList->count(); ii < nn; ii++ ) { + anOp->AddObject( aGroup, myIdList->item( ii )->text().toInt() ); + if ( !anOp->IsDone() ) + return false; + } + + SalomeApp_Study* study = getStudy(); + if ( study ) { + string IOR = GEOMBase::GetIORFromObject( aGroup ); + if ( IOR != "" ) { + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) { + _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder()); + aBuilder->SetName( SO, getNewObjectName() ); + } + } + } + + objects.push_back( aGroup._retn() ); + + return true; +} + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// ( called with addInStudy method ) +//================================================================ +GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj ) +{ + GEOM::GEOM_Object_var aFatherObj; + if ( theObj->GetType() == GEOM_GROUP ) { + GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); + aFatherObj = anOp->GetMainShape( theObj ); + } + return aFatherObj._retn(); +} diff --git a/src/IGESExport/IGESExport.cxx b/src/IGESExport/IGESExport.cxx new file mode 100644 index 000000000..591016460 --- /dev/null +++ b/src/IGESExport/IGESExport.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: IGESExport.cxx +// Created: Wed May 19 14:49:45 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include +#include +#include + +#include +#include + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName) + { + MESSAGE("Export IGES into file " << theFileName.ToCString()); + try + { + //VRV: OCC 4.0 migration + IGESControl_Controller::Init(); + IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"), + Interface_Static::IVal("XSTEP.iges.writebrep.mode")); + //VRV: OCC 4.0 migration + + ICW.AddShape( theShape ); + ICW.ComputeModel(); + if ( ICW.Write( theFileName.ToCString() ) ) + return 1; + } + catch(Standard_Failure) + { + //THROW_SALOME_CORBA_EXCEPTION("Exception catched in IGESExport", SALOME::BAD_PARAM); + } + return 0; + } +} diff --git a/src/IGESImport/IGESImport.cxx b/src/IGESImport/IGESImport.cxx new file mode 100644 index 000000000..3a59922c9 --- /dev/null +++ b/src/IGESImport/IGESImport.cxx @@ -0,0 +1,95 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: IGESImport.cxx +// Created: Wed May 19 14:36:35 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include +#include + +#include +#include + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + TopoDS_Shape Import (const TCollection_AsciiString& theFileName, + TCollection_AsciiString& theError) + { + IGESControl_Reader aReader; + TopoDS_Shape aResShape; + try { + IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString()); + + if (status == IFSelect_RetDone) { + MESSAGE("ImportIGES : all Geometry Transfer"); + //OCC 5.1.2 porting + // aReader.Clear(); + // aReader.TransferRoots(false); + aReader.ClearShapes(); + aReader.TransferRoots(); + + MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes()); + aResShape = aReader.OneShape(); + + } else { +// switch (status) { +// case IFSelect_RetVoid: +// theError = "Nothing created or No data to process"; +// break; +// case IFSelect_RetError: +// theError = "Error in command or input data"; +// break; +// case IFSelect_RetFail: +// theError = "Execution was run, but has failed"; +// break; +// case IFSelect_RetStop: +// theError = "Execution has been stopped. Quite possible, an exception was raised"; +// break; +// default: +// break; +// } + theError = "Wrong format of the imported file. Can't import file."; + aResShape.Nullify(); + } + } + catch(Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + theError = aFail->GetMessageString(); + aResShape.Nullify(); + } + return aResShape; + } +} diff --git a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx new file mode 100644 index 000000000..f7b8cb5c5 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx @@ -0,0 +1,169 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel12LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel12LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel12LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel12LineEdit_QTD::MeasureGUI_1Sel12LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel12LineEdit_QTD" ); + resize( 131, 171 ); + setCaption( trUtf8( "MeasureGUI_1Sel12LineEdit_QTD" ) ); + MeasureGUI_1Sel12LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel12LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + LineEdit12 = new QLineEdit( GroupBox1, "LineEdit12" ); + + Layout2->addWidget( LineEdit12, 0, 2 ); + + LineEdit11 = new QLineEdit( GroupBox1, "LineEdit11" ); + + Layout2->addWidget( LineEdit11, 0, 1 ); + + LineEdit42 = new QLineEdit( GroupBox1, "LineEdit42" ); + + Layout2->addWidget( LineEdit42, 3, 2 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 3, 0 ); + + LineEdit31 = new QLineEdit( GroupBox1, "LineEdit31" ); + + Layout2->addWidget( LineEdit31, 2, 1 ); + + LineEdit41 = new QLineEdit( GroupBox1, "LineEdit41" ); + + Layout2->addWidget( LineEdit41, 3, 1 ); + + LineEdit23 = new QLineEdit( GroupBox1, "LineEdit23" ); + + Layout2->addWidget( LineEdit23, 1, 3 ); + + LineEdit33 = new QLineEdit( GroupBox1, "LineEdit33" ); + + Layout2->addWidget( LineEdit33, 2, 3 ); + + LineEdit43 = new QLineEdit( GroupBox1, "LineEdit43" ); + + Layout2->addWidget( LineEdit43, 3, 3 ); + + LineEdit22 = new QLineEdit( GroupBox1, "LineEdit22" ); + + Layout2->addWidget( LineEdit22, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 2, 0 ); + + LineEdit13 = new QLineEdit( GroupBox1, "LineEdit13" ); + + Layout2->addWidget( LineEdit13, 0, 3 ); + + LineEdit32 = new QLineEdit( GroupBox1, "LineEdit32" ); + + Layout2->addWidget( LineEdit32, 2, 2 ); + + LineEdit21 = new QLineEdit( GroupBox1, "LineEdit21" ); + + Layout2->addWidget( LineEdit21, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 1, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel12LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel12LineEdit_QTD::~MeasureGUI_1Sel12LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h new file mode 100644 index 000000000..0c930fc2c --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel12LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL12LINEEDIT_QTD_H +#define MEASUREGUI_1SEL12LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel12LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel12LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel12LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit12; + QLineEdit* LineEdit11; + QLineEdit* LineEdit42; + QLabel* TextLabel5; + QLineEdit* LineEdit31; + QLineEdit* LineEdit41; + QLineEdit* LineEdit23; + QLineEdit* LineEdit33; + QLineEdit* LineEdit43; + QLineEdit* LineEdit22; + QLabel* TextLabel2; + QLabel* TextLabel4; + QLineEdit* LineEdit13; + QLineEdit* LineEdit32; + QLineEdit* LineEdit21; + QLabel* TextLabel3; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* MeasureGUI_1Sel12LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL12LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx new file mode 100644 index 000000000..42dc1451e --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx @@ -0,0 +1,96 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel1TextView_QTD.ui' +** +** Created: mar oct 28 14:01:15 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel1TextView_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel1TextView_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel1TextView_QTD::MeasureGUI_1Sel1TextView_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel1TextView_QTD" ); + resize( 130, 160 ); + setCaption( trUtf8( "MeasureGUI_1Sel1TextView_QTD" ) ); + MeasureGUI_1Sel1TextView_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel1TextView_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextEdit1 = new QTextEdit( GroupBox1, "TextEdit1" ); + + Layout1->addMultiCellWidget( TextEdit1, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel1TextView_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel1TextView_QTD::~MeasureGUI_1Sel1TextView_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h new file mode 100644 index 000000000..7d6ea600d --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel1TextView_QTD.ui' +** +** Created: mar oct 28 14:01:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL1TEXTVIEW_QTD_H +#define MEASUREGUI_1SEL1TEXTVIEW_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QTextEdit; + +class MeasureGUI_1Sel1TextView_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel1TextView_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel1TextView_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QTextEdit* TextEdit1; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + + +protected: + QGridLayout* MeasureGUI_1Sel1TextView_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // MEASUREGUI_1SEL1TEXTVIEW_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx new file mode 100644 index 000000000..d7e31ec5c --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx @@ -0,0 +1,123 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel3LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel3LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel3LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel3LineEdit_QTD::MeasureGUI_1Sel3LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel3LineEdit_QTD" ); + resize( 129, 141 ); + setCaption( trUtf8( "MeasureGUI_1Sel3LineEdit_QTD" ) ); + MeasureGUI_1Sel3LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel3LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout2->addWidget( TextLabel1, 0, 0 ); + + LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" ); + + Layout2->addMultiCellWidget( LineEdit4, 3, 3, 1, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 2, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout2->addMultiCellWidget( LineEdit2, 1, 1, 1, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 4, 2 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout2->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout2->addWidget( LineEdit1, 0, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 3, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 1, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton1, 0, 1 ); + + GroupBox1Layout->addLayout( Layout2, 0, 0 ); + + MeasureGUI_1Sel3LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel3LineEdit_QTD::~MeasureGUI_1Sel3LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h new file mode 100644 index 000000000..379b7da32 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h @@ -0,0 +1,67 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel3LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL3LINEEDIT_QTD_H +#define MEASUREGUI_1SEL3LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel3LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel3LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel3LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLineEdit* LineEdit4; + QLabel* TextLabel3; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QLineEdit* LineEdit1; + QLabel* TextLabel4; + QLabel* TextLabel2; + QPushButton* PushButton1; + + +protected: + QGridLayout* MeasureGUI_1Sel3LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL3LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx new file mode 100644 index 000000000..28968b72a --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx @@ -0,0 +1,151 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel6LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel6LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel6LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel6LineEdit_QTD::MeasureGUI_1Sel6LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel6LineEdit_QTD" ); + resize( 129, 163 ); + setCaption( trUtf8( "MeasureGUI_1Sel6LineEdit_QTD" ) ); + MeasureGUI_1Sel6LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel6LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 50, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + LineEdit22 = new QLineEdit( GroupBox1, "LineEdit22" ); + + Layout2->addWidget( LineEdit22, 2, 2 ); + + LineEdit32 = new QLineEdit( GroupBox1, "LineEdit32" ); + + Layout2->addWidget( LineEdit32, 3, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + LineEdit31 = new QLineEdit( GroupBox1, "LineEdit31" ); + + Layout2->addWidget( LineEdit31, 3, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 2, 0 ); + + LineEdit11 = new QLineEdit( GroupBox1, "LineEdit11" ); + + Layout2->addWidget( LineEdit11, 1, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout2->addWidget( TextLabel6, 3, 0 ); + + LineEdit12 = new QLineEdit( GroupBox1, "LineEdit12" ); + + Layout2->addWidget( LineEdit12, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 1 ); + + LineEdit21 = new QLineEdit( GroupBox1, "LineEdit21" ); + + Layout2->addWidget( LineEdit21, 2, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 2 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel6LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel6LineEdit_QTD::~MeasureGUI_1Sel6LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h new file mode 100644 index 000000000..f222e6380 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel6LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL6LINEEDIT_QTD_H +#define MEASUREGUI_1SEL6LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel6LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel6LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel6LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLineEdit* LineEdit22; + QLineEdit* LineEdit32; + QLabel* TextLabel4; + QLineEdit* LineEdit31; + QLabel* TextLabel5; + QLineEdit* LineEdit11; + QLabel* TextLabel6; + QLineEdit* LineEdit12; + QLabel* TextLabel2; + QLineEdit* LineEdit21; + QLabel* TextLabel3; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* MeasureGUI_1Sel6LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL6LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx new file mode 100644 index 000000000..211b3bfe8 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx @@ -0,0 +1,119 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_2Sel1LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_2Sel1LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_2Sel1LineEdit_QTD" ); + resize( 129, 115 ); + setCaption( trUtf8( "MeasureGUI_2Sel1LineEdit_QTD" ) ); + MeasureGUI_2Sel1LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_2Sel1LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_2Sel1LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_2Sel1LineEdit_QTD::~MeasureGUI_2Sel1LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h new file mode 100644 index 000000000..eae9b2701 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_2SEL1LINEEDIT_QTD_H +#define MEASUREGUI_2SEL1LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_2Sel1LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_2Sel1LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel3; + QLineEdit* LineEdit3; + QLineEdit* LineEdit2; + QLabel* TextLabel2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + + +protected: + QGridLayout* MeasureGUI_2Sel1LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // MEASUREGUI_2SEL1LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx new file mode 100644 index 000000000..9191ebd34 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -0,0 +1,341 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MeasureGUI_CenterMassDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "MeasureGUI_CenterMassDlg.h" +#include "MeasureGUI_1Sel3LineEdit_QTD.h" + +#include "utilities.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" + +#include +#include +#include +#include + +#include + +//================================================================================= +// class : MeasureGUI_CenterMassDlg() +// purpose : Constructs a MeasureGUI_CenterMassDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent ) +: GEOMBase_Skeleton( parent, "MeasureGUI_CenterMassDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_CENTERMASS" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); + + setCaption( tr( "GEOM_CMASS_TITLE" ) ); + + /***************************************************************/ + + GroupConstructors->setTitle( tr( "GEOM_CMASS" ) ); + RadioButton1->setPixmap( image0 ); + RadioButton2->close( TRUE ); + RadioButton3->close( TRUE ); + + myGrp = new MeasureGUI_1Sel3LineEdit_QTD( this, "myGrp" ); + myGrp->GroupBox1->setTitle( tr( "GEOM_CENTER" ) ); + myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) ); + myGrp->TextLabel2->setText( tr( "GEOM_X" ) ); + myGrp->TextLabel3->setText( tr( "GEOM_Y" ) ); + myGrp->TextLabel4->setText( tr( "GEOM_Z" ) ); + myGrp->LineEdit2->setReadOnly( TRUE ); + myGrp->LineEdit3->setReadOnly( TRUE ); + myGrp->LineEdit4->setReadOnly( TRUE ); + myGrp->PushButton1->setPixmap( image1 ); + myGrp->LineEdit1->setReadOnly( true ); + + Layout1->addWidget( myGrp, 2, 0 ); + /***************************************************************/ + + /* Initialisation */ + Init(); +} + + +//================================================================================= +// function : ~MeasureGUI_CenterMassDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_CenterMassDlg::~MeasureGUI_CenterMassDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = myGrp->LineEdit1; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); + connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_POINT") ); + globalSelection(); + SelectionIntoArgument(); + + /* displays Dialog */ + myGrp->show(); + this->show(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool MeasureGUI_CenterMassDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; + +// myMeasureGUI->MakeCDGAndDisplay( myGeomShape ); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void MeasureGUI_CenterMassDlg::SelectionIntoArgument() +{ + erasePreview(); + myObj = GEOM::GEOM_Object::_nil(); + + if ( IObjectCount() != 1 ) + { + processObject(); + return; + } + + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if ( !testResult || aSelectedObject->_is_nil() ) + { + processObject(); + return; + } + + myObj = aSelectedObject; + processObject(); + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::SetEditCurrentArgument() +{ + myGrp->LineEdit1->setFocus(); + myEditCurrentArgument = myGrp->LineEdit1; + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::LineEditReturnPressed() +{ + QLineEdit* send = ( QLineEdit* )sender(); + if ( send == myGrp->LineEdit1 ) + { + myEditCurrentArgument = myGrp->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + globalSelection(); + displayPreview(); +} + +//================================================================================= +// function : processObject() +// purpose : Fill dialog fields in accordance with myObj +//================================================================================= +void MeasureGUI_CenterMassDlg::processObject() +{ + if ( myObj->_is_nil() ) + { + myGrp->LineEdit1->setText( "" ); + myGrp->LineEdit2->setText( "" ); + myGrp->LineEdit3->setText( "" ); + myGrp->LineEdit4->setText( "" ); + erasePreview(); + } + else + { + double x = 0, y = 0, z = 0; + + getParameters( x, y, z ); + + myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); + myGrp->LineEdit2->setText( QString( "%1" ).arg( x ) ); + myGrp->LineEdit3->setText( QString( "%1" ).arg( y ) ); + myGrp->LineEdit4->setText( QString( "%1" ).arg( z ) ); + + displayPreview(); + } +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::enterEvent( QEvent* e ) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr MeasureGUI_CenterMassDlg::createOperation() +{ + return getGeomEngine()->GetIMeasureOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool MeasureGUI_CenterMassDlg::isValid( QString& ) +{ + return !myObj->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double& theZ ) +{ + if ( myObj->_is_nil() ) + return false; + else + { + try + { + GEOM::GEOM_Object_var anObj; + anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj ); + if ( !getOperation()->IsDone() ) + return false; + + TopoDS_Shape aShape; + if ( !GEOMBase::GetShape( anObj, aShape ) || + aShape.IsNull() || + aShape.ShapeType() != TopAbs_VERTEX ) + return false; + + TopoDS_Vertex aVertex = TopoDS::Vertex( aShape ); + + gp_Pnt aPnt = BRep_Tool::Pnt( aVertex ); + + theX = aPnt.X(); + theY = aPnt.Y(); + theZ = aPnt.Z(); + + return true; + } + catch( const SALOME::SALOME_Exception& e ) + { + SalomeApp_Tools::QtCatchCorbaException( e ); + return false; + } + } +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool MeasureGUI_CenterMassDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + + diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx new file mode 100644 index 000000000..7db3bee11 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -0,0 +1,223 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MeasureGUI_PointDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "MeasureGUI_PointDlg.h" +#include "GEOMBase.h" + +#include "utilities.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_PointDlg() +// purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent' +// +//================================================================================= +MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" ) +{ + QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap( + "GEOM",tr( "ICON_DLG_POINT" ) ) ); + + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( + "GEOM",tr( "ICON_SELECT" ) ) ); + + setCaption( tr( "CAPTION" ) ); + + GroupConstructors->setTitle( tr( "CAPTION" ) ); + RadioButton1->setPixmap( iconPnt ); + + QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, tr( "COORDINATES" ), this ); + + new QLabel( tr( "POINT" ), aGrp ); + QFrame* aFrame = new QFrame( aGrp ); + mySelBtn = new QPushButton( aFrame ); + mySelBtn->setPixmap( iconSelect ); + mySelEdit = new QLineEdit( aFrame ); + QHBoxLayout* aLay = new QHBoxLayout( aFrame, 0, 10 ); + aLay->addWidget( mySelBtn ); + aLay->addWidget( mySelEdit ); + + new QLabel( tr( "X" ), aGrp ); + myX = new QLineEdit( aGrp ); + new QLabel( tr( "Y" ), aGrp ); + myY = new QLineEdit( aGrp ); + new QLabel( tr( "Z" ), aGrp ); + myZ = new QLineEdit( aGrp ); + + mySelEdit->setReadOnly( true ); + myX->setReadOnly( true ); + myY->setReadOnly( true ); + myZ->setReadOnly( true ); + + Layout1->addWidget( aGrp, 1, 0 ); + + Init(); +} + + +//================================================================================= +// function : ~MeasureGUI_PointDlg() +// purpose : Destroys the object and frees any allocated resources +//======================myX->setReadOnly( true );=========================================================== +MeasureGUI_PointDlg::~MeasureGUI_PointDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_PointDlg::Init() +{ + QSize aSize( size() ); + resize( (int)(aSize.width() *0.75 ), aSize.height() ); + MeasureGUI_Skeleton::Init(); +} + +//================================================================================= +// function : activateSelection +// purpose : +//================================================================================= +void MeasureGUI_PointDlg::activateSelection() +{ + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); +} + +//================================================================================= +// function : SelectionIntoArgument +// purpose : +//================================================================================= +void MeasureGUI_PointDlg::SelectionIntoArgument() +{ + try + { + myObj = GEOM::GEOM_Object::_nil(); + mySelEdit->setText( "" ); + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if( !testResult || aSelectedObject->_is_nil() ) + return; + + myObj = aSelectedObject; + + TColStd_IndexedMapOfInteger anIndexes; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))-> + selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + + TopoDS_Shape aShape; + if ( anIndexes.Extent() > 1 || !GEOMBase::GetShape( myObj, aShape ) || aShape.IsNull() ) + return; + + TopoDS_Vertex aPoint; + QString aName = GEOMBase::GetName( myObj ); + if ( anIndexes.Extent() == 0 ) + { + if ( aShape.ShapeType() == TopAbs_VERTEX ) + aPoint = TopoDS::Vertex( aShape ); + } + else + { + int i = anIndexes( 1 ); + + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + + if ( aShape != aShapes( i ) ) + aName += QString( ":%1" ).arg( i ); + + aPoint = TopoDS::Vertex( aShapes( i ) ); + } + + if ( !aPoint.IsNull() ) + { + gp_Pnt aPnt = BRep_Tool::Pnt( aPoint ); + mySelEdit->setText( aName ); + myX->setText( QString( "%1" ).arg( aPnt.X() ) ); + myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); + myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + } + } + catch( ... ) + { + myObj = GEOM::GEOM_Object::_nil(); + mySelEdit->setText( "" ); + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + } +} + + + + + + + + + + + + + + + + + + + + diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx new file mode 100644 index 000000000..bbfdb0741 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -0,0 +1,344 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : MeasureGUI_Skeleton.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "MeasureGUI_Skeleton.h" +#include "GEOMBase.h" +#include "GEOM_Displayer.h" +#include "GeometryGUI.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" +#include "SUIT_Session.h" +#include "SUIT_OverrideCursor.h" + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_Skeleton() +// purpose : Constructs a MeasureGUI_Skeleton which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, + QWidget* parent, + const char* name ) +: MeasureGUI_Skeleton_QTD( parent, name, false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ), + myGeomGUI( GUI ) +{ + + mySelBtn = 0; + mySelEdit = 0; + myDisplayer = 0; + + if ( !name ) + setName( "MeasureGUI_Skeleton" ); + + buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); + + buttonClose->setAutoDefault( false ); + + GroupMedium->close( TRUE ); + resize( 350, 0 ); +} + + +//================================================================================= +// function : ~MeasureGUI_Skeleton() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_Skeleton::~MeasureGUI_Skeleton() +{ + myGeomGUI->SetActiveDialogBox( 0 ); + delete myDisplayer; +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::Init() +{ + /* init variables */ + myGeomGUI->SetActiveDialogBox((QDialog*)this); + + /* signals and slots connections */ + + connect( buttonClose, SIGNAL( clicked() ), + this, SLOT( ClickOnCancel() ) ); + + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), + this, SLOT ( DeactivateActiveDialog() ) ); + + connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), + this, SLOT ( ClickOnCancel() ) ); + + connect( mySelEdit, SIGNAL( returnPressed() ), + this, SLOT( LineEditReturnPressed() ) ); + + connect( mySelBtn, SIGNAL( clicked() ), + this, SLOT ( SetEditCurrentArgument() ) ); + + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; + + /* displays Dialog */ + RadioButton1->setChecked( TRUE ); + + activateSelection(); + SelectionIntoArgument(); + show(); +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::ClickOnCancel() +{ + close(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::LineEditReturnPressed() +{ + /* User name of object input management */ + /* If successfull the selection is changed and signal emitted... */ + /* so SelectionIntoArgument() is automatically called. */ + + const QString objectUserName = mySelEdit->text(); + QWidget* thisWidget = ( QWidget* )this; + + if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, selectedIO() ) ) + mySelEdit->setText( objectUserName ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::DeactivateActiveDialog() +{ + setEnabled( false ); + + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); + + myGeomGUI->SetActiveDialogBox( 0 ); + + globalSelection(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::ActivateThisDialog() +{ + myGeomGUI->EmitSignalDeactivateDialog(); + + setEnabled( true ); + + myGeomGUI->SetActiveDialogBox( ( QDialog* )this ); + + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; + + redisplayPreview(); + activateSelection(); +} + +//================================================================================= +// function : SetEditCurrentArgument +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::SetEditCurrentArgument() +{ + mySelEdit->setFocus(); + SelectionIntoArgument(); +} + +//================================================================================= +// function : SelectionIntoArgument +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::SelectionIntoArgument() +{ + myObj = GEOM::GEOM_Object::_nil(); + + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if( !testResult || aSelectedObject->_is_nil() ) + { + mySelEdit->setText( "" ); + processObject(); + erasePreview(); + return; + } + + myObj = aSelectedObject; + mySelEdit->setText( GEOMBase::GetName( myObj ) ); + processObject(); + redisplayPreview(); +} + +//================================================================================= +// function : processObject +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::processObject() +{ +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::closeEvent( QCloseEvent* e ) +{ + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); + QDialog::closeEvent( e ); +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return; + + ActivateThisDialog(); +} + +//================================================================================= +// function : buildPrs +// purpose : Build presentation for "preview" +//================================================================================= +SALOME_Prs* MeasureGUI_Skeleton::buildPrs() +{ + return 0; +} + +//================================================================================= +// function : closeEvent() +// purpose : Build presentation for "preview" +//================================================================================= +void MeasureGUI_Skeleton::redisplayPreview() +{ + QString aMess; + if ( !isValid( aMess ) ) + { + erasePreview( true ); + return; + } + + erasePreview( false ); + + try + { + SUIT_OverrideCursor(); + + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); + getDisplayer()->SetToActivate( false ); + + if ( SALOME_Prs* aPrs = buildPrs() ) + displayPreview( aPrs ); + } + catch( const SALOME::SALOME_Exception& e ) + { + SalomeApp_Tools::QtCatchCorbaException( e ); + } + +} + +//================================================================================= +// function : activateSelection +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::activateSelection() +{ + globalSelection( GEOM_ALLSHAPES ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool MeasureGUI_Skeleton::isValid( QString& ) +{ + return !myObj->_is_nil(); +} + +//================================================================ +// Function : getDisplayer +// Purpose : +//================================================================ +GEOM_Displayer* MeasureGUI_Skeleton::getDisplayer() +{ + if ( !myDisplayer ) + myDisplayer = new GEOM_Displayer( getStudy() ); + return myDisplayer; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation() +{ + return getGeomEngine()->GetIMeasureOperations( getStudyId() ); +} + diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..343064b7e --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx @@ -0,0 +1,118 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' +** +** Created: lun oct 27 11:23:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_Skeleton_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +MeasureGUI_Skeleton_QTD::MeasureGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "MeasureGUI_Skeleton_QTD" ); + resize( 228, 266 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "MeasureGUI_Skeleton_QTD" ) ); + setSizeGripEnabled( TRUE ); + MeasureGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "MeasureGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + QSpacerItem* spacer = new QSpacerItem( 120, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer, 0, 2 ); + QSpacerItem* spacer_2 = new QSpacerItem( 120, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer_2, 0, 0 ); + + buttonClose = new QPushButton( GroupButtons, "buttonClose" ); + buttonClose->setText( trUtf8( "&Close" ) ); + + Layout3->addWidget( buttonClose, 0, 1 ); + + GroupButtonsLayout->addLayout( Layout3, 0, 0 ); + + Layout1->addWidget( GroupButtons, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton1 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupMedium = new QGroupBox( this, "GroupMedium" ); + GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); + GroupMedium->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupMedium, 1, 0 ); + + MeasureGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_Skeleton_QTD::~MeasureGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h new file mode 100644 index 000000000..90145bfaa --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' +** +** Created: lun oct 27 11:23:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_SKELETON_QTD_H +#define MEASUREGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class MeasureGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + MeasureGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~MeasureGUI_Skeleton_QTD(); + + QGroupBox* GroupButtons; + QPushButton* buttonClose; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QGroupBox* GroupMedium; + + +protected: + QGridLayout* MeasureGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QGridLayout* GroupButtonsLayout; + QGridLayout* Layout3; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; +}; + +#endif // MEASUREGUI_SKELETON_QTD_H diff --git a/src/MeasureGUI/UIFiles/ui_to_cxx b/src/MeasureGUI/UIFiles/ui_to_cxx new file mode 100755 index 000000000..07db6a8f4 --- /dev/null +++ b/src/MeasureGUI/UIFiles/ui_to_cxx @@ -0,0 +1,38 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#!/bin/sh + +#uic -o MeasureGUI_Skeleton_QTD.h MeasureGUI_Skeleton_QTD.ui +#uic -o MeasureGUI_Skeleton_QTD.cxx -impl MeasureGUI_Skeleton_QTD.h MeasureGUI_Skeleton_QTD.ui + +uic -o MeasureGUI_1Sel3LineEdit_QTD.h MeasureGUI_1Sel3LineEdit_QTD.ui +uic -o MeasureGUI_1Sel3LineEdit_QTD.cxx -impl MeasureGUI_1Sel3LineEdit_QTD.h MeasureGUI_1Sel3LineEdit_QTD.ui + +uic -o MeasureGUI_1Sel6LineEdit_QTD.h MeasureGUI_1Sel6LineEdit_QTD.ui +uic -o MeasureGUI_1Sel6LineEdit_QTD.cxx -impl MeasureGUI_1Sel6LineEdit_QTD.h MeasureGUI_1Sel6LineEdit_QTD.ui + +uic -o MeasureGUI_1Sel12LineEdit_QTD.h MeasureGUI_1Sel12LineEdit_QTD.ui +uic -o MeasureGUI_1Sel12LineEdit_QTD.cxx -impl MeasureGUI_1Sel12LineEdit_QTD.h MeasureGUI_1Sel12LineEdit_QTD.ui + +uic -o MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui +uic -o MeasureGUI_2Sel1LineEdit_QTD.cxx -impl MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui + +#uic -o MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui +#uic -o MeasureGUI_1Sel1TextView_QTD.cxx -impl MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui diff --git a/src/NMTAlgo/Makefile.in b/src/NMTAlgo/Makefile.in new file mode 100644 index 000000000..a79769aac --- /dev/null +++ b/src/NMTAlgo/Makefile.in @@ -0,0 +1,70 @@ +# GEOM NMTAlgo : partition algorithm +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Julia DOROVSKIKH +# Module : GEOM +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# Libraries targets +LIB = libNMTAlgo.la +LIB_SRC = \ + NMTAlgo_Algo.cxx \ + NMTAlgo_Builder.cxx \ + NMTAlgo_Loop3d.cxx \ + NMTAlgo_Splitter.cxx \ + NMTAlgo_Splitter1.cxx \ + NMTAlgo_Splitter_1.cxx \ + NMTAlgo_Splitter_2.cxx \ + NMTAlgo_Tools.cxx + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# header files +EXPORT_HEADERS = \ + NMTAlgo_Splitter1.hxx \ + NMTAlgo_Splitter.hxx \ + NMTAlgo_Builder.hxx \ + NMTAlgo_Algo.hxx + +# idl files +EXPORT_IDLS= + + +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(CAS_LDPATH) -lTKBool -lTKBO -lNMTTools -L${KERNEL_ROOT_DIR}/lib/salome + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ diff --git a/src/NMTAlgo/NMTAlgo.cdl b/src/NMTAlgo/NMTAlgo.cdl new file mode 100644 index 000000000..7fce9ebb9 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo.cdl @@ -0,0 +1,59 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo.cdl +-- Created: Tue Jan 27 14:39:05 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +package NMTAlgo + + ---Purpose: + +uses + TCollection, + TColStd, + gp, + TopAbs, + TopoDS, + TopTools, + + BooleanOperations, + BOPTColStd, + IntTools, + BOPTools, + BOP, + + NMTDS, + NMTTools, + + BRep, + BRepAlgo + +is + deferred class Algo; + class Splitter; + class Splitter1; --modified by NIZNHY-PKV Wed Feb 11 14:28:50 2004 + class Builder; + class Tools; + class Loop3d; + +end NMTAlgo; diff --git a/src/NMTAlgo/NMTAlgo_Algo.cdl b/src/NMTAlgo/NMTAlgo_Algo.cdl new file mode 100644 index 000000000..a27cf6463 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Algo.cdl @@ -0,0 +1,78 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo_Algo.cdl +-- Created: Tue Jan 27 14:41:04 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +deferred class Algo from NMTAlgo + + ---Purpose: + +uses + Shape from TopoDS, + + DSFiller from NMTTools, + PDSFiller from NMTTools + +--raises + +is + Initialize + returns Algo from NMTAlgo; + ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Algo();" + + + SetFiller(me:out; + aDSF: DSFiller from NMTTools); + + Filler(me) + returns DSFiller from NMTTools; + ---C++: return const & + + ComputeWithFiller(me:out; + aDSF: DSFiller from NMTTools) + is virtual; + + Clear (me:out) + is virtual; + + Shape (me) + returns Shape from TopoDS; + ---C++: return const & + + IsDone(me) + returns Boolean from Standard; + + ErrorStatus (me) + returns Integer from Standard; + +fields + myDSFiller : PDSFiller from NMTTools is protected; + myShape : Shape from TopoDS is protected; + -- + myIsDone : Boolean from Standard is protected; + myIsComputed : Boolean from Standard is protected; + myErrorStatus : Integer from Standard is protected; + myDraw : Integer from Standard is protected; + +end Algo; diff --git a/src/NMTAlgo/NMTAlgo_Algo.cxx b/src/NMTAlgo/NMTAlgo_Algo.cxx new file mode 100644 index 000000000..82b04d14b --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Algo.cxx @@ -0,0 +1,138 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Algo.cxx +// Created: Tue Jan 27 14:58:21 2004 +// Author: Peter KURNEV +// + + +#include +#include +//======================================================================= +// function: NMTAlgo_Algo::NMTAlgo_Algo +// purpose: +//======================================================================= + NMTAlgo_Algo::NMTAlgo_Algo() +: + myDSFiller(NULL), + myIsDone(Standard_False), + myIsComputed(Standard_False), + myErrorStatus(1) +{ + myDraw=0; + // + char* xr=getenv("MDISP"); + if (xr!=NULL) { + if (!strcmp (xr, "yes")) { + myDraw=1; + } + } +} +//======================================================================= +// function: NMTAlgo_Algo +// purpose: +//======================================================================= + NMTAlgo_Algo::~NMTAlgo_Algo() +{ + Clear(); +} +//======================================================================= +// function: Clear +// purpose: +//======================================================================= + void NMTAlgo_Algo::Clear() +{ + myIsDone=Standard_False; + myIsComputed=Standard_False; + myErrorStatus=1; +} +//======================================================================= +// function: SetFiller +// purpose: +//======================================================================= + void NMTAlgo_Algo::SetFiller(const NMTTools_DSFiller& aDSF) +{ + myDSFiller=(NMTTools_DSFiller *)&aDSF; +} +//======================================================================= +// function: Filler +// purpose: +//======================================================================= + const NMTTools_DSFiller& NMTAlgo_Algo::Filler()const +{ + return *myDSFiller; +} +//======================================================================= +// function: ComputeWithFiller +// purpose: +//======================================================================= + void NMTAlgo_Algo::ComputeWithFiller(const NMTTools_DSFiller& aDSF) +{ + SetFiller(aDSF); +} +//======================================================================= +// function: Shape +// purpose: +//======================================================================= + const TopoDS_Shape& NMTAlgo_Algo::Shape()const +{ + return myShape; +} +//======================================================================= +// function: IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTAlgo_Algo::IsDone()const +{ + return myIsDone; +} +//======================================================================= +// function: ErrorStatus +// purpose: +//======================================================================= + Standard_Integer NMTAlgo_Algo::ErrorStatus()const +{ + return myErrorStatus; +} +/* +//======================================================================= +// function: Compute +// purpose: +//======================================================================= + void NMTAlgo_Algo::Compute() +{ +} +//======================================================================= +// function: SetCompositeShape +// purpose: +//======================================================================= + void NMTAlgo_Algo::SetCompositeShape(const TopoDS_Shape& aS) +{ + myCompositeShape=aS; +} +//======================================================================= +// function: CompositeShape +// purpose: +//======================================================================= + const TopoDS_Shape& NMTAlgo_Algo::CompositeShape()const +{ + return myCompositeShape; +} +*/ diff --git a/src/NMTAlgo/NMTAlgo_Algo.jxx b/src/NMTAlgo/NMTAlgo_Algo.jxx new file mode 100644 index 000000000..919494580 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Algo.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTTools_DSFiller_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Algo_HeaderFile +#include +#endif diff --git a/src/NMTAlgo/NMTAlgo_Builder.cdl b/src/NMTAlgo/NMTAlgo_Builder.cdl new file mode 100644 index 000000000..6f1aa3291 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Builder.cdl @@ -0,0 +1,98 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo_Builder.cdl +-- Created: Tue Jan 27 15:09:45 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Builder from NMTAlgo + inherits Algo from NMTAlgo + + ---Purpose: + +uses + Shape from TopoDS, + Face from TopoDS, + Edge from TopoDS, + IndexedMapOfShape from TopTools, + IndexedDataMapOfShapeListOfShape from TopTools, + IndexedDataMapOfShapeShape from TopTools, + Image from BRepAlgo, + DSFiller from NMTTools +--raises + +is + Create + returns Builder from NMTAlgo; + ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Builder();" + + Clear (me:out) + is redefined; + + ComputeWithFiller(me:out; + aDSF: DSFiller from NMTTools) + is redefined; + + FillImagesEdges (me:out) + is protected; + + FillIn2DParts (me:out) + is protected; + + FillImagesFaces (me:out) + is protected; + + FillSDFaces (me:out) + is protected; + + --- Queries + SplitVertices (me:out) + is protected; + + IsSectionEdge (me; + E : Edge from TopoDS) + returns Boolean from Standard + is protected; + + HasSameDomainF(me; + F : Face from TopoDS) + returns Boolean from Standard + is protected; + + IsSameDomainF(me; + F1 : Face from TopoDS; + F2 : Face from TopoDS) + returns Boolean from Standard + is protected; + +fields + + myImagesEdges : Image from BRepAlgo is protected; + myImagesFaces : Image from BRepAlgo is protected; + + myQueryShapes : IndexedMapOfShape from TopTools is protected; + -- + myIn2DParts : IndexedDataMapOfShapeListOfShape from TopTools is protected; + mySectionParts : IndexedDataMapOfShapeListOfShape from TopTools is protected; + mySDFaces : IndexedDataMapOfShapeShape from TopTools is protected; + -- +end Builder; diff --git a/src/NMTAlgo/NMTAlgo_Builder.cxx b/src/NMTAlgo/NMTAlgo_Builder.cxx new file mode 100644 index 000000000..7be4895b3 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Builder.cxx @@ -0,0 +1,668 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Inter3d.cxx +// Created: Tue Jan 27 15:14:13 2004 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +// function: NMTAlgo_Inter3d::NMTAlgo_Inter3d() +// purpose: +//======================================================================= + NMTAlgo_Builder::NMTAlgo_Builder() +: + NMTAlgo_Algo() +{ +} +//======================================================================= +// function: ~NMTAlgo_Builder +// purpose: +//======================================================================= + NMTAlgo_Builder::~NMTAlgo_Builder() +{ + Clear(); +} +//======================================================================= +// function: Clear +// purpose: +//======================================================================= + void NMTAlgo_Builder::Clear() +{ + NMTAlgo_Algo::Clear(); + // + myImagesEdges.Clear(); + myImagesFaces.Clear(); + myIn2DParts.Clear(); + mySectionParts.Clear(); + mySDFaces.Clear(); +} +//======================================================================= +// function: ComputeWithFiller +// purpose: +//======================================================================= + void NMTAlgo_Builder::ComputeWithFiller(const NMTTools_DSFiller& aDSF) +{ + myErrorStatus=0; + myIsDone=Standard_False; + // + SetFiller(aDSF); + // edges + FillImagesEdges(); + // faces + FillIn2DParts(); + FillImagesFaces(); + FillSDFaces(); +} + +//======================================================================= +// function: FillSDFaces +// purpose: +//======================================================================= + void NMTAlgo_Builder::FillSDFaces() +{ + const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); + IntTools_Context& aCtx= pPF->ChangeContext(); + // + Standard_Boolean bIsSDF; + Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC; + TopTools_ListIteratorOfListOfShape aItF1, aItF2; + NMTTools_ListOfCoupleOfShape aLCS; + // + mySDFaces.Clear(); + // + // 1. For each FF find among images of faces + // all pairs of same domain faces (SDF) [=> aLCS] + aNbFF=aFFs.Extent(); + for (i=1; i<=aNbFF; ++i) { + BOPTools_SSInterference& aFF=aFFs(i); + aFF.Indices(nF1, nF2); + // + const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2)); + // + // if there are no in/on 2D split parts the faces nF1, nF2 + // can not be SDF + const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); + aNbPBInOn=aLPBInOn.Extent(); + if (!aNbPBInOn) { + continue; + } + // + // if there is at least one section edge between faces nF1, nF2 + // they can not be SDF + BOPTools_SequenceOfCurves& aSC=aFF.Curves(); + aNbC=aSC.Length(); + if (aNbC) { + continue; + } + // + // the faces are suspected to be SDF. + // Try to find SDF among images of nF1, nF2 + const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); + const TopTools_ListOfShape& aLF2=myImagesFaces.Image(aF2); + // + aItF1.Initialize(aLF1); + for (; aItF1.More(); aItF1.Next()) { + const TopoDS_Face& aF1x=TopoDS::Face(aItF1.Value()); + // + aItF2.Initialize(aLF2); + for (; aItF2.More(); aItF2.Next()) { + const TopoDS_Face& aF2y=TopoDS::Face(aItF2.Value()); + bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx); + if (bIsSDF) { + NMTTools_CoupleOfShape aCS; + // + aCS.SetShape1(aF1x); + aCS.SetShape2(aF2y); + aLCS.Append(aCS); + } + } + } + }//for (i=1; i<=aNbFF; ++i) + // + aNbC=aLCS.Extent(); + if (!aNbC) { + return; + } + // + // 2. Find Chains + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC; + // + NMTTools_Tools::FindChains(aLCS, aMC); + // + // 3. Fill the map of SDF mySDFaces + aNbC=aMC.Extent(); + for (i=1; i<=aNbC; ++i) { + const TopoDS_Shape& aF=aMC.FindKey(i); + const TopTools_IndexedMapOfShape& aMSDF=aMC(i); + // + aNbFF=aMSDF.Extent(); + for (j=1; j<=aNbFF; ++j) { + const TopoDS_Shape& aFSD=aMSDF(j); + mySDFaces.Add(aFSD, aF); + } + } + // +} +//======================================================================= +// function: FillImagesFaces +// purpose: +//======================================================================= + void NMTAlgo_Builder::FillImagesFaces() +{ + const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + IntTools_Context& aCtx= pPF->ChangeContext(); + // + Standard_Integer i, j, aNb, aNbE; + TopTools_IndexedMapOfShape aMFence, aME; + TColStd_IndexedMapOfInteger aMFP; + // + // 1. Select Faces to process (MFP) + aNb=aDS.NumberOfShapesOfTheObject(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aF=aDS.Shape(i); + if (aF.ShapeType()!=TopAbs_FACE) { + continue; + } + if (aMFence.Contains(aF)) { + continue; + } + aMFence.Add(aF); + // + if (myIn2DParts.Contains(aF)) { + aMFP.Add(i); + continue; + } + // + if (mySectionParts.Contains(aF)) { + aMFP.Add(i); + continue; + } + // + aME.Clear(); + TopExp::MapShapes(aF, TopAbs_EDGE, aME); + // + aNbE=aME.Extent(); + for(j=1; j<=aNbE; ++j) { + const TopoDS_Shape& aE=aME(j); + // + if (myImagesEdges.HasImage(aE)) { + aMFP.Add(i); + break; + } + } + }// for (i=1; i<=aNb; ++i) + // + // 2. ProcessFaces + Standard_Boolean bToReverse, bIsClosed, bIsDegenerated; + Standard_Integer aNbF, nF; + TopoDS_Face aFF; + TopoDS_Edge aSp; + TopExp_Explorer anExp; + TopTools_ListIteratorOfListOfShape aIt; + BRepAlgo_Image aImagesFaces; + TopAbs_Orientation anOriF; + // + aNbF=aMFP.Extent(); + for (i=1; i<=aNbF; ++i) { + nF=aMFP(i); + const TopoDS_Face& aF=TopoDS::Face(aDS.Shape(nF)); + anOriF=aF.Orientation(); + aFF=aF; + aFF.Orientation(TopAbs_FORWARD); + // + aMFence.Clear(); + // + // 2.1. Fill WES + BOP_WireEdgeSet aWES; + aWES.Initialize(aFF); + // + // 2.1.1. Add Split parts + anExp.Init(aFF, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current()); + // + if (!myImagesEdges.HasImage(aE)) { + aWES.AddStartElement(aE); + continue; + } + // + bIsDegenerated=BRep_Tool::Degenerated(aE); + bIsClosed=BRep_Tool::IsClosed(aE, aF); + // + const TopTools_ListOfShape& aLIE=myImagesEdges.Image(aE); + aIt.Initialize(aLIE); + for (; aIt.More(); aIt.Next()) { + aSp=TopoDS::Edge(aIt.Value()); + // + if (bIsDegenerated) { + aSp.Orientation(aE.Orientation()); + aWES.AddStartElement(aSp); + continue; + } + // + if (bIsClosed){ + if (!aMFence.Contains(aSp)){ + aMFence.Add(aSp); + // + if (!BRep_Tool::IsClosed(aSp, aF)){ + BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF); + } + // + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + // + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); + continue; + } + } + // + bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx); + if (bToReverse) { + aSp.Reverse(); + } + aWES.AddStartElement(aSp); + } + } + // + // 2.1.2. Add In2D Parts + if (myIn2DParts.Contains(aF)) { + const TopTools_ListOfShape& aLE=myIn2DParts.FindFromKey(aF); + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + aSp=TopoDS::Edge(aIt.Value()); + // + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + // + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); + } + } + // + // 2.1.3. Add Section Parts + if (mySectionParts.Contains(aF)) { + const TopTools_ListOfShape& aLE=mySectionParts.FindFromKey(aF); + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + aSp=TopoDS::Edge(aIt.Value()); + // + aSp.Orientation(TopAbs_FORWARD); + aWES.AddStartElement(aSp); + // + aSp.Orientation(TopAbs_REVERSED); + aWES.AddStartElement(aSp); + } + } + // + // 2.2. Build images Faces + BOP_FaceBuilder aFB; + // + aFB.SetTreatment(0); // 0-Do Internal Edges + aFB.SetTreatSDScales(0); // what is 0 ?? + // + aFB.Do(aWES); + // + TopTools_ListOfShape aLFR; + // + const TopTools_ListOfShape& aLF=aFB.NewFaces(); + + aIt.Initialize(aLF); + for (; aIt.More(); aIt.Next()) { + TopoDS_Shape& aFR=aIt.Value(); + if (anOriF==TopAbs_REVERSED) { + aFR.Orientation(TopAbs_REVERSED); + } + aLFR.Append(aFR); + } + + // + // 2.3. Collect images Faces + myImagesFaces.Bind(aF, aLFR); + }//for (i=1; i<=aNbF; ++i) +} +//======================================================================= +// function: FillIn2DParts +// purpose: +//======================================================================= + void NMTAlgo_Builder::FillIn2DParts() +{ + const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*)&myDSFiller->InterfPool(); + BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); + // + Standard_Integer i, j, aNb, nF1, nF2, aNbFF, iFF, nSpIn, nSpSc, aNbCurves; + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aFFMap; + BOPTools_ListOfPaveBlock aLPBIn, aLPBSc; + BOPTools_ListIteratorOfListOfPaveBlock aItPBIn, aItPBSc; + TopTools_IndexedMapOfShape aMF, aMFence; + TopTools_ListOfShape aLSpIn, aLSpSc; + // + BOP_BuilderTools::DoMap(aFFs, aFFMap); + // + // 1. Collect Splits In 2D (myIn2DParts) and + // Section Edges (mySectionParts) + // for each source face that involved in FF + aNb=aFFMap.Extent(); + for (i=1; i<=aNb; ++i) { + nF1=aFFMap.FindKey(i); + const TopoDS_Shape& aF=aDS.Shape(nF1); + // + if (aMF.Contains(aF)) { + continue; + } + aMF.Add(aF); + // + aLPBIn.Clear(); + aLPBSc.Clear(); + // + const TColStd_IndexedMapOfInteger& aFFIndicesMap=aFFMap.FindFromIndex(i); + // + aNbFF=aFFIndicesMap.Extent(); + for (j=1; j<=aNbFF; ++j) { + iFF=aFFIndicesMap(j); + BOPTools_SSInterference& aFF=aFFs(iFF); + nF2=aFF.OppositeIndex(nF1); + // + // In 2D + pPF->RealSplitsInFace(0, nF2, nF1, aLPBIn); + // + // Sections + BOPTools_SequenceOfCurves& aSC=aFF.Curves(); + aNbCurves=aSC.Length(); + if (!aNbCurves) { + continue; + } + // + const BOPTools_Curve& aBC=aSC(1); + const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks(); + // + aItPBSc.Initialize(aLPB); + for (; aItPBSc.More(); aItPBSc.Next()) { + const BOPTools_PaveBlock& aPBSc=aItPBSc.Value(); + aLPBSc.Append(aPBSc); + } + }// for (j=1; j<=aNbFF; ++j) + // + // In 2D Parts + aMFence.Clear(); + // + aLSpIn.Clear(); + aItPBIn.Initialize(aLPBIn); + for (; aItPBIn.More(); aItPBIn.Next()) { + const BOPTools_PaveBlock& aPBR=aItPBIn.Value(); + nSpIn=aPBR.Edge(); + const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn); + if (!aMFence.Contains(aSpIn)){ + aMFence.Add(aSpIn); + aLSpIn.Append(aSpIn); + } + } + myIn2DParts.Add(aF, aLSpIn); + // + // Section Parts + aLSpSc.Clear(); + aItPBSc.Initialize(aLPBSc); + for (; aItPBSc.More(); aItPBSc.Next()) { + const BOPTools_PaveBlock& aPBSc=aItPBSc.Value(); + nSpSc=aPBSc.Edge(); + const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc); + if (!aMFence.Contains(aSpSc)){ + aMFence.Add(aSpSc); + aLSpSc.Append(aSpSc); + } + } + mySectionParts.Add(aF, aLSpSc); + } //for (i=1; i<=aNb; ++i) +} + +//======================================================================= +// function: FillImagesEdges +// purpose: +//======================================================================= + void NMTAlgo_Builder::FillImagesEdges() +{ + const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); + // + Standard_Integer nE, aNb, aNbSp, nSp; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + TopTools_IndexedMapOfShape aMFence; + TopTools_ListOfShape aLSp; + // + aNb=aDS.NumberOfShapesOfTheObject(); + for (nE=1; nE<=aNb; ++nE) { + const TopoDS_Shape& aE=aDS.Shape(nE); + if (aE.ShapeType()!=TopAbs_EDGE) { + continue; + } + if (aMFence.Contains(aE)) { + continue; + } + aMFence.Add(aE); + // + const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(nE)); + aNbSp=aLPB.Extent(); + // + if (!aNbSp) {// no splits + //myImagesEdges.Bind(aE, aE); + continue; + } + // + //modified by NIZNHY-PKV Fri Jan 21 17:01:10 2005 f + if (aNbSp==1) { + const BOPTools_PaveBlock& aPB1=aLPB.First(); + const BOPTools_PaveBlock& aPBR1=pPF->RealPaveBlock(aPB1); + nSp=aPBR1.Edge(); + const TopoDS_Shape& aSp1=aDS.Shape(nSp); + if (aSp1.IsSame(aE)) { + continue; + } + } + //modified by NIZNHY-PKV Fri Jan 21 17:01:14 2005 t + // + aLSp.Clear(); + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB); + nSp=aPBR.Edge(); + const TopoDS_Shape& aSp=aDS.Shape(nSp); + aLSp.Append(aSp); + } + myImagesEdges.Bind(aE, aLSp); + } +} +//======================================================================= +// function: SplitVertices +// purpose: +//======================================================================= + void NMTAlgo_Builder::SplitVertices() +{ + const NMTDS_ShapesDataStructure& aDS=myDSFiller->DS(); + NMTTools_PaveFiller* pPF=(NMTTools_PaveFiller*)&(myDSFiller->PaveFiller()); + const BOPTools_SplitShapesPool& aSSP=pPF->SplitShapesPool(); + // + Standard_Integer nE, aNb, aNbSp, nV1, nV2; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + // + myQueryShapes.Clear(); + // + aNb=aDS.NumberOfShapesOfTheObject(); + for (nE=1; nE<=aNb; ++nE) { + const TopoDS_Shape& aE=aDS.Shape(nE); + if (aE.ShapeType()!=TopAbs_EDGE) { + continue; + } + // + const BOPTools_ListOfPaveBlock& aLPB=aSSP(aDS.RefEdge(nE)); + aNbSp=aLPB.Extent(); + // + if (!aNbSp) {// no splits + continue; + } + // + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB); + // + nV1=aPBR.Pave1().Index(); + if (aDS.IsNewShape(nV1)) { + const TopoDS_Shape& aV1=aDS.Shape(nV1); + myQueryShapes.Add(aV1); + } + // + nV2=aPBR.Pave2().Index(); + if (aDS.IsNewShape(nV2)) { + const TopoDS_Shape& aV2=aDS.Shape(nV2); + myQueryShapes.Add(aV2); + } + } + } +} +//======================================================================= +// function: IsSectionEdge +// purpose: +//======================================================================= + Standard_Boolean NMTAlgo_Builder::IsSectionEdge(const TopoDS_Edge& aE)const +{ + return myImagesEdges.HasImage(aE); +} +//======================================================================= +// function: IsSameDomainF +// purpose: +//======================================================================= + Standard_Boolean NMTAlgo_Builder::HasSameDomainF(const TopoDS_Face& aF1)const +{ + Standard_Boolean bFlag=Standard_False; + TopTools_ListIteratorOfListOfShape aItF1; + // + const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); + aItF1.Initialize(aLF1); + for (; aItF1.More(); aItF1.Next()) { + const TopoDS_Shape& aF1x=aItF1.Value(); + // + if (mySDFaces.Contains(aF1x)){ + return !bFlag; + } + } + return bFlag; +} +//======================================================================= +// function: IsSameDomainF +// purpose: +//======================================================================= + Standard_Boolean NMTAlgo_Builder::IsSameDomainF(const TopoDS_Face& aF1, + const TopoDS_Face& aF2)const +{ + Standard_Boolean bFlag=Standard_False; + TopTools_ListIteratorOfListOfShape aItF1, aItF2; + // + const TopTools_ListOfShape& aLF1=myImagesFaces.Image(aF1); + const TopTools_ListOfShape& aLF2=myImagesFaces.Image(aF2); + // + aItF1.Initialize(aLF1); + for (; aItF1.More(); aItF1.Next()) { + const TopoDS_Shape& aF1x=aItF1.Value(); + // + if (!mySDFaces.Contains(aF1x)){ + continue; + } + const TopoDS_Shape& aFSD1x=mySDFaces.FindFromKey(aF1x); + // + aItF2.Initialize(aLF2); + for (; aItF2.More(); aItF2.Next()) { + const TopoDS_Shape& aF2y=aItF2.Value(); + if (!mySDFaces.Contains(aF2y)){ + continue; + } + const TopoDS_Shape& aFSD2y=mySDFaces.FindFromKey(aF2y); + if (aFSD1x.IsSame(aFSD2y)) { + return !bFlag; + } + } + } + return bFlag; +} diff --git a/src/NMTAlgo/NMTAlgo_Builder.jxx b/src/NMTAlgo/NMTAlgo_Builder.jxx new file mode 100644 index 000000000..06f18a20a --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Builder.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTTools_DSFiller_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Builder_HeaderFile +#include +#endif diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.cdl b/src/NMTAlgo/NMTAlgo_Loop3d.cdl new file mode 100644 index 000000000..096bd9b5c --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Loop3d.cdl @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +class Loop3d from NMTAlgo + + ---Purpose: Builds the shells from a set of faces. + -- Provides methods for comparing faces mutual + -- location. + +uses + Vec from gp, + MapOfOrientedShape from TopTools, + IndexedDataMapOfShapeListOfShape from TopTools, + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + Shape from TopoDS + +is + + Create + returns Loop3d from NMTAlgo ; + + AddConstFaces (me:out; + S : Shape from TopoDS) + ---Purpose: Add faces of as unique faces in the result. + is static; + + AddSectionFaces (me:out; + S : Shape from TopoDS) + ---Purpose: Add faces of as double faces in the result. + is static; + + MakeShells (me:out; + AvoidFacesMap : MapOfOrientedShape from TopTools) + returns ListOfShape from TopTools is static; + ---Purpose: Make and return shells. + -- can contain faces that must not be + -- added to result shells. + ---C++: return const & + + + ---Category: class methods + + IsInside (myclass; E : Edge from TopoDS; + F1, F2 : Face from TopoDS; + CountDot : Boolean from Standard; + Dot : in out Real from Standard; + GoodOri : in out Boolean from Standard) + returns Boolean from Standard; + ---Purpose: check if is inside by edge . + -- if , compute : scalar production of + -- normalized vectors pointing inside faces, and + -- check if faces are oriented well for sewing + + Normal (myclass; E : Edge from TopoDS; + F : Face from TopoDS) + returns Vec from gp; + + +fields + + myNewShells : ListOfShape from TopTools; -- result + + myFaces : ListOfShape from TopTools; + myEFMap : IndexedDataMapOfShapeListOfShape from TopTools; + +end Loop3d; diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.cxx b/src/NMTAlgo/NMTAlgo_Loop3d.cxx new file mode 100644 index 000000000..ae99c5d63 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Loop3d.cxx @@ -0,0 +1,349 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// + +//using namespace std; + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static + TopoDS_Edge FindEinF(const TopoDS_Edge&, const TopoDS_Face&); +static + gp_Vec NextNormal(const TopoDS_Edge&, const TopoDS_Face&); + +//======================================================================= +//function : +//purpose : +//======================================================================= + NMTAlgo_Loop3d::NMTAlgo_Loop3d() +{ +} + +//======================================================================= +//function : AddConstFaces +//purpose : Add faces of as unique faces in the result. +//======================================================================= + void NMTAlgo_Loop3d::AddConstFaces(const TopoDS_Shape& S) +{ + TopExp_Explorer FaceExp(S, TopAbs_FACE); + for (; FaceExp.More(); FaceExp.Next()){ + myFaces.Append( FaceExp.Current() ); + } + TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, myEFMap); +} + +//======================================================================= +//function : AddSectionFaces +//purpose : Add faces of as double faces in the result. +//======================================================================= + void NMTAlgo_Loop3d::AddSectionFaces(const TopoDS_Shape& S) +{ + AddConstFaces( S ); + AddConstFaces( S.Reversed() ); +} + +//======================================================================= +//function : MakeShells +//purpose : Make and return shells. +// can contain faces that must not be +// added to result shells. +//======================================================================= + const TopTools_ListOfShape& NMTAlgo_Loop3d::MakeShells + (const TopTools_MapOfOrientedShape& AvoidFacesMap) +{ + myNewShells.Clear(); + + BRep_Builder Builder; + TopTools_MapOfShape CheckedEdgesMap; + TopTools_MapOfOrientedShape AddedFacesMap; + + TopTools_ListIteratorOfListOfShape itF (myFaces); + for (; itF.More(); itF.Next()) { + const TopoDS_Shape& FF = itF.Value(); + if (AvoidFacesMap.Contains( FF ) || + ! AddedFacesMap.Add( FF ) ) + continue; + + // make a new shell + TopoDS_Shell Shell; + Builder.MakeShell(Shell); + Builder.Add(Shell,FF); + + // clear the maps from shapes added to previous Shell + TopTools_MapIteratorOfMapOfShape itEM (CheckedEdgesMap); + for (; itEM.More(); itEM.Next()) { + TopTools_ListOfShape& FL = myEFMap.ChangeFromKey( itEM.Key()); + TopTools_ListIteratorOfListOfShape it (FL); + while ( it.More()) { + if (AddedFacesMap.Contains( it.Value())) + FL.Remove( it ); + else + it.Next(); + } + } + CheckedEdgesMap.Clear(); + + + // loop on faces added to Shell; add their neighbor faces to Shell and so on + TopoDS_Iterator itAddedF (Shell); + for (; itAddedF.More(); itAddedF.Next()){ + const TopoDS_Face& F = TopoDS::Face (itAddedF.Value()); + + // loop on edges of F; find a good neighbor face of F by E + TopExp_Explorer EdgeExp(F, TopAbs_EDGE); + for (; EdgeExp.More(); EdgeExp.Next()){ + const TopoDS_Edge& E = TopoDS::Edge( EdgeExp.Current()); + if (! CheckedEdgesMap.Add( E )) + continue; + + // candidate faces list + const TopTools_ListOfShape& FL = myEFMap.ChangeFromKey(E); + if (FL.IsEmpty()) + continue; + // select one of neighbors + TopoDS_Face SelF; + if (FL.Extent() == 2) { + if (! F.IsSame( FL.First() )) + SelF = TopoDS::Face( FL.First() ); + else if (!F.IsSame( FL.Last() )) + SelF = TopoDS::Face( FL.Last() ); + } + else { + // check if a face already added to Shell shares E + TopTools_ListIteratorOfListOfShape it (FL); + Standard_Boolean found = Standard_False; + for (; !found && it.More(); it.Next()) + if (F != it.Value()) + found = AddedFacesMap.Contains( it.Value() ); + if (found) + continue; + // select basing on geometrical check + Standard_Boolean GoodOri, inside; + Standard_Real dot, MaxDot = -100; + TopTools_ListOfShape TangFL; // tangent faces + for ( it.Initialize( FL ) ; it.More(); it.Next()) { + const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); + if (NeighborF.IsSame( F )) + continue; + inside = NMTAlgo_Loop3d::IsInside( E, F, NeighborF, 1, dot, GoodOri); + if (!GoodOri) + continue; + if (!inside) + dot = -dot - 3; + if (dot < MaxDot) + continue; + if ( IsEqual( dot, MaxDot)) + TangFL.Append(SelF); + else + TangFL.Clear(); + MaxDot = dot; + SelF = NeighborF; + } + if (!TangFL.IsEmpty()) { + for (it.Initialize( TangFL ); it.More(); it.Next()) { + const TopoDS_Face& NeighborF = TopoDS::Face( it.Value()); + if (NMTAlgo_Loop3d:: IsInside( E, SelF , NeighborF, 0, dot, GoodOri)) + SelF = NeighborF; + } + } + } + if (!SelF.IsNull() && + AddedFacesMap.Add( SelF ) && + !AvoidFacesMap.Contains( SelF )) + Builder.Add( Shell, SelF); + + } // loop on edges of F + + } // loop on the faces added to Shell + + // Shell is complete + myNewShells.Append( Shell ); + + } // loop on myFaces + + + // prepare to the next call + myFaces.Clear(); + myEFMap.Clear(); + + return myNewShells; +} +//======================================================================= +//function : Normal +//purpose : +//======================================================================= + gp_Vec NMTAlgo_Loop3d::Normal(const TopoDS_Edge& E, + const TopoDS_Face& F) +{ + gp_Vec Norm, V1, V2; + Standard_Real First, Last; + gp_Pnt Ps; + + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); + Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); + + gp_Pnt2d p = C2d->Value( 0.5*(First+Last) ); + Sf->D1(p.X(), p.Y(), Ps, V1, V2); + Norm = V1.Crossed(V2); + + if (F.Orientation() == TopAbs_REVERSED ) + Norm.Reverse(); + + return Norm; +} +//======================================================================= +//function : IsInside +//purpose : check if is inside by edge . +// if , compute : scalar production of +// normalized vectors pointing inside faces, and +// check if faces are oriented well for sewing +//======================================================================= + Standard_Boolean NMTAlgo_Loop3d::IsInside(const TopoDS_Edge& E, + const TopoDS_Face& F1, + const TopoDS_Face& F2, + const Standard_Boolean CountDot, + Standard_Real& Dot, + Standard_Boolean& GoodOri) +{ + Standard_Real f, l; + gp_Pnt P; + gp_Vec Vc1, Vc2, Vin1, Vin2, Nf1, Nf2; + Handle(Geom_Curve) Curve = BRep_Tool::Curve(E,f,l); + Curve->D1( 0.5*(f + l), P, Vc2); + TopoDS_Edge E1, E2 = FindEinF (E, F2); + if (E2.Orientation() == TopAbs_REVERSED ) Vc2.Reverse(); + + Nf1 = Normal(E,F1); + Nf2 = Normal(E,F2); + + Standard_Real sin = + Nf1.CrossSquareMagnitude(Nf2) / Nf1.SquareMagnitude() / Nf2.SquareMagnitude(); + Standard_Boolean tangent = sin < 0.001; + + Standard_Boolean inside = 0; + if (tangent) { + E1 = FindEinF (E, F1); + gp_Vec NNf1 = NextNormal(E1,F1); + gp_Vec NNf2 = NextNormal(E2,F2); + Vin2 = NNf2.Crossed(Vc2); + inside = Vin2 * NNf1 < 0; + } + else { + Vin2 = Nf2.Crossed(Vc2); + inside = Vin2 * Nf1 < 0; + } + + if (!CountDot) return inside; + + if (tangent) + Vin2 = Nf2.Crossed(Vc2); + else + E1 = FindEinF (E, F1); + + Vc1 = Vc2; + if (E1.Orientation() != E2.Orientation()) + Vc1.Reverse(); + Vin1 = Nf1.Crossed(Vc1); + + if (tangent) { + Standard_Real N1N2 = Nf1 * Nf2; + GoodOri = (Vin2 * Vin1 < 0) ? N1N2 > 0 : N1N2 < 0; + } + else { + Standard_Real V1N2 = Vin1 * Nf2; + GoodOri = ( inside ? V1N2 <= 0 : V1N2 >= 0); + } + + Vin1.Normalize(); + Vin2.Normalize(); + + Dot = Vin2 * Vin1; + + return inside; +} +//======================================================================= +//function : NextNormal +//purpose : find normal to F at point a little inside F near the middle of E +//warning : E must be properly oriented in F. +//======================================================================= +gp_Vec NextNormal(const TopoDS_Edge& E, + const TopoDS_Face& F) +{ + Standard_Real First, Last; + + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface (E, F, First, Last); + Handle(Geom_Surface) Sf = BRep_Tool::Surface(F); + + gp_Pnt2d p; + gp_Vec2d v; + C2d->D1( 0.5*(First+Last), p, v); + if (E.Orientation() != F.Orientation()) + v.Reverse(); + gp_Dir2d dir( -v.Y(), v.X() ); // dir inside F + + Standard_Real duv = 1e-6; // this is not Ok and may give incorrect result if + // resolutionUV of compared faces is very different. To have a good result, + //it is necessary to get normal to faces at points equidistant from E in 3D + + p.SetX( p.X() + dir.X()*duv ); + p.SetY( p.Y() + dir.Y()*duv ); + + gp_Pnt Ps; + gp_Vec Norm, V1, V2; + Sf->D1( p.X(), p.Y(), Ps, V1, V2); + Norm = V1.Crossed(V2); + + if (F.Orientation() == TopAbs_REVERSED ) + Norm.Reverse(); + + return Norm; +} +//======================================================================= +//function : FindEinF +//purpose : find E in F +//======================================================================= +TopoDS_Edge FindEinF(const TopoDS_Edge& E, + const TopoDS_Face& F) +{ + TopExp_Explorer expl (F, TopAbs_EDGE); + for (; expl.More(); expl.Next()) + if( E.IsSame( expl.Current() )) + return TopoDS::Edge(expl.Current()); + TopoDS_Edge nullE; + return nullE; +} diff --git a/src/NMTAlgo/NMTAlgo_Loop3d.jxx b/src/NMTAlgo/NMTAlgo_Loop3d.jxx new file mode 100644 index 000000000..f9d9b5b9c --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Loop3d.jxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopTools_MapOfOrientedShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _gp_Vec_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Loop3d_HeaderFile +#include +#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter.cdl b/src/NMTAlgo/NMTAlgo_Splitter.cdl new file mode 100644 index 000000000..96f8e1340 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter.cdl @@ -0,0 +1,200 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo_Splitter.cdl +-- Created: Tue Jan 27 15:09:45 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Splitter from NMTAlgo + inherits Builder from NMTAlgo + + ---Purpose: + +uses + Builder from BRep, + ShapeEnum from TopAbs, + Compound from TopoDS, + Face from TopoDS, + Edge from TopoDS, + Shape from TopoDS, + MapOfOrientedShape from TopTools, + IndexedMapOfShape from TopTools, + DataMapOfShapeShape from TopTools, + DataMapOfShapeListOfShape from TopTools, + ListOfShape from TopTools, + MapOfShape from TopTools, + AsDes from BRepAlgo, + Image from BRepAlgo, + + DSFiller from NMTTools + +--raises + +is + Create + returns Splitter from NMTAlgo; + ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Splitter();" + + AddShape (me:out; + S : Shape from TopoDS) + is virtual; + + AddTool (me:out; + S : Shape from TopoDS) + is virtual; + + Compute(me:out) + is virtual; + + Build (me:out; + aLimit:ShapeEnum from TopAbs=TopAbs_SHAPE) + is virtual; + + ComputeWithFiller(me:out; + aDSF: DSFiller from NMTTools) + is redefined; + +----vv + KeepShapesInside (me:out; + S : Shape from TopoDS); + ---Purpose: remove shapes that are outside of S from result. + -- S should be an object shape. + ---Warning: call it after Build() + + RemoveShapesInside (me:out; + S : Shape from TopoDS); + ---Purpose: remove shapes that are inside S from result. + -- S should be an object shape. + ---Warning: call it after Build() + + Modified(me:out; + S : Shape from TopoDS) + returns ListOfShape from TopTools; + ---Purpose: Returns the list of shapes modified from the shape . + ---C++: return const & + ---Level: Public + + Generated(me:out; + S : Shape from TopoDS) + returns ListOfShape from TopTools; + ---Purpose: Returns the list of shapes generated from the shape . + ---C++: return const & + ---Level: Public + + IsDeleted (me:out; + S : Shape from TopoDS) + returns Boolean from Standard; +----^^ + + Clear (me:out) + is redefined; + + SourceShapes(me) + returns ListOfShape from TopTools; + ---C++: return const & + + FillResult(me:out) + is protected; + + FillImageShape(me:out) + is protected; + + SplittedFaces (me:out) + is protected; + + SplittedWires (me:out) + is protected; + + SplitsAndSections (me:out) + is protected; + + ShellsAndSolids(me:out) + is protected; + + MakeShells(me:out; + aS :Shape from TopoDS; + aLNS:out ListOfShape from TopTools) + is protected; + + MakeSolids (me:out; + Solid : Shape from TopoDS; + Shells: out ListOfShape from TopTools) + is protected; + + FindFacesInside (me:out; + S : Shape from TopoDS; + CheckClosed : Boolean from Standard= Standard_False; + All : Boolean from Standard= Standard_False) + returns Shape from TopoDS + is protected; + + IsInside (myclass; + S1,S2 : Shape from TopoDS) + returns Boolean from Standard is protected; + ---Purpose: Return True if the first vertex of S1 inside S2. + -- If S1.IsNull(), check infinite point against S2. + + GetOriginalShape(me; + aShape : Shape from TopoDS) + returns Shape from TopoDS + is protected; + +--modified by NIZNHY-PKV Tue Feb 1 10:24:39 2005f + FindImage(me:out; + aS : Shape from TopoDS; + aLIms: out ListOfShape from TopTools) + is protected; +--modified by NIZNHY-PKV Tue Feb 1 10:24:47 2005t + +fields + myDoneStep : ShapeEnum from TopAbs is protected; -- rebuilt level + myBuilder : Builder from BRep is protected; + + myListShapes : ListOfShape from TopTools is protected; -- object shapes + myMapFaces : MapOfShape from TopTools is protected; -- object faces + myMapTools : MapOfShape from TopTools is protected; -- tool faces + myEqualEdges : MapOfShape from TopTools is protected; -- equal splits + myNewSection : MapOfShape from TopTools is protected; -- new secton edges + myClosedShapes : MapOfShape from TopTools is protected; + myWrappingSolid: MapOfShape from TopTools is protected; -- solids having other shapes inside + myFaceShapeMap : DataMapOfShapeShape from TopTools is protected; -- to find a shape by face + + myInternalFaces: DataMapOfShapeShape from TopTools is protected; -- shape and its internal faces + myIntNotClFaces: DataMapOfShapeShape from TopTools is protected; -- internal but not closed + + myImageShape : Image from BRepAlgo is protected; + + -- avoid rebuilding twice commont part of solids + myAddedFacesMap: MapOfOrientedShape from TopTools is protected; + --***-- + mySourceShapes : ListOfShape from TopTools is protected; + myLimit : ShapeEnum from TopAbs is protected; + myToolShapes : MapOfShape from TopTools is protected; + myObjShapes : MapOfShape from TopTools is protected; + myMapSIFC : DataMapOfShapeShape from TopTools is protected; +----vv + myGenerated : ListOfShape from TopTools is protected; + --modified by NIZNHY-PKV Mon Jan 24 09:45:10 2005f + myModifiedFaces: DataMapOfShapeListOfShape from TopTools is protected; + --modified by NIZNHY-PKV Mon Jan 24 09:45:14 2005t +----^^ +end Splitter; diff --git a/src/NMTAlgo/NMTAlgo_Splitter.cxx b/src/NMTAlgo/NMTAlgo_Splitter.cxx new file mode 100644 index 000000000..5980d8319 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter.cxx @@ -0,0 +1,624 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Splitter.cxx +// Created: Thu Jan 29 17:13:03 2004 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +// +#include +#include +#include +#include + + +static + Standard_Boolean isClosed(const TopoDS_Shape& theShape); + +//======================================================================= +//function : NMTAlgo_Spliter::NMTAlgo_Splitter +//purpose : +//======================================================================= + NMTAlgo_Splitter::NMTAlgo_Splitter() +: + NMTAlgo_Builder() +{ + myErrorStatus=0; +} +//======================================================================= +// function: ~NMTAlgo_Splitter +// purpose: +//======================================================================= + NMTAlgo_Splitter::~NMTAlgo_Splitter() +{ + Clear(); + + if (myDSFiller){ + delete myDSFiller; + } +} +//======================================================================= +// function: SourceShapes +// purpose: +//======================================================================= + const TopTools_ListOfShape& NMTAlgo_Splitter::SourceShapes()const +{ + return mySourceShapes; +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + void NMTAlgo_Splitter::Clear() +{ + NMTAlgo_Builder::Clear(); + // + myListShapes.Clear(); + myMapFaces.Clear(); + myMapTools.Clear(); + myClosedShapes.Clear(); + myEqualEdges.Clear(); + myNewSection.Clear(); + myWrappingSolid.Clear(); + myFaceShapeMap.Clear(); + myInternalFaces.Clear(); + myIntNotClFaces.Clear(); + // + myImageShape.Clear(); + myAddedFacesMap.Clear(); + // + myDoneStep = TopAbs_SHAPE; + myIsComputed=Standard_False; + mySourceShapes.Clear(); + myObjShapes.Clear(); + myToolShapes.Clear(); + myMapSIFC.Clear(); + //modified by NIZNHY-PKV Mon Jan 24 09:47:37 2005f + myModifiedFaces.Clear(); + //modified by NIZNHY-PKV Mon Jan 24 09:47:41 2005t + myErrorStatus=0; +} +//======================================================================= +//function : AddShape +//purpose : add object Shape to be splited +//======================================================================= + void NMTAlgo_Splitter::AddShape(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + if (myIsComputed) { + // DS is already computed + myErrorStatus=100; + return; + } + // + if (aS.IsNull()){ + // Null shape is not allowed here + myErrorStatus=101; + return; + } + // + TopAbs_ShapeEnum aType=aS.ShapeType(); + // + if (aType < TopAbs_SOLID) { + // compound or compsolid + TopoDS_Iterator it (aS); + for (; it.More(); it.Next()) { + const TopoDS_Shape& aSS=it.Value(); + AddShape(aSS); + // to know compound by shape + myFaceShapeMap.Bind(aSS, aS); + } + return; + } + //--- + myObjShapes.Add(aS); + mySourceShapes.Append(aS); + //--- + // + TopExp_Explorer exp(aS, TopAbs_FACE); + if (!exp.More()) { + // do not split edges and vertices + return; + } + // not to add twice the same S + Standard_Integer nbFacesBefore = myMapFaces.Extent(); + // + for (; exp.More(); exp.Next()) { + const TopoDS_Shape& aFace = exp.Current(); + if (!myFaceShapeMap.IsBound(aFace)) { + // keep shape of tool face added as object + myFaceShapeMap.Bind(aFace, aS); + } + if (myMapFaces.Add(aFace)){ + myImagesFaces.SetRoot(aFace); + } + } + // + if (nbFacesBefore == myMapFaces.Extent()){ + return; + } + // solids must be processed before all + if (aType==TopAbs_SOLID){ + myListShapes.Prepend(aS); + } + else{ + myListShapes.Append(aS); + } + if (isClosed(aS)){ + myClosedShapes.Add(aS); + } +} +//======================================================================= +//function : AddTool +//purpose : add cutting tool that will _NOT_ be in result +//======================================================================= + void NMTAlgo_Splitter::AddTool(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + if (myIsComputed) { + // DS is already computed + myErrorStatus=100; + return; + } + // + if (aS.IsNull()){ + // Null shape is not allowed here + myErrorStatus=101; + return; + } + // + TopAbs_ShapeEnum aType=aS.ShapeType(); + + if (aType < TopAbs_SOLID) { // compound or compsolid + TopoDS_Iterator it (aS); + for (; it.More(); it.Next()) { + const TopoDS_Shape& aSS=it.Value(); + AddTool(aSS); + myFaceShapeMap.Bind(aSS, aS); // to know compound by shape + } + return; + } + //--- + myToolShapes.Add(aS); + mySourceShapes.Append(aS); + //--- + // + TopExp_Explorer exp(aS, TopAbs_FACE); + for (; exp.More(); exp.Next()) { + const TopoDS_Shape& aFace = exp.Current(); + myMapTools.Add(aFace); + myFaceShapeMap.Bind(aFace, aS); + } + // + // solids must be processed before all + if (aType==TopAbs_SOLID){ + myListShapes.Prepend(aS); + } + else{ + myListShapes.Append(aS); + } + // + if (isClosed(aS)) { + myClosedShapes.Add(aS); + } +} +//======================================================================= +// function: Compute +// purpose: +//======================================================================= + void NMTAlgo_Splitter::Compute() +{ + if (!mySourceShapes.Extent()){ + // No source shapes to treat + myErrorStatus=103; + return; + } + // + BRep_Builder aBB; + TopoDS_Compound aCS; + TopTools_ListIteratorOfListOfShape aIt; + // + aBB.MakeCompound(aCS); + // + aIt.Initialize(mySourceShapes); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + aBB.Add(aCS, aS); + } + // + NMTTools_DSFiller* pDSF=new NMTTools_DSFiller; + // + pDSF->SetCompositeShape(aCS); + pDSF->Perform(); + // + myIsComputed=Standard_False; + // + NMTAlgo_Splitter::ComputeWithFiller(*pDSF); +} +//======================================================================= +// function: ComputeWithFiller +// purpose: +//======================================================================= + void NMTAlgo_Splitter::ComputeWithFiller(const NMTTools_DSFiller& aDSF) +{ + myErrorStatus=0; + // + if (myIsComputed) { + // DS is already computed + myErrorStatus=100; + return; + } + // + if (!mySourceShapes.Extent()){ + // No source shapes to treat + myErrorStatus=103; + return; + } + // + NMTAlgo_Builder::ComputeWithFiller(aDSF); + // + myIsComputed=Standard_True; +} +//======================================================================= +//function : Build +//purpose : +//======================================================================= + void NMTAlgo_Splitter::Build(const TopAbs_ShapeEnum aLimit) +{ + myErrorStatus=0; + myLimit=aLimit; + // + if (!myIsComputed){ + myErrorStatus=102;// DS is not computed + return; + } + // + TopoDS_Compound aCShape; + // + myBuilder.MakeCompound(aCShape); + myShape=aCShape; + // + // 1. VERTEX + // + if (myLimit==TopAbs_VERTEX) { + SplitVertices(); + FillResult(); + return; + } + // + // 2. EDGE + if (myLimit==TopAbs_EDGE) { + SplitsAndSections(); + FillResult(); + return; + } + // + // 3. WIRE + FillImageShape(); + // + if (myLimit==TopAbs_WIRE) { + SplittedWires(); + FillResult(); + return; + } + // + // 4. FACE + // + if (myLimit==TopAbs_FACE) { + SplittedFaces(); + FillResult(); + return; + } + // + // 5.6. SHELL / SOLID + ShellsAndSolids(); + BOP_CorrectTolerances::CorrectTolerances(myShape, 0.01); +} +//======================================================================= +// function: SplitsAndSections +// purpose: +//======================================================================= + void NMTAlgo_Splitter::SplitsAndSections() +{ + Standard_Integer i, aNbE, aNbF; + TopTools_ListIteratorOfListOfShape aItLS, aIt; + TopTools_IndexedMapOfShape aME, aMF; + // + myQueryShapes.Clear(); + // + // 1. Splits / no splits + aItLS.Initialize(myListShapes); + for ( ;aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aS=aItLS.Value(); + // + if (myToolShapes.Contains(aS)) { + continue; // skip tool Shapes + } + // + TopExp::MapShapes(aS, TopAbs_EDGE, aME); + TopExp::MapShapes(aS, TopAbs_FACE, aMF); + } + // + // 1. Splits / no splits + aNbE=aME.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Shape& aE=aME(i); + // + if (!myImagesEdges.HasImage(aE)) { + myQueryShapes.Add(aE); + } + else { + const TopTools_ListOfShape& aLSp=myImagesEdges.Image(aE); + // + aIt.Initialize(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSp=aIt.Value(); + myQueryShapes.Add(aSp); + } + } + } + // + // 2. Sections + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=aMF(i); + if (mySectionParts.Contains(aF)) { + const TopTools_ListOfShape& aLSc=mySectionParts.FindFromKey(aF); + aIt.Initialize(aLSc); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSc=aIt.Value(); + myQueryShapes.Add(aSc); + } + } + } +} +//======================================================================= +// function: SplittedWires +// purpose: +//======================================================================= + void NMTAlgo_Splitter::SplittedWires() +{ + Standard_Integer i, aNbF; + TopoDS_Iterator aIt; + TopTools_IndexedMapOfShape aMF; + // + SplittedFaces(); + // + aMF=myQueryShapes; + myQueryShapes.Clear(); + // + aNbF=aMF.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=aMF(i); + aIt.Initialize(aF); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aW=aIt.Value(); + myQueryShapes.Add(aW); + } + } +} +//======================================================================= +// function: SplittedFaces +// purpose: +//======================================================================= + void NMTAlgo_Splitter::SplittedFaces() +{ + TopTools_ListIteratorOfListOfShape aIt; + TopoDS_Iterator aItF; + // + myQueryShapes.Clear(); + // + aIt.Initialize(myListShapes); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + // + if (myToolShapes.Contains(aS)) { + continue; + } + // + const TopoDS_Shape& aFC = myImageShape.Image(aS).First(); + aItF.Initialize(aFC); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Shape& aF=aItF.Value(); + myQueryShapes.Add(aF); + } + } +} +//======================================================================= +//function : FillImageShape +//purpose : +//======================================================================= + void NMTAlgo_Splitter::FillImageShape() +{ + Standard_Integer i, aNbF, iSense; + TopTools_ListIteratorOfListOfShape aItS, aItFI; + TopExp_Explorer aExp; + TopAbs_Orientation aOriFS; + TopoDS_Face aFIx, aFIy; + BRep_Builder aBB; + // + myImageShape.Clear(); + //modified by NIZNHY-PKV Mon Jan 24 09:48:15 2005f + myModifiedFaces.Clear(); + //modified by NIZNHY-PKV Mon Jan 24 09:48:18 2005t + // + aItS.Initialize(myListShapes); + for ( ;aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS=aItS.Value(); + // + myQueryShapes.Clear(); + // + aExp.Init(aS, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Face& aFS=TopoDS::Face(aExp.Current()); + aOriFS= aFS.Orientation(); + // + if (!myImagesFaces.HasImage(aFS)) { + myQueryShapes.Add(aFS); + //modified by NIZNHY-PKV Mon Jan 24 09:50:42 2005 f + if (!myModifiedFaces.IsBound(aFS)) { + TopTools_ListOfShape aLS; + // + aLS.Append(aFS); + myModifiedFaces.Bind(aFS, aLS); + } + //modified by NIZNHY-PKV Mon Jan 24 09:50:44 2005 t + continue; + } + // + const TopTools_ListOfShape& aLFI=myImagesFaces.Image(aFS); + aItFI.Initialize(aLFI); + for (; aItFI.More(); aItFI.Next()) { + const TopoDS_Face& aFI=TopoDS::Face(aItFI.Value()); + aFIx=aFI; + aFIx.Orientation(aOriFS); + // + if (mySDFaces.Contains(aFIx)) { + const TopoDS_Face& aFSDI=TopoDS::Face(mySDFaces.FindFromKey(aFIx)); + TopoDS_Face aFSDIx=aFSDI; + // + iSense=NMTAlgo_Tools::Sense(aFIx, aFSDIx); + // + if (iSense < 0) { + aFSDIx.Reverse(); + } + myQueryShapes.Add(aFSDIx); + //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f + aFIy=aFSDIx; + //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t + } + else { + myQueryShapes.Add(aFIx); + //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f + aFIy=aFIx; + //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t + } + //modified by NIZNHY-PKV Mon Jan 24 09:53:38 2005f + if (!myModifiedFaces.IsBound(aFS)) { + TopTools_ListOfShape aLS; + // + aLS.Append(aFIy); + myModifiedFaces.Bind(aFS, aLS); + } + else { + TopTools_ListOfShape& aLS=myModifiedFaces.ChangeFind(aFS); + aLS.Append(aFIy); + } + //modified by NIZNHY-PKV Mon Jan 24 09:53:43 2005t + } + }//for (; aExp.More(); aExp.Next()) { + // + TopoDS_Compound aCompound; + // + aBB.MakeCompound(aCompound); + // + aNbF=myQueryShapes.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=myQueryShapes(i); + aBB.Add(aCompound, aF); + } + // + myImageShape.Bind(aS, aCompound); + }// for ( ;aItS.More(); aItS.Next()) + // + myQueryShapes.Clear(); +} +//======================================================================= +//function : FillResult +//purpose : +//======================================================================= + void NMTAlgo_Splitter::FillResult() +{ + Standard_Integer i, aNb; + // + aNb=myQueryShapes.Extent(); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aS=myQueryShapes(i); + myBuilder.Add (myShape, aS); + } + BOP_CorrectTolerances::CorrectTolerances(myShape, 0.01); +} +//======================================================================= +//function : isClosed +//purpose : check id a shape is closed, ie is a solid or a closed shell +//======================================================================= + Standard_Boolean isClosed(const TopoDS_Shape& theShape) +{ + Standard_Boolean isClosed = (theShape.ShapeType() == TopAbs_SOLID); + // + if (!isClosed && theShape.ShapeType() == TopAbs_SHELL) { + TopTools_IndexedDataMapOfShapeListOfShape MEF; + TopExp::MapShapesAndAncestors(theShape, TopAbs_EDGE, TopAbs_FACE, MEF); + for (Standard_Integer i=1; isClosed && i<=MEF.Extent(); ++i) + isClosed = ( MEF(i).Extent() != 1 ); + } + // + return isClosed; +} +// +// myErrorStatus +// +// 100 - DS is already computed +// 101 - Null shape is not allowed here +// 102 - DS is not computed +// 103 - No source shapes to treat diff --git a/src/NMTAlgo/NMTAlgo_Splitter.jxx b/src/NMTAlgo/NMTAlgo_Splitter.jxx new file mode 100644 index 000000000..4f708f4f1 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTTools_DSFiller_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Splitter_HeaderFile +#include +#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.cdl b/src/NMTAlgo/NMTAlgo_Splitter1.cdl new file mode 100644 index 000000000..b8903281f --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter1.cdl @@ -0,0 +1,92 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo_Splitter1.cdl +-- Created: Wed Feb 11 14:23:25 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Splitter1 from NMTAlgo + inherits Splitter from NMTAlgo + + ---Purpose: + +uses + ShapeEnum from TopAbs, + Shape from TopoDS, + DataMapOfShapeInteger from TopTools + +--raises + +is + Create + returns Splitter1 from NMTAlgo; + ---C++: alias "Standard_EXPORT virtual ~NMTAlgo_Splitter1();" + + Clear (me:out) + is redefined; + + AddShape (me:out; + aS : Shape from TopoDS) + is redefined; + + + AddTool(me:out; + aS : Shape from TopoDS) + is redefined; + + + SetMaterial (me:out; + aS : Shape from TopoDS; + aM : Integer from Standard=0); + + SetRemoveWebs(me:out; + bFlag:Boolean from Standard); + + RemoveWebs(me) + returns Boolean from Standard; + + GetMaterialTable(me) + returns DataMapOfShapeInteger from TopTools; + ---C++: return const & + + Build (me:out; + Limit:ShapeEnum from TopAbs=TopAbs_SHAPE) + is redefined; + + -- protected block + TreatSolids (me:out) + is protected; + + TreatWebs (me:out) + is protected; + + RestParts (me:out) + is protected; + + +fields + myRemoveWebs : Boolean from Standard is protected; + myMapSWM : DataMapOfShapeInteger from TopTools is protected; + myMapSWMOut : DataMapOfShapeInteger from TopTools is protected; + myRestParts : Shape from TopoDS is protected; + +end Splitter1; diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.cxx b/src/NMTAlgo/NMTAlgo_Splitter1.cxx new file mode 100644 index 000000000..cb9f2861c --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter1.cxx @@ -0,0 +1,375 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Splitter1.cxx +// Created: Wed Feb 11 14:26:27 2004 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : NMTAlgo_Spliter1::NMTAlgo_Splitter1 +//purpose : +//======================================================================= + NMTAlgo_Splitter1::NMTAlgo_Splitter1() +: + NMTAlgo_Splitter() +{ + myRemoveWebs=Standard_False; +} +//======================================================================= +// function: ~NMTAlgo_Splitter1 +// purpose: +//======================================================================= + NMTAlgo_Splitter1::~NMTAlgo_Splitter1() +{ + Clear(); +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::Clear() +{ + NMTAlgo_Splitter::Clear(); + // + myRemoveWebs=Standard_False; + myMapSWM.Clear(); + myMapSWMOut.Clear(); +} +//======================================================================= +//function : SetRemoveWebs +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::SetRemoveWebs(const Standard_Boolean bFlag) +{ + myRemoveWebs=bFlag; +} +//======================================================================= +//function : RemoveWebs +//purpose : +//======================================================================= + Standard_Boolean NMTAlgo_Splitter1::RemoveWebs()const +{ + return myRemoveWebs; +} +//======================================================================= +//function : GetMaterialTable +//purpose : +//======================================================================= + const TopTools_DataMapOfShapeInteger& NMTAlgo_Splitter1::GetMaterialTable()const +{ + return myMapSWMOut; +} +//======================================================================= +//function : SetMaterial +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::SetMaterial(const TopoDS_Shape& aS, + const Standard_Integer iMt) +{ + TopExp_Explorer aExp; + // + aExp.Init(aS, TopAbs_SOLID); + for(; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aSd=aExp.Current(); + myMapSWM.Bind(aSd, iMt); + } +} +//======================================================================= +//function : AddShape +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::AddShape(const TopoDS_Shape& aS) +{ + SetMaterial(aS, 0); + NMTAlgo_Splitter::AddShape(aS); +} +//======================================================================= +//function : AddToolWithMaterial +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::AddTool(const TopoDS_Shape& aS) + +{ + SetMaterial(aS, 0); + NMTAlgo_Splitter::AddTool(aS); +} +//======================================================================= +//function : Build +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::Build(const TopAbs_ShapeEnum aLimit) +{ + NMTAlgo_Splitter::Build(aLimit); + // + myMapSWMOut.Clear(); + // + TreatSolids(); + // + if (myRemoveWebs && myMapSWMOut.Extent()) { + RestParts(); + TreatWebs(); + } +} +//======================================================================= +//function : TreatWebs +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::TreatWebs() +{ + Standard_Integer nMt; + TopTools_DataMapOfIntegerListOfShape aMMLS; + TopoDS_Iterator aIt; + TopTools_DataMapIteratorOfDataMapOfShapeInteger aIt2; + TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape aIt1; + TopTools_ListIteratorOfListOfShape aItS; + TopoDS_Compound aCx; + TopoDS_Shape aCSR; + // + aIt2.Initialize(myMapSWMOut); + for (; aIt2.More(); aIt2.Next()) { + const TopoDS_Shape& aS=aIt2.Key(); + nMt=aIt2.Value(); + // + if (aMMLS.IsBound(nMt)){ + TopTools_ListOfShape& aLS=aMMLS.ChangeFind(nMt); + aLS.Append(aS); + } + else { + TopTools_ListOfShape aLS; + aLS.Append(aS); + aMMLS.Bind(nMt, aLS); + } + } + // + myMapSWMOut.Clear(); + myBuilder.MakeCompound(aCx); + // + aIt1.Initialize(aMMLS); + for (; aIt1.More(); aIt1.Next()) { + nMt=aIt1.Key(); + // + TopoDS_Compound aCS; + myBuilder.MakeCompound(aCS); + const TopTools_ListOfShape& aLS=aIt1.Value(); + aItS.Initialize(aLS); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS=aItS.Value(); + myBuilder.Add(aCS, aS); + } + // + NMTAlgo_Tools::BreakWebs(aCS, aCSR); + // + aIt.Initialize(aCSR); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + myBuilder.Add(aCx, aS); + // + myMapSWMOut.Bind(aS, nMt); + } + } + // + aIt.Initialize(myRestParts); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + myBuilder.Add(aCx, aS); + } + // + myShape=aCx; +} + +//======================================================================= +//function : RestParts +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::RestParts() +{ + TopoDS_Iterator aIt; + TopoDS_Compound aR; + // + myBuilder.MakeCompound(aR); + // + aIt.Initialize(myShape); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if (aS.ShapeType()==TopAbs_SOLID){ + if (myMapSWMOut.IsBound(aS)) { + continue; + } + } + myBuilder.Add(aR, aS); + } + myRestParts=aR; +} +//======================================================================= +//function : TreatSolids +//purpose : +//======================================================================= + void NMTAlgo_Splitter1::TreatSolids() +{ + Standard_Integer i, j, aNbSd, aNbSdx, nMtMax, nMt; + TopAbs_ShapeEnum aType; + TopoDS_Iterator aIt; + TopTools_IndexedMapOfShape aMSo, aMSd; + TopTools_IndexedDataMapOfShapeListOfShape aMFS; + TopTools_ListIteratorOfListOfShape aItS, aItLS; + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCS; + // + TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); + TopExp::MapShapes(myShape, TopAbs_SOLID, aMSo); + // + aNbSd=aMSo.Extent(); + if (!aNbSd) { + return; + } + // + aItS.Initialize(myListShapes); + for ( ;aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS=aItS.Value(); + // + aType=aS.ShapeType(); + if (aType != TopAbs_SOLID) { + continue; + } + // + if (myToolShapes.Contains(aS)) { + continue; + } + // + if (!myMapSIFC.IsBound(aS)){ + continue; + } + // + aMSd.Clear(); + // + const TopoDS_Shape& aIFC=myMapSIFC.Find(aS); + // + aIt.Initialize(aIFC); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aIF=aIt.Value(); + if (aMFS.Contains(aIF)) { + const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aIF); + aItLS.Initialize(aLS); + for ( ;aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aSd=aItLS.Value(); + if (!aMSd.Contains(aSd)) { + aMSd.Add(aSd); + } + } + } + } + // + aNbSd=aMSd.Extent(); + if (!aNbSd) { + //modified by NIZNHY-PKV Thu Dec 23 15:07:46 2004 f + Standard_Boolean bFound; + //modified by NIZNHY-PKV Thu Dec 23 15:07:49 2004 t + TopoDS_Shape aSd; + // + const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); + //modified by NIZNHY-PKV Thu Dec 23 15:08:17 2004 f + //NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); + //aMSd.Add(aSd); + bFound=NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); + if (!aSd.IsNull()) { + aMSd.Add(aSd); + } + //modified by NIZNHY-PKV Thu Dec 23 15:09:02 2004 t + } + aMCS.Add(aS, aMSd); + } //for ( ;aItS.More(); aItS.Next()) + // + aMFS.Clear(); + // + aNbSd=aMCS.Extent(); + for (i=1; i<=aNbSd; ++i) { + const TopoDS_Shape& aSd=aMCS.FindKey(i); + const TopTools_IndexedMapOfShape& aMSdx=aMCS(i); + aNbSdx=aMSdx.Extent(); + for (j=1; j<=aNbSdx; ++j) { + const TopoDS_Shape& aSdx=aMSdx(j); + // + if (aMFS.Contains(aSdx)) { + TopTools_ListOfShape& aLS=aMFS.ChangeFromKey(aSdx); + aLS.Append(aSd); + } + else { + TopTools_ListOfShape aLS; + aLS.Append(aSd); + aMFS.Add(aSdx, aLS); + } + } + } + // + // Assign materials values to subsolids + // + myMapSWMOut.Clear(); + // + aNbSdx=aMFS.Extent(); + for (i=1; i<=aNbSdx; ++i) { + const TopoDS_Shape& aSdx=aMFS.FindKey(i); + const TopTools_ListOfShape& aLS=aMFS(i); + aItLS.Initialize(aLS); + for (j=0; aItLS.More(); aItLS.Next(), ++j) { + const TopoDS_Shape& aSd=aItLS.Value(); + // + if (!myMapSWM.IsBound(aSd)){ + continue; + } + // + nMt=myMapSWM.Find(aSd); + if (!j) { + nMtMax=nMt; + continue; + } + if (nMt>nMtMax) { + nMtMax=nMt; + } + } + myMapSWMOut.Bind(aSdx, nMtMax); + } + // +} diff --git a/src/NMTAlgo/NMTAlgo_Splitter1.jxx b/src/NMTAlgo/NMTAlgo_Splitter1.jxx new file mode 100644 index 000000000..b593e438d --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter1.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Splitter1_HeaderFile +#include +#endif diff --git a/src/NMTAlgo/NMTAlgo_Splitter_1.cxx b/src/NMTAlgo/NMTAlgo_Splitter_1.cxx new file mode 100644 index 000000000..7d25ba4f2 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter_1.cxx @@ -0,0 +1,935 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Splitter_1.cxx +// Created: Mon Feb 2 14:58:54 2004 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +static + void RefineShells(const TopoDS_Shape& , + TopTools_ListOfShape&); +static + void RefineSolids(const TopoDS_Shape& , + TopTools_ListOfShape&); + +//modified by NIZNHY-PKV Fri Feb 25 17:19:39 2005f XX +static + void GetPlanes (const TopoDS_Edge& anEx, + const TopTools_IndexedDataMapOfShapeListOfShape& anEFMapx, + const TopoDS_Face& aF1, + TopAbs_State& aStPF1); +//modified by NIZNHY-PKV Fri Feb 25 17:19:44 2005t XX + +//======================================================================= +//function : ShellsAndSolids +//purpose : +//======================================================================= + void NMTAlgo_Splitter::ShellsAndSolids() +{ + Standard_Boolean bMakeSolids; + TopAbs_ShapeEnum aType; + TopTools_ListIteratorOfListOfShape aItS; + TopTools_ListOfShape aLNS; + // + myAddedFacesMap.Clear(); + bMakeSolids=(myLimit==TopAbs_SHAPE || myLimit TopAbs_SHELL) { + continue;//face,wire,... + } + // + aLNS.Clear(); + // + MakeShells (aS, aLNS); + // + if (bMakeSolids && aType==TopAbs_SOLID) { + MakeSolids(aS, aLNS); + } + // + TopTools_ListIteratorOfListOfShape it (aLNS); + for (; it.More(); it.Next()) { + myBuilder.Add (myShape, it.Value()); + } + } + // + // add split faces + aItS.Initialize(myListShapes); + for ( ;aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS=aItS.Value(); + // + aType=aS.ShapeType(); + if (aType!=TopAbs_FACE || myMapTools.Contains(aS)) { + continue; + } + // + const TopoDS_Shape& aCSF=myImageShape.Image(aS).First(); + TopoDS_Iterator itS(aCSF); + for (; itS.More(); itS.Next()){ + const TopoDS_Shape& aF=itS.Value(); + if (!myAddedFacesMap.Contains(aF)){ + myBuilder.Add (myShape, aF); + } + } + } +} +//======================================================================= +//function : MakeShells +//purpose : split S into compound of shells +//======================================================================= +void NMTAlgo_Splitter::MakeShells(const TopoDS_Shape& aS, + TopTools_ListOfShape& aLNS) +{ + NMTAlgo_Loop3d aShellMaker; + // + // get compound of split faces of aS + const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); + aShellMaker.AddConstFaces(aFC); + // + // add split faces inside aS + if (myClosedShapes.Contains(aS)) { + // + // internal faces compound + TopoDS_Shape aIFC=FindFacesInside(aS, Standard_True); + aShellMaker.AddSectionFaces(aIFC); + } + // + aLNS=aShellMaker.MakeShells(myAddedFacesMap); + // + RefineShells(aS, aLNS); + // + // Add faces added to new shell to myAddedFacesMap: + // avoid rebuilding twice common part of 2 solids. + + TopTools_ListIteratorOfListOfShape itS(aLNS); + TopExp_Explorer expF; + for (; itS.More(); itS.Next()) { + const TopoDS_Shape& aSh=itS.Value(); + expF.Init (aSh, TopAbs_FACE); + for (; expF.More(); expF.Next()){ + myAddedFacesMap.Add (expF.Current()); + } + } + +} +//======================================================================= +//function : MakeSolids +//purpose : make solids out of Shells +//======================================================================= +void NMTAlgo_Splitter::MakeSolids(const TopoDS_Shape& theSolid, + TopTools_ListOfShape& theShellList) +{ + // for a solid wrapping other shells or solids without intersection, + // it is necessary to find shells making holes in it + Standard_Boolean isWrapping; + TopTools_ListOfShape aNewSolids; // result + TopTools_ListOfShape aHoleShells; + TopoDS_Shape anInfinitePointShape; + TopTools_DataMapOfShapeShape aInOutMap; + TopTools_ListIteratorOfListOfShape aShellIt, aSolisIt; + // + isWrapping = myWrappingSolid.Contains(theSolid); + if (!isWrapping && !theShellList.IsEmpty()) { + // check if theSolid initially has internal shells + TopoDS_Iterator aShellExp (theSolid); + aShellExp.Next(); + isWrapping = aShellExp.More(); + } + // + aShellIt.Initialize(theShellList); + for ( ; aShellIt.More(); aShellIt.Next()) { + const TopoDS_Shape & aShell = aShellIt.Value(); + // check if a shell is a hole of theSolid + if (isWrapping && IsInside(anInfinitePointShape, aShell)){ + aHoleShells.Append(aShell); + } + else { + // make a solid from a shell + TopoDS_Solid Solid; + myBuilder.MakeSolid( Solid ); + myBuilder.Add (Solid, aShell); + + aNewSolids.Append (Solid); + } + } + // + // find outer a shell most close to each hole shell + aShellIt.Initialize(aHoleShells); + for (; aShellIt.More(); aShellIt.Next()){ + const TopoDS_Shape & aHole = aShellIt.Value(); + // + aSolisIt.Initialize(aNewSolids); + for ( ; aSolisIt.More(); aSolisIt.Next()) { + const TopoDS_Shape & aSolid = aSolisIt.Value(); + // + if (! IsInside(aHole, aSolid)){ + continue; + } + // + if ( aInOutMap.IsBound (aHole)){ + const TopoDS_Shape & aSolid2 = aInOutMap( aHole ); + if ( IsInside( aSolid, aSolid2 )) { + aInOutMap.UnBind( aHole ); + aInOutMap.Bind ( aHole, aSolid ); + } + } + else{ + aInOutMap.Bind (aHole, aSolid); + } + } + // + // add aHole to a solid + if (aInOutMap.IsBound( aHole )){ + TopoDS_Shape & aSolid=aInOutMap(aHole); + myBuilder.Add (aSolid, aHole); + } + } + // + theShellList.Clear(); + // + RefineSolids(theSolid, aNewSolids); + // + theShellList.Append(aNewSolids); +} + +//======================================================================= +//function : FindFacesInside +//purpose : return compound of faces of other shapes that are +// inside . +// is an object shape. +// makes avoid faces that do not form a +// closed shell +// makes return already added faces +//======================================================================= + TopoDS_Shape NMTAlgo_Splitter::FindFacesInside(const TopoDS_Shape& theShape, + const Standard_Boolean CheckClosed, + const Standard_Boolean All) +{ + TopExp_Explorer expl; + TopAbs_State aState; + // + // ================================================ + // check if internal faces have been already found + // ================================================ + if (myInternalFaces.IsBound(theShape)) { + TopoDS_Shape aIntFComp = myInternalFaces.Find (theShape); + TopoDS_Shape aIntRemFComp = myIntNotClFaces.Find (theShape); + + expl.Init( aIntRemFComp, TopAbs_FACE); + if (CheckClosed || !expl.More()){ + return aIntFComp; + } + // + TopoDS_Compound C; + myBuilder.MakeCompound( C ); + // add removed faces + for (; expl.More(); expl.Next()){ + myBuilder.Add( C, expl.Current() ); + } + // add good internal faces + expl.Init( aIntFComp, TopAbs_FACE); + for (; expl.More(); expl.Next()) { + myBuilder.Add( C, expl.Current() ); + } + // + return C; + } + + // =================================== + // get data for internal faces search + // =================================== + // + // compound of split faces of theShape + const TopoDS_Shape& CSF = myImageShape.Image(theShape).First(); + // + TopTools_MapOfShape MSE, MFP; + TopTools_DataMapOfShapeListOfShape DMSEFP; + TopTools_MapIteratorOfMapOfShape itm; + TopTools_ListOfShape EmptyL; + TopTools_ListIteratorOfListOfShape itl; + + // MSE filling: map of new section edges of CSF + expl.Init(CSF, TopAbs_EDGE); + for (; expl.More(); expl.Next()) { + const TopoDS_Shape& aE = expl.Current() ; + MSE.Add(aE); + } + // + // DMEF: map edge of CSF - faces of CSF + TopTools_IndexedDataMapOfShapeListOfShape DMEF; + TopExp::MapShapesAndAncestors(CSF, TopAbs_EDGE, TopAbs_FACE, DMEF); + // + // Fill + // 1. MFP - a map of faces to process: map of resulting faces except + // those of theShape; we`ll add to C those of them which are inside CSF + // 2. DMSEFP - edge of MSE => faces of MFP + // + itl.Initialize(myListShapes); + for (;itl.More(); itl.Next()) { + const TopoDS_Shape& aShape = itl.Value(); + // + if ( theShape.IsSame(aShape)) { + continue; + } + // fill maps + // iterate on split faces of aShape + const TopoDS_Shape& CSF1 = myImageShape.Image(aShape).First(); + TopoDS_Iterator itF (CSF1); + for ( ; itF.More(); itF.Next()) { + const TopoDS_Shape& aF1 = itF.Value(); + MFP.Add(aF1); + // iterate on edges of split faces of aShape, + // add to DMSEFP edges that are new + expl.Init(aF1, TopAbs_EDGE); + for (; expl.More(); expl.Next()) { + TopoDS_Shape aE1 = expl.Current(); + if ( MSE.Contains(aE1)) {// section edge + if (!DMSEFP.IsBound(aE1)) { + DMSEFP.Bind(aE1, EmptyL); + } + DMSEFP(aE1).Append(aF1); + } + } + } + }//for (;itl.More(); itl.Next()) + // + // add tool faces... (is absent) + // + // =========================== + // find faces inside theShape + // =========================== + Standard_Boolean sameDom1, sameDom2; + Standard_Boolean skipAlreadyAdded = Standard_False; + Standard_Boolean GoodOri, inside; + Standard_Real dot; + TopTools_ListOfShape KeepFaces; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit; + + // iterate on section edges, check faces of other shapes + // sharing section edges and put internal faces to KeepFaces + Mapit.Initialize(DMSEFP); + for (; Mapit.More() ; Mapit.Next()) { + // a new edge of theShape + const TopoDS_Edge& E = TopoDS::Edge (Mapit.Key()); + // + //Standard_Boolean isSectionE=IsSectionEdge(E);//(OrigE); + // + // split faces of other shapes sharing E + TopTools_ListOfShape& LSF = DMSEFP.ChangeFind(E); + // + itl.Initialize( LSF ); + while (itl.More()) { + // a split faces of other shape + TopoDS_Face aFace1 = TopoDS::Face(itl.Value()); + // remove aFace1 form DMSEFP and MFP + LSF.Remove( itl ); // == itl.Next(); + if (!MFP.Remove(aFace1)) + continue; // was not is MFP (i.e already checked) + // + // check if aFace1 was already added to 2 shells + if (!All && + myAddedFacesMap.Contains(aFace1) && + myAddedFacesMap.Contains(aFace1.Reversed())) { + skipAlreadyAdded = Standard_True; + } + // + TopoDS_Shape anOrigFace = aFace1; + if (myImagesFaces.IsImage(aFace1)){ + anOrigFace = myImagesFaces.Root(aFace1); + } + // + // <- A was here + // + // check that anOrigFace is not same domain with CSF faces it intersects + // + const TopTools_ListOfShape& FL = DMEF.FindFromKey(E); //faces of CSF sharing E + // + const TopoDS_Shape& origF1 = myImagesFaces.IsImage(FL.First()) ? + myImagesFaces.Root(FL.First()) : FL.First(); + // + const TopoDS_Shape& origF2 = myImagesFaces.IsImage(FL.Last()) ? + myImagesFaces.Root(FL.Last()) : FL.Last(); + // + sameDom1 = anOrigFace.IsSame( origF1 ); + sameDom2 = anOrigFace.IsSame( origF2 ); + // + if (!(sameDom1 || sameDom2) && HasSameDomainF( TopoDS::Face(anOrigFace) )) { + sameDom1 = IsSameDomainF( TopoDS::Face(anOrigFace), TopoDS::Face(origF1)); + if (origF1 == origF2) { + sameDom2 = sameDom1; + } + } + if (sameDom1 && sameDom2){ + continue; + } + // + if (sameDom1 || sameDom2) { + inside = NMTAlgo_Loop3d::IsInside (E, + TopoDS::Face(FL.First()), + TopoDS::Face(FL.Last()), + 1, dot, GoodOri); + if (inside || (dot + Precision::Angular() >= 1.0)) { + continue; // E is convex between origF1 and origF2 or they are tangent + } + } + // + GetPlanes(E, DMEF, aFace1, aState); + if (aState==TopAbs_IN) { + KeepFaces.Append(aFace1); + } + } //while (itl.More()) { + } //for (; Mapit.More() ; Mapit.Next() ) + + // =================================================== + // add not distributed faces connected with KeepFaces + // =================================================== + + // ultimate list of internal faces + TopTools_ListOfShape KeptFaces; + // + // add to MFP not split tool faces as well, they may be connected with + // tool faces interfering with theShape + /* + itm.Initialize(myMapTools); + for (; itm.More(); itm.Next() ) { + const TopoDS_Shape& aToolFace = itm.Key(); + if (!myImageShape.HasImage(aToolFace)){ + MFP.Add (aToolFace); + } + } + */ + // + if (MFP.IsEmpty()) + KeptFaces.Append (KeepFaces); + // + while (!KeepFaces.IsEmpty()) { + // KeepEdges : map of edges of faces kept last time + TopTools_IndexedMapOfShape KeepEdges; + for ( itl.Initialize(KeepFaces); itl.More(); itl.Next() ) { + TopExp::MapShapes( itl.Value(), TopAbs_EDGE, KeepEdges); + KeptFaces.Append( itl.Value() ); + } + // + KeepFaces.Clear(); + // + // keep faces connected with already kept faces by KeepEdges + for ( itm.Initialize(MFP); itm.More(); itm.Next() ) { + const TopoDS_Shape& FP = itm.Key(); + for (expl.Init(FP,TopAbs_EDGE); expl.More(); expl.Next()) { + const TopoDS_Shape& se = expl.Current(); + if (!MSE.Contains(se) && KeepEdges.Contains(se) ) { + KeepFaces.Append(FP); + MFP.Remove(FP); + break; + } + } + } + } + + // =============================================================== + // here MFP contains faces outer of theShape and those of shapes + // which do not interfere with theShape at all and between which + // there may be those wrapped by theShape and whose faces may be + // needed to be returned as well + // =============================================================== + + Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID); + if (All || isSolid) // All is for sub-result removal + { + for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) { + TopoDS_Shape aFace = itm.Key(); + + // find a shape aFace originates from + TopoDS_Shape anOrigShape = GetOriginalShape( aFace ); + + // find out if all faces of anOrigShape are not in MFP + // and by the way remove them from MFP + Standard_Boolean isAllOut = Standard_True; + TopoDS_Shape aSplitFaces = anOrigShape; + if (myImageShape.HasImage(anOrigShape)) + aSplitFaces = myImageShape.Image(anOrigShape).First(); + + TopTools_ListOfShape aSplitFaceL; + for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next()) + { + const TopoDS_Shape & aSpFace = expl.Current(); + // a tool face which become object has image but the whole tool shape has not + if (myImageShape.HasImage( aSpFace )) + { + TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE ); + for ( ; exF.More(); exF.Next() ) + { + aSplitFaceL.Append( exF.Current() ); + if ( ! MFP.Remove( exF.Current() )) + isAllOut = Standard_False; + } + } + else + { + aSplitFaceL.Append( aSpFace ); + if ( ! MFP.Remove( aSpFace )) + isAllOut = Standard_False; + } + } + itm.Initialize( MFP ); + if ( !isAllOut ) + continue; + + // classify anOrigShape against theShape + if (IsInside (anOrigShape, theShape)) { + if (isSolid && myClosedShapes.Contains(anOrigShape)) { + // to make a special care at solid reconstruction + myWrappingSolid.Add ( theShape ); + } + // keep faces of an internal shape anOrigShape + KeptFaces.Append( aSplitFaceL ); + } + } + } + + // ==================================================== + // check if kept faces form a shell without free edges + // ==================================================== + + DMEF.Clear(); // edge - kept faces + MFP.Clear(); // reuse it for wrong faces + if (CheckClosed) { + for (itl.Initialize(KeptFaces); itl.More(); itl.Next() ) + TopExp::MapShapesAndAncestors(itl.Value(), TopAbs_EDGE, TopAbs_FACE, DMEF); + + Standard_Integer i, nb = DMEF.Extent(); + Standard_Boolean isClosed = Standard_False; + while (!isClosed) { + isClosed = Standard_True; + for (i=1; isClosed && i<=nb; ++i) { + const TopoDS_Shape& E = DMEF.FindKey( i ); + if (! BRep_Tool::Degenerated( TopoDS::Edge( E )) && + ! MSE.Contains( E )) + isClosed = ( DMEF(i).Extent() != 1 ); + } + if (!isClosed) { + const TopoDS_Shape& F = DMEF.FindFromIndex( i-1 ).First(); // bad face + MFP.Add( F ); + // remove bad face from DMEF + for (expl.Init( F, TopAbs_EDGE); expl.More(); expl.Next()) { + const TopoDS_Shape& E = expl.Current(); + TopTools_ListOfShape& FL = DMEF.ChangeFromKey( E ); + for (itl.Initialize( FL ); itl.More(); itl.Next() ) { + if ( F.IsSame( itl.Value() )) { + FL.Remove( itl ); + break; + } + } + } + } + } + } + + // ============== + // make a result + // ============== + + TopoDS_Compound C; + // compound of removed internal faces + TopoDS_Compound CNotCl; + + myBuilder.MakeCompound(C); + myBuilder.MakeCompound(CNotCl); + + // add to compounds + itl.Initialize(KeptFaces); + for (; itl.More(); itl.Next() ) { + TopoDS_Shape & aIntFace = itl.Value(); + // + if (!All && + myAddedFacesMap.Contains(aIntFace) && + myAddedFacesMap.Contains(aIntFace.Reversed())) { + continue; + } + // + if (! MFP.Contains( aIntFace )){ + myBuilder.Add(C, aIntFace); + } + else{ + myBuilder.Add(CNotCl, aIntFace); + } + } + // + if (!skipAlreadyAdded && CheckClosed) { + myInternalFaces.Bind(theShape, C); + myIntNotClFaces.Bind(theShape, CNotCl); + } + // + // + if (!myMapSIFC.IsBound(theShape)) { + TopoDS_Compound aCIF; + myBuilder.MakeCompound(aCIF); + // + itl.Initialize(KeptFaces); + for (; itl.More(); itl.Next() ) { + TopoDS_Shape & aIntFace = itl.Value(); + if (! MFP.Contains(aIntFace )){ + myBuilder.Add(aCIF, aIntFace); + } + } + myMapSIFC.Bind(theShape, aCIF); + } + // + return C; +} +//======================================================================= +//function : IsInside +//purpose : Return True if the first vertex of S1 inside S2. +// If S1.IsNull(), check infinite point against S2. +//======================================================================= +Standard_Boolean NMTAlgo_Splitter::IsInside (const TopoDS_Shape& theS1, + const TopoDS_Shape& theS2) +{ + BRepClass3d_SolidClassifier aClassifier( theS2 ); + // + TopExp_Explorer expl(theS1, TopAbs_VERTEX); + // + if (!expl.More()){ + aClassifier.PerformInfinitePoint( ::RealSmall()); + } + else { + const TopoDS_Vertex & aVertex = TopoDS::Vertex( expl.Current() ); + aClassifier.Perform (BRep_Tool::Pnt( aVertex ), + BRep_Tool::Tolerance( aVertex )); + } + // + return ( aClassifier.State() == TopAbs_IN ); +} +//======================================================================= +//function : GetOriginalShape +//purpose : Return the shape aShape originates from. aShape +// should be a face or more complex result shape +//======================================================================= +TopoDS_Shape NMTAlgo_Splitter::GetOriginalShape(const TopoDS_Shape& theShape) const +{ + TopoDS_Shape anOrigShape; + + TopExp_Explorer expl( theShape, TopAbs_FACE); + if (expl.More()) { + TopoDS_Shape aFace = expl.Current(); + if (myImagesFaces.IsImage( aFace )) + aFace = myImagesFaces.Root( aFace ); + anOrigShape = myFaceShapeMap.Find( aFace ); + } + return anOrigShape; +} +//======================================================================= +//function :RefineShells +//purpose : +//======================================================================= +void RefineShells(const TopoDS_Shape& aS, + TopTools_ListOfShape& aLNS) +{ + Standard_Boolean bFound; + Standard_Integer iS, jS, aNbSOrs, aNbSIms, aNbFOrs, aNbFIms, kFOrs, aNb; + TopTools_ListIteratorOfListOfShape aIt; + TopTools_IndexedMapOfShape aMSOrs, aMSIms, aMFOrs, aMFIms; + TopTools_IndexedDataMapOfShapeShape aMImOr; + TopTools_ListOfShape aLS; + // + TopExp::MapShapes(aS, TopAbs_SHELL, aMSOrs); + aIt.Initialize(aLNS); + for (;aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSh=aIt.Value(); + aMSIms.Add(aSh); + } + // + aNbSOrs=aMSOrs.Extent(); + aNbSIms=aMSIms.Extent(); + // + for (iS=1; iS<=aNbSOrs; ++iS) { + const TopoDS_Shape& aSOr=aMSOrs(iS); + aMFOrs.Clear(); + TopExp::MapShapes(aSOr, TopAbs_FACE, aMFOrs); + aNbFOrs=aMFOrs.Extent(); + // + for (jS=1; jS<=aNbSIms; ++jS) { + const TopoDS_Shape& aSIm=aMSIms(jS); + if (aMImOr.Contains(aSIm)) { + continue; + } + // + aMFIms.Clear(); + TopExp::MapShapes(aSIm, TopAbs_FACE, aMFIms); + aNbFIms=aMFIms.Extent(); + // + if (aNbFIms==aNbFOrs) { + bFound=Standard_True; + for (kFOrs=1; kFOrs<=aNbFOrs; ++kFOrs) { + const TopoDS_Shape& aFOr=aMFOrs(kFOrs); + if (!aMFIms.Contains(aFOr)) { + bFound=Standard_False; + break; //next aSIm + } + } + if (bFound){ + aMImOr.Add(aSIm, aSOr); + break; //next aSOr + } + } //if (aNbFIms==aNbFOrs) + } + } + // + aNb=aMImOr.Extent(); + aIt.Initialize(aLNS); + for (;aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSh=aIt.Value(); + if (aMImOr.Contains(aSh)) { + const TopoDS_Shape& aSOr=aMImOr.FindFromKey(aSh); + aLS.Append(aSOr); + } + else { + aLS.Append(aSh); + } + } + // + aLNS.Clear(); + aLNS.Append(aLS); +} + +//======================================================================= +//function :RefineSolids +//purpose : +//======================================================================= +void RefineSolids(const TopoDS_Shape& aSolidOr, + TopTools_ListOfShape& aLNS) +{ + Standard_Integer aNb, iS, aNbSOrs, aNbSIms; + TopoDS_Shape aSolidIm; + TopTools_IndexedMapOfShape aMSOrs, aMSIms; + // + aNb=aLNS.Extent(); + if (aNb!=1) { + return; + } + // + aSolidIm=aLNS.First(); + + TopExp::MapShapes(aSolidOr, TopAbs_SHELL, aMSOrs); + TopExp::MapShapes(aSolidIm, TopAbs_SHELL, aMSIms); + aNbSOrs=aMSOrs.Extent(); + aNbSIms=aMSIms.Extent(); + if (aNbSOrs!=aNbSIms) { + return; + } + // + for (iS=1; iS<=aNbSOrs; ++iS) { + const TopoDS_Shape& aSOr=aMSOrs(iS); + if (!aMSIms.Contains(aSOr)) { + return; + } + } + // + aLNS.Clear(); + aLNS.Append(aSolidOr); +} +//modified by NIZNHY-PKV Fri Feb 25 16:59:57 2005f XX +//======================================================================= +//function : GetPlanes +//purpose : +//======================================================================= +void GetPlanes (const TopoDS_Edge& anEx, + const TopTools_IndexedDataMapOfShapeListOfShape& anEFMapx, + const TopoDS_Face& aF1, + TopAbs_State& aStPF1) + +{ + Standard_Boolean bIsAdjExists; + Standard_Real aT, aT1, aT2; + TopAbs_Orientation anOrEx, anOr; + gp_Dir aDNFx1, aDNFx2, aDNF1; + gp_Pnt aPx, aPx1, aPx2, aPF1; + TopoDS_Edge aERight, aSpxSimm; + TopoDS_Face aFx1, aFx2, aFF1; + TopTools_ListIteratorOfListOfShape anIt; + // + // Point on Edge + Handle(Geom_Curve)aC3D =BRep_Tool::Curve(anEx, aT1, aT2); + aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); + + aC3D->D0(aT, aPx); + // + anOrEx=anEx.Orientation(); + + aSpxSimm=anEx; + if (anOrEx==TopAbs_FORWARD) { + aSpxSimm.Orientation(TopAbs_REVERSED); + } + else if (anOrEx==TopAbs_REVERSED){ + aSpxSimm.Orientation(TopAbs_FORWARD); + } + // + const TopTools_ListOfShape& aLF=anEFMapx.FindFromKey(anEx); + anIt.Initialize(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aFE=anIt.Value(); + aFx1=TopoDS::Face(aFE); + anOr=BOPTools_Tools3D::Orientation(anEx, aFx1); + if (anOr==anOrEx){ + break; + } + } + // + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (anEx, aFx1, aT, aPx1, aDNFx1); + // + bIsAdjExists=BOPTools_Tools3D::GetAdjacentFace (aFx1, anEx, anEFMapx, aFx2); + if (!bIsAdjExists) { + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx1, aT, aPx2, aDNFx2); + } + else { + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aSpxSimm, aFx2, aT, aPx2, aDNFx2); + } + // + aFF1=aF1; + aFF1.Orientation(TopAbs_FORWARD); + BOPTools_Tools3D::OrientEdgeOnFace (anEx, aFF1, aERight); + BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aERight, aFF1, aT, aPF1, aDNF1); + // + { + Standard_Real d12, d1, anAlfa12, anAlfa1, aTwoPI; + + aTwoPI=Standard_PI+Standard_PI; + + gp_Vec aVx1(aPx, aPx1); + gp_Dir aDBx1 (aVx1); + gp_Pln aPlnToCompare (aPx, aDNFx1); + + gp_Vec aVx2(aPx, aPx2); + gp_Dir aDBx2 (aVx2); + + anAlfa12=aDBx1.Angle(aDBx2); + d12=BOPTools_Tools3D::SignDistance(aPx2, aPlnToCompare); + if (d12 < 0.) { + anAlfa12=aTwoPI-anAlfa12; + } + + gp_Vec aVF1(aPx, aPF1); + gp_Dir aDBF1 (aVF1); + anAlfa1=aDBx1.Angle(aDBF1); + d1=BOPTools_Tools3D::SignDistance(aPF1, aPlnToCompare); + if (d1 < 0.) { + anAlfa1=aTwoPI-anAlfa1; + } + + aStPF1=TopAbs_OUT; + if (anAlfa1 > anAlfa12) { + aStPF1=TopAbs_IN; + } + } +} +//modified by NIZNHY-PKV Fri Feb 25 17:00:03 2005t XX +/* + A + // + TopoDS_Shape aFace2; + if ( !isSectionE ) { + while (itl.More()) { + aFace2 = itl.Value(); + // + TopoDS_Shape anOrigFace2 = aFace2; + if (myImagesFaces.IsImage(aFace2)) { + anOrigFace2 = myImagesFaces.Root(aFace2); + } + // + if (!MFP.Contains( aFace2 )) { + LSF.Remove( itl ); + continue; + } + //if (anOrigFace.IsSame( myImagesFaces.Root( aFace2 ))) + if (anOrigFace.IsSame(anOrigFace2)) { + break; + } + itl.Next(); + } + if (itl.More()) { // aFace2 found, remove it from maps + LSF.Remove( itl ); + MFP.Remove(aFace2); + } + else{ + aFace2.Nullify(); + } + itl.Initialize( LSF ); + } + */ diff --git a/src/NMTAlgo/NMTAlgo_Splitter_2.cxx b/src/NMTAlgo/NMTAlgo_Splitter_2.cxx new file mode 100644 index 000000000..801d57334 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Splitter_2.cxx @@ -0,0 +1,679 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Splitter_2.cxx +// Created: Mon Feb 9 15:07:51 2004 +// Author: Igor FEOKTISTOV +// + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +//======================================================================= +//function : KeepShapesInside +//purpose : remove shapes that are outside of S from result +//======================================================================= + void NMTAlgo_Splitter::KeepShapesInside (const TopoDS_Shape& S) +{ + TopoDS_Iterator it; + if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid + for (it.Initialize( S ); it.More(); it.Next()) + KeepShapesInside( it.Value()); + return; + } + + Standard_Boolean isTool = Standard_False; + if (!myImageShape.HasImage( S )) { + //isTool = CheckTool( S ); + //if (!isTool) return; + return; + } + + // build map of internal faces + TopTools_IndexedMapOfShape MIF; + TopoDS_Shape IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); + TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF ); + + TopoDS_Compound C; + myBuilder.MakeCompound(C); + + TopAbs_ShapeEnum anInternalShapeType = TopAbs_SHAPE; + if (!MIF.IsEmpty()) + { + // leave in the result only those shapes having a face in MIF + for (it.Initialize( myShape ); it.More(); it.Next()) { + const TopoDS_Shape & aResShape = it.Value(); + TopExp_Explorer expResF( aResShape, TopAbs_FACE ); + for (; expResF.More(); expResF.Next()) { + if ( MIF.Contains( expResF.Current())) { + myBuilder.Add( C, aResShape ); + if (aResShape.ShapeType() < anInternalShapeType) + anInternalShapeType = aResShape.ShapeType(); + break; + } + } + } + } + + // may be S was not split by internal faces then it is missing + // in myShape, add it + if (!isTool && + (anInternalShapeType > TopAbs_SOLID || S.ShapeType() > TopAbs_SOLID)) + { + TopTools_IndexedMapOfShape MSF; // map of split faces of S + TopExp::MapShapes( myImageShape.Image(S).First(), TopAbs_FACE, MSF); + + // find a shape having all faces in MSF + for (it.Initialize( myShape ); it.More(); it.Next()) { + TopExp_Explorer expResF( it.Value(), TopAbs_FACE ); + for (; expResF.More(); expResF.Next()) { + if (! MSF.Contains( expResF.Current())) + break; + } + if (! expResF.More()) { + myBuilder.Add( C, it.Value() ); + break; + } + } + } + + myShape = C; +} + +//======================================================================= +//function : RemoveShapesInside +//purpose : remove shapes that are inside S from result +//======================================================================= + void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& S) +{ + TopoDS_Iterator it; + if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid + it.Initialize( S ); + for (; it.More(); it.Next()) { + RemoveShapesInside( it.Value()); + } + return; + } + // + Standard_Boolean isTool; + TopoDS_Shape IntFacesComp; + TopoDS_Compound C; + TopTools_IndexedMapOfShape MIF; // map of internal faces + TopTools_MapOfShape RFM; + TopTools_MapIteratorOfMapOfShape itF; + // + isTool=myToolShapes.Contains(S); + //isTool = Standard_False; + if (!myImageShape.HasImage( S )) { + return; + } + // + IntFacesComp = FindFacesInside( S, Standard_False, Standard_True); + // + TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF); + if (MIF.IsEmpty()) { + return; + } + // add to MIF split faces of S + const TopoDS_Shape& aSIm=myImageShape.Image(S).First(); + TopExp::MapShapes(aSIm, TopAbs_FACE, MIF); + // + // leave in the result only those shapes not having all face in MIF + myBuilder.MakeCompound(C); + // + // RFM : faces of removed shapes that encounter once + it.Initialize(myShape); + for (; it.More(); it.Next()) { + TopExp_Explorer expResF; + // + const TopoDS_Shape& aSR=it.Value(); + // + expResF.Init(aSR, TopAbs_FACE); + for (; expResF.More(); expResF.Next()) { + const TopoDS_Shape& aFR=expResF.Current(); + if (!MIF.Contains(aFR)) { + break; + } + } + // + if (expResF.More()) { + // add shape to result + myBuilder.Add(C, aSR); + } + else { + // add faces of a removed shape to RFM + for (expResF.ReInit(); expResF.More(); expResF.Next()) { + const TopoDS_Shape& aF = expResF.Current(); + if (!RFM.Remove(aF)) { + RFM.Add(aF); + } + } + } + }// for (; it.More(); it.Next()) + // + // + TopoDS_Compound aCx; + // + myBuilder.MakeCompound(aCx); + itF.Initialize (RFM); + for (; itF.More(); itF.Next()) { + const TopoDS_Shape& aF=itF.Key(); + myBuilder.Add(aCx, aF); + } + // + if (!isTool) { + // rebuild S, it must remain in the result + Standard_Boolean isClosed = Standard_False; + switch (S.ShapeType()) { + case TopAbs_SOLID : + isClosed = Standard_True; break; + case TopAbs_SHELL: { + TopTools_IndexedDataMapOfShapeListOfShape MEF; + TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, MEF); + Standard_Integer i; + for (i=1; isClosed && i<=MEF.Extent(); ++i) { + isClosed = ( MEF(i).Extent() != 1 ); + } + break; + } + default: + isClosed = Standard_False; + } + // + if (isClosed) { + // add to a new shape external faces of removed shapes, ie those in RFM + TopoDS_Shell Shell; + myBuilder.MakeShell(Shell); + // exclude redundant internal face with edges encounterd only once + TopTools_IndexedDataMapOfShapeListOfShape MEF; + // + itF.Initialize (RFM); + for ( ; itF.More(); itF.Next()) { + const TopoDS_Shape& aF=itF.Key(); + TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, MEF); + } + // add only faces forming a closed shell + for (itF.Reset() ; itF.More(); itF.Next()) { + const TopoDS_Shape& aF=itF.Key(); + TopExp_Explorer expE (aF, TopAbs_EDGE); + for (; expE.More(); expE.Next()) { + if (MEF.FindFromKey(expE.Current()).Extent() == 1) { + break; + } + } + if (!expE.More()) { + myBuilder.Add( Shell, aF); + } + else { + //int a=0; + } + } + + if (S.ShapeType() == TopAbs_SOLID) { + TopoDS_Solid Solid; + myBuilder.MakeSolid( Solid ); + myBuilder.Add (Solid, Shell); + myBuilder.Add (C, Solid); + } + else { + myBuilder.Add (C, Shell); + } + } // if (isClosed) { + else { + it.Initialize(aSIm); + for (; it.More(); it.Next()) { + myBuilder.Add (C, it.Value()); + } + } + } + // + myShape = C; +} +// +//modified by NIZNHY-PKV Tue Feb 1 16:02:29 2005 f +//======================================================================= +//function : Modified +//purpose : +//======================================================================= +const TopTools_ListOfShape& NMTAlgo_Splitter::Modified (const TopoDS_Shape& S) + +{ + TopAbs_ShapeEnum aType; + // + myGenerated.Clear(); + // + aType=S.ShapeType(); + // + switch (aType) { + case TopAbs_SOLID: + case TopAbs_FACE: + case TopAbs_EDGE: + case TopAbs_VERTEX: + FindImage(S, myGenerated); + break; + + case TopAbs_SHELL: + break; + + case TopAbs_WIRE: + break; + + default: + break; + } + // + return myGenerated; +} +//modified by NIZNHY-PKV Tue Feb 1 16:02:33 2005 t +//======================================================================= +//function : IsDeleted +//purpose : +//======================================================================= +Standard_Boolean NMTAlgo_Splitter::IsDeleted (const TopoDS_Shape& S) + +{ + const TopTools_ListOfShape& aL = Modified(S); + if(aL.Extent() != 0) return Standard_False; + + TopTools_MapOfShape aMap; + TopExp_Explorer anExp; + + TopAbs_ShapeEnum aType = S.ShapeType(); + + if(aType == TopAbs_VERTEX || + aType == TopAbs_EDGE || + aType == TopAbs_FACE ) { + + anExp.Init(myShape, aType); + for(; anExp.More(); anExp.Next()) { + if(S.IsSame(anExp.Current())) return Standard_False; + } + + } + + return Standard_True; +} +//======================================================================= +//function : Generated +//purpose : +//======================================================================= +const TopTools_ListOfShape& NMTAlgo_Splitter::Generated(const TopoDS_Shape& S) +{ + myGenerated.Clear(); + TopTools_ListIteratorOfListOfShape it; + TopTools_MapOfShape aMap; + TopExp_Explorer anExp; + Standard_Boolean bCheckVert = Standard_False; + + if(S.ShapeType() == TopAbs_FACE) { + if (mySectionParts.Contains(S)) { + it.Initialize(mySectionParts.FindFromKey(S)); + anExp.Init(myShape, TopAbs_EDGE); + + for(; anExp.More(); anExp.Next()) { + aMap.Add(anExp.Current()); + } + + for (; it.More(); it.Next()) { + if(aMap.Contains(it.Value())) { + myGenerated.Append(it.Value()); + } + } + } + + NMTTools_PaveFiller& aPF = myDSFiller->ChangePaveFiller(); + const NMTDS_ShapesDataStructure& aDS = myDSFiller->DS(); + const BOPTools_PInterferencePool& anIP = aPF.InterfPool(); + + Standard_Integer aNbS = aDS.NumberOfSourceShapes(); + Standard_Integer anIndex = 0, i; + + for(i = 1; i <= aNbS; ++i) { + + const TopoDS_Shape& aS = aDS.Shape(i); + if(S.IsSame(aS)) { + anIndex = i; + break; + } + + } + + if(anIndex == 0) return myGenerated; + if(!anIP->HasInterference(anIndex)) return myGenerated; + + const BOPTools_CArray1OfESInterference& aESs = anIP->ESInterferences(); + Standard_Integer aNbI = aESs.Extent(); + + if(aNbI == 0) return myGenerated; + + for(i = 1; i <= aNbI; ++i) { + + const BOPTools_ESInterference& aES = aESs(i); + Standard_Integer ind1, ind2; + aES.Indices(ind1, ind2); + + if(ind1 == anIndex || ind2 == anIndex) { + + Standard_Integer aNSI = aES.NewShape(); + if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { + myGenerated.Append(aDS.Shape(aNSI)); + bCheckVert = Standard_True; + } + + } + + } + + if(bCheckVert) { + aMap.Clear(); + anExp.Init(myShape, TopAbs_VERTEX); + + for(; anExp.More(); anExp.Next()) { + aMap.Add(anExp.Current()); + } + + it.Initialize(myGenerated); + for (; it.More(); it.Next()) { + + if(it.Value().ShapeType() != TopAbs_VERTEX) continue; + + if(!aMap.Contains(it.Value())) { + myGenerated.Remove(it); + } + + } + } + + return myGenerated; + } + + if(S.ShapeType() == TopAbs_EDGE) { + + NMTTools_PaveFiller& aPF = myDSFiller->ChangePaveFiller(); + const NMTDS_ShapesDataStructure& aDS = myDSFiller->DS(); + const BOPTools_PInterferencePool& anIP = aPF.InterfPool(); + + Standard_Integer aNbS = aDS.NumberOfSourceShapes(); + Standard_Integer anIndex = 0, i; + + for(i = 1; i <= aNbS; ++i) { + + const TopoDS_Shape& aS = aDS.Shape(i); + if(S.IsSame(aS)) { + anIndex = i; + break; + } + + } + + if(anIndex == 0) return myGenerated; + if(!anIP->HasInterference(anIndex)) return myGenerated; + + const BOPTools_CArray1OfEEInterference& aEEs = anIP->EEInterferences(); + Standard_Integer aNbI = aEEs.Extent(); + + for(i = 1; i <= aNbI; ++i) { + + const BOPTools_EEInterference& aEE = aEEs(i); + Standard_Integer ind1, ind2; + aEE.Indices(ind1, ind2); + + if(ind1 == anIndex || ind2 == anIndex) { + + Standard_Integer aNSI = aEE.NewShape(); + if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { + myGenerated.Append(aDS.Shape(aNSI)); + bCheckVert = Standard_True; + } + + } + + } + + const BOPTools_CArray1OfESInterference& aESs = anIP->ESInterferences(); + aNbI = aESs.Extent(); + + for(i = 1; i <= aNbI; ++i) { + + const BOPTools_ESInterference& aES = aESs(i); + Standard_Integer ind1, ind2; + aES.Indices(ind1, ind2); + + if(ind1 == anIndex || ind2 == anIndex) { + + Standard_Integer aNSI = aES.NewShape(); + if(aDS.GetShapeType(aNSI) == TopAbs_VERTEX) { + myGenerated.Append(aDS.Shape(aNSI)); + bCheckVert = Standard_True; + } + + } + + } + + if(bCheckVert) { + aMap.Clear(); + anExp.Init(myShape, TopAbs_VERTEX); + + for(; anExp.More(); anExp.Next()) { + aMap.Add(anExp.Current()); + } + + it.Initialize(myGenerated); + for (; it.More(); it.Next()) { + + if(!aMap.Contains(it.Value())) { + myGenerated.Remove(it); + } + } + } + return myGenerated; + } + return myGenerated; +} +//modified by NIZNHY-PKV Tue Feb 1 10:26:18 2005f +//======================================================================= +//function : FindImage +//purpose : +//======================================================================= +void NMTAlgo_Splitter::FindImage(const TopoDS_Shape& aS, + TopTools_ListOfShape& aLIms) +{ + TopAbs_ShapeEnum aType; + // + aType=aS.ShapeType(); + // + if (aType==TopAbs_SOLID) { + Standard_Boolean bHasImage, bHasInternalFaces; + Standard_Integer i, aNbSd; + TopTools_IndexedMapOfShape aMSo, aMSd; + TopoDS_Iterator aIt; + TopTools_IndexedDataMapOfShapeListOfShape aMFS; + TopTools_ListIteratorOfListOfShape aItLS; + // + bHasInternalFaces=myMapSIFC.IsBound(aS); + if (bHasInternalFaces){ + TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); + // + const TopoDS_Shape& aIFC=myMapSIFC.Find(aS); + // + aIt.Initialize(aIFC); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aIF=aIt.Value(); + if (aMFS.Contains(aIF)) { + const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aIF); + // + aItLS.Initialize(aLS); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aSx=aItLS.Value(); + aMSd.Add(aSx); + } + } + } + // + aNbSd=aMSd.Extent(); + if (aNbSd) { + for (i=1; i<=aNbSd; ++i) { + const TopoDS_Shape& aSx=aMSd(i); + if (!aSx.IsSame(aS)) { + aLIms.Append(aSx); + } + } + return; + } + } + // + bHasImage=myImageShape.HasImage(aS); + if (!bHasImage) { + return; + } + // + TopoDS_Shape aSd; + // + TopExp::MapShapes(myShape, TopAbs_SOLID, aMSo); + // + const TopoDS_Shape& aFC=myImageShape.Image(aS).First(); + bHasImage=NMTAlgo_Tools::FindImageSolid(aFC, aMSo, aSd); + if (bHasImage) { + if (!aSd.IsSame(aS)) { + aLIms.Append(aSd); + } + } + } //if (aType==TopAbs_SOLID) { + //== + else if (aType==TopAbs_FACE) { + TopTools_MapOfShape aMap; + TopTools_ListIteratorOfListOfShape aIt; + TopExp_Explorer anExp; + // + if (myModifiedFaces.IsBound(aS)) { + anExp.Init(myShape, aType); + for(; anExp.More(); anExp.Next()) { + aMap.Add(anExp.Current()); + } + // + const TopTools_ListOfShape& aLS=myModifiedFaces.Find(aS); + aIt.Initialize(aLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aFx=aIt.Value(); + if (!aFx.IsSame(aS)) { + if (aMap.Contains(aFx)) { + aLIms.Append(aFx); + } + } + } + } + } // else if (aType==TopAbs_FACE) + //== + else if (aType==TopAbs_EDGE) { + TopTools_MapOfShape aMap; + TopTools_ListIteratorOfListOfShape aIt; + TopExp_Explorer anExp; + // + if (myImagesEdges.HasImage(aS)) { + anExp.Init(myShape, aType); + for(; anExp.More(); anExp.Next()) { + aMap.Add(anExp.Current()); + } + // + const TopTools_ListOfShape& aLE=myImagesEdges.Image(aS); + aIt.Initialize(aLE); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aEx=aIt.Value(); + if (!aEx.IsSame(aS)) { + if(aMap.Contains(aEx)) { + aLIms.Append(aEx); + } + } + } + } + }// else if (aType==TopAbs_EDGE) + //== + else if (aType==TopAbs_VERTEX) { + Standard_Integer aNbS, anIndex, i, aSDVInd; + TopExp_Explorer anExp; + // + const NMTTools_DSFiller& aDSF = Filler(); + const NMTTools_PaveFiller& aPF = aDSF.PaveFiller(); + const NMTDS_ShapesDataStructure& aDS = aDSF.DS(); + // + aNbS = aDS.NumberOfSourceShapes(); + anIndex = 0; + // + for(i=1; i<=aNbS; ++i) { + const TopoDS_Shape& aSx = aDS.Shape(i); + if(aS.IsSame(aSx)) { + anIndex = i; + break; + } + } + // + if(!anIndex) { + return; + } + // + aSDVInd=aPF.FindSDVertex(anIndex); + if(!aSDVInd) { + return; + } + // + const TopoDS_Shape& aSDV=aDS.Shape(aSDVInd); + // + anExp.Init(myShape, aType); + for(; anExp.More(); anExp.Next()) { + const TopoDS_Shape& aVx=anExp.Current(); + if(aSDV.IsSame(aVx)) { + aLIms.Append(aSDV); + break; + } + } + }// else if (aType==TopAbs_VERTEX) +} +//modified by NIZNHY-PKV Tue Feb 1 10:26:22 2005t + diff --git a/src/NMTAlgo/NMTAlgo_Tools.cdl b/src/NMTAlgo/NMTAlgo_Tools.cdl new file mode 100644 index 000000000..581235349 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Tools.cdl @@ -0,0 +1,90 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTAlgo_Tools.cdl +-- Created: Fri Jan 30 16:29:14 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class Tools from NMTAlgo + + ---Purpose: + +uses + Orientation from TopAbs, + + Shape from TopoDS, + Edge from TopoDS, + Face from TopoDS, + Shell from TopoDS, + + ListOfShape from TopTools, + IndexedMapOfShape from TopTools +--raises + +is + OrientFacesOnShell (myclass; + aShell: Shell from TopoDS; + aShellNew: out Shell from TopoDS); + + OrientFacesOnShell (myclass; + aF : Face from TopoDS; + aSh : out Shell from TopoDS); + + Orientation(myclass; + aE: Edge from TopoDS; + aF: Face from TopoDS) + returns Orientation from TopAbs; + + Sense (myclass; + aF1: Face from TopoDS; + aF2: Face from TopoDS) + returns Integer from Standard; + + IsInside (myclass; + aS1: Shape from TopoDS; + aS2: Shape from TopoDS) + returns Boolean from Standard; + + MakeShells(myclass; + aFC:Shape from TopoDS; + aLS:out ListOfShape from TopTools); + + MakeSolids(myclass; + aLS:out ListOfShape from TopTools); + + MakeSolids(myclass; + aFC:Shape from TopoDS; + aLS:out ListOfShape from TopTools); + + BreakWebs (myclass; + aS1: Shape from TopoDS; + aS2:out Shape from TopoDS); + + FindImageSolid (myclass; + aFC : Shape from TopoDS; + aMSo : IndexedMapOfShape from TopTools; + aSo : out Shape from TopoDS) + returns Boolean from Standard; + +--fields + +end Tools; diff --git a/src/NMTAlgo/NMTAlgo_Tools.cxx b/src/NMTAlgo/NMTAlgo_Tools.cxx new file mode 100644 index 000000000..894b2d0b6 --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Tools.cxx @@ -0,0 +1,518 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTAlgo_Tools.cxx +// Created: Fri Jan 30 16:30:45 2004 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include + + +//======================================================================= +// function: Sense +// purpose: +//======================================================================= + Standard_Integer NMTAlgo_Tools::Sense (const TopoDS_Face& aF1, + const TopoDS_Face& aF2) +{ + Standard_Integer iSense=0; + gp_Dir aDNF1, aDNF2; + TopoDS_Edge aE1, aE2; + TopExp_Explorer anExp; + // + anExp.Init(aF1, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + aE1=TopoDS::Edge(anExp.Current()); + if (!BRep_Tool::Degenerated(aE1)) { + if (!BRep_Tool::IsClosed(aE1, aF1)) { + break; + } + } + } + // + anExp.Init(aF2, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + aE2=TopoDS::Edge(anExp.Current()); + if (!BRep_Tool::Degenerated(aE2)) { + if (!BRep_Tool::IsClosed(aE2, aF2)) { + if (aE2.IsSame(aE1)) { + iSense=1; + break; + } + } + } + } + // + if (!iSense) { + return iSense; + } + // + BOPTools_Tools3D::GetNormalToFaceOnEdge(aE1, aF1, aDNF1); + BOPTools_Tools3D::GetNormalToFaceOnEdge(aE2, aF2, aDNF2); + // + iSense=BOPTools_Tools3D::SenseFlag(aDNF1, aDNF2); + // + return iSense; +} + +//======================================================================= +// function: OrientFacesOnShell +// purpose: +//======================================================================= + void NMTAlgo_Tools::OrientFacesOnShell (const TopoDS_Face& aF1, + TopoDS_Shell& aSh) +{ + Standard_Integer aNbFSh, iSenseFlag; + gp_Dir aDNF1, aDNF2; + TopExp_Explorer anExp; + TopoDS_Edge aE1, aESh; + TopTools_IndexedDataMapOfShapeListOfShape aMEFSh; + // + anExp.Init(aF1, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + aE1=TopoDS::Edge(anExp.Current()); + if (!BRep_Tool::Degenerated(aE1)) { + break; + } + } + // + BOPTools_Tools3D::GetNormalToFaceOnEdge(aE1, aF1, aDNF1); + // + TopExp::MapShapesAndAncestors(aSh, TopAbs_EDGE, TopAbs_FACE, aMEFSh); + if (aMEFSh.Contains(aE1)) { + const TopTools_ListOfShape& aLFSh=aMEFSh.FindFromKey(aE1); + aNbFSh=aLFSh.Extent(); + if (aNbFSh==1) { + const TopoDS_Face& aFSh=TopoDS::Face(aLFSh.First()); + // + BOPTools_Tools3D::OrientEdgeOnFace(aE1, aFSh, aESh); + BOPTools_Tools3D::GetNormalToFaceOnEdge(aESh, aFSh, aDNF2); + // + iSenseFlag=BOPTools_Tools3D::SenseFlag(aDNF1, aDNF2); + if (iSenseFlag==1) { + return; + } + // + anExp.Init(aSh, TopAbs_FACE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Shape& aFx=anExp.Current(); + TopoDS_Shape *pFx=(TopoDS_Shape *)&aFx; + pFx->Reverse(); + } + } + } +} +//======================================================================= +// function: OrientFacesOnShell +// purpose: +//======================================================================= + void NMTAlgo_Tools::OrientFacesOnShell (const TopoDS_Shell& aShell, + TopoDS_Shell& aShellNew) +{ + Standard_Boolean bIsProcessed1, bIsProcessed2; + Standard_Integer i, aNbE, aNbF, j; + TopAbs_Orientation anOrE1, anOrE2; + + TopTools_IndexedDataMapOfShapeListOfShape aEFMap; + TopTools_IndexedMapOfShape aProcessedFaces; + BRep_Builder aBB; + + aBB.MakeShell(aShellNew); + + TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aEFMap); + + aNbE=aEFMap.Extent(); + // + // One seam edge in aEFMap contains 2 equivalent faces. + for (i=1; i<=aNbE; i++) { + TopTools_ListOfShape& aLF=aEFMap.ChangeFromIndex(i); + + if (aLF.Extent()>1) { + TopTools_ListOfShape aLFTmp; + TopTools_IndexedMapOfShape aFM; + + TopTools_ListIteratorOfListOfShape anIt(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aF=anIt.Value(); + if (!aFM.Contains(aF)) { + aFM.Add(aF); + aLFTmp.Append(aF); + } + } + aLF.Clear(); + aLF=aLFTmp; + } + } + // + // Do + for (i=1; i<=aNbE; i++) { + const TopoDS_Edge& aE=TopoDS::Edge(aEFMap.FindKey(i)); + + if (BRep_Tool::Degenerated(aE)) { + continue; + } + + const TopTools_ListOfShape& aLF=aEFMap.FindFromIndex(i); + aNbF=aLF.Extent(); + + if (aNbF==2) { + TopoDS_Face& aF1=TopoDS::Face(aLF.First()); + TopoDS_Face& aF2=TopoDS::Face(aLF.Last() ); + + + bIsProcessed1=aProcessedFaces.Contains(aF1); + bIsProcessed2=aProcessedFaces.Contains(aF2); + + if (bIsProcessed1 && bIsProcessed2) { + continue; + } + + if (!bIsProcessed1 && !bIsProcessed2) { + aProcessedFaces.Add(aF1); + aBB.Add(aShellNew, aF1); + + bIsProcessed1=!bIsProcessed1; + } + + // + TopoDS_Face aF1x, aF2x; + + aF1x=aF1; + if (bIsProcessed1) { + j=aProcessedFaces.FindIndex(aF1); + aF1x=TopoDS::Face(aProcessedFaces.FindKey(j)); + } + + aF2x=aF2; + if (bIsProcessed2) { + j=aProcessedFaces.FindIndex(aF2); + aF2x=TopoDS::Face(aProcessedFaces.FindKey(j)); + } + // + + anOrE1=NMTAlgo_Tools::Orientation(aE, aF1x); + anOrE2=NMTAlgo_Tools::Orientation(aE, aF2x); + + if (bIsProcessed1 && !bIsProcessed2) { + + if (anOrE1==anOrE2) { + if (!BRep_Tool::IsClosed(aE, aF1) && + !BRep_Tool::IsClosed(aE, aF2)) { + aF2.Reverse(); + } + } + aProcessedFaces.Add(aF2); + aBB.Add(aShellNew, aF2); + } + + else if (!bIsProcessed1 && bIsProcessed2) { + if (anOrE1==anOrE2) { + if (!BRep_Tool::IsClosed(aE, aF1) && + !BRep_Tool::IsClosed(aE, aF2)) { + aF1.Reverse(); + } + } + aProcessedFaces.Add(aF1); + aBB.Add(aShellNew, aF1); + } + } + } + // + // + for (i=1; i<=aNbE; i++) { + const TopoDS_Edge& aE=TopoDS::Edge(aEFMap.FindKey(i)); + + if (BRep_Tool::Degenerated(aE)) { + continue; + } + + const TopTools_ListOfShape& aLF=aEFMap.FindFromIndex(i); + aNbF=aLF.Extent(); + if (aNbF!=2) { + TopTools_ListIteratorOfListOfShape anIt(aLF); + for(; anIt.More(); anIt.Next()) { + const TopoDS_Face& aF=TopoDS::Face(anIt.Value()); + if (!aProcessedFaces.Contains(aF)) { + aProcessedFaces.Add(aF); + aBB.Add(aShellNew, aF); + } + } + } + } +} +//======================================================================= +//function : Orientation +//purpose : +//======================================================================= + TopAbs_Orientation NMTAlgo_Tools::Orientation(const TopoDS_Edge& anE, + const TopoDS_Face& aF) +{ + TopAbs_Orientation anOr=TopAbs_INTERNAL; + + TopExp_Explorer anExp; + anExp.Init(aF, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Edge& anEF1=TopoDS::Edge(anExp.Current()); + if (anEF1.IsSame(anE)) { + anOr=anEF1.Orientation(); + break; + } + } + return anOr; +} +//======================================================================= +//function : IsInside +//purpose : Return True if the first vertex of S1 inside S2. +// If S1.IsNull(), check infinite point against S2. +//======================================================================= + Standard_Boolean NMTAlgo_Tools::IsInside (const TopoDS_Shape& theS1, + const TopoDS_Shape& theS2) +{ + BRepClass3d_SolidClassifier aClassifier( theS2 ); + // + TopExp_Explorer expl(theS1, TopAbs_VERTEX); + // + if (!expl.More()){ + aClassifier.PerformInfinitePoint( ::RealSmall()); + } + else { + const TopoDS_Vertex & aVertex = TopoDS::Vertex( expl.Current() ); + aClassifier.Perform (BRep_Tool::Pnt( aVertex ), + BRep_Tool::Tolerance( aVertex )); + } + // + return ( aClassifier.State() == TopAbs_IN ); +} +//======================================================================= +//function : MakeShells +//purpose : +//======================================================================= + void NMTAlgo_Tools::MakeShells (const TopoDS_Shape& aFC, + TopTools_ListOfShape& aLNS) +{ + NMTAlgo_Loop3d aShellMaker; + TopTools_MapOfOrientedShape aMTmp; + // + aShellMaker.AddConstFaces(aFC); + aLNS=aShellMaker.MakeShells(aMTmp); +} +//======================================================================= +//function : MakeSolids +//purpose : +//======================================================================= + void NMTAlgo_Tools::MakeSolids(const TopoDS_Shape& aFC, + TopTools_ListOfShape& theShellList) +{ + NMTAlgo_Tools::MakeShells(aFC, theShellList); + NMTAlgo_Tools::MakeSolids(theShellList); +} +//======================================================================= +//function : MakeSolids +//purpose : +//======================================================================= + void NMTAlgo_Tools::MakeSolids(TopTools_ListOfShape& theShellList) +{ + TopTools_ListOfShape aHoleShells, aNewSolids; + TopoDS_Shape anInfinitePointShape; + TopTools_DataMapOfShapeShape aInOutMap; + TopTools_ListIteratorOfListOfShape aShellIt, aSolisIt; + BRep_Builder aBB; + // + aShellIt.Initialize(theShellList); + for ( ; aShellIt.More(); aShellIt.Next()) { + const TopoDS_Shape & aShell = aShellIt.Value(); + // check if a shell is a hole of theSolid + if (NMTAlgo_Tools::IsInside(anInfinitePointShape, aShell)){ + aHoleShells.Append(aShell); + } + else { + // make a solid from a shell + TopoDS_Solid Solid; + aBB.MakeSolid( Solid ); + aBB.Add (Solid, aShell); + aNewSolids.Append (Solid); + } + } + // + // find outer a shell most close to each hole shell + aShellIt.Initialize(aHoleShells); + for (; aShellIt.More(); aShellIt.Next()){ + const TopoDS_Shape & aHole = aShellIt.Value(); + // + aSolisIt.Initialize(aNewSolids); + for ( ; aSolisIt.More(); aSolisIt.Next()) { + const TopoDS_Shape & aSolid = aSolisIt.Value(); + // + if (! NMTAlgo_Tools::IsInside(aHole, aSolid)){ + continue; + } + // + if ( aInOutMap.IsBound (aHole)){ + const TopoDS_Shape & aSolid2 = aInOutMap( aHole ); + if ( IsInside( aSolid, aSolid2 )) { + aInOutMap.UnBind( aHole ); + aInOutMap.Bind ( aHole, aSolid ); + } + } + else{ + aInOutMap.Bind (aHole, aSolid); + } + } + // + // add aHole to a solid + if (aInOutMap.IsBound( aHole )){ + TopoDS_Shape & aSolid=aInOutMap(aHole); + aBB.Add (aSolid, aHole); + } + } + theShellList.Clear(); + theShellList.Append( aNewSolids ); +} +//======================================================================= +//function : BreakWebs +//purpose : +//======================================================================= + void NMTAlgo_Tools::BreakWebs(const TopoDS_Shape& aCS, + TopoDS_Shape& aCSR) +{ + Standard_Integer i, aNbF, aNbS; + TopTools_IndexedDataMapOfShapeListOfShape aMFS; + TopTools_MapOfShape aMF; + + TopoDS_Compound aFC, aCR; + BRep_Builder aBB; + // + aBB.MakeCompound(aFC); + TopExp::MapShapesAndAncestors(aCS, TopAbs_FACE, TopAbs_SOLID, aMFS); + // + aNbF=aMFS.Extent(); + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=aMFS.FindKey(i); + const TopTools_ListOfShape& aLS=aMFS(i); + aNbS=aLS.Extent(); + if (aNbS==2) { + aMF.Add(aF); + } + else { + aBB.Add(aFC, aF); + } + } + // + if (!aMF.Extent()) { + aCSR=aCS; + return; + } + // + TopTools_ListOfShape aLNS; + TopTools_ListIteratorOfListOfShape aItS; + // + NMTAlgo_Tools::MakeShells(aFC, aLNS); + NMTAlgo_Tools::MakeSolids(aLNS); + // + aBB.MakeCompound(aCR); + aItS.Initialize(aLNS); + for ( ;aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS=aItS.Value(); + aBB.Add(aCR, aS); + } + aCSR=aCR; +} +//======================================================================= +//function : FindImageSolid +//purpose : +//======================================================================= + Standard_Boolean NMTAlgo_Tools::FindImageSolid(const TopoDS_Shape& aFC, + const TopTools_IndexedMapOfShape& aMSo, + TopoDS_Shape& aSox) +{ + Standard_Boolean bFound=Standard_False; + Standard_Integer i, j, aNbSo, aNbF, aNbFSo; + TopoDS_Iterator aIt; + TopTools_IndexedMapOfShape aMFC, aMFSo; + // + aIt.Initialize(aFC); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + aMFC.Add(aF); + } + // + aNbF=aMFC.Extent(); + aNbSo=aMSo.Extent(); + for (i=1; i<=aNbSo; ++i) { + const TopoDS_Shape& aSo=aMSo(i); + // + bFound=Standard_True; + aMFSo.Clear(); + TopExp::MapShapes(aSo, TopAbs_FACE, aMFSo); + // + aNbFSo=aMFSo.Extent(); + if (aNbFSo!=aNbF) { + bFound=Standard_False; + continue; + } + // + for (j=1; j<=aNbFSo; ++j) { + const TopoDS_Shape& aFSo=aMFSo(j); + if (!aMFC.Contains(aFSo)) { + bFound=Standard_False; + break; + } + } + if (bFound) { + aSox=aSo; + return bFound; + } + } + return bFound; +} diff --git a/src/NMTAlgo/NMTAlgo_Tools.jxx b/src/NMTAlgo/NMTAlgo_Tools.jxx new file mode 100644 index 000000000..2923711df --- /dev/null +++ b/src/NMTAlgo/NMTAlgo_Tools.jxx @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shell_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _NMTAlgo_Tools_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS.cdl b/src/NMTDS/NMTDS.cdl new file mode 100644 index 000000000..6da914c15 --- /dev/null +++ b/src/NMTDS/NMTDS.cdl @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTDS.cdl +-- Created: Fri Nov 28 10:13:19 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +package NMTDS + + ---Purpose: + +uses + + TCollection, + TColStd, + Bnd, + TopoDS, + TopAbs, + TopTools, + BooleanOperations, + BOPTColStd +is + class ShapesDataStructure; + class IndexRange; + + pointer PShapesDataStructure to ShapesDataStructure from NMTDS; + + class CArray1OfIndexRange instantiates + CArray1 from BOPTColStd(IndexRange from NMTDS); + + class ListOfIndexedDataMapOfShapeAncestorsSuccessors instantiates + List from TCollection(IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations); + + class IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger instantiates + IndexedDataMap from TCollection(Integer from Standard, + IndexedDataMapOfShapeInteger from BooleanOperations, + MapIntegerHasher from TColStd); + +end NMTDS; diff --git a/src/NMTDS/NMTDS_IndexRange.cdl b/src/NMTDS/NMTDS_IndexRange.cdl new file mode 100644 index 000000000..a6b602957 --- /dev/null +++ b/src/NMTDS/NMTDS_IndexRange.cdl @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTDS_IndexRange.cdl +-- Created: Fri Nov 28 10:31:05 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class IndexRange from NMTDS + + ---Purpose: + +--uses +--raises + +is + Create + returns IndexRange from NMTDS; + + SetFirst(me:out; + aFirst:Integer from Standard); + + SetLast(me:out; + aLast:Integer from Standard); + + First(me) + returns Integer from Standard; + + Last(me) + returns Integer from Standard; + + IsInRange(me; + aIndex:Integer from Standard) + returns Boolean from Standard; + +fields + myFirst : Integer from Standard is protected; + myLast : Integer from Standard is protected; + +end IndexRange; diff --git a/src/NMTDS/NMTDS_IndexRange.cxx b/src/NMTDS/NMTDS_IndexRange.cxx new file mode 100644 index 000000000..3d4b21d5d --- /dev/null +++ b/src/NMTDS/NMTDS_IndexRange.cxx @@ -0,0 +1,76 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTDS_IndexRange.cxx +// Created: Fri Nov 28 10:34:59 2003 +// Author: Peter KURNEV +// + + +#include +//======================================================================= +//function :NMTDS_IndexRange::NMTDS_IndexRange +//purpose : +//======================================================================= + NMTDS_IndexRange::NMTDS_IndexRange() +: + myFirst(0), + myLast(0) +{ +} +//======================================================================= +//function :SetFirst +//purpose : +//======================================================================= + void NMTDS_IndexRange::SetFirst(const Standard_Integer aFirst) +{ + myFirst=aFirst; +} +//======================================================================= +//function :First +//purpose : +//======================================================================= + Standard_Integer NMTDS_IndexRange::First()const +{ + return myFirst; +} +//======================================================================= +//function :SetLast +//purpose : +//======================================================================= + void NMTDS_IndexRange::SetLast(const Standard_Integer aLast) +{ + myLast=aLast; +} +//======================================================================= +//function :Last +//purpose : +//======================================================================= + Standard_Integer NMTDS_IndexRange::Last()const +{ + return myLast; +} +//======================================================================= +//function :IsInRange +//purpose : +//======================================================================= + Standard_Boolean NMTDS_IndexRange::IsInRange(const Standard_Integer aIndex)const +{ + return (Standard_Boolean)(aIndex>=myFirst && aIndex<=myLast); +} diff --git a/src/NMTDS/NMTDS_IndexRange.jxx b/src/NMTDS/NMTDS_IndexRange.jxx new file mode 100644 index 000000000..a7c0bf7e7 --- /dev/null +++ b/src/NMTDS/NMTDS_IndexRange.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTDS_IndexRange_HeaderFile +#include +#endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cdl b/src/NMTDS/NMTDS_ShapesDataStructure.cdl new file mode 100644 index 000000000..16b8e9288 --- /dev/null +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cdl @@ -0,0 +1,77 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTDS_ShapesDataStructure.cdl +-- Created: Mon Dec 1 10:17:05 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class ShapesDataStructure from NMTDS + inherits ShapesDataStructure from BooleanOperations + + ---Purpose: + +uses + Shape from TopoDS, + CArray1OfIndexRange from NMTDS, + IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS +--raises + +is + Create + returns ShapesDataStructure from NMTDS; + ---C++: alias "Standard_EXPORT virtual ~NMTDS_ShapesDataStructure();" +--modified by NIZNHY-PKV Wed Feb 2 11:44:38 2005ft + + SetCompositeShape(me:out; + aS:Shape from TopoDS); + + Init(me:out); + + Ranges(me) + returns CArray1OfIndexRange from NMTDS; + ---C++: return const & + + CompositeShape(me) + returns Shape from TopoDS; + ---C++: return const & + + ShapeRangeIndex(me; + aId:Integer from Standard) + returns Integer from Standard; + + Rank (me; + anIndex:Integer from Standard) + returns Integer from Standard + is redefined; + + ShapeIndex (me; + aS:Shape from TopoDS; + iRank:Integer from Standard) + returns Integer from Standard + is redefined; +fields + myCompositeShape: Shape from TopoDS is protected; + myRanges : CArray1OfIndexRange from NMTDS is protected; + myShapeIndexMap : IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger from NMTDS is protected; + +end ShapesDataStructure; + diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.cxx b/src/NMTDS/NMTDS_ShapesDataStructure.cxx new file mode 100644 index 000000000..0fde81747 --- /dev/null +++ b/src/NMTDS/NMTDS_ShapesDataStructure.cxx @@ -0,0 +1,257 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTDS_ShapesDataStructure.cxx +// Created: Mon Dec 1 10:21:04 2003 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include +#include +#include + +//=========================================================================== +//function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure +//purpose : +//=========================================================================== + NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure() +: + BooleanOperations_ShapesDataStructure() +{ + //printf(" NMTDS_ShapesDataStructure CREATE:%x\n", (int)this); +} +//modified by NIZNHY-PKV Wed Feb 2 11:45:04 2005f +//=========================================================================== +//function : ~ +//purpose : +//=========================================================================== + NMTDS_ShapesDataStructure::~NMTDS_ShapesDataStructure() +{ + //printf(" NMTDS_ShapesDataStructure DELETE:%x\n", (int)this); +} +//modified by NIZNHY-PKV Wed Feb 2 11:45:06 2005t +//=========================================================================== +//function : SetCompositeShape +//purpose : +//=========================================================================== + void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS) +{ + myCompositeShape=aS; +} +//=========================================================================== +//function : CompositeShape +//purpose : +//=========================================================================== + const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const +{ + return myCompositeShape; +} +//=========================================================================== +//function : Ranges +//purpose : +//=========================================================================== + const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const +{ + return myRanges; +} +//=========================================================================== +//function : Init +//purpose : +//=========================================================================== + void NMTDS_ShapesDataStructure::Init() +{ + Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges; + Standard_Integer iFirst, iLast; + NMTDS_ListOfIndexedDataMapOfShapeAncestorsSuccessors aLx; + NMTDS_ListIteratorOfListOfIndexedDataMapOfShapeAncestorsSuccessors aLit; + TopoDS_Iterator anIt; + // + aNbS=0; + anIt.Initialize(myCompositeShape); + for (i=0; anIt.More(); anIt.Next(), ++i) { + const TopoDS_Shape& aSx=anIt.Value(); + BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aIndDatMapShape; + FillIndexedMapOfShapesAncestorsAndSuccessors(aSx, aIndDatMapShape); + aNbSx=aIndDatMapShape.Extent(); + aNbS+=aNbSx; + aLx.Append(aIndDatMapShape); + } + // + // Fill myRanges + myRanges.Resize(i); + aLit.Initialize(aLx); + for (i=1; aLit.More(); aLit.Next(), ++i) { + const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aM=aLit.Value(); + aNbSx=aM.Extent(); + if (i==1) { + iFirst=1; + iLast=aNbSx; + myRanges(i).SetFirst(iFirst); + myRanges(i).SetLast(iLast); + continue; + } + iFirst=myRanges(i-1).Last()+1; + iLast=iFirst+aNbSx-1; + myRanges(i).SetFirst(iFirst); + myRanges(i).SetLast(iLast); + } + // + myNumberOfShapesOfTheObject=aNbS; + myNumberOfShapesOfTheTool=aNbS; + myLength=3*aNbS; + // + // Allocate the whole Table + myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences) + Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences)); + // + // Fill the table + for (i=0; i<2; ++i) { + aShift=0; + if (i) { + aShift=myNumberOfShapesOfTheObject; + } + aLit.Initialize(aLx); + for (; aLit.More(); aLit.Next()) { + const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aM=aLit.Value(); + aNbSx=aM.Extent(); + for (j=1; j<=aNbSx; ++j) { + const TopoDS_Shape& aSx=aM.FindKey(j); + const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aM.FindFromIndex(j); + InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift); + } + aShift+=aNbSx; + } + } + // + // myShapeIndexMap + myShapeIndexMap.Clear(); + // + aNbRanges=myRanges.Extent(); + for (i=1; i<=aNbRanges; ++i){ + BooleanOperations_IndexedDataMapOfShapeInteger aSIM; + // + const NMTDS_IndexRange& aR=myRanges(i); + iFirst=aR.First(); + iLast =aR.Last(); + for (j=iFirst; j<=iLast; ++j) { + const TopoDS_Shape& aS=GetShape(j); + aSIM.Add(aS, j); + } + myShapeIndexMap.Add(i, aSIM); + } + // + // myRefEdges + iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool; + myRefEdges.Resize(iLast); + + for (i=1; i<=iLast; ++i) { + const TopoDS_Shape& aS=Shape(i); + myRefEdges(i)=0; + if (aS.ShapeType()==TopAbs_EDGE) { + myNbEdges++; + myRefEdges(i)=myNbEdges; + } + } +} +//=========================================================================== +//function : ShapeRangeIndex +//purpose : +//=========================================================================== + Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex(const Standard_Integer aId)const +{ + Standard_Boolean bFound; + Standard_Integer i, aNbR, aIdx, aNbS, aZero=0; + // + aNbS=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool; + + aIdx=aId; + if (aIdx > aNbS || aIdx < 1){ + return aZero; + } + // + if (aIdx > myNumberOfShapesOfTheObject) { + aIdx-=myNumberOfShapesOfTheObject; + } + // + aNbR=myRanges.Extent(); + for (i=1; i<=aNbR; ++i) { + const NMTDS_IndexRange& aRange=myRanges(i); + bFound=aRange.IsInRange(aIdx); + if (bFound) { + return i; + } + } + return aZero; +} +//=========================================================================== +//function : Rank +//purpose : +//=========================================================================== + Standard_Integer NMTDS_ShapesDataStructure::Rank(const Standard_Integer aId)const +{ + Standard_Boolean bFound; + Standard_Integer i, aNbR, aNbS, aZero=0; + // + aNbS=myNumberOfShapesOfTheObject; + + if (aId > aNbS || aId < 1){ + return aZero; + } + // + aNbR=myRanges.Extent(); + for (i=1; i<=aNbR; ++i) { + const NMTDS_IndexRange& aRange=myRanges(i); + bFound=aRange.IsInRange(aId); + if (bFound) { + return i; + } + } + return aZero; +} +//=========================================================================== +//function : ShapeIndex +//purpose : +//=========================================================================== + Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex(const TopoDS_Shape& aS, + const Standard_Integer aRank)const +{ + Standard_Boolean bFound; + Standard_Integer aIndex=0; + // + bFound=myShapeIndexMap.Contains(aRank); + if (!bFound) { + return aIndex; + } + // + const BooleanOperations_IndexedDataMapOfShapeInteger& aSIM=myShapeIndexMap.FindFromKey(aRank); + // + bFound=aSIM.Contains(aS); + if (!bFound) { + return aIndex; + } + // + aIndex=aSIM.FindFromKey(aS); + return aIndex; +} diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.hxx b/src/NMTDS/NMTDS_ShapesDataStructure.hxx new file mode 100644 index 000000000..3eab46368 --- /dev/null +++ b/src/NMTDS/NMTDS_ShapesDataStructure.hxx @@ -0,0 +1,116 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _NMTDS_ShapesDataStructure_HeaderFile +#define _NMTDS_ShapesDataStructure_HeaderFile + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTDS_CArray1OfIndexRange_HeaderFile +#include +#endif +#ifndef _NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger_HeaderFile +#include +#endif +#ifndef _BooleanOperations_ShapesDataStructure_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class TopoDS_Shape; +class NMTDS_CArray1OfIndexRange; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class NMTDS_ShapesDataStructure : public BooleanOperations_ShapesDataStructure { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT NMTDS_ShapesDataStructure(); +Standard_EXPORT virtual ~NMTDS_ShapesDataStructure(); +Standard_EXPORT void SetCompositeShape(const TopoDS_Shape& aS) ; +Standard_EXPORT void Init() ; +Standard_EXPORT const NMTDS_CArray1OfIndexRange& Ranges() const; +Standard_EXPORT const TopoDS_Shape& CompositeShape() const; +Standard_EXPORT Standard_Integer ShapeRangeIndex(const Standard_Integer aId) const; +Standard_EXPORT virtual Standard_Integer Rank(const Standard_Integer anIndex) const; +Standard_EXPORT virtual Standard_Integer ShapeIndex(const TopoDS_Shape& aS,const Standard_Integer iRank) const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +TopoDS_Shape myCompositeShape; +NMTDS_CArray1OfIndexRange myRanges; +NMTDS_IndexedDataMapOfIntegerIndexedDataMapOfShapeInteger myShapeIndexMap; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/NMTDS/NMTDS_ShapesDataStructure.jxx b/src/NMTDS/NMTDS_ShapesDataStructure.jxx new file mode 100644 index 000000000..445438ac2 --- /dev/null +++ b/src/NMTDS/NMTDS_ShapesDataStructure.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTDS_CArray1OfIndexRange_HeaderFile +#include +#endif +#ifndef _NMTDS_ShapesDataStructure_HeaderFile +#include +#endif diff --git a/src/NMTTools/Makefile.in b/src/NMTTools/Makefile.in new file mode 100644 index 000000000..77cdada9e --- /dev/null +++ b/src/NMTTools/Makefile.in @@ -0,0 +1,103 @@ +# GEOM NMTTools : partition algorithm +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Julia DOROVSKIKH +# Module : GEOM +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# Libraries targets +LIB = libNMTTools.la +LIB_SRC = \ + NMTTools_CommonBlock.cxx \ + NMTTools_CommonBlockAPI.cxx \ + NMTTools_CommonBlockPool_0.cxx \ + NMTTools_CoupleOfShape.cxx \ + NMTTools_DEProcessor.cxx \ + NMTTools_DSFiller.cxx \ + NMTTools_IndexedDataMapNodeOfIndexedDataMapOfIndexedMapOfInteger_0.cxx \ + NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ + NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapePaveBlock_0.cxx \ + NMTTools_IndexedDataMapOfIndexedMapOfInteger_0.cxx \ + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_0.cxx \ + NMTTools_IndexedDataMapOfShapePaveBlock_0.cxx \ + NMTTools_IteratorOfCoupleOfShape.cxx \ + NMTTools_ListIteratorOfListOfCommonBlock_0.cxx \ + NMTTools_ListIteratorOfListOfCoupleOfShape_0.cxx \ + NMTTools_ListNodeOfListOfCommonBlock_0.cxx \ + NMTTools_ListNodeOfListOfCoupleOfShape_0.cxx \ + NMTTools_ListOfCommonBlock_0.cxx \ + NMTTools_ListOfCoupleOfShape_0.cxx \ + NMTTools_PaveFiller.cxx \ + NMTTools_PaveFiller_0.cxx \ + NMTTools_PaveFiller_1.cxx \ + NMTTools_PaveFiller_2.cxx \ + NMTTools_PaveFiller_3.cxx \ + NMTTools_PaveFiller_4.cxx \ + NMTTools_PaveFiller_5.cxx \ + NMTTools_PaveFiller_6.cxx \ + NMTTools_PaveFiller_7.cxx \ + NMTTools_PaveFiller_8.cxx \ + NMTTools_PaveFiller_9.cxx \ + NMTTools_PCurveMaker.cxx \ + NMTTools_Tools.cxx + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# header files +EXPORT_HEADERS = \ + NMTTools_PDSFiller.hxx \ + NMTTools_DSFiller.hxx \ + NMTTools_PPaveFiller.hxx \ + NMTTools_PaveFiller.hxx \ + NMTTools_ListOfCoupleOfShape.hxx \ + NMTTools_Tools.hxx \ + NMTTools_CoupleOfShape.hxx \ + NMTTools_ListIteratorOfListOfCoupleOfShape.hxx \ + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx \ + NMTTools_IteratorOfCoupleOfShape.hxx \ + NMTTools_CommonBlockPool.hxx \ + Handle_NMTTools_ListNodeOfListOfCoupleOfShape.hxx \ + Handle_NMTTools_IndexedDataMapNodeOfIndexedDataMapOfShapeIndexedMapOfShape.hxx + +# idl files +EXPORT_IDLS= + + +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(CAS_LDPATH) -lTKBool -lTKBO -lNMTDS -L${KERNEL_ROOT_DIR}/lib/salome + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ diff --git a/src/NMTTools/NMTTools.cdl b/src/NMTTools/NMTTools.cdl new file mode 100644 index 000000000..866c8351a --- /dev/null +++ b/src/NMTTools/NMTTools.cdl @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools.cdl +-- Created: Thu Dec 4 16:55:49 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +package NMTTools + + ---Purpose: + +uses + + TCollection, + TColStd, + gp, + TopAbs, + TopoDS, + TopTools, + Geom2d, + BooleanOperations, + BOPTColStd, + IntTools, + BOPTools, + + NMTDS + +is + class IteratorOfCoupleOfShape; + class DSFiller; + class PaveFiller; + class Tools; + class CommonBlock; + class CommonBlockAPI; + class PCurveMaker; + class DEProcessor; + class CoupleOfShape; + + pointer PPaveFiller to PaveFiller from NMTTools; + pointer PDSFiller to DSFiller from NMTTools; + + class ListOfCommonBlock instantiates + List from TCollection(CommonBlock from NMTTools); + + class CommonBlockPool instantiates + CArray1 from BOPTColStd (ListOfCommonBlock from NMTTools); + + class IndexedDataMapOfIndexedMapOfInteger instantiates + IndexedDataMap from TCollection (Integer from Standard, + IndexedMapOfInteger from TColStd, + MapIntegerHasher from TColStd); + + class IndexedDataMapOfShapePaveBlock instantiates + IndexedDataMap from TCollection (Shape from TopoDS, + PaveBlock from BOPTools, + ShapeMapHasher from TopTools); + + class IndexedDataMapOfShapeIndexedMapOfShape instantiates + IndexedDataMap from TCollection (Shape from TopoDS, + IndexedMapOfShape from TopTools, + ShapeMapHasher from TopTools); + + class ListOfCoupleOfShape instantiates + List from TCollection(CoupleOfShape from NMTTools); + +end NMTTools; diff --git a/src/NMTTools/NMTTools_CommonBlock.cdl b/src/NMTTools/NMTTools_CommonBlock.cdl new file mode 100644 index 000000000..4778f6526 --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlock.cdl @@ -0,0 +1,107 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_CommonBlock.cdl +-- Created: Tue Dec 9 12:11:48 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class CommonBlock from NMTTools + + ---Purpose: + +uses + ListOfInteger from TColStd, + PaveBlock from BOPTools, + ListOfPaveBlock from BOPTools + +--raises + +is + Create + returns CommonBlock from NMTTools; + + AddPaveBlock(me:out; + aPB : PaveBlock from BOPTools); + + AddFace(me:out; + aF : Integer from Standard); + + AddFaces(me:out; + aLF: ListOfInteger from TColStd); + + PaveBlocks(me) + returns ListOfPaveBlock from BOPTools; + ---C++: return const & + + Faces (me) + returns ListOfInteger from TColStd; + ---C++: return const & + + PaveBlock1 (me) + returns PaveBlock from BOPTools; + ---C++: return const & + + PaveBlock1 (me:out; + anIx: Integer from Standard) + returns PaveBlock from BOPTools; + ---C++: return & + + PaveBlockOnEdge (me:out; + anIndex: Integer from Standard) + returns PaveBlock from BOPTools; + ---C++: return & + + IsPaveBlockOnFace (me; + anIndex: Integer from Standard) + returns Boolean from Standard; + + IsPaveBlockOnEdge (me; + anIndex: Integer from Standard) + returns Boolean from Standard; + + IsEqual (me; + aCB:CommonBlock from NMTTools) + returns Boolean from Standard; + + Contains(me; + aPB:PaveBlock from BOPTools) + returns Boolean from Standard; + +-- SetEdge (me:out; +-- anEdge:Integer from Standard); + +-- Edge (me) +-- returns Integer from Standard; + +fields + myPaveBlocks: ListOfPaveBlock from BOPTools is protected; + myFaces : ListOfInteger from TColStd is protected; + +end CommonBlock; + + + + + + + + diff --git a/src/NMTTools/NMTTools_CommonBlock.cxx b/src/NMTTools/NMTTools_CommonBlock.cxx new file mode 100644 index 000000000..c061fe32d --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlock.cxx @@ -0,0 +1,246 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_CommonBlock.cxx +// Created: Tue Dec 9 12:23:29 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include + +//======================================================================= +// function: NMTTools_CommonBlock::NMTTools_CommonBlock() +// purpose: +//======================================================================= + NMTTools_CommonBlock::NMTTools_CommonBlock() +{ +} +//======================================================================= +// function: AddPaveBlock +// purpose: +//======================================================================= + void NMTTools_CommonBlock::AddPaveBlock(const BOPTools_PaveBlock& aPB) +{ + myPaveBlocks.Append(aPB); +} +//======================================================================= +// function: AddFace +// purpose: +//======================================================================= + void NMTTools_CommonBlock::AddFace(const Standard_Integer aF) +{ + myFaces.Append(aF); +} +//======================================================================= +// function: AddFaces +// purpose: +//======================================================================= + void NMTTools_CommonBlock::AddFaces(const TColStd_ListOfInteger& aLF) +{ + TColStd_ListIteratorOfListOfInteger aIt(aLF); + // + for (; aIt.More(); aIt.Next()) { + myFaces.Append(aIt.Value()); + } +} +//======================================================================= +// function: PaveBlocks +// purpose: +//======================================================================= + const BOPTools_ListOfPaveBlock& NMTTools_CommonBlock::PaveBlocks()const +{ + return myPaveBlocks; +} +//======================================================================= +// function: Faces +// purpose: +//======================================================================= + const TColStd_ListOfInteger& NMTTools_CommonBlock::Faces()const +{ + return myFaces; +} +//======================================================================= +// function: PaveBlock1 +// purpose: +//======================================================================= + const BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1()const +{ + return myPaveBlocks.First(); +} +//======================================================================= +// function: PaveBlock1 +// purpose: +//======================================================================= + BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlock1(const Standard_Integer aIx) +{ + return PaveBlockOnEdge(aIx); +} +//======================================================================= +// function: PaveBlockOnEdge +// purpose: +//======================================================================= + BOPTools_PaveBlock& NMTTools_CommonBlock::PaveBlockOnEdge(const Standard_Integer aIx) +{ + static BOPTools_PaveBlock aPBs; + Standard_Integer aIOr; + BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks); + // + for (; anIt.More(); anIt.Next()) { + BOPTools_PaveBlock& aPB=anIt.Value(); + aIOr=aPB.OriginalEdge(); + if (aIOr==aIx){ + return aPB; + } + } + return aPBs; +} +//======================================================================= +// function: IsPaveBlockOnFace +// purpose: +//======================================================================= + Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnFace(const Standard_Integer aIx)const +{ + Standard_Boolean bFound=Standard_False; + Standard_Integer nF; + TColStd_ListIteratorOfListOfInteger anIt(myFaces); + // + for (; anIt.More(); anIt.Next()) { + nF=anIt.Value(); + if (nF==aIx){ + return !bFound; + } + } + return bFound; +} +//======================================================================= +// function: IsPaveBlockOnEdge +// purpose: +//======================================================================= + Standard_Boolean NMTTools_CommonBlock::IsPaveBlockOnEdge(const Standard_Integer aIx)const +{ + Standard_Boolean bFound=Standard_False; + Standard_Integer aIOr; + BOPTools_ListIteratorOfListOfPaveBlock anIt(myPaveBlocks); + // + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + aIOr=aPB.OriginalEdge(); + if (aIOr==aIx){ + return !bFound; + } + } + return bFound; +} +//======================================================================= +// function: IsEqual +// purpose: +//======================================================================= + Standard_Boolean NMTTools_CommonBlock::IsEqual(const NMTTools_CommonBlock& aOther)const +{ + Standard_Boolean bFound=Standard_True; + Standard_Integer aNb1, aNb2; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + aNb1=myPaveBlocks.Extent(); + aNb2=aOther.myPaveBlocks.Extent(); + // + if (!aNb1 && !aNb2) { + return bFound; + } + if (!aNb1) { + return !bFound; + } + if (!aNb2) { + return !bFound; + } + // + const BOPTools_PaveBlock& aPB=PaveBlock1(); + // + anIt.Initialize(aOther.myPaveBlocks); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBOther=anIt.Value(); + if (aPB.IsEqual(aPBOther)){ + return bFound; + } + } + return !bFound; +} +//======================================================================= +// function: Contains +// purpose: +//======================================================================= + Standard_Boolean NMTTools_CommonBlock::Contains(const BOPTools_PaveBlock& aPBx)const +{ + Standard_Boolean bFound=Standard_False; + Standard_Integer aNb1; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + aNb1=myPaveBlocks.Extent(); + // + if (!aNb1) { + return bFound; + } + // + anIt.Initialize(myPaveBlocks); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + if (aPB.IsEqual(aPBx)) { + return !bFound; + } + } + return bFound; +} +/* +//======================================================================= +// function: SetEdge +// purpose: +//======================================================================= + void NMTTools_CommonBlock::SetEdge(const Standard_Integer anEdge) +{ + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + anIt.Initialize(myPaveBlocks); + for (; anIt.More(); anIt.Next()) { + BOPTools_PaveBlock& aPB=anIt.Value(); + aPB.SetEdge(anEdge); + } +} +//======================================================================= +// function: Edge +// purpose: +//======================================================================= + Standard_Integer NMTTools_CommonBlock::Edge()const +{ + Standard_Integer aNb; + // + aNb=myPaveBlocks.Extent(); + // + if (!aNb) { + return aNb; + } + // + const BOPTools_PaveBlock& aPB=PaveBlock1(); + aNb=aPB.Edge(); + return aNb; +} +*/ diff --git a/src/NMTTools/NMTTools_CommonBlock.jxx b/src/NMTTools/NMTTools_CommonBlock.jxx new file mode 100644 index 000000000..96f3e2846 --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlock.jxx @@ -0,0 +1,31 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _BOPTools_PaveBlock_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _BOPTools_ListOfPaveBlock_HeaderFile +#include +#endif +#ifndef _NMTTools_CommonBlock_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.cdl b/src/NMTTools/NMTTools_CommonBlockAPI.cdl new file mode 100644 index 000000000..884992d6b --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlockAPI.cdl @@ -0,0 +1,73 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_CommonBlockAPI.cdl +-- Created: Mon Dec 15 11:35:46 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class CommonBlockAPI from NMTTools + + ---Purpose: + +uses + ListOfCommonBlock from NMTTools, + ListOfPaveBlock from BOPTools, + PaveBlock from BOPTools, + CommonBlock from NMTTools + +--raises + +is + Create (aList:ListOfCommonBlock from NMTTools) + returns CommonBlockAPI from NMTTools; + + List(me) + returns ListOfCommonBlock from NMTTools; + ---C++: return const & + ---Purpose: + --- Selector + --- + CommonPaveBlocks(me; + anE:Integer from Standard) + returns ListOfPaveBlock from BOPTools; + ---C++: return const & + ---Purpose: + --- Returns all PaveBlock-s (from the list) that are + --- common for the given edge with DS-index + --- + IsCommonBlock (me; + aPB: PaveBlock from BOPTools) + returns Boolean from Standard; + ---Purpose: + --- Returns TRUE if given PaveBlock is + --- common for the Blocks from the list + + CommonBlock(me; + aPB: PaveBlock from BOPTools) + returns CommonBlock from NMTTools; + ---C++: return & + +fields + myListOfCommonBlock :Address from Standard; + myListOfPaveBlock :ListOfPaveBlock from BOPTools; + +end CommonBlockAPI; diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.cxx b/src/NMTTools/NMTTools_CommonBlockAPI.cxx new file mode 100644 index 000000000..b9cb6ec87 --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlockAPI.cxx @@ -0,0 +1,133 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_CommonBlockAPI.cxx +// Created: Mon Dec 15 11:38:04 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include + +#include +#include +#include + +//======================================================================= +// function: NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI +// purpose: +//======================================================================= + NMTTools_CommonBlockAPI::NMTTools_CommonBlockAPI (const NMTTools_ListOfCommonBlock& aLCB) +{ + myListOfCommonBlock=(void *)&aLCB; +} +//======================================================================= +// function: List +// purpose: +//======================================================================= + const NMTTools_ListOfCommonBlock& NMTTools_CommonBlockAPI::List () const +{ + NMTTools_ListOfCommonBlock* pListOfCommonBlock=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock; + return *pListOfCommonBlock; +} +//======================================================================= +// function: CommonPaveBlocks +// purpose: get all CommonPaveBlocks +//======================================================================= + const BOPTools_ListOfPaveBlock& NMTTools_CommonBlockAPI::CommonPaveBlocks(const Standard_Integer anE) const +{ + Standard_Integer anECurrent; + BOPTools_ListIteratorOfListOfPaveBlock anItPB; + // + BOPTools_ListOfPaveBlock* pmyListOfPaveBlock=(BOPTools_ListOfPaveBlock*) &myListOfPaveBlock; + pmyListOfPaveBlock->Clear(); + + NMTTools_ListOfCommonBlock* pListOfCommonBlock=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock; + + NMTTools_ListIteratorOfListOfCommonBlock anIt(*pListOfCommonBlock); + for (; anIt.More(); anIt.Next()) { + const NMTTools_CommonBlock& aCB=anIt.Value(); + // + const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); + anItPB.Initialize(aLPB); + for (; anItPB.More(); anItPB.Next()) { + const BOPTools_PaveBlock& aPB=anItPB.Value(); + anECurrent=aPB.OriginalEdge(); + if (anECurrent==anE) { + pmyListOfPaveBlock->Append(aPB); + break; + } + } + } + return myListOfPaveBlock; +} +//======================================================================= +// function: IsCommonBlock +// purpose: +//======================================================================= + Standard_Boolean NMTTools_CommonBlockAPI::IsCommonBlock(const BOPTools_PaveBlock& aPB) const +{ + Standard_Integer anE; + // + anE=aPB.OriginalEdge(); + // + CommonPaveBlocks(anE); + // + BOPTools_ListIteratorOfListOfPaveBlock anIt(myListOfPaveBlock); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB1=anIt.Value(); + if (aPB1.IsEqual(aPB)) { + return Standard_True; + } + } + return Standard_False; +} + +//======================================================================= +// function: CommonBlock +// purpose: +//======================================================================= + NMTTools_CommonBlock& NMTTools_CommonBlockAPI::CommonBlock(const BOPTools_PaveBlock& aPB)const +{ + static NMTTools_CommonBlock aCBTMP; + // + NMTTools_ListIteratorOfListOfCommonBlock anItCB; + BOPTools_ListIteratorOfListOfPaveBlock anItPB; + // + NMTTools_ListOfCommonBlock* pLCB=(NMTTools_ListOfCommonBlock*)myListOfCommonBlock; + // + anItCB.Initialize(*pLCB); + for (; anItCB.More(); anItCB.Next()) { + NMTTools_CommonBlock& aCB=anItCB.Value(); + // + const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); + anItPB.Initialize(aLPB); + for (; anItPB.More(); anItPB.Next()) { + const BOPTools_PaveBlock& aPBx=anItPB.Value(); + if (aPBx.IsEqual(aPB)) { + return aCB; + } + } + } + return aCBTMP; +} diff --git a/src/NMTTools/NMTTools_CommonBlockAPI.jxx b/src/NMTTools/NMTTools_CommonBlockAPI.jxx new file mode 100644 index 000000000..54a045946 --- /dev/null +++ b/src/NMTTools/NMTTools_CommonBlockAPI.jxx @@ -0,0 +1,34 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTTools_ListOfCommonBlock_HeaderFile +#include +#endif +#ifndef _BOPTools_ListOfPaveBlock_HeaderFile +#include +#endif +#ifndef _BOPTools_PaveBlock_HeaderFile +#include +#endif +#ifndef _NMTTools_CommonBlock_HeaderFile +#include +#endif +#ifndef _NMTTools_CommonBlockAPI_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_CoupleOfShape.cdl b/src/NMTTools/NMTTools_CoupleOfShape.cdl new file mode 100644 index 000000000..8cb400159 --- /dev/null +++ b/src/NMTTools/NMTTools_CoupleOfShape.cdl @@ -0,0 +1,58 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_CoupleOfShape.cdl +-- Created: Wed Jan 28 15:03:39 2004 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2004 + + +class CoupleOfShape from NMTTools + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns CoupleOfShape from NMTTools; + + SetShape1(me:out; + aS: Shape from TopoDS); + + SetShape2(me:out; + aS: Shape from TopoDS); + + Shape1(me) + returns Shape from TopoDS; + ---C++: return const & + + Shape2(me) + returns Shape from TopoDS; + ---C++: return const & + +fields + myShape1:Shape from TopoDS is protected; + myShape2:Shape from TopoDS is protected; + +end CoupleOfShape; diff --git a/src/NMTTools/NMTTools_CoupleOfShape.cxx b/src/NMTTools/NMTTools_CoupleOfShape.cxx new file mode 100644 index 000000000..7bc4f2d67 --- /dev/null +++ b/src/NMTTools/NMTTools_CoupleOfShape.cxx @@ -0,0 +1,64 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_CoupleOfShape.cxx +// Created: Wed Jan 28 15:06:11 2004 +// Author: Peter KURNEV +// + +#include + +//======================================================================= +// function: NMTTools_CoupleOfShape::NMTTools_CoupleOfShape +// purpose: +//======================================================================= + NMTTools_CoupleOfShape::NMTTools_CoupleOfShape() +{} +//======================================================================= +// function: SetShape1 +// purpose: +//======================================================================= + void NMTTools_CoupleOfShape::SetShape1(const TopoDS_Shape& aS) +{ + myShape1=aS; +} +//======================================================================= +// function: SetShape2 +// purpose: +//======================================================================= + void NMTTools_CoupleOfShape::SetShape2(const TopoDS_Shape& aS) +{ + myShape2=aS; +} +//======================================================================= +// function: Shape1 +// purpose: +//======================================================================= + const TopoDS_Shape& NMTTools_CoupleOfShape::Shape1()const +{ + return myShape1; +} +//======================================================================= +// function: Shape2 +// purpose: +//======================================================================= + const TopoDS_Shape& NMTTools_CoupleOfShape::Shape2()const +{ + return myShape2; +} diff --git a/src/NMTTools/NMTTools_CoupleOfShape.jxx b/src/NMTTools/NMTTools_CoupleOfShape.jxx new file mode 100644 index 000000000..a44ab4cd5 --- /dev/null +++ b/src/NMTTools/NMTTools_CoupleOfShape.jxx @@ -0,0 +1,25 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTTools_CoupleOfShape_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_DEProcessor.cdl b/src/NMTTools/NMTTools_DEProcessor.cdl new file mode 100644 index 000000000..b57cd543a --- /dev/null +++ b/src/NMTTools/NMTTools_DEProcessor.cdl @@ -0,0 +1,124 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_DEProcessor.cdl +-- Created: Wed Sep 12 12:08:37 2001 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2001 + + +class DEProcessor from NMTTools + + ---Purpose: + -- + -- The Algorithm to compute and store in interferences' pool + --- and in the Data Structure the following values + --- for degenerated edges + --- 1. Paves/Pave set(s) + --- 2. Split parts + --- 3. States (3D) for split parts + --- + +uses + + Vertex from TopoDS, + Edge from TopoDS, + Face from TopoDS, + + PPaveFiller from NMTTools, + PaveFiller from NMTTools, + --PDSFiller from NMTTools, + ListOfPaveBlock from BOPTools, + PShapesDataStructure from NMTDS, + IndexedDataMapOfIntegerDEInfo from BOPTools + + +is + --Create (aFiller:out PDSFiller from NMTTools) + -- returns DEProcessor from NMTTools; + ---Purpose: + --- Constructor + --- + Create (aFiller:out PaveFiller from NMTTools) + returns DEProcessor from NMTTools; + ---Purpose: + --- Constructor + --- + Do(me:out); + ---Purpose: + --- Launches the processor + --- + IsDone(me) + returns Boolean from Standard; + ---Purpose: + --- Returns TRUE if it is Ok + --- + --- + --- Private block + --- + --- + FindDegeneratedEdges (me:out) + is protected; + + DoPaves (me:out) + is protected; + + FindPaveBlocks (me:out; + nED:Integer from Standard; + nVD:Integer from Standard; + nFD:Integer from Standard; + aLPB:out ListOfPaveBlock from BOPTools) + is protected; + + FillPaveSet (me:out; + nED:Integer from Standard; + nVD:Integer from Standard; + nFD:Integer from Standard; + aLPB: ListOfPaveBlock from BOPTools) + is protected; + + FillSplitEdgesPool(me:out; + nED:Integer from Standard) + is protected; + + MakeSplitEdges(me:out; + nED:Integer from Standard; + nFD:Integer from Standard) + is protected; + + MakeSplitEdge (me:out; + aS1: Edge from TopoDS; + aF : Face from TopoDS; + aV1: Vertex from TopoDS; + aP1: Real from Standard; + aV2: Vertex from TopoDS; + aP2: Real from Standard; + aNewEdge:out Edge from TopoDS) + is protected; + +fields + + --myDSFiller: PDSFiller from NMTTools is protected; + myFiller : PPaveFiller from NMTTools is protected; + myDS : PShapesDataStructure from NMTDS is protected; + myIsDone : Boolean from Standard is protected; + myDEMap : IndexedDataMapOfIntegerDEInfo from BOPTools is protected; + +end DEProcessor; diff --git a/src/NMTTools/NMTTools_DEProcessor.cxx b/src/NMTTools/NMTTools_DEProcessor.cxx new file mode 100644 index 000000000..277e9e03a --- /dev/null +++ b/src/NMTTools/NMTTools_DEProcessor.cxx @@ -0,0 +1,511 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: BOPTools_DEProcessor.cxx +// Created: Wed Sep 12 12:10:52 2001 +// Author: Peter KURNEV +// + +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +//#include +#include +// +#include +#include + + + +//======================================================================= +// function: NMTTools_DEProcessor::NMTTools_DEProcessor +// purpose: +//======================================================================= + NMTTools_DEProcessor::NMTTools_DEProcessor(NMTTools_PaveFiller& aPaveFiller) +: + myIsDone(Standard_False) +{ + myFiller=(NMTTools_PaveFiller*) &aPaveFiller; + myDS=myFiller->DS(); +} +//======================================================================= +// function: IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_DEProcessor::IsDone() const +{ + return myIsDone; +} +//======================================================================= +// function: Do +// purpose: +//======================================================================= + void NMTTools_DEProcessor::Do() +{ + Standard_Integer aNbE; + myIsDone=Standard_False; + + FindDegeneratedEdges(); + aNbE=myDEMap.Extent(); + + if (!aNbE) { + myIsDone=Standard_True; + return; + } + DoPaves(); +} +//======================================================================= +// function: FindDegeneratedEdges +// purpose: +//======================================================================= + void NMTTools_DEProcessor::FindDegeneratedEdges() +{ + Standard_Integer i, aNb, nV, nF, nVx, ip, iRankE; + TopTools_IndexedDataMapOfShapeListOfShape aMEF; + // + aNb=myDS->NumberOfShapesOfTheObject(); + // + for (i=1; i<=aNb; i++) { + const TopoDS_Shape& aF=myDS->Shape(i); + if (aF.ShapeType()==TopAbs_FACE) { + TopExp::MapShapesAndAncestors (aF, TopAbs_EDGE, TopAbs_FACE, aMEF); + } + } + // + for (i=1; i<=aNb; i++) { + const TopoDS_Shape& aS=myDS->Shape(i); + if (aS.ShapeType()==TopAbs_EDGE) { + const TopoDS_Edge& aE=TopoDS::Edge(aS); + + if (BRep_Tool::Degenerated(aE)) { + iRankE=myDS->Rank(i); + + TopoDS_Vertex aV=TopExp::FirstVertex(aE); + + nVx=myDS->ShapeIndex(aV, iRankE); + // + nV=nVx; + ip=myFiller->FindSDVertex(nV); + if (ip) { + nV=ip; + } + // + TColStd_ListOfInteger aLFn; + const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE); + TopTools_ListIteratorOfListOfShape anIt(aLF); + for (; anIt.More(); anIt.Next()) { + const TopoDS_Shape& aF=anIt.Value(); + nF=myDS->ShapeIndex(aF, iRankE); + aLFn.Append(nF); + } + BOPTools_DEInfo aDEInfo; + aDEInfo.SetVertex(nV); + aDEInfo.SetFaces(aLFn); + + myDEMap.Add (i, aDEInfo); + } + } + } +} +//======================================================================= +// function: DoPaves +// purpose: +//======================================================================= + void NMTTools_DEProcessor::DoPaves() +{ + + Standard_Integer i, aNbE, nED, nVD, nFD=0; + // + aNbE=myDEMap.Extent(); + for (i=1; i<=aNbE; i++) { + nED=myDEMap.FindKey(i); + + const BOPTools_DEInfo& aDEInfo=myDEMap(i); + nVD=aDEInfo.Vertex(); + // Fill PaveSet for the edge nED + const TColStd_ListOfInteger& nLF=aDEInfo.Faces(); + TColStd_ListIteratorOfListOfInteger anIt(nLF); + for (; anIt.More(); anIt.Next()) { + nFD=anIt.Value(); + + BOPTools_ListOfPaveBlock aLPB; + FindPaveBlocks(nED, nVD, nFD, aLPB); + FillPaveSet (nED, nVD, nFD, aLPB); + } + // + // Fill aSplitEdges for the edge nED + FillSplitEdgesPool(nED); + // + // MakeSplitEdges + MakeSplitEdges(nED, nFD); + // + }// next nED +} +//======================================================================= +// function: FindPaveBlocks +// purpose: +//======================================================================= + void NMTTools_DEProcessor::FindPaveBlocks(const Standard_Integer , + const Standard_Integer nVD, + const Standard_Integer nFD, + BOPTools_ListOfPaveBlock& aLPBOut) +{ + BOPTools_ListIteratorOfListOfPaveBlock anIt; + Standard_Integer i, aNb, nF2, nV; + // + BOPTools_CArray1OfSSInterference& aFFs=(myFiller->InterfPool())->SSInterferences(); + // + aNb=aFFs.Extent(); + for (i=1; i<=aNb; ++i) { + BOPTools_SSInterference& aFF=aFFs(i); + // + nF2=aFF.OppositeIndex(nFD); + if (!nF2) { + continue; + } + // + // Split Parts + const BOPTools_ListOfPaveBlock& aLPBSplits=aFF.PaveBlocks(); + anIt.Initialize(aLPBSplits); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBSp=anIt.Value(); + // + const BOPTools_Pave& aPave1=aPBSp.Pave1(); + nV=aPave1.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSp); + continue; + } + // + const BOPTools_Pave& aPave2=aPBSp.Pave2(); + nV=aPave2.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSp); + continue; + } + } + // + // Section Parts + Standard_Integer j, aNbCurves; + BOPTools_SequenceOfCurves& aSC=aFF.Curves(); + aNbCurves=aSC.Length(); + + for (j=1; j<=aNbCurves; j++) { + const BOPTools_Curve& aBC=aSC(j); + const BOPTools_ListOfPaveBlock& aLPBSe=aBC.NewPaveBlocks(); + + anIt.Initialize(aLPBSe); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBSe=anIt.Value(); + + const BOPTools_Pave& aPv1=aPBSe.Pave1(); + nV=aPv1.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSe); + continue; + } + + const BOPTools_Pave& aPv2=aPBSe.Pave2(); + nV=aPv2.Index(); + if (nV==nVD) { + aLPBOut.Append(aPBSe); + continue; + } + } + } + } +} +//======================================================================= +// function: FillPaveSet +// purpose: +//======================================================================= + void NMTTools_DEProcessor::FillPaveSet (const Standard_Integer nED, + const Standard_Integer nVD, + const Standard_Integer nFD, + const BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Boolean bIsDone, bXDir, bRejectFlag; + Standard_Integer nE, aNbPoints, j; + Standard_Real aTD1, aTD2, aT1, aT2, aTolInter, aX, aDT; + // + aDT=Precision::PConfusion(); + // + BOPTools_PaveSet& aPaveSet= (myFiller->ChangePavePool()).ChangeValue(myDS->RefEdge(nED)); + // + // Clear aPaveSet, aSplitEdges + aPaveSet.ChangeSet().Clear(); + // + const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED)); + const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD)); + // + // 2D Curve of degenerated edge on the face aDF + Handle(Geom2d_Curve) aC2DDE=BRep_Tool::CurveOnSurface(aDE, aDF, aTD1, aTD2); + // + // Choose direction for Degenerated Edge + gp_Pnt2d aP2d1, aP2d2; + aC2DDE->D0(aTD1, aP2d1); + aC2DDE->D0(aTD2, aP2d2); + + bXDir=Standard_False; + if (fabs(aP2d1.Y()-aP2d2.Y()) < aDT){ + bXDir=!bXDir; + } + // + // Prepare bounding Paves + BOPTools_Pave aPave1 (nVD, aTD1, BooleanOperations_UnknownInterference); + aPaveSet.Append(aPave1); + BOPTools_Pave aPave2 (nVD, aTD2, BooleanOperations_UnknownInterference); + aPaveSet.Append(aPave2); + // + // Fill other paves + BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + nE=aPB.Edge(); + const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE)); + + Handle(Geom2d_Curve) aC2D=BRep_Tool::CurveOnSurface(aE, aDF, aT1, aT2); + // + // Intersection + aTolInter=0.001; + + Geom2dAdaptor_Curve aGAC1, aGAC2; + + aGAC1.Load(aC2DDE, aTD1, aTD2); + Handle(Geom2d_Line) aL2D= Handle(Geom2d_Line)::DownCast(aC2D); + if (!aL2D.IsNull()) { + aGAC2.Load(aC2D); + } + else { + aGAC2.Load(aC2D, aT1, aT2); + } + + Geom2dInt_GInter aGInter(aGAC1, aGAC2, aTolInter, aTolInter); + + bIsDone=aGInter.IsDone(); + if(bIsDone) { + aNbPoints=aGInter.NbPoints(); + if (aNbPoints) { + for (j=1; j<=aNbPoints; ++j) { + gp_Pnt2d aP2D=aGInter.Point(j).Value(); + // + aX=(bXDir) ? aP2D.X(): aP2D.Y(); + // + if (fabs (aX-aTD1) < aDT || fabs (aX-aTD2) < aDT) { + continue; + } + if (aX < aTD1 || aX > aTD2) { + continue; + } + // + bRejectFlag=Standard_False; + const BOPTools_ListOfPave& aListOfPave=aPaveSet.Set(); + BOPTools_ListIteratorOfListOfPave aPaveIt(aListOfPave); + for (; aPaveIt.More(); aPaveIt.Next()) { + const BOPTools_Pave& aPavex=aPaveIt.Value(); + Standard_Real aXx=aPavex.Param(); + if (fabs (aX-aXx) < aDT) { + bRejectFlag=Standard_True; + break; + } + } + if (bRejectFlag) { + continue; + } + // + BOPTools_Pave aPave(nVD, aX, BooleanOperations_UnknownInterference); + aPaveSet.Append(aPave); + } + } + } + } +} +//======================================================================= +// function: FillSplitEdgesPool +// purpose: +//======================================================================= + void NMTTools_DEProcessor::FillSplitEdgesPool (const Standard_Integer nED) +{ + BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->ChangeSplitShapesPool(); + BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool.ChangeValue(myDS->RefEdge(nED)); + // + aSplitEdges.Clear(); + // + const BOPTools_PavePool& aPavePool=myFiller->PavePool(); + BOPTools_PavePool* pPavePool=(BOPTools_PavePool*) &aPavePool; + BOPTools_PaveSet& aPaveSet= pPavePool->ChangeValue(myDS->RefEdge(nED)); + + BOPTools_PaveBlockIterator aPBIt(nED, aPaveSet); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + aSplitEdges.Append(aPB); + } +} +//======================================================================= +// function: MakeSplitEdges +// purpose: +//======================================================================= + void NMTTools_DEProcessor::MakeSplitEdges (const Standard_Integer nED, + const Standard_Integer nFD) +{ + const BOPTools_SplitShapesPool& aSplitShapesPool=myFiller->SplitShapesPool(); + const BOPTools_ListOfPaveBlock& aSplitEdges=aSplitShapesPool(myDS->RefEdge(nED)); + + Standard_Integer nV1, nV2, aNewShapeIndex; + Standard_Real t1, t2; + TopoDS_Edge aE, aESplit; + TopoDS_Vertex aV1, aV2; + + const TopoDS_Edge& aDE=TopoDS::Edge(myDS->Shape(nED)); + const TopoDS_Face& aDF=TopoDS::Face(myDS->Shape(nFD)); + + BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges); + + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + t1=aPave1.Param(); + aV1=TopoDS::Vertex(myDS->GetShape(nV1)); + aV1.Orientation(TopAbs_FORWARD); + + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + t2=aPave2.Param(); + aV2=TopoDS::Vertex(myDS->GetShape(nV2)); + aV2.Orientation(TopAbs_REVERSED); + + MakeSplitEdge(aDE, aDF, aV1, t1, aV2, t2, aESplit); + // + // Add Split Part of the Original Edge to the DS + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + + anASSeq.SetNewSuccessor(nV1); + anASSeq.SetNewOrientation(aV1.Orientation()); + + anASSeq.SetNewSuccessor(nV2); + anASSeq.SetNewOrientation(aV2.Orientation()); + + myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq); + aNewShapeIndex=myDS->NumberOfInsertedShapes(); + myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN); + // + // Fill Split Set for the Original Edge + aPB.SetEdge(aNewShapeIndex); + // + } +} +//======================================================================= +// function: MakeSplitEdge +// purpose: +//======================================================================= + void NMTTools_DEProcessor::MakeSplitEdge (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const TopoDS_Vertex& aV1, + const Standard_Real aP1, + const TopoDS_Vertex& aV2, + const Standard_Real aP2, + TopoDS_Edge& aNewEdge) +{ + Standard_Real aTol=1.e-7; + + TopoDS_Edge E=aE; + + E.EmptyCopy(); + BRep_Builder BB; + BB.Add (E, aV1); + BB.Add (E, aV2); + + BB.Range(E, aF, aP1, aP2); + + BB.Degenerated(E, Standard_True); + + BB.UpdateEdge(E, aTol); + aNewEdge=E; +} +/* +//======================================================================= +// function: NMTTools_DEProcessor::NMTTools_DEProcessor +// purpose: +//======================================================================= + NMTTools_DEProcessor::NMTTools_DEProcessor(NMTTools_PDSFiller& pDSFiller) +: + myIsDone(Standard_False) +{ + myDSFiller=pDSFiller; + myFiller=(NMTTools_PaveFiller*) &(myDSFiller->PaveFiller()); + myDS=myFiller->DS(); +} +*/ diff --git a/src/NMTTools/NMTTools_DEProcessor.jxx b/src/NMTTools/NMTTools_DEProcessor.jxx new file mode 100644 index 000000000..61db39d5c --- /dev/null +++ b/src/NMTTools/NMTTools_DEProcessor.jxx @@ -0,0 +1,37 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTTools_PaveFiller_HeaderFile +#include +#endif +#ifndef _BOPTools_ListOfPaveBlock_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _NMTTools_DEProcessor_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_DSFiller.cdl b/src/NMTTools/NMTTools_DSFiller.cdl new file mode 100644 index 000000000..82d011819 --- /dev/null +++ b/src/NMTTools/NMTTools_DSFiller.cdl @@ -0,0 +1,99 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_DSFiller.cdl +-- Created: Fri Dec 5 13:57:03 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class DSFiller from NMTTools + + ---Purpose: + +uses + Shape from TopoDS, + InterferencePool from BOPTools, + PInterferencePool from BOPTools, + ShapesDataStructure from NMTDS, + PShapesDataStructure from NMTDS, + PPaveFiller from NMTTools, + PaveFiller from NMTTools +--raises + +is + Create + returns DSFiller from NMTTools; + + Destroy (me:out); + ---C++: alias ~ + ---Purpose: Destructor + -- + -- Selectors/Modifiers + SetCompositeShape (me:out; + aS: Shape from TopoDS); + + CompositeShape(me) + returns Shape from TopoDS; + ---C++: return const& + + SetNewFiller(me; + aFlag:Boolean from Standard); + + IsNewFiller(me) + returns Boolean from Standard; + -- + -- Perform the algo + Perform (me:out); + -- + -- Protected section + Clear (me:out) + is protected; + -- + -- Query section + DS (me) + returns ShapesDataStructure from NMTDS; + ---C++: return const & + + InterfPool (me) + returns InterferencePool from BOPTools; + ---C++: return const & + + IsDone(me) + returns Boolean from Standard; + + PaveFiller(me) + returns PaveFiller from NMTTools; + ---C++: return const & + + ChangePaveFiller (me:out) + returns PaveFiller from NMTTools; + ---C++: return & + +fields + myCompositeShape : Shape from TopoDS is protected; + myDS : PShapesDataStructure from NMTDS is protected; + myInterfPool : PInterferencePool from BOPTools is protected; + myPaveFiller : PPaveFiller from NMTTools is protected; + + myIsDone : Boolean from Standard is protected; + myIsNewFiller : Boolean from Standard is protected; + +end DSFiller; diff --git a/src/NMTTools/NMTTools_DSFiller.cxx b/src/NMTTools/NMTTools_DSFiller.cxx new file mode 100644 index 000000000..2a2266d49 --- /dev/null +++ b/src/NMTTools/NMTTools_DSFiller.cxx @@ -0,0 +1,168 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_DSFiller.cxx +// Created: Fri Dec 5 14:06:34 2003 +// Author: Peter KURNEV +// + + +#include +#include + +//======================================================================= +// function: NMTTools_DSFiller::NMTTools_DSFiller +// purpose: +//======================================================================= + NMTTools_DSFiller::NMTTools_DSFiller() +{ + myPaveFiller=NULL; + myInterfPool=NULL; + myDS=NULL; + myIsNewFiller=Standard_True; + myIsDone=Standard_False; +} +//======================================================================= +// function:Destroy +// purpose: +//======================================================================= + void NMTTools_DSFiller::Destroy() +{ + Clear(); +} +//======================================================================= +// function: Clear +// purpose: +//======================================================================= + void NMTTools_DSFiller::Clear() +{ + if (myPaveFiller!=NULL) { + delete myPaveFiller; + } + if (myInterfPool!=NULL) { + delete myInterfPool; + } + if (myDS!=NULL) { + delete myDS; + } + myPaveFiller=NULL; + myInterfPool=NULL; + myDS=NULL; +} +//======================================================================= +// function: SetCompositeShape +// purpose: +//======================================================================= + void NMTTools_DSFiller::SetCompositeShape(const TopoDS_Shape& aS) +{ + myCompositeShape=aS; +} +//======================================================================= +// function: CompositeShape +// purpose: +//======================================================================= + const TopoDS_Shape& NMTTools_DSFiller::CompositeShape()const +{ + return myCompositeShape; +} +//======================================================================= +// function: SetNewFiller +// purpose: +//======================================================================= + void NMTTools_DSFiller::SetNewFiller(const Standard_Boolean aFlag) const +{ + NMTTools_DSFiller* pDSFiller=(NMTTools_DSFiller*)this; + pDSFiller->myIsNewFiller=aFlag; +} +//======================================================================= +// function: IsNewFiller +// purpose: +//======================================================================= + Standard_Boolean NMTTools_DSFiller::IsNewFiller() const +{ + return myIsNewFiller; +} +//======================================================================= +// function: DS +// purpose: +//======================================================================= + const NMTDS_ShapesDataStructure& NMTTools_DSFiller::DS () const +{ + return *myDS; +} +//======================================================================= +// function: InterfPool +// purpose: +//======================================================================= + const BOPTools_InterferencePool& NMTTools_DSFiller::InterfPool () const +{ + return *myInterfPool; +} +//======================================================================= +// function: IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_DSFiller::IsDone()const +{ + return myIsDone; +} +//======================================================================= +// function: PaveFiller +// purpose: +//======================================================================= + const NMTTools_PaveFiller& NMTTools_DSFiller::PaveFiller()const +{ + return *myPaveFiller; +} +//======================================================================= +// function: ChangePaveFiller +// purpose: +//======================================================================= + NMTTools_PaveFiller& NMTTools_DSFiller::ChangePaveFiller() +{ + return *myPaveFiller; +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= + void NMTTools_DSFiller::Perform() +{ + myIsDone=Standard_False; + // + if (myCompositeShape.IsNull()) { + return; + } + // + // + // Clear contents of the DS if it was before + Clear(); + // + myIsNewFiller=Standard_True; + // + myDS = new NMTDS_ShapesDataStructure; + myDS->SetCompositeShape(myCompositeShape); + myDS->Init(); + // + myInterfPool= new BOPTools_InterferencePool (*myDS); + // + myPaveFiller = new NMTTools_PaveFiller(*myInterfPool); + myPaveFiller->Perform(); + myIsDone=myPaveFiller->IsDone(); +} diff --git a/src/NMTTools/NMTTools_DSFiller.jxx b/src/NMTTools/NMTTools_DSFiller.jxx new file mode 100644 index 000000000..0eaf5fed7 --- /dev/null +++ b/src/NMTTools/NMTTools_DSFiller.jxx @@ -0,0 +1,34 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _NMTDS_ShapesDataStructure_HeaderFile +#include +#endif +#ifndef _BOPTools_InterferencePool_HeaderFile +#include +#endif +#ifndef _NMTTools_PaveFiller_HeaderFile +#include +#endif +#ifndef _NMTTools_DSFiller_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl new file mode 100644 index 000000000..b85337d85 --- /dev/null +++ b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cdl @@ -0,0 +1,74 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_IteratorOfCoupleOfShape.cdl +-- Created: Thu Dec 4 16:57:48 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class IteratorOfCoupleOfShape from NMTTools + inherits IteratorOfCoupleOfShape from BOPTools + + ---Purpose: + +uses + ShapeEnum from TopAbs, + IndexedMapOfCoupleOfInteger from BOPTools, + PShapesDataStructure from NMTDS, + ShapesDataStructure from NMTDS + +raises + NoSuchObject from Standard + +is + Create + returns IteratorOfCoupleOfShape from NMTTools; + + SetDS(me:out; + pDS:PShapesDataStructure from NMTDS); + + Initialize(me: in out; + Type1: ShapeEnum from TopAbs; + Type2: ShapeEnum from TopAbs) + raises NoSuchObject from Standard + is redefined; + + Current(me; Index1: in out Integer from Standard; + Index2: in out Integer from Standard; + WithSubShape: out Boolean from Standard) + is redefined; + + More(me) + returns Boolean from Standard + is redefined; + + DS(me) + returns ShapesDataStructure from NMTDS; + ---C++:return const & + +fields + myPNMTPS : PShapesDataStructure from NMTDS is protected; + myMap : IndexedMapOfCoupleOfInteger from BOPTools is protected; + myIndex1 : Integer from Standard is protected; + myIndex2 : Integer from Standard is protected; + myWithSubShapeFlag: Boolean from Standard is protected; + +end IteratorOfCoupleOfShape; diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx new file mode 100644 index 000000000..fb96d6277 --- /dev/null +++ b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.cxx @@ -0,0 +1,159 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_IteratorOfCoupleOfShape.cxx +// Created: Thu Dec 4 17:00:03 2003 +// Author: Peter KURNEV +// + + +#include +#include +#include +#include +#include +#include + +//======================================================================= +// function: +// purpose: +//======================================================================= + NMTTools_IteratorOfCoupleOfShape::NMTTools_IteratorOfCoupleOfShape() +: + BOPTools_IteratorOfCoupleOfShape() +{ + myIndex1=0; + myIndex2=0; + myWithSubShapeFlag=Standard_False; +} +//======================================================================= +// function: SetDS +// purpose: +//======================================================================= + void NMTTools_IteratorOfCoupleOfShape::SetDS(const NMTDS_PShapesDataStructure& PDS) +{ + myPNMTPS=PDS; + SetDataStructure(myPNMTPS); +} +//======================================================================= +// function: Initialize +// purpose: +//======================================================================= + void NMTTools_IteratorOfCoupleOfShape::Initialize(const TopAbs_ShapeEnum Type1, + const TopAbs_ShapeEnum Type2) +{ + if(myPDS==NULL) { + Standard_NoSuchObject::Raise("NMTTools_IteratorOfCoupleOfShape::Initialize: myPDS==NULL"); + } + // + myType1 = Type1; + myType2 = Type2; + myCurrentIndex1 = -1; + myCurrentIndex2 = -1; + // + myFirstLowerIndex=1; + myFirstUpperIndex=myPNMTPS->NumberOfShapesOfTheObject(); + mySecondLowerIndex=myFirstUpperIndex+1; + mySecondUpperIndex=myFirstUpperIndex+myPNMTPS->NumberOfShapesOfTheTool(); + // + Standard_Integer n1, n2, aIR1, aIR2;//, aN1, aN2, aNS; + // + const NMTDS_CArray1OfIndexRange& aRanges=myPNMTPS->Ranges(); + // + //aNS=myPNMTPS->NumberOfShapesOfTheObject(); + myIndex1=0; + myIndex2=0; + myWithSubShapeFlag=Standard_False; + // + myListOfCouple.Clear(); + myMap.Clear(); + // + NextP(); + for (; MoreP(); NextP()) { + CurrentP(n1, n2); + // + aIR1=myPNMTPS->ShapeRangeIndex(n1); + aIR2=myPNMTPS->ShapeRangeIndex(n2); + if (aIR1==aIR2){ + continue; + } + // + BOPTools_CoupleOfInteger aCouple(n1, n2); + myListOfCouple.Append(aCouple); + // + /* + aN1=(n1>aNS)? n1-aNS : n1; + aN2=(n2>aNS)? n2-aNS : n2; + BOPTools_CoupleOfInteger aCoupleX(aN1, aN2); + myMap.Add(aCoupleX); + */ + } + myIterator.Initialize(myListOfCouple); +} +//======================================================================= +// function: Current +// purpose: +//======================================================================= + void NMTTools_IteratorOfCoupleOfShape::Current(Standard_Integer& aIndex1, + Standard_Integer& aIndex2, + Standard_Boolean& aWithSubShape) const +{ + aIndex1=myIndex1; + aIndex2=myIndex2; + aWithSubShape=myWithSubShapeFlag; +} +//======================================================================= +// function: More +// purpose: +//======================================================================= + Standard_Boolean NMTTools_IteratorOfCoupleOfShape::More()const +{ + Standard_Boolean bMore, bWithSubShape; + Standard_Integer n1, n2, aNS, aN1, aN2; + BOPTools_CoupleOfInteger aCoupleX; + NMTTools_IteratorOfCoupleOfShape* pIt=(NMTTools_IteratorOfCoupleOfShape*)this; + // + aNS=myPNMTPS->NumberOfShapesOfTheObject(); + pIt->myIndex1=0; + pIt->myIndex2=0; + pIt->myWithSubShapeFlag=Standard_False; + // + while (1) { + bMore=myIterator.More(); + if (!bMore) { + break; + } + // + BOPTools_IteratorOfCoupleOfShape::Current(n1, n2, bWithSubShape); + aN1=(n1>aNS)? n1-aNS : n1; + aN2=(n2>aNS)? n2-aNS : n2; + aCoupleX.SetCouple(aN1, aN2); + if (!myMap.Contains(aCoupleX)) { + pIt->myMap.Add(aCoupleX); + // + pIt->myIndex1=aN1; + pIt->myIndex2=aN2; + pIt->myWithSubShapeFlag=bWithSubShape; + break; + } + // + pIt->Next(); + } + return bMore; +} diff --git a/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx new file mode 100644 index 000000000..ac0d96f7e --- /dev/null +++ b/src/NMTTools/NMTTools_IteratorOfCoupleOfShape.jxx @@ -0,0 +1,28 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _NMTDS_ShapesDataStructure_HeaderFile +#include +#endif +#ifndef _NMTTools_IteratorOfCoupleOfShape_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_PCurveMaker.cdl b/src/NMTTools/NMTTools_PCurveMaker.cdl new file mode 100644 index 000000000..3c38575a0 --- /dev/null +++ b/src/NMTTools/NMTTools_PCurveMaker.cdl @@ -0,0 +1,54 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_PCurveMaker.cdl +-- Created: +-- Author: Peter KURNEV +-- + +class PCurveMaker from NMTTools + + ---Purpose: + -- Class provides computation p-curves for the edges and theirs + --- split parts + +uses + PDSFiller from NMTTools + +is + Create (aFiller:out PDSFiller from NMTTools) + returns PCurveMaker from NMTTools; + ---Purpose: + --- Constructor + --- + Do(me:out); + ---Purpose: + --- Launch the processor + --- + IsDone(me) + returns Boolean from Standard; + ---Purpose: + --- Returns TRUE if Ok + --- + +fields + myDSFiller: PDSFiller from NMTTools is protected; + myIsDone : Boolean from Standard is protected; + +end PCurveMaker; diff --git a/src/NMTTools/NMTTools_PCurveMaker.cxx b/src/NMTTools/NMTTools_PCurveMaker.cxx new file mode 100644 index 000000000..2b139c143 --- /dev/null +++ b/src/NMTTools/NMTTools_PCurveMaker.cxx @@ -0,0 +1,128 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PCurveMaker.cxx +// Created: +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +//======================================================================= +// function: NMTTools_PCurveMaker +// purpose: +//======================================================================= + NMTTools_PCurveMaker::NMTTools_PCurveMaker(NMTTools_PDSFiller& pDSFiller) +: + myIsDone(Standard_False) +{ + myDSFiller=pDSFiller; +} +//======================================================================= +// function: IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PCurveMaker::IsDone() const +{ + return myIsDone; +} +//======================================================================= +// function: Do +// purpose: +//======================================================================= + void NMTTools_PCurveMaker::Do() +{ + Standard_Integer i, aNb, nF1, nF2, nE; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + TopoDS_Face aF1FWD, aF2FWD; + // + NMTTools_PaveFiller *pFiller=(NMTTools_PaveFiller*) &(myDSFiller->PaveFiller()); + NMTDS_ShapesDataStructure *pDS=pFiller->DS(); + // + BOPTools_CArray1OfSSInterference& aFFs=(pFiller->InterfPool())->SSInterferences(); + // + aNb=aFFs.Extent(); + for (i=1; i<=aNb; ++i) { + BOPTools_SSInterference& aFF=aFFs(i); + // Faces + aFF.Indices(nF1, nF2); + const TopoDS_Face& aF1=TopoDS::Face(pDS->Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(pDS->Shape(nF2)); + // + // 1.Forwarding the Faces + aF1FWD=aF1; + aF1FWD.Orientation(TopAbs_FORWARD); + aF2FWD=aF2; + aF2FWD.Orientation(TopAbs_FORWARD); + // + // 2. In, On parts processing + const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); + anIt.Initialize(aLPBInOn); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + const BOPTools_PaveBlock& aPBInOn=pFiller->RealPaveBlock(aPB); + // + nE=aPBInOn.Edge(); + const TopoDS_Edge& aE=TopoDS::Edge(pDS->Shape(nE)); + + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); + } + } // for (i=1; i<=aNb; i++) + myIsDone=Standard_True; +} + diff --git a/src/NMTTools/NMTTools_PCurveMaker.jxx b/src/NMTTools/NMTTools_PCurveMaker.jxx new file mode 100644 index 000000000..8d7f0405d --- /dev/null +++ b/src/NMTTools/NMTTools_PCurveMaker.jxx @@ -0,0 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _NMTTools_PCurveMaker_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_PaveFiller.cdl b/src/NMTTools/NMTTools_PaveFiller.cdl new file mode 100644 index 000000000..49616a9ca --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller.cdl @@ -0,0 +1,460 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_PaveFiller.cdl +-- Created: Fri Dec 5 14:35:00 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class PaveFiller from NMTTools + + ---Purpose: + +uses + ListOfInteger from TColStd, + Pnt from gp, + ShapeEnum from TopAbs, + Vertex from TopoDS, + Face from TopoDS, + + Context from IntTools, + ShrunkRange from IntTools, + + IndexedDataMapOfShapeInteger from BooleanOperations, + + InterferencePool from BOPTools, + PInterferencePool from BOPTools, + PavePool from BOPTools, + PaveBlock from BOPTools, + ListOfPaveBlock from BOPTools, + SplitShapesPool from BOPTools, + Pave from BOPTools, + PaveSet from BOPTools, + Curve from BOPTools, + SSInterference from BOPTools, + + IDMapOfPaveBlockIMapOfPaveBlock from BOPTools, + IDMapOfPaveBlockIMapOfInteger from BOPTools, + SSIntersectionAttribute from BOPTools, + + CommonBlockPool from NMTTools, + CommonBlock from NMTTools, + ListOfCommonBlock from NMTTools, + IteratorOfCoupleOfShape from NMTTools, + + ShapesDataStructure from NMTDS, + PShapesDataStructure from NMTDS + +--raises + +is + Create + returns PaveFiller from NMTTools; + + Create(aIP:InterferencePool from BOPTools) + returns PaveFiller from NMTTools; + + Destroy (me: in out) + is virtual; + ---C++: alias "Standard_EXPORT virtual ~NMTTools_PaveFiller(){Destroy();}" + -- + -- Selectors/Modifiers + SetInterferencePool(me:out; + aIP:InterferencePool from BOPTools); + + InterfPool(me:out) + returns PInterferencePool from BOPTools; + -- + -- Perform the algo + Init (me:out) + is protected; + + Perform (me:out) + is virtual; + + PerformVV (me:out) + is virtual protected; + + PerformVE (me:out) + is virtual protected; + + PerformVF (me:out) + is virtual protected; + + PerformEE (me:out) + is virtual protected; + + PerformEF (me:out) + is virtual protected; + + PerformFF (me:out) + is virtual protected; + + MakeSplitEdges(me:out) + is protected; + + PreparePaveBlocks (me:out; + aType1: ShapeEnum from TopAbs; + aType2: ShapeEnum from TopAbs) + is virtual protected; + + CorrectShrunkRanges(me:out; + aSide: Integer from Standard; + aPave: Pave from BOPTools; + aSR : out ShrunkRange from IntTools) + is protected; + + PreparePaveBlocks (me:out; + anE:Integer from Standard) + is virtual protected; + + PerformNewVertices (me:out) + is virtual protected; + + PrepareEdges (me:out) + is virtual protected; + + SortTypes (me; + anInd1:in out Integer from Standard; + anInd2:in out Integer from Standard) + is protected; + + ExpectedPoolLength(me) + returns Integer from Standard + is protected; + -- + -- Query section + IsDone(me) + returns Boolean from Standard; + + DS(me:out) + returns PShapesDataStructure from NMTDS; + + Context(me) + returns Context from IntTools; + ---C++:return const & + + ChangeContext(me:out) + returns Context from IntTools; + ---C++:return & + + PavePool(me) + returns PavePool from BOPTools; + ---C++:return const & + + ChangePavePool(me:out) + returns PavePool from BOPTools; + ---C++:return & + + CommonBlockPool(me) + returns CommonBlockPool from NMTTools; + ---C++:return const & + + ChangeCommonBlockPool(me:out) + returns CommonBlockPool from NMTTools; + ---C++:return & + + SplitShapesPool(me) + returns SplitShapesPool from BOPTools; + ---C++:return const & + + ChangeSplitShapesPool(me:out) + returns SplitShapesPool from BOPTools; + ---C++:return & + + FindSDVertex (me; + nV: Integer from Standard) + returns Integer from Standard; + + IsSuccesstorsComputed (me; + iF1:Integer from Standard; + iF2:Integer from Standard) + returns Boolean from Standard + is protected; + + IsBlocksCoinside (me; + aPB1:PaveBlock from BOPTools; + aPB2:PaveBlock from BOPTools) + returns Boolean from Standard + is protected; + + RefinePavePool(me:out) + is protected; + + CheckFacePaves(me:out; + aV : Vertex from TopoDS; + nF: Integer from Standard) + returns Integer from Standard + is protected; + + ReplaceCommonBlocks (me:out; + aLCB: ListOfCommonBlock from NMTTools) + is protected; + + RemoveCommonBlocks (me:out; + aLCB: ListOfCommonBlock from NMTTools) + is protected; + + SplitCommonBlocks (me:out; + aLCB: ListOfCommonBlock from NMTTools) + is protected; + + SplitCommonBlock (me:out; + aCB : CommonBlock from NMTTools; + aLCB: out ListOfCommonBlock from NMTTools) + is protected; + + EECommonBlocks(me:out; + aM:IDMapOfPaveBlockIMapOfPaveBlock from BOPTools) + is protected; + + EFCommonBlocks(me:out; + aMapCB:IDMapOfPaveBlockIMapOfInteger from BOPTools) + is protected; + + EENewVertices (me:out; + aM:IndexedDataMapOfShapeInteger from BooleanOperations) + is protected; + + EENewVertices (me:out; + aV:Vertex from TopoDS; + aM:IndexedDataMapOfShapeInteger from BooleanOperations) + is protected; + + EFNewVertices (me:out; + aM:IndexedDataMapOfShapeInteger from BooleanOperations) + is protected; + + EFNewVertices (me:out; + aV:Vertex from TopoDS; + aM:IndexedDataMapOfShapeInteger from BooleanOperations) + is protected; + + UpdateCommonBlocks(me:out) + is protected; + + UpdatePaveBlocks(me:out) + is protected; + + SplitIndex(me; + aPB:PaveBlock from BOPTools) + returns Integer from Standard + is protected; + + MakeBlocks(me:out) + is protected; + + -------------------------------------------------------------- + --- + --- Some API FUNCTIONS + --- + SplitsInFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + SplitsInFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + SplitsOnEdge(me:out; + nE1 :Integer from Standard; + nE2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + SplitsOnFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + SplitsOnFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + SplitsInFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + + SplitsInFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + + SplitsOnEdge(me:out; + nE1 :Integer from Standard; + nE2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + + SplitsOnFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + + SplitsOnFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + -- + SplitsFace (me:out; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools) + returns Integer from Standard; + + SplitsFace (me:out; + nF2 :Integer from Standard; + aLs :out ListOfInteger from TColStd) + returns Integer from Standard; + + CommonBlocksFace (me:out; + nF :Integer from Standard; + aLCB:out ListOfCommonBlock from NMTTools) + returns Integer from Standard; + + PrepareFace(me:out; + nF : Integer from Standard; + aF : out Face from TopoDS); + + -- + RealPaveBlock(me:out; + aPB:PaveBlock from BOPTools) + returns PaveBlock from BOPTools; + ---C++: return const & + -- + RealSplitsFace (me:out; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + + HasRealSplitsInOnFace (me:out; + nF1 :Integer from Standard; + nF2 :Integer from Standard) + returns Boolean from Standard; + + RealSplitsInFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + + RealSplitsInFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + + RealSplitsOnEdge(me:out; + nE1 :Integer from Standard; + nE2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + + RealSplitsOnFace(me:out; + nE1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + + RealSplitsOnFace(me:out; + aBid:Integer from Standard; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + aLs :out ListOfPaveBlock from BOPTools); + -- + PrepareSetForFace(me:out; + nF1 :Integer from Standard; + nF2 :Integer from Standard; + --modified by NIZNHY-PKV Fri Apr 1 11:19:15 2005f + aLPB: ListOfPaveBlock from BOPTools; + --modified by NIZNHY-PKV Fri Apr 1 10:54:16 2005t + aPSF:out PaveSet from BOPTools); + + PutPaveOnCurve(me:out; + aPSF: PaveSet from BOPTools; + aTol: Real from Standard; + aBC : out Curve from BOPTools); + + PutBoundPaveOnCurve (me:out; + aBC :out Curve from BOPTools; + aFF :out SSInterference from BOPTools); + + PutBoundPaveOnCurve (me:out; + aP : Pnt from gp; + aT : Real from Standard; + aBC :out Curve from BOPTools; + aFF :out SSInterference from BOPTools); + + FindPave (me:out; + aP : Pnt from gp; + aTpV: Real from Standard; + aPS : PaveSet from BOPTools; + aPV :out Pave from BOPTools) + returns Boolean from Standard; + + CheckIntermediatePoint(me:out; + aPB : PaveBlock from BOPTools; + aPBR: PaveBlock from BOPTools; + aTol: Real from Standard) + returns Integer from Standard; + +-- IsExistingPaveBlock (me:out; +-- aPB : PaveBlock from BOPTools; +-- aFF : SSInterference from BOPTools) +-- returns Boolean from Standard; + +--modified by NIZNHY-PKV Fri Apr 1 09:35:34 2005f + IsExistingPaveBlock (me:out; + aPB : PaveBlock from BOPTools; + aLPB: ListOfPaveBlock from BOPTools; + aTol: Real from Standard) + returns Boolean from Standard; +--modified by NIZNHY-PKV Fri Apr 1 09:35:39 2005t + + MakePCurves (me:out); + +fields + myIntrPool : PInterferencePool from BOPTools is protected; + myDS : PShapesDataStructure from NMTDS is protected; + myIsDone : Boolean from Standard is protected; + myNbSources : Integer from Standard is protected; + myNbEdges : Integer from Standard is protected; + myDSIt : IteratorOfCoupleOfShape from NMTTools is protected; + -- + myPavePool : PavePool from BOPTools is protected; + myPavePoolNew : PavePool from BOPTools is protected; + myCommonBlockPool : CommonBlockPool from NMTTools is protected; + mySplitShapesPool : SplitShapesPool from BOPTools is protected; + -- + myContext : Context from IntTools is protected; + mySectionAttribute : SSIntersectionAttribute from BOPTools is protected; +end PaveFiller; diff --git a/src/NMTTools/NMTTools_PaveFiller.cxx b/src/NMTTools/NMTTools_PaveFiller.cxx new file mode 100644 index 000000000..4594b09b4 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller.cxx @@ -0,0 +1,231 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller.cxx +// Created: Fri Dec 5 14:58:54 2003 +// Author: Peter KURNEV +// +// +#include +// +#include +#include +#include +//QQ #include "utilities.h" + +//======================================================================= +// function: NMTTools_PaveFiller::NMTTools_PaveFiller +// purpose: +//======================================================================= + NMTTools_PaveFiller::NMTTools_PaveFiller() +{ + myIntrPool=NULL; + myDS=NULL; + myIsDone=Standard_False; + myNbSources=0; + myNbEdges=0; +} +//======================================================================= +// function:NMTTools_PaveFiller::NMTTools_PaveFiller +// purpose: +//======================================================================= + NMTTools_PaveFiller::NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP) +{ + SetInterferencePool(aIP); +} +//======================================================================= +// function: Destroy +// purpose: +//======================================================================= + void NMTTools_PaveFiller::Destroy() +{ +} +//======================================================================= +// function: SetInterferencePool +// purpose: +//======================================================================= + void NMTTools_PaveFiller::SetInterferencePool(const BOPTools_InterferencePool& aIP) +{ + myIsDone=Standard_False; + // + myIntrPool=(BOPTools_InterferencePool*)&aIP; + myDS=(NMTDS_ShapesDataStructure*)myIntrPool->DS(); + myNbSources=myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool(); + myNbEdges=myDS->NbEdges(); +} +//======================================================================= +// function: InterfPool +// purpose: +//======================================================================= + BOPTools_PInterferencePool NMTTools_PaveFiller::InterfPool() +{ + return myIntrPool; +} +//======================================================================= +// function:IsDone +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsDone() const +{ + return myIsDone; +} +//======================================================================= +// function: DS +// purpose: +//======================================================================= + NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS() +{ + return myDS; +} +//======================================================================= +// function: Context +// purpose: +//======================================================================= + const IntTools_Context& NMTTools_PaveFiller::Context() const +{ + return myContext; +} +//======================================================================= +// function: ChangeContext +// purpose: +//======================================================================= + IntTools_Context& NMTTools_PaveFiller::ChangeContext() +{ + return myContext; +} +//======================================================================= +// function: PavePool +// purpose: +//======================================================================= + const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const +{ + return myPavePool; +} +//======================================================================= +// function: ChangePavePool +// purpose: +//======================================================================= + BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool() +{ + return myPavePool; +} +//======================================================================= +// function: CommonBlockPool +// purpose: +//======================================================================= + const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const +{ + return myCommonBlockPool; +} +//======================================================================= +// function: ChangeCommonBlockPool +// purpose: +//======================================================================= + NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool() +{ + return myCommonBlockPool; +} +//======================================================================= +// function: SplitShapesPool +// purpose: +//======================================================================= + const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const +{ + return mySplitShapesPool; +} + +//======================================================================= +// function: ChangeSplitShapesPool +// purpose: +//======================================================================= + BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool() +{ + return mySplitShapesPool; +} +//======================================================================= +// function: Init +// purpose: +//======================================================================= + void NMTTools_PaveFiller::Init() +{ + myDSIt.SetDS(myDS); +} +//======================================================================= +// function: Perform +// purpose: +//======================================================================= + void NMTTools_PaveFiller::Perform() +{ + try { + // 0. + Init();//myDSIt.SetDS(myDS); + // + //1.VV + PerformVV(); + PerformNewVertices(); + // + // 2.VE + myPavePool.Resize (myNbEdges); + PrepareEdges(); + + PerformVE(); + // + // 3.VF + PerformVF(); + // + // 4.EE + myCommonBlockPool.Resize (myNbEdges); + mySplitShapesPool.Resize (myNbEdges); + myPavePoolNew .Resize (myNbEdges); + + PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE); + PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE); + // + PerformEE(); + // + RefinePavePool (); + // + myPavePoolNew.Destroy(); + myPavePoolNew.Resize (myNbEdges); + // + // 5.EF + PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE); + PerformEF(); + RefinePavePool(); + // + myPavePoolNew.Destroy(); + MakeSplitEdges(); + UpdateCommonBlocks(); + // + // 6. FF + PerformFF (); + MakeBlocks(); + MakePCurves(); + // + // 7.Postprocessing + UpdatePaveBlocks(); + // + NMTTools_DEProcessor aDEP(*this); + aDEP.Do(); + // + } + catch (BOPTColStd_Failure& /*x*/) { + //QQ MESSAGE(x.Message() << flush); + } +} diff --git a/src/NMTTools/NMTTools_PaveFiller.jxx b/src/NMTTools/NMTTools_PaveFiller.jxx new file mode 100644 index 000000000..07212861d --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller.jxx @@ -0,0 +1,85 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _BOPTools_InterferencePool_HeaderFile +#include +#endif +#ifndef _BOPTools_Pave_HeaderFile +#include +#endif +#ifndef _IntTools_ShrunkRange_HeaderFile +#include +#endif +#ifndef _IntTools_Context_HeaderFile +#include +#endif +#ifndef _BOPTools_PavePool_HeaderFile +#include +#endif +#ifndef _NMTTools_CommonBlockPool_HeaderFile +#include +#endif +#ifndef _BOPTools_SplitShapesPool_HeaderFile +#include +#endif +#ifndef _BOPTools_PaveBlock_HeaderFile +#include +#endif +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _NMTTools_ListOfCommonBlock_HeaderFile +#include +#endif +#ifndef _NMTTools_CommonBlock_HeaderFile +#include +#endif +#ifndef _BOPTools_IDMapOfPaveBlockIMapOfPaveBlock_HeaderFile +#include +#endif +#ifndef _BOPTools_IDMapOfPaveBlockIMapOfInteger_HeaderFile +#include +#endif +#ifndef _BooleanOperations_IndexedDataMapOfShapeInteger_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _BOPTools_ListOfPaveBlock_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _BOPTools_PaveSet_HeaderFile +#include +#endif +#ifndef _BOPTools_Curve_HeaderFile +#include +#endif +#ifndef _BOPTools_SSInterference_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _NMTTools_PaveFiller_HeaderFile +#include +#endif diff --git a/src/NMTTools/NMTTools_PaveFiller_0.cxx b/src/NMTTools/NMTTools_PaveFiller_0.cxx new file mode 100644 index 000000000..67951644d --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_0.cxx @@ -0,0 +1,137 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_0.cxx +// Created: Mon Dec 8 11:45:51 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include + +//======================================================================= +//function : SortTypes +//purpose : +//======================================================================= + void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat, + Standard_Integer& theWith)const +{ + Standard_Boolean aReverseFlag=Standard_True; + + TopAbs_ShapeEnum aType1= myDS->GetShapeType(theWhat), + aType2= myDS->GetShapeType(theWith); + + if (aType1==aType2) + return; + + if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE){ + aReverseFlag=Standard_False; + } + + if (aType1==TopAbs_VERTEX && + (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) { + aReverseFlag=Standard_False; + } + + Standard_Integer aWhat, aWith; + aWhat=(aReverseFlag) ? theWith : theWhat; + aWith=(aReverseFlag) ? theWhat : theWith; + + theWhat=aWhat; + theWith=aWith; +} +//======================================================================= +// function: ExpectedPoolLength +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::ExpectedPoolLength()const +{ + Standard_Integer aNbIIs; + Standard_Real aCfPredict=.5; + + const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple(); + aNbIIs=aLC.Extent(); + // + if (aNbIIs==1) { + return aNbIIs; + } + // + aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs); + + return aNbIIs; +} +//======================================================================= +// function:IsSuccesstorsComputed +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsSuccesstorsComputed(const Standard_Integer aN1, + const Standard_Integer aN2)const +{ + Standard_Integer nSuc, n1, n2; + + BooleanOperations_OnceExplorer aExp(*myDS); + TopAbs_ShapeEnum aType=myDS->GetShapeType(aN1); + + n1=aN1; + n2=aN2; + + if (aType!=TopAbs_VERTEX) { + Standard_Integer ntmp=n1; + n1=n2; + n2=ntmp; + } + + aType=myDS->GetShapeType(n2); + if (aType==TopAbs_EDGE) { + aExp.Init(n2, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nSuc=aExp.Current(); + if (myIntrPool->IsComputed(n1, nSuc)) { + return Standard_True; + } + } + return Standard_False; + } + + else if (aType==TopAbs_FACE) { + aExp.Init(n2, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nSuc=aExp.Current(); + if (myIntrPool->IsComputed(n1, nSuc)) { + return Standard_True; + } + } + + aExp.Init(n2, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nSuc=aExp.Current(); + if (myIntrPool->IsComputed(n1, nSuc)) { + return Standard_True; + } + } + return Standard_False; + } + + return Standard_False; +} diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx new file mode 100644 index 000000000..6aa2d4504 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -0,0 +1,189 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_1.cxx +// Created: Mon Dec 8 11:47:55 2003 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + + +//======================================================================= +// function: PerformVV +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformVV() +{ + myIsDone=Standard_False; + // + Standard_Integer n1, n2,anIndexIn, aFlag, aWhat, aWith, aNbVVs, aBlockLength; + Standard_Boolean bJustAddInterference; + // + BOPTools_CArray1OfVVInterference& aVVs=myIntrPool->VVInterferences(); + // + // BlockLength correction + aNbVVs=ExpectedPoolLength(); + aBlockLength=aVVs.BlockLength(); + if (aNbVVs > aBlockLength) { + aVVs.SetBlockLength(aNbVVs); + } + // + // V/V BooleanOperations_VertexVertex + myDSIt.Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, bJustAddInterference); + // + if (!myIntrPool->IsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; + aWith=n2; + SortTypes(aWhat, aWith); + if (!bJustAddInterference) { + const TopoDS_Shape& aS1=myDS->GetShape(aWhat); + const TopoDS_Shape& aS2=myDS->GetShape(aWith); + // + const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1); + const TopoDS_Vertex& aV2=TopoDS::Vertex(aS2); + aFlag=IntTools_Tools::ComputeVV (aV1, aV2); + // + if (!aFlag) { + BOPTools_VVInterference anInterf (aWhat, aWith); + anIndexIn=aVVs.Append(anInterf); + } + } + myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexVertex, anIndexIn); + } + } + myIsDone=Standard_True; +} +//======================================================================= +// function: PerformNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformNewVertices() +{ + myIsDone=Standard_False; + // + Standard_Integer i, aNb, anIndex1, anIndex2, aNewShape; + TopoDS_Vertex aNewVertex; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + Standard_Integer aNbChains, j, aNbV, aIdV, aNbL; + TColStd_IndexedMapOfInteger aMapWhole; + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapChains;//aMCV + TopTools_ListOfShape aLV; + TopTools_IndexedMapOfShape aM; + // + // 1. VV Interferences + BOPTools_CArray1OfVVInterference& VVs=myIntrPool->VVInterferences(); + // + NMTTools_Tools::FindChains(VVs, aMapChains); + // + aNbChains=aMapChains.Extent(); + for (i=1; i<=aNbChains; ++i) { + const TColStd_IndexedMapOfInteger& aChain=aMapChains(i); + // + aM.Clear(); + aLV.Clear(); + aNbV=aChain.Extent(); + for (j=1; j<=aNbV; ++j) { + aIdV=aChain(j); + const TopoDS_Shape& aV=myDS->Shape(aIdV); + if (!aM.Contains(aV)) { + aM.Add(aV); + aLV.Append(aV); + } + } + // + aNbL=aLV.Extent(); + if (aNbL==1){ + aNewShape=aChain(1); + } + else if (aNbL>1) { + // + // Make new Vertex + NMTTools_Tools::MakeNewVertex(aLV, aNewVertex); + // Insert New Vertex in DS; + // aNewShape is # of DS-line, where aNewVertex is kept + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + // + // State of New Vertex is ON + myDS->SetState (aNewShape, BooleanOperations_ON); + } + // + // Insert New Vertex in Interference + aNb=VVs.Extent(); + for (j=1; j<=aNb; ++j) { + BOPTools_VVInterference& VV=VVs(j); + anIndex1=VV.Index1(); + anIndex2=VV.Index2(); + if (aChain.Contains(anIndex1) || aChain.Contains(anIndex2)) { + VV.SetNewShape(aNewShape); + } + } + } + myIsDone=Standard_True; +} + +//======================================================================= +// function: FindSDVertex +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::FindSDVertex(const Standard_Integer nV)const +{ + Standard_Integer i, aNb, anIndex1, anIndex2, aNewShape=0; + + BOPTools_CArray1OfVVInterference& VVs=myIntrPool->VVInterferences(); + aNb=VVs.Extent(); + + for (i=1; i<=aNb; i++) { + const BOPTools_VVInterference& VV=VVs(i); + anIndex1=VV.Index1(); + anIndex2=VV.Index2(); + if (nV==anIndex1 || nV==anIndex2) { + aNewShape=VV.NewShape(); + return aNewShape; + } + } + return aNewShape; +} diff --git a/src/NMTTools/NMTTools_PaveFiller_2.cxx b/src/NMTTools/NMTTools_PaveFiller_2.cxx new file mode 100644 index 000000000..33ea053d8 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_2.cxx @@ -0,0 +1,230 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_2.cxx +// Created: Mon Dec 8 12:02:56 2003 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +// +#include +#include + +//======================================================================= +// function: PrepareEdges +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PrepareEdges() +{ + Standard_Integer i, nV, ii, aNBSuc, ip, aNbShapesObject; + Standard_Real aT; + TopAbs_Orientation anOr; + TopoDS_Edge aE; + TopoDS_Vertex aV; + // + aNbShapesObject=myDS->NumberOfShapesOfTheObject(); + for (i=1; i<=myNbSources; ++i) { + if (myDS->GetShapeType(i)==TopAbs_EDGE) { + aE=TopoDS::Edge(myDS->Shape(i)); + // + if (BRep_Tool::Degenerated(aE)){ + continue; + } + // + BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(i)); + // + // A <- + aNBSuc=myDS->NumberOfSuccessors(i); + for (ii=1; ii <=aNBSuc; ii++) { + nV=myDS->GetSuccessor(i, ii); + anOr=myDS->GetOrientation(i, ii); + aV=TopoDS::Vertex(myDS->Shape(nV)); + aV.Orientation(anOr); + aT=BRep_Tool::Parameter(aV, aE); + // + ip=FindSDVertex(nV); + if (ip) { + aV=TopoDS::Vertex(myDS->Shape(ip)); + aV.Orientation(anOr);// XX ? if the edge is closed it'll be amazing result + nV=ip; + } + // + BOPTools_Pave aPave(nV, aT); + aPaveSet.Append (aPave); + } + } + } +} +//======================================================================= +// function: PerformVE +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformVE() +{ + myIsDone=Standard_False; + // + Standard_Boolean bJustAddInterference; + Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVEs, aBlockLength, iSDV, nV1; + Standard_Real aT; + TopoDS_Vertex aV1; + TopoDS_Edge aE2; + BOPTools_IndexedMapOfCoupleOfInteger aSnareMap; + BOPTools_CoupleOfInteger aCouple; + // + BOPTools_CArray1OfVEInterference& aVEs=myIntrPool->VEInterferences(); + // + myDSIt.Initialize (TopAbs_VERTEX, TopAbs_EDGE); + // + // BlockLength correction + aNbVEs=ExpectedPoolLength(); + aBlockLength=aVEs.BlockLength(); + if (aNbVEs > aBlockLength) { + aVEs.SetBlockLength(aNbVEs); + } + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, bJustAddInterference); + // + if (! myIntrPool->IsComputed(n1, n2)) { + if (! IsSuccesstorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Edge + SortTypes(aWhat, aWith); + // + if(bJustAddInterference) { + myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + continue; + } + // Edge + aE2=TopoDS::Edge(myDS->Shape(aWith)); + // + if (BRep_Tool::Degenerated(aE2)){ + continue; + } + // Vertex + nV1=aWhat; + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + // + iSDV=FindSDVertex(aWhat); + if (iSDV) { + nV1=iSDV; + aV1=TopoDS::Vertex(myDS->Shape(nV1)); + } + // + aFlag=myContext.ComputeVE (aV1, aE2, aT); + // + if (!aFlag) { + // + // Add Interference to the Pool + BOPTools_VEInterference anInterf (aWhat, aWith, aT); + anIndexIn=aVEs.Append(anInterf); + // + // Add Pave to the Edge's myPavePool + aCouple.SetCouple(nV1, aWith); + if (!aSnareMap.Contains(aCouple)){ + aSnareMap.Add(aCouple); + // + BOPTools_Pave aPave(nV1, aT, BooleanOperations_VertexEdge); + aPave.SetInterference(anIndexIn); + BOPTools_PaveSet& aPaveSet= myPavePool(myDS->RefEdge(aWith)); + aPaveSet.Append(aPave); + } + // + // State for the Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VEInterference& aVE=aVEs(anIndexIn); + aVE.SetNewShape(aWhat); + } + myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexEdge, anIndexIn); + } + } + } + myIsDone=Standard_True; +} + +/* +// A +// + // cto900/M2 + // Some of Edges can be [Semi] Infinite. Such Edges have no + // vertices on correspondant INF ends. So we must provide + // these vertices formally (to obtain Shrunk Ranges for e.g). + // In reality this vertex(-es) does not belong to the INF Edge. + // It just has reference in the DS. + // PKV Tue Apr 23 10:21:45 2002 + { + Standard_Real aT1, aT2, aTolE; + Standard_Boolean bInf1, bInf2; + gp_Pnt aPx; + TopoDS_Vertex aVx; + BRep_Builder aBB; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + aTolE=BRep_Tool::Tolerance(aE); + Handle(Geom_Curve) aC3D=BRep_Tool::Curve (aE, aT1, aT2); + bInf1=Precision::IsNegativeInfinite(aT1); + bInf2=Precision::IsPositiveInfinite(aT2); + + if (bInf1) { + aC3D->D0(aT1, aPx); + aBB.MakeVertex(aVx, aPx, aTolE); + myDS->InsertShapeAndAncestorsSuccessors(aVx, anASSeq); + nV=myDS->NumberOfInsertedShapes(); + BOPTools_Pave aPave(nV, aT1); + aPaveSet.Append (aPave); + } + + if (bInf2) { + aC3D->D0(aT2, aPx); + aBB.MakeVertex(aVx, aPx, aTolE); + myDS->InsertShapeAndAncestorsSuccessors(aVx, anASSeq); + nV=myDS->NumberOfInsertedShapes(); + BOPTools_Pave aPave(nV, aT2); + aPaveSet.Append (aPave); + } + } +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_3.cxx b/src/NMTTools/NMTTools_PaveFiller_3.cxx new file mode 100644 index 000000000..989e6357c --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_3.cxx @@ -0,0 +1,107 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_3.cxx +// Created: Mon Dec 8 16:06:56 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +//======================================================================= +// function: PerformVF +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformVF() +{ + myIsDone=Standard_False; + // + Standard_Boolean aJustAddInterference; + Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV; + Standard_Real aU, aV; + TopoDS_Vertex aV1; + TopoDS_Face aF2; + // + BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences(); + // + // V/E Interferences + myDSIt.Initialize(TopAbs_VERTEX, TopAbs_FACE); + // + // BlockLength correction + aNbVSs=ExpectedPoolLength(); + aBlockLength=aVSs.BlockLength(); + if (aNbVSs > aBlockLength) { + aVSs.SetBlockLength(aNbVSs); + } + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, aJustAddInterference); + // + if (! myIntrPool->IsComputed(n1, n2)) { + if (! IsSuccesstorsComputed(n1, n2)) { + anIndexIn=0; + aWhat=n1; // Vertex + aWith=n2; // Face + SortTypes(aWhat, aWith); + // + iSDV=FindSDVertex(aWhat); + // + if(aJustAddInterference) { + myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + continue; + } + // + aV1=TopoDS::Vertex(myDS->Shape(aWhat)); + if (iSDV) { + aV1=TopoDS::Vertex(myDS->Shape(iSDV)); + } + // + aF2=TopoDS::Face(myDS->Shape(aWith)); + // + aFlag=myContext.ComputeVS (aV1, aF2, aU, aV); + // + if (!aFlag) { + // + // Add Interference to the Pool + BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV); + anIndexIn=aVSs.Append(anInterf); + // + // SetState for Vertex in DS; + myDS->SetState (aWhat, BooleanOperations_ON); + // Insert Vertex in Interference Object + BOPTools_VSInterference& aVS=aVSs(anIndexIn); + aVS.SetNewShape(aWhat); + } + myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn); + } + } + } + myIsDone=Standard_True; +} diff --git a/src/NMTTools/NMTTools_PaveFiller_4.cxx b/src/NMTTools/NMTTools_PaveFiller_4.cxx new file mode 100644 index 000000000..1db2e5a04 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_4.cxx @@ -0,0 +1,1095 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_4.cxx +// Created: Mon Dec 8 17:08:58 2003 +// Author: Peter KURNEV +// + + +#include +// +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +// +static + void VertexParameters(const IntTools_CommonPrt& aCPart, + Standard_Real& aT1, + Standard_Real& aT2); +static + Standard_Boolean IsOnPave(const Standard_Real& aT1, + const IntTools_Range& aRange, + const Standard_Real& aTolerance); +static + void ProcessBlock(const BOPTools_PaveBlock& aPB, + const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + BOPTools_IMapOfPaveBlock& aProcessedBlocks, + BOPTools_IMapOfPaveBlock& aChain); +static + void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + NMTTools_ListOfCommonBlock& aLCB); + +//======================================================================= +// function: PerformEE +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformEE() +{ + myIsDone=Standard_False; + // + Standard_Boolean bJustAdd; + Standard_Integer n1, n2, anIndexIn, nE1, nE2, aNbVEs, aBlockLength; + Standard_Integer aTmp, aWhat, aWith, i, aNbCPrts, aDiscretize=30; + Standard_Real aTolE1, aTolE2, aDeflection=0.01; + BOPTools_ListIteratorOfListOfPaveBlock anIt1, anIt2; + TopoDS_Edge aEWhat, aEWith; + TopoDS_Vertex aNewVertex; + BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; + BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + // BlockLength correction + aNbVEs=ExpectedPoolLength(); + aBlockLength=aEEs.BlockLength(); + if (aNbVEs > aBlockLength) { + aEEs.SetBlockLength(aNbVEs); + } + // + myDSIt.Initialize(TopAbs_EDGE, TopAbs_EDGE); + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, bJustAdd); + anIndexIn = 0; + // + if (myIntrPool->IsComputed(n1, n2)) { + continue; + } + // + nE1=n1; + nE2=n2; + SortTypes(nE1, nE2); + // + if(bJustAdd) { + myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); + continue; + } + // + const TopoDS_Edge& aE1=TopoDS::Edge(myDS->Shape(nE1)); + const TopoDS_Edge& aE2=TopoDS::Edge(myDS->Shape(nE2)); + // + if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){ + continue; + } + // + aTolE1=BRep_Tool::Tolerance(aE1); + aTolE2=BRep_Tool::Tolerance(aE2); + // + BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); + // + for (anIt1.Initialize(aLPB1); anIt1.More(); anIt1.Next()) { + BOPTools_PaveBlock& aPB1=anIt1.Value(); + const IntTools_ShrunkRange& aShrunkRange1=aPB1.ShrunkRange(); + // + const IntTools_Range& aSR1=aShrunkRange1.ShrunkRange(); + const Bnd_Box& aBB1=aShrunkRange1.BndBox(); + // + BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); + // + for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) { + BOPTools_PaveBlock& aPB2=anIt2.Value(); + const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange(); + + const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange(); + const Bnd_Box& aBB2=aShrunkRange2.BndBox(); + // + if (aBB1.IsOut (aBB2)) { + continue; + } + // + // EE + IntTools_EdgeEdge aEE; + aEE.SetEdge1 (aE1); + aEE.SetEdge2 (aE2); + aEE.SetTolerance1 (aTolE1); + aEE.SetTolerance2 (aTolE2); + aEE.SetDiscretize (aDiscretize); + aEE.SetDeflection (aDeflection); + // + IntTools_Range anewSR1 = aSR1; + IntTools_Range anewSR2 = aSR2; + // + BOPTools_Tools::CorrectRange (aE1, aE2, aSR1, anewSR1); + BOPTools_Tools::CorrectRange (aE2, aE1, aSR2, anewSR2); + // + aEE.SetRange1(anewSR1); + aEE.SetRange2(anewSR2); + + aEE.Perform(); + // + anIndexIn=0; + // + if (aEE.IsDone()) { + // reverse order if it is necessary + aEWhat=aE1; + aEWith=aE2; + aWhat=nE1; + aWith=nE2; + if (aEE.Order()) { + aTmp=aWhat; + aWhat=aWith; + aWith=aTmp; + aEWhat=aE2; + aEWith=aE1; + } + // + const IntTools_SequenceOfCommonPrts& aCPrts=aEE.CommonParts(); + aNbCPrts=aCPrts.Length(); + for (i=1; i<=aNbCPrts; i++) { + const IntTools_CommonPrt& aCPart=aCPrts(i); + const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2(); + // + anIndexIn=0; + // + TopAbs_ShapeEnum aType=aCPart.Type(); + switch (aType) { + case TopAbs_VERTEX: { + Standard_Real aT1, aT2, aTol=Precision::PConfusion(); + Standard_Boolean bIsOnPave1, bIsOnPave2; + IntTools_Range aR1, aR2; + // + VertexParameters(aCPart, aT1, aT2); + // + //decide to keep the pave or not + aR1 = (aEE.Order()) ? anewSR2 : anewSR1; + aR2 = (aEE.Order()) ? anewSR1 : anewSR2; + // + bIsOnPave1=IsOnPave(aT1, aR1, aTol); + bIsOnPave2=IsOnPave(aT2, aR2, aTol); + // + if(bIsOnPave1 || bIsOnPave2) { + myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + continue; + } + // + BOPTools_Tools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aNewVertex); + // + // Add Interference to the Pool + BOPTools_EEInterference anInterf (aWhat, aWith, aCPart); + // + anIndexIn=aEEs.Append(anInterf); + myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + // + // Collect + aMapVI.Add(aNewVertex, anIndexIn); + } + break; + + case TopAbs_EDGE: { + Standard_Integer aNbComPrt2; + Standard_Boolean aCoinsideFlag; + // + aNbComPrt2=aRanges2.Length(); + aCoinsideFlag=IsBlocksCoinside(aPB1, aPB2); + // + if (aNbComPrt2>1 || !aCoinsideFlag) { + myIntrPool->AddInterference (aWhat, aWith, BooleanOperations_EdgeEdge, anIndexIn); + break; + } + // + // Fill aMapCB + if (aMapCB.Contains(aPB1)) { + BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1); + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + } + else { + BOPTools_IMapOfPaveBlock aMapPB; + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + aMapCB.Add(aPB1, aMapPB); + } + // + if (aMapCB.Contains(aPB2)) { + BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2); + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + } + else { + BOPTools_IMapOfPaveBlock aMapPB; + aMapPB.Add(aPB1); + aMapPB.Add(aPB2); + aMapCB.Add(aPB2, aMapPB); + } + } + break; + default: + break; + } // switch (aType) + } // for (i=1; i<=aNbCPrts; i++) + }// if (aEE.IsDone()) + } // for (; anIt2.More(); anIt2.Next()) + } // for (; anIt1.More(); anIt1.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) + // + EENewVertices (aMapVI); + EECommonBlocks(aMapCB); + // + myIsDone=Standard_True; +} +//======================================================================= +// function:EECommonBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB) +{ + NMTTools_ListOfCommonBlock aLCB; + // + FindChains(aMapCB, aLCB); + ReplaceCommonBlocks(aLCB); +} +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer aNb, i, j, aNewShape, aNbEdges, aNbIEE, aNbVV, aNbSimple; + Standard_Integer aWhat, aWith, i1, i2, nE1, nE2, nE, nV, aFlag; + Standard_Real aT; + TopoDS_Compound aCompound; + BRep_Builder aBB; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEE; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + TopoDS_Vertex aNewVertex; + TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + aNb=aMapVI.Extent(); + // + if (!aNb) { // no new vertices, no new problems + return; + } + // + // 0. + if (aNb==1) { + aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); + EENewVertices(aNewVertex, aMapVI); + return; + } + // + // 1. Make compound from new vertices + aBB.MakeCompound(aCompound); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + aBB.Add(aCompound, aV); + } + // + // 2. VV intersection between these vertices + // using the auxiliary Filler + NMTDS_ShapesDataStructure tDS; + // + tDS.SetCompositeShape(aCompound); + tDS.Init(); + // + BOPTools_InterferencePool tInterfPool(tDS); + NMTTools_PaveFiller tPaveFiller(tInterfPool); + // + tPaveFiller.Init(); + // + tPaveFiller.PerformVV(); + tPaveFiller.PerformNewVertices(); + // + const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + // + // 3. Separate Comlex and Simple new vertices + aNbVV=aVVInterfs.Extent(); + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aVV.Indices(aWhat, aWith); + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + const TopoDS_Shape& aV2=tDS.Shape(aWith); + aMNVComplex.Add(aV1); + aMNVComplex.Add(aV2); + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + if (!aMNVComplex.Contains(aV)) { + aMNVSimple.Add(aV); + } + } + // + // 4. Treat Simple new Vertices + aNbSimple=aMNVSimple.Extent(); + for (i=1; i<=aNbSimple; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); + EENewVertices(aV, aMapVI); + } + // + // 3. Fill Maps : NewVertex-edges (aMNVE) + // NewVertex-interferences (aMNVIEE) + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aNewShape=aVV.NewShape(); + if (!aNewShape) { + continue; + } + // + if (!aMNVE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVE.Add(aNewShape, aMx); + } + if (!aMNVIEE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVIEE.Add(aNewShape, aMx); + } + // + TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); + TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.ChangeFromKey(aNewShape); + // + aVV.Indices(aWhat, aWith); + //aWhat + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + i1=aMapVI.FindFromKey(aV1); + const BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i1); + //aWith + const TopoDS_Shape& aV2=tDS.Shape(aWith); + i2=aMapVI.FindFromKey(aV2); + const BOPTools_EEInterference& aEE2=aEEs(i2); + aEE2.Indices(nE1, nE2); + aME.Add(nE1); + aME.Add(nE2); + aMIEE.Add(i2); + // + //printf(" VV: (%d, %d) -> %d\n", aWhat, aWith, aNewShape); + } + // + // 4. Process new vertices + aNb=aMNVE.Extent(); + for (i=1; i<=aNb; ++i) { // xx + // + // new Vertex + nV=aMNVE.FindKey(i); + aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // + // Update index of NewShape in EE interferences + const TColStd_IndexedMapOfInteger& aMIEE=aMNVIEE.FindFromKey(nV);//(i); + aNbIEE=aMIEE.Extent(); + for (j=1; j<=aNbIEE; ++j) { + i1=aMIEE(j); + BOPTools_EEInterference& aEE1=aEEs(i1); + aEE1.SetNewShape(aNewShape); + } + // + // Update Paves on edges + const TColStd_IndexedMapOfInteger& aME=aMNVE(i); + aNbEdges=aME.Extent(); + for (j=1; j<=aNbEdges; ++j) { + nE=aME(j); + const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE)); + // + aFlag=myContext.ComputeVE (aNewVertex, aE, aT); + // + if (!aFlag) { + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); + } + } + }// for (i=1; i<=aNb; ++i) {// xx +} +//======================================================================= +// function:EENewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer i, aNewShape, nE1, nE2; + Standard_Real aT1, aT2; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + BOPTools_Pave aPave; + // + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + // + // one new vertex case is treated in usual way + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // Insert New Vertex in EE Interference + i=aMapVI.FindFromKey(aNewVertex); + BOPTools_EEInterference& aEEInterf= aEEs(i); + aEEInterf.SetNewShape(aNewShape); + // Extact interference info + aEEInterf.Indices(nE1, nE2); + const IntTools_CommonPrt& aCPart=aEEInterf.CommonPrt(); + VertexParameters(aCPart, aT1, aT2); + // + // Add Paves to the myPavePoolNew + aPave.SetInterference(i); + aPave.SetType (BooleanOperations_EdgeEdge); + aPave.SetIndex(aNewShape); + // Pave for edge nE1 + aPave.SetParam(aT1); + BOPTools_PaveSet& aPaveSet1=myPavePoolNew(myDS->RefEdge(nE1)); + aPaveSet1.Append(aPave); + // Pave for edge nE2 + aPave.SetParam(aT2); + BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); + aPaveSet2.Append(aPave); +} +//======================================================================= +// function: RefinePavePool +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RefinePavePool() +{ + Standard_Integer i, aNbNew; + + for (i=1; i<=myNbSources; i++) { + + if ((myDS->GetShape(i)).ShapeType()==TopAbs_EDGE) { + BOPTools_PaveSet& aPS= myPavePool(myDS->RefEdge(i)); + // + BOPTools_PaveSet& aNewPS= myPavePoolNew(myDS->RefEdge(i)); + BOPTools_ListOfPave& aNewLP=aNewPS.ChangeSet(); + // + aNbNew=aNewLP.Extent(); + if (aNbNew) { + BOPTools_ListIteratorOfListOfPave anIt(aNewLP); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPave=anIt.Value(); + aPS.Append(aPave); + } + // Clear the ListOfPaveBlock + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(i)); + aLPB.Clear(); + // Prepare the paveBlocks for that egde again + PreparePaveBlocks(i); + } + aNewLP.Clear(); + } + } +} +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, + const TopAbs_ShapeEnum aType2) +{ + myIsDone=Standard_False; + // + Standard_Boolean Ok1, Ok2, Ok3; + Ok1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; + Ok2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; + Ok3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; + if (!Ok1 && !Ok2 && !Ok3) { + // error: Type mismatch + return; + } + // + Standard_Boolean aFlag = Standard_False; + Standard_Integer n1, n2, nE1, nE2, aNbSplits; + TColStd_MapOfInteger aMap; + // + myDSIt.Initialize(aType1, aType2); + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, aFlag); + nE1=n1; + nE2=n2; + SortTypes(nE1, nE2); + // + if (aType1==TopAbs_EDGE) { + BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); + aNbSplits=aLPB1.Extent(); + if (!aNbSplits) { + if (!aMap.Contains(nE1)) { + aMap.Add(nE1); + PreparePaveBlocks(nE1); + // + if (!myIsDone) { + return; + } + } + } + } + // + if (aType2==TopAbs_EDGE) { + BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); + aNbSplits=aLPB2.Extent(); + if (!aNbSplits) { + if (!aMap.Contains(nE2)) { + aMap.Add(nE2); + PreparePaveBlocks(nE2); + // + if (!myIsDone) { + return; + } + } + } + }// if (aType2==TopAbs_EDGE) + }// for (; myDSIt.More(); myDSIt.Next()) + + myIsDone=Standard_True; +} +//======================================================================= +// function: PreparePaveBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) +{ + myIsDone=Standard_False; + + Standard_Integer nV1, nV2; + + TopoDS_Edge aE; + TopoDS_Vertex aV1, aV2; + + // SplitShapesPool + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + // Edge + aE=TopoDS::Edge(myDS->Shape(nE)); + // + if (!BRep_Tool::Degenerated(aE)){ + // + BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); + + BOPTools_PaveBlockIterator aPBIt(nE, aPS); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + + const IntTools_Range& aRange=aPB.Range(); + + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + aV1=TopoDS::Vertex(myDS->GetShape(nV1)); + + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + aV2=TopoDS::Vertex(myDS->GetShape(nV2)); + // + // ShrunkRange + IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext); + // + Standard_Integer anErrorStatus; + anErrorStatus=aSR.ErrorStatus(); + + char buf[512]; + if (!aSR.IsDone()) { + sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); + throw + BOPTColStd_Failure(buf) ; + } + // + if (anErrorStatus==6) { + sprintf(buf, + "Warning: [PreparePaveBlocks()] Max.Dummy Shrunk Range for Edge %d\n", nE); + BOPTColStd_Dump::PrintMessage(buf); + } + else { + // Check left paves and correct ShrunkRange if it is necessary + CorrectShrunkRanges (0, aPave1, aSR); + CorrectShrunkRanges (1, aPave2, aSR); + } + // + aPB.SetShrunkRange(aSR); + aLPB.Append(aPB); + } //for (; aPBIt1.More(); aPBIt1.Next()) + } + myIsDone=Standard_True; +} +//======================================================================= +// function: CorrectShrunkRanges +// purpose: +//======================================================================= + void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide, + const BOPTools_Pave& aPave, + IntTools_ShrunkRange& aShrunkRange) +{ + BooleanOperations_KindOfInterference aType; + Standard_Integer anIndexInterf ; + // + aType=aPave.Type(); + if (aType!=BooleanOperations_EdgeEdge) { + return; + } + // + anIndexInterf=aPave.Interference(); + if (anIndexInterf<0) { + // it can be EE interf between E and (e1,e2,..en) -> vertex + // so we can't decide which aEE.CommonPrt() we should take. + return; + } + + BOPTools_CArray1OfEEInterference& aEEs=myIntrPool->EEInterferences(); + const BOPTools_EEInterference& aEE=aEEs(anIndexInterf); + const IntTools_CommonPrt& aCP=aEE.CommonPrt(); + const TopoDS_Edge& aE1=aCP.Edge1(); + const TopoDS_Edge& aE2=aCP.Edge2(); + + const IntTools_Range& aSR=aShrunkRange.ShrunkRange(); + const TopoDS_Edge& aE=aShrunkRange.Edge(); + + IntTools_Range aNewRange; + IntTools_Range aCPRange; + + if (aE1.IsSame(aE)) { + const IntTools_Range& aR1=aCP.Range1(); + aCPRange=aR1; + } + if (aE2.IsSame(aE)) { + const IntTools_SequenceOfRanges& aSeqR=aCP.Ranges2(); + const IntTools_Range& aR2=aSeqR(1); + aCPRange=aR2; + } + // + Standard_Real aCoeff=1.05, tV, tNV; + tV=aPave.Param(); + if (aSide==0) { // Left + if (aCPRange.Last() > aSR.First()) { + tNV=aCPRange.Last(); + tNV=tV+aCoeff*(tNV-tV); + aNewRange.SetFirst(tNV); + aNewRange.SetLast (aSR.Last()); + + if(aNewRange.First() > aNewRange.Last()) { + aShrunkRange.SetShrunkRange(aNewRange); + } + } + } + else { // Right + if (aCPRange.First() < aSR.Last()) { + tNV=aCPRange.First(); + tNV=tV-aCoeff*(tV-tNV); + aNewRange.SetFirst(aSR.First()); + aNewRange.SetLast (tNV); + + if(aNewRange.First() < aNewRange.Last()) { + aShrunkRange.SetShrunkRange(aNewRange); + } + } + } +} +//======================================================================= +// function: IsBlocksCoinside +// purpose: +//======================================================================= + Standard_Boolean + NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1, + const BOPTools_PaveBlock& aPB2) const +{ + Standard_Boolean bRetFlag=Standard_True; + Standard_Real aTolV11, aTolV12, aTolV21, aTolV22; + Standard_Real d1121, d1122, d1222, d1221, aTolSum, aCoeff=1.05; + gp_Pnt aP11, aP12, aP21, aP22; + + const TopoDS_Vertex& aV11=TopoDS::Vertex(myDS->Shape(aPB1.Pave1().Index())); + const TopoDS_Vertex& aV12=TopoDS::Vertex(myDS->Shape(aPB1.Pave2().Index())); + const TopoDS_Vertex& aV21=TopoDS::Vertex(myDS->Shape(aPB2.Pave1().Index())); + const TopoDS_Vertex& aV22=TopoDS::Vertex(myDS->Shape(aPB2.Pave2().Index())); + + aTolV11=BRep_Tool::Tolerance(aV11); + aTolV12=BRep_Tool::Tolerance(aV12); + aTolV21=BRep_Tool::Tolerance(aV21); + aTolV22=BRep_Tool::Tolerance(aV22); + + aP11=BRep_Tool::Pnt(aV11); + aP12=BRep_Tool::Pnt(aV12); + aP21=BRep_Tool::Pnt(aV21); + aP22=BRep_Tool::Pnt(aV22); + + d1121=aP11.Distance(aP21); + aTolSum=aCoeff*(aTolV11+aTolV21); + if (d1121RefEdge(nE)); + aLCBE.Append(aCBx); + } + } + } +} +//======================================================================= +// function: RemoveCommonBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) +{ + Standard_Integer nE; + NMTTools_ListOfCommonBlock aLCBx; + NMTTools_ListIteratorOfListOfCommonBlock anItCB, anItCBE; + BOPTools_ListIteratorOfListOfPaveBlock anItLPB; + // + anItCB.Initialize(aLCB); + for (; anItCB.More(); anItCB.Next()) { + const NMTTools_CommonBlock& aCB=anItCB.Value(); + const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); + // + // Remove aCB from each edge + anItLPB.Initialize(aLPB); + for (; anItLPB.More(); anItLPB.Next()) { + const BOPTools_PaveBlock& aPB=anItLPB.Value(); + nE=aPB.OriginalEdge(); + // + NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); + anItCBE.Initialize(aLCBE); + for (; anItCBE.More(); anItCBE.Next()) { + const NMTTools_CommonBlock& aCBE=anItCBE.Value(); + if (aCBE.IsEqual(aCB)) { + aLCBE.Remove(anItCBE); + break; + } + } + } + } +} +//======================================================================= +// function: SplitCommonBlock +// purpose: +//======================================================================= + void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB, + NMTTools_ListOfCommonBlock& aLCBx) +{ + Standard_Integer i, j, k, nE, aNbE, aNbSPBx, aNbPB; + BOPTools_SequenceOfPaveBlock aSPBx; + BOPTools_ListIteratorOfListOfPaveBlock anItLPB; + BOPTools_ListIteratorOfListOfPave anIt; + + BOPTools_PaveBlockIterator anPBIt; + // + const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); + aNbE=aLPB.Extent(); + // + // 1. Whether we realy need to split the common block ? + anItLPB.Initialize(aLPB); + for (; anItLPB.More(); anItLPB.Next()) { + const BOPTools_PaveBlock& aPB=anItLPB.Value(); + nE=aPB.OriginalEdge(); + BOPTools_PaveSet& aPSE=myPavePoolNew(myDS->RefEdge(nE)); + aPSE.SortSet(); + // + BOPTools_PaveSet aPSx; + // + const BOPTools_ListOfPave& aLPE=aPSE.Set(); + anIt.Initialize(aLPE); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPx=anIt.Value(); + if (aPB.IsInBlock(aPx)) { + aPSx.Append(aPx); + } + } + aNbPB=aPSx.Set().Extent(); + break; + } + // + if (!aNbPB) { + // we need not split it + aLCBx.Append(aCB); + return; + } + // + // 2. Get sequence of pave Blocks containing all new pave blocks + // for each edges's source pave Block + anItLPB.Initialize(aLPB); + for (; anItLPB.More(); anItLPB.Next()) { + const BOPTools_PaveBlock& aPB=anItLPB.Value(); + const BOPTools_Pave& aPave1=aPB.Pave1(); + const BOPTools_Pave& aPave2=aPB.Pave2(); + nE=aPB.OriginalEdge(); + // + BOPTools_PaveSet aPSx; + // + // the set aPsx will contain bounadry paves aPave1, aPave2 and + // all paves of the edge nE that are inside block aPB + aPSx.Append(aPave1); + aPSx.Append(aPave2); + // + BOPTools_PaveSet& aPSE=myPavePoolNew(myDS->RefEdge(nE)); + aPSE.SortSet(); + // + const BOPTools_ListOfPave& aLPE=aPSE.Set(); + anIt.Initialize(aLPE); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPx=anIt.Value(); + if (aPB.IsInBlock(aPx)) { + aPSx.Append(aPx); + } + } + // + // Form pave blocks from aPSx and collect them in aSPBx + anPBIt.Initialize(nE, aPSx); + for (; anPBIt.More(); anPBIt.Next()) { + const BOPTools_PaveBlock& aPBx=anPBIt.Value(); + aSPBx.Append(aPBx); + } + } + // + // 3. Do new common blocks + // + const TColStd_ListOfInteger& aLF=aCB.Faces(); + aNbSPBx=aSPBx.Length(); + aNbPB=aNbSPBx/aNbE; + // + for (i=1; i<=aNbPB; ++i) { + NMTTools_CommonBlock aCBx; + // + aCBx.AddFaces(aLF); + // + for (j=1; j<=aNbE; ++j) { + k=i+(j-1)*aNbPB; + const BOPTools_PaveBlock& aPB=aSPBx(k); + aCBx.AddPaveBlock(aPB); + } + aLCBx.Append(aCBx); + } +} + +//======================================================================= +// function: VertexParameters +// purpose: +//======================================================================= +void VertexParameters(const IntTools_CommonPrt& aCPart, + Standard_Real& aT1, + Standard_Real& aT2) +{ + const IntTools_Range& aR1=aCPart.Range1(); + aT1=0.5*(aR1.First()+aR1.Last()); + // + if((aCPart.VertexParameter1() >= aR1.First()) && + (aCPart.VertexParameter1() <= aR1.Last())) { + aT1 = aCPart.VertexParameter1(); + } + // + const IntTools_SequenceOfRanges& aRanges2=aCPart.Ranges2(); + const IntTools_Range& aR2=aRanges2(1); + aT2=0.5*(aR2.First()+aR2.Last()); + // + if((aCPart.VertexParameter2() >= aR2.First()) && + (aCPart.VertexParameter2() <= aR2.Last())) { + aT2 = aCPart.VertexParameter2(); + } +} +//======================================================================= +// function: KeepPave +// purpose: +//======================================================================= +Standard_Boolean IsOnPave(const Standard_Real& aT1, + const IntTools_Range& aRange, + const Standard_Real& aTolerance) +{ + Standard_Boolean firstisonpave1, firstisonpave2, bIsOnPave; + // + firstisonpave1 = (Abs(aRange.First() - aT1) < aTolerance); + firstisonpave2 = (Abs(aRange.Last() - aT1) < aTolerance); + bIsOnPave=(firstisonpave1 || firstisonpave2); + return bIsOnPave; +} + +//======================================================================= +// function:FindChains +// purpose: +//======================================================================= +void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + NMTTools_ListOfCommonBlock& aLCB) +{ + Standard_Integer i, j, aNbCB, aNbPB; + BOPTools_IMapOfPaveBlock aProcessedBlocks, aChain; + // + aNbCB=aMapCB.Extent(); + for (i=1; i<=aNbCB; ++i) { + const BOPTools_PaveBlock& aPB=aMapCB.FindKey(i); + if (aProcessedBlocks.Contains(aPB)) { + continue; + } + // + aProcessedBlocks.Add(aPB); + aChain.Add(aPB); + // + const BOPTools_IMapOfPaveBlock& aMapPB=aMapCB(i); + aNbPB=aMapPB.Extent(); + for (j=1; j<=aNbPB; ++j) { + const BOPTools_PaveBlock& aPBx=aMapPB(j); + ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain); + } + // + NMTTools_CommonBlock aCB; + // + aNbPB=aChain.Extent(); + for (j=1; j<=aNbPB; ++j) { + const BOPTools_PaveBlock& aPBx=aChain(j); + aCB.AddPaveBlock(aPBx); + } + aLCB.Append(aCB); + aChain.Clear(); + } +} +//======================================================================= +// function:ProcessBlock +// purpose: +//======================================================================= +void ProcessBlock(const BOPTools_PaveBlock& aPB, + const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, + BOPTools_IMapOfPaveBlock& aProcessedBlocks, + BOPTools_IMapOfPaveBlock& aChain) +{ + Standard_Integer j, aNbPB; + // + if (aProcessedBlocks.Contains(aPB)) { + return; + } + aProcessedBlocks.Add(aPB); + aChain.Add(aPB); + // + const BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.FindFromKey(aPB); + aNbPB=aMapPB.Extent(); + for (j=1; j<=aNbPB; ++j) { + const BOPTools_PaveBlock& aPBx=aMapPB(j); + ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain); + } +} diff --git a/src/NMTTools/NMTTools_PaveFiller_5.cxx b/src/NMTTools/NMTTools_PaveFiller_5.cxx new file mode 100644 index 000000000..fae995ed9 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_5.cxx @@ -0,0 +1,624 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_5.cxx +// Created: Mon Dec 15 11:28:33 2003 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +static + void VertexParameter(const IntTools_CommonPrt& aCPart, + Standard_Real& aT); +static + Standard_Boolean IsOnPave(const Standard_Real& aTR, + const IntTools_Range& aCPRange, + const Standard_Real& aTolerance); + +//======================================================================= +// function: PerformEF +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformEF() +{ + myIsDone=Standard_False; + + Standard_Integer n1, n2, anIndexIn=0, nE, nF, aNbEFs, aBlockLength; + Standard_Boolean bJustAdd; + Standard_Real aTolE, aTolF, aDeflection=0.01; + Standard_Integer aDiscretize=35; + BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; + BOPTools_IDMapOfPaveBlockIMapOfInteger aMapCB; + BOPTools_IMapOfPaveBlock aIMPBx; + + // + BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + // + myDSIt.Initialize(TopAbs_EDGE, TopAbs_FACE); + // + // BlockLength correction + aNbEFs=ExpectedPoolLength(); + aBlockLength=aEFs.BlockLength(); + if (aNbEFs > aBlockLength) { + aEFs.SetBlockLength(aNbEFs); + } + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, bJustAdd); + anIndexIn = 0; + // + if (myIntrPool->IsComputed(n1, n2)) { + continue; + } + // + nE=n1; + nF=n2; + SortTypes(nE, nF); + // + // all Common Blocks for face nF + //XXX + NMTTools_ListOfCommonBlock aLCBF; + CommonBlocksFace(nF, aLCBF); + NMTTools_CommonBlockAPI aCBAPIF(aLCBF); + //XXX + if(bJustAdd) { + myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + continue; + } + // Edge + const TopoDS_Edge& aE=TopoDS::Edge(myDS->GetShape(nE)); + if (BRep_Tool::Degenerated(aE)){ + continue; + } + aTolE=BRep_Tool::Tolerance(aE); + // Face + const TopoDS_Face& aF=TopoDS::Face(myDS->GetShape(nF)); + aTolF=BRep_Tool::Tolerance(aF); + const Bnd_Box& aBBF=myDS->GetBoundingBox(nF); + // + // Process each PaveBlock on edge nE + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + // + BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB); + for (; anIt.More(); anIt.Next()) { + BOPTools_PaveBlock& aPB=anIt.Value(); + //XXX + if (aCBAPIF.IsCommonBlock(aPB)) { + continue; + } + //XXX + const IntTools_ShrunkRange& aShrunkRange=aPB.ShrunkRange(); + const IntTools_Range& aSR =aShrunkRange.ShrunkRange(); + const Bnd_Box& aBBE=aShrunkRange.BndBox(); + // + if (aBBF.IsOut (aBBE)) { + continue; + } + // + // EF + IntTools_EdgeFace aEF; + aEF.SetEdge (aE); + aEF.SetFace (aF); + aEF.SetTolE (aTolE); + aEF.SetTolF (aTolF); + aEF.SetDiscretize (aDiscretize); + aEF.SetDeflection (aDeflection); + // + aEF.SetContext((IntTools_PContext)&myContext); + // + IntTools_Range anewSR = aSR; + // + // Correction of the Shrunk Range + BOPTools_Tools::CorrectRange(aE, aF, aSR, anewSR); + aEF.SetRange (anewSR); + // + aEF.Perform(); + // + if (aEF.IsDone()) { + const IntTools_SequenceOfCommonPrts& aCPrts=aEF.CommonParts(); + Standard_Integer i, aNbCPrts; + aNbCPrts=aCPrts.Length(); + for (i=1; i<=aNbCPrts; i++) { + // + anIndexIn=0; + // + const IntTools_CommonPrt& aCPart=aCPrts(i); + TopAbs_ShapeEnum aType=aCPart.Type(); + switch (aType) { + + case TopAbs_VERTEX: { + Standard_Boolean bIsOnPave1, bIsOnPave2; + Standard_Integer nVF; + Standard_Real aT, aTolToDecide; + TopoDS_Vertex aNewVertex; + // + const IntTools_Range& aR=aCPart.Range1(); + // + // New Vertex + VertexParameter(aCPart, aT); + BOPTools_Tools::MakeNewVertex(aE, aT, aF, aNewVertex); + // + //decide to add pave or not + aTolToDecide=5.e-8; + // + bIsOnPave1=IsOnPave(anewSR.First(), aR, aTolToDecide); + bIsOnPave2=IsOnPave(anewSR.Last() , aR, aTolToDecide); + // + if (!bIsOnPave1 && !bIsOnPave2) { + nVF=CheckFacePaves(aNewVertex, nF); + if (!nVF) { + // really new vertex + // Add Interference to the Pool + BOPTools_ESInterference anInterf (nE, nF, aCPart); + anIndexIn=aEFs.Append(anInterf); + anInterf.SetNewShape(0); + // + aMapVI.Add(aNewVertex, anIndexIn); + aIMPBx.Add(aPB); + // + }// if (!nVF) + }// if (!bIsOnPave1 && !bIsOnPave2) + myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + }// case TopAbs_VERTEX: + break; + // + case TopAbs_EDGE: { + Standard_Boolean aCoinsideFlag; + // + aCoinsideFlag=BOPTools_Tools::IsBlockInOnFace(aPB, aF, myContext); + if (!aCoinsideFlag) { + myIntrPool->AddInterference (nE, nF, BooleanOperations_EdgeSurface, anIndexIn); + break; + } + // + // Fill aMapCB + if (aMapCB.Contains(aPB)) { + TColStd_IndexedMapOfInteger& aMapF=aMapCB.ChangeFromKey(aPB); + aMapF.Add(nF); + } + else { + TColStd_IndexedMapOfInteger aMapF; + aMapF.Add(nF); + aMapCB.Add(aPB, aMapF); + } + //modified by NIZNHY-PKV Fri Jan 23 14:13:08 2004 f + aIMPBx.Add(aPB); + //modified by NIZNHY-PKV Fri Jan 23 14:13:10 2004 t + }// case TopAbs_EDGE: + break; + + default: + break; + } // switch (aType) + } // for (i=1; i<=aNbCPrts; i++) + } //if (aEF.IsDone()) + } // for (; anIt.More(); anIt.Next()) + }// for (; myDSIt.More(); myDSIt.Next()) + // + // Treat New vertices + EFNewVertices(aMapVI); + // + // Add draft Common Blocks of EF type + EFCommonBlocks(aMapCB); + // + // Collect all CB we suspected to split by new vertices + NMTTools_ListOfCommonBlock aLCBx; + { + Standard_Integer i, aNbPBx, nEx; + BOPTools_IMapOfPaveBlock aMx; + // + aNbPBx=aIMPBx.Extent(); + for (i=1; i<=aNbPBx; ++i) { + const BOPTools_PaveBlock& aPBx=aIMPBx(i); + nEx=aPBx.OriginalEdge(); + NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nEx)); + if (aLCB.Extent()) { + NMTTools_CommonBlockAPI aCBAPIx(aLCB); + if (aCBAPIx.IsCommonBlock(aPBx)) { + NMTTools_CommonBlock& aCBx=aCBAPIx.CommonBlock(aPBx); + const BOPTools_PaveBlock& aPB1=aCBx.PaveBlock1(); + if (!aMx.Contains(aPB1)){ + aMx.Add(aPB1); + aLCBx.Append(aCBx); + } + } + } + } + } + // + // Split the common blocks above + if (aLCBx.Extent()) { + ReplaceCommonBlocks(aLCBx); + } + // + myIsDone=Standard_True; +} +//======================================================================= +// function:EFCommonBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EFCommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfInteger& aMapCB) +{ + Standard_Integer i, aNbPB, nE, j, aNbF, nF; + // + aNbPB=aMapCB.Extent(); + // + for (i=1; i<=aNbPB; ++i) { + const BOPTools_PaveBlock& aPB=aMapCB.FindKey(i); + const TColStd_IndexedMapOfInteger& aMapF=aMapCB.FindFromIndex(i); + aNbF=aMapF.Extent(); + // + nE=aPB.OriginalEdge(); + // + NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE)); + // + NMTTools_CommonBlockAPI aCBAPI(aLCB); + if (aCBAPI.IsCommonBlock(aPB)) { + NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); + for (j=1; j<=aNbF; ++j) { + nF=aMapF(j); + aCB.AddFace(nF); + } + } + else { + NMTTools_CommonBlock aCB; + // + aCB.AddPaveBlock(aPB); + for (j=1; j<=aNbF; ++j) { + nF=aMapF(j); + aCB.AddFace(nF); + } + aLCB.Append(aCB); + } + } +} +//======================================================================= +// function:EFNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EFNewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer i, j, aNb, aNewShape, aFlag, iX, aNbVV, aNbSimple; + Standard_Integer aWhat, aWith, nE, nF, nV, aNbIEF, aNbEdges; + Standard_Real aT; + TopoDS_Compound aCompound; + TopoDS_Vertex aNewVertex; + BRep_Builder aBB; + BOPTools_Pave aPave; + NMTTools_IndexedDataMapOfIndexedMapOfInteger aMNVE, aMNVIEF; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + TopTools_IndexedMapOfShape aMNVComplex, aMNVSimple; + // + BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + // + aNb=aMapVI.Extent(); + // + if (!aNb) { // no new vertices, no new problems + return; + } + // + // 0. + if (aNb==1) { + aNewVertex=TopoDS::Vertex(aMapVI.FindKey(1)); + EFNewVertices(aNewVertex, aMapVI); + return; + } + // + // 1. Make compound from new vertices + aBB.MakeCompound(aCompound); + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + aBB.Add(aCompound, aV); + } + // + // 2. VV intersection between these vertices + // using the auxiliary Filler + NMTDS_ShapesDataStructure tDS; + // + tDS.SetCompositeShape(aCompound); + tDS.Init(); + // + BOPTools_InterferencePool tInterfPool(tDS); + NMTTools_PaveFiller tPaveFiller(tInterfPool); + // + tPaveFiller.Init(); + // + tPaveFiller.PerformVV(); + tPaveFiller.PerformNewVertices(); + // + const BOPTools_CArray1OfVVInterference& aVVInterfs=tInterfPool.VVInterfs(); + // + // 3. Separate Comlex and Simple new vertices + aNbVV=aVVInterfs.Extent(); + for (i=1; i<=aNbVV; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aVV.Indices(aWhat, aWith); + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + const TopoDS_Shape& aV2=tDS.Shape(aWith); + aMNVComplex.Add(aV1); + aMNVComplex.Add(aV2); + } + // + for (i=1; i<=aNb; ++i) { + const TopoDS_Shape& aV=aMapVI.FindKey(i); + if (!aMNVComplex.Contains(aV)) { + aMNVSimple.Add(aV); + } + } + // + // 4. Treat Simple new Vertices + aNbSimple=aMNVSimple.Extent(); + for (i=1; i<=aNbSimple; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMNVSimple(i)); + EFNewVertices(aV, aMapVI); + } + // + // 3. Fill Maps : NewVertex-edges (aMNVE) + // NewVertex-interferences (aMNVIEE) + aNb=aVVInterfs.Extent(); + for (i=1; i<=aNb; ++i) { + const BOPTools_VVInterference& aVV=aVVInterfs(i); + aNewShape=aVV.NewShape(); + if (!aNewShape) { + continue; + } + // + if (!aMNVE.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVE.Add(aNewShape, aMx); + } + if (!aMNVIEF.Contains(aNewShape)) { + TColStd_IndexedMapOfInteger aMx; + aMNVIEF.Add(aNewShape, aMx); + } + // + TColStd_IndexedMapOfInteger& aME=aMNVE.ChangeFromKey(aNewShape); + TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.ChangeFromKey(aNewShape); + // + aVV.Indices(aWhat, aWith); + //aWhat + const TopoDS_Shape& aV1=tDS.Shape(aWhat); + iX=aMapVI.FindFromKey(aV1); + const BOPTools_ESInterference& aEF1=aEFs(iX); + aEF1.Indices(nE, nF); + SortTypes(nE, nF); + aME.Add(nE); + aMIEF.Add(iX); + //aWith + const TopoDS_Shape& aV2=tDS.Shape(aWith); + iX=aMapVI.FindFromKey(aV2); + const BOPTools_ESInterference& aEF2=aEFs(iX); + aEF2.Indices(nE, nF); + SortTypes(nE, nF); + aME.Add(nE); + aMIEF.Add(iX); + } + // 4. Process new vertices + aNb=aMNVE.Extent(); + for (i=1; i<=aNb; ++i) { // xx + // + // new Vertex + nV=aMNVE.FindKey(i); + aNewVertex=TopoDS::Vertex(tDS.Shape(nV)); + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // + // Update index of NewShape in EF interferences + const TColStd_IndexedMapOfInteger& aMIEF=aMNVIEF.FindFromKey(nV); + aNbIEF=aMIEF.Extent(); + for (j=1; j<=aNbIEF; ++j) { + iX=aMIEF(j); + BOPTools_ESInterference& aEF=aEFs(iX); + aEF.SetNewShape(aNewShape); + } + // + // Update Paves on all edges + const TColStd_IndexedMapOfInteger& aME=aMNVE(i); + aNbEdges=aME.Extent(); + for (j=1; j<=aNbEdges; ++j) { + nE=aME(j); + const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE)); + // + aFlag=myContext.ComputeVE (aNewVertex, aE, aT); + // + if (!aFlag) { + aPave.SetInterference(-1); + aPave.SetType (BooleanOperations_EdgeSurface); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); + } + } + } +} +//======================================================================= +// function:EFNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::EFNewVertices (const TopoDS_Vertex& aNewVertex, + const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) +{ + Standard_Integer i, aNewShape, nE, nF; + Standard_Real aT; + BOPTools_Pave aPave; + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + BOPTools_CArray1OfESInterference& aEFs=myIntrPool->ESInterferences(); + // + // Insert New Vertex in DS; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + aNewShape=myDS->NumberOfInsertedShapes(); + myDS->SetState (aNewShape, BooleanOperations_ON); + // Insert New Vertex in EFInterference + i=aMapVI.FindFromKey(aNewVertex); + BOPTools_ESInterference& aEFInterf= aEFs(i); + aEFInterf.SetNewShape(aNewShape); + // Extract interference info + aEFInterf.Indices(nE, nF); + SortTypes(nE, nF); + const IntTools_CommonPrt& aCPart=aEFInterf.CommonPrt(); + VertexParameter(aCPart, aT); + // + // Pave for edge nE + aPave.SetInterference(i); + aPave.SetType (BooleanOperations_EdgeSurface); + aPave.SetIndex(aNewShape); + aPave.SetParam(aT); + // Append the Pave to the myPavePoolNew + BOPTools_PaveSet& aPaveSet=myPavePoolNew(myDS->RefEdge(nE)); + aPaveSet.Append(aPave); + // +} +//======================================================================= +// function: CheckFacePaves +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aNewVertex, + const Standard_Integer nF) +{ + Standard_Integer nEF, nVF, iFlag, i, aNbV; + BOPTools_ListIteratorOfListOfPave anIt; + TColStd_IndexedMapOfInteger aMVF; + // + BooleanOperations_OnceExplorer aExp(*myDS); + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nEF=aExp.Current(); + BOPTools_PaveSet& aPaveSet=myPavePool(myDS->RefEdge(nEF)); + const BOPTools_ListOfPave& aLP=aPaveSet.Set(); + anIt.Initialize(aLP); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPave=anIt.Value(); + nVF=aPave.Index(); + aMVF.Add(nVF); + } + } + // + aNbV=aMVF.Extent(); + for (i=1; i<=aNbV; ++i) { + nVF=aMVF(i); + const TopoDS_Vertex& aVF=TopoDS::Vertex(myDS->Shape(nVF)); + iFlag=IntTools_Tools::ComputeVV(aNewVertex, aVF); + if (!iFlag) { + return nVF; + } + } + return 0; +} + +// +//======================================================================= +// function: VertexParameter +// purpose: +//======================================================================= +void VertexParameter(const IntTools_CommonPrt& aCPart, + Standard_Real& aT) +{ + const IntTools_Range& aR=aCPart.Range1(); + aT=0.5*(aR.First()+aR.Last()); + // + if((aCPart.VertexParameter1() >= aR.First()) && + (aCPart.VertexParameter1() <= aR.Last())) { + aT = aCPart.VertexParameter1(); + } +} +//======================================================================= +// function: IsOnPave +// purpose: +//======================================================================= +Standard_Boolean IsOnPave(const Standard_Real& aTR, + const IntTools_Range& aCPRange, + const Standard_Real& aTolerance) +{ + Standard_Boolean bIsOnPave; + Standard_Real aT1, aT2, dT1, dT2; + // + aT1=aCPRange.First(); + aT2=aCPRange.Last(); + bIsOnPave=(aTR>=aT1 && aTR<=aT1); + if (bIsOnPave) { + return bIsOnPave; + } + dT1=Abs(aTR-aT1); + dT2=Abs(aTR-aT2); + bIsOnPave=(dT1<=aTolerance || dT2<=aTolerance); + return bIsOnPave; +} diff --git a/src/NMTTools/NMTTools_PaveFiller_6.cxx b/src/NMTTools/NMTTools_PaveFiller_6.cxx new file mode 100644 index 000000000..e9bae0c1a --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_6.cxx @@ -0,0 +1,1220 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_6.cxx +// Created: Fri Dec 19 10:27:31 2003 +// Author: Peter KURNEV +// + +#include + +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static + Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith); + +static + void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat); +static + void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith); +static + Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith); + + +//======================================================================= +// function: PerformFF +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformFF() +{ + myIsDone=Standard_False; + // + Standard_Boolean bIsFound, bJustAdd, bIsComputed; + Standard_Integer n1, n2, anIndexIn, nF1, nF2, aBlockLength, aNbFFs; + Standard_Boolean bToApproxC3d, bToApproxC2dOnS1, bToApproxC2dOnS2, bIsDone; + Standard_Integer aNbCurves, aNbPoints; + Standard_Real anApproxTol, aTolR3D, aTolR2D; + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapWhat, aMapWith; + IntTools_SequenceOfPntOn2Faces aPnts; + IntTools_SequenceOfCurves aCvs; + BooleanOperations_KindOfInterference aTypeFF=BooleanOperations_SurfaceSurface; + // + BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + // + // F/F Interferences [BooleanOperations_SurfaceSurface] + myDSIt.Initialize(TopAbs_FACE, TopAbs_FACE); + // + // BlockLength correction + aNbFFs=ExpectedPoolLength(); + aBlockLength=aFFs.BlockLength(); + if (aNbFFs > aBlockLength) { + aFFs.SetBlockLength(aNbFFs); + } + // + for (; myDSIt.More(); myDSIt.Next()) { + myDSIt.Current(n1, n2, bJustAdd); + // + bIsComputed=myIntrPool->IsComputed(n1, n2); + if (bIsComputed) { + continue; + } + // + nF1 = n2; + nF2 = n1; + if(n1 < n2) { + nF1 = n1; + nF2 = n2; + } + anIndexIn=0; + aPnts.Clear(); + aCvs.Clear(); + // + bIsFound=IsPairFound(nF1, nF2, myIntrPool, aMapWhat, aMapWith); + // + if (bJustAdd) { + if (!bIsFound) { + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + } + else{ + BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); + anIndexIn=aFFs.Append(anInterf); + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + } + continue; + } + // + const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2)); + // + // FF + bToApproxC3d = mySectionAttribute.Approximation(); + bToApproxC2dOnS1 = mySectionAttribute.PCurveOnS1(); + bToApproxC2dOnS2 = mySectionAttribute.PCurveOnS2(); + // + anApproxTol=1.e-7; + // + IntTools_FaceFace aFF; + // + aFF.SetParameters (bToApproxC3d, bToApproxC2dOnS1, + bToApproxC2dOnS2, anApproxTol); + // + aFF.Perform(aF1, aF2); + // + bIsDone=aFF.IsDone(); + // + if (!bIsDone) { + if (!bIsFound) { + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + } + else { + BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); + anIndexIn=aFFs.Append(anInterf); + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + } + continue; + } + // + aTolR3D=aFF.TolReached3d(); + aTolR2D=aFF.TolReached2d(); + if (aTolR3D < 1.e-7){ + aTolR3D=1.e-7; + } + // + aFF.PrepareLines3D(); + // + const IntTools_SequenceOfCurves& aCvsX=aFF.Lines(); + const IntTools_SequenceOfPntOn2Faces& aPntsX=aFF.Points(); + // + aNbCurves=aCvsX.Length(); + aNbPoints=aPntsX.Length(); + // + if (!aNbCurves && !aNbPoints) { + BOPTools_SSInterference anInterf (nF1, nF2, 1.e-07, 1.e-07, aCvs, aPnts); + anIndexIn=aFFs.Append(anInterf); + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + continue; + } + // + { + BOPTools_SSInterference anInterf (nF1, nF2, aTolR3D, aTolR2D, aCvsX, aPntsX); + anIndexIn=aFFs.Append(anInterf); + myIntrPool->AddInterference (nF1, nF2, aTypeFF, anIndexIn); + } + // + }// for (; myDSIt.More(); myDSIt.Next()) + // + myIsDone=Standard_True; +} +//======================================================================= +// function: MakeBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::MakeBlocks() +{ + myIsDone=Standard_False; + // + Standard_Boolean bIsExistingPaveBlock, bIsValidIn2D; + Standard_Integer i, aNbFFs, nF1, nF2, aBid=0; + Standard_Integer nV1, nV2, j, aNbCurves; + Standard_Real aTolR3D, aTol2D, aT1, aT2, aTolPPC=Precision::PConfusion(); + NMTTools_IndexedDataMapOfShapePaveBlock aMEPB; + BooleanOperations_IndexedDataMapOfShapeInteger aMapEI; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + // + // 1. Produce Section Edges from intersection curves + // between each pair of faces + // + aNbFFs=aFFs.Extent(); + for (i=1; i<=aNbFFs; ++i) { + BOPTools_SSInterference& aFFi=aFFs(i); + // + // Faces + aFFi.Indices(nF1, nF2); + const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2)); + // + BOPTools_ListOfPaveBlock aLPB, aLPBC; + // + //modified by NIZNHY-PKV Fri Mar 11 15:43:02 2005 f + { + Standard_Integer nFj1, nFj2, nE; + TColStd_IndexedMapOfInteger aMFence; + BOPTools_ListOfPaveBlock aLPBCx; + // + for (j=1; j<=aNbFFs; ++j) { + BOPTools_SSInterference& aFFj=aFFs(j); + aFFj.Indices(nFj1, nFj2); + // + if ((nF1==nFj1 && nFj2!=nF2) || + (nF1==nFj2 && nFj1!=nF2) || + (nF2==nFj1 && nFj2!=nF1) || + (nF2==nFj2 && nFj1!=nF1)) { + RealSplitsInFace (aBid, nFj1, nFj2, aLPBCx); + RealSplitsInFace (aBid, nFj2, nFj1, aLPBCx); + RealSplitsOnFace (aBid, nFj1, nFj2, aLPBCx); + } + } + // + anIt.Initialize(aLPBCx); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBCx=anIt.Value(); + // + nE=aPBCx.Edge(); + if (!aMFence.Contains(nE)) { + aMFence.Add(nE); + aLPBC.Append(aPBCx); + } + } + } + // + //modified by NIZNHY-PKV Fri Apr 1 09:49:57 2005t + // + RealSplitsInFace (aBid, nF1, nF2, aLPB); + RealSplitsInFace (aBid, nF2, nF1, aLPB); + RealSplitsOnFace (aBid, nF1, nF2, aLPB); + // + anIt.Initialize(aLPB); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + aFFi.AppendBlock(aPB); + } + // + BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves(); + aNbCurves=aSCvs.Length(); + if (!aNbCurves) { + continue; + } + // + aTolR3D=aFFi.TolR3D(); + aTol2D=(aTolR3D < 1.e-3) ? 1.e-3 : aTolR3D; + // + BOPTools_PaveSet aPSF; + // + //modified by NIZNHY-PKV Fri Apr 1 10:53:09 2005f + PrepareSetForFace (nF1, nF2, aLPBC, aPSF); + //PrepareSetForFace (nF1, nF2, aPSF); + //modified by NIZNHY-PKV Thu Mar 31 16:16:47 2005t + // + // Put Paves On Curves + for (j=1; j<=aNbCurves; ++j) { + BOPTools_Curve& aBC=aSCvs(j); + // DEBUG + const IntTools_Curve& aC=aBC.Curve(); + Handle (Geom_Curve) aC3D= aC.Curve(); + // + PutPaveOnCurve (aPSF, aTolR3D, aBC); + } + // + // Put bounding paves on curves + for (j=1; j<=aNbCurves; ++j) { + BOPTools_Curve& aBC=aSCvs(j); + PutBoundPaveOnCurve (aBC, aFFi); + } + // + // Pave Blocks on Curves + for (j=1; j<=aNbCurves; ++j) { + BOPTools_Curve& aBC=aSCvs(j); + const IntTools_Curve& aIC= aBC.Curve(); + BOPTools_PaveSet& aPaveSet=aBC.Set(); + // + BOPTools_PaveBlockIterator aPBIter(0, aPaveSet); + for (; aPBIter.More(); aPBIter.Next()) { + BOPTools_PaveBlock& aPBNew=aPBIter.Value(); + aPBNew.SetCurve(aIC); + aPBNew.SetFace1(nF1); + aPBNew.SetFace2(nF2); + // + nV1=aPBNew.Pave1().Index(); + nV2=aPBNew.Pave2().Index(); + aT1=aPBNew.Pave1().Param(); + aT2=aPBNew.Pave2().Param(); + // ??? + if((nV1==nV2) && (Abs(aT2 - aT1) < aTolPPC)) { + continue;// mkk ft + } + // + //modified by NIZNHY-PKV Fri Apr 1 09:56:11 2005f + // 1 + const BOPTools_ListOfPaveBlock& aLPBFF=aFFi.PaveBlocks(); + bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPBFF, aTolR3D); + //bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aFFi); + if (bIsExistingPaveBlock) { + continue; + } + // 2 + bIsExistingPaveBlock=IsExistingPaveBlock(aPBNew, aLPBC, aTolR3D); + if (bIsExistingPaveBlock) { + continue; + } + //modified by NIZNHY-PKV Fri Apr 1 09:56:14 2005t + // Checking of validity in 2D + // + bIsValidIn2D=myContext.IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTol2D); + if (!bIsValidIn2D) { + continue; + } + // + //aBC.AppendNewBlock(aPBNew); + // + // Make Section Edge + TopoDS_Edge aES; + // + const TopoDS_Vertex& aV1=TopoDS::Vertex(myDS->Shape(nV1)); + const TopoDS_Vertex& aV2=TopoDS::Vertex(myDS->Shape(nV2)); + // + BOPTools_Tools::MakeSectEdge (aIC, aV1, aT1, aV2, aT2, aES); + // + { + Standard_Real aTolR2D; + // + aTolR2D=aFFi.TolR2D(); + Handle(Geom2d_Curve) aC2D1=aIC.FirstCurve2d(); + Handle(Geom2d_Curve) aC2D2=aIC.SecondCurve2d(); + // + NMTTools_Tools::MakePCurve(aES, aF1, aC2D1, aTolR2D); + NMTTools_Tools::MakePCurve(aES, aF2, aC2D2, aTolR2D); + } + // + aMEPB.Add(aES, aPBNew); + aMapEI.Add(aES, i); + } + } // end of for (j=1; j<=aNbCurves; ++j) + }// for (i=1; i<=aNbFFs; ++i) + //============================================================= + // + // II. Post treatment + // + // Input data: aMEPB, aMapEI + // Result : section edges in myDS + // + Standard_Integer aNbSE; + // + aNbSE=aMEPB.Extent(); + if (!aNbSE) { + // there is nothing to do here + return; + } + // + BRep_Builder aBB; + TopoDS_Compound aCompound; + // + // 1. Make compound from SE + aBB.MakeCompound(aCompound); + for (i=1; i<=aNbSE; ++i) { + const TopoDS_Shape& aSE=aMEPB.FindKey(i); + aBB.Add(aCompound, aSE); + } + // + // + // 2. Intersect SE using auxiliary Filler + NMTDS_ShapesDataStructure tDS; + // + tDS.SetCompositeShape(aCompound); + tDS.Init(); + // + BOPTools_InterferencePool tIP(tDS); + NMTTools_PaveFiller tPF(tIP); + // + // 2.1.VV + tPF.Init(); + tPF.PerformVV(); + tPF.PerformNewVertices(); + // + // 2.2.VE + tPF.myPavePool.Resize (tPF.myNbEdges); + tPF.PrepareEdges(); + tPF.PerformVE(); + // + // 2.3.VF + tPF.PerformVF(); + // + // 2.4.EE + tPF.myCommonBlockPool.Resize (tPF.myNbEdges); + tPF.mySplitShapesPool.Resize (tPF.myNbEdges); + tPF.myPavePoolNew .Resize (tPF.myNbEdges); + + tPF.PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE); + tPF.PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE); + // + tPF.PerformEE(); + // + tPF.RefinePavePool (); + // + tPF.myPavePoolNew.Destroy(); + // + tPF.MakeSplitEdges(); + tPF.UpdateCommonBlocks(); + // + // 3. Treatment of the result of intersection + // + Standard_Integer aNbOld, aNbLines, aNbPB, mV1, mV2, nE, mE, iFF; + TopAbs_ShapeEnum aType; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTColStd_IndexedDataMapOfIntegerInteger aMNewOld; + // + const BOPTools_SplitShapesPool& aSSP=tPF.mySplitShapesPool; + const NMTTools_CommonBlockPool& aCBP=tPF.myCommonBlockPool; + // + aNbLines=tDS.NumberOfInsertedShapes(); + aNbOld=tDS.NumberOfShapesOfTheObject(); + // + // 3.1 Links between indices in tDS and DS (kept in aMNewOld) + // + // 3.1.1.Old vertices [ links ] + for (i=1; i<=aNbOld; ++i) { + const TopoDS_Shape& aV=tDS.Shape(i); + aType=aV.ShapeType(); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + for (j=1; j<=aNbSE; ++j) { + const BOPTools_PaveBlock& aPBSE=aMEPB(j); + nV1=aPBSE.Pave1().Index(); + const TopoDS_Shape& aV1=myDS->Shape(nV1); + if (aV1.IsSame(aV)) { + aMNewOld.Add(i, nV1); + break; + } + nV2=aPBSE.Pave2().Index(); + const TopoDS_Shape& aV2=myDS->Shape(nV2); + if (aV2.IsSame(aV)) { + aMNewOld.Add(i, nV2); + break; + } + } + } + // + // 3.1.2. New vertices [ links ] + i=tDS.NumberOfSourceShapes()+1; + for (; i<=aNbLines; ++i) { + const TopoDS_Shape& aV=tDS.Shape(i); + aType=aV.ShapeType(); + if (aType!=TopAbs_VERTEX) { + continue; + } + // + // Insert new vertex in myDS + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq); + nV1=myDS->NumberOfInsertedShapes(); + // link + aMNewOld.Add(i, nV1); + } + // + // 3.2. Treatment of section edges (SE) + for (i=1; i<=aNbOld; ++i) { + const TopoDS_Shape& aE=tDS.Shape(i); + aType=aE.ShapeType(); + if (aType!=TopAbs_EDGE) { + continue; + } + // + // block of section edge that we already have for this SE + BOPTools_PaveBlock& aPBSE=aMEPB.ChangeFromKey(aE); + // + // Corresponding FF-interference + iFF=aMapEI.FindFromKey(aE); + BOPTools_SSInterference& aFFi=aFFs(iFF); + BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves(); + // + BOPTools_Curve& aBC=aSCvs(1); + // + const BOPTools_ListOfPaveBlock& aLPB=aSSP(tDS.RefEdge(i)); + aNbPB=aLPB.Extent(); + // + if (!aNbPB) { + // no pave blocks -> use aPBSE and whole edge aE + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + nV1=aPBSE.Pave1().Index(); + const TopoDS_Shape& aV1=myDS->Shape(nV1); + nV2=aPBSE.Pave2().Index(); + const TopoDS_Shape& aV2=myDS->Shape(nV2); + // + anASSeq.SetNewSuccessor(nV1); + anASSeq.SetNewOrientation(aV1.Orientation()); + anASSeq.SetNewSuccessor(nV2); + anASSeq.SetNewOrientation(aV2.Orientation()); + // + myDS->InsertShapeAndAncestorsSuccessors(aE, anASSeq); + nE=myDS->NumberOfInsertedShapes(); + // + aPBSE.SetEdge(nE); + aBC.AppendNewBlock(aPBSE); + // + continue; + } + // + nF1=aPBSE.Face1(); + nF2=aPBSE.Face2(); + const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2)); + // + const NMTTools_ListOfCommonBlock& aLCB=aCBP(tDS.RefEdge(i)); + NMTTools_CommonBlockAPI aCBAPI(aLCB); + // + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + BOPTools_PaveBlock aPB=aIt.Value(); + // + if (aCBAPI.IsCommonBlock(aPB)) { + // it can be Common Block + Standard_Real aTolEx; + Handle(Geom2d_Curve) aC2D1, aC2D2; + TopoDS_Face aF1FWD, aF2FWD; + // + NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); + const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); + // + aPB=aCB.PaveBlock1(); + mE=aPB.Edge(); // index of edge in tDS + const TopoDS_Edge& aEx=TopoDS::Edge(tDS.Shape(mE)); + aTolEx=BRep_Tool::Tolerance(aEx); + // + // Commented out by EAP in the frame of PAL9151 + // +// Standard_Boolean bHasPCOnF, bFound; +// Standard_Integer nF, k, nEOrx, nF1x, nF2x; +// Standard_Real aTolEx, aT1x, aT2x; +// BOPTools_ListIteratorOfListOfPaveBlock aItPBx; + // +// for (k=0; k<2; ++k) { +// nF=(!k) ? nF1 : nF2; +// const TopoDS_Face& aF=TopoDS::Face(myDS->Shape(nF)); +// // +// bHasPCOnF=BOPTools_Tools2D::HasCurveOnSurface(aEx, aF); +// if (bHasPCOnF) { +// continue; +// } +// // +// bFound=Standard_False; +// aItPBx.Initialize(aLPBx); +// for (; aItPBx.More(); aItPBx.Next()) { +// BOPTools_PaveBlock& aPBx=aIt.Value(); +// nEOrx=aPBx.OriginalEdge(); +// const TopoDS_Shape& aEOrx=tDS.Shape(nEOrx); +// BOPTools_PaveBlock& aPBSEx=aMEPB.ChangeFromKey(aEOrx); +// aT1x=aPBSEx.Pave1().Param(); +// aT2x=aPBSEx.Pave2().Param(); +// const IntTools_Curve& aICx=aPBSEx.Curve(); +// // +// nF1x=aPBSEx.Face1(); +// nF2x=aPBSEx.Face2(); +// // +// if (nF1x==nF) { +// Handle(Geom2d_Curve) aC2D1x=aICx.FirstCurve2d(); +// Handle(Geom2d_TrimmedCurve)aC2D1xT =new Geom2d_TrimmedCurve(aC2D1x, aT1x, aT2x); +// aBB.UpdateEdge(aEx, aC2D1xT, aF, aTolEx); +// bFound=!bFound; +// break; +// } +// // +// if (nF2x==nF) { +// Handle(Geom2d_Curve) aC2D2x=aICx.SecondCurve2d(); +// Handle(Geom2d_TrimmedCurve)aC2D2xT =new Geom2d_TrimmedCurve(aC2D2x, aT1x, aT2x); +// aBB.UpdateEdge(aEx, aC2D2xT, aF, aTolEx); +// bFound=!bFound; +// break; +// } +// } +// if (bFound){ +// BRepLib::SameParameter(aEx, aTolEx, Standard_True); +// } +// } + // + // The code till the if block end is restored from V2_2_2 revision + // + aF1FWD=aF1; + aF1FWD.Orientation(TopAbs_FORWARD); + NMTTools_Tools::MakePCurve(aEx, aF1FWD, aC2D1, aTolEx); + // + aF2FWD=aF2; + aF2FWD.Orientation(TopAbs_FORWARD); + NMTTools_Tools::MakePCurve(aEx, aF2FWD, aC2D2, aTolEx); + } //if (aCBAPI.IsCommonBlock(aPB)) + // + // new SE + mE=aPB.Edge(); // index of edge in tDS + const TopoDS_Shape& aSp=tDS.Shape(mE); + // + const BOPTools_Pave& aPave1=aPB.Pave1(); + aT1=aPave1.Param(); + mV1=aPave1.Index(); // index in tDS + nV1=aMNewOld.FindFromKey(mV1); // index in myDS + const TopoDS_Shape& aV1=myDS->Shape(nV1); + // + const BOPTools_Pave& aPave2=aPB.Pave2(); + aT2=aPave2.Param(); + mV2=aPave2.Index(); + nV2=aMNewOld.FindFromKey(mV2); + const TopoDS_Shape& aV2=myDS->Shape(nV2); + // + if (!aMNewOld.Contains(mE)) { + // add new SE to the myDS + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + anASSeq.SetNewSuccessor(nV1); + anASSeq.SetNewOrientation(aV1.Orientation()); + + anASSeq.SetNewSuccessor(nV2); + anASSeq.SetNewOrientation(aV2.Orientation()); + + myDS->InsertShapeAndAncestorsSuccessors(aSp, anASSeq); + nE=myDS->NumberOfInsertedShapes(); + // + aMNewOld.Add(mE, nE); + } + else { + nE=aMNewOld.FindFromKey(mE); + } + // Form PaveBlock; + BOPTools_PaveBlock aPBx; + BOPTools_Pave aP1, aP2; + // + aPBx.SetFace1(nF1); + aPBx.SetFace1(nF2); + // + aP1.SetIndex(nV1); + aP1.SetParam(aT1); + // + aP2.SetIndex(nV2); + aP2.SetParam(aT2); + // + aPBx.SetPave1(aP1); + aPBx.SetPave2(aP2); + // + aPBx.SetEdge(nE); + // + aBC.AppendNewBlock(aPBx); + }// for (; aIt.More(); aIt.Next()) + }// for (i=1; i<=aNbOld; ++i) + // + myIsDone=Standard_True; +} +//======================================================================= +// function: MakePCurves +// purpose: +//======================================================================= + void NMTTools_PaveFiller::MakePCurves() +{ + Standard_Integer i, aNb, nF1, nF2, nE; + TopoDS_Face aF1FWD, aF2FWD; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + // + aNb=aFFs.Extent(); + for (i=1; i<=aNb; i++) { + BOPTools_SSInterference& aFF=aFFs(i); + aFF.Indices(nF1, nF2); + // + const TopoDS_Face& aF1=TopoDS::Face(myDS->Shape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(myDS->Shape(nF2)); + // + aF1FWD=aF1; + aF1FWD.Orientation(TopAbs_FORWARD); + aF2FWD=aF2; + aF2FWD.Orientation(TopAbs_FORWARD); + // + // In, On parts processing + const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); + // + anIt.Initialize(aLPBInOn); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + nE=aPB.Edge(); + const TopoDS_Edge& aE=TopoDS::Edge(myDS->Shape(nE)); + + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); + } + } +} +//modified by NIZNHY-PKV Fri Apr 1 09:36:06 2005f +//======================================================================= +// function: IsExistingPaveBlock +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, + const BOPTools_ListOfPaveBlock& aLPBR, + const Standard_Real aTolR3D) +{ + Standard_Boolean bFlag; + Standard_Integer nVNew1, nVNew2, nV1, nV2, iC; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + bFlag=Standard_False; + nVNew1=aPBNew.Pave1().Index(); + nVNew2=aPBNew.Pave2().Index(); + // + anIt.Initialize(aLPBR); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBR=anIt.Value(); + nV1=aPBR.Pave1().Index(); + nV2=aPBR.Pave2().Index(); + if (nVNew1==nV1 || nVNew1==nV2 || nVNew2==nV1 || nVNew2==nV2) { + // + iC=CheckIntermediatePoint(aPBNew, aPBR, aTolR3D); + if (!iC) { + return !bFlag; + } + } + } + return bFlag; +} +//modified by NIZNHY-PKV Fri Apr 1 09:36:06 2005t +//======================================================================= +// function: CheckIntermediatePoint +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::CheckIntermediatePoint(const BOPTools_PaveBlock& aPB, + const BOPTools_PaveBlock& aPBR, + const Standard_Real aTolC) + +{ + Standard_Real aT11, aT12, aTM, aTmp; + Standard_Integer iVM, nE2; + gp_Pnt aPM; + BRep_Builder aBB; + TopoDS_Vertex aVM; + // + // Vertex + const BOPTools_Pave& aPave11=aPB.Pave1(); + aT11=aPave11.Param(); + // + const BOPTools_Pave& aPave12=aPB.Pave2(); + aT12=aPave12.Param(); + // + aTM=IntTools_Tools::IntermediatePoint (aT11, aT12); + // + const IntTools_Curve& aIC=aPB.Curve(); + aIC.D0(aTM, aPM); + // + aBB.MakeVertex (aVM, aPM, aTolC); + // + //Edge + nE2=aPBR.Edge(); + const TopoDS_Edge& aE2=TopoDS::Edge(myDS->GetShape(nE2)); + // VE + iVM=myContext.ComputeVE(aVM, aE2, aTmp); + // + return iVM; +} +//======================================================================= +// function: PutBoundPaveOnCurve +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PutBoundPaveOnCurve(BOPTools_Curve& aBC, + BOPTools_SSInterference& aFFi) +{ + Standard_Boolean bHasBounds, bVF; + Standard_Integer nF1, nF2; + Standard_Real aT1, aT2, aTolR3D; + gp_Pnt aP1, aP2; + // + const IntTools_Curve& aIC=aBC.Curve(); + bHasBounds=aIC.HasBounds (); + if (!bHasBounds){ + return; + } + // + // Bounds + aIC.Bounds (aT1, aT2, aP1, aP2); + // + // Faces + aFFi.Indices(nF1, nF2); + aTolR3D=aFFi.TolR3D(); + // + const TopoDS_Face& aF1=TopoDS::Face(myDS->GetShape(nF1)); + const TopoDS_Face& aF2=TopoDS::Face(myDS->GetShape(nF2)); + // + bVF=myContext.IsValidPointForFaces (aP1, aF1, aF2, aTolR3D); + if (bVF) { + PutBoundPaveOnCurve (aP1, aT1, aBC, aFFi); + } + // + bVF=myContext.IsValidPointForFaces (aP2, aF1, aF2, aTolR3D); + if (bVF) { + PutBoundPaveOnCurve (aP2, aT2, aBC, aFFi); + } +} +//======================================================================= +// function: PutBoundPaveOnCurve +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PutBoundPaveOnCurve(const gp_Pnt& aP, + const Standard_Real aT, + BOPTools_Curve& aBC, + BOPTools_SSInterference& aFFi) +{ + Standard_Boolean bFound1, bFound2; + Standard_Integer nV; + Standard_Real aTolV=aFFi.TolR3D(); + + BOPTools_Pave aPave1, aPave2, aPave; + BOPTools_PaveSet& aCPS=aBC.Set(); + BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet(); + const IntTools_Curve& aIC=aBC.Curve(); + // + bFound1=FindPave(aP, aTolV, aCPS , aPave1); + bFound2=FindPave(aP, aTolV, aFFiPS, aPave2); + // + if (!bFound1 && !bFound2) { + TopoDS_Vertex aNewVertex; + BOPTools_Tools::MakeNewVertex(aP, aTolV, aNewVertex); + // + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); + nV=myDS->NumberOfInsertedShapes(); + aPave.SetIndex(nV); + aPave.SetParam(aT); + + aCPS.Append(aPave); + aFFiPS.Append(aPave); + // + // Append Techno Vertex to the Curve + TColStd_ListOfInteger& aTVs=aBC.TechnoVertices(); + aTVs.Append(nV); + } + + if (bFound1 && !bFound2) { + nV=aPave1.Index(); + aPave.SetIndex(nV); + aPave.SetParam(aT); + aFFiPS.Append(aPave); + // + const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV)); + BOPTools_Tools::UpdateVertex (aIC, aT, aV); + } + + if (!bFound1 && bFound2) { + nV=aPave2.Index(); + aPave.SetIndex(nV); + aPave.SetParam(aT); + aCPS.Append(aPave); + // + const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV)); + BOPTools_Tools::UpdateVertex (aIC, aT, aV); + } +} +//======================================================================= +// function: FindPave +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::FindPave(const gp_Pnt& aP, + const Standard_Real aTolPV, + const BOPTools_PaveSet& aPS, + BOPTools_Pave& aPave) +{ + Standard_Integer nV; + Standard_Boolean bIsVertex=Standard_False; + + const BOPTools_ListOfPave& aLP=aPS.Set(); + BOPTools_ListIteratorOfListOfPave anIt(aLP); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPC=anIt.Value(); + nV=aPC.Index(); + const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV)); + bIsVertex=IntTools_Tools::IsVertex (aP, aTolPV, aV); + if (bIsVertex) { + aPave=aPC; + return bIsVertex; + } + } + return bIsVertex; +} +//======================================================================= +// function: PrepareSetForFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer nF1, + const Standard_Integer nF2, + const BOPTools_ListOfPaveBlock& aLPBC, + BOPTools_PaveSet& aPSF) +{ + Standard_Integer nV1, nV2; + TColStd_MapOfInteger aMap; + BOPTools_ListOfPaveBlock aLPB1, aLPB2, aLPBS; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + RealSplitsFace(nF1, aLPB1); + anIt.Initialize(aLPB1); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + aLPBS.Append(aPB); + } + // + RealSplitsFace(nF2, aLPB2); + anIt.Initialize(aLPB2); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + aLPBS.Append(aPB); + } + // + anIt.Initialize(aLPBC); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + aLPBS.Append(aPB); + } + // + anIt.Initialize(aLPBS); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + if (!aMap.Contains(nV1)) { + aMap.Add(nV1); + aPSF.Append(aPave1); + } + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + if (!aMap.Contains(nV2)) { + aMap.Add(nV2); + aPSF.Append(aPave2); + } + } +} +//======================================================================= +// function: PutPaveOnCurve +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PutPaveOnCurve(const BOPTools_PaveSet& aPaveSet, + const Standard_Real aTolR3D, + BOPTools_Curve& aBC) +{ + Standard_Integer nV; + Standard_Boolean bIsVertexOnLine; + Standard_Real aT; + BOPTools_ListIteratorOfListOfPave anIt; + Bnd_Box aBBC; + GeomAdaptor_Curve aGAC; + // + const IntTools_Curve& aC=aBC.Curve(); + Handle (Geom_Curve) aC3D= aC.Curve(); + aGAC.Load(aC3D); + BndLib_Add3dCurve::Add(aGAC, aTolR3D, aBBC); + // + const BOPTools_ListOfPave& aLP=aPaveSet.Set(); + anIt.Initialize(aLP); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Pave& aPave=anIt.Value(); + // + nV=aPave.Index(); + const TopoDS_Vertex& aV=TopoDS::Vertex(myDS->Shape(nV)); + // + Bnd_Box aBBV; + BRepBndLib::Add(aV, aBBV); + if (aBBC.IsOut(aBBV)){ + continue; + } + // + bIsVertexOnLine=myContext.IsVertexOnLine(aV, aC, aTolR3D, aT); + // + if (bIsVertexOnLine) { + BOPTools_Pave aPaveNew(nV, aT, BooleanOperations_SurfaceSurface); + BOPTools_PaveSet& aPS=aBC.Set(); + aPS.Append(aPaveNew); + //<-B + BOPTools_Tools::UpdateVertex (aC, aT, aV); + } + } +} +///////////// +//======================================================================= +// function: IsPairFound +// purpose: +//======================================================================= +Standard_Boolean IsPairFound(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_InterferencePool* myIntrPool, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWhat, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bIsFound; + // + if (!aMapWhat.Contains(nF1)) { + TColStd_IndexedMapOfInteger aMWhat; + FMapWhat(nF1, myIntrPool, aMWhat); + aMapWhat.Add(nF1, aMWhat); + } + // + if (!aMapWith.Contains(nF2)) { + TColStd_IndexedMapOfInteger aMWith; + FMapWith(nF2, myIntrPool, aMWith); + aMapWith.Add(nF2, aMWith); + } + // + const TColStd_IndexedMapOfInteger& aMWht=aMapWhat.FindFromKey(nF1); + const TColStd_IndexedMapOfInteger& aMWit=aMapWith.FindFromKey(nF2); + // + bIsFound=IsFound(aMWht, aMWit); + // + return bIsFound; +} +//======================================================================= +// function: FMapWhat +// purpose: +//======================================================================= +void FMapWhat(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWhat) + +{ + Standard_Integer nE, nV; + + + + BooleanOperations_ShapesDataStructure* myDS=myIntrPool->DS(); + BooleanOperations_OnceExplorer aExp(*myDS); + // + // What + aMapWhat.Add(nF); + aExp.Init(nF, TopAbs_VERTEX); + for (; aExp.More(); aExp.Next()) { + nV=aExp.Current(); + aMapWhat.Add(nV); + } + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + aMapWhat.Add(nE); + } +} +//======================================================================= +// function: FMapWith +// purpose: +//======================================================================= +void FMapWith(const Standard_Integer nF, + BOPTools_InterferencePool* myIntrPool, + TColStd_IndexedMapOfInteger& aMapWith) +{ + TColStd_IndexedMapOfInteger aMapWhat; + + FMapWhat(nF, myIntrPool, aMapWhat); + // + // With + Standard_Integer i, aNb, anIndex, aWhat, aWith; + BOPTools_ListIteratorOfListOfInterference anIt; + + const BOPTools_CArray1OfInterferenceLine& anArrIL= myIntrPool->InterferenceTable(); + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + + const BOPTools_InterferenceLine& aWithLine=anArrIL(aWhat); + + const BOPTools_ListOfInterference& aLI=aWithLine.List(); + anIt.Initialize(aLI); + for (; anIt.More(); anIt.Next()) { + const BOPTools_Interference& anIntf=anIt.Value(); + anIndex=anIntf.Index(); + if (anIndex) { + aWith=anIntf.With(); + aMapWith.Add(aWith); + } + } + } +} +//======================================================================= +// function: IsFound +// purpose: +//======================================================================= +Standard_Boolean IsFound(const TColStd_IndexedMapOfInteger& aMapWhat, + const TColStd_IndexedMapOfInteger& aMapWith) +{ + Standard_Boolean bFlag=Standard_False; + Standard_Integer i, aNb, aWhat; + + aNb=aMapWhat.Extent(); + for (i=1; i<=aNb; i++) { + aWhat=aMapWhat(i); + if (aMapWith.Contains(aWhat)) { + return !bFlag; + } + } + return bFlag; +} +/* +//======================================================================= +// function: PrepareSetForFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PrepareSetForFace(const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_PaveSet& aPSF) +{ + Standard_Integer nV1, nV2; + TColStd_MapOfInteger aMap; + BOPTools_ListOfPaveBlock aLPB1, aLPB2; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + RealSplitsFace(nF1, aLPB1); + RealSplitsFace(nF2, aLPB2); + // + aLPB1.Append(aLPB2); + // + anIt.Initialize(aLPB1); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + if (!aMap.Contains(nV1)) { + aMap.Add(nV1); + aPSF.Append(aPave1); + } + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + if (!aMap.Contains(nV2)) { + aMap.Add(nV2); + aPSF.Append(aPave2); + } + } +} +*/ +/* +//======================================================================= +// function: IsExistingPaveBlock +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::IsExistingPaveBlock(const BOPTools_PaveBlock& aPBNew, + const BOPTools_SSInterference& aFFi) +{ + Standard_Boolean bFlag; + Standard_Real aTolR3D; + // + aTolR3D=aFFi.TolR3D(); + const BOPTools_ListOfPaveBlock& aLPBR=aFFi.PaveBlocks(); + // + bFlag=IsExistingPaveBlock(aPBNew, aLPBR, aTolR3D); + // + return bFlag; +} +*/ diff --git a/src/NMTTools/NMTTools_PaveFiller_7.cxx b/src/NMTTools/NMTTools_PaveFiller_7.cxx new file mode 100644 index 000000000..ebc09a959 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_7.cxx @@ -0,0 +1,280 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_7.cxx +// Created: Thu Dec 18 15:14:55 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +// function: MakeSplitEdges +// purpose: +//======================================================================= + void NMTTools_PaveFiller::MakeSplitEdges() +{ + myIsDone=Standard_False; + // + Standard_Boolean bIsNewVertex1, bIsNewVertex2; + Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex; + Standard_Real t1, t2; + TopAbs_Orientation anOri; + TopoDS_Edge aE, aESplit; + TopoDS_Vertex aV1, aV2; + // + aNbS=myDS->NumberOfShapesOfTheObject(); + for (i=1; i<=aNbS; ++i) { + if (myDS->GetShapeType(i) != TopAbs_EDGE) + continue; + // + // Original Edge + aE=TopoDS::Edge(myDS->Shape(i)); + if (BRep_Tool::Degenerated(aE)){ + continue; + } + // + anOri=aE.Orientation(); + aE.Orientation(TopAbs_FORWARD); + // + // Making Split Edges + // + // Split Set for the Original Edge i + BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i)); + BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges); + // + aNbPaveBlocks=aSplitEdges.Extent(); + + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPB=aPBIt.Value(); + // aPave1 + const BOPTools_Pave& aPave1=aPB.Pave1(); + nV1=aPave1.Index(); + t1=aPave1.Param(); + aV1=TopoDS::Vertex(myDS->GetShape(nV1)); + aV1.Orientation(TopAbs_FORWARD); + // aPave2 + const BOPTools_Pave& aPave2=aPB.Pave2(); + nV2=aPave2.Index(); + t2=aPave2.Param(); + aV2=TopoDS::Vertex(myDS->GetShape(nV2)); + aV2.Orientation(TopAbs_REVERSED); + //xx + if (aNbPaveBlocks==1) { + bIsNewVertex1=myDS->IsNewShape (nV1); + bIsNewVertex2=myDS->IsNewShape (nV2); + if (!bIsNewVertex1 && !bIsNewVertex2) { + aPB.SetEdge(i); + continue; + } + } + //xx + BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit); + // + // Add Split Part of the Original Edge to the DS + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + + anASSeq.SetNewSuccessor(nV1); + anASSeq.SetNewOrientation(aV1.Orientation()); + + anASSeq.SetNewSuccessor(nV2); + anASSeq.SetNewOrientation(aV2.Orientation()); + // + if (anOri==TopAbs_INTERNAL) { + anASSeq.SetNewAncestor(i); + aESplit.Orientation(anOri); + } + // + myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq); + aNewShapeIndex=myDS->NumberOfInsertedShapes(); + myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN); + // + // Fill Split Set for the Original Edge + aPB.SetEdge(aNewShapeIndex); + // + } + } + myIsDone=Standard_True; +} +//======================================================================= +// function: UpdateCommonBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::UpdateCommonBlocks() +{ + myIsDone=Standard_False; + // + Standard_Integer nE, aNbS, nSp, nEx, nSpx; + NMTTools_ListIteratorOfListOfCommonBlock aCBIt; + BOPTools_ListIteratorOfListOfPaveBlock aPBIt; + // + aNbS=myDS->NumberOfShapesOfTheObject(); + // + for (nE=1; nE<=aNbS; ++nE) { + if (myDS->GetShapeType(nE)!=TopAbs_EDGE){ + continue; + } + if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){ + continue; + } + // + NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE)); + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool (myDS->RefEdge(nE)); + // + aCBIt.Initialize(aLCB); + for (; aCBIt.More(); aCBIt.Next()) { + NMTTools_CommonBlock& aCB=aCBIt.Value(); + BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE); + nSp=SplitIndex(aPB); + aPB.SetEdge(nSp); + // + const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks(); + aPBIt.Initialize(aCBLPB); + for (; aPBIt.More(); aPBIt.Next()) { + BOPTools_PaveBlock& aPBx=aPBIt.Value(); + nEx=aPBx.OriginalEdge(); + if (nEx==nE) { + continue; + } + // + nSpx=SplitIndex(aPBx); + aPBx.SetEdge(nSpx); + } + // + } + } +} +//======================================================================= +// function: SplitIndex +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitIndex(const BOPTools_PaveBlock& aPBx)const +{ + Standard_Integer anOriginalEdge, anEdgeIndex=0; + + anOriginalEdge=aPBx.OriginalEdge(); + + const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge)); + // + BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB); + for (; anIt.More(); anIt.Next()) { + BOPTools_PaveBlock& aPB=anIt.Value(); + if (aPB.IsEqual(aPBx)) { + anEdgeIndex=aPB.Edge(); + return anEdgeIndex; + } + } + return anEdgeIndex; +} +//======================================================================= +// function: UpdatePaveBlocks +// purpose: +//======================================================================= + void NMTTools_PaveFiller::UpdatePaveBlocks() +{ + myIsDone=Standard_False; + // + + Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB; + Standard_Real aT1, aT2; + TColStd_IndexedMapOfInteger aMF, aME; + TopExp_Explorer aExp; + TopoDS_Vertex aV1, aV2; + TopoDS_Edge aE; + BOPTools_Pave aPave1, aPave2; + BOPTools_PaveBlock aPB; + // + BOPTools_CArray1OfSSInterference& aFFs=myIntrPool->SSInterferences(); + // + aNbFFs=aFFs.Extent(); + for (i=1; i<=aNbFFs; ++i) { + BOPTools_SSInterference& aFFi=aFFs(i); + aFFi.Indices(nF1, nF2); + aMF.Add(nF1); + aMF.Add(nF2); + } + // + aNbF=aMF.Extent(); + for(i=1; i<=aNbF; ++i) { + nF=aMF(i); + iRankF=myDS->Rank(nF); + const TopoDS_Shape& aF=myDS->Shape(nF); + aExp.Init(aF, TopAbs_EDGE); + for(; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + // + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + nE=myDS->ShapeIndex(aE, iRankF); + // + if (aME.Contains(nE)) { + continue; + } + aME.Add(nE); + // + BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + aNbPB=aLPB.Extent(); + if (aNbPB) { + continue; + } + TopExp::Vertices(aE, aV1, aV2); + // + nV1=myDS->ShapeIndex(aV1, iRankF); + aT1=BRep_Tool::Parameter(aV1, aE); + aPave1.SetIndex(nV1); + aPave1.SetParam(aT1); + // + nV2=myDS->ShapeIndex(aV2, iRankF); + aT2=BRep_Tool::Parameter(aV2, aE); + aPave2.SetIndex(nV2); + aPave2.SetParam(aT2); + // + aPB.SetEdge(nE); + aPB.SetOriginalEdge(nE); + aPB.SetPave1(aPave1); + aPB.SetPave2(aPave2); + // + aLPB.Append(aPB); + } + } +} diff --git a/src/NMTTools/NMTTools_PaveFiller_8.cxx b/src/NMTTools/NMTTools_PaveFiller_8.cxx new file mode 100644 index 000000000..007478455 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_8.cxx @@ -0,0 +1,614 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_8.cxx +// Created: Fri Dec 19 11:15:53 2003 +// Author: Peter KURNEV +// + + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +//======================================================================= +// function: RealPaveBlock +// purpose: +//======================================================================= + const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock(const BOPTools_PaveBlock& aPB) +{ + Standard_Integer nE; + // + nE=aPB.OriginalEdge(); + const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); + NMTTools_CommonBlockAPI aCBAPI(aLCBE); + if (aCBAPI.IsCommonBlock(aPB)) { + NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB); + const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1(); + return aPBx; + } + return aPB; +} +//======================================================================= +// function: CommonBlocksFace +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::CommonBlocksFace(const Standard_Integer nF, + NMTTools_ListOfCommonBlock& aLCB) +{ + Standard_Integer nE; + TopAbs_ShapeEnum aT; + NMTTools_ListIteratorOfListOfCommonBlock anIt; + // + aT=myDS->GetShapeType(nF); + // + if (aT!=TopAbs_FACE) { + return 1; // Type mismatch + } + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE)); + anIt.Initialize(aLCBE); + for (; anIt.More(); anIt.Next()) { + const NMTTools_CommonBlock& aCBE=anIt.Value(); + aLCB.Append(aCBE); + } + } + return 0; //Ok +} +// +// 1 RealSplits +// +// +//======================================================================= +// function: RealSplitsFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsFace(const Standard_Integer nF, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE)); + anIt.Initialize(aLPBE); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB=anIt.Value(); + const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB); + aLPB.Append(aPBR); + } + } +} +//======================================================================= +// function: HasRealSplitsInOnFace +// purpose: +//======================================================================= + Standard_Boolean NMTTools_PaveFiller::HasRealSplitsInOnFace(const Standard_Integer nF1, + const Standard_Integer nF2) +{ + Standard_Boolean bFlag; + BOPTools_ListOfPaveBlock aLPB; + // + RealSplitsInFace(0, nF1, nF2, aLPB); + // + bFlag=!aLPB.IsEmpty(); + if (bFlag) { + return bFlag; + } + // + RealSplitsInFace(0, nF1, nF2, aLPB); + // + bFlag=!aLPB.IsEmpty(); + return bFlag; +} +//======================================================================= +// function: RealSplitsInFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE1; + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + aExp.Init(nF1, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE1=aExp.Current(); + RealSplitsInFace (nE1, nF2, aLPB); + } +} +//======================================================================= +// function: RealSplitsInFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nF1; + // + TColStd_ListIteratorOfListOfInteger anItLFCB; + NMTTools_ListIteratorOfListOfCommonBlock anItCB; + // + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); + // + anItCB.Initialize(aLCB); + for (; anItCB.More(); anItCB.Next()) { + NMTTools_CommonBlock& aCB=anItCB.Value(); + const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); + const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1); + + const TColStd_ListOfInteger& aLFCB=aCB.Faces(); + anItLFCB.Initialize(aLFCB); + for (; anItLFCB.More(); anItLFCB.Next()) { + nF1=anItLFCB.Value(); + if (nF1==nF2) { + aLPB.Append(aPB1R); + } + } + } +} +//======================================================================= +// function: RealSplitsOnEdge +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE; + // + BOPTools_ListIteratorOfListOfPaveBlock anIt; + NMTTools_ListIteratorOfListOfCommonBlock anItCB; + // + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); + + anItCB.Initialize(aLCB); + for (; anItCB.More(); anItCB.Next()) { + NMTTools_CommonBlock& aCB=anItCB.Value(); + const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); + const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1); + // + const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); + anIt.Initialize(aLPBx); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB2=anIt.Value(); + nE=aPB2.OriginalEdge(); + if (nE==nE2) { + aLPB.Append(aPB1R); + } + } + } +} +//======================================================================= +// function: RealSplitsOnFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE2; + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + aExp.Init(nF2, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE2=aExp.Current(); + RealSplitsOnEdge(nE1, nE2, aLPB); + } +} +//======================================================================= +// function: RealSplitsOnFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE1; + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*myDS); + aExp.Init(nF1, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE1=aExp.Current(); + RealSplitsOnFace(nE1, nF2, aLPB); + } +} + +// 2 SimpleSplits +//======================================================================= +// function: SplitsFace +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE; + TopAbs_ShapeEnum aT; + BOPTools_ListIteratorOfListOfPaveBlock anIt; + // + aT=myDS->GetShapeType(nF); + // + if (aT!=TopAbs_FACE) { + return 1; // Type mismatch + } + // + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + // + aExp.Init(nF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE=aExp.Current(); + const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE)); + anIt.Initialize(aLPBE); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPBE=anIt.Value(); + aLPB.Append(aPBE); + } + } + return 0; //Ok +} + +//======================================================================= +// function: SplitsInFace +// purpose: splits of edges from nF1 in nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE1; + TopAbs_ShapeEnum aT1, aT2; + + aT1=myDS->GetShapeType(nF1); + aT2=myDS->GetShapeType(nF2); + + if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { + return 1; // Type mismatch + } + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + aExp.Init(nF1, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE1=aExp.Current(); + SplitsInFace (nE1, nF2, aLPB); + } + return 0; //Ok +} +//======================================================================= +// function: SplitsInFace +// purpose: splits of edge nE1 in aFace2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nF1; + TopAbs_ShapeEnum aT1, aT2; + + aT1=myDS->GetShapeType(nE1); + aT2=myDS->GetShapeType(nF2); + + if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { + return 1; // Type mismatch + } + // + TColStd_ListIteratorOfListOfInteger anItLFCB; + NMTTools_ListIteratorOfListOfCommonBlock anItCB; + // + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); + // + anItCB.Initialize(aLCB); + for (; anItCB.More(); anItCB.Next()) { + NMTTools_CommonBlock& aCB=anItCB.Value(); + const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); + + const TColStd_ListOfInteger& aLFCB=aCB.Faces(); + anItLFCB.Initialize(aLFCB); + for (; anItLFCB.More(); anItLFCB.Next()) { + nF1=anItLFCB.Value(); + if (nF1==nF2) { + aLPB.Append(aPB1); + } + } + } + return 0; //Ok +} +//======================================================================= +// function: SplitsOnEdge +// purpose: splits of edge nE1 on nE2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE; + TopAbs_ShapeEnum aT1, aT2; + + aT1=myDS->GetShapeType(nE1); + aT2=myDS->GetShapeType(nE2); + + if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) { + return 1; // Type mismatch + } + // + BOPTools_ListIteratorOfListOfPaveBlock anIt; + NMTTools_ListIteratorOfListOfCommonBlock anItCB; + // + const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); + + anItCB.Initialize(aLCB); + for (; anItCB.More(); anItCB.Next()) { + NMTTools_CommonBlock& aCB=anItCB.Value(); + const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);//XXX + // + const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks(); + anIt.Initialize(aLPBx); + for (; anIt.More(); anIt.Next()) { + const BOPTools_PaveBlock& aPB2=anIt.Value(); + nE=aPB2.OriginalEdge(); + if (nE==nE2) { + aLPB.Append(aPB1); + } + } + } + return 0; //Ok +} +//======================================================================= +// function: SplitsOnFace +// purpose: splits of edge nE1 on face nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE2, ip; + TopAbs_ShapeEnum aT1, aT2; + + aT1=myDS->GetShapeType(nE1); + aT2=myDS->GetShapeType(nF2); + + if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { + return 1; // Type mismatch + } + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*pDS); + aExp.Init(nF2, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE2=aExp.Current(); + ip=SplitsOnEdge(nE1, nE2, aLPB); + if (ip) { + return ip; + } + } + return 0; //Ok +} +//======================================================================= +// function: SplitsOnFace +// purpose: splits of edges from face nF1 on face nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + BOPTools_ListOfPaveBlock& aLPB) +{ + Standard_Integer nE1, ip; + TopAbs_ShapeEnum aT1, aT2; + + aT1=myDS->GetShapeType(nF1); + aT2=myDS->GetShapeType(nF2); + + if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { + return 1; // Type mismatch + } + BooleanOperations_ShapesDataStructure *pDS=myDS; + BooleanOperations_OnceExplorer aExp(*myDS); + aExp.Init(nF1, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + nE1=aExp.Current(); + ip=SplitsOnFace(nE1, nF2, aLPB); + if (ip) { + return ip; + } + } + return 0; //Ok +} + +// 3 Simple Splits indices +//======================================================================= +// function: SplitsFace +// purpose: +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsFace(nF, aLPB); + if (iErr) { + return iErr; + } + + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return 0; //Ok +} + +//======================================================================= +// function: SplitsInFace +// purpose: splits of edges from nF1 in nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsInFace(0, nF1, nF2, aLPB); + if (iErr) { + return iErr; + } + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return iErr; +} +//======================================================================= +// function: SplitsInFace +// purpose: splits of edge nE1 in aFace2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsInFace(nE1, nF2, aLPB); + if (iErr) { + return iErr; + } + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return iErr; +} +//======================================================================= +// function: SplitsOnEdge +// purpose: splits of edge nE1 on nE2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, + const Standard_Integer nE2, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsOnEdge(nE1, nE2, aLPB); + if (iErr) { + return iErr; + } + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return iErr; +} +//======================================================================= +// function: SplitsOnFace +// purpose: splits of edge nE1 on face nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsOnEdge(nE1, nF2, aLPB); + if (iErr) { + return iErr; + } + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return iErr; +} +//======================================================================= +// function: SplitsOnFace +// purpose: splits of edges from face nF1 on face nF2 +//======================================================================= + Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding + const Standard_Integer nF1, + const Standard_Integer nF2, + TColStd_ListOfInteger& aSplits) +{ + Standard_Integer nE, iErr; + BOPTools_ListIteratorOfListOfPaveBlock aIt; + BOPTools_ListOfPaveBlock aLPB; + // + iErr=SplitsOnFace(0, nF1, nF2, aLPB); + if (iErr) { + return iErr; + } + + aIt.Initialize(aLPB); + for (; aIt.More(); aIt.Next()) { + const BOPTools_PaveBlock& aPB=aIt.Value(); + nE=aPB.Edge(); + aSplits.Append(nE); + } + return 0; //Ok +} diff --git a/src/NMTTools/NMTTools_PaveFiller_9.cxx b/src/NMTTools/NMTTools_PaveFiller_9.cxx new file mode 100644 index 000000000..2fc560ed2 --- /dev/null +++ b/src/NMTTools/NMTTools_PaveFiller_9.cxx @@ -0,0 +1,124 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_PaveFiller_9.cxx +// Created: Fri Dec 19 11:15:53 2003 +// Author: Peter KURNEV +// + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include + + +//======================================================================= +// function: PrepareFace +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF, + TopoDS_Face& newFace) +{ + Standard_Boolean bToReverse, bIsDegenerated; + Standard_Integer iRankF, nE, nSp, aNbPB; + Standard_Real aTol; + TopLoc_Location aLoc; + TopoDS_Face aF; + TopoDS_Wire newWire; + TopoDS_Edge aSp; + TopAbs_Orientation anOrF, anOrE; + BRep_Builder aBB; + TopExp_Explorer aExpW, aExpE; + BOPTools_ListIteratorOfListOfPaveBlock aItPB; + // + iRankF=myDS->Rank(nF); + aF=TopoDS::Face(myDS->Shape(nF)); + anOrF=aF.Orientation(); + aF.Orientation(TopAbs_FORWARD); + // + Handle(Geom_Surface) aS=BRep_Tool::Surface(aF, aLoc); + aTol=BRep_Tool::Tolerance(aF); + // + aBB.MakeFace (newFace, aS, aLoc, aTol); + // + aExpW.Init(aF, TopAbs_WIRE); + for (; aExpW.More(); aExpW.Next()) { + const TopoDS_Shape& aW=aExpW.Current(); + aBB.MakeWire(newWire); + // + aExpE.Init(aW, TopAbs_EDGE); + for (; aExpE.More(); aExpE.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current()); + bIsDegenerated=BRep_Tool::Degenerated(aE); + anOrE=aE.Orientation(); + // + nE=myDS->ShapeIndex(aE, iRankF); + const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); + aNbPB=aLPB.Extent(); + if (!aNbPB) { + aBB.Add(newWire, aE); + continue; + } + // + aItPB.Initialize(aLPB); + for (; aItPB.More(); aItPB.Next()) { + const BOPTools_PaveBlock& aPB=aItPB.Value(); + const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB); + nSp=aPBR.Edge(); + // + aSp=TopoDS::Edge(myDS->Shape(nSp)); + if (!bIsDegenerated) { + bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext); + if (bToReverse) { + aSp.Reverse(); + } + } + else { + aSp.Orientation(anOrE); + } + aBB.Add(newWire, aSp); + } + } + aBB.Add(newFace, newWire); + } + newFace.Orientation(anOrF); +} diff --git a/src/NMTTools/NMTTools_Tools.cdl b/src/NMTTools/NMTTools_Tools.cdl new file mode 100644 index 000000000..86ce89dba --- /dev/null +++ b/src/NMTTools/NMTTools_Tools.cdl @@ -0,0 +1,91 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- File: NMTTools_Tools.cdl +-- Created: Mon Dec 8 10:32:34 2003 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2003 + + +class Tools from NMTTools + + ---Purpose: + +uses + Vertex from TopoDS, + Edge from TopoDS, + Face from TopoDS, + Context from IntTools, + Curve from Geom2d, + + ListOfShape from TopTools, + IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd, + CArray1OfVVInterference from BOPTools, + CArray1OfSSInterference from BOPTools, + ListOfCoupleOfShape from NMTTools, + IndexedDataMapOfShapeIndexedMapOfShape from NMTTools + +--raises + +is + MakeNewVertex (myclass; + aLV : ListOfShape from TopTools; + aNewVertex: out Vertex from TopoDS); + FindChains(myclass; + aVVs:CArray1OfVVInterference from BOPTools; + aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); + + FindChains(myclass; + aVVs:CArray1OfSSInterference from BOPTools; + aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); + + FindChains(myclass; + aMCV: IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd; + aMCX: out IndexedDataMapOfIntegerIndexedMapOfInteger from BOPTColStd); + + + IsSplitInOnFace(myclass; + aE : Edge from TopoDS; + aF : Face from TopoDS; + aCtx:out Context from IntTools) + returns Boolean from Standard; + + AreFacesSameDomain(myclass; + aF1 : Face from TopoDS; + aF2 : Face from TopoDS; + aCtx : out Context from IntTools) + returns Boolean from Standard; + + FindChains(myclass; + aLCS:ListOfCoupleOfShape from NMTTools; + aM :out IndexedDataMapOfShapeIndexedMapOfShape from NMTTools); + + FindChains(myclass; + aM1: IndexedDataMapOfShapeIndexedMapOfShape from NMTTools; + aM2:out IndexedDataMapOfShapeIndexedMapOfShape from NMTTools); + + MakePCurve(myclass; + aE : Edge from TopoDS; + aF : Face from TopoDS; + aC2D: Curve from Geom2d; + aTolR2D: Real from Standard); +--fields + +end Tools; diff --git a/src/NMTTools/NMTTools_Tools.cxx b/src/NMTTools/NMTTools_Tools.cxx new file mode 100644 index 000000000..1193c8f2c --- /dev/null +++ b/src/NMTTools/NMTTools_Tools.cxx @@ -0,0 +1,569 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: NMTTools_Tools.cxx +// Created: Mon Dec 8 10:35:15 2003 +// Author: Peter KURNEV +// + + +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static + void ProcessBlock(const Standard_Integer iV, + const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + TColStd_IndexedMapOfInteger& aProcessed, + TColStd_IndexedMapOfInteger& aChain); +static + void ProcessBlock(const TopoDS_Shape& aF, + const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, + TopTools_IndexedMapOfShape& aProcessed, + TopTools_IndexedMapOfShape& aChain); + +//======================================================================= +// function: MakePCurve +// purpose: +//======================================================================= + void NMTTools_Tools::MakePCurve(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Handle(Geom2d_Curve)& aC2Dx, + const Standard_Real aTolR2D) +{ + Standard_Integer k, aNbV; + Standard_Real aTolEdge, aTolFact, aTolV, aTolVmax; + Standard_Real aTFirst, aTLast, aOutFirst, aOutLast, aOutTol; + TopoDS_Face aFFWD; + TopTools_IndexedMapOfShape aVMap; + BRep_Builder aBB; + // + aFFWD=aF; + aFFWD.Orientation(TopAbs_FORWARD); + // + aTolEdge=BRep_Tool::Tolerance(aE); + aTolFact=Max(aTolEdge, aTolR2D); + // + TopExp::MapShapes(aE, TopAbs_VERTEX, aVMap); + // + aTolVmax=-1.; + aNbV=aVMap.Extent(); + for (k=1; k<=aNbV; ++k) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k)); + aTolV=BRep_Tool::Tolerance(aV); + if (aTolV>aTolVmax) { + aTolVmax=aTolV; + } + } + // + if (aTolFact>aTolVmax) { + aTolFact=aTolVmax; + } + // + const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aTFirst, aTLast); + Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aTFirst, aTLast); + // + Handle(Geom2d_Curve) aC2D, aC2DA; + // + aC2D=aC2Dx; + if (aC2D.IsNull()) { + BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aFFWD); + BOPTools_Tools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, aOutTol, Standard_True); + } + if (aC3DE->IsPeriodic()) { + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aTFirst, aTLast, aC2D, aC2DA); + } + else { + BOPTools_Tools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); + } + // + aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolFact); + BRepLib::SameParameter(aE); +} + +//======================================================================= +// function: IsSplitInOnFace +// purpose: +//======================================================================= + Standard_Boolean NMTTools_Tools::IsSplitInOnFace(const TopoDS_Edge& aE, + const TopoDS_Face& aF, + IntTools_Context& aContext) +{ + Standard_Boolean bFlag; + Standard_Real aT, aTolE, aTolF, aTol, aDist, aU, aV; + gp_Pnt aP; + gp_Pnt2d aP2D; + // + aTolE=BRep_Tool::Tolerance(aE); + aTolF=BRep_Tool::Tolerance(aF); + aTol=aTolE+aTolF; + // + GeomAPI_ProjectPointOnSurf& aProjector=aContext.ProjPS(aF); + // + aT=BOPTools_Tools2D::IntermediatePoint(aE); + BOPTools_Tools::PointOnEdge(aE, aT, aP); + // + aProjector.Perform(aP); + bFlag=aProjector.IsDone(); + if (!bFlag) { + return bFlag; + } + // + aDist=aProjector.LowerDistance(); + bFlag=(aDist <= aTol); + if (!bFlag) { + return bFlag; + } + // + aProjector.LowerDistanceParameters(aU, aV); + aP2D.SetCoord(aU, aV); + bFlag=aContext.IsPointInOnFace (aF, aP2D); + return bFlag; +} +//======================================================================= +// function: NMTTools_Tools::MakeNewVertex +// purpose : +//======================================================================= + void NMTTools_Tools::MakeNewVertex(const TopTools_ListOfShape& aLVs, + TopoDS_Vertex& aNewVertex) +{ + Standard_Integer aNb; + Standard_Real aTi, aDi, aDmax=-1.e5; + gp_Pnt aPi, aP; + gp_XYZ aXYZ(0.,0.,0.), aXYZi; + TopTools_ListIteratorOfListOfShape anIt; + // + aNb=aLVs.Extent(); + if (!aNb) { + return; + } + // + anIt.Initialize(aLVs); + for (; anIt.More(); anIt.Next()) { + TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value()); + aPi=BRep_Tool::Pnt(aVi); + aXYZi=aPi.XYZ(); + aXYZ=aXYZ+aXYZi; + } + // + aXYZ.Divide((Standard_Real)aNb); + aP.SetXYZ(aXYZ); + // + anIt.Initialize(aLVs); + for (; anIt.More(); anIt.Next()) { + TopoDS_Vertex aVi=TopoDS::Vertex(anIt.Value()); + aPi=BRep_Tool::Pnt(aVi); + aTi=BRep_Tool::Tolerance(aVi); + aDi=aP.Distance(aPi); + aDi=aDi+aTi; + if (aDi > aDmax) { + aDmax=aDi; + } + } + BRep_Builder aBB; + aBB.MakeVertex (aNewVertex, aP, aDmax); +} +//======================================================================= +// function: FindChains +// purpose : +//======================================================================= + void NMTTools_Tools::FindChains(const BOPTools_CArray1OfSSInterference& FFs, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) +{ + Standard_Boolean bIsTangentFaces; + Standard_Integer j, aNb, anIndex1, anIndex2; + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV; + // + aNb=FFs.Extent(); + for (j=1; j<=aNb; ++j) { + const BOPTools_SSInterference& aFF=FFs(j); + // + bIsTangentFaces=aFF.IsTangentFaces(); + if (!bIsTangentFaces) { + continue; + } + // + aFF.Indices(anIndex1, anIndex2); + // + if (aMCV.Contains(anIndex1)) { + TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1); + aMV.Add(anIndex1); + aMV.Add(anIndex2); + } + else { + TColStd_IndexedMapOfInteger aMV; + aMV.Add(anIndex1); + aMV.Add(anIndex2); + aMCV.Add(anIndex1, aMV); + } + // + if (aMCV.Contains(anIndex2)) { + TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2); + aMV.Add(anIndex1); + aMV.Add(anIndex2); + } + else { + TColStd_IndexedMapOfInteger aMV; + aMV.Add(anIndex1); + aMV.Add(anIndex2); + aMCV.Add(anIndex2, aMV); + } + } + NMTTools_Tools::FindChains(aMCV, aMapChains); +} +//======================================================================= +// function: FindChains +// purpose : +//======================================================================= + void NMTTools_Tools::FindChains(const BOPTools_CArray1OfVVInterference& VVs, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) +{ + Standard_Integer j, aNb, anIndex1, anIndex2; + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMCV; + // + aNb=VVs.Extent(); + for (j=1; j<=aNb; ++j) { + const BOPTools_VVInterference& VV=VVs(j); + VV.Indices(anIndex1, anIndex2); + // + if (aMCV.Contains(anIndex1)) { + TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex1); + aMV.Add(anIndex1); + aMV.Add(anIndex2); + } + else { + TColStd_IndexedMapOfInteger aMV; + aMV.Add(anIndex1); + aMV.Add(anIndex2); + aMCV.Add(anIndex1, aMV); + } + // + if (aMCV.Contains(anIndex2)) { + TColStd_IndexedMapOfInteger& aMV=aMCV.ChangeFromKey(anIndex2); + aMV.Add(anIndex1); + aMV.Add(anIndex2); + } + else { + TColStd_IndexedMapOfInteger aMV; + aMV.Add(anIndex1); + aMV.Add(anIndex2); + aMCV.Add(anIndex2, aMV); + } + } + NMTTools_Tools::FindChains(aMCV, aMapChains); +} + +//======================================================================= +// function: FindChains +// purpose : +//======================================================================= + void NMTTools_Tools::FindChains(const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMapChains) +{ + Standard_Integer i, j, aNbCV, aNbV, iV, iVx; + TColStd_IndexedMapOfInteger aProcessed, aChain; + // + aNbCV=aMCV.Extent(); + for (i=1; i<=aNbCV; ++i) { + iV=aMCV.FindKey(i); + if (aProcessed.Contains(iV)) { + continue; + } + // + aProcessed.Add(iV); + aChain.Add(iV); + // + const TColStd_IndexedMapOfInteger& aMV=aMCV(i); + aNbV=aMV.Extent(); + for (j=1; j<=aNbV; ++j) { + iVx=aMV(j); + ProcessBlock(iVx, aMCV, aProcessed, aChain); + } + aMapChains.Add(i, aChain); + aChain.Clear(); + } +} +//======================================================================= +// function: ProcessBlock +// purpose: +//======================================================================= +void ProcessBlock(const Standard_Integer iV, + const BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger& aMCV, + TColStd_IndexedMapOfInteger& aProcessed, + TColStd_IndexedMapOfInteger& aChain) +{ + Standard_Integer j, aNbV, iVx; + // + if (aProcessed.Contains(iV)) { + return; + } + aProcessed.Add(iV); + aChain.Add(iV); + // + const TColStd_IndexedMapOfInteger& aMV=aMCV.FindFromKey(iV); + aNbV=aMV.Extent(); + for (j=1; j<=aNbV; ++j) { + iVx=aMV(j); + ProcessBlock(iVx, aMCV, aProcessed, aChain); + } +} +//======================================================================= +// function: AreFacesSameDomain +// purpose : +//======================================================================= + Standard_Boolean NMTTools_Tools::AreFacesSameDomain(const TopoDS_Face& aF1x, + const TopoDS_Face& aF2y, + IntTools_Context& aCtx) +{ + Standard_Boolean bFlag; + Standard_Integer i, aNbE1, aNbE2; + + TopTools_IndexedMapOfShape aME1, aME2; + TopoDS_Edge aEF1, aEF2; + TopoDS_Face aF1, aF2; + // + aF1=aF1x; + aF1.Orientation(TopAbs_FORWARD); + aF2=aF2y; + aF2.Orientation(TopAbs_FORWARD); + // + TopExp::MapShapes(aF1, TopAbs_EDGE, aME1); + TopExp::MapShapes(aF2, TopAbs_EDGE, aME2); + // + bFlag=Standard_False; + // + aNbE1=aME1.Extent(); + aNbE2=aME2.Extent(); + // + if(!aNbE1 || !aNbE2){ + return bFlag; + } + // + if(aNbE1!=aNbE2) { + return bFlag; + } + // + for (i=1; i<=aNbE1; ++i) { + const TopoDS_Edge& aE1=TopoDS::Edge(aME1(i)); + if (BRep_Tool::Degenerated(aE1)) { + // not try to compare deg edges because it + // can not have same TShape on different faces at all + continue; + } + if (!aME2.Contains(aE1)) { + return bFlag; + } + } + // + Standard_Real aTolF1, aTolF2, aTol; + gp_Pnt2d aP2D; + gp_Pnt aP; + TopExp_Explorer anExp; + // + aTolF1=BRep_Tool::Tolerance(aF1); + aTolF2=BRep_Tool::Tolerance(aF2); + aTol=aTolF1+aTolF2; + // + anExp.Init(aF1, TopAbs_EDGE); + for (; anExp.More(); anExp.Next()) { + const TopoDS_Edge& aE1=TopoDS::Edge(anExp.Current()); + if (!BRep_Tool::Degenerated(aE1)) { + BOPTools_Tools3D::PointNearEdge(aE1, aF1, aP2D, aP); + bFlag=aCtx.IsValidPointForFace(aP, aF2, aTol); + break; + } + } + return bFlag; + /* + // + Standard_Real aU1, aU2, aV1, aV2; + Standard_Real dU, dV, aU, aV; + Standard_Integer aNbP=5, aNbP1, j; + gp_Pnt2d aP2D; + gp_Pnt aP; + // + aTolF1=BRep_Tool::Tolerance(aF1); + aTolF2=BRep_Tool::Tolerance(aF2); + aTol=aTolF1+aTolF2; + // + BRepTools::UVBounds(aF1, aU1, aU2, aV1, aV2); + Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1); + // + aNbP1=aNbP+1; + dU=(aU2-aU1)/aNbP1; + dV=(aV2-aV1)/aNbP1; + // + for (i=1; i<=aNbP; ++i) { + aU=aU1+i*dU; + for (j=1; j<=aNbP; ++j) { + aV=aV1+j*dV; + aP2D.SetCoord(aU, aV); + // + if(aCtx.IsPointInFace(aF1, aP2D)) { + aP=aS1->Value(aU, aV); + bFlag=aCtx.IsValidPointForFace(aP, aF2, aTol); + if (!bFlag) { + return bFlag; + } + } + } + } + */ + // + return bFlag; +} +//======================================================================= +// function: FindChains +// purpose : +//======================================================================= + void NMTTools_Tools::FindChains(const NMTTools_ListOfCoupleOfShape& aLCS, + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) +{ + NMTTools_ListIteratorOfListOfCoupleOfShape aItCS; + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMCV; + // + aItCS.Initialize(aLCS); + for (; aItCS.More(); aItCS.Next()) { + const NMTTools_CoupleOfShape& aCS=aItCS.Value(); + // + const TopoDS_Shape& aF1=aCS.Shape1(); + const TopoDS_Shape& aF2=aCS.Shape2(); + // + // + if (aMCV.Contains(aF1)) { + TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF1); + aMV.Add(aF1); + aMV.Add(aF2); + } + else { + TopTools_IndexedMapOfShape aMV; + aMV.Add(aF1); + aMV.Add(aF2); + aMCV.Add(aF1, aMV); + } + // + if (aMCV.Contains(aF2)) { + TopTools_IndexedMapOfShape& aMV=aMCV.ChangeFromKey(aF2); + aMV.Add(aF1); + aMV.Add(aF2); + } + else { + TopTools_IndexedMapOfShape aMV; + aMV.Add(aF1); + aMV.Add(aF2); + aMCV.Add(aF2, aMV); + } + } + NMTTools_Tools::FindChains(aMCV, aMapChains); +} +//======================================================================= +// function: FindChains +// purpose : +//======================================================================= + void NMTTools_Tools::FindChains(const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, + NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains) +{ + Standard_Integer i, j, aNbCV, aNbV; + TopTools_IndexedMapOfShape aProcessed, aChain; + // + aNbCV=aMCV.Extent(); + for (i=1; i<=aNbCV; ++i) { + const TopoDS_Shape& aF=aMCV.FindKey(i); + if (aProcessed.Contains(aF)) { + continue; + } + // + aProcessed.Add(aF); + aChain.Add(aF); + // + const TopTools_IndexedMapOfShape& aMV=aMCV(i); + aNbV=aMV.Extent(); + for (j=1; j<=aNbV; ++j) { + const TopoDS_Shape& aFx=aMV(j); + ProcessBlock(aFx, aMCV, aProcessed, aChain); + } + aMapChains.Add(aF, aChain); + aChain.Clear(); + } +} +//======================================================================= +// function: ProcessBlock +// purpose: +//======================================================================= +void ProcessBlock(const TopoDS_Shape& aF, + const NMTTools_IndexedDataMapOfShapeIndexedMapOfShape& aMCV, + TopTools_IndexedMapOfShape& aProcessed, + TopTools_IndexedMapOfShape& aChain) +{ + Standard_Integer j, aNbV; + // + if (aProcessed.Contains(aF)) { + return; + } + aProcessed.Add(aF); + aChain.Add(aF); + // + const TopTools_IndexedMapOfShape& aMV=aMCV.FindFromKey(aF); + aNbV=aMV.Extent(); + for (j=1; j<=aNbV; ++j) { + const TopoDS_Shape& aFx=aMV(j); + ProcessBlock(aFx, aMCV, aProcessed, aChain); + } +} diff --git a/src/NMTTools/NMTTools_Tools.jxx b/src/NMTTools/NMTTools_Tools.jxx new file mode 100644 index 000000000..f39eecd53 --- /dev/null +++ b/src/NMTTools/NMTTools_Tools.jxx @@ -0,0 +1,55 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef _TopTools_ListOfShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfVVInterference_HeaderFile +#include +#endif +#ifndef _BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger_HeaderFile +#include +#endif +#ifndef _BOPTools_CArray1OfSSInterference_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _IntTools_Context_HeaderFile +#include +#endif +#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile +#include +#endif +#ifndef _NMTTools_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _Geom2d_Curve_HeaderFile +#include +#endif +#ifndef _NMTTools_Tools_HeaderFile +#include +#endif diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx new file mode 100644 index 000000000..0d024e7f3 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -0,0 +1,267 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_ArchimedeDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#include "OperationGUI_ArchimedeDlg.h" +#include "DlgRef_1Sel3Spin.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +//================================================================================= +// class : OperationGUI_ArchimedeDlg() +// purpose : Constructs a OperationGUI_ArchimedeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) +: GEOMBase_Skeleton( parent, "ArchimedeDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ARCHIMEDE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ARCHIMEDE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_WEIGHT")); + GroupPoints->TextLabel3->setText(tr("GEOM_WATER_DENSITY")); + GroupPoints->TextLabel4->setText(tr("GEOM_MESHING_DEFLECTION")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_ArchimedeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + /* Get setting of myStep value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double myStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + double SpecificStep1 = 0.1; + double SpecificStep2 = 0.01; + /* min, max, myStep and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, myStep, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, SpecificStep2, 3); + + GroupPoints->SpinBox_DX->SetValue( 100.0 ); + GroupPoints->SpinBox_DY->SetValue( 1.0 ); + GroupPoints->SpinBox_DZ->SetValue( 0.01 ); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_ARCHIMEDE" ) ); + + globalSelection( GEOM_ALLSHAPES ); + + SelectionIntoArgument(); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_ArchimedeDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void OperationGUI_ArchimedeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText( "" ); + myShape = GEOM::GEOM_Object::_nil(); + + if ( IObjectCount() != 1 ) + return; + + Standard_Boolean testResult = Standard_False; + myShape = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if ( !testResult || myShape->_is_nil() || !GEOMBase::IsShape( myShape ) ) + { + myShape = GEOM::GEOM_Object::_nil(); + return; + } + + myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) ); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + globalSelection( GEOM_ALLSHAPES ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_ArchimedeDlg::createOperation() +{ + return getGeomEngine()->GetILocalOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool OperationGUI_ArchimedeDlg::isValid( QString& ) +{ + return !myShape->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + double aWeight = GroupPoints->SpinBox_DX->GetValue(); + double aWaterDensity = GroupPoints->SpinBox_DY->GetValue(); + double aMeshDeflection = GroupPoints->SpinBox_DZ->GetValue(); + + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx new file mode 100644 index 000000000..79678b359 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -0,0 +1,708 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_ChamferDlg.cxx +// Author : Damien COQUERET +// Module : GEOM + +// $Header$ + +#include "OperationGUI_ChamferDlg.h" +#include "DlgRef_SpinBox.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" + +#include + +#include +#include "qpixmap.h" +#include + +#include "GEOMImpl_Types.hxx" + +//================================================================================= +// class : OperationGUI_ChamferDlg() +// purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent ) +: GEOMBase_Skeleton(parent, "ChamferDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + myConstructorId = -1; + + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); + QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); + + GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) ); + + RadioButton1->setPixmap( image1 ); + RadioButton2->setPixmap( image2 ); + RadioButton3->setPixmap( image3 ); + + // Create first group + + myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this ); + + QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 ); + aSelGrp1->setFrameStyle( QFrame::NoFrame ); + aSelGrp1->setInsideMargin( 0 ); + + createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 ); + + QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 ); + aSpinGrp->setFrameStyle( QFrame::NoFrame ); + aSpinGrp->setInsideMargin( 0 ); + + new QLabel( tr( "D" ), aSpinGrp ); + mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp ); + + ( new QFrame( myGrp1 ) )->setSizePolicy( + QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + // Create second group + + myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this ); + + QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 ); + aSelGrp2->setFrameStyle( QFrame::NoFrame ); + aSelGrp2->setInsideMargin( 0 ); + + createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 ); + createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 ); + createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 ); + + aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp2 ); + aSpinGrp->setFrameStyle( QFrame::NoFrame ); + aSpinGrp->setInsideMargin( 0 ); + + new QLabel( tr( "GEOM_D1" ), aSpinGrp ); + mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp ); + + new QLabel( tr( "GEOM_D2" ), aSpinGrp ); + mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp ); + + // Create third group + + myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this ); + + QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 ); + aSelGrp3->setFrameStyle( QFrame::NoFrame ); + aSelGrp3->setInsideMargin( 0 ); + + createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 ); + createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces ); + + aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp3 ); + aSpinGrp->setFrameStyle( QFrame::NoFrame ); + aSpinGrp->setInsideMargin( 0 ); + + new QLabel( tr( "GEOM_D1" ), aSpinGrp ); + mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp ); + + new QLabel( tr( "GEOM_D2" ), aSpinGrp ); + mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp ); + + ( new QLabel( myGrp3 ) )->setSizePolicy( + QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + // Add groups to layout + + Layout1->addWidget( myGrp1, 2, 0 ); + Layout1->addWidget( myGrp2, 2, 0 ); + Layout1->addWidget( myGrp3, 2, 0 ); + + // Set range of spinboxes + + double SpecificStep = 10.0; + QMap< int, DlgRef_SpinBox* >::iterator anIter; + for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) + anIter.data()->RangeStepAndValidator( 0.001, 999.999, SpecificStep, 3 ); + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_ChamferDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::Init() +{ + myConstructorId = -1; + reset(); + RadioButton1->setChecked( true ); + myEditCurrentArgument = mySelName[ MainObj1 ]; + + /* signals and slots connections */ + + // main buttons + connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + // group box + connect( GroupConstructors, SIGNAL( clicked( int ) ), + this, SLOT( ConstructorsClicked( int ) ) ); + + // push buttons + QMap< int, QPushButton* >::iterator anIterBtn; + for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) + connect( anIterBtn.data(), SIGNAL( clicked() ), + this, SLOT( SetEditCurrentArgument() ) ); + + // line edits + QMap< int, QLineEdit* >::iterator anIterLE2; + for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 ) + connect( anIterLE2.data(), SIGNAL( returnPressed() ), + this, SLOT( LineEditReturnPressed() ) ); + + // spin boxes + QMap< int, DlgRef_SpinBox* >::iterator anIterSpin; + for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin ) + connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ), + this, SLOT( ValueChangedInSpinBox( double ) ) ); + + // selection + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + initName( tr( "GEOM_CHAMFER" ) ); + + myGrp2->hide(); + myGrp3->hide(); + myGrp1->show(); + + this->show(); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId ) +{ + // Activate next widget + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) + { + RadioButton1->setChecked( true ); + return; + } + + if ( myConstructorId == constructorId ) + return; + + // Get values from previous widget + double D1 = 5, D2 = 5; + if ( myConstructorId == 0 ) + D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue(); + else if ( myConstructorId == 1 ) + { + D1 = mySpinBox[ SpinBox21 ]->GetValue(); + D2 = mySpinBox[ SpinBox22 ]->GetValue(); + } + else if ( myConstructorId == 2 ) + { + D1 = mySpinBox[ SpinBox31 ]->GetValue(); + D2 = mySpinBox[ SpinBox32 ]->GetValue(); + } + + myConstructorId = constructorId; + + switch ( constructorId ) + { + case 0: + myGrp1->show(); + myGrp2->hide(); + myGrp3->hide(); + mySpinBox[ SpinBox1 ]->SetValue( D1 ); + break; + case 1: + myGrp1->hide(); + myGrp2->show(); + myGrp3->hide(); + mySpinBox[ SpinBox21 ]->SetValue( D1 ); + mySpinBox[ SpinBox22 ]->SetValue( D2 ); + break; + case 2: + myGrp1->hide(); + myGrp2->hide(); + myGrp3->show(); + mySpinBox[ SpinBox31 ]->SetValue( D1 ); + mySpinBox[ SpinBox32 ]->SetValue( D2 ); + break; + default: + break; + } + + if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ]; + else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ]; + else myEditCurrentArgument = mySelName[ MainObj3 ]; + + activateSelection(); + enableWidgets(); + + if ( !myShape->_is_nil() ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) ); + GEOMBase_Skeleton::LineEditReturnPressed(); + } + else + myEditCurrentArgument->setText( "" ); + + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_ChamferDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void OperationGUI_ChamferDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText( "" ); + + // Get index of current selection focus + int aCurrFocus = -1; + QMap< int, QLineEdit* >::iterator anIter; + for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) + if ( myEditCurrentArgument == anIter.data() ) + { + aCurrFocus = anIter.key(); + break; + } + + // If selection of main object is activated + if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) + { + if ( IObjectCount() == 1 ) + { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + { + myShape = anObj; + mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) ); + displayPreview(); + enableWidgets(); + return; + } + } + + myShape = GEOM::GEOM_Object::_nil(); + enableWidgets(); + } + // If face selection of second tab is activated + else if ( aCurrFocus == Face1 || aCurrFocus == Face2 ) + { + if ( IObjectCount() == 1 ) + { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + { + TColStd_IndexedMapOfInteger anIndexes; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + + if ( anIndexes.Extent() == 1 ) + { + int anIndex = anIndexes( 1 ); + QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1"; + myEditCurrentArgument->setText( aFaceName.arg( anIndex ) ); + myFace[ aCurrFocus ] = anIndex; + displayPreview(); + return; + } + } + } + + myFace[ aCurrFocus ] = -1; + } + // If face selection of third tab is activated + else if ( aCurrFocus == Faces ) + { + if ( IObjectCount() == 1 ) + { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + { + TColStd_IndexedMapOfInteger anIndexes; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + + if ( anIndexes.Extent() > 0 ) + { + QString aFaceName; + if ( anIndexes.Extent() == 1 ) + { + int anIndex = anIndexes( 1 ); + + aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); + } + else + aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() ); + + myEditCurrentArgument->setText( aFaceName ); + myFaces = anIndexes; + displayPreview(); + return; + } + } + } + myFaces.Clear(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::LineEditReturnPressed() +{ + QLineEdit* aSender = ( QLineEdit* )sender(); + + QMap< int, QLineEdit* >::iterator anIterLE; + for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) + if ( anIterLE.data() == aSender ) + myEditCurrentArgument = anIterLE.data(); + + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::SetEditCurrentArgument() +{ + QPushButton* aSender = ( QPushButton* )sender(); + + QMap< int, QPushButton* >::iterator anIter; + for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) + if ( anIter.data() == aSender ) + { + mySelName[ anIter.key() ]->setFocus(); + myEditCurrentArgument = mySelName[ anIter.key() ]; + } + + activateSelection(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::DeactivateActiveDialog() +{ + // disconnect selection + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) ); + + activateSelection(); + displayPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + this->ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) +{ + displayPreview(); +} + + +//================================================================================= +// function : createSelWg() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl, + QPixmap& thePix, + QWidget* theParent, + const int theId ) +{ + new QLabel( theLbl, theParent ); + mySelBtn[ theId ] = new QPushButton( theParent ); + mySelBtn[ theId ]->setPixmap( thePix ); + mySelName[ theId ] = new QLineEdit( theParent ); + mySelName[ theId ]->setReadOnly( true ); +} + +//================================================================================= +// function : reset() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::reset() +{ + // Set Initial values of spinboxes + QMap< int, DlgRef_SpinBox* >::iterator anIter; + for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) + anIter.data()->SetValue( 5 ); + + // clear line edits + QMap< int, QLineEdit* >::iterator anIterLE; + for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) + anIterLE.data()->setText( "" ); + + // constructor id + int aConstructorId = getConstructorId(); + + if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ]; + else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ]; + else myEditCurrentArgument = mySelName[ MainObj3 ]; + + myShape = GEOM::GEOM_Object::_nil(); + + myFaces.Clear(); + myFace[ Face1 ] = -1; + myFace[ Face2 ] = -1; + + erasePreview( true ); + + activateSelection(); + + enableWidgets(); +} + +//================================================================================= +// function : getConstructorId() +// purpose : +//================================================================================= +int OperationGUI_ChamferDlg::getConstructorId() const +{ + return GroupConstructors->id( GroupConstructors->selected() ); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void OperationGUI_ChamferDlg::activateSelection() +{ + if ( !myShape->_is_nil() && + ( myEditCurrentArgument == mySelName[ Face1 ] || + myEditCurrentArgument == mySelName[ Face2 ] || + myEditCurrentArgument == mySelName[ Faces ] ) ) + localSelection( myShape, TopAbs_FACE ); + else + { + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_SOLID ); + aMap.Add( GEOM_COMPOUND ); + globalSelection( aMap ); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : enableWidgets +// purpose : Enable widgets of faces in accordance with value of main object +//================================================================================= +void OperationGUI_ChamferDlg::enableWidgets() +{ + int anId = getConstructorId(); + + bool toEnable = !myShape->_is_nil(); + + if ( anId == 1 ) + { + mySelName[ Face1 ]->setEnabled( toEnable ); + mySelName[ Face2 ]->setEnabled( toEnable ); + mySelBtn[ Face1 ]->setEnabled( toEnable ); + mySelBtn[ Face2 ]->setEnabled( toEnable ); + + if ( !toEnable ) + { + mySelName[ Face1 ]->setText( "" ); + mySelName[ Face2 ]->setText( "" ); + myFace[ Face1 ] = -1; + myFace[ Face2 ] = -1; + } + } + else if ( anId == 2 ) + { + mySelName[ Faces ]->setEnabled( toEnable ); + + if ( !toEnable ) + myFaces.Clear(); + } +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation() +{ + return getGeomEngine()->GetILocalOperations( getStudyId() ); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : Verify validity of input data +//================================================================================= +bool OperationGUI_ChamferDlg::isValid( QString& ) +{ + switch ( getConstructorId() ) + { + case 0: return !myShape->_is_nil(); + case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0; + case 2: return !myShape->_is_nil() && myFaces.Extent() > 0; + default: return false; + } +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_ChamferDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + int anId = getConstructorId(); + if ( anId == 0 ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferAll( myShape, + mySpinBox[ SpinBox1 ]->GetValue() ); + else if ( anId == 1 ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferEdge( myShape, + mySpinBox[ SpinBox21 ]->GetValue(), + mySpinBox[ SpinBox22 ]->GetValue(), + myFace[ Face1 ], + myFace[ Face2 ] ); + else if ( anId == 2 ) + { + + int i = 0; + GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; + anArray->length( myFaces.Extent() ); + + + for ( int i = 1, n = myFaces.Extent(); i <= n; i++ ) + anArray[ i - 1 ] = myFaces( i ); + + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferFaces( myShape, + mySpinBox[ SpinBox31 ]->GetValue(), + mySpinBox[ SpinBox32 ]->GetValue(), + anArray ); + } + + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + + + + + + + + + diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx new file mode 100644 index 000000000..191eb88c2 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -0,0 +1,403 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_ClippingDlg.cxx +// Author : Michael Zorin +// Module : GEOM +// $Header: + +#include "OperationGUI_ClippingDlg.h" +#include "DlgRef_SpinBox.h" + +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "SVTK_ViewWindow.h" +#include "SVTK_ViewModel.h" +#include "OCCViewer_ViewWindow.h" +#include "OCCViewer_ViewPort3d.h" + +#include "utilities.h" +#include +#include + +//#include + +// QT Includes +#include +#include +#include +#include +#include + +// VTK Includes +#include +#include + +//================================================================================= +// class : OperationGUI_ClippingDlg() +// purpose : +//================================================================================= +OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : GEOMBase_Skeleton( parent, "OperationGUI_ClippingDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + setCaption( tr( "Change clipping range" ) ); + + GroupConstructors->close(); + GroupBoxName->close(); + + /***************************************************************/ + GroupArguments = new QGroupBox( this, "GroupArguments" ); + GroupArguments->setColumnLayout(0, Qt::Vertical ); + GroupArguments->layout()->setSpacing( 0 ); + GroupArguments->layout()->setMargin( 0 ); + QGridLayout* GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() ); + GroupArgumentsLayout->setAlignment( Qt::AlignTop ); + GroupArgumentsLayout->setSpacing( 6 ); + GroupArgumentsLayout->setMargin( 11 ); + + // Controls + TextLabelNear = new QLabel( GroupArguments, "TextLabelNear" ); + TextLabelNear->setText( tr( "Near" ) ); + TextLabelNear->setFixedWidth(74); + GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 ); + + SpinBox_Near = new DlgRef_SpinBox( GroupArguments, "SpinBox_Near"); + GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 ); + + TextLabelFar = new QLabel( GroupArguments, "TextLabelFar" ); + TextLabelFar->setText( tr( "Far" ) ); + TextLabelFar->setFixedWidth(74); + GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 ); + + SpinBox_Far = new DlgRef_SpinBox( GroupArguments, "SpinBox_Far"); + GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 ); + + resetButton = new QPushButton( GroupArguments, "resetButton" ); + resetButton->setText( tr( "Reset" ) ); + GroupArgumentsLayout->addWidget( resetButton, 0, 4 ); + + TypeCB = new QComboBox( GroupArguments, "TypeCB" ); + TypeCB->insertItem(tr("OFF")); + TypeCB->insertItem(tr("BACK")); + TypeCB->insertItem(tr("FRONT")); + TypeCB->insertItem(tr("SLICE")); + GroupArgumentsLayout->addMultiCellWidget( TypeCB, 1, 1, 0, 4 ); + + Layout1->addWidget( GroupArguments, 2, 0 ); + + /* Initialisations */ + SpinBox_Near->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 ); + SpinBox_Far->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 ); + + //GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI(); + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + connect( resetButton, SIGNAL (clicked() ), this, SLOT( onReset() ) ) ; + + // connect( aGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ) ; + //connect( aGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + Init(); +} + +//================================================================================= +// function : ~ OperationGUI_ClippingDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ClippingDlg::~ OperationGUI_ClippingDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::Init() +{ + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return; + + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) + { + SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + if( !aVTKFrame ) + return; + + TextLabelNear->setText( tr( "Near" ) ); + TextLabelFar->setText( tr( "Far" ) ); + + TypeCB->hide(); + + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); + if(!aRenderer) return; + + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); + if( anActiveCamera == NULL ){ + MESSAGE("Trying to reset clipping range of non-existant camera"); + return; + } + + // Find the plane equation for the camera view plane + double vn[3]; + anActiveCamera->GetViewPlaneNormal(vn); + double position[3]; + anActiveCamera->GetPosition(position); + + float bounds[6]; + aRenderer->ComputeVisiblePropBounds(bounds); + + double center[3]; + center[0] = (bounds[0] + bounds[1])/2.0; + center[1] = (bounds[2] + bounds[3])/2.0; + center[2] = (bounds[4] + bounds[5])/2.0; + + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); + + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + + (position[1]-center[1])*(position[1]-center[1]) + + (position[2]-center[2])*(position[2]-center[2])); + + float range[2] = {distance - width/2.0, distance + width/2.0}; + + SpinBox_Near->SetValue(range[0]); + SpinBox_Far->SetValue(range[1]); + + return; + } + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) + { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + + TextLabelNear->setText( tr( "Depth" ) ); + TextLabelFar->setText( tr( "Thickness" ) ); + + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); + + double depth, thickness; + int ztype= view3d->ZClipping(depth, thickness); + SpinBox_Near->SetValue(depth); + SpinBox_Far->SetValue(thickness); + TypeCB->setCurrentItem(ztype); + + //Handle(V3d_Plane) aPlane = new V3d_Plane( aOCCFrame->getViewer()->getViewer3d() ,0, 0, 1, -100); + //aPlane->Display(view3d); + } +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_ClippingDlg::ClickOnApply() +{ + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return false; + + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) + { + SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + if( !aVTKFrame ) + return false; + + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); + if(!aRenderer) return false; + + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); + if( anActiveCamera == NULL ){ + MESSAGE("Trying to reset clipping range of non-existant camera"); + return false; + } + + float range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() }; + if (range[0] < 0.0) range[0] = 0.0; + anActiveCamera->SetClippingRange( range ); + + return true; + } + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) + { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); + + double depth = SpinBox_Near->GetValue(); + double thickness = SpinBox_Far->GetValue(); + int aType = TypeCB->currentItem(); + + view3d->SetZClippingType(V3d_TypeOfZclipping(aType)); + view3d->SetZClippingDepth(depth); + view3d->SetZClippingWidth(thickness); + } + + return true; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::ClickOnOk() +{ + ClickOnApply(); + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : onActivate() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::onActivate() +{ + GEOMBase_Skeleton::ActivateThisDialog(); +} + + +//================================================================================= +// function : onDeactivate() +// purpose : public slot to deactivate if active +//================================================================================= +void OperationGUI_ClippingDlg::DeactivateActiveDialog() +{ + return; +} + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::enterEvent(QEvent* e) +{ + this->setEnabled(true); + return; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::closeEvent( QCloseEvent* e ) +{ + QDialog::closeEvent( e ); +} + + +//================================================================================= +// function : onReset() +// purpose : +//================================================================================= +void OperationGUI_ClippingDlg::onReset() +{ + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return; + + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) + { + SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + if( !aVTKFrame ) + return; + + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); + if(!aRenderer) return; + + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); + if( anActiveCamera == NULL ){ + MESSAGE("Trying to reset clipping range of non-existant camera"); + return; + } + + // Find the plane equation for the camera view plane + double vn[3]; + anActiveCamera->GetViewPlaneNormal(vn); + double position[3]; + anActiveCamera->GetPosition(position); + + float bounds[6]; + aRenderer->ComputeVisiblePropBounds(bounds); + + double center[3]; + center[0] = (bounds[0] + bounds[1])/2.0; + center[1] = (bounds[2] + bounds[3])/2.0; + center[2] = (bounds[4] + bounds[5])/2.0; + + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); + + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + + (position[1]-center[1])*(position[1]-center[1]) + + (position[2]-center[2])*(position[2]-center[2])); + + float range[2] = {distance - width/2.0, distance + width/2.0}; + + SpinBox_Near->SetValue(range[0]); + SpinBox_Far->SetValue(range[1]); + + return; + } + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) + { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + + TextLabelNear->setText( tr( "Depth" ) ); + TextLabelFar->setText( tr( "Thickness" ) ); + + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); + + view3d->SetZClippingType(V3d_TypeOfZclipping(0)); + view3d->ZFitAll(); + double depth, thickness; + int ztype= view3d->ZClipping(depth, thickness); + SpinBox_Near->SetValue(0); + SpinBox_Far->SetValue(1000); + TypeCB->setCurrentItem(ztype); + } + + + + return; +} diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx new file mode 100644 index 000000000..583aad057 --- /dev/null +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -0,0 +1,635 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_FilletDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "OperationGUI_FilletDlg.h" +#include "DlgRef_1Sel1Spin.h" +#include "DlgRef_2Sel1Spin.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" + +#include "qlabel.h" +#include "qpixmap.h" +#include +#include +#include + +#include "GEOMImpl_Types.hxx" + +//================================================================================= +// class : OperationGUI_FilletDlg() +// purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent ) + :GEOMBase_Skeleton( parent, "OperationGUI_FilletDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + myConstructorId = -1; + + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_FACE" ) ) ); + + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + + setCaption( tr( "GEOM_FILLET_TITLE" ) ); + + /***************************************************************/ + GroupConstructors->setTitle( tr( "GEOM_FILLET" ) ); + RadioButton1->setPixmap( image0 ); + RadioButton2->setPixmap( image1 ); + RadioButton3->setPixmap( image2 ); + + Group1 = new DlgRef_1Sel1Spin( this, "Group1" ); + Group1->GroupBox1->setTitle( tr( "GEOM_FILLET_ALL" ) ); + Group1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + Group1->TextLabel2->setText( tr( "GEOM_RADIUS" ) ); + Group1->PushButton1->setPixmap( iconSelect ); + Group1->LineEdit1->setReadOnly( true ); + + Group2 = new DlgRef_2Sel1Spin( this, "Group2" ); + Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) ); + Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); + Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) ); + Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); + Group2->PushButton1->setPixmap( iconSelect ); + Group2->PushButton2->setPixmap( iconSelect ); + Group2->LineEdit1->setReadOnly( true ); + Group2->LineEdit2->setReadOnly( true ); + + Group3 = new DlgRef_2Sel1Spin( this, "Group3" ); + Group3->GroupBox1->setTitle(tr( "GEOM_FILLET_FACES" ) ); + Group3->TextLabel1->setText(tr( "GEOM_MAIN_OBJECT" ) ); + Group3->TextLabel2->setText(tr( "SELECTED_FACES" ) ); + Group3->TextLabel3->setText(tr( "GEOM_RADIUS" ) ); + Group3->PushButton1->setPixmap( iconSelect ); + Group3->PushButton2->setPixmap( iconSelect ); + Group3->LineEdit1->setReadOnly( true ); + Group3->LineEdit2->setReadOnly( true ); + + Layout1->addWidget( Group1, 2, 0 ); + Layout1->addWidget( Group2, 2, 0 ); + Layout1->addWidget( Group3, 2, 0 ); + /***************************************************************/ + + double SpecificStep = 10.0; + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + + /* Initialisations */ + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_FilletDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_FilletDlg::~OperationGUI_FilletDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::Init() +{ + myConstructorId = -1; + reset(); + RadioButton1->setChecked( true ); + myEditCurrentArgument = Group1->LineEdit1; + + // main buttons + connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + + // group box + connect( GroupConstructors, SIGNAL( clicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); + + // push buttons + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + // line edits + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + // spin boxes + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + // selection + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + + + initName( tr( "GEOM_FILLET" ) ); + + Group2->hide(); + Group3->hide(); + Group1->show(); + + this->show(); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId ) +{ + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) + { + RadioButton1->setChecked( true ); + return; + } + + if ( myConstructorId == constructorId ) + return; + + // Get radius from previous widget + double R = 5; + if ( myConstructorId == 0 ) R = Group1->SpinBox_DX->GetValue(); + else if ( myConstructorId == 1 ) R = Group2->SpinBox_DX->GetValue(); + else R = Group3->SpinBox_DX->GetValue(); + + myConstructorId = constructorId; + + switch ( constructorId ) + { + case 0: + Group1->show(); + Group2->hide(); + Group3->hide(); + Group1->SpinBox_DX->SetValue( R ); + break; + case 1: + Group1->hide(); + Group2->show(); + Group3->hide(); + Group2->SpinBox_DX->SetValue( R ); + break; + case 2: + Group1->hide(); + Group2->hide(); + Group3->show(); + Group3->SpinBox_DX->SetValue( R ); + break; + default: + break; + } + + if ( constructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1; + else if ( constructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1; + else myEditCurrentArgument = Group3->LineEdit1; + + activateSelection(); + enableWidgets(); + + if ( !myShape->_is_nil() ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) ); + GEOMBase_Skeleton::LineEditReturnPressed(); + } + else + myEditCurrentArgument->setText( "" ); + + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool OperationGUI_FilletDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + return true; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void OperationGUI_FilletDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText( "" ); + + // If selection of main object is activated + if ( myEditCurrentArgument == Group1->LineEdit1 || + myEditCurrentArgument == Group2->LineEdit1 || + myEditCurrentArgument == Group3->LineEdit1 ) + { + if ( IObjectCount() == 1 ) + { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + { + myShape = anObj; + myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); + displayPreview(); + enableWidgets(); + return; + } + } + + myShape = GEOM::GEOM_Object::_nil(); + enableWidgets(); + } + // If face or edge selection is activated + else if ( myEditCurrentArgument == Group2->LineEdit2 || + myEditCurrentArgument == Group3->LineEdit2 ) + { + if ( IObjectCount() == 1 ) + { + Standard_Boolean aResult = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); + + if ( aResult && !anObj->_is_nil() ) + { + TColStd_IndexedMapOfInteger anIndexes; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); + + if ( anIndexes.Extent() > 0 ) + { + QString aName; + if ( anIndexes.Extent() == 1 ) + { + int anIndex = anIndexes( 1 ); + + aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); + } + else + aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() ); + + myEditCurrentArgument->setText( aName ); + + if ( myConstructorId == 1 ) + myEdges = anIndexes; + else + myFaces = anIndexes; + + displayPreview(); + return; + } + } + } + myFaces.Clear(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::LineEditReturnPressed() +{ + QLineEdit* send = ( QLineEdit* )sender(); + + if ( send == Group1->LineEdit1 ) + myEditCurrentArgument = Group1->LineEdit1; + else if ( send == Group2->LineEdit1 ) + myEditCurrentArgument = Group2->LineEdit1; + else if ( send == Group3->LineEdit1 ) + myEditCurrentArgument = Group3->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if ( send == Group1->PushButton1 ) + { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if( send == Group2->PushButton1 ) + { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; + } + else if( send == Group2->PushButton2 ) + { + Group2->LineEdit2->setFocus(); + myEditCurrentArgument = Group2->LineEdit2; + } + else if ( send == Group3->PushButton1 ) + { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit1; + } + else if( send == Group3->PushButton2 ) + { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit2; + } + + activateSelection(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) ); + + activateSelection(); + displayPreview(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::enterEvent( QEvent* e ) +{ + if ( !GroupConstructors->isEnabled() ) + this->ActivateThisDialog(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ValueChangedInSpinBox( double newValue ) +{ + displayPreview(); +} + +//================================================================================= +// function : reset() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::reset() +{ + // Set Initial values of spinboxes + Group1->SpinBox_DX->SetValue( 5 ); + Group2->SpinBox_DX->SetValue( 5 ); + Group3->SpinBox_DX->SetValue( 5 ); + + Group1->LineEdit1->setText( "" ); + Group2->LineEdit1->setText( "" ); + Group2->LineEdit2->setText( "" ); + Group3->LineEdit1->setText( "" ); + Group3->LineEdit2->setText( "" ); + + // constructor id + int aConstructorId = getConstructorId(); + + if ( aConstructorId == 0 ) myEditCurrentArgument = Group1->LineEdit1; + else if ( aConstructorId == 1 ) myEditCurrentArgument = Group2->LineEdit1; + else myEditCurrentArgument = Group3->LineEdit1; + + myShape = GEOM::GEOM_Object::_nil(); + + myFaces.Clear(); + myEdges.Clear(); + + erasePreview( true ); + + activateSelection(); + + enableWidgets(); +} + +//================================================================================= +// function : getConstructorId() +// purpose : +//================================================================================= +int OperationGUI_FilletDlg::getConstructorId() const +{ + return GroupConstructors->id( GroupConstructors->selected() ); +} + +//================================================================================= +// function : activateSelection +// purpose : Activate selection in accordance with myEditCurrentArgument +//================================================================================= +void OperationGUI_FilletDlg::activateSelection() +{ + + if ( !myShape->_is_nil() && myEditCurrentArgument == Group2->LineEdit2 ) + localSelection( myShape, TopAbs_EDGE ); + else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 ) + localSelection( myShape, TopAbs_FACE ); + else + { + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_SOLID ); + aMap.Add( GEOM_COMPOUND ); + globalSelection( aMap ); + } + + SelectionIntoArgument(); +} + +//================================================================================= +// function : enableWidgets +// purpose : Enable widgets of faces in accordance with value of main object +//================================================================================= +void OperationGUI_FilletDlg::enableWidgets() +{ + int anId = getConstructorId(); + + bool toEnable = !myShape->_is_nil(); + + if ( anId == 1 ) + { + Group2->LineEdit2->setEnabled( toEnable ); + Group2->PushButton2->setEnabled( toEnable ); + + if ( !toEnable ) + { + Group2->LineEdit2->setText( "" ); + myEdges.Clear(); + } + } + else if ( anId == 2 ) + { + Group3->LineEdit2->setEnabled( toEnable ); + Group3->PushButton2->setEnabled( toEnable ); + + if ( !toEnable ) + { + Group3->LineEdit2->setText( "" ); + myFaces.Clear(); + } + } +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation() +{ + return getGeomEngine()->GetILocalOperations( getStudyId() ); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : Verify validity of input data +//================================================================================= +bool OperationGUI_FilletDlg::isValid( QString& ) +{ + switch ( getConstructorId() ) + { + case 0: return !myShape->_is_nil(); + case 1: return !myShape->_is_nil() && myEdges.Extent() > 0; + case 2: return !myShape->_is_nil() && myFaces.Extent() > 0; + default: return false; + } +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_FilletDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj; + + int anId = getConstructorId(); + if ( anId == 0 ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletAll( myShape, + getRadius() ); + else if ( anId == 1 ) + { + GEOM::ListOfLong_var aList = new GEOM::ListOfLong; + aList->length( myEdges.Extent() ); + + for ( int i = 1, n = myEdges.Extent(); i <= n; i++ ) + aList[ i - 1 ] = myEdges( i ); + + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletEdges( myShape, getRadius(), aList ); + } + else if ( anId == 2 ) + { + int i = 0; + GEOM::ListOfLong_var aList = new GEOM::ListOfLong; + aList->length( myFaces.Extent() ); + + for ( int i = 1, n = myFaces.Extent(); i <= n; i++ ) + aList[ i - 1 ] = myFaces( i ); + + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletFaces( myShape, getRadius(), aList ); + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return true; +} + +//================================================================================= +// function : getRadius +// purpose : Get radius +//================================================================================= +double OperationGUI_FilletDlg::getRadius() const +{ + int anId = getConstructorId(); + if ( anId == 0 ) return Group1->SpinBox_DX->GetValue(); + else if ( anId == 1 ) return Group2->SpinBox_DX->GetValue(); + else return Group3->SpinBox_DX->GetValue(); +} + + + + + + + diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.cxx b/src/OperationGUI/OperationGUI_MaterialDlg.cxx new file mode 100644 index 000000000..b3055d38d --- /dev/null +++ b/src/OperationGUI/OperationGUI_MaterialDlg.cxx @@ -0,0 +1,238 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_MaterialDlg.cxx +// Author : Julia DOROVSKIKH +// Module : GEOM +// $Header$ + +#include "OperationGUI_MaterialDlg.h" +#include "OperationGUI_PartitionDlg.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include "utilities.h" + +#include +#include +#include + +using namespace std; + +//================================================================================= +// class : OperationGUI_MaterialDlg() +// purpose : Constructs a OperationGUI_MaterialDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_MaterialDlg::OperationGUI_MaterialDlg (QWidget* parent, const char* name, + GEOM::ListOfGO ListShapes, + bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + myListShapes = ListShapes; + myParentDlg = parent; + + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); + + setCaption(tr("GEOM_MATERIAL_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PARTITION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1List1Spin1Btn_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); + + myShapeCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_SHAPE")); + myMaterCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_MATERIAL")); + GroupPoints->ListView1->setSelectionMode(QListView::Extended); + + GroupPoints->TextLabel1->setText(tr("GEOM_MATERIAL_ID")); + GroupPoints->PushButton1->setText(tr("GEOM_MATERIAL_SET")); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_MaterialDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_MaterialDlg::~OperationGUI_MaterialDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_MaterialDlg::Init() +{ + // get materials list from the parent dialog + OperationGUI_PartitionDlg* aParentDlg = + dynamic_cast(myParentDlg); + if (aParentDlg) + myListMaterials = aParentDlg->GetListMaterials(); + + /* list filling */ + MESSAGE("Filling list with " << myListShapes.length() << " objects"); + QString aMaterialId; + for (int ind = 0; ind < myListShapes.length(); ind++) { + GEOM::GEOM_Object_var anObject = myListShapes[ind]; + if (!anObject->_is_nil()) { + MESSAGE("Insert " << GEOMBase::GetName( anObject )); + if (ind < myListMaterials.length()) + aMaterialId = QString::number(myListMaterials[ind]); + else + aMaterialId = "0"; + QListViewItem* aItem = + new QListViewItem(GroupPoints->ListView1, GEOMBase::GetName( anObject ), aMaterialId); + } + } + MESSAGE("Filled"); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + buttonApply->close(TRUE); + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetMaterial())); + +// connect(GroupPoints->ListView1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); +// connect(GroupPoints->SpinBox1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + MESSAGE("GroupPoints->show() ..."); + GroupPoints->show(); + MESSAGE("this->show() ..."); + this->show(); + MESSAGE("return"); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_MaterialDlg::ClickOnOk() +{ + SUIT_Session::session()->activeApplication()->putInfo(tr("")); + + int nbSh = myListShapes.length(); + myListMaterials.length(nbSh); + + QListViewItemIterator it (GroupPoints->ListView1); + for (int i = 0; it.current() != 0; it++, i++) { + QString aMatIdStr = it.current()->text(myMaterCol); + myListMaterials[i] = aMatIdStr.toInt(); + MESSAGE("For shape # " << i << " material ID = " << myListMaterials[i]); + } + + // set materials list to the parent dialog + OperationGUI_PartitionDlg* aParentDlg = + dynamic_cast(myParentDlg); + if (aParentDlg) + { + aParentDlg->SetListMaterials(myListMaterials); + } + + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void OperationGUI_MaterialDlg::SelectionIntoArgument() +{ + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(selectedIO(), aString); + if(nbSel < 1) { + return; + } + + //myGeomBase->ConvertListOfIOInListOfIOR(selectedIO(), myListShapes); + + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetMaterial() +// purpose : +//================================================================================= +void OperationGUI_MaterialDlg::SetMaterial() +{ + int aMatId = GroupPoints->SpinBox1->value(); + QString aMatIdStr; + aMatIdStr.setNum(aMatId); + QListViewItemIterator it (GroupPoints->ListView1); + for (; it.current() != 0; it++) { + if (it.current()->isSelected()) + it.current()->setText(myMaterCol, aMatIdStr); + } + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_MaterialDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_MaterialDlg::enterEvent(QEvent* e) +{ + if(!GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx new file mode 100644 index 000000000..9315616f4 --- /dev/null +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -0,0 +1,554 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : OperationGUI_PartitionDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "OperationGUI_PartitionDlg.h" +#include "OperationGUI_MaterialDlg.h" + +#include "GEOMImpl_Types.hxx" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include +#include + +#include "utilities.h" + +//================================================================================= +// class : OperationGUI_PartitionDlg() +// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION_PLANE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PARTITION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PARTITION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + // Full partition (contains half-space partition) + GroupPoints = new DlgRef_4Sel1List1Check_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); + GroupPoints->GroupBox2->setTitle(tr("SUPPRESS_RESULT")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); + GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT")); + GroupPoints->TextLabel4->setText(tr("GEOM_SUPPRESS_RESULT_INSIDE")); + GroupPoints->TextLabel5->setText(tr("GEOM_SUPPRESS_RESULT_OUTSIDE")); + GroupPoints->CheckBox1->setText(tr("GEOM_REMOVE_WEBS")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + GroupPoints->PushButton3->setPixmap(image2); + GroupPoints->PushButton4->setPixmap(image2); + GroupPoints->PushButton5->setText(tr("GEOM_SET_MATERIALS")); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit3->setReadOnly( true ); + GroupPoints->LineEdit4->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_PartitionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::Init() +{ + /* type for sub shape selection */ + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX")); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetMaterials())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onRemoveWebs(bool))); + + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_PARTITION" ) ); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + globalSelection(); + + myListShapes.length(0); + myListTools.length(0); + myListKeepInside.length(0); + myListRemoveInside.length(0); + myListMaterials.length(0); + + switch (constructorId) + { + case 0: /*Full partition */ + { + GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); + GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); + resize(0, 0); + GroupPoints->TextLabel3->show(); + GroupPoints->ComboBox1->show(); + GroupPoints->GroupBox2->show(); + + GroupPoints->ComboBox1->setCurrentItem(0); + GroupPoints->LineEdit3->clear(); + GroupPoints->LineEdit4->clear(); + break; + } + case 1: /*Half-space partition */ + { + + GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION_HALFSPACE")); + GroupPoints->GroupBox2->hide(); + GroupPoints->TextLabel3->hide(); + GroupPoints->ComboBox1->hide(); + GroupPoints->TextLabel2->setText(tr("GEOM_PLANE")); + resize(0, 0); + break; + } + } + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->clear(); + GroupPoints->LineEdit2->clear(); + onRemoveWebs(false); + + myEditCurrentArgument->setFocus(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + MESSAGE(width()<<" "<setText( "" ); + QString aString = ""; + + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); + + if ( nbSel < 1 ) + { + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + { + myListShapes.length( 0 ); + myListMaterials.length( 0 ); + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + myListTools.length( 0 ); + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) + myListRemoveInside.length( 0 ); + else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) + myListKeepInside.length( 0 ); + } + + // One and only one plane can be selected + + if ( getConstructorId() == 1 && myEditCurrentArgument == GroupPoints->LineEdit2 && nbSel != 1 ) + { + myListTools.length( 0 ); + return; + } + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + { + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true ); + myListMaterials.length( 0 ); + if ( !myListShapes.length() ) + return; + } + else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + { + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true ); + if ( !myListTools.length() ) + return; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + { + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListRemoveInside, true ); + if (!myListRemoveInside.length()) + return; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit4) + { + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListKeepInside, true ); + if ( !myListKeepInside.length() ) + return; + } + + myEditCurrentArgument->setText( aString ); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if(send == GroupPoints->PushButton2) + { + myEditCurrentArgument = GroupPoints->LineEdit2; + if( getConstructorId()==1 ) + globalSelection( GEOM_PLANE ); + } + else if(send == GroupPoints->PushButton3) + myEditCurrentArgument = GroupPoints->LineEdit3; + else if(send == GroupPoints->PushButton4) + myEditCurrentArgument = GroupPoints->LineEdit4; + + globalSelection( GEOM_ALLSHAPES ); + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2 || + send == GroupPoints->LineEdit3 || + send == GroupPoints->LineEdit4 ) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void OperationGUI_PartitionDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::enterEvent(QEvent* e) +{ + if(!GroupConstructors->isEnabled()) + this->ActivateThisDialog(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation() +{ + return getGeomEngine()->GetIBooleanOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool OperationGUI_PartitionDlg::isValid( QString& msg ) +{ + return (myListShapes.length() || myListTools.length() || + myListKeepInside.length() || myListRemoveInside.length()); +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + QString msg; + + int aLimit = GetLimit(); + int aConstructorId = getConstructorId(); + + if (aConstructorId==1) + aLimit = GEOM::SHAPE; + + if (isValid( msg )) + { + + if ( aConstructorId==0 && !toRemoveWebs() ) + myListMaterials.length(0); + + anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->MakePartition(myListShapes, + myListTools, + myListKeepInside, + myListRemoveInside, + aLimit, + toRemoveWebs(), + myListMaterials); + res = true; + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//======================================================================= +//function : ComboTextChanged +//purpose : +//======================================================================= + +void OperationGUI_PartitionDlg::ComboTextChanged() +{ + bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3; + GroupPoints->LineEdit3->setEnabled(IsEnabled); + GroupPoints->LineEdit4->setEnabled(IsEnabled); + GroupPoints->TextLabel4->setEnabled(IsEnabled); + GroupPoints->TextLabel5->setEnabled(IsEnabled); + GroupPoints->PushButton3->setEnabled(IsEnabled); + GroupPoints->PushButton4->setEnabled(IsEnabled); +} + + +//================================================================================= +// function : SetMaterials() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::SetMaterials() +{ + MESSAGE("OperationGUI_MaterialDlg ..."); + OperationGUI_MaterialDlg *aDlg = + new OperationGUI_MaterialDlg(this, "", myListShapes, true); + MESSAGE("OperationGUI_MaterialDlg"); + return; +} + + +//================================================================================= +// function : onRemoveWebs() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::onRemoveWebs(bool isChecked) +{ + if (GroupPoints->CheckBox1->isChecked() != isChecked) + GroupPoints->CheckBox1->setChecked(isChecked); + + GroupPoints->PushButton5->setEnabled(isChecked); +} + + +//================================================================================= +// function : toRemoveWebs() +// purpose : +//================================================================================= +bool OperationGUI_PartitionDlg::toRemoveWebs() const +{ + return GroupPoints->CheckBox1->isChecked(); +} + + +//================================================================================= +// function : GetLimit() +// purpose : +//================================================================================= +int OperationGUI_PartitionDlg::GetLimit() const +{ + int aLimit = GroupPoints->ComboBox1->currentItem(); + + switch(aLimit) + { + case 0 : + { + aLimit = GEOM::SOLID; + break; + } + case 1 : + { + aLimit = GEOM::SHELL; + break; + } + case 2 : + { + aLimit = GEOM::FACE; + break; + } + case 3 : + { + aLimit = GEOM::WIRE; + break; + } + case 4 : + { + aLimit = GEOM::EDGE; + break; + } + case 5 : + { + aLimit = GEOM::VERTEX; + break; + } + default : + aLimit = GEOM::SHAPE; + } + + return aLimit; +} diff --git a/src/PARTITION/Partition.cdl b/src/PARTITION/Partition.cdl new file mode 100644 index 000000000..179b425e8 --- /dev/null +++ b/src/PARTITION/Partition.cdl @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : Partition.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +package Partition + +uses + TopoDS, + TopTools, + TopAbs, + BRepAlgo, + BRep, + gp +is + class Spliter; + class Inter3d; + class Inter2d; + class Loop2d; + class Loop3d; + +end Partition; diff --git a/src/PARTITION/Partition_Inter2d.cdl b/src/PARTITION/Partition_Inter2d.cdl new file mode 100644 index 000000000..55b69124f --- /dev/null +++ b/src/PARTITION/Partition_Inter2d.cdl @@ -0,0 +1,110 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : Partition_Inter2d.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +class Inter2d from Partition + + ---Purpose: Computes the intersections between edges on a face + -- stores result is SD as AsDes from BRepAlgo. + +uses + AsDes from BRepAlgo, + Edge from TopoDS, + Face from TopoDS, + Vertex from TopoDS, + MapOfShape from TopTools, + Real from Standard, + ListOfShape from TopTools + +is + CompletPart2d(myclass ; AsDes : mutable AsDes from BRepAlgo; + F : Face from TopoDS; + NewEdges : MapOfShape from TopTools); + + ---Purpose: Computes the intersections between the edges stored + -- is AsDes as descendants of . Intersections is computed + -- between two edges if one of them is bound in NewEdges. + + + FindEndVertex(myclass; VertList : ListOfShape from TopTools; + f,l : Real from Standard; + E : Edge from TopoDS; + First : out Boolean from Standard; + DU : out Real from Standard) + returns Vertex from TopoDS; + ---Purpose: Returns a vertex from having parameter on + -- most close to or . is True if + -- found vertex is closer to . returns parameter + -- difference. + + AddVonE(myclass; V : Vertex from TopoDS; + E1,E2 : Edge from TopoDS; + AsDes : mutable AsDes from BRepAlgo; + F: Face from TopoDS) + returns Vertex from TopoDS; + ---Purpose: Put V in AsDes as intersection of E1 and E2. + -- Check that vertex equal to V already exists on one + -- of edges, in such a case, V is not added but + -- existing vertex is updated to be on E1 and E2 and + -- is returned insead of V. + -- Optional F is a face E1 and E2 are on. If F is + -- provided, it is used to find new vertices on E1 + -- and E2 resulting from intersection of new edges on + -- the two other faces the F interferes with and + -- through which E1 and E2 pass too. This helps to + -- avoid small edges. + + + GetTolerance(myclass; theV : Vertex from TopoDS; + theU : Real from Standard; + theE : Edge from TopoDS; + theAsDes : AsDes from BRepAlgo) + returns Real from Standard; + ---Purpose: Returns tolerance theV must have atfer its + -- addition to theE with theU parameter. theAsDes is + -- used to find pcurves of theE + +end Inter2d; + diff --git a/src/PARTITION/Partition_Inter3d.cdl b/src/PARTITION/Partition_Inter3d.cdl new file mode 100644 index 000000000..578161a25 --- /dev/null +++ b/src/PARTITION/Partition_Inter3d.cdl @@ -0,0 +1,194 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : Partition_Inter3d.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +class Inter3d from Partition + + ---Purpose: Computes the intersection face face in a set of faces + -- Store the result in a SD as AsDes. + +uses + Edge from TopoDS, + Vertex from TopoDS, + DataMapOfShapeShape from TopTools, + MapOfShape from TopTools, + Boolean from Standard, + AsDes from BRepAlgo, + Image from BRepAlgo, + Shape from TopoDS, + Face from TopoDS, + ListOfShape from TopTools, + Real from Standard, + State from TopAbs, + DataMapOfShapeListOfShape from TopTools + +is + Create returns Inter3d from Partition; + + Create(AsDes : mutable AsDes from BRepAlgo); + + CompletPart3d (me : in out; SetOfFaces1 : ListOfShape from TopTools; + FaceShapeMap: DataMapOfShapeShape from TopTools) + is static; + + FacesPartition (me : in out; F1, F2 : Face from TopoDS) + is static; + + ---------------------------- + ---Category: Result Querying + ---------------------------- + + IsDone(me ; F1,F2 : Face from TopoDS) + returns Boolean from Standard is static; + ---Purpose: return True if F1-F2 pair has been processed + + TouchedFaces(me : in out) returns MapOfShape from TopTools + ---C++: return & + is static; + ---Purpose: return map of faces cut by new or section edges + + NewEdges(me : in out) returns MapOfShape from TopTools + ---C++: return & + is static; + ---Purpose: return new and section edges + + AsDes(me) returns AsDes from BRepAlgo + is static; + ---Purpose: return an object containing info about + -- Ascendants | Descendants + -- ------------------+--------------------- + -- 1. faces | edges cutting them + -- 2. sectoin edges | new vertices on them + + + ------------------------------- + ---Category: Same domain shapes + ------------------------------- + + HasSameDomainF(me; F : Shape from TopoDS) + returns Boolean from Standard; + ---Purpose: Return true if F has same domain faces + + IsSameDomainF(me; F1, F2 : Shape from TopoDS) + returns Boolean from Standard; + ---Purpose: Return true if F1 and F2 are same domain faces + + SameDomain(me; F : Face from TopoDS) + returns ListOfShape from TopTools; + ---C++: return const & + ---Purpose: Return same domain faces of F + + ReplaceSameDomainV (me; V : Vertex from TopoDS; + E : Edge from TopoDS) + returns Vertex from TopoDS; + ---Purpose: return same domain vertex of V if it was replaced + -- and make this vertex to be on E too, else return V + + -------------------------- + ---Category: Section edges + -------------------------- + + SectionEdgesAD (me) returns AsDes from BRepAlgo + is static; + + IsSectionEdge (me; E : Edge from TopoDS) + returns Boolean from Standard; + ---Purpose: return True if E is an edge of an initial face and + -- E intersects aother face + + HasSectionEdge (me; F : Face from TopoDS) + returns Boolean from Standard; + ---Purpose: return True if F is intersected by an edge of + -- other face + + IsSplitOn (me; NewE, OldE : Edge from TopoDS; + F : Face from TopoDS) + returns Boolean from Standard; + ---Purpose: return True if NewE is split of OldE on F; + -- no check if NewE is split of OldE :) + + SectionEdgeFaces (me; SecE : Edge from TopoDS) + returns ListOfShape from TopTools; + ---C++: return const& + ---Purpose: return faces cut by section edge + + -------------------- + ---Category: Private + -------------------- + + Inter3D (me: in out; F1, F2 : Face from TopoDS; + LInt : in out ListOfShape from TopTools) + is static private; + + StorePart3d(me : in out; F1,F2 : Face from TopoDS; + LInt1 : ListOfShape from TopTools) + is static private; + + SetDone(me : in out; F1,F2 : Face from TopoDS) + is static private; + + Affiche (me; SetOfFaces : ListOfShape from TopTools) + is static private; + +fields + + myAsDes : AsDes from BRepAlgo; + myDone : DataMapOfShapeListOfShape from TopTools; + myTouched : MapOfShape from TopTools; + myNewEdges : MapOfShape from TopTools; + + -- section edges: existing edges that are intersection lines, + -- may be partially. + -- Store as + -- FACE -> SECTION EDGES, SECTION EDGE -> OTHER SECTION EDGE + mySectionEdgesAD : AsDes from BRepAlgo; + + -- same domain shapes + -- faces + mySameDomainFM : DataMapOfShapeListOfShape from TopTools; + -- vertex -> vertex replacement + mySameDomainVM : DataMapOfShapeShape from TopTools; + +end Inter3d; diff --git a/src/PARTITION/Partition_Loop.cdl b/src/PARTITION/Partition_Loop.cdl new file mode 100644 index 000000000..8678d2f19 --- /dev/null +++ b/src/PARTITION/Partition_Loop.cdl @@ -0,0 +1,106 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : Partition_Loop.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +class Loop from Partition + + ---Purpose: Builds the loops from a set of edges on a face. + +uses + + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + DataMapOfShapeListOfShape from TopTools + +is + + Create; + + Init (me : in out; F : Face from TopoDS) + ---Purpose: Init with the set of edges must have + -- pcurves on . + is static; + + AddEdge (me : in out; E : in out Edge from TopoDS; + LV : ListOfShape from TopTools) + ---Purpose: Add E with . will be copied and trim + -- by vertices in . + is static; + + AddConstEdge (me : in out; E : Edge from TopoDS) + ---Purpose: Add as const edge, E can be in the result. + is static; + + Perform(me : in out) + ---Purpose: Make loops. + is static; + + NewWires (me) + ---Purpose: Returns the list of wires performed. + -- can be an empty list. + ---C++: return const & + returns ListOfShape from TopTools; + + WiresToFaces (me : in out) + ---Purpose: Build faces from the wires result. + is static; + + NewFaces (me) + ---Purpose: Returns the list of faces. + ---Warning: The method as to be called before. + -- can be an empty list. + ---C++: return const & + returns ListOfShape from TopTools; + + +fields + + myFace : Face from TopoDS; + myConstEdges : ListOfShape from TopTools; + myNewWires : ListOfShape from TopTools; + myNewFaces : ListOfShape from TopTools; + +end Loop; diff --git a/src/PARTITION/Partition_Loop2d.cdl b/src/PARTITION/Partition_Loop2d.cdl new file mode 100644 index 000000000..94d0e7e4a --- /dev/null +++ b/src/PARTITION/Partition_Loop2d.cdl @@ -0,0 +1,102 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 CEA/DEN, EDF R&D +-- +-- +-- +-- File : Partition_Loop2d.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +class Loop2d from Partition + + ---Purpose: Builds the loops from a set of edges on a face. + -- It works in supposition that all constant edges + -- are split edges of an initialization face and all + -- section edges are new on the face + +uses + + Orientation from TopAbs, + Boolean from Standard, + Face from TopoDS, + Image from BRepAlgo, + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + DataMapOfShapeListOfShape from TopTools, + MapOfShape from TopTools +is + + Create; + + Init (me : in out; F : Face from TopoDS) + ---Purpose: Init with the set of edges must have + -- pcurves on . + is static; + + AddConstEdge (me : in out; E : Edge from TopoDS) + ---Purpose: Add as unique edge in the result. + is static; + + AddSectionEdge (me : in out; E : Edge from TopoDS) + ---Purpose: Add as double edge in the result. + is static; + + Perform(me : in out) + ---Purpose: Make loops. + is static; + + NewWires (me) + ---Purpose: Returns the list of wires performed. + -- can be an empty list. + ---C++: return const & + returns ListOfShape from TopTools; + + WiresToFaces (me : in out; EdgeImage : Image from BRepAlgo) + ---Purpose: Build faces from the wires result. + -- serves to find original edge by new + -- one. + is static; + + NewFaces (me) + ---Purpose: Returns the list of faces. + ---Warning: The method as to be called before. + -- can be an empty list. + ---C++: return const & + returns ListOfShape from TopTools; + + +fields + + myFace : Face from TopoDS; + myFaceOri : Orientation from TopAbs; + myConstEdges : ListOfShape from TopTools; + myNewWires : ListOfShape from TopTools; + myNewFaces : ListOfShape from TopTools; + + -- internal wires do not contain constant edges + myInternalWL : ListOfShape from TopTools; + + mySectionEdges : MapOfShape from TopTools; + +end Loop2d; diff --git a/src/PARTITION/Partition_Loop3d.cdl b/src/PARTITION/Partition_Loop3d.cdl new file mode 100644 index 000000000..62e6af3ce --- /dev/null +++ b/src/PARTITION/Partition_Loop3d.cdl @@ -0,0 +1,88 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 CEA/DEN, EDF R&D +-- +-- +-- +-- File : Partition_Loop3d.cdl +-- Module : GEOM + +class Loop3d from Partition + + ---Purpose: Builds the shells from a set of faces. + -- Provides methods for comparing faces mutual + -- location. + +uses + Vec from gp, + MapOfOrientedShape from TopTools, + IndexedDataMapOfShapeListOfShape from TopTools, + Face from TopoDS, + Edge from TopoDS, + ListOfShape from TopTools, + Shape from TopoDS + +is + + Create; + + AddConstFaces (me : in out; S : Shape from TopoDS) + ---Purpose: Add faces of as unique faces in the result. + is static; + + AddSectionFaces (me : in out; S : Shape from TopoDS) + ---Purpose: Add faces of as double faces in the result. + is static; + + MakeShells (me : in out; AvoidFacesMap : MapOfOrientedShape from TopTools) + returns ListOfShape from TopTools is static; + ---Purpose: Make and return shells. + -- can contain faces that must not be + -- added to result shells. + ---C++: return const & + + + ---Category: class methods + + IsInside (myclass; E : Edge from TopoDS; + F1, F2 : Face from TopoDS; + CountDot : Boolean from Standard; + Dot : in out Real from Standard; + GoodOri : in out Boolean from Standard) + returns Boolean from Standard; + ---Purpose: check if is inside by edge . + -- if , compute : scalar production of + -- normalized vectors pointing inside faces, and + -- check if faces are oriented well for sewing + + Normal (myclass; E : Edge from TopoDS; + F : Face from TopoDS) returns Vec from gp; + + +fields + + myNewShells : ListOfShape from TopTools; -- result + + myFaces : ListOfShape from TopTools; + myEFMap : IndexedDataMapOfShapeListOfShape from TopTools; + +end Loop3d; diff --git a/src/PARTITION/Partition_Spliter.cdl b/src/PARTITION/Partition_Spliter.cdl new file mode 100644 index 000000000..acef3db6a --- /dev/null +++ b/src/PARTITION/Partition_Spliter.cdl @@ -0,0 +1,204 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +-- GEOM PARTITION : partition algorithm +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : Partition_Spliter.cdl +-- Author : Benedicte MARTIN +-- Module : GEOM + +class Spliter from Partition + + ---Purpose: Split solids, shells and faces into parts of the + -- same topology if reconstruction level is not + -- limited. + +uses + Inter3d from Partition, + Loop2d from Partition, + Builder from BRep, + ShapeEnum from TopAbs, + Compound from TopoDS, + Face from TopoDS, + Edge from TopoDS, + Shape from TopoDS, + MapOfOrientedShape from TopTools, + IndexedMapOfShape from TopTools, + DataMapOfShapeShape from TopTools, + ListOfShape from TopTools, + MapOfShape from TopTools, + AsDes from BRepAlgo, + Image from BRepAlgo + +is + Create returns Spliter from Partition; + ---Purpose: constructor + + AddShape ( me : in out; S : Shape from TopoDS); + ---Purpose: add object Shape to be splitted. + -- If S is a COMPOUND or COMPSOLID, it will be + -- exploded in order to get more simple object + -- shapes. + -- Object shapes that are vertices, edges or wires + -- won't be splitted and won't be in a result. + + AddTool ( me : in out; S : Shape from TopoDS); + ---Purpose: add cutting tool + + Compute (me : in out; Limit : ShapeEnum from TopAbs + = TopAbs_SHAPE); + ---Purpose: produce a result which is a compound of parts of + -- object shapes. A part can be either a vertex, + -- edge, wire, face, shell or solid. + -- By default, a part is of the same topology as an + -- object shape, else restricts parts + -- reconstruction. + -- If == TopAbs_VERTEX, only new vertices are + -- returned in the result + + KeepShapesInside (me : in out; S : Shape from TopoDS); + ---Purpose: remove shapes that are outside of S from result. + -- S should be an object shape. + ---Warning: call it after Compute() + + RemoveShapesInside (me : in out; S : Shape from TopoDS); + ---Purpose: remove shapes that are inside S from result. + -- S should be an object shape. + ---Warning: call it after Compute() + + Shape ( me ) returns Shape from TopoDS; + ---Purpose: return resulting compound + + Clear ( me : in out); + ---Purpose: clear fields + + + ---Category: private methods + + + MakeSolids (me: in out; Solid : Shape from TopoDS; + Shells: in out ListOfShape from TopTools) + is private; + ---Purpose: make solids out of Shells + + MakeShells (me: in out; S : Shape from TopoDS; + NS: in out ListOfShape from TopTools) is private; + ---Purpose: split S into shells + + MakeFaces (me: in out; S : Shape from TopoDS) + returns Shape from TopoDS is private; + ---Purpose: split faces of S, return compound of new faces + + MakeEdges (me; + E : Edge from TopoDS; + VOnE : ListOfShape from TopTools; + NE : in out ListOfShape from TopTools) + is private; + ---Purpose: cut E by vertices VOnE, return list of new edges + -- NE + + FindFacesInside (me: in out; S : Shape from TopoDS; + CheckClosed : Boolean = Standard_False; + All : Boolean = Standard_False) + returns Shape from TopoDS is private; + ---Purpose: return compound of faces of other shapes that are + -- inside . must have image in myImageShape. + -- makes avoid faces that do not form a + -- closed shell + -- makes return already added faces + + CheckTool ( me: in out; S : Shape from TopoDS) + returns Boolean from Standard is private; + ---Purpose: Return True if is a tool shape. Prepare tool + -- faces of for the search of internal faces. + + MergeEqualEdges (me: in out; LE : ListOfShape from TopTools) is private; + ---Purpose: among LE, find equal edges, choose ones to keep + -- and make them have pcurves on all faces they are + -- shared by + -- contains edge splits + + IsInside (myclass; S1,S2 : Shape from TopoDS) + returns Boolean from Standard is private; + ---Purpose: Return True if the first vertex of S1 inside S2. + -- If S1.IsNull(), check infinite point against S2. + + GetOriginalShape(me; aShape : Shape from TopoDS) + returns Shape from TopoDS is private; + ---Purpose: Return the shape aShape originates from. aShape + -- should be a face or more complex result shape + + FindToolsToReconstruct(me: in out) is private; + ---Purpose: find and store as objects tools which interfere + -- with solids or are inside solids without + -- an interference + +fields + + myDoneStep : ShapeEnum from TopAbs; -- rebuilt level + myShape : Compound from TopoDS; -- result + myBuilder : Builder from BRep; + + myListShapes : ListOfShape from TopTools; -- object shapes + myMapFaces : MapOfShape from TopTools; -- object faces + myMapTools : MapOfShape from TopTools; -- tool faces + myEqualEdges : MapOfShape from TopTools; -- equal splits + myNewSection : MapOfShape from TopTools; -- new secton edges + myClosedShapes : MapOfShape from TopTools; + mySharedFaces : MapOfShape from TopTools; -- faces shared by several shapes + myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside + myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face + + myInternalFaces: DataMapOfShapeShape from TopTools; -- shape and its internal faces + myIntNotClFaces: DataMapOfShapeShape from TopTools; -- internal but not closed + + + myAsDes : AsDes from BRepAlgo; + myImagesFaces : Image from BRepAlgo; + myImagesEdges : Image from BRepAlgo; + myImageShape : Image from BRepAlgo; + + -- contains info of same domain shapes and section edges + myInter3d : Inter3d from Partition; + + -- avoid rebuilding twice commont part of solids + myAddedFacesMap: MapOfOrientedShape from TopTools; + +end Spliter; diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx new file mode 100644 index 000000000..ea44ad1bc --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -0,0 +1,412 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : PrimitiveGUI_BoxDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "PrimitiveGUI_BoxDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + + +//================================================================================= +// class : PrimitiveGUI_BoxDlg() +// purpose : Constructs a PrimitiveGUI_BoxDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BOX_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BOX")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_DIAGONAL_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); + GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); + GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~DialogBox_Box() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_BoxDlg::~PrimitiveGUI_BoxDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes */ + GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + double initValue = 200.0; + GroupDimensions->SpinBox_DX->SetValue(initValue); + GroupDimensions->SpinBox_DY->SetValue(initValue); + GroupDimensions->SpinBox_DZ->SetValue(initValue); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_BOX" ) ); + ConstructorsClicked(0); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + globalSelection( GEOM_POINT ); + + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + break; + } + } + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_BoxDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed +//================================================================================= +void PrimitiveGUI_BoxDlg::SelectionIntoArgument() +{ + if ( getConstructorId() != 0 ) + return; + + myEditCurrentArgument->setText(""); + + if (IObjectCount() != 1) + { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit2) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if(!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint1 = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myPoint2 = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if(send == GroupPoints->PushButton2) + myEditCurrentArgument = GroupPoints->LineEdit2; + + globalSelection( GEOM_POINT ); + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_BoxDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_BoxDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : true; +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_BoxDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) ) { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeBoxTwoPnt( myPoint1, myPoint2 ); + res = true; + } + + break; + } + case 1 : + { + double x = GroupDimensions->SpinBox_DX->GetValue(); + double y = GroupDimensions->SpinBox_DY->GetValue(); + double z = GroupDimensions->SpinBox_DZ->GetValue(); + + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeBoxDXDYDZ( x, y, z ); + res = true; + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx new file mode 100644 index 000000000..45db91182 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -0,0 +1,471 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : PrimitiveGUI_ConeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "PrimitiveGUI_ConeDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : PrimitiveGUI_ConeDlg() +// purpose : Constructs a PrimitiveGUI_ConeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CONE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CONE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_ConeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_ConeDlg::~PrimitiveGUI_ConeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, 999.999, step, 3); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + double aRadius1(100.0), aRadius2(0.0), aHeight(300.0); + GroupPoints->SpinBox_DX->SetValue(aRadius1); + GroupPoints->SpinBox_DY->SetValue(aRadius2); + GroupPoints->SpinBox_DZ->SetValue(aHeight); + GroupDimensions->SpinBox_DX->SetValue(aRadius1); + GroupDimensions->SpinBox_DY->SetValue(aRadius2); + GroupDimensions->SpinBox_DZ->SetValue(aHeight); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_CONE" ) ); + ConstructorsClicked(0); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch(constructorId) + { + case 0 : + { + globalSelection( GEOM_POINT ); + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + + break; + } + } + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_ConeDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void PrimitiveGUI_ConeDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_ConeDlg::SelectionIntoArgument() +{ + if ( getConstructorId() != 0 ) + return; + + if(IObjectCount() != 1) + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = GEOM::GEOM_Object::_nil(); + return; + } + + /* nbSel == 1 */ + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if(!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; + + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_ConeDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_ConeDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_ConeDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_ConeDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) ){ + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeConePntVecR1R2H( myPoint, + myDir, + getRadius1(), + getRadius2(), + getHeight()); + res = true; + } + break; + } + case 1 : + { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeConeR1R2H( getRadius1(), + getRadius2(), + getHeight()); + res = true; + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::closeEvent( QCloseEvent* e ) +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : getRadius1() +// purpose : +//================================================================================= +double PrimitiveGUI_ConeDlg::getRadius1() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DX->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DX->GetValue(); + return 0; +} + + +//================================================================================= +// function : getRadius2() +// purpose : +//================================================================================= +double PrimitiveGUI_ConeDlg::getRadius2() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DY->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DY->GetValue(); + return 0; +} + + +//================================================================================= +// function : getRadius2() +// purpose : +//================================================================================= +double PrimitiveGUI_ConeDlg::getHeight() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DZ->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DZ->GetValue(); + return 0; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx new file mode 100644 index 000000000..19aaff74d --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -0,0 +1,447 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : PrimitiveGUI_CylinderDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "PrimitiveGUI_CylinderDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : PrimitiveGUI_CylinderDlg() +// purpose : Constructs a PrimitiveGUI_CylinderDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CYLINDER_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CYLINDER")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); + GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_CylinderDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_CylinderDlg::~PrimitiveGUI_CylinderDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + /* First constructor : radius */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + /* First constructor : algebric height */ + GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + /* Second constructor : radius */ + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + /* Second constructor : algebric height */ + GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + + GroupPoints->SpinBox_DX->SetValue(100.0); + GroupPoints->SpinBox_DY->SetValue(300.0); + GroupDimensions->SpinBox_DX->SetValue(100.0); + GroupDimensions->SpinBox_DY->SetValue(300.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_CYLINDER" ) ); + ConstructorsClicked(0); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch(constructorId) + { + case 0 : + { + globalSelection( GEOM_POINT ); + + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + + break; + } + } + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_CylinderDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void PrimitiveGUI_CylinderDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() +{ + if ( getConstructorId() != 0 ) + return; + + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = GEOM::GEOM_Object::_nil(); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = GEOM::GEOM_Object::_nil(); + return; + } + + /* nbSel == 1 */ + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if(!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_CylinderDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( ) +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_CylinderDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil() ) : true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_CylinderDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )) { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight()); + res = true; + } + break; + } + case 1 : + { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeCylinderRH(getRadius(), getHeight()); + res = true; + + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : getRadius() +// purpose : +//================================================================================= +double PrimitiveGUI_CylinderDlg::getRadius() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DX->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DX->GetValue(); + return 0; +} + + +//================================================================================= +// function : getHeight() +// purpose : +//================================================================================= +double PrimitiveGUI_CylinderDlg::getHeight() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DY->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DY->GetValue(); + return 0; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx new file mode 100644 index 000000000..49bca1dc2 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -0,0 +1,398 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : PrimitiveGUI_SphereDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "PrimitiveGUI_SphereDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : PrimitiveGUI_SphereDlg() +// purpose : Constructs a PrimitiveGUI_SphereDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SPHERE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SPHERE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_SPHERE_CR")); + GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); + GroupPoints->TextLabel2->setText(tr("GEOM_RADIUS")); + GroupPoints->PushButton1->setPixmap(image2); + + GroupDimensions = new DlgRef_1Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_SPHERE_RO")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_SphereDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_SphereDlg::~PrimitiveGUI_SphereDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + + myPoint = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DX->SetValue(100.0); + GroupDimensions->SpinBox_DX->SetValue(100.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName(tr("GEOM_SPHERE")); + ConstructorsClicked(0); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch (constructorId) + { + case 0: + { + globalSelection( GEOM_POINT ); + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + myPoint = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + break; + } + } + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_SphereDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void PrimitiveGUI_SphereDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_SphereDlg::SelectionIntoArgument() +{ + if ( getConstructorId() != 0 ) + return; + + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) + { + myPoint = GEOM::GEOM_Object::_nil(); + return; + } + + /* nbSel == 1 ! */ + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if (!testResult || CORBA::is_nil( aSelectedObject )) + return; + + myPoint = aSelectedObject; + myEditCurrentArgument->setText( GEOMBase::GetName( myPoint ) ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_SphereDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_SphereDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !myPoint->_is_nil() : true; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myPoint ) ) { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() ); + res = true; + } + break; + } + case 1 : + { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() ); + res = true; + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e ) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + + +//================================================================================= +// function : getRadius() +// purpose : +//================================================================================= +double PrimitiveGUI_SphereDlg::getRadius() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DX->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DX->GetValue(); + return 0; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx new file mode 100644 index 000000000..05e6c7b6c --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -0,0 +1,445 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : PrimitiveGUI_TorusDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "PrimitiveGUI_TorusDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : PrimitiveGUI_TorusDlg() +// purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_TORUS_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_TORUS")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_TorusDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_TorusDlg::~PrimitiveGUI_TorusDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + + GroupPoints->SpinBox_DX->SetValue(300.0); + GroupPoints->SpinBox_DY->SetValue(100.0); + GroupDimensions->SpinBox_DX->SetValue(300.0); + GroupDimensions->SpinBox_DY->SetValue(100.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_TORUS" ) ); + ConstructorsClicked(0); +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + switch(constructorId) + { + case 0 : + { + globalSelection( GEOM_LINE ); + + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + myPoint = myDir = GEOM::GEOM_Object::_nil(); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break ; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + + break ; + } + } + displayPreview(); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool PrimitiveGUI_TorusDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void PrimitiveGUI_TorusDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_TorusDlg::SelectionIntoArgument() +{ + if ( getConstructorId() != 0 ) + return; + + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = GEOM::GEOM_Object::_nil(); + return; + } + + + /* nbSel == 1 */ + Standard_Boolean testResult = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + + if(!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myPoint = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_POINT ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void PrimitiveGUI_TorusDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation() +{ + return getGeomEngine()->GetI3DPrimOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool PrimitiveGUI_TorusDlg::isValid( QString& msg ) +{ + return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true; +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )){ + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); + res = true; + } + break; + } + case 1 : + { + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusRR(getRadius1(), getRadius2()); + res = true; + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : getRadius1() +// purpose : +//================================================================================= +double PrimitiveGUI_TorusDlg::getRadius1() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DX->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DX->GetValue(); + return 0; +} + + +//================================================================================= +// function : getRadius2() +// purpose : +//================================================================================= +double PrimitiveGUI_TorusDlg::getRadius2() const +{ + int aConstructorId = getConstructorId(); + if (aConstructorId == 0) + return GroupPoints->SpinBox_DY->GetValue(); + else if (aConstructorId == 1) + return GroupDimensions->SpinBox_DY->GetValue(); + return 0; +} diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx new file mode 100644 index 000000000..fa4187134 --- /dev/null +++ b/src/RepairGUI/RepairGUI.cxx @@ -0,0 +1,146 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "RepairGUI.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" + +#include "RepairGUI_SewingDlg.h" // Method SEWING +#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES +#include "RepairGUI_RemoveHolesDlg.h" // Method SUPPRESS HOLE +#include "RepairGUI_ShapeProcessDlg.h" // Method PROCESS SHAPE +#include "RepairGUI_CloseContourDlg.h" // Method CLOSE CONTOUR +#include "RepairGUI_RemoveIntWiresDlg.h"// Method REMOVE INTERNAL WIRES +#include "RepairGUI_DivideEdgeDlg.h" // Method DEVIDE EDGE +#include "RepairGUI_FreeBoundDlg.h" // Method FREE BOUNDARIES +#include "RepairGUI_FreeFacesDlg.h" // Method FREE FACES +#include "RepairGUI_GlueDlg.h" // Method GLUE FACES + +#include "utilities.h" + +using namespace std; + +RepairGUI* RepairGUI::myGUIObject = 0; + +//======================================================================= +// function : GetRepairGUI() +// purpose : Get the only RepairGUI object [ static ] +//======================================================================= +RepairGUI* RepairGUI::GetRepairGUI( GeometryGUI* parent ) +{ + if ( myGUIObject == 0 ) { + // init RepairGUI only once + myGUIObject = new RepairGUI( parent ); + } + return myGUIObject; +} + +//======================================================================= +// function : RepairGUI() +// purpose : Constructor +//======================================================================= +RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent ) +{ +} + + +//======================================================================= +// function : ~RepairGUI() +// purpose : Destructor +//======================================================================= +RepairGUI::~RepairGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) +{ + getGeometryGUI()->EmitSignalDeactivateDialog(); + + QDialog* aDlg = NULL; + switch (theCommandID) { + case 601: // SEWING + aDlg = new RepairGUI_SewingDlg( parent, "" ); + break; + case 602: // GLUE FACES + aDlg = new RepairGUI_GlueDlg( parent, "" ); + break; + case 603: // SUPPRESS FACES + aDlg = new RepairGUI_SuppressFacesDlg( parent, "" ); + break; + case 604: // SUPPRESS HOLES + aDlg = new RepairGUI_RemoveHolesDlg( parent, "" ); + break; + case 605: // SHAPE PROCESSING + aDlg = new RepairGUI_ShapeProcessDlg( parent, "" ); + break; + case 606: // CLOSE CONTOUR + aDlg = new RepairGUI_CloseContourDlg( parent, "" ); + break; + case 607: // REMOVE INTERNAL WIRES + aDlg = new RepairGUI_RemoveIntWiresDlg( parent, "" ); + break; + case 608: // ADD POINT ON EDGE + aDlg = new RepairGUI_DivideEdgeDlg( getGeometryGUI(), parent, "" ); + break; + case 609: // FREE BOUNDARIES + aDlg = new RepairGUI_FreeBoundDlg( getGeometryGUI(), parent ); + break; + case 610: // FREE FACES + aDlg = new RepairGUI_FreeFacesDlg( getGeometryGUI(), parent, "" ); + break; + default: + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + + if ( aDlg ) + aDlg->show(); + + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WNT + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) + { + return RepairGUI::GetRepairGUI( parent ); + } +} diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx new file mode 100644 index 000000000..e5bb3a708 --- /dev/null +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx @@ -0,0 +1,398 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_CloseContourDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_CloseContourDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include +#include +#include + +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_CloseContourDlg() +// purpose : Constructs a RepairGUI_CloseContourDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CLOSECONTOUR"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CLOSECONTOUR_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CLOSECONTOUR_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("Contour to close")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay"); + + mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" ); + mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) ); + mySelectWiresBtn->setText( trUtf8( "" ) ); + mySelectWiresBtn->setPixmap(image1); + + mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" ); + mySelectWiresEdt->setReadOnly( true ); + + mySelectWiresLbl = new QLabel( tr( "Contour to close" ), GroupPoints->GroupBox1, "ContourLbl" ); + mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) ); + + aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 ); + aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 ); + aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + aSelectWiresLay->addItem( spacer, 1, 2 ); + + myIsVertexGr = new QButtonGroup( 2, Qt::Vertical, GroupPoints ); + myIsVertexGr->setFrameStyle( QFrame::NoFrame ); + myIsVertexGr->setRadioButtonExclusive( true ); + myIsVertexGr->insert( new QRadioButton( tr( "Close by common vertex" ), myIsVertexGr ), 0 ); + myIsVertexGr->insert( new QRadioButton( tr( "Close by new edge" ), myIsVertexGr ), 1 ); + myIsVertexGr->find( 0 )->toggle(); + + Layout1->addWidget(GroupPoints, 2, 0); + GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 1, 0 ); + GroupPoints->getGroupBoxLayout()->addMultiCellWidget(myIsVertexGr, 2, 2, 0, 2); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_CloseContourDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_CloseContourDlg::~RepairGUI_CloseContourDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd = new GEOM::short_array(); + myWiresInd->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_CloseContourDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_CloseContourDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void RepairGUI_CloseContourDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText( "" ); + mySelectWiresEdt->setText( "" ); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + myObject = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == mySelectWiresEdt ) + myWiresInd->length( 0 ); + + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection + { + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes && GEOMBase::IsShape( myObject ) ) + { + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + TopoDS_Shape aShape; + if ( myGeomBase->GetShape( myObject, aShape, TopAbs_WIRE ) ) + mySelectWiresEdt->setText( myEditCurrentArgument->text() ); + } + else + myObject = GEOM::GEOM_Object::_nil(); + } + else if ( myEditCurrentArgument == mySelectWiresEdt ) + { + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + const int n = aMap.Extent(); + myWiresInd->length( n ); + for ( int i = 1; i <= n; i++ ) + myWiresInd[ i-1 ] = aMap( i ); + if ( n ) + myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) ); + } + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == GroupPoints->PushButton1 ) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) + myEditCurrentArgument = mySelectWiresEdt; + if ( myEditCurrentArgument ) + { + initSelection(); + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) + { + myEditCurrentArgument = (QLineEdit*)send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + mySelectWiresEdt->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_CloseContourDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_CloseContourDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_CloseContourDlg::isValid( QString& msg ) +{ + TopoDS_Shape aTmpShape; + return !myObject->_is_nil() && ( myWiresInd->length() || myGeomBase->GetShape( myObject, aTmpShape, TopAbs_WIRE ) ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_CloseContourDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->CloseContour( myObject, myWiresInd, getIsByVertex() ); + bool aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + + return aResult; +} + +//================================================================================= +// function : getIsByVertex +// purpose : +//================================================================================= +bool RepairGUI_CloseContourDlg::getIsByVertex() const +{ + return myIsVertexGr->find( 0 )->isOn(); +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_CloseContourDlg::initSelection() +{ + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + { + TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_COMPOUND ); + aTypes.Add( GEOM_SOLID ); + aTypes.Add( GEOM_SHELL ); + aTypes.Add( GEOM_FACE ); + aTypes.Add( GEOM_WIRE ); + + globalSelection( aTypes ); + } + else if ( myEditCurrentArgument == mySelectWiresEdt ) + { + localSelection( myObject, TopAbs_EDGE ); + localSelection( myObject, TopAbs_WIRE ); + } +} + + diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx new file mode 100644 index 000000000..969b7162a --- /dev/null +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -0,0 +1,365 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_DivideEdgeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_DivideEdgeDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include + +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_DivideEdgeDlg() +// purpose : Constructs a RepairGUI_DivideEdgeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, + const char* name, bool modal, WFlags fl) + : GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | + WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + myGeomGUI = theGeometryGUI; + + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_DIVIDE_EDGE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_DIVIDE_EDGE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ADD_POINT")); + GroupPoints->TextLabel1->setText(tr("GEOM_EDGE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + myIsParameterGr = new QButtonGroup( 2, Qt::Vertical, GroupPoints ); + myIsParameterGr->setFrameStyle( QFrame::NoFrame ); + myIsParameterGr->setRadioButtonExclusive( true ); + myIsParameterGr->insert( new QRadioButton( tr( "GEOM_BY_PARAMETER" ), myIsParameterGr ), 0 ); + myIsParameterGr->insert( new QRadioButton( tr( "GEOM_BY_LENGTH" ), myIsParameterGr ), 1 ); + myIsParameterGr->find( 0 )->toggle(); + + QGridLayout* aLay = new QGridLayout( 0, 1, 2, 0, 6, "aLay" ); + myValEdt = new QtxDblSpinBox(0., 1., 0.1, GroupPoints->GroupBox1); + myValEdt->setPrecision( 3 ); + myValEdt->setValue( 0.5 ); + QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->GroupBox1 ); + aLay->addWidget( aLbl1, 0, 0 ); + aLay->addWidget( myValEdt, 0, 1 ); + + Layout1->addWidget(GroupPoints, 2, 0); + GroupPoints->getGroupBoxLayout()->addMultiCellWidget(myIsParameterGr, 1, 1, 0, 2); + GroupPoints->getGroupBoxLayout()->addLayout( aLay, 2, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_DivideEdgeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_DivideEdgeDlg::~RepairGUI_DivideEdgeDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; + + //myGeomGUI->SetState( 0 ); + initSelection(); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_DivideEdgeDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_DivideEdgeDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; + + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + Standard_Boolean aRes; + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( !CORBA::is_nil( aSelectedObj ) && aRes ) + { + TopoDS_Shape aShape; + if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) + { + const int aType = aShape.ShapeType(); + if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound + { + GEOM::short_array anIndexes; + + TColStd_IndexedMapOfInteger aMap; + SalomeApp_Application* anApp = + (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + anApp->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) // subshape selection + { + myIndex = aMap( 1 ); + myObject = aSelectedObj; + myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" ); + } + else if ( aType == TopAbs_EDGE ) // single shape selection + { + myIndex = -1; + myObject = aSelectedObj; + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + } + else // face, shell, solid or compound was selected, and NOT its subshape. + { + myIndex = -1; + myObject = GEOM::GEOM_Object::_nil(); + } + } + } + } + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::SetEditCurrentArgument() +{ + if( sender() == GroupPoints->PushButton1 ) + { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::LineEditReturnPressed() +{ + if( sender() == GroupPoints->LineEdit1 ) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myObject = GEOM::GEOM_Object::_nil(); + myIndex = -1; + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_DivideEdgeDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_DivideEdgeDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_DivideEdgeDlg::isValid( QString& msg ) +{ + return !myObject->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge + ( myObject, myIndex, myValEdt->value(), getIsByParameter() ); + bool aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + + return aResult; +} + +//================================================================================= +// function : getIsByParameter +// purpose : +//================================================================================= +bool RepairGUI_DivideEdgeDlg::getIsByParameter() const +{ + return myIsParameterGr->find( 0 )->isOn(); +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_DivideEdgeDlg::initSelection() +{ + GEOM::GEOM_Object_var aNullGeomObject; + localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects +} diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h new file mode 100644 index 000000000..02cf3a262 --- /dev/null +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -0,0 +1,88 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_DivideEdgeDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_DivideEdge_H +#define DIALOGBOX_DivideEdge_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_Ext.h" +#include "QtxDblSpinBox.h" + +#include + +#include +#include + +//================================================================================= +// class : RepairGUI_DivideEdgeDlg +// purpose : +//================================================================================= +class RepairGUI_DivideEdgeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_DivideEdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ~RepairGUI_DivideEdgeDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& objects ); + +private : + void Init(); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void initSelection(); + + bool getIsByParameter() const; + + GEOM::GEOM_Object_var myObject; + int myIndex; + + DlgRef_1Sel_Ext* GroupPoints; + QButtonGroup* myIsParameterGr; + QtxDblSpinBox* myValEdt; + +protected slots: + void ClickOnOk(); + bool ClickOnApply(); + void ClickOnCancel(); + + void ActivateThisDialog(); + void DeactivateActiveDialog(); + + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); +}; + +#endif // DIALOGBOX_DivideEdge_H diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx new file mode 100644 index 000000000..896c0f0d4 --- /dev/null +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx @@ -0,0 +1,282 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_FreeBoundDlg.cxx +// Author : Sergey LITONIN +// Module : GEOM +// $Header$ + +#include "RepairGUI_FreeBoundDlg.h" +#include "GEOMBase.h" +#include "GeometryGUI.h" +#include "GEOM_Displayer.h" +#include "GEOMImpl_Types.hxx" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" + +#include + +#include +#include +#include +#include +#include + +#define SPACING 5 +#define MARGIN 10 + +/* + Calss : RepairGUI_FreeBoundDlg + Description : Dialog for displaying free boundaries of selected face, shell or solid +*/ + + +//================================================================================= +// function : RepairGUI_FreeBoundDlg +// purpose : Constructor +//================================================================================= +RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent ) +: QDialog( theParent, "RepairGUI_FreeBoundDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( theParent ) ), + myGeomGUI ( theGUI ) +{ + setCaption( tr( "CAPTION" ) ); + + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); + + QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FREE_BOUND" ), this ); + + QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp ); + aSelGrp->setInsideMargin( 0 ); + aSelGrp->setFrameStyle( QFrame::NoFrame ); + new QLabel( tr( "GEOM_OBJECT" ), aSelGrp ); + ( new QPushButton( aSelGrp ) )->setPixmap( iconSelect ); + myEdit = new QLineEdit( aSelGrp ); + myEdit->setReadOnly( true ); + myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + myClosedLbl = new QLabel( tr( "NUMBER_CLOSED" ), aMainGrp ); + myOpenLbl = new QLabel( tr( "NUMBER_OPEN" ), aMainGrp ); + + QFrame* aFrame = new QFrame( this ); + aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); + QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame ); + QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame, MARGIN, SPACING ); + aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + aBtnLay->addWidget( aCloseBtn ); + aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + + QVBoxLayout* aLay = new QVBoxLayout( this ); + aLay->setSpacing( SPACING ); + aLay->setMargin( MARGIN ); + aLay->addWidget( aMainGrp ); + aLay->addWidget( aFrame ); + + connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); + + Init(); +} + +//================================================================================= +// function : ~RepairGUI_FreeBoundDlg +// purpose : Destructor +//================================================================================= +RepairGUI_FreeBoundDlg::~RepairGUI_FreeBoundDlg() +{ +} + +//================================================================================= +// function : onClose +// purpose : SLOT. Called when "close" button pressed. Close dialog +//================================================================================= +void RepairGUI_FreeBoundDlg::onClose() +{ + globalSelection(); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); + reject(); + erasePreview(); +} + +//================================================================================= +// function : onDeactivate +// purpose : Deactivate this dialog +//================================================================================= +void RepairGUI_FreeBoundDlg::onDeactivate() +{ + setEnabled(false); + globalSelection(); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); +} + +//================================================================================= +// function : onActivate +// purpose : Activate this dialog +//================================================================================= +void RepairGUI_FreeBoundDlg::onActivate() +{ + myGeomGUI->EmitSignalDeactivateDialog(); + setEnabled( true ); + myGeomGUI->SetActiveDialogBox( this ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); + activateSelection(); + onSelectionDone(); +} + +//================================================================================= +// function : onSelectionDone +// purpose : SLOT. Called when selection changed. +//================================================================================= +void RepairGUI_FreeBoundDlg::onSelectionDone() +{ + if( IObjectCount() != 1 ) + return; + + Standard_Boolean isOk = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk ); + + if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) + return; + else + { + myObj = anObj; + displayPreview( false, true, true, 3 ); + } + +} + +//================================================================================= +// function : Init +// purpose : Initialize dialog fields +//================================================================================= +void RepairGUI_FreeBoundDlg::Init() +{ + myNbClosed = myNbOpen = 0; + myObj = GEOM::GEOM_Object::_nil(); + + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); + + activateSelection(); + onSelectionDone(); +} + +//================================================================================= +// function : enterEvent +// purpose : Activate dialog +//================================================================================= +void RepairGUI_FreeBoundDlg::enterEvent( QEvent* e ) +{ + onActivate(); +} + +//================================================================================= +// function : closeEvent +// purpose : Close dialog +//================================================================================= +void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* e ) +{ + onClose(); +} + +//================================================================================= +// function : activateSelection +// purpose : activate selection of faces, shells, and solids +//================================================================================= +void RepairGUI_FreeBoundDlg::activateSelection() +{ + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_FACE ); + aMap.Add( GEOM_SHELL ); + aMap.Add( GEOM_SOLID ); + aMap.Add( GEOM_COMPOUND ); + globalSelection( aMap ); +} + +//================================================================================= +// function : createOperation +// purpose : Create operation +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_FreeBoundDlg::isValid( QString& msg ) +{ + return !myObj->_is_nil(); +} + +//================================================================================= +// function : execute +// purpose : Get free boundaries +//================================================================================= +bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects ) +{ + if ( !IsPreview() || myObj->_is_nil() ) + return false; + + GEOM::ListOfGO_var aClosed, anOpen; + + bool result = GEOM::GEOM_IHealingOperations::_narrow( + getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen ); + + if ( result ) + { + myNbClosed = aClosed->length(); + myNbOpen = anOpen->length(); + int i; + for ( i = 0; i < myNbClosed; i++ ) + objects.push_back( aClosed[i]._retn() ); + for ( i = 0; i < myNbOpen; i++ ) + objects.push_back( anOpen[i]._retn() ); + + myEdit->setText( GEOMBase::GetName( myObj ) ); + QString aLabelText = tr( "NUMBER_CLOSED" ) + QString( "%1" ).arg( myNbClosed ); + myClosedLbl->setText( aLabelText ); + aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen ); + myOpenLbl->setText( aLabelText ); + } + else + { + myEdit->setText( GEOMBase::GetName( myObj ) ); + myClosedLbl->setText( tr( "NUMBER_CLOSED" ) ); + myOpenLbl->setText( tr( "NUMBER_OPEN" ) ); + } + + return result; +} + + + diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx new file mode 100644 index 000000000..3143b7fec --- /dev/null +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx @@ -0,0 +1,330 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_FreeFacesDlg.cxx +// Author : VKN +// Module : GEOM +// $Header$ + +#include "RepairGUI_FreeFacesDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" + +#include "SUIT_Session.h" +#include "SUIT_OverrideCursor.h" + +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" +#include +#include +#include +#include "GEOMBase.h" +#include "GeometryGUI.h" +#include "GEOM_Displayer.h" + +#include +#include +#include +#include +#include +#include +#define SPACING 5 +#define MARGIN 10 +#define MIN_WIDTH 200 + +using namespace std; + +//================================================================================= +// class : RepairGUI_FreeFacesDlg() +// purpose : Constructs a RepairGUI_FreeFacesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) +:QDialog( parent, "RepairGUI_FreeBoundDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ), + myGeomGUI( GUI ) +{ + myDisplayer = 0; + + setSizeGripEnabled( TRUE ); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FREE_FACES_TITLE")); + + /***************************************************************/ + + QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_SELECTED_SHAPE" ), this ); + + + QGroupBox* aSelGrp = new QGroupBox( 1, Qt::Vertical, aMainGrp ); + + aSelGrp->setInsideMargin( 0 ); + aSelGrp->setFrameStyle( QFrame::NoFrame ); + new QLabel( tr( "GEOM_OBJECT" ), aSelGrp ); + mySelBtn = new QPushButton( aSelGrp ); + mySelBtn->setPixmap( image1 ); + myEdit = new QLineEdit( aSelGrp ); + myEdit->setReadOnly( true ); + myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myEdit->setMinimumWidth( MIN_WIDTH ); + + QFrame* aFrame = new QFrame( this ); + aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); + QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame ); + QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame, MARGIN, SPACING ); + aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + aBtnLay->addWidget( aCloseBtn ); + aBtnLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + + QVBoxLayout* aLay = new QVBoxLayout( this ); + aLay->setSpacing( SPACING ); + aLay->setMargin( MARGIN ); + aLay->addWidget( aMainGrp ); + aLay->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + aLay->addWidget( aFrame ); + + connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); + connect( mySelBtn, SIGNAL( clicked() ), + this, SLOT ( onSetEditCurrentArgument() ) ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_FreeFacesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_FreeFacesDlg::~RepairGUI_FreeFacesDlg() +{ +} + + +//================================================================================= +// function : onClose +// purpose : SLOT. Called when "close" button pressed. Close dialog +//================================================================================= +void RepairGUI_FreeFacesDlg::onClose() +{ + globalSelection(); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); + reject(); + erasePreview(); +} + +//================================================================================= +// function : onDeactivate +// purpose : Deactivate this dialog +//================================================================================= +void RepairGUI_FreeFacesDlg::onDeactivate() +{ + setEnabled(false); + globalSelection(); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); +} + +//================================================================================= +// function : onActivate +// purpose : Activate this dialog +//================================================================================= +void RepairGUI_FreeFacesDlg::onActivate() +{ + myGeomGUI->EmitSignalDeactivateDialog(); + setEnabled( true ); + myGeomGUI->SetActiveDialogBox( this ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + activateSelection(); +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_FreeFacesDlg::Init() +{ + myObj = GEOM::GEOM_Object::_nil(); + + /* signals and slots connections */ + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + + activateSelection(); + onSelectionDone(); +} + +//================================================================================= +// function : onSelectionDone +// purpose : SLOT. Called when selection changed. +//================================================================================= +void RepairGUI_FreeFacesDlg::onSelectionDone() +{ + erasePreview(); + if( IObjectCount() != 1 ) + { + myEdit->setText( "" ); + return; + } + + Standard_Boolean isOk = Standard_False; + GEOM::GEOM_Object_var anObj = + GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk ); + + if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) + { + myEdit->setText( "" ); + return; + } + else + { + myObj = anObj; + displayPreview( false, true, true, 3 ); + } +} + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_FreeFacesDlg::enterEvent(QEvent* e) +{ + onActivate(); +} + +//================================================================================= +// function : activateSelection +// purpose : activate selection of faces, shells, and solids +//================================================================================= +void RepairGUI_FreeFacesDlg::activateSelection() +{ + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_SOLID ); + aMap.Add( GEOM_COMPOUND ); + globalSelection( aMap ); +} + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_FreeFacesDlg::closeEvent(QCloseEvent* e) +{ + onClose(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_FreeFacesDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_FreeFacesDlg::isValid( QString& msg ) +{ + return !myObj->_is_nil() ; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) +{ + bool aResult = false; + GEOM::ListOfLong_var aFaceLst = + GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->GetFreeFacesIDs( myObj ); + TopoDS_Shape aSelShape; + TopoDS_Shape aFace; + TopTools_IndexedMapOfShape anIndices; + if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) + { + myEdit->setText( GEOMBase::GetName( myObj ) ); + QString aMess; + if ( !isValid( aMess ) ) + { + erasePreview( true ); + return false; + } + + SUIT_OverrideCursor(); + + TopExp::MapShapes( aSelShape, anIndices); + SALOME_Prs* aPrs = 0; + + for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) + { + aFace = anIndices.FindKey( aFaceLst[i] ); + try + { + getDisplayer()->SetColor( Quantity_NOC_RED ); + getDisplayer()->SetToActivate( false ); + aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0; + if ( aPrs ) + displayPreview( aPrs, true ); + } + catch( const SALOME::SALOME_Exception& e ) + { + SalomeApp_Tools::QtCatchCorbaException( e ); + } + } + } + return aResult; +} + +//================================================================ +// Function : getDisplayer +// Purpose : +//================================================================ +GEOM_Displayer* RepairGUI_FreeFacesDlg::getDisplayer() +{ + if ( !myDisplayer ) + myDisplayer = new GEOM_Displayer( getStudy() ); + return myDisplayer; +} + +//================================================================================= +// function : SetEditCurrentArgument +// purpose : +//================================================================================= +void RepairGUI_FreeFacesDlg::onSetEditCurrentArgument() +{ + myEdit->setFocus(); + onSelectionDone(); +} + diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx new file mode 100644 index 000000000..789a0a704 --- /dev/null +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -0,0 +1,447 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_GlueDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_GlueDlg.h" +#include "DlgRef_1Sel_Ext.h" +#include "GEOMImpl_Types.hxx" + +#include "QtxDblSpinBox.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_Tools.h" + +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_OverrideCursor.h" + +#include "SALOME_ListIteratorOfListIO.hxx" + +#include + +#include +#include + +using namespace std; + +#define DEFAULT_TOLERANCE_VALUE 1e-07 + +//================================================================================= +// class : RepairGUI_GlueDlg() +// purpose : Constructs a RepairGUI_GlueDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_GLUE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_GLUE_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + + QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); + QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); + myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt->setPrecision( 10 ); + myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); + + aLay->addWidget( aLbl1, 0, 0 ); + aLay->addWidget( myTolEdt, 0, 1 ); + + GroupPoints->getGroupBoxLayout()->addLayout( aLay, 3, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_GlueDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_GlueDlg::~RepairGUI_GlueDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState( 0 ); + globalSelection( GEOM_COMPOUND ); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GLUE_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_GlueDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_GlueDlg::ClickOnApply() +{ + if ( !onAcceptLocal() ) + return false; + + initName(); + + GroupPoints->LineEdit1->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + globalSelection( GEOM_COMPOUND ); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_GlueDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + if ( IObjectCount() == 1 ) { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes ) + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == GroupPoints->PushButton1 ) { + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == GroupPoints->LineEdit1 ) { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + GroupPoints->LineEdit1->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState( 0 ); + globalSelection( GEOM_COMPOUND ); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_GlueDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation() +{ + return getGeomEngine()->GetIShapesOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_GlueDlg::isValid( QString& msg ) +{ + return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_GlueDlg::execute( ObjectList& objects ) +{ + bool aResult = false; + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow + ( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value() ); + aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + + return aResult; +} + +//================================================================ +// Function : clearShapeBufferLocal +// Purpose : +//================================================================ +void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) +{ + if ( CORBA::is_nil( theObj ) ) + return; + + string IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj ); + TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) ); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + + if ( !getStudy() || !( getStudy()->studyDS() ) ) + return; + + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !aSObj ) + return; + + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); + for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + _PTR(GenericAttribute) anAttr; + if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { + _PTR(AttributeIOR) anIOR ( anAttr ); + TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + } + } +} + +//================================================================ +// Function : onAccept +// Purpose : This method should be called from dialog's slots onOk() and onApply() +// It perfroms user input validation, then it +// performs a proper operation and manages transactions, etc. +//================================================================ +bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransaction ) +{ + if ( !getStudy() || !( getStudy()->studyDS() ) ) + return false; + + _PTR(Study) aStudy = getStudy()->studyDS(); + + bool aLocked = aStudy->GetProperties()->IsLocked(); + if ( aLocked ) { + MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); + SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + return false; + } + + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return false; + } + + erasePreview( false ); + + try { + if ( ( !publish && !useTransaction ) || openCommand() ) { + + SUIT_OverrideCursor wc; + + SUIT_Session::session()->activeApplication()->putInfo( "" ); + ObjectList objects; + // JFA 28.12.2004 if ( !execute( objects ) || !getOperation()->IsDone() ) { + if ( !execute( objects ) ) { // JFA 28.12.2004 // To enable warnings + wc.suspend(); + abortCommand(); + showError(); + } + else { + const int nbObjs = objects.size(); + bool withChildren = false; + for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) { + if ( publish ) { + QString aName(""); + if ( nbObjs > 1 ) + aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) ); + else { + aName = getNewObjectName(); + // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName() + if ( aName.isEmpty() ) + aName = GEOMBase::GetDefaultName( getPrefix( *it ) ); + } + addInStudy( *it, aName.latin1() ); + withChildren = false; + display( *it, false ); + } + else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client + // before redisplay + clearShapeBufferLocal( *it ); + withChildren = true; + redisplay( *it, withChildren, false ); + } + } + + if ( nbObjs ) { + commitCommand(); + updateObjBrowser(); + SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + } + else { + abortCommand(); + } + + // JFA 28.12.2004 BEGIN // To enable warnings + if ( !getOperation()->_is_nil() ) { + if ( !getOperation()->IsDone() ) { + wc.suspend(); + QString msgw = QObject::tr( getOperation()->GetErrorCode() ); + SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), + QObject::tr( "WRN_WARNING" ), + msgw, + QObject::tr( "BUT_OK" )); + } + } + // JFA 28.12.2004 END + } + } + } + catch( const SALOME::SALOME_Exception& e ) { + SalomeApp_Tools::QtCatchCorbaException( e ); + abortCommand(); + } + + updateViewer(); + + return true; +} diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx new file mode 100644 index 000000000..6dc3188eb --- /dev/null +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx @@ -0,0 +1,448 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_RemoveHolesDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_RemoveHolesDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" + +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_RemoveHolesDlg() +// purpose : Constructs a RepairGUI_RemoveHolesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_HOLES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_REMOVE_HOLES_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_REMOVE_HOLES_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_HOLES")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + + myAllChk = new QCheckBox( tr( "GEOM_REMOVE_ALL_HOLES" ), GroupPoints->GroupBox1 ); + + QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay"); + + mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" ); + mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) ); + mySelectWiresBtn->setText( trUtf8( "" ) ); + mySelectWiresBtn->setPixmap(image1); + + mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" ); + mySelectWiresEdt->setReadOnly( true ); + + mySelectWiresLbl = new QLabel( tr( "GEOM_WIRES_TO_REMOVE" ), GroupPoints->GroupBox1, "TextLabel1" ); + mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) ); + + aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 ); + aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 ); + aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + aSelectWiresLay->addItem( spacer, 1, 2 ); + + QGridLayout* aDetectLay = new QGridLayout( 0, 1, 1, 0, 6, "aDetectLay" ); + myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 ); + QLabel* aLbl = new QLabel( tr( "GEOM_FREE_BOUNDARIES" ), GroupPoints->GroupBox1 ); + aDetectLay->addWidget( aLbl, 0, 0 ); + aDetectLay->addWidget( myFreeBoundBtn, 0, 1 ); + + GroupPoints->getGroupBoxLayout()->addMultiCellWidget( myAllChk, 1, 1, 0, 2 ); + GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 2, 0 ); + GroupPoints->getGroupBoxLayout()->addLayout( aDetectLay, 3, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_RemoveHolesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_RemoveHolesDlg::~RepairGUI_RemoveHolesDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd = new GEOM::short_array(); + myWiresInd->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); + + myClosed = -1; + myOpen = -1; + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); + connect( myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect()) ); + + initName( tr( "REMOVE_HOLES_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_RemoveHolesDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_RemoveHolesDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + mySelectWiresEdt->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_RemoveHolesDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); + + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection + { + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes && GEOMBase::IsShape( myObject ) ) + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + else + myObject = GEOM::GEOM_Object::_nil(); + } + else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) + { + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + const int n = aMap.Extent(); + myWiresInd->length( n ); + for ( int i = 1; i <= n; i++ ) + myWiresInd[i-1] = aMap( i ); + if ( n ) + myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) ); + } + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == GroupPoints->PushButton1 ) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) + myEditCurrentArgument = mySelectWiresEdt; + if ( myEditCurrentArgument ) + { + initSelection(); + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) + { + myEditCurrentArgument = (QLineEdit*)send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + mySelectWiresEdt->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + myClosed = -1; + myOpen = -1; + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_RemoveHolesDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_RemoveHolesDlg::isValid( QString& msg ) +{ + myClosed = -1; + return !myObject->_is_nil() && ( IsPreview() || myAllChk->isChecked() || myWiresInd->length() ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_RemoveHolesDlg::execute( ObjectList& objects ) +{ + bool aResult = false; + if ( IsPreview() ) // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog + { + GEOM::ListOfGO_var aClosed, anOpen; + + aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen ); + + if ( aResult ) + { + myClosed = aClosed->length(); + myOpen = anOpen->length(); + int i; + for ( i = 0; i < myClosed; i++ ) + objects.push_back( aClosed[i]._retn() ); + for ( i = 0; i < myOpen; i++ ) + objects.push_back( anOpen[i]._retn() ); + } + else + myClosed = -1; + } + else + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->FillHoles( myObject, myWiresInd ); + aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + } + + return aResult; +} + +//================================================================================= +// function : onRemoveAllClicked +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::onRemoveAllClicked() +{ + bool b = myAllChk->isOn(); + mySelectWiresLbl->setEnabled( !b ); + mySelectWiresBtn->setEnabled( !b ); + mySelectWiresEdt->setEnabled( !b ); + if ( b ) + { + mySelectWiresEdt->setText( "" ); + myWiresInd->length( 0 ); + } +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::initSelection() +{ + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + { + TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_COMPOUND ); + aTypes.Add( GEOM_SOLID ); + aTypes.Add( GEOM_SHELL ); + aTypes.Add( GEOM_FACE ); + + globalSelection( aTypes ); + } + else if ( myEditCurrentArgument == mySelectWiresEdt ) + { + localSelection( myObject, TopAbs_EDGE ); + localSelection( myObject, TopAbs_WIRE ); + } +} + + +//================================================================================= +// function : onDetect +// purpose : +//================================================================================= +void RepairGUI_RemoveHolesDlg::onDetect() +{ + displayPreview( false, true, true, 3 ); + + // field myClosed,myOpen is initialized in execute() method, called by displayPreview(). + QString msg; + if ( myClosed != -1 ) + msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); + else + msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); + SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); +} + diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx new file mode 100644 index 000000000..91822ded9 --- /dev/null +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx @@ -0,0 +1,391 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_RemoveIntWiresDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_RemoveIntWiresDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_RemoveIntWiresDlg() +// purpose : Constructs a RepairGUI_RemoveIntWiresDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_INT_WIRES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_REMOVE_INTERNAL_WIRES_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_REMOVE_INTERNAL_WIRES_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_INTERNAL_WIRES")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_FACE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + + myAllChk = new QCheckBox( tr( "GEOM_REMOVE_ALL_INT_WIRES" ), GroupPoints->GroupBox1 ); + + QGridLayout* aSelectWiresLay = new QGridLayout( 0, 1, 1, 0, 6, "aSelectWiresLay"); + + mySelectWiresBtn = new QPushButton( GroupPoints->GroupBox1, "mySelectWiresBtn" ); + mySelectWiresBtn->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresBtn->sizePolicy().hasHeightForWidth() ) ); + mySelectWiresBtn->setText( trUtf8( "" ) ); + mySelectWiresBtn->setPixmap(image1); + + mySelectWiresEdt = new QLineEdit( GroupPoints->GroupBox1, "mySelectWiresEdt" ); + mySelectWiresEdt->setReadOnly( true ); + + mySelectWiresLbl = new QLabel( tr( "GEOM_WIRES_TO_REMOVE" ), GroupPoints->GroupBox1, "TextLabel1" ); + mySelectWiresLbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, mySelectWiresLbl->sizePolicy().hasHeightForWidth() ) ); + + aSelectWiresLay->addWidget( mySelectWiresLbl, 0, 0 ); + aSelectWiresLay->addWidget( mySelectWiresBtn, 0, 1 ); + aSelectWiresLay->addWidget( mySelectWiresEdt, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + aSelectWiresLay->addItem( spacer, 1, 2 ); + + GroupPoints->getGroupBoxLayout()->addMultiCellWidget( myAllChk, 1, 1, 0, 2 ); + GroupPoints->getGroupBoxLayout()->addLayout( aSelectWiresLay, 2, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_RemoveIntWiresDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_RemoveIntWiresDlg::~RepairGUI_RemoveIntWiresDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd = new GEOM::short_array(); + myWiresInd->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); + + initName( tr( "REMOVE_INT_WIRES_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_RemoveIntWiresDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + mySelectWiresEdt->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); + + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection + { + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes && GEOMBase::IsShape( myObject ) ) + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + else + myObject = GEOM::GEOM_Object::_nil(); + } + else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) + { + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + const int n = aMap.Extent(); + myWiresInd->length( n ); + for ( int i = 1; i <= n; i++ ) + myWiresInd[i-1] = aMap( i ); + if ( n ) + myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) ); + } + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == GroupPoints->PushButton1 ) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if ( send == mySelectWiresBtn && !myObject->_is_nil() ) + myEditCurrentArgument = mySelectWiresEdt; + + if ( myEditCurrentArgument ) + { + initSelection(); + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == GroupPoints->LineEdit1 || send == mySelectWiresEdt ) + { + myEditCurrentArgument = (QLineEdit*)send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + mySelectWiresEdt->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + myWiresInd->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_RemoveIntWiresDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_RemoveIntWiresDlg::isValid( QString& msg ) +{ + return !myObject->_is_nil() && ( myAllChk->isChecked() || myWiresInd->length() ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_RemoveIntWiresDlg::execute( ObjectList& objects ) +{ + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->RemoveIntWires( myObject, myWiresInd ); + bool aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + + return aResult; +} + +//================================================================================= +// function : onRemoveAllClicked +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::onRemoveAllClicked() +{ + bool b = myAllChk->isOn(); + mySelectWiresLbl->setEnabled( !b ); + mySelectWiresBtn->setEnabled( !b ); + mySelectWiresEdt->setEnabled( !b ); + if ( b ) + { + mySelectWiresEdt->setText( "" ); + myWiresInd->length( 0 ); + } +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_RemoveIntWiresDlg::initSelection() +{ + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) + { + TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_COMPOUND ); + aTypes.Add( GEOM_SOLID ); + aTypes.Add( GEOM_SHELL ); + aTypes.Add( GEOM_FACE ); + + globalSelection( aTypes ); + } + else if ( myEditCurrentArgument == mySelectWiresEdt ) + { + //localSelection( myObject, TopAbs_EDGE ); + localSelection( myObject, TopAbs_WIRE ); + } +} + + diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx new file mode 100644 index 000000000..05ed77509 --- /dev/null +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -0,0 +1,369 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_SewingDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_SewingDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include +#include + +#define DEFAULT_TOLERANCE_VALUE 1e-07 + +using namespace std; + +//================================================================================= +// class : RepairGUI_SewingDlg() +// purpose : Constructs a RepairGUI_SewingDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SEWING"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SEWING_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SEWING_TITLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_Ext(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_SEWING")); + GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + + QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); + myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt->setPrecision( 10 ); + myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); + QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); + myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 ); + QLabel* aLbl2 = new QLabel( tr( "GEOM_FREE_BOUNDARIES" ), GroupPoints->GroupBox1 ); + aLay->addWidget( aLbl1, 0, 0 ); + aLay->addWidget( myTolEdt, 0, 1 ); + aLay->addWidget( aLbl2, 1, 0 ); + aLay->addWidget( myFreeBoundBtn, 1, 1 ); + + GroupPoints->getGroupBoxLayout()->addLayout( aLay, 3, 0 ); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_SewingDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_SewingDlg::~RepairGUI_SewingDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObject = GEOM::GEOM_Object::_nil(); + + //myGeomGUI->SetState( 0 ); + initSelection(); + + myClosed = -1; + myOpen = -1; + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + connect(myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect())); + + initName( tr( "SEWING_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_SewingDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_SewingDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + GroupPoints->LineEdit1->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection +//================================================================================= +void RepairGUI_SewingDlg::SelectionIntoArgument() +{ + erasePreview(); + myEditCurrentArgument->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes ) + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + } +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::SetEditCurrentArgument() +{ + const QObject* send = sender(); + if ( send == GroupPoints->PushButton1 ) + { + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::LineEditReturnPressed() +{ + const QObject* send = sender(); + if( send == GroupPoints->LineEdit1 ) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + GroupPoints->LineEdit1->setText(""); + myObject = GEOM::GEOM_Object::_nil(); + + myClosed = -1; + myOpen = -1; + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_SewingDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_SewingDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_SewingDlg::isValid( QString& msg ) +{ + myClosed = -1; + return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_SewingDlg::execute( ObjectList& objects ) +{ + bool aResult = false; + if ( IsPreview() ) // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog + { + GEOM::ListOfGO_var aClosed, anOpen; + + aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen ); + + if ( aResult ) + { + myClosed = aClosed->length(); + myOpen = anOpen->length(); + int i; + for ( i = 0; i < myClosed; i++ ) + objects.push_back( aClosed[i]._retn() ); + for ( i = 0; i < myOpen; i++ ) + objects.push_back( anOpen[i]._retn() ); + } + else + myClosed = -1; + } + else + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() ); + aResult = !anObj->_is_nil(); + if ( aResult ) + objects.push_back( anObj._retn() ); + } + + return aResult; +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::initSelection() +{ + TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_SHELL ); + aTypes.Add( GEOM_SOLID ); + aTypes.Add( GEOM_COMPOUND ); + globalSelection( aTypes ); +} + +//================================================================================= +// function : onDetect +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::onDetect() +{ + displayPreview( false, true, true, 3 ); + + // field myClosed,myOpen is initialized in execute() method, called by displayPreview(). + QString msg; + if ( myClosed != -1 ) + msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); + else + msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); + SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); +} diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx new file mode 100755 index 000000000..7c9005a1a --- /dev/null +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -0,0 +1,847 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_ShapeProcessDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_ShapeProcessDlg.h" + +#include "GEOMImpl_Types.hxx" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_ListIO.hxx" + +#include +#include + +#include +#include +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_ShapeProcessDlg() +// purpose : Constructs a RepairGUI_ShapeProcessDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + init(); +} + + +//================================================================================= +// function : ~RepairGUI_ShapeProcessDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_ShapeProcessDlg::~RepairGUI_ShapeProcessDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::init() +{ + //myGeomGUI->SetState( 0 ); + + initParamsValues(); + initSelection(); + + setCaption(tr("GEOM_SHAPEPROCESS_TITLE")); + + GroupConstructors->hide(); + + // select widget on the top + mySelectWdgt = new DlgRef_1Sel_QTD( this, "SelectedObjects" ); + mySelectWdgt->GroupBox1->setTitle( tr("GEOM_SHAPE") ); + mySelectWdgt->TextLabel1->setText( tr("GEOM_SELECTED_OBJECTS") ); + mySelectWdgt->PushButton1->setPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")) ); + mySelectWdgt->LineEdit1->setReadOnly( true ); + + Layout1->addWidget( mySelectWdgt, 0, 0 ); + + // layout the two group boxes in the middle, add a list of operations + QFrame* aMidFrame = new QFrame( this ); + QGridLayout* aMidLay = new QGridLayout( aMidFrame, 1, 3, 0, 5 ); + QGroupBox* anOperGr = new QGroupBox( tr("GEOM_OPERATIONS"), aMidFrame ); + QVBoxLayout* aOperLay = new QVBoxLayout( anOperGr, 0, 0 ); + + myOpList = new QListView( anOperGr ); + myOpList->setSorting( -1 ); + myOpList->addColumn( "Operations" ); + myOpList->header()->hide(); + aOperLay->addWidget( myOpList ); + QStringList::ConstIterator it = myOpLst.end(); + do // iterating from end to begin so to keep the order of items in the listview. + new QCheckListItem ( myOpList, *(--it), QCheckListItem::CheckBox ); + while ( it != myOpLst.begin() ); + + QGroupBox* aParamsGr = new QGroupBox( tr("GEOM_PARAMETERS"), aMidFrame ); + aMidLay->addWidget( anOperGr, 0, 0 ); + aMidLay->addMultiCellWidget( aParamsGr, 0, 0, 1, 3 ); + aMidLay->setColStretch( 0, 1 ); + aMidLay->setColStretch( 1, 2 ); + + Layout1->addWidget( aMidFrame, 2, 0 ); + Layout1->setRowStretch( 0, 0 ); + Layout1->setRowStretch( 1, 1 ); + + // add a widget stack to the parameters group box + myStack = new QWidgetStack( aParamsGr ); + QVBoxLayout* aVParamsLay = new QVBoxLayout( aParamsGr ); + aVParamsLay->addWidget( myStack ); + + // continueties values.. + QStringList aContinueties = QStringList::split( ",", "C0,G1,C1,G2,C2,C3,CN" ); + + // FixShape + QFrame* aFrame = new QFrame( myStack ); + QGridLayout* aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + myFixShapeTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixShapeTol3D->setPrecision( 10 ); + myFixShapeMaxTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixShapeMaxTol3D->setPrecision( 10 ); + + aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); + aLay->addWidget( myFixShapeTol3D, 0, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_MAX_3D_TOLERANCE"), aFrame ), 1, 0 ); + aLay->addWidget( myFixShapeMaxTol3D, 1, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "FixShape" ) ); + + // FixFaceSize + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + myFixFaceSizeTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixFaceSizeTol->setPrecision( 10 ); + + aLay->addWidget( new QLabel( tr("GEOM_TOLERANCE"), aFrame ), 0, 0 ); + aLay->addWidget( myFixFaceSizeTol, 0, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "FixFaceSize" ) ); + + // DropSmallEdges + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + myDropSmallEdgesTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myDropSmallEdgesTol3D->setPrecision( 10 ); + + aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); + aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "DropSmallEdges" ) ); + + // SplitAngle + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + mySplitAngleAngle = new QtxDblSpinBox( 0, 360, 1, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 360, 1 ); + mySplitAngleMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitAngleMaxTol->setPrecision( 10 ); + + aLay->addWidget( new QLabel( tr("GEOM_ANGLE_1"), aFrame ), 0, 0 ); + aLay->addWidget( mySplitAngleAngle, 0, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame ), 1, 0 ); + aLay->addWidget( mySplitAngleMaxTol, 1, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "SplitAngle" ) ); + + // SplitClosedFaces + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + mySplitClosedFacesNum = new QSpinBox( aFrame ); + + aLay->addWidget( new QLabel( tr("GEOM_NUM_SPLIT_POINTS"), aFrame ), 0, 0 ); + aLay->addWidget( mySplitClosedFacesNum, 0, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "SplitClosedFaces" ) ); + + // SplitContinuity + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + mySplitContTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitContTol3D->setPrecision( 10 ); + mySplitContSurfCont = new QComboBox( aFrame ); + mySplitContSurfCont->insertStringList( aContinueties ); + mySplitContCurvCont = new QComboBox( aFrame ); + mySplitContCurvCont->insertStringList( aContinueties ); + + aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); + aLay->addWidget( mySplitContTol3D, 0, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_SURFACE_CONTINUTY"), aFrame ), 1, 0 ); + aLay->addWidget( mySplitContSurfCont, 1, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_CURVE_CONTINUTY"), aFrame ), 2, 0 ); + aLay->addWidget( mySplitContCurvCont, 2, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "SplitContinuity" ) ); + + // BSplineRestriction + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); + myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); + myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); + + myBSplineTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myBSplineTol3D->setPrecision( 10 ); + + myBSplineTol2D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myBSplineTol2D->setPrecision( 10 ); + + myBSplineDegree = new QSpinBox( aFrame ); + myBSplineSegments = new QSpinBox( aFrame ); + myBSpline2DCont = new QComboBox( aFrame ); + myBSpline2DCont->insertStringList( aContinueties ); + myBSpline3DCont = new QComboBox( aFrame ); + myBSpline3DCont->insertStringList( aContinueties ); + + myBSplineSurfModeChk->setChecked( true ); + myBSpline3DCurveChk->setChecked( true ); + myBSpline2DCurveChk->setChecked( true ); + + aLay->addWidget( myBSplineSurfModeChk, 0, 0 ); + aLay->addWidget( myBSpline3DCurveChk, 1, 0 ); + aLay->addWidget( myBSpline2DCurveChk, 2, 0 ); + aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame), 3, 0 ); + aLay->addWidget( myBSplineTol3D, 3, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_2D_TOLERANCE"), aFrame), 4, 0 ); + aLay->addWidget( myBSplineTol2D, 4, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_DEGREE"), aFrame), 5, 0 ); + aLay->addWidget( myBSplineDegree, 5, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_REQUIRED_NUM_SEGMENTS"), aFrame), 6, 0 ); + aLay->addWidget( myBSplineSegments, 6, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_3D_CONTINUTY"), aFrame), 7, 0 ); + aLay->addWidget( myBSpline3DCont, 7, 1 ); + aLay->addWidget( new QLabel( tr("GEOM_2D_CONTINUTY"), aFrame), 8, 0 ); + aLay->addWidget( myBSpline2DCont, 8, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "BSplineRestriction" ) ); + + // ToBezier + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); + myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); + myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); + + myToBezierMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myToBezierMaxTol->setPrecision( 10 ); + + aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); + aLay->addWidget( myToBezier3DCurveChk, 1, 0 ); + aLay->addWidget( myToBezier2DCurveChk, 2, 0 ); + aLay->addWidget( new QLabel( tr("GEOM_MAX_TOLERANCE"), aFrame), 3, 0 ); + aLay->addWidget( myToBezierMaxTol, 3, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "ToBezier" ) ); + + // SameParameter + aFrame = new QFrame( myStack ); + aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); + + mySameParameterTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySameParameterTol3D->setPrecision( 10 ); + + aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); + aLay->addWidget( mySameParameterTol3D, 0, 1 ); + aLay->setRowStretch( 9, 2 ); + + myStack->addWidget( aFrame, myOpLst.findIndex( "SameParameter" ) ); + + // signals and slots connections + connect( myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(deactivate()) ); + connect( myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onCancel()) ); + + connect( buttonCancel, SIGNAL(clicked()), this, SLOT(onCancel()) ); + connect( buttonOk, SIGNAL(clicked()), this, SLOT(onOk()) ); + connect( buttonApply, SIGNAL(clicked()), this, SLOT(onApply()) ); + + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged()) ); + connect( myOpList, SIGNAL(selectionChanged()), this, SLOT(operationChanged()) ); + + connect( mySelectWdgt->PushButton1, SIGNAL(clicked()), this, SLOT(selectClicked()) ); + connect( mySelectWdgt->LineEdit1, SIGNAL(returnPressed()), this, SLOT(lineEditReturnPressed()) ); + + connect( myToBezierSurfModeChk, SIGNAL(toggled(bool)), SLOT(advOptionToggled(bool)) ); + + adjustSize(); + loadDefaults(); // init dialog fields with values from resource file + myOpList->setSelected( myOpList->findItem( "FixShape", 0 ), true ); + reset(); + + initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ) ); +} + +//================================================================================= +// function : operationChanged() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::operationChanged() +{ + QListViewItem* anItem = myOpList->selectedItem(); + if ( anItem ) + { + int id = myOpLst.findIndex( anItem->text(0) ); + if ( id > -1 ) + myStack->raiseWidget( id ); + } +} + +//================================================================================= +// function : onOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_ShapeProcessDlg::onOk() +{ + if ( onApply() ) + onCancel(); +} + + + +//================================================================================= +// function : onApply() +// purpose : +//================================================================================= +bool RepairGUI_ShapeProcessDlg::onApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + reset(); + initSelection(); + + return true; +} + + +//================================================================================= +// function : onCancel() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::onCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : selectionChanged() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void RepairGUI_ShapeProcessDlg::selectionChanged() +{ + reset(); + + Standard_Boolean aRes = Standard_False; + int i = 0; + myObjects->length( IObjectCount() ); + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) + { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + myObjects[i++] = aSelectedObject; + } + myObjects->length( i ); + if ( i == 1 ) + mySelectWdgt->LineEdit1->setText( GEOMBase::GetName( myObjects[0] ) ); + else if ( i > 0 ) + mySelectWdgt->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_OBJECTS" ) ); +} + + +//================================================================================= +// function : selectClicked() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::selectClicked() +{ + myEditCurrentArgument = mySelectWdgt->LineEdit1; + mySelectWdgt->LineEdit1->setFocus(); + selectionChanged(); +} + + +//================================================================================= +// function : lineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::lineEditReturnPressed() +{ + GEOMBase_Skeleton::LineEditReturnPressed(); +} + + +//================================================================================= +// function : deactivate() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::deactivate() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : activate() +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::activate() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged())); + + reset(); + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_ShapeProcessDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + activate(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : same than click on cancel button +//================================================================================= +void RepairGUI_ShapeProcessDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : reset() +// purpose : Completely reset the state of method including local context +//================================================================================= +void RepairGUI_ShapeProcessDlg::reset() +{ + myObjects = new GEOM::ListOfGO(); + myObjects->length( 0 ); + mySelectWdgt->LineEdit1->setText(""); +} + + +//================================================================================= +// function : get_convert +// purpose : conversion of angle values to radians (non-angle values are not converted) +//================================================================================= +const char* get_convert( const char* theParam, const char* theValue ) +{ + if ( !strcmp( theParam, "SplitAngle.Angle" ) ) + { + double doubleValue = atof( theValue ) * PI / 180; + TCollection_AsciiString str( doubleValue ); + return CORBA::string_dup( str.ToCString() ); + } + return CORBA::string_dup( theValue ); +} + +//================================================================================= +// function : set_convert +// purpose : conversion of angle values to degrees (non-angle values are not converted) +//================================================================================= +const char* set_convert( const char* theParam, const char* theValue ) +{ + if ( !strcmp( theParam, "SplitAngle.Angle" ) ) + { + double doubleValue = atof( theValue ) * 180 / PI; + TCollection_AsciiString str( doubleValue ); + return CORBA::string_dup( str.ToCString() ); + } + return CORBA::string_dup( theValue ); +} + +//================================================================================= +// function : loadDefaults() +// purpose : initialize "values"-fields with default values retrieved from IHealingOperations +//================================================================================= +void RepairGUI_ShapeProcessDlg::loadDefaults() +{ + GEOM::GEOM_IHealingOperations_var anOp = myGeomGUI->GetGeomGen()->GetIHealingOperations( getStudyId() ); + GEOM::string_array_var anOperators, aParams, aValues; + anOp->GetShapeProcessParameters( anOperators, aParams, aValues ); + + // check the default items-operators + int i; + for ( i = 0; i < anOperators->length(); i++ ) + { + //MESSAGE("-->"<<(const char*)anOperators[i]); + QListViewItem* anItem = myOpList->findItem( (const char*)anOperators[i], 0 ); + if ( anItem /*&& anItem->inherits( "QCheckListItem" )*/ ) + ((QCheckListItem*) anItem)->setOn( true ); + } + + // Retrieve default parameters for ALL operators + for ( QListViewItemIterator it(myOpList); it.current(); ++it ) { + CORBA::String_var anOperator = CORBA::string_dup( it.current()->text( 0 ).latin1() ); + anOp->GetOperatorParameters( anOperator.in(), aParams, aValues ); + + // set default values of parameters + if ( aParams->length() != aValues->length() ) + continue; + for ( i = 0; i < aParams->length(); i++ ) { + QWidget* aCtrl = getControl( (const char*)aParams[i] ); + const char* aValue = set_convert( (const char*)aParams[i], aValues[i] ); + setValue( aCtrl, aValue ); + } + } +} + +//================================================================================= +// function : setValue() +// purpose : set value in the proper way +//================================================================================= +void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const char* theValue ) +{ + if ( theControl == NULL || theValue == NULL ) + return; + + if ( theControl->isA( "QtxDblSpinBox" ) ) + ((QtxDblSpinBox*)theControl)->setValue( QString( theValue ).toDouble() ); + else if ( theControl->isA( "QSpinBox" ) ) + ((QSpinBox*)theControl)->setValue( QString( theValue ).toInt() ); + else if ( theControl->isA( "QComboBox" ) ) + ((QComboBox*)theControl)->setCurrentText( QString( theValue ) ); + else if ( theControl->isA( "QCheckBox" ) ) + ((QCheckBox*)theControl)->setChecked( QString( theValue ).toInt() != 0 ); +} + +//================================================================================= +// function : getValue() +// purpose : get value in the proper way +//================================================================================= +const char* RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const +{ + if ( theControl == NULL ) + return ""; + + if ( theControl->isA( "QtxDblSpinBox" ) ) + return ((QtxDblSpinBox*)theControl)->text().latin1(); + else if ( theControl->isA( "QSpinBox" ) ) + return ((QSpinBox*)theControl)->text().latin1(); + else if ( theControl->isA( "QComboBox" ) ) + return ((QComboBox*)theControl)->currentText().latin1(); + else if ( theControl->isA( "QCheckBox" ) ) + return ((QCheckBox*)theControl)->isChecked() ? "1" : "0"; + + return ""; +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_ShapeProcessDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_ShapeProcessDlg::isValid( QString& msg ) +{ + bool error = false; + GEOM::string_array_var anOperators = getActiveOperators(); + if ( !myObjects->length() ) + { + msg += tr( "ERROR_NO_OBJECTS" ); + error = true; + } + if ( !anOperators->length() ) + { + if ( error ) + msg += "\n"; + msg += tr( "ERROR_NO_OPERATORS" ); + error = true; + } + return !error; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects ) +{ + GEOM::string_array_var anOperators = getActiveOperators(); + GEOM::string_array_var aParams = getParameters( anOperators ); + GEOM::string_array_var aValues = getValues( aParams ); + + /*//-- check -- + int z; + MESSAGE("Objects : "); + for ( z = 0; z < myObjects->length(); z++ ) + MESSAGE(myObjects[z]->GetName() << " "); + MESSAGE("\nOperators : "); + for ( z = 0; z < anOperators->length(); z++ ) + MESSAGE(anOperators[z] << " "); + MESSAGE("\nParameters : "); + for ( z = 0; z < aParams->length(); z++ ) + MESSAGE(aParams[z] << " "); + MESSAGE("\nValues : "); + for ( z = 0; z < aValues->length(); z ++ ) + MESSAGE(aValues[z] << " "); + MESSAGE("\n"); + */// ----------- + + QStringList anErrorObjNames; + for ( int i = 0; i < myObjects->length(); i++ ) + { + GEOM::GEOM_Object_var obj = myObjects[i]; + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ProcessShape( + obj, anOperators, aParams, aValues ); + if ( anObj->_is_nil() ) + anErrorObjNames << GEOMBase::GetName( obj ); + else + objects.push_back( anObj._retn() ); + } + + if ( !anErrorObjNames.empty() ) + MESSAGE("ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " )); + + return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing. +} + +//================================================================================= +// function : getActiveOperators +// purpose : +//================================================================================= +GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators() +{ + GEOM::string_array_var anOperators = new GEOM::string_array(); + QStringList aCheckedList; + QStringList::Iterator it; + for ( it = myOpLst.begin(); it != myOpLst.end(); ++it ) + if ( ((QCheckListItem*)myOpList->findItem( *it, 0 ))->isOn() ) + aCheckedList << *it; + anOperators->length( aCheckedList.size() ); + int i = 0; + for ( it = aCheckedList.begin(); it != aCheckedList.end(); ++it ) + anOperators[i++] = CORBA::string_dup( (*it).latin1() ); + + return anOperators._retn(); +} + +//================================================================================= +// function : getcontrol +// purpose : +//================================================================================= +QWidget* RepairGUI_ShapeProcessDlg::getControl( const char* theParam ) +{ + string aParam = theParam; + if ( aParam == "SplitAngle.Angle" ) return mySplitAngleAngle; + else if ( aParam == "SplitAngle.MaxTolerance" ) return mySplitAngleMaxTol; + else if ( aParam == "SplitClosedFaces.NbSplitPoints" ) return mySplitClosedFacesNum; + else if ( aParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol; + else if ( aParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D; + else if ( aParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk; + else if ( aParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk; + else if ( aParam == "BSplineRestriction.Curve2dMode" ) return myBSpline2DCurveChk; + else if ( aParam == "BSplineRestriction.Tolerance3d" ) return myBSplineTol3D; + else if ( aParam == "BSplineRestriction.Tolerance2d" ) return myBSplineTol2D; + else if ( aParam == "BSplineRestriction.RequiredDegree" ) return myBSplineDegree; + else if ( aParam == "BSplineRestriction.RequiredNbSegments" ) return myBSplineSegments; + else if ( aParam == "BSplineRestriction.Continuity3d" ) return myBSpline3DCont; + else if ( aParam == "BSplineRestriction.Continuity2d" ) return myBSpline2DCont; + else if ( aParam == "SplitContinuity.Tolerance3d" ) return mySplitContTol3D; + else if ( aParam == "SplitContinuity.SurfaceContinuity" ) return mySplitContSurfCont; + else if ( aParam == "SplitContinuity.CurveContinuity" ) return mySplitContCurvCont; + else if ( aParam == "ToBezier.SurfaceMode" ) return myToBezierSurfModeChk; + else if ( aParam == "ToBezier.Curve3dMode" ) return myToBezier3DCurveChk; + else if ( aParam == "ToBezier.Curve2dMode" ) return myToBezier2DCurveChk; + else if ( aParam == "ToBezier.MaxTolerance" ) return myToBezierMaxTol; + else if ( aParam == "SameParameter.Tolerance3d" ) return mySameParameterTol3D; + else if ( aParam == "FixShape.Tolerance3d" ) return myFixShapeTol3D; + else if ( aParam == "FixShape.MaxTolerance3d" ) return myFixShapeMaxTol3D; + return NULL; +} + +//================================================================================= +// function : getParameters +// purpose : +//================================================================================= +void RepairGUI_ShapeProcessDlg::initParamsValues() +{ + myOpLst << "FixShape"; + myValMap["FixShape"] << "FixShape.Tolerance3d"; + myValMap["FixShape"] << "FixShape.MaxTolerance3d"; + + myOpLst << "FixFaceSize"; + myValMap["FixFaceSize"] << "FixFaceSize.Tolerance"; + + myOpLst << "DropSmallEdges"; + myValMap["DropSmallEdges"] << "DropSmallEdges.Tolerance3d"; + + myOpLst << "SplitAngle"; + myValMap["SplitAngle"] << "SplitAngle.Angle"; + myValMap["SplitAngle"] << "SplitAngle.MaxTolerance"; + + myOpLst << "SplitClosedFaces"; + myValMap["SplitClosedFaces"] << "SplitClosedFaces.NbSplitPoints"; + + myOpLst << "SplitContinuity"; + myValMap["SplitContinuity"] << "SplitContinuity.Tolerance3d"; + myValMap["SplitContinuity"] << "SplitContinuity.SurfaceContinuity"; + myValMap["SplitContinuity"] << "SplitContinuity.CurveContinuity"; + + myOpLst << "BSplineRestriction"; + myValMap["BSplineRestriction"] << "BSplineRestriction.SurfaceMode"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Curve3dMode"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Curve2dMode"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Tolerance3d"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Tolerance2d"; + myValMap["BSplineRestriction"] << "BSplineRestriction.RequiredDegree"; + myValMap["BSplineRestriction"] << "BSplineRestriction.RequiredNbSegments"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Continuity3d"; + myValMap["BSplineRestriction"] << "BSplineRestriction.Continuity2d"; + + myOpLst << "ToBezier"; + myValMap["ToBezier"] << "ToBezier.SurfaceMode"; + myValMap["ToBezier"] << "ToBezier.Curve3dMode"; + myValMap["ToBezier"] << "ToBezier.Curve2dMode"; + myValMap["ToBezier"] << "ToBezier.MaxTolerance"; + + myOpLst << "SameParameter"; + myValMap["SameParameter"] << "SameParameter.Tolerance3d"; +} + +//================================================================================= +// function : getParameters +// purpose : +//================================================================================= +GEOM::string_array* RepairGUI_ShapeProcessDlg::getParameters( const GEOM::string_array& theOperators ) +{ + GEOM::string_array_var aParams = new GEOM::string_array(); + int i( 0 ), j( 0 ); + + // calculate the length of parameters + for ( i = 0, j = 0; i < theOperators.length(); i++ ) + j+= myValMap[QString((const char*)theOperators[i])].size(); + + // set the new length of paremeters + aParams->length( j ); + + // fill the parameters + for ( i = 0, j = 0; i < theOperators.length(); i++ ) + { + QStringList aValLst = myValMap[QString( (const char*)theOperators[i] )]; + for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it ) + aParams[j++] = CORBA::string_dup( (*it).latin1() ); + } + + return aParams._retn(); +} + + +//================================================================================= +// function : getValues +// purpose : +//================================================================================= +GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_array& theParams ) +{ + GEOM::string_array_var aValues = new GEOM::string_array(); + aValues->length( theParams.length() ); + + for ( int i = 0; i < theParams.length(); i++ ) + { + QWidget* aCtrl = getControl( (const char*)theParams[i] ); + if ( aCtrl ) + aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ) ); + } + + return aValues._retn(); +} + +//================================================================================= +// function : initSelection +// purpose : set selection of ALL shape types except vertexes +//================================================================================= +void RepairGUI_ShapeProcessDlg::initSelection() +{ + TColStd_MapOfInteger aTypes; + aTypes.Add( GEOM_COMPOUND ); + aTypes.Add( GEOM_SOLID ); + aTypes.Add( GEOM_SHELL ); + aTypes.Add( GEOM_FACE ); + aTypes.Add( GEOM_WIRE ); + aTypes.Add( GEOM_EDGE ); + globalSelection( aTypes ); +} + +//================================================================================= +// function : advOptionToggled +// purpose : this slot is used to warn the user about possible consequences +// of enabling some advanced options +//================================================================================= +void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on ) +{ + QButton* btn = (QButton*)sender(); + if ( on && btn->isToggleButton() && + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) + btn->toggle(); +} diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx new file mode 100644 index 000000000..4d996d2a1 --- /dev/null +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -0,0 +1,349 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : RepairGUI_SuppressFacesDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "RepairGUI_SuppressFacesDlg.h" + +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "GEOMImpl_Types.hxx" + +#include + +#include + +using namespace std; + +//================================================================================= +// class : RepairGUI_SuppressFacesDlg() +// purpose : Constructs a RepairGUI_SuppressFacesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SUPRESSFACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("Faces to remove")); + GroupPoints->TextLabel1->setText(tr("Faces")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->LineEdit1->setReadOnly( true ); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_SuppressFacesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_SuppressFacesDlg::~RepairGUI_SuppressFacesDlg() +{ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myObjects = new GEOM::ListOfGO(); + myObjects->length( 0 ); + + //myGeomGUI->SetState( 0 ); + initSelection(); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_SuppressFacesDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool RepairGUI_SuppressFacesDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + + myEditCurrentArgument->setText(""); + myObjects->length( 0 ); + myFaces.clear(); + + initSelection(); + + return true; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + Standard_Boolean aRes = Standard_False; + int i = 0; + int numFaces = 0; + myObjects->length( IObjectCount() ); + myFaces.clear(); + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) + { + Handle(SALOME_InteractiveObject) anIO = anIt.Value(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + { + TopoDS_Shape aShape; + if ( myGeomBase->GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) ) + { + if ( aShape.ShapeType() <= TopAbs_FACE ) // FACE, SHELL, SOLID, COMPOUND + { + GEOM::short_array anIndexes; + + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) + { + Convert( aMap, anIndexes ); + myObjects[i++] = aSelectedObject; // append the object + myFaces.append( anIndexes ); // append faces' indexes + numFaces += anIndexes.length();// just for text field output + } + } + } + } + } + myObjects->length( i ); // this is the right length, smaller of equal to the previously set + if ( numFaces ) + myEditCurrentArgument->setText( QString::number( numFaces ) + "_" + tr( "GEOM_FACE" ) + tr( "_S_" ) ); +} + +//================================================================================= +// function : Convert() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::Convert( const TColStd_IndexedMapOfInteger& theMap, GEOM::short_array& theOutSeq ) +{ + const int n = theMap.Extent(); + theOutSeq.length( n ); + for ( int i = 0; i < n; i++ ) + theOutSeq[i] = theMap( i+1 ); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() +{ + if( sender() == GroupPoints->PushButton1 ) + { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() +{ + if( sender() == GroupPoints->LineEdit1 ) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + //myGeomGUI->SetState( 0 ); + initSelection(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e) +{ + //myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr RepairGUI_SuppressFacesDlg::createOperation() +{ + return getGeomEngine()->GetIHealingOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool RepairGUI_SuppressFacesDlg::isValid( QString& msg ) +{ + const int objL = myObjects->length(), facesL = myFaces.size(); + return ( objL && objL == facesL ); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects ) +{ + QStringList anErrorObjNames; + for ( int i = 0; i < myObjects->length(); i++ ) + { + GEOM::GEOM_Object_var obj = myObjects[i]; + GEOM::short_array faces = myFaces[i]; + //MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length()); + GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->SuppressFaces( obj, faces ); + if ( anObj->_is_nil() ) + anErrorObjNames << GEOMBase::GetName( obj ); + else + objects.push_back( anObj._retn() ); + } + + if ( !anErrorObjNames.empty() ) + MESSAGE("ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " )); + + return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing. +} + +//================================================================================= +// function : initSelection +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::initSelection() +{ + GEOM::GEOM_Object_var aNullGeomObject; + localSelection( aNullGeomObject, TopAbs_FACE ); // load local selection on ALL objects +} diff --git a/src/STEPExport/STEPExport.cxx b/src/STEPExport/STEPExport.cxx new file mode 100644 index 000000000..d7ed96b6f --- /dev/null +++ b/src/STEPExport/STEPExport.cxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: STEPExport.cxx +// Created: Wed May 19 14:53:52 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include + +#include + +#include +#include + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName) + { + MESSAGE("Export STEP into file " << theFileName.ToCString()); + + try + { + IFSelect_ReturnStatus status ; + //VRV: OCC 4.0 migration + STEPControl_Writer aWriter; +//JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep ); + status = aWriter.Transfer( theShape, STEPControl_AsIs ); + //VRV: OCC 4.0 migration + if ( status == IFSelect_RetDone ) + status = aWriter.Write( theFileName.ToCString() ) ; + if ( status == IFSelect_RetDone ) + return 1; + } + catch(Standard_Failure) + { + //THROW_SALOME_CORBA_EXCEPTION("Exception catched in STEPExport", SALOME::BAD_PARAM); + } + return 0; + } +} diff --git a/src/STEPImport/STEPImport.cxx b/src/STEPImport/STEPImport.cxx new file mode 100644 index 000000000..3fb9cc511 --- /dev/null +++ b/src/STEPImport/STEPImport.cxx @@ -0,0 +1,133 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: STEPImport.cxx +// Created: Wed May 19 14:41:10 2004 +// Author: Pavel TELKOV +// + +#include "utilities.h" + +#include + +#include + +#include + +#include +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +#ifdef WNT +#include +#else +#define SALOME_WNT_EXPORT +#endif + +//============================================================================= +/*! + * Import() + */ +//============================================================================= + +extern "C" +{ +SALOME_WNT_EXPORT + TopoDS_Shape Import (const TCollection_AsciiString& theFileName, + TCollection_AsciiString& theError) + { + MESSAGE("Import STEP model from file " << theFileName.ToCString()); + TopoDS_Shape aResShape; + //VRV: OCC 4.0 migration + STEPControl_Reader aReader; + //VRV: OCC 4.0 migration + TopoDS_Compound compound; + BRep_Builder B; + B.MakeCompound( compound ); + try { + IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString()); + + if (status == IFSelect_RetDone) { + Standard_Boolean failsonly = Standard_False ; + aReader.PrintCheckLoad (failsonly, IFSelect_ItemsByEntity); + /* Root transfers */ + Standard_Integer nbr = aReader.NbRootsForTransfer(); + aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity); + + for ( Standard_Integer n=1; n <= nbr; n++) { + Standard_Boolean ok = aReader.TransferRoot(n); + /* Collecting resulting entities */ + Standard_Integer nbs = aReader.NbShapes(); + if (!ok || nbs == 0) + { + // THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM); + continue; // skip empty root + } + /* For a single entity */ + else if (nbr == 1 && nbs == 1) { + aResShape = aReader.Shape(1); + break; + } + + for ( Standard_Integer i=1; i<=nbs; i++ ) { + TopoDS_Shape aShape = aReader.Shape(i); + if ( aShape.IsNull() ) { + // THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ; + //return aResShape; + continue; + } + else { + B.Add( compound, aShape ) ; + } + } + } + if ( aResShape.IsNull() ) + aResShape = compound; + + } else { +// switch (status) { +// case IFSelect_RetVoid: +// theError = "Nothing created or No data to process"; +// break; +// case IFSelect_RetError: +// theError = "Error in command or input data"; +// break; +// case IFSelect_RetFail: +// theError = "Execution was run, but has failed"; +// break; +// case IFSelect_RetStop: +// theError = "Execution has been stopped. Quite possible, an exception was raised"; +// break; +// default: +// break; +// } + theError = "Wrong format of the imported file. Can't import file."; + aResShape.Nullify(); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + theError = aFail->GetMessageString(); + aResShape.Nullify(); + } + return aResShape; + } +} diff --git a/src/ShHealOper/Makefile.in b/src/ShHealOper/Makefile.in new file mode 100644 index 000000000..82f11b3a4 --- /dev/null +++ b/src/ShHealOper/Makefile.in @@ -0,0 +1,80 @@ +# GEOM ShHealOper : Shape Healing +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Alexander SLADKOV +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# Libraries targets +LIB = libShHealOper.la + +LIB_SRC = \ + ShHealOper_CloseContour.cxx \ + ShHealOper_EdgeDivide.cxx \ + ShHealOper_FillHoles.cxx \ + ShHealOper_RemoveFace.cxx \ + ShHealOper_RemoveInternalWires.cxx \ + ShHealOper_Sewing.cxx \ + ShHealOper_ShapeProcess.cxx \ + ShHealOper_SplitCurve2d.cxx \ + ShHealOper_SplitCurve3d.cxx \ + ShHealOper_Tool.cxx \ + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# header files +EXPORT_HEADERS = \ + ShHealOper_CloseContour.hxx \ + ShHealOper_EdgeDivide.hxx \ + ShHealOper_FillHoles.hxx \ + ShHealOper_RemoveFace.hxx \ + ShHealOper_RemoveInternalWires.hxx \ + ShHealOper_Sewing.hxx \ + ShHealOper_ShapeProcess.hxx \ + ShHealOper_SpiltCurve2d.hxx \ + ShHealOper_SplitCurve2d.hxx \ + ShHealOper_SplitCurve3d.hxx \ + ShHealOper_Tool.hxx + +# idl files +EXPORT_IDLS= + +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += $(CAS_KERNEL) $(CAS_MATH) $(CAS_TKTopAlgo) $(CAS_LDPATH) -lTKBool -lTKShHealing + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ diff --git a/src/ShHealOper/ShHealOper_CloseContour.cxx b/src/ShHealOper/ShHealOper_CloseContour.cxx new file mode 100644 index 000000000..e4d171b34 --- /dev/null +++ b/src/ShHealOper/ShHealOper_CloseContour.cxx @@ -0,0 +1,426 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File: ShHealOper_CloseContour.cxx +// Created: 20.04.04 11:36:01 +// Author: Galina KULIKOVA +// Copyright: Airbus Industries 2004 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//======================================================================= +//function : ShHealOper_CloseContour() +//purpose : Constructor +//======================================================================= + +ShHealOper_CloseContour::ShHealOper_CloseContour (const TopoDS_Shape& theShape ) +{ + Init(theShape); +} +//======================================================================= +//function : Init +//purpose : +//======================================================================= + +void ShHealOper_CloseContour::Init(const TopoDS_Shape& theShape) +{ + ShHealOper_Tool::Init(theShape); + myTolerance = Precision::Confusion(); + myMaxTolerance = 1.0; + TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,myMapEdgesFace); +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +Standard_Boolean ShHealOper_CloseContour::Perform(const TopTools_SequenceOfShape& theSeqEdges, + const Standard_Boolean theModeVertex, + const Standard_Boolean theModeFixGapsCurves) +{ + myFreeEdges.Clear(); + myDone = Standard_False; + myErrorStatus =ShHealOper_NotError; + if(myInitShape.IsNull()) { + myErrorStatus = ShHealOper_InvalidParameters; + return myDone; + } + Handle(ShapeExtend_WireData) asewd = new ShapeExtend_WireData; + Standard_Integer i =1; + for ( ; i <= theSeqEdges.Length(); i++) + asewd->Add(theSeqEdges.Value(i)); + + myModeVertex = theModeVertex; + myModeFixGapsCurves = theModeFixGapsCurves; + + build(asewd); + + return myDone; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +Standard_Boolean ShHealOper_CloseContour::Perform(const TopoDS_Wire& theWire, + const Standard_Boolean theModeVertex, + const Standard_Boolean theModeFixGapsCurves) +{ + myFreeEdges.Clear(); + myDone = Standard_False; + if(myInitShape.IsNull()) { + myErrorStatus = ShHealOper_InvalidParameters; + return myDone; + } + Handle(ShapeExtend_WireData) asewd = new ShapeExtend_WireData(theWire); + myModeVertex = theModeVertex; + myModeFixGapsCurves = theModeFixGapsCurves; + build(asewd); + return myDone; +} +//======================================================================= +//function : Build +//purpose : +//======================================================================= + +void ShHealOper_CloseContour::build(Handle(ShapeExtend_WireData)& theSewd) +{ + TopTools_SequenceOfShape aCommonFaces; + //checks that all specified edges belong the one face or not. + Standard_Boolean isOneFace = checkOneFace(theSewd,aCommonFaces); + + //add edge or increase max tolerance in dependance on specified VertexMode. + //if all edges belong the one face that gap will be closed in the 2D by line + //else gap will be closed in the 3D by line. + myDone = fixGaps(theSewd,aCommonFaces); + updateWire(theSewd); + Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire; + sfw->SetContext(myContext); + sfw->Load(theSewd); + + sfw->ClosedWireMode() = Standard_True; + sfw->SetPrecision(myTolerance); + sfw->SetMaxTolerance(myMaxTolerance); + + if(isOneFace) { + Standard_Integer ii =1; + for( ; ii <= aCommonFaces.Length(); ii++) { + TopoDS_Face aFace = TopoDS::Face(aCommonFaces.Value(ii)); + sfw->SetFace(aFace); + myDone = (sfw->Perform() || myDone); + //if Mode for fix gaps is equal to true that + //curve 3D and curve 2D will be pull to each other. + if(myModeFixGapsCurves) { + Standard_Boolean isFixgaps = Standard_False; + if(ii ==1) { + sfw->FixGaps3d(); + isFixgaps = sfw->StatusGaps3d(ShapeExtend_DONE); + if(!isFixgaps && sfw->StatusGaps3d(ShapeExtend_FAIL)) + myErrorStatus = ShHealOper_ErrorExecution; + } + if(sfw->FixGaps2d()) + sfw->FixSelfIntersection(); + else if(sfw->StatusGaps2d(ShapeExtend_FAIL)) + myErrorStatus = ShHealOper_ErrorExecution; + + isFixgaps = (isFixgaps || sfw->StatusGaps2d(ShapeExtend_DONE)); + myDone = (myDone || isFixgaps); + if(isFixgaps) { + Handle(ShapeExtend_WireData) sbwd = sfw->WireData(); + Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge; + for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) { + TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge)); + sfe->FixVertexTolerance(aEdge,aFace); + sfe->FixSameParameter(aEdge); + } + } + } + } + } + else { + myDone = (sfw->Perform() || myDone); + if(myModeFixGapsCurves) { + //if Mode for fix gaps is equal to true that + //curve 3D will be pull to each other. + if(sfw->FixGaps3d()) { + Handle(ShapeExtend_WireData) sbwd = sfw->WireData(); + Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge; + for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) { + TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge)); + sfe->FixVertexTolerance(aEdge); + sfe->FixSameParameter(aEdge); + } + } + else if(sfw->StatusGaps3d(ShapeExtend_FAIL)) + myErrorStatus = ShHealOper_ErrorExecution; + myDone = (sfw->StatusGaps3d(ShapeExtend_DONE) || myDone); + } + } + + if(myDone) { + TopoDS_Shape aoldShape = myInitShape; + //if free edges were added they will be added to the result shape + //and type of result shape should be change if initial shape is not COMPOUND. + if( myFreeEdges.Length()) { + BRep_Builder aB; + TopoDS_Compound aComp; + aB.MakeCompound(aComp); + if(aoldShape.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator aIt(aoldShape); + for( ;aIt.More();aIt.Next() ) + aB.Add(aComp,aIt.Value()); + } + else + aB.Add(aComp,aoldShape); + + Standard_Integer i=1; + for ( ; i <= myFreeEdges.Length(); i++ ) + aB.Add(aComp,myFreeEdges.Value(i)); + aoldShape = aComp; + + } + myResultShape = myContext->Apply(aoldShape); + } + return; +} +//======================================================================= +//function : checkGaps +//purpose : +//======================================================================= + +Standard_Boolean ShHealOper_CloseContour::fixGaps(const Handle(ShapeExtend_WireData)& theWire, + const TopTools_SequenceOfShape& theCommonFaces) +{ + Handle(ShapeAnalysis_Wire) asaw = new ShapeAnalysis_Wire; + asaw->Load(theWire); + + Standard_Integer i =1; + Standard_Boolean hasGaps = Standard_False; + for ( ; i <= asaw->NbEdges(); i++) { + if(asaw->CheckGap3d(i)) { + Standard_Real dist = asaw->MinDistance3d(); + if(dist > myMaxTolerance) { + hasGaps = Standard_True; + Standard_Integer ind2 = (i ==0 ? theWire->NbEdges() :i); + Standard_Integer ind1 = (ind2 >1 ? ind2 -1 : theWire->NbEdges()); + TopoDS_Edge aE1= theWire->Edge(ind1); + TopoDS_Edge aE2= theWire->Edge(ind2); + if(!myModeVertex) + buildEdge(aE1,aE2,theCommonFaces); + else + myMaxTolerance = RealLast(); + if(ind2 == ind1) break; + } + } + + } + return hasGaps; +} + +//======================================================================= +//function : checkOneFace +//purpose : +//======================================================================= + +Standard_Boolean ShHealOper_CloseContour::checkOneFace(const Handle(ShapeExtend_WireData)& theSewd, + TopTools_SequenceOfShape& theCommonFaces) const +{ + + TopTools_IndexedMapOfShape amapfaces; + TopoDS_Edge aEdge1 = theSewd->Edge(1); + Standard_Boolean isOneFace = myMapEdgesFace.Contains(aEdge1 ); + if(!isOneFace) + return isOneFace; + + //check that all specified edges belong to one face. + const TopTools_ListOfShape& alfaces = myMapEdgesFace.FindFromKey(aEdge1); + isOneFace = isOneFace && (!alfaces.IsEmpty()); + if(!isOneFace) + return Standard_False; + + TopTools_ListIteratorOfListOfShape litr(alfaces); + for( ; litr.More();litr.Next() ) + amapfaces.Add(litr.Value()); + + TColStd_MapOfInteger amapIndex; + Standard_Integer ind =0; + Standard_Integer i =2; + for( ; i <= theSewd->NbEdges() && isOneFace; i++) { + isOneFace = myMapEdgesFace.Contains(theSewd->Edge(i)); + if(isOneFace) { + const TopTools_ListOfShape& alfaces1 = myMapEdgesFace.FindFromKey(theSewd->Edge(i)); + + TColStd_MapOfInteger aTmpInd; + for(litr.Initialize(alfaces1) ; litr.More() ;litr.Next() ) { + if(amapfaces.Contains(litr.Value())) { + ind = amapfaces.FindIndex(litr.Value()); + if( i == 2) + amapIndex.Add(ind); + else + aTmpInd.Add(ind); + } + } + if(i ==2) { + isOneFace = (amapIndex.Extent()); + continue; + } + else { + TColStd_MapIteratorOfMapOfInteger aMi(amapIndex); + for( ; aMi.More();aMi.Next()) { + if(!aTmpInd.Contains(aMi.Key())) + amapIndex.Remove(aMi.Key()); + } + isOneFace = (amapIndex.Extent()); + + } + } + } + if(theSewd->NbEdges() >1) { + Standard_Integer j =1; + for( ; j <= amapfaces.Extent(); j++) { + if(!amapIndex.Contains(j)) continue; + TopoDS_Shape aF = amapfaces.FindKey(j); + theCommonFaces.Append(aF); + } + } + return isOneFace; +} +//======================================================================= +//function : buildEdge +//purpose : +//======================================================================= + +void ShHealOper_CloseContour::buildEdge(const TopoDS_Edge& aE1, + const TopoDS_Edge& aE2, + const TopTools_SequenceOfShape& theCommonFaces) +{ + ShapeAnalysis_Edge asae; + TopoDS_Vertex aV1 = asae.LastVertex(aE1); + TopoDS_Vertex aV2 = asae.FirstVertex(aE2); + gp_Pnt p1 = BRep_Tool::Pnt(aV1); + gp_Pnt p2 = BRep_Tool::Pnt(aV2); + BRepBuilderAPI_MakeVertex mkver1( p1 ); + TopoDS_Vertex newV1 = mkver1.Vertex(); + + BRepBuilderAPI_MakeVertex mkver2( p2 ); + TopoDS_Vertex newV2 = mkver2.Vertex(); + BRep_Builder B; + B.UpdateVertex ( newV1,Precision::Confusion()); + B.UpdateVertex ( newV2, Precision::Confusion()); + Standard_Boolean isBuild = Standard_False; + TopoDS_Edge edge; + B.MakeEdge ( edge ); + ShapeBuild_Edge sbe; + //if all edges belong to one face that gap will be closed in the 2D by line + //than 3D curve will be built by 2D curve + if(theCommonFaces.Length()) { + + TopoDS_Face aF1 = TopoDS::Face(theCommonFaces.Value(1)); + Handle(Geom2d_Curve) c2d1,c2d2; + gp_Pnt2d p2d1,p2d2; + Standard_Real a1, b1,a2, b2; + if ( asae.PCurve ( aE1, aF1, c2d1, a1, b1, Standard_True ) && + asae.PCurve ( aE2, aF1, c2d2, a2, b2, Standard_True )) { + + c2d1->D0 ( b1, p2d1); + c2d2->D0 ( a2, p2d2); + gp_Vec2d v12 ( p2d1, p2d2 ); + + Handle(Geom2d_Line) aLine2d = new Geom2d_Line ( p2d1, gp_Dir2d ( v12 ) ); + B.UpdateEdge ( edge, aLine2d, aF1, ::Precision::Confusion() ); + B.Range ( edge, aF1, 0.0, v12.Magnitude() ); + + isBuild = sbe.BuildCurve3d ( edge ); + } + } + //else gap will be closed in the 3D by line. + if(!isBuild) { + gp_Vec v1 ( p1, p2 ); + Handle(Geom_Line) aLine = new Geom_Line ( p1, gp_Dir ( v1 ) ); + B.UpdateEdge ( edge, aLine, ::Precision::Confusion() ); + B.Range ( edge,0.0, v1.Magnitude()); + } + B.Add ( edge, newV1.Oriented ( TopAbs_FORWARD ) ); + B.Add ( edge, newV2.Oriented ( TopAbs_REVERSED ) ); + myContext->Replace(aV1, newV1.Oriented (aV1.Orientation())); + myContext->Replace(aV2, newV2.Oriented (aV2.Orientation())); + if(isBuild) { + newV1.Orientation(aV1.Orientation()); + TopoDS_Edge newEdge = sbe.CopyReplaceVertices ( aE1,TopoDS_Vertex(), newV1); + TopoDS_Wire aw; + B.MakeWire(aw); + B.Add(aw,newEdge); + B.Add(aw,edge); + TopoDS_Shape anE1 = myContext->Apply(aE1); + myContext->Replace(anE1,aw); + } + else { + myFreeEdges.Append(edge); + } +} +//======================================================================= +//function : UpdateWire +//purpose : +//======================================================================= + +void ShHealOper_CloseContour::updateWire (Handle(ShapeExtend_WireData)& sbwd) +{ + Standard_Integer i=1; + for ( ; i <= sbwd->NbEdges(); i++ ) { + TopoDS_Edge E = sbwd->Edge(i); + TopoDS_Shape S = myContext->Apply ( E ); + if ( S == E ) continue; + for ( TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next() ) + sbwd->Add ( exp.Current(), i++ ); + sbwd->Remove ( i-- ); + } + for ( i =1; i <= myFreeEdges.Length(); i++ ) { + sbwd->Add(TopoDS::Edge(myFreeEdges.Value(i))); + } +} diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx new file mode 100644 index 000000000..8f09b83f8 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -0,0 +1,452 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_MirrorDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "TransformationGUI_MirrorDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_MirrorDlg() +// purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_POINT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_AXE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_PLANE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MIRROR_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MIRROR")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints->SpinBox_DX->hide(); + GroupPoints->TextLabel3->hide(); + GroupPoints->CheckButton2->hide(); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); + GroupPoints->TextLabel2->setFixedWidth(74); + GroupPoints->PushButton1->setPixmap(image3); + GroupPoints->PushButton2->setPixmap(image3); + GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + Layout1->addWidget(GroupPoints, 2, 0); + + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_MirrorDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->setReadOnly(true); + + myArgument = GEOM::GEOM_Object::_nil(); + + // Activate Create a Copy mode + GroupPoints->CheckButton1->setChecked(true); + CreateCopyModeChanged(true); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_MIRROR" ) ); + ConstructorsClicked( 0 ); +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) +{ + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + + globalSelection(); + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit2->clear(); + myArgument = GEOM::GEOM_Object::_nil(); + + switch (constructorId) + { + case 0: /* mirror an object by point */ + { + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR")); + break; + } + case 1: /* mirror an object by axe */ + { + GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR")); + break; + } + case 2: /* mirror an object by plane */ + { + GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR")); + break; + } + } + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_MirrorDlg::ClickOnApply() +{ + if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_MirrorDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void TransformationGUI_MirrorDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) + { + myObjects.length(0); + return; + } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + if(aNbSel != 1) + aName = tr("%1_objects").arg(aNbSel); + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + { + if(IObjectCount() != 1) + { + myArgument = GEOM::GEOM_Object::_nil(); + return; + } + Standard_Boolean testResult = Standard_False; + myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + if(!testResult || CORBA::is_nil( myArgument )) + return; + aName = GEOMBase::GetName( myArgument ); + } + myEditCurrentArgument->setText( aName ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1){ + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + switch(getConstructorId()) + { + case 0: + { + globalSelection( GEOM_POINT ); + break; + } + case 1: + { + globalSelection( GEOM_LINE ); + break; + } + case 2: + { + globalSelection( GEOM_PLANE ); + break; + } + } + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_MirrorDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void TransformationGUI_MirrorDlg::enterEvent(QEvent * e) +{ + if(!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation() +{ + return getGeomEngine()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_MirrorDlg::isValid( QString& msg ) +{ + return !(myObjects.length() == 0 || myArgument->_is_nil()); +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_MirrorDlg::execute( ObjectList& objects ) +{ + bool res = false; + bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + case 1 : + { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + case 2: + { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + } + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + this->GroupBoxName->setEnabled(isCreateCopy); +} diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx new file mode 100644 index 000000000..88b262a44 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -0,0 +1,483 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_MultiRotationDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "TransformationGUI_MultiRotationDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_MultiRotationDlg() +// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MULTIROTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MULTIROTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->setReadOnly(true); + + GroupDimensions = new DlgRef_2Sel4Spin1Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE")); + GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES")); + GroupDimensions->TextLabel5->setText(tr("GEOM_STEP")); + GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES")); + GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE")); + GroupDimensions->PushButton1->setPixmap(image2); + GroupDimensions->PushButton2->setPixmap(image2); + GroupDimensions->LineEdit1->setReadOnly(true); + GroupDimensions->LineEdit2->setReadOnly(true); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_MultiRotationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::Init() +{ + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + double SpecificStep1 = 5; + double SpecificStep2 = 1; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupPoints->SpinBox_DX->SetValue(myNbTimes1); + + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, SpecificStep1, 3); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupDimensions->SpinBox_DX1->SetValue(myAng); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + + connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_MULTIROTATION" ) ); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + myAng = 45.0; + myStep = 50.0; + myNbTimes1 = myNbTimes2 = 2; + + globalSelection( GEOM_ALLSHAPES ); + + switch (constructorId) + { + case 0: /* Rotate simple */ + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + GroupPoints->SpinBox_DX->SetValue(myNbTimes1); + + break; + } + case 1: /* Rotate double */ + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + GroupDimensions->LineEdit2->setText(""); + + GroupDimensions->SpinBox_DX1->SetValue(myAng); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); + + break; + } + } + + myEditCurrentArgument->setFocus(); + myBase = myVector = GEOM::GEOM_Object::_nil(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_MultiRotationDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_MultiRotationDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myVector = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False;; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) + return; + + + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myVector = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + else if(send == GroupDimensions->PushButton1) { + myEditCurrentArgument = GroupDimensions->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); + } + else if(send == GroupDimensions->PushButton2) { + myEditCurrentArgument = GroupDimensions->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_MultiRotationDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) +{ + if(!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) + myNbTimes1 = (int)newValue; + else if(send == GroupDimensions->SpinBox_DX1) + myAng = newValue; + else if(send == GroupDimensions->SpinBox_DX2) + myStep = newValue; + else if(send == GroupDimensions->SpinBox_DY2) + myNbTimes2 = (int)newValue; + + displayPreview(); +} + + +//================================================================================= +// function : ReverseAngle() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiRotationDlg::ReverseAngle() +{ + myAng = -myAng; + + int aConstructorId = getConstructorId(); + + if(aConstructorId == 0) + GroupPoints->SpinBox_DX->SetValue(myAng); + else if(aConstructorId == 1) + GroupDimensions->SpinBox_DX1->SetValue(myAng); + + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) +{ + return !(myBase->_is_nil() || myVector->_is_nil()); +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiRotate1D( myBase, myVector, myNbTimes1 ); + res = true; + } + break; + } + case 1 : + { + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVector ) ) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiRotate2D( myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2 ); + res = true; + } + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx new file mode 100644 index 000000000..255df8858 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -0,0 +1,546 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "TransformationGUI_MultiTranslationDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include + +#include "GEOMImpl_Types.hxx" + +#include + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_MultiTranslationDlg() +// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MULTITRANSLATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U")); + GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U")); + GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U")); + GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->setReadOnly(true); + + GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE")); + GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U")); + GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V")); + GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U")); + GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U")); + GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V")); + GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V")); + GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U")); + GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V")); + GroupDimensions->PushButton1->setPixmap(image2); + GroupDimensions->PushButton2->setPixmap(image2); + GroupDimensions->PushButton3->setPixmap(image2); + GroupDimensions->LineEdit1->setReadOnly(true); + GroupDimensions->LineEdit2->setReadOnly(true); + GroupDimensions->LineEdit3->setReadOnly(true); + + Layout1->addWidget(GroupPoints, 2, 0); + Layout1->addWidget(GroupDimensions, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_MultiTranslationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::Init() +{ + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + double SpecificStep = 1; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myStepU); + GroupPoints->SpinBox_DY->SetValue(myNbTimesU); + + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupDimensions->SpinBox_DX1->SetValue(myStepU); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); + GroupDimensions->SpinBox_DX2->SetValue(myStepV); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); + connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); + connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + + initName( tr( "GEOM_MULTITRANSLATION" ) ); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) +{ + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + + myStepU = myStepV = 50.0; + myNbTimesU = myNbTimesV = 2; + + globalSelection( GEOM_ALLSHAPES ); + + switch (constructorId) + { + case 0: /* Translate simple */ + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + GroupPoints->SpinBox_DX->SetValue(myStepU); + GroupPoints->SpinBox_DY->SetValue(myNbTimesU); + + break; + } + case 1: /* Translate double */ + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + GroupDimensions->LineEdit2->setText(""); + GroupDimensions->LineEdit3->setText(""); + + GroupDimensions->SpinBox_DX1->SetValue(myStepU); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); + GroupDimensions->SpinBox_DX2->SetValue(myStepV); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimesV); + + myVectorV = GEOM::GEOM_Object::_nil(); + break; + } + } + + myEditCurrentArgument->setFocus(); + myBase = myVectorU = GEOM::GEOM_Object::_nil(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_MultiTranslationDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_MultiTranslationDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + + if(IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myVectorU = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + myVectorV = GEOM::GEOM_Object::_nil(); + return; + } + + // nbSel == 1 + Standard_Boolean testResult = Standard_False;; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myVectorU = aSelectedObject; + else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + myVectorV = aSelectedObject; + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + else if(send == GroupDimensions->PushButton1) { + myEditCurrentArgument = GroupDimensions->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); + } + else if(send == GroupDimensions->PushButton2) { + myEditCurrentArgument = GroupDimensions->LineEdit2; + globalSelection( GEOM_LINE ); + } + else if(send == GroupDimensions->PushButton3) { + myEditCurrentArgument = GroupDimensions->LineEdit3; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || + send == GroupDimensions->LineEdit3) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_MultiTranslationDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) +{ + if(!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + switch(getConstructorId()) + { + case 0 : + { + if(send == GroupPoints->SpinBox_DX) + myStepU = newValue; + else if(send == GroupPoints->SpinBox_DY) + myNbTimesU = (int)newValue; + break; + } + case 1 : + { + if(send == GroupDimensions->SpinBox_DX1) + myStepU = newValue; + else if(send == GroupDimensions->SpinBox_DY1) + myNbTimesU = (int)newValue; + else if(send == GroupDimensions->SpinBox_DX2) + myStepV = newValue; + else if(send == GroupDimensions->SpinBox_DY2) + myNbTimesV = (int)newValue; + break; + } + } + + displayPreview(); +} + + +//================================================================================= +// function : ReverseStepU() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ReverseStepU() +{ + myStepU = -myStepU; + + int aConstructorId = getConstructorId(); + + if(aConstructorId == 0) + GroupPoints->SpinBox_DX->SetValue(myStepU); + else if(aConstructorId == 1) + GroupDimensions->SpinBox_DX1->SetValue(myStepU); + + displayPreview(); +} + + +//================================================================================= +// function : ReverseStepV +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ReverseStepV() +{ + myStepV = -myStepV; + + GroupDimensions->SpinBox_DX2->SetValue(myStepV); + + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) +{ + int aConstructorId = getConstructorId(); + + if(aConstructorId == 0) + return !(myBase->_is_nil() || myVectorU->_is_nil()); + else if(aConstructorId == 1) + return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); + return 0; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) ) { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate1D( myBase, myVectorU, myStepU, myNbTimesU ); + res = true; + } + break; + } + case 1 : + { + if ( !CORBA::is_nil( myBase ) && !CORBA::is_nil( myVectorU ) && !CORBA::is_nil( myVectorV ) ) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MultiTranslate2D( myBase, myVectorU, myStepU, myNbTimesU, + myVectorV, myStepV, myNbTimesV ); + res = true; + } + break; + } + } + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx new file mode 100644 index 000000000..805bc8a72 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -0,0 +1,352 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_OffsetDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "TransformationGUI_OffsetDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_OffsetDlg() +// purpose : Constructs a TransformationGUI_OffsetDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_OFFSET"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_OFFSET_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_OFFSET")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_OFFSET")); + GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + + // san -- modification of an exisitng object by offset is not allowed + GroupPoints->CheckButton1->hide(); + + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 2, 0); + + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_OffsetDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly( true ); + + /* Get setting of step value from file configuration */ + double step = 1; + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DX->setPrecision(5); + //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); + GroupPoints->SpinBox_DX->SetValue(1e-05); + + // Activate Create a Copy mode + GroupPoints->CheckButton1->setChecked(true); + CreateCopyModeChanged(true); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + + initName( tr( "GEOM_OFFSET" ) ); + + globalSelection( GEOM_ALLSHAPES ); + +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_OffsetDlg::ClickOnApply() +{ + if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) + return false; + + initName(); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_OffsetDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void TransformationGUI_OffsetDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) + { + myObjects.length(0); + return; + } + + // nbSel > 0 + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + + myEditCurrentArgument->setText( aName ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if ( send == GroupPoints->LineEdit1 ) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); + } +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) +{ + if ( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection( GEOM_ALLSHAPES ); + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setFocus(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_OffsetDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_OffsetDlg::createOperation() +{ + return getGeomEngine()->GetITransformOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_OffsetDlg::isValid( QString& msg ) +{ + return !(myObjects.length() == 0); +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + + if (GroupPoints->CheckButton1->isChecked() || IsPreview()) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + + res = true; + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e ) +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : GetOffset() +// purpose : +//================================================================================= +double TransformationGUI_OffsetDlg::GetOffset() const +{ + return GroupPoints->SpinBox_DX->GetValue(); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_OffsetDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + this->GroupBoxName->setEnabled(isCreateCopy); +} diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx new file mode 100644 index 000000000..e16e3bbd3 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx @@ -0,0 +1,445 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_PositionDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#include "TransformationGUI_PositionDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "TColStd_MapOfInteger.hxx" + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_PositionDlg() +// purpose : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_PositionDlg::TransformationGUI_PositionDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POSITION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POSITION2"))); + QPixmap imageselect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_POSITION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_POSITION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1"); + Group1->SpinBox1->hide(); + Group1->SpinBox2->hide(); + Group1->SpinBox3->hide(); + Group1->TextLabel4->hide(); + Group1->TextLabel5->hide(); + Group1->TextLabel6->hide(); + Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group1->TextLabel1->setText(tr("GEOM_OBJECTS")); + Group1->TextLabel2->setText(tr("GEOM_START_LCS")); + Group1->TextLabel3->setText(tr("GEOM_END_LCS")); + Group1->PushButton1->setPixmap(imageselect); + Group1->PushButton2->setPixmap(imageselect); + Group1->PushButton3->setPixmap(imageselect); + Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY")); + + Layout1->addWidget(Group1, 2, 0); + + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_PositionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::Init() +{ + /* init variables */ + Group1->LineEdit1->setReadOnly(true); + Group1->LineEdit2->setReadOnly(true); + Group1->LineEdit3->setReadOnly(true); + + myStartLCS = GEOM::GEOM_Object::_nil(); + myEndLCS = GEOM::GEOM_Object::_nil(); + + // Activate Create a Copy mode + Group1->CheckBox1->setChecked(true); + CreateCopyModeChanged(true); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + initName( tr( "GEOM_POSITION" ) ); + ConstructorsClicked( 0 ); +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) +{ + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + + globalSelection(); + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit2->clear(); + Group1->LineEdit3->clear(); + myStartLCS = GEOM::GEOM_Object::_nil(); + myEndLCS = GEOM::GEOM_Object::_nil(); + + switch (constructorId) + { + case 0: + { + Group1->LineEdit2->hide(); + Group1->TextLabel2->hide(); + Group1->PushButton2->hide(); + break; + } + case 1: + { + Group1->LineEdit2->show(); + Group1->TextLabel2->show(); + Group1->PushButton2->show(); + break; + } + } + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + SelectionIntoArgument(); +} + + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_PositionDlg::ClickOnApply() +{ + if ( !onAccept(Group1->CheckBox1->isChecked()) ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_PositionDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void TransformationGUI_PositionDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + if(myEditCurrentArgument == Group1->LineEdit1) { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) { + myObjects.length(0); + displayPreview(); + return; + } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) { + displayPreview(); + return; + } + } + else if(myEditCurrentArgument == Group1->LineEdit2) { + myStartLCS = GEOM::GEOM_Object::_nil(); + if(IObjectCount() != 1) { + displayPreview(); + return; + } + + Standard_Boolean testResult = Standard_False; + myStartLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + if(!testResult || CORBA::is_nil( myStartLCS )) { + displayPreview(); + return; + } + aName = GEOMBase::GetName( myStartLCS ); + } + else if(myEditCurrentArgument == Group1->LineEdit3) { + myEndLCS = GEOM::GEOM_Object::_nil(); + if(IObjectCount() != 1) { + displayPreview(); + return; + } + + Standard_Boolean testResult = Standard_False; + myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + if(!testResult || CORBA::is_nil( myEndLCS )) { + displayPreview(); + return; + } + aName = GEOMBase::GetName( myEndLCS ); + } + + myEditCurrentArgument->setText( aName ); + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1 || send == Group1->LineEdit2 || send == Group1->LineEdit3) { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1){ + myEditCurrentArgument = Group1->LineEdit1; + globalSelection(); + } + else if(send == Group1->PushButton2) { + myEditCurrentArgument = Group1->LineEdit2; + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_PLANE ); + aMap.Add( GEOM_MARKER ); + globalSelection( aMap ); + } + else if(send == Group1->PushButton3) { + myEditCurrentArgument = Group1->LineEdit3; + TColStd_MapOfInteger aMap; + aMap.Add( GEOM_PLANE ); + aMap.Add( GEOM_MARKER ); + globalSelection( aMap ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_PositionDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void TransformationGUI_PositionDlg::enterEvent(QEvent * e) +{ + if(!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation() +{ + return getGeomEngine()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_PositionDlg::isValid( QString& msg ) +{ + bool res; + if (getConstructorId() == 0) + res = !(myObjects.length() == 0 || myEndLCS->_is_nil()); + else + res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil()); + + return res; +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_PositionDlg::execute( ObjectList& objects ) +{ + bool res = false; + bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked(); + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + for (int i = 0; i < myObjects.length(); i++) { + if (toCreateCopy) + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS ); + else + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS ); + + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + case 1 : + { + for (int i = 0; i < myObjects.length(); i++) { + if (toCreateCopy) + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS ); + else + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + } + + return res; +} + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_PositionDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + this->GroupBoxName->setEnabled(isCreateCopy); +} diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx new file mode 100644 index 000000000..7b1abd28b --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -0,0 +1,386 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_RotationDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "TransformationGUI_RotationDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_RotationDlg() +// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ROTATION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ROTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ROTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); + GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->setReadOnly(true); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + double anAngle = 0; + double SpecificStep = 5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(anAngle); + + // Activate Create a Copy mode + GroupPoints->CheckButton1->setChecked(true); + CreateCopyModeChanged(true); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_RotationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit2->clear(); + + myAxis = GEOM::GEOM_Object::_nil(); + + initName( tr( "GEOM_ROTATION" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_RotationDlg::ClickOnApply() +{ + if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) + return false; + + Init(); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_RotationDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_RotationDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) + { + myObjects.length(0); + return; + } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + { + if(IObjectCount() != 1) + { + myAxis = GEOM::GEOM_Object::_nil(); + return; + } + Standard_Boolean testResult = Standard_False; + myAxis = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + if(!testResult || CORBA::is_nil( myAxis )) + return; + aName = GEOMBase::GetName( myAxis ); + } + myEditCurrentArgument->setText( aName ); + + displayPreview(); +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_LINE ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection(); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit2->clear(); + myAxis = GEOM::GEOM_Object::_nil(); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_RotationDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::enterEvent(QEvent* e) +{ + if (!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation() +{ + return getGeomEngine()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_RotationDlg::isValid( QString& msg ) +{ + return !(myObjects.length() == 0 || myAxis->_is_nil()); +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + if (GroupPoints->CheckButton1->isChecked() || IsPreview()) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : GetAngle() +// purpose : +//================================================================================= +double TransformationGUI_RotationDlg::GetAngle() const +{ + return GroupPoints->SpinBox_DX->GetValue(); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + this->GroupBoxName->setEnabled(isCreateCopy); +} + + +//================================================================================= +// function : onReverse() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::onReverse() +{ + double anOldValue = GroupPoints->SpinBox_DX->GetValue(); + GroupPoints->SpinBox_DX->SetValue( -anOldValue ); +} diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx new file mode 100644 index 000000000..a215ba028 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -0,0 +1,374 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_ScaleDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "TransformationGUI_ScaleDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_ScaleDlg() +// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SCALE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SCALE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SCALE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); + GroupPoints->CheckButton2->hide(); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); + GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR")); + GroupPoints->LineEdit1->setReadOnly( true ); + GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY")); + + // san -- modification of an exisitng object by offset is not allowed + GroupPoints->CheckButton1->hide(); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + double aFactor = 2.0; + double SpecificStep = 0.5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(aFactor); + + // Activate Create a Copy mode + GroupPoints->CheckButton1->setChecked(true); + CreateCopyModeChanged(true); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_ScaleDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::Init() +{ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit2->clear(); + + myPoint = GEOM::GEOM_Object::_nil(); + + initName( tr( "GEOM_SCALE" ) ); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_ScaleDlg::ClickOnApply() +{ + if ( !onAccept(GroupPoints->CheckButton1->isChecked()) ) + return false; + + Init(); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_ScaleDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_ScaleDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) + { + myObjects.length(0); + return; + } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + { + if(IObjectCount() != 1) + { + myPoint = GEOM::GEOM_Object::_nil(); + return; + } + Standard_Boolean testResult = Standard_False; + myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + if(!testResult || CORBA::is_nil( myPoint )) + return; + aName = GEOMBase::GetName( myPoint ); + } + myEditCurrentArgument->setText( aName ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1 || + send == GroupPoints->LineEdit2) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if(send == GroupPoints->PushButton2) { + myEditCurrentArgument = GroupPoints->LineEdit2; + globalSelection( GEOM_POINT ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection(); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_ScaleDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::enterEvent(QEvent* e) +{ + if( !GroupConstructors->isEnabled() ) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_ScaleDlg::isValid( QString& msg ) +{ + return !(myObjects.length() == 0 || myPoint->_is_nil() || fabs(GetFactor()) <= 0.00001); +} + + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + if (GroupPoints->CheckButton1->isChecked() || IsPreview()) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e ) +{ + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : GetFactor() +// purpose : +//================================================================================= +double TransformationGUI_ScaleDlg::GetFactor() const +{ + return GroupPoints->SpinBox_DX->GetValue(); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + this->GroupBoxName->setEnabled(isCreateCopy); +} diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx new file mode 100644 index 000000000..d221fb855 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -0,0 +1,527 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : TransformationGUI_TranslationDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#include "TransformationGUI_TranslationDlg.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "LightApp_SelectionMgr.h" + +#include +#include + +#include "GEOMImpl_Types.hxx" + +#include "utilities.h" + +using namespace std; + +//================================================================================= +// class : TransformationGUI_TranslationDlg() +// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) +{ + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_DXYZ"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_POINTS"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_VECTOR"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_TRANSLATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_TRANSLATION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + RadioButton1->setChecked(true); + + GroupPoints = new DlgRef_3Sel3Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->TextLabel4->setText(tr("GEOM_DX")); + GroupPoints->TextLabel5->setText(tr("GEOM_DY")); + GroupPoints->TextLabel6->setText(tr("GEOM_DZ")); + GroupPoints->PushButton1->setPixmap(image3); + GroupPoints->PushButton2->setPixmap(image3); + GroupPoints->PushButton3->setPixmap(image3); + GroupPoints->CheckBox1->setText(tr("GEOM_CREATE_COPY")); + + Layout1->addWidget(GroupPoints, 2, 0); + /***************************************************************/ + + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_TranslationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setReadOnly(true); + GroupPoints->LineEdit2->setReadOnly(true); + GroupPoints->LineEdit3->setReadOnly(true); + + myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + + // Activate Create a Copy mode + GroupPoints->CheckBox1->setChecked(true); + CreateCopyModeChanged(true); + + /* Get setting of step value from file configuration */ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox1->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox2->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox3->RangeStepAndValidator(-999.999, 999.999, step, 3); + + GroupPoints->SpinBox1->SetValue(0.0); + GroupPoints->SpinBox2->SetValue(0.0); + GroupPoints->SpinBox3->SetValue(0.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ? + + connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); + + connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + initName( tr( "GEOM_TRANSLATION" ) ); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) +{ + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + + switch (constructorId) + { + case 0: /* translation an object by dx, dy, dz */ + { + GroupPoints->ShowRows(1,2,false); + resize(0,0); + GroupPoints->ShowRows(3,5,true); + break; + } + case 1: /* translation an object by 2 points */ + { + GroupPoints->ShowRows(3,5,false); + resize(0,0); + GroupPoints->ShowRows(0,2,true); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->LineEdit2->clear(); + GroupPoints->LineEdit3->clear(); + myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + break; + } + case 2: /* translation an object by vector */ + { + GroupPoints->ShowRows(2,5,false); + resize(0,0); + GroupPoints->ShowRows(0,1,true); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->LineEdit2->clear(); + myVector = GEOM::GEOM_Object::_nil(); + break; + } + } + + myEditCurrentArgument->setFocus(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool TransformationGUI_TranslationDlg::ClickOnApply() +{ + if ( !onAccept(GroupPoints->CheckBox1->isChecked()) ) + return false; + + initName(); + ConstructorsClicked( getConstructorId() ); + return true; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void TransformationGUI_TranslationDlg::ClickOnCancel() +{ + GEOMBase_Skeleton::ClickOnCancel(); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_TranslationDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aName; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) + { + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + + if(aNbSel < 1) + { + myObjects.length(0); + return; + } + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); + if (!myObjects.length()) + return; + } + else + { + if (IObjectCount() != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) + myPoint1 = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) + myVector = GEOM::GEOM_Object::_nil(); + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + myPoint2 = GEOM::GEOM_Object::_nil(); + return; + } + + Standard_Boolean testResult = Standard_False;; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + + if (!testResult || CORBA::is_nil( aSelectedObject )) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) + myPoint1 = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) + myVector = aSelectedObject; + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + myPoint2 = aSelectedObject; + + aName = GEOMBase::GetName( aSelectedObject ); + } + + myEditCurrentArgument->setText( aName ); + + displayPreview(); +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) + { + myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection(); + } + else if (send == GroupPoints->PushButton2) + { + myEditCurrentArgument = GroupPoints->LineEdit2; + getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : + globalSelection( GEOM_LINE ); + } + else if (send == GroupPoints->PushButton3) + { + myEditCurrentArgument = GroupPoints->LineEdit3; + globalSelection( GEOM_POINT ); + } + + myEditCurrentArgument->setFocus(); + SelectionIntoArgument(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + ConstructorsClicked( getConstructorId() ); +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void TransformationGUI_TranslationDlg::DeactivateActiveDialog() +{ + GEOMBase_Skeleton::DeactivateActiveDialog(); +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) +{ + if(!GroupConstructors->isEnabled()) + ActivateThisDialog(); +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ValueChangedInSpinBox() +{ + displayPreview(); +} + + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() +{ + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); +} + + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool TransformationGUI_TranslationDlg::isValid( QString& msg ) +{ + int aConstructorId = getConstructorId(); + + switch (aConstructorId) + { + case 0: + { + return !(myObjects.length() == 0 ); + break; + } + case 1: + { + return !(myObjects.length() == 0 || myPoint1->_is_nil() || myPoint2->_is_nil() ); + break; + } + case 2: + { + return !(myObjects.length() == 0 || myVector->_is_nil()); + break; + } + default: return false; + } +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) +{ + bool res = false; + bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked(); + + GEOM::GEOM_Object_var anObj; + + switch ( getConstructorId() ) + { + case 0 : + { + double dx = GroupPoints->SpinBox1->GetValue(); + double dy = GroupPoints->SpinBox2->GetValue(); + double dz = GroupPoints->SpinBox3->GetValue(); + + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZCopy( myObjects[i], dx, dy, dz ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateDXDYDZ( myObjects[i], dx, dy, dz ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + case 1 : + { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPointsCopy( myObjects[i], myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateTwoPoints( myObjects[i], myPoint1, myPoint2 ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + case 2: + { + if (toCreateCopy) + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVectorCopy( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + else + for (int i = 0; i < myObjects.length(); i++) + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->TranslateVector( myObjects[i], myVector ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; + break; + } + } + + return res; +} + + +//================================================================================= +// function : closeEvent +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e ) +{ + // myGeomGUI->SetState( -1 ); + GEOMBase_Skeleton::closeEvent( e ); +} + + +//================================================================================= +// function : CreateCopyModeChanged() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy) +{ + GroupBoxName->setEnabled(isCreateCopy); +}